Table of Contents

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 PidTuning
public class PidModel : ModelBaseClass, ISimulatableModel
Inheritance
PidModel
Implements
Inherited Members

Constructors

PidModel(PidParameters, string)

Constructor

public PidModel(PidParameters pidParameters, string ID = "not_named")

Parameters

pidParameters PidParameters

object containing the paramters of the controller

ID string

Each controller shoudl be given a unique ID

Fields

pidParameters

The parameters which define the behavior of the PidModel

public PidParameters pidParameters

Field Value

PidParameters

Methods

Clone(string)

Create deep copy/clone

public ISimulatableModel Clone(string ID = null)

Parameters

ID string

Returns

ISimulatableModel

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

newPidParameters PidParameters

Returns

ISimulatableModel

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

int

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

SignalType

GetSteadyStateInput(double, int, double[])

[Method not currently implemented]

public double? GetSteadyStateInput(double y0, int inputIdx = 0, double[] givenInputValues = null)

Parameters

y0 double
inputIdx int
givenInputValues double[]

Returns

double?

GetSteadyStateOutput(double[], double)

NOT IMPLEMENTED/NOT APPLICABLE

public double? GetSteadyStateOutput(double[] u0, double badDataID)

Parameters

u0 double[]
badDataID double

optional special value that indicates "Nan"

Returns

double?

IsModelSimulatable(out string)

Answers if the model with the curret paramters makes sense to simulate

public bool IsModelSimulatable(out string explainStr)

Parameters

explainStr string

Returns

bool

Iterate(double[], double, double)

Iterate the PID controller one step

public double[] Iterate(double[] inputs, double timeBase_s, double badDataID = -9999)

Parameters

inputs double[]

is a vector of length 2, 3 or 4. First value isy_process_abs, second value is y_set_abs, optional third value is uTrackSignal, optional fourth value is gainSchedulingVariable

timeBase_s double

time base in seconds

badDataID double

value of inputs that is to be treated as NaN

Returns

double[]

the output u of the pid-controller. If not enough inputs, it returns NaN

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_prc double

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

string

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

y_process_abs double
y_set double
u double

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)

Parameters

inputs double[]
output double