SettlingStateMachine¶
The SettlingStateMachine block implements the state machine that generates events compatible with the move command completion criterion.
When executing moves, the actual position of the system will never exactly match the position setpoint of the trajectory generator. The function of the control loop is to keep this tracking error as small as possible. When a move is finished, it can take some time for the tracking error to stabilize and settle. PMP defines two different phases: settling (based on a fixed envelope) and stabilization (based on a fixed time).
This Simulink® block quantifies the behavior during this settling and stabilization.
Hint
The SettlingComplete
, StabilizingComplete
and SettlingTimeoutExceeded
output ports can be connected to the Event Output block, such that the events can be coupled to e.g. an EventResponse
in PMP.
Implementation¶
State machine¶
The settling behavior is defined in two phases:
- Settling phase:
The settling phase waits for the tracking error to stay within the
SettlingEnvelope
duringSettlingInsideEnvelopeTime
. If this condition is satisfied, the state machine transitions to theStabilizing
state. If the condition is not satisfied after the periodSettlingTimeout
the state machine transitions to theTimeout
state. Note that during the settling period, the state machine may be in either theOutsideEnvelope
orInsideEnvelope
state.The settling can be skipped by setting
SettlingInsideEnvelopeTime
to zero, to clearIsSettlingEnabled
.
- Stabilizing phase:
The stabilizing phase is a fixed time period after the settling phase.
The stabilizing phase can be skipped by setting
StabilizingTime
to zero, to clearIsStabilizingEnabled
.
The state machine is defined as follows:
In this diagram:
IsSettlingEnabled
is true whenSettlingInsideEnvelopeTime
is non-zero, and false otherwise. Note that whenSettlingInsideEnvelopeTime
is zero, theSettlingEnvelope
is ignored.IsStabilizingEnabled
is true whenStabilizingTime
is non-zero, and false otherwise.
The states and transitions are further explained in the table below:
State |
Name |
Description |
---|---|---|
0 |
Moving |
A move command is being executed, i.e., the position setpoint is changing. This state is entered if the
|
1 |
OutsideEnvelope |
The move has finished, i.e., the setpoint has become stationary. The control system is settling and the tracking error is outside of the configured
|
2 |
InsideEnvelope |
The move has finished, i.e., the setpoint has become stationary. The control system is settling and the tracking error is inside of the configured
|
3 |
Stabilizing |
The control system is settled and is now stabilizing. When entering the stabilizing time, the state remains active for the configured duration
|
4 |
Idle |
This is the start / end point. The setpoint is stationary and the tracking error is considered to be settled and stabilized. The
|
5 |
Timeout |
Settling timeout exceeded. The state is left after one cycle. The
|
Motion activity¶
In many applications, it makes sense to split the behavior of either a controller or a related component based on the motion activity state. Two motion activity states are defined by this Simulink® block:
- Moving
Active during the following settling states: Moving, OutsideEnvelope and InsideEnvelope
- Idling
Active during the following settling states: Stabilizing, Idle and Timeout
The boolean IsMoving
output is used to distinguish these activity states.
Hint
It is good practice to monitor the tracking error and control output and to issue a warning or error when certain bounds are exceeded. The values of these bounds can be set based on the motion activity state:
A bound for when the system is idle. This bound is generally tighter since the end position of the actuator should be precise.
A bound for when the system is moving. Generally, this bound is more relaxed, since the exact position during movement is less important. Additionally, it is more difficult to obtain a small tracking error during movement due to unmodeled plant behavior and external disturbances.
Parameters and Dialog Box¶
- Settling envelope
The
SettlingEnvelope
parameter specifies an envelope in which the tracking error must remain after reaching the trajectory stateInPosition
forSettlingInsideEnvelopeTime
amount of time before it is considered settled. The parameter defines the peak-peak envelop, e.g., only tracking errors in the range [-0.5, 0.5] are considered to be inside the envelop for a settling envelope of 1. The unit of the parameter is equal to the unit of the tracking error.
- Settling inside envelope time
The
SettlingInsideEnvelopeTime
parameter specifies the time duration that the tracking error must remain within theSettlingEnvelope
bounds during the settling phase. When theSettlingInsideEnvelopeTime
is set to zero, the settling phase is skipped, and theSettlingEnvelope
is ignored. The unit of the parameter is [s].- Settling timeout
The
SettlingTimeout
parameter specifies the maximum duration of the settling phase. If the timeout is exceeded, the settling state machine will transition toTimeout
. The timeout is disabled by settingTimeout
to zero. The unit of the parameter is [s].- Stabilizing time
The
StabilizingTime
parameter specifies the duration of the stabilizing phase. After the duration has ended, the settling state machine will transition to stateIdle
. When theStabilizingTime
is zero, the stabilizing phase is skipped. The unit of the parameter is [s].
Data Type Support¶
All input ports support any scalar data type.
All dialog parameters must be of type single
.