| ApossC SDK V01.15

Functions
SDK_Amplifier_MotorCommissioning.mc File Reference

Functions for commissioning a motor. More...

`#include <SysDef.mh>`
`#include "SDK_Amplifier_MotorCommissioning.mh"`

Go to the source code of this file.

## Functions
long | sdkMotorCommCurrentStep (long axis, long current, long time, long recordEnable)
| Current step for setting the current controller. More...
long | sdkMotorCommVelStep (long axis, long velocity, long time, long recordEnable)
| Velocity step for setting the velocity controller. More...
long | sdkMotorCommPositionRamp (long axis, long distance, long controlMode, long recordEnable)
| Position ramp for setting the position controller. More...
long | sdkMotorCommHallSignalCheck (long axis)
| Checking the hall signals. More...
long | sdkMotorCommEncoderUserUnitCheck (long axis)
| Checking the configured encoders and the user units. More...

## Detailed Description

Functions for commissioning a motor.

Revision
  241

Definition in file SDK_Amplifier_MotorCommissioning.mc.

## Function Documentation

## ◆ sdkMotorCommCurrentStep()

long sdkMotorCommCurrentStep | ( | long | axis,
|  | long | current,
|  | long | time,
|  | long | recordEnable
| ) |  |

Current step for setting the current controller.

This function can be used to do a current step and record it. The controller parameters can then be adjusted until t he desired behaviour of the current controller is achieved. The axis must be correctly parameterised before calling the function. With the help of this function, the attached example and the utility monitor file ut_Control_Loop_Parameter_Slider.zbm the controller can be adjusted. More information about the controller setting can be found in the ApossIDE Help.

Note
  To adjust the current controller, the motor does not need to move. A step which only takes several ms is enough.

Parameters

  axis | Axis module number
  current | Current for the step in mA
  time | Duration of the current step in ms
  recordEnable | Definition record osciloscope (Only available on MACS6) 0 Record Disable 1 Record Enable

Returns
  value: Always 1 in this function
  value > 0 Process successful
  value = 0 Process is active
  value < 0 Error

Examples
  MotorCommissioning_MaxonECi30.mc.

Definition at line 33 of file SDK_Amplifier_MotorCommissioning.mc.

34 {
35 if (recordEnable==1) // Settings for the recording
36 {
37 RecordIndex( HWAMP_PROCESS_INDEX(axis,PO_HWAMP_CURRENT),
38 AXE_PROCESS_INDEX(axis,REG_USERREFCUR));
39 RecordTimeBase(RECORD_LOOP_CUR);
40 RecordDest(DYNMEM);
41 RecordStart(0);
42 }
43
44 // Set the controller loop
45 HWAMP_PARAM(axis, HWAMP_MODE) = HWAMP_MODE_POS_CUR;
46
47 // Parameters for position controller -> Make sure that the position controller is not running
48 AXE_PARAM(axis, KPROP) = 0; // position-controller proportional factor
49 AXE_PARAM(axis, KINT) = 0; // position-controller integral factor
50 AXE_PARAM(axis, KDER) = 0; // position-controller differencial factor
51 AXE_PARAM(axis, FFVEL) = 0; // position-controller Velocity Feed forward
52 AXE_PARAM(axis, KFFACC) = 0; // position-controller Acceleration Feed Forward
53 AXE_PARAM(axis, KFFDEC) = 0; // position-controller Deceleration Feed Forward
54 AXE_PARAM(axis, POSERR) = 0x7FFFFFFF; // very high to avoid errors
55
56 AxisControl(axis, USERREFCUR); // Turn motor control on with a user defined reference current
57 print("Start current step");
58 Delay(50);
59
60 AXE_PROCESS(axis,REG_USERREFCUR)=current; //Current Step to "current" mA
61 Delay(time); //Wait for "time" ms
62 AXE_PROCESS(axis,REG_USERREFCUR)=0; //Set current to 0 mA
63
64 Delay(50);
65 print("Stop current step");
66 RecordStop(0,0);
67
68 return(1);
69 }

