ApossC SDK  V01.15
SDK_Axis_Setup.mc
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include <SysDef.mh>
21 #include "SDK_Axis_Setup.mh"
22 
36 long sdkSetupPositionPIDControl(long axis, long kprop, long kint, long kder)
37 {
38  // Parameters for position controller
39  AXE_PARAM(axis, KPROP) = kprop; // position-controller proportional factor: 1 … 65000
40  AXE_PARAM(axis, KINT) = kint; // position-controller integral factor: 0 … 65000
41  AXE_PARAM(axis, KDER) = kder; // position-controller differencial factor: 0 … 65000
42 
43  return(1);
44 }
45 
65 long sdkSetupPositionPIDControlExt(long axis, long kprop, long kint, long kder, long kilim, long kilimtime, long bandwidth, long ffvel, long kffacc, long kffdec)
66 {
67  // Parameters for position controller
68  AXE_PARAM(axis, KPROP) = kprop; // position-controller proportional factor: 1 … 65000
69  AXE_PARAM(axis, KINT) = kint; // position-controller integral factor: 0 … 65000
70  AXE_PARAM(axis, KDER) = kder; // position-controller differencial factor: 0 … 65000
71 
72  AXE_PARAM(axis, KILIM) = kilim; // position-controller limits the integral sum: 0 … 65000
73  AXE_PARAM(axis, KILIMTIME) = kilimtime;// position-controller Time used to for integral limit: -10000…10000
74  AXE_PARAM(axis, BANDWIDTH) = bandwidth;// position-controller Bandwidth of the PID filter: 0 … 2000
75  AXE_PARAM(axis, FFVEL) = ffvel; // position-controller Velocity Feed forward: 0…100000
76  AXE_PARAM(axis, KFFACC) = kffacc; // position-controller Acceleration Feed Forward: 0 … 8000
77  AXE_PARAM(axis, KFFDEC) = kffdec; // position-controller Deceleration Feed Forward: 0 … 8000
78 
79  return(1);
80 }
81 
104 long sdkSetupAxisUserUnits(long axis, long posencrev, long posencqc, long posfact_z, long posfact_n, long feedrev, long feeddist)
105 {
106  AXE_PARAM(axis,POSENCREV) = posencrev; // Number of revolutions of the motor
107  AXE_PARAM(axis,POSENCQC) = posencqc; // Number of quadcounts in POSENCREV revolutions
108  AXE_PARAM(axis,POSFACT_Z) = posfact_z; // Number of revolutions of the input shaft
109  AXE_PARAM(axis,POSFACT_N) = posfact_n; // Number of revolutions of the output shaft in POSFACT_Z revolutions of the input shaft
110  AXE_PARAM(axis,FEEDREV) = feedrev; // Number of revolutions of the gear box output shaft
111  AXE_PARAM(axis,FEEDDIST) = feeddist; // Distance travelled (in user units) in FEEDREV revolutions of the gear box output shaft
112 
113  return(1);
114 }
115 
116 
136 long sdkSetupAxisMovementParam(long axis, long velres, long maxRpm, long ramptype, long rampmin, long jerkmin, long poserr)
137 {
138  AXE_PARAM(axis, VELRES) = velres; // Velocity resolution
139  AXE_PARAM(axis, VELMAX) = maxRpm; // Rated speed of drive
140  AXE_PARAM(axis, RAMPTYPE) = ramptype; // Ramp type
141  AXE_PARAM(axis, RAMPMIN) = rampmin; // Maximum acceleration
142  AXE_PARAM(axis, JERKMIN) = jerkmin; // Minimum time required before reaching the maximum acceleration
143  AXE_PARAM(axis, POSERR) = poserr; // Maximum tolerated position error
144 
145  return(1);
146 }
147 
162 long sdkSetupAxisJerkLimited(long axis, long jerkmin1, long jerkmin2, long jerkmin3, long jerkmin4)
163 {
164  AXE_PARAM(axis, RAMPTYPE) = RAMPTYPE_JERKLIMITED; // Ramp type: Jerk limited
165  AXE_PARAM(axis, JERKMIN) = jerkmin1;
166  AXE_PARAM(axis, JERKMIN2) = jerkmin2;
167  AXE_PARAM(axis, JERKMIN3) = jerkmin3;
168  AXE_PARAM(axis, JERKMIN4) = jerkmin4;
169 
170  return(1);
171 }
172 
173 
186 long sdkSetupAxisDirection(long axis, long posdrct)
187 {
188  // Set rotation direction
189  if (posdrct==1 || posdrct==-1 )
190  {
191  VIRTAMP_PARAM(axis,VIRTAMP_INVERT)=posdrct;
193  }
194  else // Error
195  {
196  print("SDK Error: not supported rotation direction");
197  return(-1);
198  }
199 
200  return(1);
201 }
202 
215 long skdSetupAxisSoftwareLimit( long axis, long negLimitUu, long posLimitUu)
216 {
217  AXE_PARAM(axis,NEGLIMIT) = negLimitUu * ((double)(AXE_PARAM(axis,FEEDREV)*AXE_PARAM(axis,POSFACT_Z)*AXE_PARAM(axis,POSENCQC))/((double)AXE_PARAM(axis,FEEDDIST)*AXE_PARAM(axis,POSFACT_N)*AXE_PARAM(axis,POSENCREV)));
218  AXE_PARAM(axis,POSLIMIT) = posLimitUu * ((double)(AXE_PARAM(axis,FEEDREV)*AXE_PARAM(axis,POSFACT_Z)*AXE_PARAM(axis,POSENCQC))/((double)AXE_PARAM(axis,FEEDDIST)*AXE_PARAM(axis,POSFACT_N)*AXE_PARAM(axis,POSENCREV)));
219  print("Set negative software limit to ", AXE_PARAM(axis,NEGLIMIT), " qc");
220  print("Set positive software limit to ", AXE_PARAM(axis,POSLIMIT), " qc");
221  return(1);
222 }
223 
238 long skdEnableAxisSoftwareLimit( long axis, long active)
239 {
240  if(active == 0)
241  {
242  AXE_PARAM(axis,SWPOSLIMACT) = active;
243  AXE_PARAM(axis,SWNEGLIMACT) = active;
244  print("Disable software limit axis ", axis);
245  }
246  else
247  {
248  AXE_PARAM(axis,SWPOSLIMACT) = 1;
249  AXE_PARAM(axis,SWNEGLIMACT) = 1;
250  print("Enable software limit axis ", axis);
251  }
252 
253  return(1);
254 }
255 
RAMPTYPE
#define RAMPTYPE
Ramp type.
Definition: SdoDictionary.mh:2610
VIRTCOUNTIN_PARAM
#define VIRTCOUNTIN_PARAM(modno, parno)
Virtual Counter Inputs parameters: Setter.
Definition: SdoDictionary.mh:4985
sdkSetupAxisUserUnits
long sdkSetupAxisUserUnits(long axis, long posencrev, long posencqc, long posfact_z, long posfact_n, long feedrev, long feeddist)
Setup to convert the resolution of the machine in user units.
Definition: SDK_Axis_Setup.mc:104
POSFACT_Z
#define POSFACT_Z
User factor numerator.
Definition: SdoDictionary.mh:2528
JERKMIN2
#define JERKMIN2
Minimum time required to ramp the acceleration down from maximum acceleration to 0.
Definition: SdoDictionary.mh:2947
VELMAX
#define VELMAX
Rated speed of drive.
Definition: SdoDictionary.mh:2308
KFFDEC
#define KFFDEC
Deceleration Feed Forward.
Definition: SdoDictionary.mh:3111
skdEnableAxisSoftwareLimit
long skdEnableAxisSoftwareLimit(long axis, long active)
Activation of the axis software limits.
Definition: SDK_Axis_Setup.mc:238
KILIMTIME
#define KILIMTIME
Time used to increase or decrease the integral limit.
Definition: SdoDictionary.mh:2983
KDER
#define KDER
Derivative Factor for PID position control loop.
Definition: SdoDictionary.mh:2413
skdSetupAxisSoftwareLimit
long skdSetupAxisSoftwareLimit(long axis, long negLimitUu, long posLimitUu)
Setting up a software axis limitation in user units.
Definition: SDK_Axis_Setup.mc:215
POSERR
#define POSERR
Maximum tolerated position error.
Definition: SdoDictionary.mh:2444
FEEDREV
#define FEEDREV
Feed revolutions.
Definition: SdoDictionary.mh:3022
SWPOSLIMACT
#define SWPOSLIMACT
Positive software end limit active.
Definition: SdoDictionary.mh:2498
NEGLIMIT
#define NEGLIMIT
Negative software limit position.
Definition: SdoDictionary.mh:2331
POSENCREV
#define POSENCREV
Encoder resolution revolution count.
Definition: SdoDictionary.mh:3045
POSENCQC
#define POSENCQC
Encoder resolution quadcount.
Definition: SdoDictionary.mh:3035
VIRTAMP_PARAM
#define VIRTAMP_PARAM(modno, parno)
Virtual Amplifier Parameters: Setter.
Definition: SdoDictionary.mh:5280
RAMPMIN
#define RAMPMIN
Maximum acceleration.
Definition: SdoDictionary.mh:2601
FEEDDIST
#define FEEDDIST
Feed distance.
Definition: SdoDictionary.mh:3011
JERKMIN4
#define JERKMIN4
Minimum time required to ramp the deceleration down from maximum deceleration to 0.
Definition: SdoDictionary.mh:2969
KILIM
#define KILIM
Limit value for the integral sum of the PID position control loop.
Definition: SdoDictionary.mh:2507
JERKMIN
#define JERKMIN
Minimum time required before reaching the maximum acceleration.
Definition: SdoDictionary.mh:2936
VIRTAMP_INVERT
#define VIRTAMP_INVERT
Output reference reversion.
Definition: SdoDictionary.mh:5467
AXE_PARAM
#define AXE_PARAM(modno, parno)
Axis Parameters: Setter.
Definition: SdoDictionary.mh:2293
SDK_Axis_Setup.mh
Declaration of the axis setup function.
RAMPTYPE_JERKLIMITED
#define RAMPTYPE_JERKLIMITED
Definition: SdoDictionary.mh:3157
SWNEGLIMACT
#define SWNEGLIMACT
Negative software end limit active.
Definition: SdoDictionary.mh:2487
KFFACC
#define KFFACC
Acceleration Feed Forward.
Definition: SdoDictionary.mh:3102
sdkSetupAxisDirection
long sdkSetupAxisDirection(long axis, long posdrct)
Definition of the rotation direction of the axis.
Definition: SDK_Axis_Setup.mc:186
POSFACT_N
#define POSFACT_N
User factor denominator.
Definition: SdoDictionary.mh:2561
VIRTCNTIN_UUFACT_UNITNO
#define VIRTCNTIN_UUFACT_UNITNO
Conversion Factor - number of user units.
Definition: SdoDictionary.mh:5067
sdkSetupPositionPIDControlExt
long sdkSetupPositionPIDControlExt(long axis, long kprop, long kint, long kder, long kilim, long kilimtime, long bandwidth, long ffvel, long kffacc, long kffdec)
Set extended parameters for PID position control loop.
Definition: SDK_Axis_Setup.mc:65
sdkSetupAxisJerkLimited
long sdkSetupAxisJerkLimited(long axis, long jerkmin1, long jerkmin2, long jerkmin3, long jerkmin4)
Definition of the jerk limited extended parameter.
Definition: SDK_Axis_Setup.mc:162
JERKMIN3
#define JERKMIN3
Minimum time required to ramp the deceleration up from 0 to maximum deceleration.
Definition: SdoDictionary.mh:2958
sdkSetupAxisMovementParam
long sdkSetupAxisMovementParam(long axis, long velres, long maxRpm, long ramptype, long rampmin, long jerkmin, long poserr)
Defines parameters which are required for the calculation of ramps and velocities.
Definition: SDK_Axis_Setup.mc:136
VELRES
#define VELRES
Velocity resolution.
Definition: SdoDictionary.mh:2517
FFVEL
#define FFVEL
Velocity Feed forward.
Definition: SdoDictionary.mh:2644
KPROP
#define KPROP
Proportional value for PID position control loop.
Definition: SdoDictionary.mh:2404
POSLIMIT
#define POSLIMIT
Positive software limit position.
Definition: SdoDictionary.mh:2342
KINT
#define KINT
Integral value for PID position control loop.
Definition: SdoDictionary.mh:2422
BANDWIDTH
#define BANDWIDTH
Bandwidth within which the PID filter is active.
Definition: SdoDictionary.mh:2635
sdkSetupPositionPIDControl
long sdkSetupPositionPIDControl(long axis, long kprop, long kint, long kder)
Set parameters for PID position control loop.
Definition: SDK_Axis_Setup.mc:36

Data Sheets | Released Software | Software Manuals | Hardware Manuals | Maxon Shop

Maxon Support Center