Recipe Example
This page describes an application example using the Sequence Manager to provide control of a variable speed pump.
Situation
A customer wanted a pump to be managed in a specific way to optimize system performance. He wanted a sequence as follows:
- When demand occurs, start at a user-defined low speed and ramp slowly to full speed.
- Stay at full speed for five minutes.
- Ramp down to a different user-defined speed.
- Stay at that speed until demand is satisfied.
The Vesta rule engine is not well suited to managing this kind of sequence. It’s possible, but the resulting variables and rules would be complicated and hard to understand.
The Vesta Sequence Manager is designed for exactly this situation: a sequence of steps with different operating conditions for each, and defined criteria for transitioning between steps. This application example describes the process of meeting the customer’s requirements using the Sequence Manager.
Approach
There is an analog output named ‘Pump Speed’ that drives the pump. It’s value is in percent. We need to provide values for this output, ramping it up and down and holding it at different fixed values.
Ramping Output
The easiest way to ramp an output with the Vesta is to have a math rule that adds an increment (or decrement) to the output every rule engine cycle. We’ll use a variable named ‘Ramp Increment’ to hold the increment value, which can be positive, negative, or zero. In this case the Sequence Manager will set the increment value depending on the phase.
Phases
There are five phases including the default phase 0. Each phase has defined criteria for transitioning to the next phase.
- Pump off, no demand
- Transition to phase 1 when there’s a demand for the pump
- Ramp up to full speed
- Transition to phase 2 when full speed is reached
- Hold at full speed
- Transition to phase 3 after five minutes
- Ramp down to low speed
- Transition to phase 4 when chosen low speed is reached
- Hold at low speed
- Transition to phase 0 when there is no longer demand for the pump
It’s also possible that pump demand could go away during any phase. In that case, we want to ramp down, then stop. We’ll add transitions from phases 1 and 2 that go directly to phase 3 if the pump is no longer needed.
Variables
In addition to the ramp increment variable mentioned above, the Sequence Manager requires two variables: an ‘enable’ variable that allows it to be active, and a ‘phase’ variable to hold the current phase. In this case pump control should always be enabled, so we can choose the system 'TRUE' data element as our 'enable' element.
We’ll also need a state variable to tell the Sequence Manger when the pump is needed.
Finally, we’ll need a timer variable for the full speed phase. Here’s the complete list of Vesta data elements required for this application:
Name | Type | Purpose |
---|---|---|
Pump Speed | Analog Output | Vesta output that controls pump speed |
TRUE | System Constant | Keeps the Sequence Manager always enabled |
Pump Demand | State Variable | Tells the Sequence Manager that the pump is needed |
Pump Phase | Variable | Current phase in the sequence |
Ramp Increment | Variable | Amount to change the speed each rule cycle |
Pump Timer | Variable | Timer for the five minutes at full speed |
Vesta Rules
We need two Vesta rules: One to increment the output, and one for the timer variable. Here they are:
Set Pump Speed to Pump Speed plus Ramp Increment
Set Pump Timer for 0.0 seconds when Pump Timer is false
The timer rule doesn’t do anything, but it is required to tell the rule engine that ‘Pump Timer’ is a timer variable that should count down.
Recipe
The recipe for this application has a data header and five phases. This is the actual recipe as displayed by the 'List' button, with explanations for each section.
Recipe Data Header
Recipe Data: Name: Pump Ramps File Name: pumpramp.json Enable Variable: TRUE Phase Variable: Pump Demand First Phase: Not Active
This is all standard Sequence Manager data. Note the use of the 'TRUE' systrem constant as the enable variable.
Phase 0
Phase 0: 'Not Active' When this phase starts: Set Pump Speed to 0 Set Ramp Increment to 0 Exit Path: 'Ramp Up' If Pump Demand EQ 1 Set Pump Phase to 'Ramp Up'
This is the default inactive phase. This is the starting point and ending point. In this phase, the pump is off and the increment is zero. The only transition from this phase is to ‘Ramp Up’ when there’s demand for the pump.
Phase 1
Phase 1: 'Ramp Up' When this phase starts: Set Pump Speed to 20 Set Ramp Increment to 0.5 Exit Path: 'Full Speed' If Pump Speed GT 98 Set Pump Phase to 'Full Speed' Set Ramp Increment to 0 Exit Path: 'No Demand' If Pump Demand EQ 0 Set Pump Phase to 'Ramp Down'
Here we set the pump speed to 20% at first, and set the ramp increment to a positive value. This will result in the pump speed incrementing due to the rule that we created earlier. When we’re very close to full speed, we set the ramp increment to zero and go to the ‘Full Speed’ phase. If there’s no demand, we jump to the ‘Ramp Down’ phase.
Phase 2
Phase 2: 'Full Speed' When this phase starts: Set Pump Speed to 100 Set Pump Timer to 300 Exit Path: 'Ramp Down' If Pump Timer EQ 0 Set Pump Phase to 'Ramp Down' Exit Path: 'No Demand' If Pump Demand EQ 0 Set Pump Phase to 'Ramp Down'
When this phase starts we set the speed to 100% and set the timer for 300 seconds (five minutes). The normal exit happens when the timer counts down to zero and we go to the ‘Ramp Down’ phase. If pump demand goes away, we jump immediately to ‘Ramp Down’ regardless of the timer.
Phase 3
Phase 3: 'Ramp Down' When this phase starts: Set Ramp Increment to -0.5 Exit Path: 'Low Speed' If Pump Speed LT 50 Set Pump Phase to 'Low Speed'
Here we set the ramp increment to a negative value so that the output will decrement. Our target low speed in this case is 50%, and we’ll exit when the output reaches this value. We use ‘Less Than’ in case the value is never exactly equal to 50%. We’ll exit with a value slightly less than 50%.
Phase 4
Phase 4: 'Low Speed' When this phase starts: Set Ramp Increment to 0 Set Pump Speed to 50 Exit Path: 'Normal Exit' If Pump Demand EQ 0 Set Pump Phase to 'Not Active'
In this phase we set the speed to the desired value (it was a bit less on entry). This phase continues until there’s no demand for the pump, at which time it transitions to Phase 0. Note that if there’s no demand when this phase begins, it will transition immediately.
Discussion
In this example the 'low' speed (50%) is embedded into the recipe, so that changing it's value would require editing the recipe. It would also be possible to use a variable to hold this value. However, the Sequence Manager does not support variables as the second argument to actions or exit criteria. For instance, even if you have a variable named 'Slow' with a value of 50, you can't have an action like this:
Set Pump Speed to Slow
It's possible to have a state variable that's set by the Sequence Manager, and then use a standard rule to actually set the value. For instance, create a state variable called 'Force Slow Speed'. You can then create a Sequence Manager action and standard rule like these:
Sequence Manager action: Set Set Slow Speed to 1
Standard Rule: Set Pump Speed to Slow when Force Slow Speed is true
Of course, the Sequence Manager would need to set 'Force Slow Speed' back to false at some point.