Class Ssab_ServoReg
Redaktör Jonas Haulin
Version 1.0
Modified 25-JAN-2006 14:57:22.76
Kod ssabox_plc_servoreg.c
 Servoregulator with direct positioning



The function works as a combined servo regulator, deadzone and positioning ramp.
The features may be used individually or all at once.
It was developed to ensure trajectory tracking and positioning in automated cranes with anti-sway control,
but can be deployed for any positioning problem. The output of the function is a velocity reference.

A brief description of the features:

1. The servo regulator is used to enhance the real-time reference tracking of a system.
   It is a simple three-term regulator, where the output is determined as

	 uReg = kP*(uReference - uMeasured) + kI*(xR - xM) + kD*(aR - aM)

   If a non-zero PID delay time is set (see DelayPID attribute), input reference
   values will be placed in a queue and extracted to the PID regulator with the given delay.
   This is useful if a delay is unavoidable, but acceptable if it is uniform throughout travel.
   The D-part should not be used if a low-noise measured signal aM is not available.

2. The positioning ramp limits the output according to the equation

	 uRamp = -DelayRamp*amaxS + sqrt(DelayRamp^2*amaxS^2 + 2.0*|Delta x|*amaxS)

   where Delta x is the remaining distance to the command position.
   In the case of zero delay, uRamp(x) is just a constant deceleration curve,
   where amaxS is the magnitude of deceleration.

3. The deadzone sets the output to zero, if within its limits. A second larger deadzone that is
   activated after a specified time within its limits may also be used.

See also



RtBody attributes pwr_sClass_Ssab_ServoReg
Float32 aR AR Current reference acceleration of the desired trajectory. The input is used by the PID regulator of the object.
Float32 uR UR Current reference velocity of the desired trajectory. The input is used by the PID regulator of the object.
Float32 xR XR Current reference position of the desired trajectory. The input is used by the PID regulator of the object.
Float32 ac AM Current measured acceleration. The input is used by the PID regulator of the object.
Float32 uc UM Current measured velocity. The input is used by the PID regulator of the object.
Float32 xc XM Current measured position. The input is used by the PID regulator of the object.
Float32 xCommand XCOM Command position. Final travel destination.
Float32 umaxP MAXP Maximum positive output velocity. This value may depend on other system variables,
such as local low-speed restrictions etc, and is therefore supplied as an input.
Float32 umaxN MAXN Maximum negative output velocity. Same as above, but this value should be < 0,
and reflects a restriction on movement in the other direction.
Boolean positioning pos If true, and if the ramp is enabled, the control output is initially set to umaxP or umaxN,
depending on the sign of Delta x, the distance to the command position.
The output is then limited by the ramp. The effect is a very accurate positioning, given that
the relevant parameters are set correctly.
Direct positioning disables the PID regulator, as the two cannot be used simultaneously.
Boolean enable en On/Off switch. If false, uR is simply passed untouched through the object.
Float32 amaxS   "Soft" maximum acceleration, i.e. the acceleration or deceleration that the system
can be guaranteed to uphold.
Boolean enablePID   Enabling or disabling of PID regulator. The positioning input overrides this setting, however.
Array of Float32 kPID   PID constants:
kPID[0] - kP
kPID[1] - kI
kPID[2] - kD
Float32 DelayPID   Reference delay in seconds.
Int32 maxdelaysteps   Limit as to how many time steps will be stored in the queue.
If DelayPID / ScanTime > maxdelaysteps, the full delay will not be realized.
Pointer to Float32 RefListp   Pointer to the reference list / queue.
Boolean enableRamp   Pointer to the reference list / queue.
Float32 DelayRamp   Delay parameter in the ramp model. A larger delay causes a less steep deceleration.
Boolean enableDZ   Enabling or disabling of deadzone.
Float32 DeadZone   Determines the extension of the deadzone in both directions about the command position.
Interval = [xCommand - DeadZone, xCommand + DeadZone]
Boolean enableTDZ   Enabling or disabling of timer deadzone.
Float32 TimerDeadZone   Determines the extension of the deadzone in both directions about the command position.
Interval = [xCommand - TimerDeadZone, xCommand + TimerDeadZone]
Float32 TDZTime   Waiting time for the timer deadzone. The deadzone is activated after
TDZTime seconds within the timer deadzone.
Float32 TDZElapsedTime   Time counter of the timer deadzone.
Pointer to Float32 ScanTime  
Float32 uReg UREG Control output velocity.
Boolean RampActive ramp Indicates whether the ramp is active or not, that is if it currently
limits the magnitude of the control output.
Boolean DZActive dz Indicates whether the deadzone is active or not, that is if it currently
limits the magnitude of the control output.
The output may be used as a confirmation of completed positioning.
Boolean TDZActive tdz Indicates whether the timer deadzone is active or not, that is if it currently
limits the magnitude of the control output.
The output may be used as a confirmation of completed positioning.

DevBody attributes 
pwrs:Class-$PlcNode PlcNode  


GraphPlcNode
object_type 11
parameters[0] 11
parameters[1] 15
parameters[2] 4
parameters[3] 0
graphmethod 0 (standard, individual attributes)
graphindex 0
default_mask[0] 502
default_mask[1] 1
segname_annotation 1
compmethod 4
compindex 0
tracemethod 0
traceindex 0
connectmethod 0
executeordermethod 2
objname servoreg
graphname ServoReg


