Difference Summation Module
The module is a hybrid of the Counter and Integrator modules, in which the Source input is numeric, rather than a pulse, and, unlike the Integrator, elapsed time is not used in the calculation. The Delta value does not get calculated until there is a valid Previous Source value. There will not be a valid Previous Source value until the Source input has been read twice. The Source and Previous Source values are used to calculate the Delta and the Delta is then used to calculate the Summation output register as follows:
Delta = Source - Previous Source
Summation = previous Summation + Delta
If the Source RollValue input is linked, the Source RollValue input will be used to determine Rollover value of the Source input as described in the case below:
If the Source RollValue input is linked and Abs(Source) < Abs(Previous Source), Delta = (Source + Source RollValue) - Previous Source.
If the Source RollValue input is not linked, the calculation will proceed as described previously.
When the module is first created, the Summation, Previous Source and Delta output registers will all remain at 0 until two iterations of the module operate function.
This input is the value that is monitored for changes. It must be linked to a numeric output register of another module. Linking this input is mandatory.
This input is used to accommodate Source input rollovers. It is designed to be linked to the RollValue setup register of the module used for the Source input. If this input is linked, it will be used to calculate the Delta (and thus the Summation output register value) as follows:
If Abs(Previous Source + Source RollValue) > Deadband,
Delta = (Source + Source RollValue) - Previous Source
When this input is off, the Summation output register does not update. The Delta and Previous Source do continue to update, and when the module is re-enabled, the Summation output will update immediately based on the next change in the Source input. This module is enabled by default.
When this input is pulsed, all output registers are set to zero. The next update will occur after two operate cycles, when Previous Source and Delta can be determined.
When the Summation output register reaches the value specified the RollValue setup register, the Summation output register will rollover (be set to zero). Setting this register to zero disables the rollover feature (no rollovers will occur).
The Deadband setup register allows the user to set a deadband to accommodate source jitter and prevent detection of spurious source rollovers. A source rollover will only be detected if the source values moves backwards by an amount greater then the Deadband setup register.
This numeric register contains the result of the summation of the changes in value at the Source input. If the current Source input is less than the Previous Source value, and the Source RollValue input is linked, the value at the Source RollValue input is added to the current Source input value before calculating the Delta. The Summation will rollover (reset to zero) if the value in the RollValue setup register is reached.
This numeric register contains the previous value detected at the Source input.
This numeric register contains the difference between the current Source input and the Previous Source output register.
This register generates a pulse every time the Summation register reaches the value specified in the RollValue setup register.
Any events generated by the Difference Summation module are recorded in the Event register. Possible events and their associated priority numbers are shown in the table below.
|Event priority group||Priority||Description|
|Reset||5||A module reset has occurred.|
|Setup Change||10||Input links, setup registers or labels have changed.|
The Event output register stores the following information for each ION event: time stamp, priority, cause, effect, and any values or conditions associated with the cause and effect.
Responses to special conditions
The following table summarizes how the Difference Summation module behaves under different conditions.
|Condition||Response of output registers|
|Input not available||Summation stops; Summation, Previous Source, Delta outputs hold current values. When input becomes available, module carries on normally.|
|Enable input is off||Everything but the Summation output continues to update. When turned back on, carry on based on new Source and current Previous Source, which has continued to update while Summation was off.|
|Reset input is pulsed||All outputs are set to zero. Module will require two readings at the Source input before the output registers are updated.|
|RollValue is reached||Summation output register resets to zero. Rollover output register pulses.|
|Module is re-linked or setup registers changed||Same as a Reset|
|Virtual Processor is restarted||Output registers retain the values they had at shutdown. On startup, Previous Source is assigned Previous Source + Delta. First new Summation will be based on this as Previous Source value.|
Detailed module operation
The Source input is read once and then again to obtain a value for Previous Source. The Source and Previous Source values are used to calculate the Delta and the Delta is used to calculate the Summation as follows:
Delta = Source - Previous Source
Summation = previous Summation + Delta
The Source RollValue input will be used to determine Rollover value of the Source input as described in the case below:
If the Source RollValue input is linked and Abs(Source) < Abs(Previous Source), Delta = (Source + Source RollValue) - Previous Source. If the Source RollValue input is not linked, the calculation will proceed normally.
No value will appear in the Summation or Delta output registers until two iterations of the module operate function.
Summation, Delta and Previous Source all appear as output registers. These output registers all hold their values at shutdown.
When the Summation output register reaches the value specified by the RollValue setup register, the Summation output register will be set to zero and the Rollover output register will pulse. If RollValue is set to zero, no rollovers will occur.
Reaching the RollValue - When the RollValue is reached exactly, the Summation output register will go to zero and the Rollover output register will pulse.
Overshooting the RollValue by Less Than RollValue - If the RollValue is exceeded by less than RollValue, the excess is written to the Summation output register and the Rollover output register will pulse.
Overshooting the RollValue by More Than RollValue - If the RollValue is exceeded by more than RollValue, Delta mod RollValue is written to the Summation output register. The Rollover output register will pulse Delta/RollValue times.
Reset will function independently of the state of Enable input.
Consider the case in which an energy quantity, provided by pulses from an external source, must be allocated in real-time between two tariffs, On Peak and Off Peak. The following framework uses the Difference Summation module to implement a solution.
In this framework, the Counter module converts input pulses into the energy quantity of interest. The Scheduler module dictates which of the two tariffs is active - On Peak or Off Peak. The Difference Summation modules are used to allocate the energy quantity between the tariffs.
The Counter module Accumulatr output register, which holds the energy quantity, is linked to the Source input for each Difference Summation module. The Scheduler module output that corresponds to the On Peak condition is linked to the Enable input of On Peak Difference Summation module and the output that corresponds to the Off Peak condition is linked to the Enable input of the Off Peak Difference Summation module.
Under this configuration, the Summation output register of the On Peak Difference Summation module is updated according to the source energy quantity when the On Peak condition is true. Likewise, Summation output register of the Off Peak Difference Summation module is updated when the Off Peak condition is true.