Difference between revisions of "Axis Setup Procedure"
m (→Step 4: Position Units Definition) |
(AXY: new links) |
||
(31 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{Languages|Axis_Setup_Procedure}} | |
− | + | The steps below explain how to create and define an axis in the softMC controller. | |
+ | |||
+ | The following are required: | ||
+ | * Running softMC (actual or simulated) | ||
+ | * User interface (ControlStudio) | ||
− | |||
− | |||
== Step 1: Declare Axis == | == Step 1: Declare Axis == | ||
− | + | In the first line of CONFIG.PRG file specify the number of axes that will be in use: | |
− | In the first line of CONFIG.PRG file | ||
− | |||
<pre> | <pre> | ||
Sys.Naxes = <number> | Sys.Naxes = <number> | ||
Line 17: | Line 17: | ||
</pre> | </pre> | ||
− | + | Send the CONFIG.PRG file to softMC and run it by issuing these two lines from terminal window: | |
− | Send | ||
<pre> | <pre> | ||
send config.prg | send config.prg | ||
Line 24: | Line 23: | ||
</pre> | </pre> | ||
− | Now you have your axes defined, it is | + | Now you have your axes defined, it is easy to check by issuing this command from terminal window: |
<pre> | <pre> | ||
->?axislist | ->?axislist | ||
Line 30: | Line 29: | ||
</pre> | </pre> | ||
− | == Step 2: | + | == Step 2: Define Meaningful Axis Name == |
− | |||
System default axis names are not very user friendly (a1,a2,a3, etc.). | System default axis names are not very user friendly (a1,a2,a3, etc.). | ||
It is a good practice to give them more meaningful names. This is done in CONFIG.PRG file only, by assigning a new name to each axis (no double-quotes) to [[MC-Basic:axis.AXISNAME|<axis>.AxisName]] property. | It is a good practice to give them more meaningful names. This is done in CONFIG.PRG file only, by assigning a new name to each axis (no double-quotes) to [[MC-Basic:axis.AXISNAME|<axis>.AxisName]] property. | ||
− | |||
<pre> | <pre> | ||
Sys.Naxes = <number> | Sys.Naxes = <number> | ||
Line 45: | Line 42: | ||
</pre> | </pre> | ||
− | == Step 3: | + | == Step 3: Prepare General Axis Setup == |
− | To | + | To setup system axes, a setup program must be prepared. Let’s call it SETUP.PRG.<br/> |
− | + | '''Note''':<br/> | |
* To access (write to) an axis property, the axis needs to be attached. | * To access (write to) an axis property, the axis needs to be attached. | ||
− | * For some properties, the axis needs to be disabled | + | * For some properties, the axis needs to be disabled. |
'''SETUP.PRG''' | '''SETUP.PRG''' | ||
Line 59: | Line 56: | ||
End Program | End Program | ||
− | Sub SetAxis(ax as generic | + | Sub SetAxis(ax as generic axis) |
With ax | With ax | ||
Attach | Attach | ||
Line 73: | Line 70: | ||
==Step 4: Position Units Definition== | ==Step 4: Position Units Definition== | ||
+ | [[Image:GearMotor.png|GearMotor.png]] | ||
− | + | [[MC-Basic:axis.POSITIONFACTOR|<axis>.PositionFactor]] defines the position units that will be used in all position variables of the specified axis (pcmd, pfb, etc.). It consists of the following: | |
− | |||
− | [[MC-Basic:axis.POSITIONFACTOR|<axis>.PositionFactor]] defines the position units that will be used in all position variables of the specified axis (pcmd, pfb, etc.). It consists of: | ||
− | * Motor encoder resolution seen through the motion | + | * Motor encoder resolution seen through the motion bus (See EtherCAT, SERCOS, CanOPEN). How many counts are there in one motor revolution - stored in pos_units global variable (for each axis differently). |
* Gear ratio (M:N) and/or the pitch of the linear screw (mm/rev). | * Gear ratio (M:N) and/or the pitch of the linear screw (mm/rev). | ||
Line 85: | Line 81: | ||
:*Linear axes: | :*Linear axes: | ||
− | ::For position in | + | ::For position in millimeters PositionFactor is:PFAC = Pos_Units)/MPITCH |
− | [[Image:LinMotor.png| | + | [[Image:LinMotor.png|LinMotor.png]] |
See Motion Bus setup for pos_units and MPITCH setup | See Motion Bus setup for pos_units and MPITCH setup | ||
− | ==Step | + | ==Step 5: Direction of Movement == |
− | |||
Positive direction of drive's position increments does not have to match the desired positive direction of user axis (Upwards, Left-Right, Counterclockwise). Therefore <axis>.direction flag is to be used: | Positive direction of drive's position increments does not have to match the desired positive direction of user axis (Upwards, Left-Right, Counterclockwise). Therefore <axis>.direction flag is to be used: | ||
− | |||
<pre> | <pre> | ||
− | + | <axis>.Direction = {1|-1} | |
</pre> | </pre> | ||
− | |||
Value of '''-1''' indicates direction inversion. | Value of '''-1''' indicates direction inversion. | ||
− | ==Step | + | ==Step 6: Velocity, Acceleration, Jerk Units == |
+ | Velocity/acceleration/jerk units do not have to match position units. Units can be user-defined. For all the derivative units (velocity, acceleration, jerk), the default time scale is in milliseconds; therefore scaling is needed. | ||
− | + | To use position units per second for velocity, the following must be defined: | |
+ | <pre> | ||
+ | <axis>.VelocityFactor = <axis>.PositionFactor/1000 | ||
+ | </pre> | ||
+ | In this case if the user sets the position in millimeters the velocity will be '''mm/sec''' | ||
− | To | + | To define velocity in '''RPM''' of the motor: |
− | + | <pre> | |
− | + | <axis>.VelocityFactor = Pos_Units /1000/60 | |
+ | </pre> | ||
− | + | Acceleration and jerk units are the same; their default values are expressed in velocity and acceleration units per milliseconds. Thus, in order to set them per seconds, they need to be set as: | |
− | + | <pre> | |
− | + | <axis>.AccelerationFactor = <axis>. VelocityFactor /1000 | |
− | + | <axis>.JerkFactor = <axis>. AccelerationFactor /1000 | |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
+ | ==Step 7: Units Summary== | ||
Position, velocity, acceleration and jerk units are set by: | Position, velocity, acceleration and jerk units are set by: | ||
+ | <pre> | ||
+ | <axis>.PositionFactor = … | ||
+ | <axis>.Direction = … | ||
+ | <axis>.VelocityFactor = … | ||
+ | <axis>.AccelerationFactor = … | ||
+ | <axis>.JerkFactor = … | ||
+ | </pre> | ||
− | + | ==Step 8: Position Limits== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==Step | ||
Setting position range of an axis. | Setting position range of an axis. | ||
− | Setting | + | Setting maximum position: |
<axis>.Pmax = … and enabling /disabling it: <axis>.PmaxEn = {0|1} | <axis>.Pmax = … and enabling /disabling it: <axis>.PmaxEn = {0|1} | ||
− | Setting | + | Setting minimum position: |
<axis>.Pmin = … and enabling /disabling it: <axis>.PminEn = {0|1} | <axis>.Pmin = … and enabling /disabling it: <axis>.PminEn = {0|1} | ||
Setting the axis type: | Setting the axis type: | ||
Line 145: | Line 142: | ||
<axis>. PositionRollOverMin | <axis>. PositionRollOverMin | ||
− | + | Note: If the enable flag is not set, the corresponding value does not need to be set. | |
[[Image:Axis-PLIM.PNG|500px]] | [[Image:Axis-PLIM.PNG|500px]] | ||
− | ==Step | + | ==Step 9: Motion Bus Units == |
+ | Depending on the type of motion bus (EtherCAT, SERCOS, CANopen) and drive used, several parameters are available for the user to adjust (but are not necessarily needed): | ||
− | + | If micro-interpolation is turned on in the drive, the velocity sent to drive must be properly scaled; this is done with (for counts per ms): | |
+ | <pre> | ||
+ | <axis>.MotionBusVelocityScale = 0 | ||
+ | <axis>.MotionBusVelocityBase = 1 | ||
+ | </pre> | ||
+ | If a limited drive’s position range is used (other then integer 32 bits): | ||
+ | <pre> | ||
+ | <axis>.CountMin = <drive min position value> | ||
+ | <axis>.CountMax = <drive max position value> | ||
+ | </pre> | ||
− | + | ==Step 10: Motion Parameters== | |
− | + | Motion parameters are grouped into velocity, acceleration and jerk values. All have maximum values for overall limitations, and motion-default values that are used when motion is executed. | |
− | |||
− | |||
− | |||
− | |||
− | + | {| class="wikitable" margin-left: 10px; color: red; border-style: solid; border-width: 3px" | |
− | |||
− | |||
− | |||
− | {| class="wikitable" | ||
| Motion default value is: | | Motion default value is: | ||
− | | [[MC-Basic: | + | | [[MC-Basic:element.VELOCITYCRUISE|'''<axis>.VelocityCruise''']] |
|} | |} | ||
Line 172: | Line 171: | ||
<axis>.Vmax | <axis>.Vmax | ||
− | {| class="wikitable" | + | {| class="wikitable" margin-left: 10px; color: red; border-style: solid; border-width: 3px" |
| Motion default values are: | | Motion default values are: | ||
− | | [[MC-Basic: | + | | [[MC-Basic:element.ACCELERATION|'''<axis>.Acceleration''']] <br> [[MC-Basic:element.DECELERATION|'''<axis>.Deceleration''' ]] |
|} | |} | ||
Acceleration is set according to maximum axis physical limits (Max drive/motor current, axis load) in user units: | Acceleration is set according to maximum axis physical limits (Max drive/motor current, axis load) in user units: | ||
Line 180: | Line 179: | ||
<axis>.Dmax | <axis>.Dmax | ||
− | {| class="wikitable" | + | {| class="wikitable" margin-left: 10px; color: red; border-style: solid; border-width: 3px" |
| Motion default value is: | | Motion default value is: | ||
− | | [[MC-Basic: | + | | [[MC-Basic:element.JERK|'''<axis>.Jerk''']] |
|} | |} | ||
Jerk is the third time-derivation of position, if smooth profiles are used it needs to be defined a good rule of thumb is to set J=BW*A, where J – jerk, A – acceleration, BW- control Bandwidth (Hz). | Jerk is the third time-derivation of position, if smooth profiles are used it needs to be defined a good rule of thumb is to set J=BW*A, where J – jerk, A – acceleration, BW- control Bandwidth (Hz). | ||
<axis>.JerkMax | <axis>.JerkMax | ||
− | ==Step | + | ==Step 11: Safety Parameters== |
Maximum allowed position error (PE). PE is defined as a difference between the position command and position feedback. Due to communication delay of the motion bus and processing time of the drive (micro-interpolation) position command of the several samples before the current is compared to the currently obtained position feedback of the drive: | Maximum allowed position error (PE). PE is defined as a difference between the position command and position feedback. Due to communication delay of the motion bus and processing time of the drive (micro-interpolation) position command of the several samples before the current is compared to the currently obtained position feedback of the drive: | ||
<axis>.PositionErrorMax – max allowed position error during in user units. | <axis>.PositionErrorMax – max allowed position error during in user units. | ||
Line 201: | Line 200: | ||
<axis>.TorqueMaxError | <axis>.TorqueMaxError | ||
− | ==Step | + | ==Step 12: Smoothness== |
− | Different profile types are available from very smooth S-curves (Acceleration | + | Different profile types are available, ranging from very smooth S-curves (Trapezoidal Acceleration, Sine Acceleration) to less smooth but faster Trapezoidal Velocity, to totally edgy profiles (Constant Velocity) by setting these two parameters: |
+ | :<axis>.Smooth defined automatic (0-100) or manual smoothing (-1) | ||
+ | :<axis>.PrfType specifies profile more precisely (Trapezoidal Velocity, Trapezoidal Acceleration, Sine Acceleration) | ||
− | + | ==Step 13: Axis Setup - Complete Example: the SetAxis Subroutine== | |
− | |||
− | |||
− | ==Step | ||
<pre> | <pre> | ||
Line 243: | Line 241: | ||
end sub | end sub | ||
</pre> | </pre> | ||
− | ==Step | + | ==Step 14: Motion Bus EtherCAT Example == |
Position Units | Position Units | ||
Line 254: | Line 252: | ||
::gear ratio = FBGMS / FBGDS | ::gear ratio = FBGMS / FBGDS | ||
− | ==Step | + | ==Step 15: Extra - Dynamic Model == |
− | |||
Torque Scaling | Torque Scaling |
Latest revision as of 09:38, 13 September 2017
Language: | English • 中文(简体) |
---|
The steps below explain how to create and define an axis in the softMC controller.
The following are required:
- Running softMC (actual or simulated)
- User interface (ControlStudio)
Contents
- 1 Step 1: Declare Axis
- 2 Step 2: Define Meaningful Axis Name
- 3 Step 3: Prepare General Axis Setup
- 4 Step 4: Position Units Definition
- 5 Step 5: Direction of Movement
- 6 Step 6: Velocity, Acceleration, Jerk Units
- 7 Step 7: Units Summary
- 8 Step 8: Position Limits
- 9 Step 9: Motion Bus Units
- 10 Step 10: Motion Parameters
- 11 Step 11: Safety Parameters
- 12 Step 12: Smoothness
- 13 Step 13: Axis Setup - Complete Example: the SetAxis Subroutine
- 14 Step 14: Motion Bus EtherCAT Example
- 15 Step 15: Extra - Dynamic Model
Step 1: Declare Axis
In the first line of CONFIG.PRG file specify the number of axes that will be in use:
Sys.Naxes = <number> … Program … End Program
Send the CONFIG.PRG file to softMC and run it by issuing these two lines from terminal window:
send config.prg reset all
Now you have your axes defined, it is easy to check by issuing this command from terminal window:
->?axislist A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17
Step 2: Define Meaningful Axis Name
System default axis names are not very user friendly (a1,a2,a3, etc.). It is a good practice to give them more meaningful names. This is done in CONFIG.PRG file only, by assigning a new name to each axis (no double-quotes) to <axis>.AxisName property.
Sys.Naxes = <number> … Program a1.AxisName = Xaxis a2.AxisName = Lift … End Program
Step 3: Prepare General Axis Setup
To setup system axes, a setup program must be prepared. Let’s call it SETUP.PRG.
Note:
- To access (write to) an axis property, the axis needs to be attached.
- For some properties, the axis needs to be disabled.
SETUP.PRG
Program Call SetAxis(a1) Call SetAxis(a2) … End Program Sub SetAxis(ax as generic axis) With ax Attach En = 0 … <stuff goes here> … Detach End With End Sub
Step 4: Position Units Definition
<axis>.PositionFactor defines the position units that will be used in all position variables of the specified axis (pcmd, pfb, etc.). It consists of the following:
- Motor encoder resolution seen through the motion bus (See EtherCAT, SERCOS, CanOPEN). How many counts are there in one motor revolution - stored in pos_units global variable (for each axis differently).
- Gear ratio (M:N) and/or the pitch of the linear screw (mm/rev).
- Rotary axes:
- For position in degrees PositionFactor is:PFAC = Pos_Units *(M/N)/360
- Linear axes:
- For position in millimeters PositionFactor is:PFAC = Pos_Units)/MPITCH
See Motion Bus setup for pos_units and MPITCH setup
Step 5: Direction of Movement
Positive direction of drive's position increments does not have to match the desired positive direction of user axis (Upwards, Left-Right, Counterclockwise). Therefore <axis>.direction flag is to be used:
<axis>.Direction = {1|-1}
Value of -1 indicates direction inversion.
Step 6: Velocity, Acceleration, Jerk Units
Velocity/acceleration/jerk units do not have to match position units. Units can be user-defined. For all the derivative units (velocity, acceleration, jerk), the default time scale is in milliseconds; therefore scaling is needed.
To use position units per second for velocity, the following must be defined:
<axis>.VelocityFactor = <axis>.PositionFactor/1000
In this case if the user sets the position in millimeters the velocity will be mm/sec
To define velocity in RPM of the motor:
<axis>.VelocityFactor = Pos_Units /1000/60
Acceleration and jerk units are the same; their default values are expressed in velocity and acceleration units per milliseconds. Thus, in order to set them per seconds, they need to be set as:
<axis>.AccelerationFactor = <axis>. VelocityFactor /1000 <axis>.JerkFactor = <axis>. AccelerationFactor /1000
Step 7: Units Summary
Position, velocity, acceleration and jerk units are set by:
<axis>.PositionFactor = … <axis>.Direction = … <axis>.VelocityFactor = … <axis>.AccelerationFactor = … <axis>.JerkFactor = …
Step 8: Position Limits
Setting position range of an axis. Setting maximum position:
<axis>.Pmax = … and enabling /disabling it: <axis>.PmaxEn = {0|1}
Setting minimum position:
<axis>.Pmin = … and enabling /disabling it: <axis>.PminEn = {0|1}
Setting the axis type:
<axis>.AxisType = 0 ‘ For linear axes <axis>.AxisType = 1 ‘ For rotary axes
For rotary axes rollover can be defined: Enabling/Disabling it:
<axis>.PositionRollOverEnable = {0|1}
Setting the whole range:
<axis>. PositionRollOver
Setting the low value:
<axis>. PositionRollOverMin
Note: If the enable flag is not set, the corresponding value does not need to be set.
Step 9: Motion Bus Units
Depending on the type of motion bus (EtherCAT, SERCOS, CANopen) and drive used, several parameters are available for the user to adjust (but are not necessarily needed):
If micro-interpolation is turned on in the drive, the velocity sent to drive must be properly scaled; this is done with (for counts per ms):
<axis>.MotionBusVelocityScale = 0 <axis>.MotionBusVelocityBase = 1
If a limited drive’s position range is used (other then integer 32 bits):
<axis>.CountMin = <drive min position value> <axis>.CountMax = <drive max position value>
Step 10: Motion Parameters
Motion parameters are grouped into velocity, acceleration and jerk values. All have maximum values for overall limitations, and motion-default values that are used when motion is executed.
Motion default value is: | <axis>.VelocityCruise |
Velocity is set according to maximum axis physical limit (drives/motor capabilities and mechanical limitations):
<axis>.Vmax
Motion default values are: | <axis>.Acceleration <axis>.Deceleration |
Acceleration is set according to maximum axis physical limits (Max drive/motor current, axis load) in user units:
<axis>.Amax <axis>.Dmax
Motion default value is: | <axis>.Jerk |
Jerk is the third time-derivation of position, if smooth profiles are used it needs to be defined a good rule of thumb is to set J=BW*A, where J – jerk, A – acceleration, BW- control Bandwidth (Hz).
<axis>.JerkMax
Step 11: Safety Parameters
Maximum allowed position error (PE). PE is defined as a difference between the position command and position feedback. Due to communication delay of the motion bus and processing time of the drive (micro-interpolation) position command of the several samples before the current is compared to the currently obtained position feedback of the drive:
<axis>.PositionErrorMax – max allowed position error during in user units. <axis>.PositionErrorDelay – number of samples used for delay computation.
Velocity (Runaway) Protection, the feedback velocity of the motor is checked every sample (recommended to be set to 120% of the <axis>.VelocityMax)
<axis>.VelocityOverSpeed
Sanity Threshold, as a final protection against unintentional jumps (recommended to be set to 1000% of <axis>.VelocityMax):
<axis>.VelocitySafetyLimit
Torque Error – only if axis dynamic model is turned on
<axis>.TorqueMaxError
Step 12: Smoothness
Different profile types are available, ranging from very smooth S-curves (Trapezoidal Acceleration, Sine Acceleration) to less smooth but faster Trapezoidal Velocity, to totally edgy profiles (Constant Velocity) by setting these two parameters:
- <axis>.Smooth defined automatic (0-100) or manual smoothing (-1)
- <axis>.PrfType specifies profile more precisely (Trapezoidal Velocity, Trapezoidal Acceleration, Sine Acceleration)
Step 13: Axis Setup - Complete Example: the SetAxis Subroutine
sub SetRotAxis(ax as generic axis, byval minval as double , byval maxval as double) with ax attach En = 0 AxisType = 1 PositionFactor = pos_unit/360 VelocityFactor = PositionFactor /1000 AccelerationFactor = VelocityFactor /1000 Jerkfactor = AccelerationFactor /1000 VelocityMax = 1000 AccelerationMax = 10000 DecelerationMax= 10000 JerkMax = 20*amax VelocityCruise = 0.5*VelocityMax Acceleration = AccelerationMax Deceleration = DecelerationMax Jerk = JerkMax PrfType = -1 Smooth = -1 VelocityOverspeed = 1.2*VelocityMax VelocitySafetyLimit = 10*VelocityMax PositionErrorDelay = 2 PositionErrorMax = 1 PositionMax = maxval PositionMin = minval PositionMaxEn = 1 PositionMinEn = 1 PositionRolloverEnable = 0 detach end with end sub
Step 14: Motion Bus EtherCAT Example
Position Units
- First read the motor encoder resolution (MENCRES – SDO:0x20F1:0)
- MENCRES = EC_SDO_READ(<addr>,0x20f1,0)
Then set (value of 1) the configured number of motor shaft revolutions and number of driving shaft revolutions. The gear ratio is calculated by the following:
- Fieldbus CANopen Gear Motor Shaft Scaling (FBGMS – SDO0x2091:0)
- Fieldbus CANopen Gear Driving Shaft Scaling (FBGDS – SDO0x2091:1)
- gear ratio = FBGMS / FBGDS
Step 15: Extra - Dynamic Model
Torque Scaling
- <axis>.TorqueFactor – according to the Motor KT parameter
Limits
- <axis>.TorqueMax – maximum motor torque
Dynamic Model Parameters
- axis.DYNAMICMODEL[..] = <…>