## ◆ sdkMotorCommEncoderUserUnitCheck()

long sdkMotorCommEncoderUserUnitCheck | ( | long | axis | ) |

Checking the configured encoders and the user units.

With this function the number of quadcounts, counts per turn and user units can be compared. The encoder must first be correctly configured. The values are printed in the APossIDE.

Parameters

  axis | Axis module number

Returns
  value: Always 1 in this function
  value > 0 Process successful
  value = 0 Process is active
  value < 0 Error

Examples
  MotorCommissioning_MaxonECi30.mc.

Definition at line 218 of file SDK_Amplifier_MotorCommissioning.mc.

219 {
220 // Turn off the motor
221 AxisControl(axis, OFF);
222 print("Counts per turn [cpt]: ",AXE_PROCESS(axis,REG_ACTPOS)/4);
223 print("Quadcounts [qc] : ",AXE_PROCESS(axis,REG_ACTPOS));
224 print("User units [uu] : ", Apos(axis));
225 print("");
226 return(1);
227 }

## ◆ sdkMotorCommHallSignalCheck()

long sdkMotorCommHallSignalCheck | ( | long | axis | ) |

Checking the hall signals.

With this function, the individual hall states and the position can be read out. The states are printed in the ApossiDE.

Parameters

  axis | Axis module number

Returns
  value: Always 1 in this function
  value > 0 Process successful
  value = 0 Process is active
  value < 0 Error

Examples
  MotorCommissioning_MaxonECi30.mc.

Definition at line 195 of file SDK_Amplifier_MotorCommissioning.mc.

196 {
197 // Turn off the motor and set a hall commtype
198 AxisControl(axis, OFF);
199 HWAMP_PARAM(axis,HWAMP_COMMTYPE)=HWAMP_COMMTYPE_BLDC;
200
201 print("HALL Bit 0: ", HWHALL_PROCESS(axis,PO_HWHALL_STATUS).i[0]);
202 print("HALL Bit 1: ", HWHALL_PROCESS(axis,PO_HWHALL_STATUS).i[1]);
203 print("HALL Bit 2: ", HWHALL_PROCESS(axis,PO_HWHALL_STATUS).i[2]);
204 print("HALL Position: ", HWHALL_PROCESS(axis,PO_HWHALL_POS));
205
206 return(1);
207 }

## ◆ sdkMotorCommPositionRamp()

long sdkMotorCommPositionRamp | ( | long | axis,
|  | long | distance,
|  | long | controlMode,
|  | long | recordEnable
| ) |  |

Position ramp for setting the position controller.

This function can be used to do a positon ramp and record it. The controller parameters can then be adjusted until the desired behaviour of the position controller is achieved. The axis must be correctly parameterised before calling the function. With the help of this function, the attached example and the utility monitor file ut_Control_Loop_Parameter_Slider.zbm the controller can be adjusted. More information about the controller setting can be found in the ApossIDE Help.

Parameters

  axis | Axis module number
  distance | Relative distance in user units between start and end position
  controlMode | Define control typ (default 3) 0 HWAMP_MODE_POS_VEL_CUR: Pos -> Vel -> Cur -> PWM 1 HWAMP_MODE_POS_VEL: Pos -> Vel -> PWM 2 HWAMP_MODE_POS_CUR: Pos -> Cur -> PWM 3 HWAMP_MODE_POS: Pos -> PWM
  recordEnable | Definition record osciloscope (Only available on MACS6) 0 Record Disable 1 Record Enable

Returns
  value: Always 1 in this function
  value > 0 Process successful
  value = 0 Process is active
  value < 0 Error

Examples
  MotorCommissioning_MaxonECi30.mc.

Definition at line 154 of file SDK_Amplifier_MotorCommissioning.mc.

