Standard States
Every Unit within the Zeugwerk Framework template by default comes with a standardized statemachine. This statemachine utilies five active states are linked to a Sequence.
- Booting initial state that each unit is in after activating the PLC. This state is used for getting the unit's equipment ready to work. To be specific, the fieldbus parameters are written and stuff similar to this.
- GoHome this state is used for referencing the unit, such that it is in a safe, definied state.
- Automatic the unit is performing its main purpose, i.e. move something from A to B.
- Stop this state stops the unit in a fast, controlled fashion. It is interrupting any state, even other active ones.
- FaultReaction this state is used for a fast, controlled stop of the unit that is interrupting any state, even active states. In contrast to the Stop states, this state does should not wait for any subobject that is stopped while the unit is in this state. If the the sequence of this state is aborted, the unit directly transitions into Fault, this however should usually be avoided by ignoring potential errors that are popping up in this state.
If a sequence in a state has finished, it the statemachine performs a transition into one of the following non active states. For a detailed transition diagram see State diagram.
- Init [non-active] state after the boot process has finished. Units, if not explicitly configured differently, wait in this state until the machine operator references the machine by hoping it.
- Idle [non-active] this state indicated that the unit is read to work, but it is waiting for an instruction by the machine operator or another unit that controls this one.
- Stopped [non-active] after the unit gets out of its Stop state, it directly transitions to the stop state. Indicating that the stop process has finished.
- Fault [non-active] after the unit gets out of its FaultReaction state, it directly transitions to the Fault state. Indicating that the FaultReaction process has finished.
Practical example
To provide a clearer explanation of this state machine, let's work through a practical example of a production system.
- When we switch on a production system, it is booting and this is done by the
Boot
State transition (booting sequence). Usually booting is done automatically, but the developer is able to add here some custom steps that have to be done (e.g. parameterizing equipment). - After booting is done, the production system is in the init state. From this state there is only one transition allowed which is to idle state by running
Homing
(homing sequence). This is usually initiated by a machine operator by pressing a homing button (of cource beforehand the safety environment has to be ok and all infrastructural components have to be ready). TheHoming
sequence brings the production system in a production ready state from which it can be started. - After homing is finished, the production system is in the idle state. Now we can start the production system by pressing a start button or something similar and we run the
Automatic
sequence which is doing the production process itself.
These are the first 3 steps which are pretty straight forward on a production system. Lets now assume there is a problem in the automatic sequence and the machine stops:
- If an error occurs the machine has to stop to prevent damage on its components. So the automatic sequence gets interrupted and the
FaultReaction
sequence is started. There are all those tasks done like stopping axes, stopping actuators, reseting valves, error light is blinking and so on. After this sequence is finished we are inFault
state - If the problem is fixed by the operator, the production system is still in this aborted automatic state. To restart, usually there have to be some steps to be done. This is again done by the
Homing
sequence which is started by the operator and when finished, a transition to idle state is done. - Last but not least, the operator can start the production system again by pressing a start button which leads to a transition from idle state to automatic and running the
Automatic
sequence.
A third and last important step is, stopping the machine without any occuring error. This is similar to the fault reaction behavior, but here the Stop
sequence is running and doing all this tasks like stopping axes, stopping actuators and so on. Again by starting homing we get back to idle and after that we can start the system again.
How to use standard states
The easiest way to learn how to use sequences of the standard states is to go through our pre implemented Quickstart Tutorial. Here we have the 4 major states (automatic, homing, stop and faultreaction) implemented. Try to implement some additional steps to the Quickstart Tutorial in automatic sequence to understand when and why these are executed.