PID_ControlDirectly influencing a stock to keep it at setpoint value |
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
.
hasRateOutput |
Value: false Type: Boolean Description: = true, if the rate is reported via real output connectors |
---|---|
tc |
Value: TimingChoices.permanent Type: TimingChoices Description: Select whether contoll is permanent or timed |
onTime |
Value: modelSettings.modelStartTime Type: Time (s) Description: Time for component to become effective |
offTime |
Value: modelSettings.modelTimeHorizon Type: Time (s) Description: Time for component to become ineffective |
hasExogenousSetpoint |
Value: false Type: Boolean Description: = true, if the setpoint is to be given by an input connector |
initialSetpoint |
Value: Type: SetpointType Description: Setpoint valid from modelStartTime to startTime |
finalSetpoint |
Value: Type: SetpointType Description: Final setpoint valid from startTime + duration until the end of the simulation |
startTime |
Value: modelSettings.modelStartTime Type: Time (s) Description: Start time for change of setpoint |
duration |
Value: modelSettings.modelTimeHorizon Type: Time (s) Description: Time until final setpoint is reached |
k |
Value: 1 Type: GainType Description: Gain of controller [GainType] |
Ti |
Value: inf Type: Time (s) Description: Time constant of integrator (i.e., gain for integrator = 1/Ti) |
Td |
Value: 0 Type: Time (s) Description: Derivative gain (i.e., time span for error prediction) |
initType |
Value: Init.NoInit Type: Init Description: Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output) |
Nd |
Value: 10 Type: Real Description: The higher Nd, the more ideal the derivative block |
xi_start |
Value: 0 Type: Fraction Description: Initial or guess value for integrator output (= integrator state) |
xd_start |
Value: 0 Type: Fraction Description: Initial or guess value for state of derivative block |
y_start |
Value: 0 Type: OutputType Description: Initial value of output |
flowPort |
Type: FlowPort Description: Used to represent stock and flow connections |
|
---|---|---|
y |
Type: RealOutput Description: Output of current rate of flow |
|
y1 |
Type: RealOutput Description: Output of current rate of flow |
|
u |
Type: RealInput Description: Setpoint input for controller |
onOff |
Type: PulseInput Description: Generate pulse or pulse-train signal of real input |
|
---|---|---|
permanent |
Type: ConstantConverter Description: A constant value is turned into a constant signal |
|
setpoint |
Type: RampInput Description: Ramp input determining the setpoint |
|
currentValue |
Type: FlowPortSensor Description: Current value of connected stock |
|
modelSettings |
Type: ModelSettings Description: Setting important global variables within a model |
|
PID |
Type: PID Description: PID-controller in additive description form |
|
error |
Type: Gap Description: Gap between setpoint and current stock value |
|
changing |
Type: ExogenousChange Description: Flow to adjust the stock |
|
actualRate |
Type: Product_2 Description: Actual rate, which becomes zero when control is turned off |