State Machine Concepts
From ECCWiki
[edit] What is a State Machine?
The BCS controller uses the concept of "State Machines" to program control sequences. State Machines are simply a way to abstract control rules into something that the controller can process. For example, say you want turn on an output. This would be a single state, depicted by the diagram below. States can be thought of as points in time where a certain set of outputs are asserted.
Now say that we want to assert Output1 for 3 seconds, and then turn it off for 1 second, and repeat. We now have 2 states, one for Output1=ON, and one for Ouput1=OFF. Why do we have two states? Because now there are two points in time where the outputs are uniquely asserted.
By adding the second state, we've also introduced the concept of an "Exit Condition". This is an event that triggers a state change, and it occurs when an input matches a preset condition. In our example, the exit condition would be "Goto State1 when Timer=0". We also have an exit condition for State1, which is "Goto State0 when Timer=0".
Next we'll introduce the concept of "Processes". A Process is simply running a state machine. It can be thought of as an initial state. All outputs are deasserted when the Process is off. When the Process is enabled, the State Machine starts in State0, and progresses based upon the rules that have been programmed.
We've just created a 75% duty cycle output. This is a basic example of how to program the controller. The BCS-460 allows up to eight active Processes, each process with up to eight States, and each state up to four Exit Conditions. Exit conditions can be triggered by a temperature reading, a timer value, a user input, or a discrete input (switch). Outputs can be asserted directly in a State (On/Off), by variable duty cycle, or they can be controlled Differentially or by PID control. Each state can assert any or all of outputs uniquely. In addition to allowing Processes control Outputs automatically, users are also able to control the Outputs manually via the web interface.