155 {
156 if (recordEnable==1) // Settings for the recording
157 {
158 RecordIndex( AXE_PROCESS_INDEX(axis,REG_COMPOS),
159 AXE_PROCESS_INDEX(axis,REG_ACTPOS),
160 AXE_PROCESS_INDEX(axis,REG_TRACKERR));
161 RecordDest(DYNMEM);
162 RecordStart(0);
163 }
164
165 // Set controller loop
166 HWAMP_PARAM(axis, HWAMP_MODE) = controlMode;
167 AXE_PARAM(axis, POSERR) = 0x7FFFFFFF; // very high to avoid errors
168
169 AxisControl(axis, ON); // Turn the motor on
170 print("Start position ramp");
171 Delay(50);
172
173 AxisPosRelStart(axis, distance); // Start relative movement
174 AxisWaitReached(axis); // Wait until target ist reached
175
176 Delay(50);
177 print("Stop position ramp");
178 RecordStop(0,0);
179
180 return(1);
181 }

## ◆ sdkMotorCommVelStep()

long sdkMotorCommVelStep | ( | long | axis,
|  | long | velocity,
|  | long | time,
|  | long | recordEnable
| ) |  |

Velocity step for setting the velocity controller.

This function can be used to do a velocity step and record it. The controller parameters can then be adjusted until the desired behaviour of the current controller is achieved. The axis must be correctly parameterised before calling the function. With the help of this function, the attached example and the utility monitor file ut_Control_Loop_Parameter_Slider.zbm the controller can be adjusted. More information about the controller setting can be found in the ApossIDE Help.

Note
  To adjust the velocity controller, the motor does need to move. The speed must be achievable in the selected time.

Parameters

  axis | Axis module number
  velocity | Velocity for the step, scaling is —0x4000 to 0x4000 for -100 to 100% of VELMAX
  time | Duration of the velocity step in ms
  recordEnable | Definition record osciloscope (Only available on MACS6) 0 Record Disable 1 Record Enable

Returns
  value: Always 1 in this function
  value > 0 Process successful
  value = 0 Process is active
  value < 0 Error

Examples
  MotorCommissioning_MaxonECi30.mc.

Definition at line 91 of file SDK_Amplifier_MotorCommissioning.mc.

92 {
93 // Settings for the recording
94 if (recordEnable==1)
95 {
96 RecordIndex( HWAMP_PROCESS_INDEX(axis,PO_HWAMP_VELPI_ACTUAL),
97 HWAMP_PROCESS_INDEX(axis,PO_HWAMP_VELPI_REF));
98 RecordTimeBase(RECORD_LOOP_VEL);
99 RecordDest(DYNMEM);
100 RecordStart(0);
101 }
102
103 // Set the controller loop
104 HWAMP_PARAM(axis, HWAMP_MODE) = HWAMP_MODE_POS_VEL_CUR;
105
106 // Parameters for position controller -> Make sure that the position controller is not running
107 AXE_PARAM(axis, KPROP) = 0; // position-controller proportional factor
108 AXE_PARAM(axis, KINT) = 0; // position-controller integral factor
109 AXE_PARAM(axis, KDER) = 0; // position-controller differencial factor
110 AXE_PARAM(axis, FFVEL) = 0; // position-controller Velocity Feed forward
111 AXE_PARAM(axis, KFFACC) = 0; // position-controller Acceleration Feed Forward
112 AXE_PARAM(axis, KFFDEC) = 0; // position-controller Deceleration Feed Forward
113 AXE_PARAM(axis, POSERR) = 0x7FFFFFFF; // very high to avoid errors
114
115
116 AxisControl(axis, USERREFVEL); // Turn motor control on with a user defined reference current
117 print("Start velocity step");
118 Delay(50);
119
120 AXE_PROCESS(axis,REG_USERREFVEL)=velocity; // Velcity step to "velocity"
121 Delay(time); // Wait for "time" ms
122 AXE_PROCESS(axis,REG_USERREFVEL)=0; // Set velocity to 0
123
124 Delay(50);
125 print("Stop velocity step");
126 RecordStop(0,0);
127
128 return(1);
129 }
HWAMP_MODE
#define HWAMP_MODE
Mode of operation.
Definition: SdoDictionary.mh:7639
HWAMP_COMMTYPE
#define HWAMP_COMMTYPE
Commutation type in use.
Definition: SdoDictionary.mh:7749
PO_HWAMP_VELPI_REF
#define PO_HWAMP_VELPI_REF
Reference of velocity controller.
Definition: SdoDictionary.mh:11637
PO_HWHALL_POS
#define PO_HWHALL_POS
Position value (incrementing/decrementing)
Definition: SdoDictionary.mh:11982
AXE_PROCESS
#define AXE_PROCESS(modno, parno)
Axis Process Data: Setter.
Definition: SdoDictionary.mh:3187
HWHALL_PROCESS
#define HWHALL_PROCESS(modno, parno)
HW Hall Sensor Process Data: Setter.
Definition: SdoDictionary.mh:11968
KFFDEC
#define KFFDEC
Deceleration Feed Forward.
Definition: SdoDictionary.mh:3111
PO_HWHALL_STATUS
#define PO_HWHALL_STATUS
Digital input status of HALL sensor (3 bits, 0...7)
Definition: SdoDictionary.mh:11977
KDER
#define KDER
Derivative Factor for PID position control loop.
Definition: SdoDictionary.mh:2413
PO_HWAMP_CURRENT
#define PO_HWAMP_CURRENT
Actual current.
Definition: SdoDictionary.mh:11357
POSERR
#define POSERR
Maximum tolerated position error.
Definition: SdoDictionary.mh:2444
REG_ACTPOS
#define REG_ACTPOS
Actual position value.
Definition: SdoDictionary.mh:3199
REG_USERREFCUR
#define REG_USERREFCUR
Motor current reference value in AxisControl(USERREFCUR) mode.
Definition: SdoDictionary.mh:3414
HWAMP_MODE_POS_CUR
#define HWAMP_MODE_POS_CUR
Definition: SdoDictionary.mh:8273
PO_HWAMP_VELPI_ACTUAL
#define PO_HWAMP_VELPI_ACTUAL
Same as PO_HWAMP_VEL_VEL.
Definition: SdoDictionary.mh:11631
AXE_PROCESS_INDEX
#define AXE_PROCESS_INDEX(modno, parno)
Axis Process Data: Getter.
Definition: SdoDictionary.mh:3175
REG_USERREFVEL
#define REG_USERREFVEL
User velocity reference value for AxisControl(AxisNo, USERREFVEL) mode.
Definition: SdoDictionary.mh:3339
AXE_PARAM
#define AXE_PARAM(modno, parno)
Axis Parameters: Setter.
Definition: SdoDictionary.mh:2293
REG_COMPOS
#define REG_COMPOS
Set-point position value.
Definition: SdoDictionary.mh:3207
KFFACC
#define KFFACC
Acceleration Feed Forward.
Definition: SdoDictionary.mh:3102
HWAMP_MODE_POS_VEL_CUR
#define HWAMP_MODE_POS_VEL_CUR
Definition: SdoDictionary.mh:8271
HWAMP_PARAM
#define HWAMP_PARAM(modno, parno)
HW Amplifier Parameters: Setter.
Definition: SdoDictionary.mh:7627
FFVEL
#define FFVEL
Velocity Feed forward.
Definition: SdoDictionary.mh:2644
KPROP
#define KPROP
Proportional value for PID position control loop.
Definition: SdoDictionary.mh:2404
KINT
#define KINT
Integral value for PID position control loop.
Definition: SdoDictionary.mh:2422
HWAMP_PROCESS_INDEX
#define HWAMP_PROCESS_INDEX(modno, parno)
HW Amplifier Process Data: Getter.
Definition: SdoDictionary.mh:11329
REG_TRACKERR
#define REG_TRACKERR
Actual position tracking error.
Definition: SdoDictionary.mh:3239
HWAMP_COMMTYPE_BLDC
#define HWAMP_COMMTYPE_BLDC
Definition: SdoDictionary.mh:8283

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

Maxon Support Center