PlantSecondOrderMechanical

A second order mechanical plant model with actuator and sensor models.

The PlantSecondOrderMechanical processing block can be found in the ‘Templates’ feature in the PMP installer.

plant second order mechanical loop structure

The control loop structure where a feedback controller controls a mechanical plant

The structure of the mechanical plant and its typical location in a control loop is shown above. The inputs to the mechanical plant can be either force, torque or current. The outputs of the mechanical model are position, velocity, acceleration and sensor outputs, which include an index pulse and limit switches.

Description

The implementation of the processing block is shown in the figure below. The block consists of multiple components, which are further explained in the following sections:

  • Inverse actuator model blue-rect

  • Second order mechanical model yellow-rect

  • Encoder index pulse model green-rect

  • Limit switch red-rect

  • Inverse sensor model purple-rect

plant second order mechanical implementation

The implementation of the processing block

Inverse actuator model

The processing block can handle various input signal units, due to the inverse actuator model. The ActuatorScaleFactor is used to convert the data on the Actuator input to force, via \(Force = \frac{Actuator}{ActuatorScaleFactor}\).

plant second order mechanical inverse actuator model

The implementation of the inverse actuator model

The quantization function allows for simulating an actuator’s resolution. The quantization block is parametrized by the ActuatorResolution. Note that (default) value 0.0 bypasses quantization.

Second order mechanical model

The mechanical model is based on a discrete-time implementation of the following second order transfer function:

\[\frac{Position}{Force} = \frac{1}{ms^2+ds+k}\]

Where \(m\) is Mass, \(d\) is Damping and \(k\) is Stiffness. Each parameter can be described using the corresponding signal.

Two optional mechanical end stops are included in this model. The locations of the end stops can be defined using the PositiveEndStop and NegativeEndStop signals. The end stops are ignored if NegativeEndStop >= PositiveEndStop. End stops are ignored by default since their locations are initialized at zero.

If the position of the plant reaches one of the defined end stop positions, the EndStopSaturationExceeded event is raised. The acceleration and velocity of the plant are immediately set to zero such that the position remains constant.

Note

The model for the end stop does not include dynamical characteristics of the end stop, such as damping and stiffness. It is intended to test homing functionality and therefore implemented as a rigid body.

plant second order mechanical second order mechanical model

The implementation of the second order mechanical model

Encoder index pulse model

The encoder index pulse model can be used to obtain index pulses in a simulation, which correspond to the pulses in the actual system.

The model requires three configuration signals:

Signal

Description

IndexPulsePosition

The exact location of the index pulse within one encoder ‘revolution’.

IndexPulseDistance

This is the distance between two index pulses, given in the same unit as the position input. It defines a single turn in case of a rotary application, i.e., \(2 \pi\) [rad].

IndexPulseWidth

The width of the pulse in distance, given in the same unit as the position input.

The signals are described by the figures below (left for linear applications, right for rotary).

plant second order mechanical index pulse linear

The index pulse definition for linear applications

plant second order mechanical index pulse rotary

The index pulse definition for rotary applications

The implementation is given below, where the behavior of the comparator is depicted above.

plant second order mechanical encoder index pulse model

The implementation of the encoder index pulse model

Note

The main functionality of the simulated index pulse is to simulate homing procedures, which require an index pulse.

Attention

An index pulse is skipped if the IndexPulseWidth is smaller than the distance covered in one sample period.

Limit switch

The limit switch model consists of a PositiveLimitSwitch and a NegativeLimitSwitch.

The positive limit switch can be configured using PositiveLimitSwitchPosition and PositiveLimitSwitchPulseWidth. The same terminology is used for the negative limit switch.

Note

Although the names suggested otherwise, the defined positions of the limit switches can both be positive or negative.

The PositiveLimitSwitch and NegativeLimitSwitch signals are high when the corresponding switch is active.

plant second order mechanical limit switch

The index pulse definition for linear applications

Hint

The main functionality of the simulated limit switches to simulate homing procedures, which require one or more limit switches.

Inverse sensor model

The inverse sensor model can be used to convert the unit of the output of a plant, such that it can be matched to the encoder configuration in the actual system. The SensorScaleFactor is used to convert the data on the Position signal to the data on the Value signal, via \(Value = \frac{Position}{SensorScaleFactor}\).

plant second order mechanical inverse sensor model

The implementation of the inverse sensor model

The quantization function allows for simulating a sensor’s resolution. The quantization block is parametrized by the SensorResolution. Note that (default) value 0.0 bypasses quantization.

Integration

The integration of this processing block in the platform is depicted in The integration of plant second order mechanical in the software platform. Most connections between the processing block and other software components are required for correct operation, but some are optional. The optional connections are depicted using dashed lines.

plant second order mechanical integration

The integration of plant second order mechanical in the software platform

See also

Closed-loop system

Using PlantSecondOrderMechanical to create a simulated closed-loop system guide via API.

Closed-loop system

Using PlantSecondOrderMechanical to create a simulated closed-loop system guide via Tooling.

Interface

Inputs

Inputs

Name

Description

Actuator

Actuator input (i.e. force, torque or current).

SamplePeriod

Input to configure the period at which the plant is sampled.

Read only signals

Read only signals

Name

Description

Acceleration

Acceleration of the mass.

Force

Force generated by the actuator.

IndexPulse

Index pulse value.

NegativeLimitSwitch

Negative limit switch value.

PositiveLimitSwitch

Positive limit switch value.

Position

Position of the mass.

UnsaturatedPosition

Position of the mass before end-stop saturation.

Value

Raw sensor value.

Velocity

Velocity of the mass.

Read-write signals

Read-write signals

Name

Description

ActuatorResolution

Actuator resolution.

ActuatorScaleFactor

Actuator scale factor.

Damping [N*s/m]

Damping.

IndexPulseDistance [m]

Index pulse distance.

IndexPulsePosition [m]

Position at which index pulse is generated.

IndexPulseWidth [m]

Pulse width of index pulse.

Mass [kg]

Mass.

NegativeEndStop [m]

Position of negative end-stop.

NegativeLimitSwitchPosition [m]

Position of negative limit switch.

NegativeLimitSwitchPulseWidth [m]

Pulse width of negative limit switch.

PositiveEndStop [m]

Position of positive end-stop.

PositiveLimitSwitchPosition [m]

Position of positive limit switch.

PositiveLimitSwitchPulseWidth [m]

Pulse width of positive limit switch.

SensorResolution

Sensor resolution.

SensorScaleFactor

Sensor scale factor.

Stiffness [N/m]

Stiffness.

Events

Events

Name

Description

EndStopSaturationExceeded

The value of this event is True while the position is saturated by the PositiveEndStop or NegativeEndStop limits.