Class PidModel
- Namespace
- TimeSeriesAnalysis.Dynamic
- Assembly
- TimeSeriesAnalysis.dll
Simulatable industrial PID-controller
This class is as a wrapper for PidController class, that implements ISimulatableModel.
To simulate minimum or maximum select controllers, combine this class with Select blocks.
The controller paramters belong to different aspects of the controller like, tuning, scaling, gain-scheduling, feedforward and anti-surge are adjusted have been collected into a number of data-classes, linked below:
PidParameters PidAntiSurgeParams PidFeedForward PidGainScheduling PidStatus PidScaling PidTuningpublic class PidModel : ModelBaseClass, ISimulatableModel
- Inheritance
-
PidModel
- Implements
- Inherited Members
Constructors
PidModel(PidParameters, string)
Constructor
public PidModel(PidParameters pidParameters, string ID = "not_named")
Parameters
pidParametersPidParametersobject containing the paramters of the controller
IDstringEach controller shoudl be given a unique ID
Fields
pidParameters
The parameters which define the behavior of the PidModel
public PidParameters pidParameters
Field Value
Methods
Clone(string)
Create deep copy/clone
public ISimulatableModel Clone(string ID = null)
Parameters
IDstring
Returns
Clone(PidParameters)
Create deep copy/clone that replaces the existing paramters with a new paramters object, keeping the id the same
public ISimulatableModel Clone(PidParameters newPidParameters)
Parameters
newPidParametersPidParameters
Returns
GetLengthOfInputVector()
Get number of inputs (between 2 and 4) first input is always ymeas, second input is y_setpoint, optionally, input 3 is track signal and input 4 is gain scheduling variable
public override int GetLengthOfInputVector()
Returns
GetModelParameters()
Get the model parameters
public PidParameters GetModelParameters()
Returns
- PidParameters
the parameters object of the model
GetOutputSignalType()
Return the type of the output signal
public override SignalType GetOutputSignalType()
Returns
GetSteadyStateInput(double, int, double[])
[Method not currently implemented]
public double? GetSteadyStateInput(double y0, int inputIdx = 0, double[] givenInputValues = null)
Parameters
Returns
GetSteadyStateOutput(double[], double)
NOT IMPLEMENTED/NOT APPLICABLE
public double? GetSteadyStateOutput(double[] u0, double badDataID)
Parameters
Returns
IsModelSimulatable(out string)
Answers if the model with the curret paramters makes sense to simulate
public bool IsModelSimulatable(out string explainStr)
Parameters
explainStrstring
Returns
Iterate(double[], double, double)
Iterate the PID controller one step
public double[] Iterate(double[] inputs, double timeBase_s, double badDataID = -9999)
Parameters
inputsdouble[]is a vector of length 2, 3 or 4. First value is
y_process_abs, second value isy_set_abs, optional third value isuTrackSignal, optional fourth value isgainSchedulingVariabletimeBase_sdoubletime base in seconds
badDataIDdoublevalue of inputs that is to be treated as
NaN
Returns
- double[]
the output
uof the pid-controller. If not enough inputs, it returnsNaN
SetManualOutput(double)
Set the desired manual output fo controller. This output will only be applied if controller is in MANUAL mode.
public void SetManualOutput(double manualOutput_prc)
Parameters
manualOutput_prcdouble
SetToAutoMode()
Set controller in auto
public void SetToAutoMode()
SetToManualMode()
Set controller in auto
public void SetToManualMode()
ToString()
Create a nice human-readable summary of all the important data contained in the model object. This is especially useful for unit-testing and development.
public override string ToString()
Returns
WarmStart(double, double, double)
Initalizes the controller internal state(integral term) to be steady at the given process value and output value, useful to avoid bumps when staring controller
public void WarmStart(double y_process_abs, double y_set, double u)
Parameters
WarmStart(double[], double)
Initalizes the controller internal state(integral term) to be steady at the given process value and output value, useful to avoid bumps when staring controller
public void WarmStart(double[] inputs, double output)