Structure definitions
ST_ControllerParameter
TYPE ST_CTRL_TempCtrlParameter:
STRUCT
(* general parameters *)
iMode : E_CTRL_ControlMode;
iReactionOnFailure : E_CTRL_ReactionOnFailure;
bSelCtrlParameterSet : BOOL;
dwAlarmSupp : DWORD;
tCtrlCycleTime : TIME;
tTaskCycleTime : TIME;
(* tuning parameteer *)
iTuningMode : E_CTRL_TuneMode;
tTuneStabilisation : TIME := T#20S;
fEndTunePercentHeating : LREAL := 80.0;
fYTuneHeating : LREAL;
fYStableHeating : LREAL;
fEndTunePercentCooling : LREAL := 20.0;
fYTuneCooling : LREAL;
fYStableCooling : LREAL;
fScalingFactor : LREAL := 1.0;
(* setpoint parameters *)
fWMin : LREAL;
fWMax : LREAL;
(* start up *)
bEnableSoftStart : BOOL;
bEnableRamping : BOOL;
fWStartUp : LREAL;
tStartUp : TIME;
bStartUpRamping : BOOL;
fWStartUpVeloPos : LREAL;
fWStartUpVeloNeg : LREAL;
fWVeloPos : LREAL;
fWVeloNeg : LREAL;
(* actual value parameters *)
bFilter : BOOL;
tFilter : TIME;
(* deadband parameters *)
bDeadband : BOOL;
fEDeadband : LREAL;
(* control value parameters *)
fYMin : LREAL;
fYMax : LREAL;
fYManual : LREAL;
fYOnFailure : LREAL;
tPWMCycleTime : TIME;
tPWMMinOffTime : TIME;
tPWMMinOnTime : TIME;
tPWMWaitingTime : TIME;
fYThresholdOff : LREAL;
fYThresholdOn : LREAL;
nCyclesForSwitchOver : INT := 100;
(* controller settings *)
bEnablePreController : BOOL;
bEnableZones : BOOL;
bEnableCVFilter : BOOL;
iFilterType : E_CTRL_FilterType;
iControllerType : E_CTRL_ControllerType;
(* min max temperatures *)
TempLow : LREAL;
TempLowLow : LREAL;
TempHigh : LREAL;
TempHighHigh : LREAL;
TempAbsoluteHigh : LREAL;
TempAbsoluteLow : LREAL;
(* internal tuning parameters *)
fTuneKp : LREAL := 1.2;
fTuneTn : LREAL := 2.0;
fTuneTv : LREAL := 0.42;
fTuneTd : LREAL := 0.25;
END_STRUCT
END_TYPE
Name | Unit | Value range | Description |
---|---|---|---|
General parameters |
|
|
|
iMode | none | INT | Controller operation mode (1 = heating, 2 = cooling, 3 = heating & cooling) (see below) |
iReactionOnFailure | none | INT | Parameterizable reaction to errors (see below) |
bSelCtrlParameterSet | none | BOOL | TRUE = external parameter set, FALSE = internal parameter set (determined by tuning) |
dwAlarmSupp | none | DWORD | Masks out the alarms (see below) |
tCtrlCycleTime | s | TIME | Controller's sampling time. In the course of the sampling time the controller re-calculates the control value. |
tTaskCycleTime | s | TIME | Task cycle time. The FB is called with this time interval. |
Tuning parameters |
|
|
|
iTuningMode | K | E_CTRL_TuneMode | Determination of the tuning sequence (see below.) |
tTune stabilization | s | TIME | Waiting time until the section is stable for tuning. |
fEndTunePercentHeating | % | LREAL | Percentage value of setpoint, from which the system switches to Closed Loop Control. |
fYTuneCooling | K | LREAL | Step change in control value during tuning. |
fYStableCooling | K | LREAL | Control value when switching to tuning during cooling. |
fScalingFactor | none | LREAL | Scaling factor for parameter switching if no tuning is performed for cooling. |
Setpoint parameters |
|
|
|
fWMin | K | LREAL | Minimum setpoint |
fWMax | K | LREAL | Maximum setpoint |
bEnableSoftStart | none | BOOL | FALSE = no soft start, TRUE = soft start |
bEnableRamping | none | BOOL | FALSE = no ramping, TRUE = ramping |
fWStartUp | K | LREAL | Setpoint at start-up |
tStartUp | s | TIME | Time with the fWStartUp setpoint |
bStartUpRamping | none | [TRUE,FALSE] | Switches on ramping during the start-up phase. |
fWStartUpVeloPos | K/s | LREAL | Rate of rise (of ramp) during the start-up phase |
fWStartUpVeloNeg | K/s | LREAL | Rate of fall (of ramp) during the start-up phase |
fWVeloPos | K/s | LREAL | Rate of rise (of ramp) |
fWVeloNeg | K/s | LREAL | Rate of fall (of ramp). |
Actual value parameters |
|
|
|
tFilter | s | TIME | Time constant of the actual value filter (first order P-T1 filter) |
bFilter | none | [TRUE,FALSE] | The actual value filter is actuated if TRUE. |
Deadband parameters |
|
|
|
bDeadband | none | [TRUE,FALSE] | TRUE = deadband on, FALSE = deadband off |
fEDeadband | K | LREAL | Deadband in degrees |
Control value parameters |
|
|
|
fYMin | none | LREAL | Minimum value of the control value |
fYMax | none | LREAL | Maximum value of the control value |
fYManual | none | LREAL | Control value in manual operation |
fYOnFailure | none | LREAL | Control value in case of error (parameterizable) |
tPWMCycleTime | s | TIME | Cycle time of the PWM signal |
tPWMMinOffTime | s | TIME | PWM: minimum switch-off time |
tPWMMinOnTime | s | TIME | PWM: minimum switch-on time |
tPWMWaitingTime | s | TIME | PWM: Waiting time when switching from heating to cooling |
fYThresholdOff | % | LREAL | 3-point: Switch-off threshold |
fYThresholdOn | % | LREAL | 3-point: Switch-on threshold |
nCyclesForSwitchOver | none | INT | Number of cycles for transition from one parameter set to another |
Controller parameters |
|
|
|
bEnablePreController | none | [TRUE,FALSE] | Switches pre-controller on. |
bEnableZones | none | [TRUE,FALSE] | Switches open loop characteristic on until close to setpoint. |
bEnableCVFilter | none | [TRUE,FALSE] | Switches on control value filter following the main controller. |
iFilterType | none | ENUM | Selection of a filter type for the control value filter following the main controller (see below). |
iControllerType | none | ENUM | Selection of a control algorithm (see below). |
Alarming parameters |
|
|
|
TempLow | K | LREAL | Relative lower temperature limit in the first band |
TempLowLow | K | LREAL | Relative lower temperature limit in the second band |
TempHigh | K | LREAL | Relative upper temperature limit in the first band |
TempHighHigh | K | LREAL | Relative upper temperature limit in the second band |
TempAbsoluteHigh | K | LREAL | Absolute upper temperature limit |
TempAbsoluteLow | K | LREAL | Absolute lower temperature limit |
Expert parameters |
|
|
|
fTuneKp | none | LREAL | FineTuning parameters for the PID controller (only for advanced users) |
fTuneTn | none | LREAL | FineTuning parameters for the PID controller (only for advanced users) |
fTuneTv | none | LREAL | FineTuning parameters for the PID controller (only for advanced users) |
fTuneTd | none | LREAL | FineTuning parameters for the PID controller (only for advanced users) |
ST_CTRL_ParaController
TYPE ST_CTRL_ParaController :
STRUCT
(* Controller parameter set - heating *)
KpHeat : FLOAT;
TnHeat : TIME;
TvHeat : TIME;
TdHeat : TIME;
(* Controller parameter set - cooling *)
KpCool : FLOAT;
TnCool : TIME;
TvCool : TIME;
TdCool : TIME;
END_STRUCT
END_TYPE
Name | Unit | Value range | Description |
---|---|---|---|
KpHeat | none | LREAL | Gain factor for the main controller |
TnHeat | s | TIME | Integral action time for main controller (I component) |
TvHeat | s | TIME | Derivative action time for main controller (D component) |
TdHeat | s | TIME | Damping time for the main controller |
KpCool | none | LREAL | Gain factor for the main controller |
TnCool | s | TIME | Integral action time for main controller (I component) |
TvCool | s | TIME | Derivative action time for main controller (D component) |
TdCool | s | TIME | Damping time for the main controller |
ENUM: E_CTRL_ERRORCODES
See documentation of the TwinCAT controller toolbox.
ENUM: E_CTRL_ReactionOnFailure
Name | Description |
---|---|
eCTRL_ReactionOnFailure_NoFailure | No error |
eCTRL_ReactionOnFailure_StopController | If there is an error (an alarm) the controller will stop. |
eCTRL_ReactionOnFailure_SetManMode | If there is an error (an alarm) the controller will switch to manual operation. |
eCTRL_ReactionOnFailure_SetYMax | If there is an error (an alarm) set the control value to its maximum. |
eCTRL_ReactionOnFailure_SetYMin | If there is an error (an alarm) set the control value to its minimum. |
eCTRL_ReactionOnFailure_SetYMean | If error (alarm), set control value to average value (in preparation). |
ENUM: E_CTRL_ControllerStateInternal
Name | Description |
---|---|
E_CTRL_ControllerStateInternalHeating | internal |
E_CTRL_ControllerStateInternalCooling | internal |
ENUM: E_CTRL_ControlMode
Name | Description |
---|---|
eCTRL_ControlMode_HEATING | Heating only |
eCTRL_ControlMode_COOLING | Cooling only |
eCTRL_ControlMode_HEATING_COOLING | Heating and cooling |
ENUM: E_CTRL_STATE
See documentation of the TwinCAT controller toolbox.
ENUM: E_CTRL_STATE_TUNIG
Name | Description |
---|---|
eCTRL_STATE_TUNING_INIT | Tuning: Initialization |
eCTRL_STATE_TUNING_IDLE | Tuning: Waiting for stable input signal (control variable) |
eCTRL_STATE_TUNING_PULSE | Tuning: Excitation through short pulse (in preparation) |
eCTRL_STATE_TUNING_STEP | Tuning: Excitation through step change (inflectional tangent method) |
eCTRL_STATE_TUNING_READY | Tuning: Determining the parameters, finalization |
eCTRL_STATE_TUNING_ERROR | Tuning: Error during tuning |
ENUM: E_CTRL_TuneMode
Name | Description |
---|---|
eCTRL_TuneMode_HEATING | Tuning: heating only |
eCTRL_TuneMode_COOLING | Tuning: cooling only |
eCTRL_TuneMode_HEATING_COOLING | Tuning: first heating, then cooling |
eCTRL_TuneMode_COOLING_HEATING | Tuning: first cooling, then heating |
eCTRL_TuneMode_OSCILLATION | Tuning: on-the-fly parameter estimation through vibration excitation (in preparation) |
ENUM: E_CTRL_FilterType
Name | Description |
---|---|
eCTRL_FilterType_FIRSTORDER | First order filter |
eCTRL_FilterType_AVERAGE | Mean value filter |
ENUM: E_CTRL_ControllerType
Name | Description |
---|---|
eCTRL_ControllerType_PID | Standard PID control algorithm |
eCTRL_ControllerType_PI | Standard PI control algorithm |
eCTRL_ControllerType_PID_Pre | Standard PID control algorithm with pre-controller (in preparation) |
eCTRL_ControllerType_PIDD2 | Serial PID control algorithm (in preparation) |
Bit-masks for alarms
Name | Mask | Description |
---|---|---|
nAlarmOpen | 2#0000_0000_0000_0000_0000_0000_0000_0001 | Hardware: open temperature sensor |
nAlarmReverse | 2#0000_0000_0000_0000_0000_0000_0000_0010 | Hardware: reverse connected temperature sensor |
nAlarmBackVoltage | 2#0000_0000_0000_0000_0000_0000_0000_0100 | Hardware: excessive voltage at temperature sensor |
nAlarmLeakage | 2#0000_0000_0000_0000_0000_0000_0000_1000 | Hardware: leakage current measured |
nAlarmShortCircuit | 2#0000_0000_0000_0000_0000_0000_0001_0000 | Hardware: Short circuit |
nAlarmOpenCircuit | 2#0000_0000_0000_0000_0000_0000_0010_0000 | Hardware: no current |
nAlarmLimitLow | 2#0000_0000_0000_0000_0000_0001_0000_0000 | Software: fallen below first lower relative temperature |
nAlarmLimitLowLow | 2#0000_0000_0000_0000_0000_0010_0000_0000 | Software: fallen below second lower relative temperature |
nAlarmLimitHigh | 2#0000_0000_0000_0000_0000_0100_0000_0000 | Software: first upper relative temperature exceeded |
nAlarmLimitHighHigh | 2#0000_0000_0000_0000_0000_1000_0000_0000 | Software: second upper relative temperature exceeded |
nAlarmAbsoluteHigh | 2#0000_0000_0000_0000_0001_0000_0000_0000 | Software: upper absolute temperature exceeded |
nAlarmAbsoluteLow | 2#0000_0000_0000_0000_0010_0000_0000_0000 | Software: fallen below lower absolute temperature |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT 3.1.4016 | PC or CX | Tc2_TempController |