Second-Order Controller (SOC)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
CompactLogix
5380,
CompactLogix
5480, and
ControlLogix
5580 controllers.
The SOC instruction is designed for use in closed loop control systems in a similar manner to the PI instruction. The SOC instruction provides a gain term, a first order lag, and a second order lead.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram.
Function Block
RSL5K_SOC Function Block_v31
Structured Text
SOC(SOC_tag);
Operands
Function Block
Operand
Type
Format
Description
SOC tag
SEC_ORDER_CONTROLLER
Structure
SOC structure
SEC_ORDER_CONTROLLER Structure
Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
In
REAL
The analog signal input to the instruction.
Valid = any float
Default = 0.0
Initialize
BOOL
The instruction initialization command. When set, Out and internal integrator are set equal to the value of InitialValue.
Default is cleared.
InitialValue
REAL
The initial value input. When Initialize is set, Out and integrator are set to the value of InitialValue. The value of InitialValue is limited using HighLimit and LowLimit.
Valid = any float
Default = 0.0
Gain
REAL
The proportional gain for the instruction. If the value is out of range, the instruction limits the value and sets the appropriate bit in Status.
Valid = any float > 0.0
Default = minimum positive float
WLag
REAL
First order lag corner frequency in radians/second. If the value is out of range, the instruction limits the value and sets the appropriate bit in Status.
Valid = see the Description section below for valid ranges
Default = 0.0
WLead
REAL
Second order lead corner frequency in radians/second. If the value is out of range, the instruction limits the value and sets the appropriate bit in Status.
Valid = see the Description section below for valid ranges
Default = 0.0
ZetaLead
REAL
Second order lead damping factor. If the value is out of range, the instruction limits the value and sets the appropriate bit in Status.
Valid = 0.0 to 10.0
Default = 0.0
HighLimit
REAL
The high limit value. This is the maximum value for Out. If HighLimitLess than or equal toLowLimit, the instruction sets HighAlarm and LowAlarm, sets the appropriate bit in Status, and sets Out = LowLimit.
Valid = LowLimit < HighLimit Less than or equal to maximum positive float
Default = maximum positive float
LowLimit
REAL
The low limit value. This is the minimum value for Out. If HighLimit Less than or equal to LowLimit, the instruction sets HighAlarm and LowAlarm, sets the appropriate bit in Status, and sets Out = LowLimit.
Valid = maximum negative float Less than or equal to LowLimit < HighLimit
Default = maximum negative float
HoldHigh
BOOL
The hold high command. When set, the value of the internal integrator is not allowed to increase in value.
Default is cleared.
HoldLow
BOOL
The hold low command. When set, the value of the internal integrator is not allowed to decrease in value.
Default is cleared.
TimingMode
DINT
Selects timing execution mode.
0 = Periodic mode
1 = Oversample mode
2 = Real time sampling mode
For more information about timing modes, see Function Block Attributes.
Valid = 0 to 2
Default = 0
OversampleDT
REAL
Execution time for oversample mode.
Valid = 0 to 4194.303 seconds
Default = 0
RTSTime
DINT
Module update period for real time sampling mode
Valid = 1 to 32,767ms
Default = 1
RTSTimeStamp
DINT
Module time stamp value for real time sampling mode.
Valid = 0 to 32,767ms
Default = 0
Output Parameter
Data Type
Description
EnableOut
BOOL
Indicates if instruction is enabled. Cleared to false if Out overflows.
Out
REAL
The calculated output of the algorithm.
HighAlarm
BOOL
The maximum limit alarm indicator. Set when the calculated value for Out Greater than or equal toHighLimit and the output is clamped at HighLimit.
LowAlarm
BOOL
The minimum limit alarm indicator. Set when the calculated value for Out Less than or equal to LowLimit and the output is clamped at LowLimit.
DeltaT
REAL
Elapsed time between updates. This is the elapsed time in seconds used by the control algorithm to calculate the process output.
Status
DINT
Status of the function block.
InstructFault (Status.0)
BOOL
The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred.
GainInv (Status.1)
BOOL
Gain < minimum positive float.
WLagInv (Status.2)
BOOL
WLag > maximum or WLag < minimum.
WLeadInv (Status.3)
BOOL
WLead > maximum or WLead < minimum.
ZetaLeadInv (Status.4)
BOOL
ZetaLead > maximum or ZetaLead < minimum.
HighLowLimsInv (Status.5)
BOOL
HighLimit Less than or equal to LowLimit.
TimingModeInv (Status.27)
BOOL
Invalid timing mode.
For more information about timing modes, see Function Block Attributes.
RTSMissed (Status.28)
BOOL
Only used in real time sampling mode. Set when ABS | DeltaT - RTSTime | > 1 (.001 second).
RTSTimeInv (Satus.29)
BOOL
Invalid RTSTime value.
RTSTimeStampInv (Status.30)
BOOL
Invalid RTSTimeStamp value.
DeltaT (Status.31)
BOOL
Invalid DeltaT value.
Structured Text
Operand
Type
Format
Description
SOC tag
SEC_ORDER_CONTROLLER
structure
SOC structure
See Structured Text Syntax for more information of the syntax of expressions within structured text.
Description
The SOC instruction provides a gain term, a first order lag, and a second order lead. The frequency of the lag is adjustable and the frequency and damping of the lead is adjustable. The zero pair for the second order lead can be complex (damping is less than unity) or real (damping Greater than or equal to to unity). The SOC instruction is designed to execute in a task where the scan rate remains constant.
The SOC instruction uses the following Laplace Transfer equation.
SOC_Equation
Parameter Limitations
The following SOC parameters have these limits on valid values.
Parameter
Limit
WLead
SOC high and low limit equation
where DeltaT is in seconds
WLag
SOC high and low limit equation 2
where DeltaT is in seconds
ZetaLead
LowLimit = 0.0
HighLimit = 10.0
Whenever the value computed for the output is invalid or NAN, the instruction sets Out = the invalid value. The internal parameters are not updated. In each subsequent scan, the output is computed using the internal parameters from the last scan when the output was valid.
Limiting
The instruction stops wind-up based on state of the Hold inputs.
If:
Then:
HoldHigh is set and Integrator > Integrator
n-1
Integrator = Integrator
n-1
HoldLow is set and Integrator < Integrator
n-1
Integrator = Integrator
n-1
The instruction also stops integrator windup based on the HighLimit and LowLimit values.
If:
Then:
Integrator > IntegratorHighLimit
Integrator = IntegratorHighLimit
Integrator < IntegratorLowLimit
Integrator = IntegratorLowLimit
where:
SOC_equation 2
The instruction also limits the value of Out based on the HighLimit and LowLimit values.
If:
Then:
HighLimit Less than or equal to LowLimit
Out = LowLimit
Integrator = IntegratorLowLimit
HighLowLimsInv is set
HighAlarm is set
LowAlarm is set
Out Greater than or equal to HighLimit
Out = HighLimit
IntegratorLowLimit
n-1
HighAlarm is set
Out Less than or equal to LowLimit
Out = LowLimit
Integrator = Integrator
n-1
LowAlarm is set
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related faults.
Execution
Function Block
Condition/State
Action Taken
Prescan
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is false
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is true
EnableIn and EnableOut bit is set to true.
The instruction executes.
Instruction first run
N/A
Instruction first scan
The internal parameters and Out are set to 0. Force recalculation of equation coefficients.
Postscan
EnableIn and EnableOut bits are cleared to false.
Structured Text
Condition/State
Action Taken
Prescan
See Prescan in the Function Block table.
Normal Execution
See Tag.EnableIn is true in the Function Block table.
Postscan
See Postscan in the Function Block table.
Example
The SOC instruction is a specialized function block that is used in applications where energy is transferred between two sections through a spring-mass system. Typically in these types of applications, the frequency response of the process itself can be characterized as shown in the bode diagram A below:
SOC_Diagram A
The SOC instruction implements a first order lag filter followed by a PID controller to implement a transfer function with an integration, a second order zero, (lead,) and a first order pole (lag.) With this instruction, PID tuning is simplified because the regulating terms are arranged so that you have WLead and ZLead as inputs to the SOC instruction, rather than Kp, Ki, and Kd values. The transfer function for the SOC instruction is:
SOC_Example formula
Its corresponding bode diagram is shown in Diagram B below.
L5K_SOC_Diagram B
The SOC instruction can be used in a torque or tension regulating application where a load cell or force transducer is used as feedback and the output of the regulating scheme operates directly on the torque (current) minor loop of the drive. In many such applications, the controlled system may be mechanically under-damped and have a natural frequency which is difficult to stabilize as it becomes reflected through the feedback device itself.
SOC_Example 2 torque reg app
Using the SOC instruction, PID tuning is simplified because the regulating terms can be arranged so that you have WLead and ZLead as inputs to the SOC instruction, rather than Kp, Ki, and Kd values. In this manner, the corner frequencies of the controller/regulator are easier to adjust and setup against the real world process. During startup, the natural frequency of the system and the damping factor can be measured empirically or on-site. Afterward, the parameters of the regulator can be adjusted to match the characteristics of the process, allowing more gain and more stable control of the final process.
SOC_Example 2 PID tuning
In the system above, if Wlead is set equal to the system natural frequency, and if Wlag is set substantially above the desired crossover frequency, (> 5 times crossover), the resulting system response would look like the following:
SOC_Example Wlead
In an actual application, the steps in using and setting up this instruction include:
Recognize the type of process that is being controlled. If the system’s response to a step function results in a high degree of ringing or can be characterized by the process curve shown above, this block may provide the regulating characteristics required for stable control.
Determine the natural frequency of the system/process. This can may be arrived at empirically - or it might be measured on-site. Adjust WLead so that it corresponds with, or is slightly ahead of, the natural frequency of the process itself.
Tune damping factor, Zlead, so that it cancels out any of the overshoot in the system.
Move WLag out far enough past the system crossover frequency (>5 times) and begin increasing overall Gain to achieve
Function Block
SOC_FBD_ex
Structured Text
SOC_01.In := Process_Error;
SOC_01.Initialize := Regulator_Enable_Not;
SOC_01.Gain := Gain;
SOC_01.WLag := Lag_Radians_per_sec;
SOC_01.WLead := Lead_radians_per_sec;
SOC_01.ZetaLead := Damping_Factor;
SOC_01.HighLimit := Max_Out;
SOC_01.LowLimit := Min_Out;
SOC(SOC_01);
SOC_Out := SOC_01.Out;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.