modelPID_Control

Directly influencing a stock to keep it at setpoint value

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:

y(t) = ...

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

DiagramView
ModelDiagram.png

See also

SimpleControl, InputControl, PID

Parameters

TypeNameDefaultDescription
SetpointTypeinitialSetpoint (from Control)Setpoint valid from modelStartTime to startTime
SetpointTypefinalSetpoint (from Control)Final setpoint valid from startTime + duration until the end of the simulation
TimestartTime (from Control)modelSettings.modelStartTimeStart time for change of setpoint
Timeduration (from Control)modelSettings.modelTimeHorizonTime until final setpoint is reached
GainTypek1Gain of controller [GainType]
TimeTiinfTime constant of integrator (i.e., gain for integrator = 1/Ti)
TimeTd0Derivative gain (i.e., time span for error prediction)
Structural Parameters
BooleanhasRateOutput (from FlowPort)false= true, if the rate is reported via real output connectors
BooleanhasExogenousSetpoint (from Control)false= true, if the setpoint is to be given by an input connector
Timing
TimingChoicestc (from TimedSource)TimingChoices.permanentSelect whether contoll is permanent or timed
TimeonTime (from TimedSource)modelSettings.modelStartTimeTime for component to become effective
TimeoffTime (from TimedSource)modelSettings.modelTimeHorizonTime for component to become ineffective
Initialization
InitinitTypeInit.NoInitType of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output)
Fractionxi_start0Initial or guess value for integrator output (= integrator state)
Fractionxd_start0Initial or guess value for state of derivative block
OutputTypey_start0Initial value of output
Advanced
RealNd10The higher Nd, the more ideal the derivative block

Connectors

TypeNameDefaultDescription
FlowPortflowPort (from FlowPort)Used to represent stock and flow connections
Connectors.RealInputu (from Control)Setpoint input for controller

Components

TypeNameDefaultDescription
RealOutputy (from FlowPort)Output of current rate of flow
RealOutputy1 (from FlowPort)Output of current rate of flow
ModelSettingsmodelSettings (from TimedSource)

Contents

NameDescription
GainType

Revisions

  • Introduced in v2.0.0.

  • Class adapted as to be compliant with MSL 4.0.0 in v2.2.