# Main Parameter

Navigation: Valve Firmware > Sequencer > # Main Parameter |

Run - The main control that activates and deactivates the sequence running.

State – The main state (read-only) that tells in which stage is the sequence running now: IDLE, RUNNING, STOPPING, STOPPED, FINISHED, TIMEOUT or ERROR.

Starting Command – This parameter defines at which command in the sequence the execution starts at beginning.

Current command – Currently executing command or the last executed command in case a delay is going on.

Pre-Cycle Commands – String that lists all commands executed before the loop (cycle) if any.

Cycle commands – String that lists commands executed in a loop, if any.

Target Cycles - Number of cycles that the sequence need to pass before it reaches the state FINISHED.

Target Time – Number of seconds that the sequence need to run before it goes to state FINISHED.

Cycle Counter – Number of executed cycles. Depending on “Saving Mode” parameter, it might be stored in memory.

Cycle time – Number of seconds that tells how long is current cycle running.

Running Time – Total sequence execution time. Depending on “Saving Mode” parameter, it might be stored in memory.

Controlword Bitmap – This bit-field controls more parameters at once It supports controlling the valve over EtherCAT. Bit 0 with it rising edge (from 0 to 1) makes the parameter “Run” to be TRUE. Bit 1 makes the same parameter “Run” to be FALSE, regardless of its rising edge. In addition, it has higher priority than the bit 0, which means, as long as the bit 1 is high, the sequencer will never run. Bit 2 makes “Cycle Counter” zero whenever its transition from 0 to 1 happens (rising edge).

## Section “Settings”

Run From State Stopped – This is relevant only in case the sequence is in state stopped. The parameter defines how the sequence will starts again. Possibilities are to continue with the next command or to start the whole sequence from the beginning again with or without the pre-cycle. If not, the first command will be the beginning of the loop (cycle).

Automatic Run After Restart – In case an external restart (power cycle) or an internal one (restart command) happens; here we define if we want automatically to continue the sequence run, once the controller has power supply again. Optionally, the pre-cycles can be included.

Stop At Command Error – Each command internally receives a feedback that may be an error report. If this happens, for whatever reason, here we define whether the sequencer stops (and goes to state ERROR) or not.

Command Timeout – In case that some command execution takes too long, here we define how long the sequencer will wait. Once this timeout is been reached, the sequencer will act according the following parameter “Command Timeout Action”: stop or proceed to the next command.

Command Timeout Action – Here is defined what happens in case the timeout has been reached. Option “Stop” will bring the sequencer in state “Timeout”. Option “Next Command” executes the next command (if any) after the timeout.

Saving Mode – In case the sequencer is running for a long time we might need to store the counter (cycles or time) in the non-volatile memory. «Saving Mode» defines whether the controller periodically stores elapsed time or number of already finished cycles in memory. In this way, the sequencer will continue counting after any kind of interruption. There are three options for saving: time, cycles, or nothing
Saving Cycle period and Saving Time Period – Depending on the previous parameter, here we define the saving period (how often the parameters will be saved). For example, if it is selected “Saving Cycle period” to be 100, and a system restart happens at the cycle number 294, the “Cycle counter” will have stored value 200, because it is the biggest number that is multiplication of 100 and less than 294. The current cycle number is sometimes additionally stored in memory after stopping and starting, regardless of the defined periods.

## Section “Commands”

Function – For each command in the sequence this parameter defines the function. There are eight options: Parameter ID, Open, Close, Position, Pressure, Learn, Homing and Time Delay. Depending on selected function, the rest of parameters might be irrelevant. For example, Open and Close functions don’t depend on the parameter Value.

Parameter ID and Parameter ID [hex] explicitly define which parameter is being controlled in case the function “[Parameter ID]” has been selected.

Value – The value feeds different functions with position, pressure, etc.

Delay/Tolerance – This parameter has several purposes, depending on its value.
If it is positive, it defines a delay that the sequencer will wait until it starts execution of the next command in a sequence.
If it is equal to -1, it means that next command, if any, will be executed only when the current command reaches its goal: “Open” and “Position” reach the final positions, Homing is done, Target Pressure is achieved etc.
If it is negative, bug greater than -1, it will define the percentage tolerance of the given target Position or Pressure. For example -0.1 represents 10%, -0.25 represents 25% of the full scale etc. If a command’s function is position with the target of 73 (out of 100), and the tolerance is -0.2 (20%), the goal will be achieved as soon as position reaches the range between 73 – 0.2 x 100 and 73 + 0.2 x 100, which is [53, 93]. Therefore, the next command will execute earlier comparing to the case with tolerance 0. This range has no effect on functions other than pressure and position.

Next command – It defines the following command. It can even be the same command, or some that is already been executed. Changing of these connections between commands directly updates the order of the commands execution.

## Example

In the following example is described how the sequencer via CPA can be set to periodically run following 6 commands:

Command | 1 | 2 | 3 | 4 | 5 | 6
Function | open | position | position | open | pressure | Open
Value | / | 20% | 70% | / | 3 Torr | /
Delay | 2s | 0.2s | 0.2s | 2s | 5s | 2s

Commands need to be defined with all their fields, as shown in following snapshots:

Commands 1, 4 and 6:

Command 2

Command 3

Command 5