Stage Driver

The input pins to this function block are n stages active (Number of active stages) and runtimeReset (Stage number runtime to be reset to 0). The output pin is Stage1 (on/off). The StageDriverMaster function takes input number of stages active and determines which stages to energize or de energize based on the lead/lag strategy chosen. Stage Driver works with StageDriverAdd to distribute additional stages above those provided in Stage Driver. Stage Driver also maintains a nonvolatile runtime total and digital stage status information for each stage.

The configuration tool sets a runtime and stage stages offset in a single offsets variable. The offsets variable is not used as a Public Variable ID. The lower byte   stores the offset in digital memory to reference the starting stage status memory index, and the upper byte stores the offset in nonvolatile memory to reference the starting runtime memory index. stgStatusOut is the offset to digital stage status that is used by connected StageDriverAdd blocks.

As more stages are set up during design, the configuration tool calculates the starting address for both stage status and runtime and allocate the memory and calculate the offset from the base index that is the starting address for the runtime area and the stage status area in their respective memories.

The stage status information is accessible to drive additional stages. The StageDriverAdd function blocks are use to drive stages above those provided in Stage Driver up to 255 stages.

Analog Inputs

Range
Input Name Low High Input Value Description
nStagesActive 0 255 unconnected Stages all off
invalid Stages all off
runtimeReset 0 255 unconnected No action to reset. runtime can accumulate
Invalid No action. runtime can accumulate
Value = 0 No action. runtime can accumulate
1<=VAL<=255 Stage runtime for stage VAL is reset to 0. runtime for this stage does not accumulate, you must reset VAL to 0 to allow accumulation of runtime.

Outputs

Range
Output Name Low High Description
Stage1 0 1 Stage 1 output
Stage2 0 1 Stage 2 output
Stage3 0 1 Stage 3 output
Stage4 0 1 Stage 4 output
Stage5 0 1 Stage 5 output
stgStatusOut Output value to connect to StageDriverAdd block. The floating number must be converted to an integer and then converted to a 2 byte value. The upper byte (value right shifted 8 bits) is the maxStgs info and the lower byte(value AND 0xFF) is the stageStatus offset to reference the starting location in digital memory for the stageStatus bytes.
offset Float value has two components after conversion to a two byte unsigned integer value the upper byte is offset of number of nonvolatile entries to get to the start of the stage runtime storage (used only for leadLag=LL-RUNEQ) and the lower byte is the offset of number of digital memory locations to the start of the stage status bytes (one byte allocated per 8 stages assigned in maxStgs)

Configuration

Specify the maximum number of stages (maxStgs) from 1 to 255.

Specify the lead lag (leadlag)

If the leadlag is outside of the range of 0 - 2 then stages are initialized to off and not commanded.

Inputs

nStagesActive is the input number of stages to be distributed to on/off values to individual stages.

runtimeReset is the stage number runtime to be reset to 0 if the lead-lag parameter is set to LL RUNTIME. 0 or unconnected results in no reset occurring. This value must be returned to 0 to allow the reset stage number to resume counting. Only valid if leadLag is set to LL RUNTIME. The stage runtime values are only allocated and updated if the leadLag config is set to LL RUNTIME. The runtime for each stage is stored as a floating point number in intervals of 1 minute.

The stages are sampled once a minute and if the stage is on, then the stage runtime accumulator number for that stage is incremented by one minute. The range of values for an integer number stored as a float is from -16,777,216 to 16,777,216. If the runtime is stored in minutes starting at 0 to 16,777,216, then the range of runtime is from 0 to 31.92 years of runtime.

Outputs

Stage1, stage2, stage3, stage4, and stage5 are individual outputs that represent on or off values. These are outputs that are turned on in different order depending on the leadLag strategy.

stgStatusOut is connected from StageDriver to the StageDriverAdd block and gives a floating point number combined to hold two pieces of information, offset in the Common Memory to the StageBitStatus values and maximum number of stages available. This information is used by the StageDriverAdd to find the correct offset to command which stages to turn on or off. The floating value can be converted to an integer and ANDed with 0xFF and it gives the value of the stageStatus Offset. The floating value stgStatusOut converted to an integer and right shifted 8 bits gives the byte value of the maxStages. These values are needed to allow the StageDriverAdd to work properly. The values in stgStatusOut are created by the StageDriver stage and no tool calculation is required.

