WOLFRAM SYSTEMMODELER

PID_Controller

Demonstrates the usage of a Continuous.LimPID controller

Diagram

Wolfram Language

In[1]:=
Click for copyable input
SystemModel["Modelica.Blocks.Examples.PID_Controller"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

This is a simple drive train controlled by a PID controller:

  • The two blocks "kinematic_PTP" and "integrator" are used to generate the reference speed (= constant acceleration phase, constant speed phase, constant deceleration phase until inertia is at rest). To check whether the system starts in steady state, the reference speed is zero until time = 0.5 s and then follows the sketched trajectory.
  • The block "PI" is an instance of "Blocks.Continuous.LimPID" which is a PID controller where several practical important aspects, such as anti-windup-compensation has been added. In this case, the control block is used as PI controller.
  • The output of the controller is a torque that drives a motor inertia "inertia1". Via a compliant spring/damper component, the load inertia "inertia2" is attached. A constant external torque of 10 Nm is acting on the load inertia.

The PI controller settings included "limitAtInit=false", in order that the controller output limits of 12 Nm are removed from the initialization problem.

The PI controller is initialized in steady state (initType=SteadyState) and the drive shall also be initialized in steady state. However, it is not possible to initialize "inertia1" in SteadyState, because "der(inertia1.phi)=inertia1.w=0" is an input to the PI controller that defines that the derivative of the integrator state is zero (= the same condition that was already defined by option SteadyState of the PI controller). Furthermore, one initial condition is missing, because the absolute position of inertia1 or inertia2 is not defined. The solution shown in this examples is to initialize the angle and the angular acceleration of "inertia1".

In the following figure, results of a typical simulation are shown:

PID_controller.png
PID_controller2.png

In the upper figure the reference speed (= integrator.y) and the actual speed (= inertia1.w) are shown. As can be seen, the system initializes in steady state, since no transients are present. The inertia follows the reference speed quite good until the end of the constant speed phase. Then there is a deviation. In the lower figure the reason can be seen: The output of the controller (PI.y) is in its limits. The anti-windup compensation works reasonably, since the input to the limiter (PI.limiter.u) is forced back to its limit after a transient phase.

Parameters (1)

driveAngle

Value: 1.57

Type: Angle (rad)

Description: Reference distance to move

Components (9)

PI

Type: LimPID

Description:

inertia1

Type: Inertia

Description:

torque

Type: Torque

Description:

spring

Type: SpringDamper

Description:

inertia2

Type: Inertia

Description:

kinematicPTP

Type: KinematicPTP

Description:

integrator

Type: Integrator

Description:

speedSensor

Type: SpeedSensor

Description:

loadTorque

Type: ConstantTorque

Description: