Class Ssab_AntiSway
Redaktör Jonas Haulin
Version 1.1
Modified 16-JAN-2006 11:27:43.17
Kod ssabox_plc_antisway.c
 Feedforward antisway control for overhead cranes



The antsiway object operates in manual or automatic mode.
In manual mode, a command velocity is passed to the object, that calculates an acceleration trajectory
that will render the the crane at the command velocity without sway.
The acceleration trajectory is retained in the object,
and at each time step a reference velocity output is generated.
The object thus works as an advanced ramp function, with an unramped command velocity input,
and a ramped reference velocity output.

In automatic mode, the object will give an output that renders the system
without sway at a given command position if followed exactly.
The object solves the coupled problem of positioning and sway elimination,
and its performance depends on the ability of the freqency converters and motors
in the system to track a given velocity reference in real time.
Frequency converters should be equipped with DTC or an equivalent control technology,
and should be tuned to follow ramped references (not step references) with maximum accuracy.
Positioning and antisway performance may be enhanced by using the antisway object
in combination with a ServoReg object, or some other kind of regulator.

In manual mode, the object always compensates for hoisting (a changed or changing pendulum length).
In automatic mode, compensation can be activated with the compensate attribute,
but this may affect travel time performance negatively, and may not be necessary for sway elimination.

At any time, the antisway object can be switched from automatic to manual mode operation.
The result will be a smooth adaption to the given command velocity, with maintained antisway control.

Technical details and more information can be found in the thesis report
"Feedforward Anti-Sway Control for Overhead Cranes - Development and Implementation in Proview", by the author.

See also



RtBody attributes pwr_sClass_Ssab_AntiSway
Pointer to Void other Other Pointer to another antisway object. If this input is used, objects
operating in the x- and y-directions (the two horizontal directions of a crane
operating in treedimensional space) will communicate and match their
set extensions as much as possible, in automatic mode. The result will be that the
path travelled by the crane ressembles a straight line. The total
travel time will not be different, however. If not connected, or if in manual mode, each
object operates individually.
Int32 mode Mode Integer that defines the setpoint shaping sequence / antisway strategy.
The relevant available sequences are

0 No antisway
1 Double pulse of unity magnitude
2 Robust, or double, double pulse - slower, but less sensitive to parameter errors.
3 Triple pulse of unity magnitude - may sometimes give a faster and more smooth operation.

More information on these and other available sequences may be found in the thesis report.
Boolean manual man Switch that sets the object in manual (1) or automatic (0) mode.
The mode can be switched at any time during operation.
A typical use of the input would be to set the object in manual mode whenever a manual command is given.
Thus an automatic travel can be aborted by touching a joystick or controller used for manual operation.
Float32 uCommand UCOM Command velocity. Assumed to be in interval [-UMAXSM, UMAXSM] (see umax attribute).
Float32 xCommand XCOM Command position. Assumed to be in interval [XMIN, XMAX] (see limits attribute).
Float32 xc POS Current position
Float32 DLc dL/dt Current hoisting velocity (defined as dL/dt, i.e. positive direction down).
Float32 Lc L Current pendulum length.
The pendulum length of a crane is best calibrated by measuring a number
of oscillation periods and then calculating L as L=g*(T/(2pi))^2
Boolean umax2 umax2 Digital input used to switch to a second UMAXSA, (soft maximum velocity in automatic mode)
provided in the umax attribute.
In automatic mode, the object will accomodate the trajectory to the new maximum velocity.
The feature may be used if low-speed restrictions apply to parts of the operation area.
Boolean enable en On/Off switch. If the object has been stopped due to an error of some kind,
the error status can be reset, and the object reactivated by toggling enable.
Array of Float32 amax   Array that contains hard and soft maximum accelerations in manual and automatic mode.

amax[0] - AMAXHM. Hard limit of acceleration, manual mode.
amax[1] - AMAXSM. Soft limit of acceleration, manual mode.
amax[2] - AMAXHA. Hard limit of acceleration, automatic mode.
amax[3] - AMAXSA. Soft limit of acceleration, automatic mode.

When the object generates trajectories, the soft maximum acceleration is used.
It should be slightly lower than the hard limit, which is the absolute maximum allowed or possible.
Having a soft limit serves two purposes. Firstly, compensation for
hoisting requires some extra acceleration that can be kicked in when
needed. Secondly, a frequency converter will have better chances of
tracking the trajectory if not operating at its acceleration limit.
A control strategy to ensure trajectory tracking also has better chances
of being successful.
A suitable value of AMAXS that will leave enough acceleration space for
the hoisting compensation can be calculated from the formula;
AMAXS = AMAXH/(1.0+(1.5*DLMax/sqrt(g*LMin))),
where DLMax is the maximum hoisting speed, g the acceleration of gravity
and LMin the minimum pendulum length.
Array of Float32 umax   Array that contains hard and soft maximum velocities in manual and automatic mode.

umax[0] - UMAXHM. Hard limit of velocity, manual mode.
umax[1] - UMAXSM. Soft limit of velocity, manual mode.
umax[2] - UMAXHA. Hard limit of velocity, automatic mode.
umax[3] - UMAXSA. Soft limit of velocity, automatic mode.
umax[4] - UMAXSA. Second soft limit of velocity, automatic mode (see umax2 attribute).

Anologue to the amax array above. Soft maximum velocities will be used in normal trajectory generation.
Array of Float32 limits   Array of adjustable parameter limits. In most cases the default values will do.

limits[0] - ZEROLIM. Default 0.001. Will set reference velocity
uR to zero if |uR| < limit.
limits[1] - ERRFACT. Default 2.0. Will stop/deactivate object
if |uR|>limit*umaxH.
limits[2] - UR_MIN. Default 0.01. Minimum steady state reference
velocity that can be passed to frequency converter.
limits[3] - XMAX. Default 99999.0. Maximum reference position.
limits[4] - XMIN. Default -99999.0. Minimum reference position.
limits[5] - ATTAIN_ERRLIM. Default 0.001. Will warn if final uR
misses uCommand (or zero if auto) with more than limit.
limits[6] - L_MIN_CHANGE. Default 0.005. Length interval between
compensation for new pendulum length.
limits[7] - DL_MIN. Default 0.005. Minimum hoisting speed that will
be compensated for.
limits[8] - XR_ATTAIN_ERRLIM. Default 0.001. Will warn if final xR
misses xCommand with more than limit. Auto only
limits[9] - XCOM_MIN_CHANGE. Default 0.01. Minimum change in command
position that will invoke a new call. Auto only.
Int32 compensate   Compensate for changed / changing pendulum length during automatic travel.

0 - Do not compensate - use the initial pendulum length throughout travel.
1 - Compensate for new L
2 - Compensate for new L and non-zero dL/dt

Compensation in automatic mode can reduces time performance, and may not be necessary.
Often an automated crane will not lift and move simultaneously,
and the effect of not compensating may be negligible even if it does.
An alternative to compensation is to use a more robust antisway strategy, see the mode attribute.
Int32 verbose   Integer value. If verbose =0, the object will tell you about
its progress (or failure) by printouts to the terminal window
(i.e. it only makes sense if ProviewR is started from a terminal window..).
There are three degrees of verbosity:

1 AS_VERB_DISABLED Object will print message if disabled
2 AS_VERB_ERR Object will print message if any error occurs
3 AS_VERB_ALL Object will print message when anything new happens
Boolean zeroTheta   Boolean switch for resetting calculated sway angle
(there is no damping modeled in the sway simuluation).
The calculated sway angle is not used for anything in the algorithms,
but is merely a demo/diagnose output.
Mask errstatus   Integer bit mask keeping information of major and minor errors that
has occurred since last reset. The status is most easily controlled in the class graph.
If errstatus > AS_ERR_MINOR, the object will disable itself (it will
not affect the value of enable, though). errstatus is reset by
switching enable, or by using the reset attribute, below.
Mask autostatus   Integer bit mask used for storing automatic operation status and for
communication between objects, via the other input.
Boolean reset   Reset errstatus and autostatus. If set, "reset" is automatically reset once
the errstatus and autostatus attributes have been reset.
Array of Boolean flags   Array that contains the individual status bits of errstatus and autostatus.
Used for display in the class graph.
Float64 aR   Reference acceleration, 64-bit.
Float64 uR   Reference velocity, 64-bit.
Array of Float64 xR   xR[0] - Reference position, 64-bit.
xR[1] - Reference position at previous time step, 64-bit.
Array of Float64 thR   thR[0] - Reference sway angle, 64-bit (diagnose/demo output).
thR[1] - Reference sway angle at previous time step, 64-bit.
String32 Set   The phasor set contains all future acceleration commands,
in the form of an array of phasors. The set is represented
as a 16-byte string. If the struct is changed or if int +
double + pointer = 16 byte, it has to be changed. phasor set members are:

int N Number of phasors in the set
double extSum Acceleration-weighted phase extension sum.
extSum = sum (|phiEnd - phiStart|*Sa),
where the sum is taken over all the phasors in the set.
Positive for positive acc.
Usage: Divide by omega to get the velocity change of
the set.
AS_phasor *ph Pointer to the array of phasors. Memory is allocated
dynamically.
(see AS_phasor_methods.h for a description of the phasor
struct)
Array of pointers to Char messageQ   Queue of warning and error messages.
Array of String80 message   Current / Last warning (message[1]) and error (message[0]) messages.
An error means that the object has deactivated itself, and needs to be restarted.
Array of Int32 mparams   Parameters that determine the behavior of the message system.

mparams[0] - M_LENGTH. Default 79. Maximum number of characters in message string.
mparams[1] - M_NLIMIT. Default 80. Maximum number of messages in queue.
mparams[2] - M_ALWAIT. Default 20. Wait this number of cycles before taking next message from queue.
mparams[3] - M_ALHOLD. Default 30. Hold the current message this number of cycles.
Float32 aRO AR Reference acceleration, 32-bit.
Float32 uRO UR Reference velocity, 32-bit.
Float32 xRO XR Reference position, 32-bit.
Float32 thRO THR Reference sway angle, 32-bit (demo / diagnose).
Boolean done done True if antisway travel is completed. Can be used in automatic mode to activate
a positioning regulator if not close enough to the command position at end of travel.
Boolean Alarm1 al1 New error message in message[0]. Can be connected to a DSup, where the message string can be stored as well.
Boolean Alarm2 al2 New warning message in message[1]. Can be connected to a DSup, where the message string can be stored as well.

DevBody attributes 
pwrs:Class-$PlcNode PlcNode  


GraphPlcNode
object_type 11
parameters[0] 10
parameters[1] 18
parameters[2] 7
parameters[3] 0
graphmethod 0 (standard, individual attributes)
graphindex 0
default_mask[0] 200
default_mask[1] 2
segname_annotation 1
compmethod 4
compindex 0
tracemethod 0
traceindex 0
connectmethod 0
executeordermethod 2
objname Antisway
graphname AntiSway


Template Object
manual 1
amax[0] 4.000000e-01
amax[1] 3.800000e-01
amax[2] 4.000000e-01
amax[3] 3.800000e-01
umax[0] 2.000000e+00
umax[1] 1.950000e+00
umax[2] 2.000000e+00
umax[3] 1.950000e+00
umax[4] 5.000000e-01
limits[0] 1.000000e-03
limits[1] 2.000000e+00
limits[2] 1.000000e-02
limits[3] 9.999900e+04
limits[4] -9.999900e+04
limits[5] 1.000000e-03
limits[6] 5.000000e-03
limits[7] 5.000000e-03
limits[8] 1.000000e-03
limits[9] 1.000000e-02
mparams[0] 79
mparams[1] 30
mparams[2] 20
mparams[3] 80


Attributes detail


other Input
Klass Input
Typ Pointer to Void
Flags Pointer|Private
GraphName Other
Kropp RtBody
 Pointer to another antisway object. If this input is used, objects
 operating in the x- and y-directions (the two horizontal directions of a crane
 operating in treedimensional space) will communicate and match their
 set extensions as much as possible, in automatic mode. The result will be that the
 path travelled by the crane ressembles a straight line. The total
 travel time will not be different, however. If not connected, or if in manual mode, each
 object operates individually.

mode Input
Klass Input
Typ Int32
Flags
GraphName Mode
Kropp RtBody
Integer that defines the setpoint shaping sequence / antisway strategy.
The relevant available sequences are

0  No antisway
1  Double pulse of unity magnitude
2  Robust, or double, double pulse - slower, but less sensitive to parameter errors.
3  Triple pulse of unity magnitude - may sometimes give a faster and more smooth operation.

More information on these and other available sequences may be found in the thesis report.

manual Input
Klass Input
Typ Boolean
Flags
GraphName man
Kropp RtBody
Switch that sets the object in manual (1) or automatic (0) mode.
The mode can be switched at any time during operation.
A typical use of the input would be to set the object in manual mode whenever a manual command is given.
Thus an automatic travel can be aborted by touching a joystick or controller used for manual operation.

uCommand Input
Klass Input
Typ Float32
Flags
GraphName UCOM
Kropp RtBody
Command velocity. Assumed to be in interval [-UMAXSM, UMAXSM] (see umax attribute).

xCommand Input
Klass Input
Typ Float32
Flags
GraphName XCOM
Kropp RtBody
Command position. Assumed to be in interval [XMIN, XMAX] (see limits attribute).

xc Input
Klass Input
Typ Float32
Flags
GraphName POS
Kropp RtBody
Current position

DLc Input
Klass Input
Typ Float32
Flags
GraphName dL/dt
Kropp RtBody
Current hoisting velocity (defined as dL/dt, i.e. positive direction down).

Lc Input
Klass Input
Typ Float32
Flags
GraphName L
Kropp RtBody
Current pendulum length.
The pendulum length of a crane is best calibrated by measuring a number
of oscillation periods and then calculating L as L=g*(T/(2pi))^2

umax2 Input
Klass Input
Typ Boolean
Flags
GraphName umax2
Kropp RtBody
Digital input used to switch to a second UMAXSA, (soft maximum velocity in automatic mode)
provided in the umax attribute.
In automatic mode, the object will accomodate the trajectory to the new maximum velocity.
The feature may be used if low-speed restrictions apply to parts of the operation area.

enable Input
Klass Input
Typ Boolean
Flags
GraphName en
Kropp RtBody
On/Off switch. If the object has been stopped due to an error of some kind,
the error status can be reset, and the object reactivated by toggling enable.

amax Intern
Klass Intern
Typ Array of Float32
Flags Array
Elements 4
Kropp RtBody
Array that contains hard and soft maximum accelerations in manual and automatic mode.

amax[0] - AMAXHM. Hard limit of acceleration, manual mode.
amax[1] - AMAXSM. Soft limit of acceleration, manual mode.
amax[2] - AMAXHA. Hard limit of acceleration, automatic mode.
amax[3] - AMAXSA. Soft limit of acceleration, automatic mode.

When the object generates trajectories, the soft maximum acceleration is used.
It should be slightly lower than the hard limit, which is the absolute maximum allowed or possible.
Having a soft limit serves two purposes. Firstly, compensation for
hoisting requires some extra acceleration that can be kicked in when
needed. Secondly, a frequency converter will have better chances of
tracking the trajectory if not operating at its acceleration limit.
A control strategy to ensure trajectory tracking also has better chances
of being successful.
A suitable value of AMAXS that will leave enough acceleration space for
the hoisting compensation can be calculated from the formula;
   AMAXS = AMAXH/(1.0+(1.5*DLMax/sqrt(g*LMin))),
where DLMax is the maximum hoisting speed, g the acceleration of gravity
and LMin the minimum pendulum length.

umax Intern
Klass Intern
Typ Array of Float32
Flags Array
Elements 5
Kropp RtBody
Array that contains hard and soft maximum velocities in manual and automatic mode.

umax[0] - UMAXHM. Hard limit of velocity, manual mode.
umax[1] - UMAXSM. Soft limit of velocity, manual mode.
umax[2] - UMAXHA. Hard limit of velocity, automatic mode.
umax[3] - UMAXSA. Soft limit of velocity, automatic mode.
umax[4] - UMAXSA. Second soft limit of velocity, automatic mode (see umax2 attribute).

Anologue to the amax array above. Soft maximum velocities will be used in normal trajectory generation.


limits Intern
Klass Intern
Typ Array of Float32
Flags Array
Elements 10
Kropp RtBody
Array of adjustable parameter limits. In most cases the default values will do.

limits[0] - ZEROLIM. Default 0.001. Will set reference velocity
	      uR to zero if |uR| < limit.
limits[1] - ERRFACT. Default 2.0. Will stop/deactivate object
	      if |uR|>limit*umaxH.
limits[2] - UR_MIN. Default 0.01. Minimum steady state reference
	      velocity that can be passed to frequency converter.
limits[3] - XMAX. Default 99999.0. Maximum reference position.
limits[4] - XMIN. Default -99999.0. Minimum reference position.
limits[5] - ATTAIN_ERRLIM. Default 0.001. Will warn if final uR
	      misses uCommand (or zero if auto) with more than limit.
limits[6] - L_MIN_CHANGE. Default 0.005. Length interval between
	      compensation for new pendulum length.
limits[7] - DL_MIN. Default 0.005. Minimum hoisting speed that will
	      be compensated for.
limits[8] - XR_ATTAIN_ERRLIM. Default 0.001. Will warn if final xR
	      misses xCommand with more than limit. Auto only
limits[9] - XCOM_MIN_CHANGE. Default 0.01. Minimum change in command
	      position that will invoke a new call. Auto only.


compensate Intern
Klass Intern
Typ Int32
Flags
Kropp RtBody
Compensate for changed / changing pendulum length during automatic travel.

0 - Do not compensate - use the initial pendulum length throughout travel.
1 - Compensate for new L
2 - Compensate for new L and non-zero dL/dt

Compensation in automatic mode can reduces time performance, and may not be necessary.
Often an automated crane will not lift and move simultaneously,
and the effect of not compensating may be negligible even if it does.
An alternative to compensation is to use a more robust antisway strategy, see the mode attribute.


verbose Intern
Klass Intern
Typ Int32
Flags
Kropp RtBody
 Integer value. If verbose =0, the object will tell you about
 its progress (or failure) by printouts to the terminal window
(i.e. it only makes sense if ProviewR is started from a terminal window..).
 There are three degrees of verbosity:

 1 AS_VERB_DISABLED Object will print message if disabled
 2 AS_VERB_ERR Object will print message if any error occurs
 3 AS_VERB_ALL Object will print message when anything new happens

zeroTheta Intern
Klass Intern
Typ Boolean
Flags
Kropp RtBody
 Boolean switch for resetting calculated sway angle
(there is no damping modeled in the sway simuluation).
 The calculated sway angle is not used for anything in the algorithms,
 but is merely a demo/diagnose output.

errstatus Intern
Klass Intern
Typ Mask
Flags
Kropp RtBody
Integer bit mask keeping information of major and minor errors that
has occurred since last reset. The status is most easily controlled in the class graph.
If errstatus > AS_ERR_MINOR, the object will disable itself (it will
not affect the value of enable, though). errstatus is reset by
switching enable, or by using the reset attribute, below.

autostatus Intern
Klass Intern
Typ Mask
Flags
Kropp RtBody
 Integer bit mask used for storing automatic operation status and for
 communication between objects, via the other input.

reset Intern
Klass Intern
Typ Boolean
Flags
Kropp RtBody
 Reset errstatus and autostatus. If set, "reset" is automatically reset once
the errstatus and autostatus attributes have been reset.

flags Intern
Klass Intern
Typ Array of Boolean
Flags Array|State|Noedit
Elements 32
Kropp RtBody
 Array that contains the individual status bits of errstatus and autostatus.
Used for display in the class graph.

aR Intern
Klass Intern
Typ Float64
Flags State|Noedit
Kropp RtBody
 Reference acceleration, 64-bit.

uR Intern
Klass Intern
Typ Float64
Flags State|Noedit
Kropp RtBody
 Reference velocity, 64-bit.

xR Intern
Klass Intern
Typ Array of Float64
Flags Array|State|Noedit
Elements 2
Kropp RtBody
xR[0] - Reference position, 64-bit.
xR[1] - Reference position at previous time step, 64-bit.

thR Intern
Klass Intern
Typ Array of Float64
Flags Array|State|Noedit
Elements 2
Kropp RtBody
 thR[0] - Reference sway angle, 64-bit (diagnose/demo output).
 thR[1] - Reference sway angle at previous time step, 64-bit.

Set Intern
Klass Intern
Typ String32
Flags State|Noedit
Kropp RtBody
The phasor set contains all future acceleration commands,
in the form of an array of phasors. The set is represented
as a 16-byte string. If the struct is changed or if int +
double + pointer = 16 byte, it has to be changed. phasor set members are:

int N	         Number of phasors in the set
double extSum  Acceleration-weighted phase extension sum.
               extSum = sum (|phiEnd - phiStart|*Sa),
		 where the sum is taken over all the phasors in the set.
               Positive for positive acc.
		 Usage: Divide by omega to get the velocity change of
               the set.
AS_phasor *ph	 Pointer to the array of phasors. Memory is allocated
               dynamically.
		 (see AS_phasor_methods.h for a description of the phasor
               struct)

messageQ Intern
Klass Intern
Typ Array of pointers to Char
Flags Pointer|Array|State|Noedit|Invisible|Private
Elements 2
Kropp RtBody
 Queue of warning and error messages.

message Intern
Klass Intern
Typ Array of String80
Flags Array|State|Noedit
Elements 2
Kropp RtBody
 Current / Last warning (message[1]) and error (message[0]) messages.
An error means that the object has deactivated itself, and needs to be restarted.

mparams Intern
Klass Intern
Typ Array of Int32
Flags Array
Elements 4
Kropp RtBody
Parameters that determine the behavior of the message system.

mparams[0] - M_LENGTH. Default 79. Maximum number of characters in message string.
mparams[1] - M_NLIMIT. Default 80. Maximum number of messages in queue.
mparams[2] - M_ALWAIT. Default 20. Wait this number of cycles before taking next message from queue.
mparams[3] - M_ALHOLD. Default 30. Hold the current message this number of cycles.

aRO Output
Klass Output
Typ Float32
Flags State|Noedit
GraphName AR
Kropp RtBody
 Reference acceleration, 32-bit.

uRO Output
Klass Output
Typ Float32
Flags State|Noedit
GraphName UR
Kropp RtBody
 Reference velocity, 32-bit.

xRO Output
Klass Output
Typ Float32
Flags State|Noedit
GraphName XR
Kropp RtBody
Reference position, 32-bit.

thRO Output
Klass Output
Typ Float32
Flags State|Noedit
GraphName THR
Kropp RtBody
Reference sway angle, 32-bit (demo / diagnose).

done Output
Klass Output
Typ Boolean
Flags State|Noedit
GraphName done
Kropp RtBody
True if antisway travel is completed. Can be used in automatic mode to activate
a positioning regulator if not close enough to the command position at end of travel.

Alarm1 Output
Klass Output
Typ Boolean
Flags State|Noedit
GraphName al1
Kropp RtBody
New error message in message[0]. Can be connected to a DSup, where the message string can be stored as well.

Alarm2 Output
Klass Output
Typ Boolean
Flags State|Noedit
GraphName al2
Kropp RtBody
New warning message in message[1]. Can be connected to a DSup, where the message string can be stored as well.

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