modelPID_Control
Extends from BusinessSimulation.Interfaces.PartialCLD.Control (Partial model for control in CLD+ modeling).
Information
This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
This component uses a →PID controller to arrive at a rate of flow that is needed to move a connected stock "under management" to a given setpoint, i.e., goal. The PID controller here follows the typical standard form implementation where the error e(t) is defined as the difference between the setpoint SP(t) and the current stock value S(t): e(t) = SP(t) - S(t). The control u(t) accordingly is the rate affecting the stock:
There is proportional control k e(t) that is immediately acting upon any deviation between stock value and setpoint. The controller also has an integral component that is aiming at correcting the accumulated error within a time span of Ti units of time. Finally, the controller has a derivative component that uses the current rate of change in the error to predict the error Td units of time into the future.
The control's setpoint can be provided either by an embedded →RampInput or by an exogenous input u. In case of a ramp input the setpoint will move from initialSetpoint to finalSetpoint in linear fashion for a period given by duration starting at startTime.
The controller by default is active over the whole simulation run, but can be restricted to an on-off period using tc = TimingChoices.period and the parameters onTime and offTime.
Implementation
![]() |
See also
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| SetpointType | initialSetpoint (from Control) | Setpoint valid from modelStartTime to startTime | |
| SetpointType | finalSetpoint (from Control) | Final setpoint valid from startTime + duration until the end of the simulation | |
| Time | startTime (from Control) | modelSettings.modelStartTime | Start time for change of setpoint |
| Time | duration (from Control) | modelSettings.modelTimeHorizon | Time until final setpoint is reached |
| GainType | k | 1 | Gain of controller [GainType] |
| Time | Ti | inf | Time constant of integrator (i.e., gain for integrator = 1/Ti) |
| Time | Td | 0 | Derivative gain (i.e., time span for error prediction) |
| Structural Parameters | |||
| Boolean | hasRateOutput (from FlowPort) | false | = true, if the rate is reported via real output connectors |
| Boolean | hasExogenousSetpoint (from Control) | false | = true, if the setpoint is to be given by an input connector |
| Timing | |||
| TimingChoices | tc (from TimedSource) | TimingChoices.permanent | Select whether contoll is permanent or timed |
| Time | onTime (from TimedSource) | modelSettings.modelStartTime | Time for component to become effective |
| Time | offTime (from TimedSource) | modelSettings.modelTimeHorizon | Time for component to become ineffective |
| Initialization | |||
| Init | initType | Init.NoInit | Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output) |
| Fraction | xi_start | 0 | Initial or guess value for integrator output (= integrator state) |
| Fraction | xd_start | 0 | Initial or guess value for state of derivative block |
| OutputType | y_start | 0 | Initial value of output |
| Advanced | |||
| Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| FlowPort | flowPort (from FlowPort) | Used to represent stock and flow connections | |
| Connectors.RealInput | u (from Control) | Setpoint input for controller |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| RealOutput | y (from FlowPort) | Output of current rate of flow | |
| RealOutput | y1 (from FlowPort) | Output of current rate of flow | |
| ModelSettings | modelSettings (from TimedSource) |
Contents
| Name | Description |
|---|---|
| GainType |
Revisions
- Introduced in v2.0.0.
- Class adapted as to be compliant with MSL 4.0.0 in v2.2.