Template Object
umaxP 2.000000e+00
umaxN -2.000000e+00
amaxS 3.800000e-01
kPID[0] 6.000000e-01
kPID[1] 3.000000e-01
maxdelaysteps 1000
DelayRamp 1.000000e-01
DeadZone 2.000000e-02
TimerDeadZone 5.000000e-02
TDZTime 5.000000e+00


Attributes detail


aR Input
Klass Input
Typ Float32
Flags
GraphName AR
Kropp RtBody
Current reference acceleration of the desired trajectory. The input is used by the PID regulator of the object.

uR Input
Klass Input
Typ Float32
Flags
GraphName UR
Kropp RtBody
Current reference velocity of the desired trajectory. The input is used by the PID regulator of the object.

xR Input
Klass Input
Typ Float32
Flags
GraphName XR
Kropp RtBody
Current reference position of the desired trajectory. The input is used by the PID regulator of the object.

ac Input
Klass Input
Typ Float32
Flags
GraphName AM
Kropp RtBody
Current measured acceleration. The input is used by the PID regulator of the object.

uc Input
Klass Input
Typ Float32
Flags
GraphName UM
Kropp RtBody
Current measured velocity. The input is used by the PID regulator of the object.

xc Input
Klass Input
Typ Float32
Flags
GraphName XM
Kropp RtBody
Current measured position. The input is used by the PID regulator of the object.

xCommand Input
Klass Input
Typ Float32
Flags
GraphName XCOM
Kropp RtBody
Command position. Final travel destination.

umaxP Input
Klass Input
Typ Float32
Flags
GraphName MAXP
Kropp RtBody
Maximum positive output velocity. This value may depend on other system variables,
such as local low-speed restrictions etc, and is therefore supplied as an input.

umaxN Input
Klass Input
Typ Float32
Flags
GraphName MAXN
Kropp RtBody
Maximum negative output velocity. Same as above, but this value should be < 0,
and reflects a restriction on movement in the other direction.

positioning Input
Klass Input
Typ Boolean
Flags
GraphName pos
Kropp RtBody
If true, and if the ramp is enabled, the control output is initially set to umaxP or umaxN,
depending on the sign of Delta x, the distance to the command position.
The output is then limited by the ramp. The effect is a very accurate positioning, given that
the relevant parameters are set correctly.
Direct positioning disables the PID regulator, as the two cannot be used simultaneously.

enable Input
Klass Input
Typ Boolean
Flags
GraphName en
Kropp RtBody
On/Off switch. If false, uR is simply passed untouched through the object.

amaxS Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
"Soft" maximum acceleration, i.e. the acceleration or deceleration that the system
can be guaranteed to uphold.

enablePID Intern
Klass Intern
Typ Boolean
Flags
Kropp RtBody
Enabling or disabling of PID regulator. The positioning input overrides this setting, however.

kPID Intern
Klass Intern
Typ Array of Float32
Flags Array
Elements 3
Kropp RtBody
PID constants:
kPID[0] - kP
kPID[1] - kI
kPID[2] - kD

DelayPID Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
Reference delay in seconds.

maxdelaysteps Intern
Klass Intern
Typ Int32
Flags
Kropp RtBody
Limit as to how many time steps will be stored in the queue.
If DelayPID / ScanTime > maxdelaysteps, the full delay will not be realized.

RefListp Intern
Klass Intern
Typ Pointer to Float32
Flags Pointer|State|Noedit|Invisible|Private
Kropp RtBody
Pointer to the reference list / queue.

enableRamp Intern
Klass Intern
Typ Boolean
Flags
Kropp RtBody
Pointer to the reference list / queue.

DelayRamp Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
Delay parameter in the ramp model. A larger delay causes a less steep deceleration.

enableDZ Intern
Klass Intern
Typ Boolean
Flags
Kropp RtBody
Enabling or disabling of deadzone.

DeadZone Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
Determines the extension of the deadzone in both directions about the command position.
Interval = [xCommand - DeadZone, xCommand + DeadZone]

enableTDZ Intern
Klass Intern
Typ Boolean
Flags
Kropp RtBody
Enabling or disabling of timer deadzone.

TimerDeadZone Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
Determines the extension of the deadzone in both directions about the command position.
Interval = [xCommand - TimerDeadZone, xCommand + TimerDeadZone]

TDZTime Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
Waiting time for the timer deadzone. The deadzone is activated after
TDZTime seconds within the timer deadzone.

TDZElapsedTime Intern
Klass Intern
Typ Float32
Flags
Kropp RtBody
Time counter of the timer deadzone.

ScanTime Intern
Klass Intern
Typ Pointer to Float32
Flags Pointer|Invisible|Private
Kropp RtBody

uReg Output
Klass Output
Typ Float32
Flags State|Noedit
GraphName UREG
Kropp RtBody
Control output velocity.

RampActive Output
Klass Output
Typ Boolean
Flags State|Noedit
GraphName ramp
Kropp RtBody
Indicates whether the ramp is active or not, that is if it currently
limits the magnitude of the control output.

DZActive Output
Klass Output
Typ Boolean
Flags State|Noedit
GraphName dz
Kropp RtBody
Indicates whether the deadzone is active or not, that is if it currently
limits the magnitude of the control output.
The output may be used as a confirmation of completed positioning.

TDZActive Output
Klass Output
Typ Boolean
Flags State|Noedit
GraphName tdz
Kropp RtBody
Indicates whether the timer deadzone is active or not, that is if it currently
limits the magnitude of the control output.
The output may be used as a confirmation of completed positioning.

PlcNode Buffer
Klass Buffer
Typ pwrs:Class-$PlcNode
Flags Invisible
Kropp DevBody