SettlingStateMachine

settlingstatemachine mask

Settling state machine mask

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.

settling behavior

Settling at the end of a move.

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 during SettlingInsideEnvelopeTime. If this condition is satisfied, the state machine transitions to the Stabilizing state. If the condition is not satisfied after the period SettlingTimeout the state machine transitions to the Timeout state. Note that during the settling period, the state machine may be in either the OutsideEnvelope or InsideEnvelope state.

    • The settling can be skipped by setting SettlingInsideEnvelopeTime to zero, to clear IsSettlingEnabled.

  • 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 clear IsStabilizingEnabled.

The state machine is defined as follows:

SettlingStateMachine statemachine

The state machine is used to track the settling behavior.

In this diagram:

  • IsSettlingEnabled is true when SettlingInsideEnvelopeTime is non-zero, and false otherwise. Note that when SettlingInsideEnvelopeTime is zero, the SettlingEnvelope is ignored.

  • IsStabilizingEnabled is true when StabilizingTime is non-zero, and false otherwise.

The states and transitions are further explained in the table below:

StatesAndTransitions

State

Name

Description

0

Moving

A move command is being executed, i.e., the position setpoint is changing. This state is entered if the InPosition input is false. The state is left when InPosition becomes true. The IsMoving output port is set.

OnEntry

The SettlingComplete and StabilizingComplete events are reset.

OnExit

The settling inside envelope time, settling duration and stabilizing time timers are reset.

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 SettlingEnvelope. The IsMoving output port is set.

OnEntry

The settling inside envelope time timer is reset.

OnUpdate

The settling duration timer is incrementing.

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 SettlingEnvelope. The IsMoving output port is set.

OnUpdate

The settling inside envelope time and settling duration timers are incrementing.

3

Stabilizing

The control system is settled and is now stabilizing. When entering the stabilizing time, the state remains active for the configured duration StabilizingTime. After this duration, the settling state reaches Idle. The IsMoving output port is cleared.

OnEntry

The SettlingComplete and StabilizingComplete events are reset.

OnExit

The settling inside envelope time, settling duration and stabilizing time timers are reset.

4

Idle

This is the start / end point. The setpoint is stationary and the tracking error is considered to be settled and stabilized. The IsMoving output port is cleared.

OnEntry

The SettlingComplete and StabilizingComplete events are set and the SettlingTimeoutExceeded event is reset.

5

Timeout

Settling timeout exceeded. The state is left after one cycle. The IsMoving output port is cleared.

OnEntry

The SettlingTimeoutExceeded, SettlingComplete and StabilizingComplete events are set.

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

SettlingStateMachine dialog

SettlingStateMachine dialog.

Settling envelope

The SettlingEnvelope parameter specifies an envelope in which the tracking error must remain after reaching the trajectory state InPosition for SettlingInsideEnvelopeTime 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 the SettlingEnvelope bounds during the settling phase. When the SettlingInsideEnvelopeTime is set to zero, the settling phase is skipped, and the SettlingEnvelope 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 to Timeout. The timeout is disabled by setting Timeout 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 state Idle. When the StabilizingTime 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.