Offsets store the public Variable ID to a float a value created by the tool to allocate storage memory and reference for stage status in digital memory and stage runtime in nonvolatile memory. There are two offsets stored inside the float value, one for runtime, and one for stage status. The offset float value right shifted 8 bits gives the number of nonvolatile float values from the beginning nonvolatile index (offset) where the runtime values are stored (one runtime value offset for each stage configured), and the offset ANDED with 0xff gives the number of digital values from the base where the stagestatus is stored (one byte per up to 8 stages configured). Each digital memory location takes up 1 byte storage in calculating the offset.

Example

If three nonvolatiles were already assigned and four digital outputs were already assigned before adding a stagedriver stage of nine stages with runtime accumulation, then the offset float value would be 256(3) + 4 = 772.0.

That means the tool would have 8 nonvolatile runtime locations starting at offset 3 from the base of nonvolatile memory and the tool would allocate digital memory of two bytes for the stage status starting at offset of 4 from the base of digital memory. The tool sets this float value for offsets and allocates the memory, and then stagedriver uses this information to know where to look for stagestatus and stage runtime information.

The Float value that stores Offsets is composed of two values

offsetStageRuntimer (byte)

The float value converted to an integer and shifted 8 bits specifies the variable quantity offset to be applied to the beginning of nonvolatile memory variable number that indicates the starting variable number used to store the individual stage runtime values. This number is calculated by the configuration tool and is not changeable.

offsetStageStatus (byte)

The float value converted to an integer and anded with 0xFF specifies the variable number offset to be applied to the beginning of digital memory area that indicates the starting variable number used to store the individual stage on/off values. This number is calculated by the configuration tool and is not changeable. This value is exported to other stages through the stageBitStatus output.

Parameters

leadLag (Byte param:UBYTE) specifies whether the staging strategy should be:

Runtime Accumulation selection requires the tool to allocate Nonvolatile memory and Set the Offsets value.

Example

In a boiler control system configured for a maximum stages of 4, LL STD takes the number of stages active and activate the stages in the following order, stage 1 on, then stage1 and stage 2 on, then stage 1 on stage2 on stage3 on , then stage 1 on stage2 on stage3 on and stage 4 on. When one stage is removed then it is stage 1 on stage 2 on stage 3 on. If one more stage is removed then it is stage 1 on stage 2 on. If one more stage is removed then stage 1 on , and finally if one more stage is removed then there is only one stage on. And finally if one more stage is removed then no stages are on. Stage 1 always comes on first and is always the last stage to turn off.

If we take this same example and implement it as a LL FOFO which is rotating or First on first off, then the boiler keeps track of where the starting stage is from the last cycle. Say for example there are no stages on and a stage is added. Then adding one stage turns on stage1. If another stage is added, then stage1 is on and stage2 is on. If one more stage is added then stage1 is on stage2 on and stage 3 is on. Now lets say that the number of stages goes from 3 to 2 so now it is time to remove a stage. Because of LL FOFO, the first stage we turned on is the first stage to turn off so stage 1 would go off and only stage 2 and stage 3 would be on. Then if you were to turn off one more stage then stage 2 would go off and only stage 3 would be on. Now if you added one more stage, stage 4 would turn on in addition to stage 3. If One more stage were added (numstages = 3) then stage 3 is on, stage 4 is on, and now stage 1 turns on too.

For a final example, let us take the example of LL RUNTEQ for a sequence. Each stage now has a runtime accumulation in minutes. So let us assume that all 4 stages turn on for 12 minutes. Each stage for stage1, stage2, stage3, and stage 4 is on and accumulates 12 minutes of runtime. Now it is time to turn off one stage so all the ON stages are evaluated for the highest runtime and since they are all the same, the last stage that is on that is evaluated has the highest runtime so stage 4 is turned off so stage 1 on stage2 on and stage3 = on. Now let us run the boilers for 2 more minutes. Now stage 1 has 14 minutes runtime, stage 2 has 14 minutes runtime, stage 3 has 14 minutes runtime, and stage 4 has 12 minutes runtime. Now the number of stages requested drops to 2 stages so stage 3 is turned off and now stage 1 on, stage 2 on , stage 3 off, and stage 4 off. So now the boilers are run for 2 more minutes. The runtimes are now stage 1 on = 16 minutes, stage 2 on =16 minutes, stage 3 = off =14 minutes, and stage 4 = off = 12 minutes. Now let us add one more stage so number of stages goes from 2 to 3. Now all the stages that are off are evaluated for lowest runtime. Stage 4 has the lowest runtime of 12 minutes so now stage 4 is turned on.

maxStages (Byte param:UBYTE) specifies how many total stages nStagesActive can reach. MaxStages can go up to a total of 255 stages.

Note: Due to limitations of Niagara, only 95 stages can be seen on the wiresheet. To see, say stage number 200, do one of the following: