Professional Documents
Culture Documents
AWL Axes Management (En SW nf0)
AWL Axes Management (En SW nf0)
Via dell’Artigianato, 21
31050 Vascon (TV)
Tel. 0422/447411 - Fax 0422/447444
e-mail:cmz@cmz.it – support@cmz.it
331 SOFTWARE axes controller in AWL
WARNING
CMZ Sistemi Elettronici can modify or improve the products herein described at any time without prior notice.
This manual has been written by CMZ Sistemi Elettronici exclusively for its customers to provide them with the latest
and more updated information on its products. Information in this document is subject to change and does not represent a
commitment on the part of the company.
Special attention is required when using the functions herein described to avoid any possible danger for workers, damages
to the machines or any consequential damage that may result from wrong installation or misuse of the equipment.
No further guarantees are given by CMZ Sistemi Elettronici in particular for imperfections, incomplete information
and/or operative difficulties.
This manual is meant for the programmers of CTE300 and of those systems based on 331CPU card. Please note that
while CTE300 has a precise hardware configuration with maximum three axes, the other systems can have up to 16 axes.
The program for axes control in this operative system enables to operate on all axes, but to store in memory only 4 axes.
If the application would require a larger number of axes, it is necessary to allocate their relative memory areas (one for
each exceeding axis) directly in the user program. This manual does not introduce the modalities for memory allocation.
In the systems based on the 331CPU card the ENCODA card or the MINENC + CNV312 cards (or others) can be used to
control axes. The program for axes control expects the use of the ENCODA card. For other cards, the user's program
should be compiled together whit the drivers program provided by CMZ.
This manual does not introduce the operative modalities for these drivers and their installation procedure, but it will be
soon completed with all the missing instructions. Meanwhile CMZ's tchnicians are available for all further information
and explanations about operative modalities the customer might need.
SUMMARY
CORRECTION...................................................................................................................................... 85
The aim of this manual is that of providing AWL programmers with all the necessary information on
axes control. In particular on:
For the comprehension of this manual, knowledge of the AWL language system is required, as
explained in the 331 SOFTWARE - PLC User’s manual.
The program for axes control enables all motion functions and is fully controlled by the AWL
program. It is activated by interrupt on high priority every millisecond and separately examines
each axis. Therefore if three axes are enabled at the same time, the sampling time for each axis (Tc)
is three milliseconds.
In this program there are two different sections, operated in a sequence:
• a section for quota generation, which generates the theoretical axis’s trajectory.
• a section for quota regulation, which tries to maintain null the error between the real and the
theoretical quota.
For the programmer that uses the standard functions the management of these sections is
transparent.
In the following paragraph, comes furnished an explanation of the axes program operation way and
of the possible commands.
For a detailed explanation of each command see chapter 3.
The motion program is activated by the cm-start function that requires the number of axes to be
activated in ACC1. For example, with:
L KZ3
C cm-start
three axes are activated. The call for cm-start function must be inserted before starting the AWL
program or at least before other possible functions calls from the axes library. After their activation,
the axes enter the position maintenance mode (see 1.3.1).
The variables for the motion program can be divided in two groups:
The parameters are set with default values only during their first activation, while during further
activations only work variables are used. Therefore when a variable is modified, its new value
remains unchanged during all further program activations.
NOTE
It should be noted that the system’s RAM has a backup battery so it maintains its content even when there is no
electric supply or the plug is not connected. The system is normally already provided with initialised variables
due to factory tests. To force a total reset the cm-restot function should be used as herein specified.
To force a parameters total reset and to set-up the default values, the cm-restot function that
requires the number of axes to be controlled in ACC1 must be called. In the CTE300 system the
default values are those memorized in EEPROM (where the T_MOT program should previously
memorized them).
A total reset is necessary when the axes number is modified or when, due to errors caused by the
system program, the variables of the motion program have changed to the extent that a re-start is
impossible.
The cm-restot and cm-start functions must be called once, not continuously. The cm-restot
function should be called only at system’s first start (it must be written in the #RESET block); the
cm-start function should instead be called at every new start (it must be written in the #START
block). The cm-restot function initialises the axes program. An activation example is given in
chapter 3 (cm-restot).
The variables of the motion program are contained in the RAM memory of operating system. Some
variables are common to all axes, while others are multiple since each axis has its own.
A list of the motion program’s variables that the programmer might wish to change or control is
here specified along with their dimension ( B= byte W= word L= double word) and their
accessibility from AWL (R= only reading W=only writing R/W=reading and writing NO=not
accessible from AWL). Parameters are indicated in italics, while work variables are in normal
characters. The DEFAULT column indicates the parameters value during system total reset.
Only the clearness parameters are important for a standard use of the axes program.
NOTE
The axis position (P1) is set to zero only at total reset, but during later starts it maintains the reached value.
Therefore in a machine controlled by the system, the axes position is not changed the same even after switching
it on and off. If the axes position is manually changed because the controller is switched off or the program is
not activated, there is obviously no position updating, so a zero search is required.
NOTE
The Risenc parameter is not part of the axes program, it cannot be set by T_MOT. In the CTE300 system, in case
of total reset it is not loaded by EEPROM.
The axis number where to address instructions should be previously selected by the w.asse function
demanding the axes number to be controlled in ACC1. For example, the following program selects
axis 0 as the axis to which instructions should be addressed:
This program section generates a theoretical position (PDESID) and a theoretical speed (VDESID)
that together set the axes trajectory.
Quota, speed and acceleration are all expressed in their own unit of measurement, in particular:
Quota Unit
Quotas are expressed in encoder impulses. It is important to note that the system interface multiplies by four the primary
wave of the encoder. Impulses to be considered are always those multiplied.
Speed Unit
The different speeds are expressed in (encoder impulses for every Tc) × 65536
Acceleration Unit
Accelerations (KVD, KVS parameters) are expressed in speed increase for every Tc.
These units of measurement are internally used by the axes control system and will be called inside
units. However, for quota and speed units of measurement for physics interpretation (called
physical units) are available: these are faster than inside units. To use them, the axis resolution
must be set: a whole number at 32 bits expressing the number of physical units, multiplied by
10000, for each encoder impulse. Imagine a positioning system with a final linear movement
where a 1 metre movement corresponds to 41500 encoder impulses: if we want to work with the
hundredth of millimetre unit, 1 metre will have 100000 physical units, and the resolution will be
measured as following:
100000
ris = × 10000 = 24096
41500
To set the resolution value of the selected axes (see w.asse and r.asse) w.ris is available: it requires
the encoder resolution in ACC1. For example, to select the resolution of axis n° 1 at 24096, we
should operate as following:
It is also possible to know the value of the present resolution (selected axis) by calling the r.ris
function that gives its value in ACC1.
Once the resolution has been set, the following conversion function can be used:
C.U.I Converts the value contained in ACC1 from physical units to encoder impulses.
C.I.U Converts the value contained in ACC1 from encoder impulses to physical units.
C.UI.V Converts the speed value contained in ACC1 from physical units per second to inside
units.
C.IU.V Converts the speed value contained in ACC1 from inside units to physical units per
second.
These functions allow to express a quota or speed in physical units and then to turn them into inside
units or vice versa.
The mode for quota or speed generation varies according to the state or mode in which the axis is.
This state is constantly indicated by the modo variable, with the following meaning:
mode FUNCTION
0 maintaining the position
VDESID speed is constantly kept = 0 and the PDESID position is kept equal to the value of the ENC.FIN
variable representing the final quota at the last positioning. Therefore the axis remains in its present position.
1 movement in speed
VDESID speed reaches the VREGIME variable when the ramp is set, while the PDESID quota is increased at
each Tc of the value given by VDESID. Practically the axis moves at VDESID speed. If VDESID=0 and
VREGIME=0, it automatically switches to mode 0.
2-3 positioning
these two modes take place during the positioning point to point, when the axis switches from present
position to that contained in ENC.FIN. Mode 2 concerns the acceleration ramp ( VDESID goes to
VREGIME when the ramp is set ) and its possible distance at constant speed (VDESID=VREGIME), while
mode 3 concerns the deceleration ramp (VDESID goes back to zero when the ramp is set). Once the
positioning has been accomplished, it automatically switches to mode 0, or if enabled, to mode 14.
The mode can be read by the R.modo function which returns its value in ACC1. For example, if we
want DW0 to contain the mode for axis n° 2:
L KZ2 * Select the axis
C w.asse
C R.modo * Read axis mode
T DW0 * Transfer mode into DW0
The functions for axes control described in this paragraph is operative only after the activation of the
motion program (see 1.1).
The axis current speed is contained in the VDESID variable, while the speed to be reached during
normal function modes, is contained in the VREGIME variable. Changing from one speed to the
other is achieved by means of a linear or "S" type ramp. The variables defining the characteristics
of the ramp are:
For the units of measurement of these parameters, see the note at the beginning of this chapter.
If the "S" ramps are not enabled, (ftr=0, default) the transfer from one speed (VDESID1) to the
other (VDESID2=VREGIME) is achieved by a linear ramp with slope equal to KVS or KVD,
depending whether there is a speed increase or decrease (as absolute value).
ts VDESID 2
(VREGIME) VDESID 1
KVD
KVS VDESID 2
VDESID 1 (VREGIME)
td
VREGIME − VDESIDiniz.
ts =
KVS
VDESIDiniz. − VREGIME
td =
KVD
If the "S" ramps are enabled, (ftr=1) KVS or KVD accelerations are gradually inserted, starting
from an acceleration equal to zero and increasing it with KRAS or KRAD at every sampling
interval, so there is a smoother speed variaton. Hence, when the speed has almost reached the set
value, deceleration starts decreasing according to the same modalities, so when
VDESID=VREGIME acceleration is already equal to zero.
The ramps show a typical "S" trend which produces a very inferior mechanic stress on the axis.
t t1 VDESID 2
(VREGIME)
deltaV
KVS
VDESID 1 deltaV
t1
KVS
t1 =
KRAS
t1( t1 + 1)
deltaV = KRAS ×
2
( VREGIME − VDESIDiniz. ) − 2deltaV
t=
KVS
It is clear that the total speed variation would be inferior to 2deltaV, the ramp could not be complete
in all its stages and it would miss the linear section t and its two variable acceleration sections could
have a duration inferior to t1.
The same notions can be easily applied to the deceleration ramp by substituting KVS with KVD
and KRAS with KRAD.
To set KVS and KVD parameters the function cm-ramp can be used that requires the KVD
parameter in ACC1 and the KVS parameter in ACC2. These parameters are obviously set to the
axis selected at that moment.
To set KRAS and KRAD parameters the function cm-ramps can be used that requires the KRAD
parameter and in ACC1 the KRAS parameter in ACC2.
For the parameter ftr, the two functions W.ftr and R.ftr: one sets the ftr flag up with the value
contained in ACC1, the other returns its value in ACC1.
NOTE
In ramp generation, the absolute value VDESID is limited by the value contained in the variable VEMAX.
The function cm-veli instructs the selected axis to reach the speed indicated in ACC1 (expressed in
inside units) with the ramp set. This function keeps axis in mode 1 until a different instruction is
given or until the end-stroke switch is exceeded.
Doc. MS229601 - Ed.02 – 18/07/96 13
331 SOFTWARE axes controller in AWL
Speed can be positive or negative. If the axis is already in motion, it goes from its actual speed to
that indicated. If the speed is equal to zero, the axis stops and then enters mode 0.
The function cm-stop stops the selected axis by executing the deceleration ramp in open loop (that
is, the trajectory along the deceleration ramp is not necessarily maintained). When the axis stops, it
enters mode 0. This function requires no parameters in ACC1 or ACC2.
The function cm-lock locks the selected axis in its present position and puts it in mode 0. If the axis
is in motion, it immediately stops without ramp.
NOTE
An instant axis lock at high speed can generate an error situation (mode 12).
When an axis is in electric gear with another axis (called master), it moves along with the master
axis movement, the two axes’s movements, in encoder impulses, maintain a defined ratio. The
function operating the electric gear is insegui that puts the selected axis in electric gear with another
axis whose number is specified in ACC1.
The electric gear ratio is given by the coefficient RAPINS (of the slave axis) at 32 bits, according to
the following ratio:
deltaQ 2 × RAPINS
deltaQ1 =
65536
deltaQ1 and deltaQ2 represent the position variations of the slave and master axes according to the
moment when the insegui function was operated. A RAPINS value equal to 65536 produces an
electric gear ratio of 1:1.
A second parameter called modoins (at 16 bits), sets a particular function of this mode. In
particular, if modoins is equal to 0, the maximum speed of the slave axis (see the regulation
paragraph) is given by the theoretical VDESID speed of the master axis. Instead, if it is equal to 1, it
is given by the real speed V1. Practically modoins should be set at 0 (default) if the master axis is
driven by the system in closed loop, and at 1 if it is driven by any other engine or by the system in
open loop.
The parameters RAPINS and modoins can be set or read by the functions: W.RAPINS,
R.RAPINS, W.modoins and R.modoins which require or restore the value in ACC1.
NOTE
Since all axes parameters can be set by the program T_MOT, normally modoins is set during the tuning phase
and it is not changed at AWL level.
With the cm-free function the selected axis is no longer driven, however its encoder is still read and
its position is updated.
The functions cm-move and cm-movei can instruct the selected axis to reach a wanted quota: cm-
move considers the quota in absolute terms, while cm-movei considers the quota as an increase
from its present position. These functions require the speed (expressed in inside units) in ACC1 and
the quota (absolute or incremental) expressed in encoder impulses in ACC2.
The speed sign is not important and is correctly set up according to the direction of the movement.
Normally this instruction is given to an axis in mode 0 that after reaching position, goes back to
mode 0. During the positioning phase, speed is as following:
VREGIME
VMINIMA
time
Other elements and parameters can influenced the axis performance in its arrival point.
ENC.FIN ENC.FIN
VMINIMA VMINIMA
quota quota
TOLL time TOLL time
ANTIC ANTIC
• The ENC.FIN variable contains the position to be reached, automatically updated by the
function cm-move (or cm-movei).
• The VMINIMA speed represents the speed by which the axis approaches ENC.FIN in the last
distance (the speed ramp stops at that value). A high value of that parameter enables a faster
positioning though with a sudden stop.
• The ANTIC quota causes a position advancement in the measuring of the deceleration ramp. The
default value is 0, a higher value makes the last leg of a distance equal to ANTIC to be run at
minimum speed. The advance is useful when linear ramps are used in order to guarantee an axis
arrival at the final quota with slow speed. On the other hand, with the "S" ramps, which already
assure a ‘smooth’ arrival, it is better to leave it at zero. However the advance is useful in open
loop since deceleration ramps are not granted. It should be said that linear ramps tend to zero
speed when meeting VMINIMA, while "S" ramps tend to VMINIMA.
• The quota TOLL represents an advance from the final position (ENC.FIN). In this case when
the axis position exceeds the quota [ENC.FIN - TOLL], the axis enters mode 0, so it concludes
the positioning phase and enters a position control phase. Its default value is 1: the change to
mode 0 takes place in ENC.FIN. For axes driven in closed loop, it is suggested not to modify
this value: with a higher value (as shown in the picture) the position would be reached with a
regulation effect and not at predictable speed. For axes in open loop a TOLL increase could be
necessary, as an on the moment of their stop.
Positioning can also be achieved with back-lash recovery. This action is useful when the encoder is
tightly connected to the motor, but between the motor axis and the final movement there are
mechanical back-lashes. The positioning instruction is still the same (cm-move or cm-movei), while
recovery modalities are given by the two parameters modogio and GIOCO with the following
meaning:
modogio=1 the quota contained in the GIOCO variable is summed to the final quota for backward
movements. Forward movements are normal. The GIOCO value can be positive or negative.
modogio=2 the quota contained in the GIOCO variable is summed to the final quota for forward
movements. Backward movements are normal. The GIOCO value can be positive or negative.
modogio=3 in backward movements the axis exceeds the final quota for the quantity indicated by the
GIOCO variable, then it reverts its movement and goes to the final quota with the minimum
speed VMINIMA. Forward movements are normal. The GIOCO value must be positive.
modogio=4 in forward movements the axis overcomes the final quota for the quantity indicated by the
GIOCO variable, then reverts its movement and goes to the final quota at minimum speed
VMINIMA. Backward movements are normal. The GIOCO value must be positive
The function cm-inic executes the zero search is that makes the selected axis move at VIND speed
until it reaches the home-micro switch, then revert its direction and at home-micro switch release,
resets its position and stops. To know when the zero search is achieved, it is necessary to question
the axis with the function ?fermo. If VIND is negative, the axis moves backward searching for zero,
if positive, it moves forward. The home-micro switch must be connected according to table A. (See
hardware manual)
VIND The parameter can be set or read with the functions W.VIND and R.VIND that require or
return the value in ACC1.
NOTE
The quota reset is done at home-micro switch release: at the end of this performance the axis quota could not be
0 due to the distance run in the final deceleration ramp. This does not mean reset has not been correctly
achieved. If you wish axis to be in position 0, a positioning instruction should be given to the quota 0.
1.3.2.9 Zero search on home-micro switch and encoder index pulse (mode 4)
The function cm-rtac moves the selected axis at VIND speed until it meets the home-micro switch.
Then the axis reverts its motion direction and at home-micro switch release, it starts searching the
encoder index pulse with VTACC speed. When it has reached it, it resets its position and stops. To
know when the zero search is achieved, it is necessary to question the axis with the function
?fermo. If VIND is negative, the axis moves backward searching for zero, if positive, it moves
forward. The home-micro switch must be connected according to table A or B (See hardware
manual).
The parameter VTACC can be set or read with the functions W.VTACC and R.VTACC that require
or give back the value in ACC1.
NOTE
The quota is reset when there is an encoder index pulse edge: at the end of this performance the axis quota could
not to be 0 due to the distance run in the final deceleration ramp. This does not mean the reset has not been
correctly achieved. If you wish the axis to be in position 0, give a positioning instruction to the quota 0.
NOTE
The VTACC value is automatically limited so that during this phase the frequency of the encoder primary wave
would not overcome 3 Khz because of hardware problems.
The function ?fermo controls if the axis is stopped: it sets or resets RLC depending on whether the
selected axis is stopped or not. In alternative to ?fermo, the function ?toll sets RLC if the axis is
stopped and if the position error is less than the previous value in ACC1.
The function cm-setp1 sets the value provided in ACC1 to the actual position of the selected axis.
The parameters LIMITS and LIMITI contain the value for software end-strokes (respectively
superior limit and inferior limit).
If speed is positive the LIMITS exceeding is kept under control, while if negative, the LIMITI
exceeding is kept under control. When the axis overcomes the set limit quotas, it stops without ramp
and enters mode 13. The only possible movement is in a direction opposite the one of limits
exceeding. During the zero search phase, the control of software limits is not enabled.
The function cm-limit modifies the limits value: it requires the LIMITI in ACC1 value and the
LIMITS value in ACC2, both expressed in encoder impulses.
The motion program can manage two inputs for axis end-stroke micro switches. When the axis
meets an end-stroke micro switch, it stops without ramp and enters mode 13. The only possible
movement is that in opposite direction. The number to enter negative movements is contained in the
parameter NUM.IC, while for positive movements in NUM.FC. A value -1 memorised in one of
the variables disables the corresponding input. End-strokes cannot be set from AWL, but only from
the axes tuning program T_MOT or from FORTH. The input number is not identified by the
couple byte.bit as in AWL, but by a single value as in the following rule.
For example if the end-stroke micro switch for backward movements is E3.4
NUM.IC = 3 × 8 + 4 = 28
1.4. REGULATION
The regulation section controls the motor in order to maintain the real position P1 the closest
possible to the wished PDESID one. The following error ER is so named:
ER=PDESID-P1
The operation can be done in open or closed loop. The flag flca defines this modality.
In open loop the quota PDESID is set equal to P1 therefore the error ER is always null.
To switch from one operation mode to another, there are the functions cm-cap (puts the selected
axis in open loop, flca=1) and cm-nocap (puts the selected axis in closed loop, flca=0) that reset all
the possible error conditions.
The third operation mode is not available from AWL.
In order to choose an operation modality, three aspects are important:
• An axis in closed loop can be totally controlled and thus should always be preferred. However it
requires the tuning of PID filter’s parameters. When not correctly done, it can generate auto-
oscillations and can produce an overflow axis condition (mode 12).
• The precise movement of an axis in open loop depends on the linearity typical of the motor-
driver group. It requires no corrections, only the tuning of the KN coefficient. An axis so driven
moves more regularly, but is less controllable: it will probably not maintain its position due to the
unavoidable offsets (in this case it is better to disable the driver when the axis is stopped).
• An axis with flca=-1 is normally in closed loop, it switches to open loop during the first
positioning phase and returns to closed loop in the deceleration ramp. This kind of operation
allows to avoid possible errors in the acceleration ramp that could influence the achievement of
position, though it is useful only in limited cases.
At any time the function mode can be changed from open loop to closed loop and vice versa.
For example, if the encoder is not closely tightened to the motor but can be easily discharged from it
(ex. a metric wheel leaning on the material to be worked), it is better to set the axis in open loop
when the encoder is not connected, to prevent a motor overrun due to the encoder absence.
If the driver works in torque control, closed loop is necessary.
The regulation equation allowing the generation of an output voltage VU controlling the driver is:
VU=VB1+VB2+EY+offset
VU it is a 16 bit variable representing the output voltage, it can vary from -32768 (-10 volt) to 32767 (+10
volt). Actually the output converter D/A has a 12 bit resolution, therefore the four VU’s less important
bits are not relevant.
VB1 this is VU basic value that it should have in case of perfect linearity of the electromechanical system
with no perturbations. Therefore it represents the speed feed forward contribution. The VU value is
measured as VDESID/KN: KN represents the static earning of the motor-driver group (see 1.4.2.2).
VB1 is not a variable memorised in the regulation program.
VB2 it represents the contribution from the acceleration feed forward (see 1.4.2.3). It is measured as:
(var.vel) × KFA. The speed variation var.vel is measured during the two sampling intervals and is
expressed in [decimal of encoder impulses / Tc×Tc]. KFA is a coefficient that can be set (see 1.4.2.3).
VB2 is not a variable memorised by the regulation program
EY position error filtered by the regulation algorithm according to the following rule:
MEMIN
KP × ER + KD × ERD +KI × + KIL × EYprec
EY = KIDIV
KNDA
where:
ER instant error
ERD error variation measured according to a fixed time. This time has an IND intervals Tc
value
KIDIV divisive coefficient of the integral action. Normally its default value=100 is not
modified.
The following table shows the regulation algorithm for the axes program.
KN=0 +
1 speed feed forward +
VDESID
KN KN=0
QUOTA
GENERATOR KP
closed + + +10V
loop PDESID ER -
+ dER KD + 1 EY + VU D/A
PDESID CONVERTER
dT + KNDA
open
loop - + +
P1
Sum. KI
ER KIDIV
HARDWARE
These coefficients, both having a default value=100, are used as normalisation factors to enable the
other regulation coefficients having an whole value bigger than one. KIDIV only concerns the
integral action, while KNDA all actions. Practically, a value of KP=100 (KNDA) means that the real
KP of the transfer function is 1, in the same way KI=10000 (KNDA x KIDIV) means real KI is 1. It
is suggested not to set parameters different from their default values.
where:
FMAX = encoder frequency (expressed in impulse/second) at motor maximum speed (that is when command voltage is
of 10 Volt ⇒ VU = 32767).
Once KN has been correctly measured, it is easy to find the speed maximum value (that is, the one
corresponding to an output voltage of 10 Volts) that is normally memorised in the variable VEMAX,
to obtain a limitation of VDESID:
VEMAX=KN × 32767
In some applications you might wish to keep speed under that value: just give VEMAX a value
inferior to the one in the formula.
The VDESID/KN ratio represents the contribution given by speed feed forward; if KN is not
correctly set, the regulation corrects the error but the axis performance decreases in respect to
promptness in reaction. A value of KN=0 excludes such contribution.
In open loop the axis is exclusively driven by feed forward, so it is important KN to be well tuned.
KN can be automatically measured, which is better than a formula measurement since it also takes
into account driver’s eventual imprecise tunings. This procedure is described in the Motor Tuning
paragraph.
When there is a driver with torque control, the speed feed forward is used only to compensate the
components of the resistant torque proportional to motor speed. In this case a measurement as
shown in the previous paragraph is not possible, but it is normally set experimentally. Since the
contribution by feed forward is always measured as VDESID/KN, it is clear that the bigger the KN
value is, the less its contribution value. However it is often better to have a value of KN=0 totally
excludes the action.
The action of the acceleration feed forward permits to drive the motor during the acceleration or
deceleration phase, no matter what the error value is. The intensity of over-driving is proportional to
the KFA coefficient value. This action is particularly useful for a driver with torque control, but in
case of speed control it is used only for those applications where extremely quick ramps are
required. However this parameter has to be set during the testing phase.
These three coefficients permit to vary the PID filter action operating in order to reduce the error ER.
KP concerns the proportional action, KI the integral action and KD the derivative one. There is a
brief explanation about the three actions, but practical modalities for the determination of their value
are presented in the Motor Tuning paragraph.
Proportional Action
The proportional action operates in order to reduce the instant error. The higher the energetic value
is, the best the correction effect. Too high KP values can generate auto-oscillations.
Integral Action
The integral action operates against error persistence over time. Its effect is useful to correct these
non-linear behaviours of the axis and especially of the offset. Only the integral action guarantees to
reach a position with zero error. KI high values can be highly corrective, can also generate auto-
oscillations. The integral action is held in case of error values, in absolute value, higher than
LIMINT (default=1000) and of error total values higher than LIM (always in absolute value).
Derivative action
The derivative action has a stabilising effect to compensate for those values which are higher than
other parameters. Its action is related to the error variation, which is measured according to the error
previously found by IND sampling intervals. The IND default value equal to 1 is generally fine, but
it can be increased when there are high time constants. The stabilising effect is proportional to the
KD value. However too high KD values can generate vibrations due to the quantization of
dimensions and elaboration. Its use is fundamental for drivers with torque control, while for those
with speed control it must very often be kept at zero.
The limited integral action maintains the regulation effect over a certain time, even if there is no
error. KIL represents the time constant by which the effect stops: the decrease is equal to
KIL/KNDA for every sampling interval. For KIL=KNDA (100) the effect continues over an
unlimited time and surely there is an instability situation.
The offset variable is summed to other contributions in order to compensate eventual offsets present
in the system. Its measure unit is the same as VU (-32768=-10V, 32767=+10V). It is possible to
measure the offset automatically. However it can often be left at 0 because the regulation already
compensates the effect of small offsets.
The tuning consists in defining the value of those parameters that optimise the motor performance.
The system firmware of CTE300 has a tuning program called T_MOT that enables this operation by
a graphic assessment on axes performance. It also enables to check the operation of main functions
such as: positioning, zero search, following mode (electric gear) ecc.
The program has been projected for a driver with speed loop, in case of drivers with torque control
the auto-tuning function, herewith described, cannot be used.
1) Disconnect the application program, or even better, completely reset the CTE300 to avoid
the ram area used by T_MOT, for graphics memorisation, to dirt the FORTH vocabulary.
To stop the user program you must press the keys Ctrl+Shift+Esc and after only the Esc key,
succesively you must type the command:
COLD <enter>
2) Reset the RES variable if you want to start with a total parameters initialisation. Type the
command:
0 RES ! <enter>
3) Call the program T_MOT by the keyboard, by using its functions, define the axes
parameters.
4) Once the awaited answer is given, memorise the parameters in the EEPROM and exit from
T_MOT.
5) The AWL program is compiled (or just put the PLC in run if the program has already been
compiled): in the beginning it will call the cm-restot, function that will load the values
memorised in EEPROM.
The user program has been prepared so that the found parameters can be varied (for example, by
host computer or by AWL program with the due functions).
Additionally it could be used also during the execution of the user program for check the behavior
of the axes and change some parameters.
NOTE
The T_MOT program is present only in the operating system of the CTE300. In the case of systems with
331CPU card the T_MOT program must be compiled. In this chapter comes taken in consideration only the
T_MOT program of the CTE300.
The operators that use the 331CPU card must remenber that the funcion of memorization in EEPROM are not
available and that the functions of visualization of the chart are not available on the LCD of the CTX618 and
CTD913 systems.
T_MOT ACTIVATION
The access to the tuning program is possible by pressing the T_MOT command and then the key
<cr>. The main menu is entered automatically.
The measure units are the same as those for the regulation program (see paragraph 1.3), if not
differently specified.
In this menu the function keys enabling to enter a particular table for function tuning are active.
Function keys:
F2 = Driver Tuning
Enables the first tests on axis motion to verify the connections and to tune the driver.
F3 = KN Tuning
Enables the automatic measurement of KN coefficient, PID parameters and software offset.
F4 = Access to parameters
Enables to set all regulation parameters and motor motion parameters and to make several
tests to find out the best system performance.
All the described tables enable returning to the main menu by pressing the <Esc> key.
The purpose of the following parameters is the configuration in order to acquire and visualise
graphics on motor performance. In particular they are:
Acquisition Step:
It indicates every how many Tc intervals the selected variable must be memorised in the buffer. The
variable values can later be represented in a graphic. By increasing this parameter value, having the
buffer a fixed length, it is possible to control the axis behaviour over a longer time (obviously with a
lowest temporal resolution).
Variable to acquire:
All the options available appear by pressing a key: just select the wanted one with the Enter key.
The selection is about the parameters acquisition and its graphic visualisation. It can be:
position error, that is the difference at every single moment between the theoretical position
and the real axis position (this option is meaningful only if the axis is in closed loop ).
speed error, that is the difference at every single moment between the theoretical speed and
the real axis speed as compiled by the encoder (variable V1).
Speed trend, that is the speed trend analysed (V1) by the encoder referred to the axis
theoretical sped.
NOTE
The V1 speed is measured by counting the encoder impulses every KK/2 Tc, so it is an average speed on an
interval, therefore always delayed in respect to the instant speed.
Acquisition Trigger:
Enables to choose the mode by which the program starts acquiring data for graphic visualisation.
This can be:
manual: the acquisition starts when pressing the corresponding function key (see key
F5, first parameters page)
deceleration ramp:
the acquisition starts when the motor enters the deceleration ramp
VDESID: the acquisition starts when the motor’s VDESID exceeds in absolute value
the value indicated.
NOTE
The value showed in the previus figure is referred to CTE300 system. For the 331CPU system this value is
obviously different.
Language
Italian or English can be selected for program messages.
Function Keys:
F1= Go forward.
Generates in the D/A output voltage set in the Axes Control Voltage area.
F2= Go backward
Generates in the D/A output a voltage with sign opposed to the one set in the Axes Control
Voltage area.
Space = Stop
Reset voltage in the D/A output
In this page there are some useful functions for a first axes motion, that permit to assess the
electrical wiring system and the correct connection of encoder phases.
This page can be considered as a voltage generator and a quota encoder measurer (with motor
revolution counter).
These different ‘means’ should make the following axis assessment possible:
By an output voltage = 0 (space pressure) the trimmer of the driver’s offset regulation should be
regulated until the visualised encoder quota is not stable enough.
The assessment on encoder phases can be achieved by setting an axes control voltage with positive
(negative) value and by moving the axis with the function key F1. If the encoder is correctly
connected, its encoder quota (represented in the picture on bottom right) must increase (decrease).
In case of wrong connection, the message "encoder reversed phases " will appear.
We suggest you to test the axis motion in both direction.
Select a voltage for which the number of motor revolutions (according to motor physic
characteristics) is known. Then regulate the trimmer for speed gain until the motor has not reached
the expected speed. For example, 10 volt = 3000 rpm, 5 volt = 1500 rpm ect. It can be useful to
assess the linearity in the driver’s operation by checking the motor’s real speed with different
control voltages.
Motor speed can be read with a normal revolution counter. When not available, if knowing the
number of encoder impulses for each chosen physical unit (ex. revolutions, metres, etc.), the video
measurer can be used (central table on the page indicated by Motor speed). It can be operated by
simply inserting the number of encoder impulses(× 4) for each unit, in the area encoder impulses
per unit.
For example, to visualise speed in revolutions per minute, the number of encoder impulses for each
motor revolution must be provided.
Or, to visualise speed in metres per minute, the number of encoder impulses for each meter of the
axis movement must be provided.
NOTE
The encoder parameter impulses per unit, here set, is useful also for other T_MOT pages, since it is used
whenever speed has to be visualised or set in units different from inside units.
2.5 KN TUNING
Function keys:
F1= Go forward
Generates in the D/A output voltage set in the Reference voltage for tuning area and
calculate the KN value.
F2= Go backward
Generates in the D/A output a voltage with sign opposed to the one set in the Reference
voltage for tuning area and calculate the KN value.
F3= Offset
Calculate the axis offset.
F4 = Calc. P.I.
Calculate the proportional and integral coefficients according to the system answer to the
voltage step.
Space = Stop
Reset voltage in the D/A output and stop the autotuning procedure.
This page enables the automatic tuning of: KN, the offset software and the PID parameters.
Once these tunings have been achieved, the axis is ready to work.
2.5.1 KN Tuning
KN parameter tuning is an important step in the control of the axis correct operation. In fact it
relates the analog output with the encoder resolution. Remember: KN is important only for those
drivers with speed loop.
In the open loop control, KN is responsible only for the driving voltage, the more this value
represents the real motor function of voltage-speed transfer, the more the values for real and
theoretical speed can match.
There is a similar problem for the closed loop control, but here due to the PID regulation, eventual
small differences concerning the real value or depending on the driver’s non-linearity are
compensated. However the truer KN is, the simpler the tuning of other parameters is.
KN tuning is executed by setting a voltage and by moving the motor with the keys F1=forward and
F2=backward (‘SPACE’ stops the motor)
When the motor reaches the set state speed, KN is measured (the message ‘KN TUNING’ appears).
KN tuning is to be considered achieved when the variation of the visualised value is more or less
than one unit. KN might need a certain time to stabilise.
If the voltage set for the movement produces an encoder speed too slow for a precise KN
measurement, then the message 'Speed too slow for calculating KN parameter' appears. In this
case the command voltage can be increased or the manual measurement can be started by using the
formula described at page 23:
It might be important to assess the answer linearity of the motor-driver system. So it should be
made sure that the measured KN does not change because of different command voltages.
With the function key F4 the motor is driven with a voltage step equal to the value set in the area
'Reference Voltage for tuning'. If the mechanical frame connected to the motor enables it, the step
32 Doc. MS229601 - Ed.02 – 18/07/96
chapter 2. axes tuning
to should have at least 4 Volts. According to the axis answer found out by the encoder, the values of
both KP proportional and KI integral regulation coefficient are estimated, while KIL, KD and KFA
coefficients are reset. The values found out by this procedure can be optimised during further
phases.
The procedure for PID tuning calculates also the VEMAX parameter, as speed corresponding to a
driving voltage of 10 Volt. It initialises the ramp coefficients with default values.
The function key F3 starts and stops this operation that requires a zero voltage on the analog output
and controls which voltage is used in order to keep the axis still.
WARNING
The tuning function puts the motor in closed loop, so this function is to be used after PID tuning.
Normally the offset tuning is not very essential to the system because if the driver offset has already
been correctly tuned, the remaining offset is certainly compensated by the PID control in closed
loop.
WARNING
For a correct system tuning is necessary respect the following commands sequence:
1. KN tuning
2. PID tuning
3. Offset tuning
This page enables to modify regulation parameters and to operate motion tests to assess the axes
performance.
The page is divided in three parts: motor parameters, pre-set test, motor state.
Doc. MS229601 - Ed.02 – 18/07/96 33
331 SOFTWARE axes controller in AWL
In the part for motor parameters it is possible to modify the various parameters that define the
movement of the motor: from regulation coefficients (KP, KI, KD) to the values of acceleration and
deceleration ramps.
In the pre-set test table it is possible to pre-set a speed (both in inside units and units per minute)
and two quotas (Quota1 and Quota2). These data are used by the function keys which enable the
motion (see F1 F2 D S space)
In the motor state table on the right, some important information are constantly visualised for an
understanding and an evaluation on motor behaviour, as here described.
Motor state
Indicates if motor is controlled in open or closed loop (see flca flag). The two driving modes
can be forced by the function key F6.
Control Mode
Indicates the axis mode.
Cerr Alarm
In case of alarm, appearing in the line below the one visualising the mode, the Cerr error bits
are in turns visualised. For reset this alarm message pres the Shift+F2 keys.
Motor Quota
It is the actual position expressed in encoder impulses.
Motor speed
It is the actual speed expressed in units per minute. The units depend on the parameter set in
the driver tuning page.
D/A Voltage
Visualise the D/A output expressed in volts.
Instant Error
Visualise the axis error expressed in encoder impulses.
Maximum Error
Memorises the maximum position error found out by the control. It can be useful to verify the
error dimension during transfer. The reset of this value is executed by the function key F3.
Function Keys:
F1 = Enable to reach Quota1 with the speed in the pre-set test table.
F2 = Enable to reach Quota2 with the speed in the pre-set test table.
F6= Change motor command from open loop to closed loop and vice versa.
F9= Achieve zero search with home-micro switch and encoder zero notch.
During this function, in the motor state table, at the end of the procedure for zero search,
instead of the quota encoder, the distance in impulses from the release of the reference micro
to the zero notch is visualised. This enables to evaluate if the zero notch is too close to the
micro release. If so, there is the danger the encoder index pulse to be recognised only during
the following revolution. The pressure of any other function key or the change to another table
restores the visualisation of the encoder quota.
shift F2= Execute a reset of the Cerr variable and a consequent reset of the alarms visualised.
shift F3= Memorises on EEPROM the axis parameters. Before saving, confirmation of this
operation is required since all the parameters previously memorised will be lost (This function is
available only for the CTE300 system).
shift F4= Return parameters from EEPROM to those of the actual axis. Confirmation of this
operation is required since all present axis parameters will go lost (This function is available only for
the CTE300 system).
D= move the axis forward at selected speed, the axis stops when <space> is pressed.
S= move the axis backward with at selected speed, the axis stops when <space> is pressed.
Function Keys:
F1 = Show the global graphic.
F4 = Select the cursor to move. The active cursor is showed in the upper right corner.
ï ,ð
ð = Move the active cursor.
ï , Ctrl+ð
Ctrl+ï ð = Move, in rapid mode, the active cursor.
The graphic highlights all the axis passage to mode 0 (position maintenance) with a vertical yellow
line on the X-axis. So the motor trend at the end of a positioning phase can be identified and
evaluated.
A key pressure during graphic insertion phases stops the visualisation process there.
This page has two charts: the left chart (motor parameters) shows a range of variables for the
regulation program, the right one shows a range of switches that can be enabled or disabled with the
function keys.
The parameters that can be set are: the axis software limits, the control of on/off axes, data about the
axes control in electrical gear.
Function keys:
F1 = disable the axis software limits. The disabling of software limits is indicated in the 'enable' table
by the message 'OFF' in the areas 'Pos.soft.Lim.' and 'Neg.soft Lim.'.
F8 = Put the selected axis in following mode with the axis indicated in MOT.TRA.
In this chapter all the functions for axes control are listed in alphabetical order. Many of them have
already been presented in chapter 1.
?fermo
Example: You want the M50.0 flag to be set-up when all the three axes are in position.
?toll
If the selected axis has reached the position and the position error is less than the value contained in
ACC1, it returns RLC=vero otherwise RLC=falso. This function is to be preferred to ?fermo for
those axes requiring long adjustment time.
Example: You want M60.0 to be in 1 when the axis 1 has reached the position and the position error is less than 10
impulses.
C.I.U
Converts a quota from encoder impulses to physical units. To make the function give back the
correct value, the encoder resolution must be set with the w.ris function.
Example: You want Double Word 8 to contain the actual quota of axis 0 expressed in physical units (you must
previously load encoder resolution).
C w.asse0
C R.P1 * Read axis quota in impulses
C C.I.U * Execute the transformation
T DD8 * Update the Double Word 8
C.IU.V
cm-aenc
Forces a reading of all the encoders every millisecond. The default is read at every sampling period
(three milliseconds in case of three axes). The call to this function must be done immediately after
the cm-restot for program starting.
cm-cap
Example: Axis 0 must be set in open loop if the E0.0 input is not available (manual engine), otherwise it must be set in
closed loop (automatic engine). The command is given on the leading or falling edges of the above-mentioned input.
cm-free
Releases the selected axis. The selected axis is not anymore driven, however its encoder is still read
and the position is still updated.
Example: If the E1.3 input is present, axis 0 must be set in stand-by. When there is the falling-edge the axis must be
blocked.
cm-inic
Commands the selected axis to execute zero search on the home micro-switch. By this command
(to be given just once) the axis moves with VIND speed until it finds the home-micro switch, then it
reverses its direction and at home-micro switch release it resets its position.
Example: On the leading edge of the E0.1 input, the axis 0 executes the zero search on the home micro-switch. The
M48.0 flag indicates that zero search is going on, while the M48.1 flag indicates that the search has been correctly
executed.
cm-limit
Sets the values indicated in ACC1 (LIMITI= inferior limit) and ACC2 (LIMITS= superior limit) to
the software end-micro switches of the selected axis.
Example: If you want to set the software limits of axis 0 to the values -300000 (inferior limit) and +300000 (superior
limit):
cm-limoff
Example: You want to disable the control of software limits for axis 1.
C w.asse1
C cm-limoff * Excludes the software limits control
cm-lock
Blocks the selected axis in its present position. If the axis is in motion, it immediately stops without
ramp. A sudden stop at high speed can generate an error situation (mode 12).
Example: The E0.6 and E0.7 inputs represent the end-stroke micro-switches (respectively positive and negative) of the
axis 0. When the axis reaches the end-stroke micro-switches (if these are of a normally closed type, then the relative input
is open), the axis must immediately be stopped. The axis direction must obviously be considered.
cm-move
This command (to be given once) instructs the selected axis to reach the quota indicated in ACC2 at
the speed indicated in ACC1. Quota and speed are expressed in inside units. The arrival at quota can
be assessed by ?fermo or ?toll.
ACC2: Unchanged
See also: cm-movei ?fermo ?toll
Example: At every E0.2 leading edge axis 0 must position at the quota contained in DD20 (expressed in physical units)
with the speed contained in DD24 (expressed in inside units ).
cm-movei
cm-nocap
Forces the selected axis to operate in closed loop. The command must be given once.
cm-ramp
Sets the ramp coefficients KVS (ACC2) and KVD (ACC1) for the selected axis.
Example: You want to set the KVS parameter (acceleration ramp) of axis 0 at 50000 and the KVD
parameter(deceleration ramp) at 90000.
cm-ramps
Sets the "S" ramp coefficients KRAS (ACC2) and KRAD (ACC1) for the selected axis.
cm-restot
Activates the axes control program by forcing a parameters total reset and, if the system is the
CTE300, by loading default parameters from EEPROM. The number of axes to be controlled must
be set in ACC1.
#RESET
L KZ3
C cm-restot
BE
#START
L KZ3
C cm-start
BE
cm-rtac
Commands the selected axis to execute zero search on the home micro switch and encoder index
pulse. The selected axis moves at VIND speed until it reaches the encoder index pulse, then it
reverses its direction and at micro release, it starts searching for the encoder index pulse with
VTACC speed. When it has reached it, it stops and resets its position. The command must be given
once, not repetitively.
cm-senc
Forces encoder reading at every sampling period. The call for this function is useless if the function
cm-aenc has not been previously used.
cm-setp1
Sets the value contained in ACC1 and expressed in impulses to the selected axis actual position. The
command must be given once and not repetitively.
Example: At every leading edge of the E0.5 input the position of axis 2 must be set to the quota (expressed in physical
units) contained in DD40.
cm-setp1e
Sets the value contained in ACC1 and expressed in impulses to the selected axis actual position,
leaving unaffected the value of the error. The command must be given once and not repetitively.
cm-settc
Change the time of sampling of the axes program, the time of sampling, expressed in microseconds,
must be contained in ACC1 (default 1000).
cm-start
Activates the axes control program. The number of axes to be controlled must be contained in
ACC1. The command must be given once at every system starting.
cm-stop
Stops the selected axis by executing the deceleration ramp in open loop.
Example: Axis 0 must be manually controlled. The E1.0 input makes the axis go forward, while the E1.1 input makes
the axis go backward. Switches release stops the axis. The motion speed is contained in DD36 (expressed in inside units ).
C w.asse0
L DD36 * Load Speed
U E1.0 * Analyse E1.0 leading edge
D M241.0
= C cm-veli * Axis Advancement
U E1.1 * Analyse E1.1 leading edge
D M241.1
IF
KZW * Inverts speed sign
C cm-veli * Axis Rearward
ENDIF
UN E1.0 * Analyse both switches falling edge
UN E1.1
D M241.2
= C cm-stop * Axes Stop
cm-veli
Commands the selected axis in speed. The speed must be set in ACC1 and expressed in inside units.
cm-zeroa
Resets the selected axis quota to the actual position. The command must be given once and not
repetitively.
Example: At the leading edge of the E0.6 input the quota of axis 1 must be reset.
C.U.I
Converts the value contained in ACC1 from physical units to encoder impulses.
C.UI.V
insegui
Puts the selected axis in electric gear with the axis whose number is specified in ACC1 (master axis).
The command must be given once and not repetitively. The following ratio is given by the
coefficient RAPINS.
Example: Axis 1 must follow axis 0 that is driven in open loop (the modoins flag must be set-up).
C w.asse1
L KZ1 * Load the value to be inserted in 'modoins'
C W.modoins
L KZ0 * Load axis to be followed
C insegui
R.ANTIC
Returns the ANTIC variable value of the selected axis in ACC1. The ANTIC variable indicates the
advancement quota on the ramps during positioning phases.
Example: You want to memorise in DD60 the ANTIC parameter value of axis 2.
r.asse
R.Cerr
Returns the Cerr variable value of the selected axis in ACC1. The variable Cerr indicates the error
code if the axis is in mode 12 (= axis in overflow) according to the following custom:
The Cerr variable is updated by the axes program as soon as the axis enters in mode 12 and is not
modified unless a new error condition. Therefore this variable must be reset by he AWL program.
Example: In case of axis 0 error, MB20 must contain the error code, in particular M20.0 indicates a regulation
overflow and M20.1 indicates the maximum double error.
C w.asse0
C R.modo * Read axis mode
L KZ12
=F * Axis in mode 12 ?
IF
C R.Cerr * Read error code
T MB20 * Memorise in MB20
ELSE
L KZ0 * Reset MB20
T MB20
C W.Cerr * Reset error code
ENDIF
rch.funz
Enables the routine on interrupt for finding the home-micro switch edges and the encoder index
pulse. It also enables to test these edges and to read the state of the home-micro switch. The
function executed by rch.funz is specified in ACC1 according to the following table:
When an edge is found, its corresponding routine must be rehabilitated on interrupt to find the
following leading edge.
ACC1 Azione
0 Test the leading edge of NC input whitout debounce software. Returns the result in
ACC1.
1 Test the falling edge of NC input whitout debounce software. Returns the result in
ACC1.
2 Test the leading edge of the encoder index pulse. Returns the result in ACC1.
3 Test the NO input state. Returns the result in ACC1.
4 Test the NC input state. Returns the result in ACC1.
5 Enables the routine on interrupt to find the NC input leading edge (to be tested by the
rch.funz’s function 0).
6 Enables the routine on interrupt to find the NC input falling edge (to be tested by the
rch.funz’s function 1).
7 Enables the routine on interrupt to find the encoder index pulse leading edge (to be
tested by the rch.funz’s function 2).
8 Disables the routine on interrupt to find the NC input leading edge.
9 Disables the routine on interrupt to find the NC input falling edge.
10 Disables the routine on interrupt to find the encoder index pulse leading edge.
11 Enables the routine on interrupt with hardware reset of axis's quota at the NC input
leading edge.
12 Enables the routine on interrupt with hardware reset of axis's quota at the NC input
falling edge.
13 Enables the routine on interrupt with hardware reset of axis's quota at the encoder
index pulse leading edge.
14 Disables the routine on interrupt with hardware reset of axis's quota at the NC input
falling edge.
15 Disables the routine on interrupt with hardware reset of axis's quota at the NC input
falling edge.
16 Disables the routine on interrupt with hardware reset of axis's quota at the encoder
index pulse leading edge.
17 Test the leading edge of NC input whit debounce software. Returns the result in
ACC1.
18 Test the falling edge of NC input whit debounce software. Returns the result in ACC1.
NOTE
For the resetting hardware of the quota of the axis is necessary to use a contact of exchange.
NOTE
With ACC1= 0 or ACC1= 1 no control on the bounces of the signal is performed. The use of such formality is
necessary if a contact of exchange are used (on falling edge of the NC input and then with ACC1= 1).
NOTE
With ACC1= 17 or ACC1= 18 a control on the bounces of the signal is perfomed analyzing the edge and the
level of the same. The use of such formality has recommended if a contact of C type are used for avoid of
receive more leading and/or falling edge of the NC input. But in this situation could happen a condition of
malfunction if the impulse of the NC input is too brief (inferior to an indicative time of 1ms.); in fact if this
impulse happens while a high level interrupt routine are served (like to example a interrupt of the axes program
or a interrupt of the serial canals) then the edge are detected but not the level and therefore the edge is discarged.
See the following figure:
WARNING
We want to put in evidence that, beyond on the index pulse the interrupt is generated only on the
leading/falling edge of the NC input. For which the connection of B type (connection commonly
closed) you doesn't can ever be used because the NC input level is always maintained to high level.
on on on
0V 0V 0V
0V 0V 0V
The red led show the 24 Vdc voltage presence on the NC input.
The yellow led show the 24 Vdc voltage presence on the NO input.
Note: Edge finding (of the inputs and of the encoder index pulse) cannot be executed at the same time with the zero
search’s cm-rtac and cm-inic functions.
Example: At E0.0 leading edge axis 0 must be commanded in speed; at every NC input falling edge the axis must move
of 1000 impulses.
C w.asse0
U E0.0 * Test E0.0 leading edge
D M10.0
IF
L KZ100000 * Command axis in speed
C cm-veli
L KZ6 * Enable routine for edge finding
C rch.funz
ENDIF
U M10.1 * Positioning
D M10.2
IF
L KZ1000 * Movement
L KZ100000 * Speed
C cm-movei
ENDIF
R.CIRC
Returns the CIRC variable value of the selected axis in ACC1. The CIRC variable indicates the
number of revolution impulses for circular axes. If this variable’s value is above zero, the axis is
considered circular.
R.ENC.FIN
Returns the ENC.FIN variable value of the selected axis in ACC1. The ENC.FIN variable indicates
the position to be reached during the positioning phase expressed in encoder impulses.
Example: You want to execute a Hold function. At the E0.6 leading edge axis 0 stops (only if it is in mode 1,2 or 3),
at the following input edge the axis re-starts the operation it was executing.
C w.asse0
L KZ1
=F
= M11.0 * Axis commanded in speed
TAK
L KZ2
=F
= M11.1 * Positioning mode
TAK
L KZ3
=F
= M11.2 * Positioning mode
O M11.0
O M11.1
O M11.2
IF
C R.ENC.FIN
T DD40
C R.VREGIME
T DD44
C cm-stop
S M10.0
ENDIF
ENDIF
ENDIF
R.ER
Returns the ER variable value of the selected axis in ACC1. The ER variable indicates the actual
position error expressed in encoder impulses.
Example: The A0.1 output must be switched on whenever the position error of axis 0 exceeds 50 impulses.
C w.asse0
C R.ER * Read error
ASS * Measure the absolute value
L KZ50 * Number of impulses - maximum error
>F * Superior to 50 impulses ?
= A0.1 * Command exit
R.EROVFL
Returns the EROVFL variable value of the selected axis in ACC1. The EROVFL variable indicates
the maximum error (in impulses) for the activation of the mode 13, a negative value in this variable
disables the control.
R.ftr
Returns the ftr flag value of the selected axis in ACC1. The ftr flag indicates the type of selected
ramp: 0 ð linear ramps, 1 ð"S" ramps.
R.GIOCO
Returns the GIOCO value of the selected axis in ACC1. The GIOCO variable indicates the back-
lash quota during the positioning.
R.KD
R.KI
R.KN
R.KP
R.modo
Returns the modo variable value of the selected axis in ACC1. The modo variable indicates the axis
operation mode.
R.modogio
Returns the modogio flag value of the selected axis in ACC1. The modogio flag indicates the
operation mode for positioning with back-lash recovery.
R.modoins
Returns the modoins flag value of the selected axis in ACC1. The modoins flag indicates the
operation mode of the electric gear.
R.N.ASSI
Returns the number of the axes controlled by the motion program with the functions cm-start or
cm-restot.
R.P1
Returns the actual position (P1) in impulses of the selected axis in ACC1.
R.RAPINS
Returns the RAPINS variable value of the selected axis in ACC1. The RAPINS variable indicates
the electric gear ratio between master axis and slave axis.
r.ris
Returns the ris encoder resolution value of the selected axis in ACC1.
C w.asse0
C r.ris * Read resolution
T DD80 * Memorise in DD80
R.TOLL
Returns the TOLL variable value of the selected axis in ACC1. The TOLL variable represents the
tolerance in impulses for the entrance in mode 0 at the end of positioning.
R.V1
R.VDESID
R.VEMAX
Returns the VEMAX variable value of the selected axis in ACC1. The VEMAX variable contains
the maximum value VDESID theoretical speed can have.
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VEMAX Value
ACC2: Unchanged
See also: W.VEMAX
R.VIND
Returns the VIND variable value of the selected axis in ACC1. The VIND variable indicates speed
during the first phase of zero search.
R.VMINIMA
Returns the VMINIMA variable value of the selected axis in ACC1. The VMINIMA variable
indicates the arrival speed during positioning phases.
R.VREGIME
Returns the VREGIME variable value of the selected axis in ACC1. The VREGIME variable
indicates the speed to be reached during some function modes.
R.VTACC
Returns the VTACC variable value of the selected axis in ACC1. The VTACC variable indicates the
speed searching for the encoder index pulse.
R.VU
Returns in ACC1 the value of the output voltage (VU) normalised at the range -32768 ÷ +32767
(-10V ð VU=-32768, +10V ð VU=+32767).
W.ANTIC
Sets to the ANTIC variable of the selected axis the value contained in ACC1.
C w.asse1
L KZ50 * Value to be set to the parameter
C W.ANTIC
w.asse
Selects the axis number for further instructions. The axis number must be contained in ACC1.
w.asse0
w.asse1
w.asse2
W.Cerr
Sets to the Cerr variable of the selected axis the value contained in ACC1.
W.CIRC
Sets to the variable CIRC of the selected axis the value contained in ACC1.
W.EROVFL
Sets to the EROVFL variable of the selected axis the value contained in ACC1.
W.ftr
Sets to the ftr flag of the selected axis the value contained in ACC1.
Example: When E0.0 input is on, the ‘S' ramps for the axis 0 must be set. Otherwise, linear ramps must be set.
C w.asse0
U E0.0 * Analyse E0.0 leading edge
D M240.0
L KZ1 * Value to be set to ftr
= C W.ftr
UN E0.0 * Analyse E0.0 falling edge
D M240.1
L KZ0 * Value to be set to ftr
= C W.ftr
W.GIOCO
Sets to the GIOCO variable of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.GIOCO and its value with a more appropriate
value).
W.KD
Sets to the KD derivative constant of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.KD and its value with a more appropriate value).
W.KI
Sets to the KI integral constant of the selected axis the value contained in ACC1.
Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: KI Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.KI R.KD W.KD R.KP W.KP
Example: See example in W.ANTIC (just change W.ANTIC with W.KI and its value with a more appropriate value).
W.KN
Sets to the KN normalisation constant of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.KN and its value with a more appropriate value).
W.KP
Sets to the KP proportional constant of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.KP and its value with a more appropriate value).
W.modogio
Sets to the modogio flag of the selected axis the value contained in ACC1.
ACC2: Unchanged
See also: R.modogio R.GIOCO W.GIOCO
Example: See example in W.ANTIC (just change W.ANTIC with W.modogio and its value with a more appropriate
value).
W.modoins
Sets to the modoins flag of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.modoins and its value with a more appropriate
value).
W.N.ABL
Sets to the NUM.ABL parameter of the selected axis the value contained in ACC1.
W.N.ASSI
Sets to the N.ASSI parameter of the selected axis the value contained in ACC1. The parameter
N.ASSI indicates the number of axes to be controlled. It is better to use the cm-start function(or
cm-restot) that requires the number of axes to be controlled in ACC1 and initialises the axes
program.
W.N.AVL
Sets to the NUM.AVL parameter of the selected axis the value contained in ACC1.
W.N.AVV
Sets to the NUM.AVV parameter of the selected axis the value contained in ACC1.
W.N.IDL
Sets to the NUM.IDL parameter of the selected axis the value contained in ACC1.
W.N.IDV
Sets to the NUM.IDV parameter of the selected axis the value contained in ACC1.
W.N.INV
Sets to the NUM.INV parameter of the selected axis the value contained in ACC1.
W.RAPINS
Sets to the RAPINS variable of the selected axis the value contained in ACC1. RAPINS can be
modified also when the axis is in electric gear because the W.RAPINS call initialises again the
‘following command’ if RAPINS previous value was different from the actual one.
Example: You want to put axis 1 in electric gear with axis 0, the following ratio (which is likely to continually vary) is
contained in the double word 4.
C w.asse1
UN M80.5 Flag to avoid repeating the command
IF
L DD4 * Sets up the following ratio
C W.RAPINS
L KZ0 * Master Axis
C insegui * Axis 1 follows axis 0
ENDIF
L DD4 * RAPINS Variation on line
C W.RAPINS
W.RES
Sets to the RES variable of the selected axis the value contained in ACC1. When the function cm-
start is modified such variable, if containing a value different from 1234, executes a total reset of
the axes program. For axes program reset it is better to use the cm-restot function.
ACC2: Unchanged
w.ris
Sets to the ris encoder resolution of the selected axis the value contained in ACC1
Example: See example in W.ANTIC (just change W.ANTIC with w.ris and its value with a more appropriate value).
W.TOLL
Sets to the TOLL variable of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.TOLL and its value with a more appropriate
value).
W.VEMAX
Sets to the VEMAX variable of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.VEMAX and its value with a more appropriate
value).
W.VIND
Sets to the VIND variable of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.VIND and its value with a more appropriate
value).
W.VMINIMA
Sets to the VMINIMA variable of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.VMINIMA and its value with a more appropriate
value).
W.VTACC
Sets to the VTACC variable of the selected axis the value contained in ACC1.
Example: See example in W.ANTIC (just change W.ANTIC with W.VTACC and its value with a more appropriate
value).
Y
dX
Y
X
Z dY
(X1,Y1)
0 X
The machine can work both in automatic and manual mode. In manual mode, every axis can be
moved by its corresponding button. The movement of the X-co-ordinate and the Y-co-ordinate is
inhibited if axis Z quota is not less than a set security quota. In this mode it is possible to execute the
zero search by the ZERO SEARCH button.
The E0.1 key changes the operation mode from manual to automatic or vice versa. The shift to
automatic mode is inhibited if zero search has not been executed. In automatic, at cycle start
(START button) the axes go to the point (X1,Y1): when they arrive in quota, axis Z goes down to
quota Z1 and waits for a set time. After that time, axis Z goes up again and overpasses the security
quota, the X and Y axes go to the next point indicated by dX and dY and repeat the whole cycle
again. Once the work is finished (it is possible to set the number of holes to be done), the axes go
back to the point (0,0,0). The cycle can be stopped by the STOP button.
The M40.0 flag enables the machine continuos operation. When the last hole has been done, the
axes take position at the first point and execute a new operation.
All the parameters characterising the work are set in DATA DOUBLE WORD
The reason for an alarm situation can be read in MW64 with the following meaning:
Axis 0 = Axis X
Axis 1 = Axis Y
Axis 2 = Axis Z
****************************************************************************
*
* Initialisation of program
*
****************************************************************************
#RESET
L KZ3 * Number of axes to be controlled
C cm-restot * Initialisation with EEPROM loading
S M0.0 * Avoid a new initialisation of the axes program
S M80.0 * Avoid a new starting of the axes program
BE
****************************************************************************
*
* Start of program
*
*****************************************************************************
#START
C w.asse2
C R.P1 * Read quota axis Z
L DD48 * Axis Z Security Quota
C C.U.I * Convert in impulses
<=F * Present Quota minor or equal to security quota
= M24.0 * Axis Z Flag in security quota
C w.asse0
C ?fermo * Read axis X state
= M24.1 * Axis X stopped
C w.asse1
C ?fermo * Read axis Y state
= M24.2 * Axis Y stopped
********************************************************************************
*
* Emergency control and change in function mode
*
********************************************************************************
* At every E0.0 falling edge (emergence) and at every change in the function
* mode, all axes must be instantly blocked (In emergency case the M64.1 alarm
* flag must be set up) and all MW100 and MW90 flags must be reset.
* If the zero search procedure indicated by M80.2 flag has not been previously
* executed, the shift to automatic mode is not possible. If mode switch to
* automatic should be tried even without executing the zero search, M64.2 flag
* (alarm) will be set up.
* The state is restored in M80.3 (manual) flag and in M80.4 (automatic).
********************************************************************************
*
* Block axes in case of emergency or mode change or else
*
********************************************************************************
* In case of emergency or change in the function mode or if axis Z is not in the
* security quota, axes are instantly blocked and the zero search and automatic
* cycle flags are reset.
*
********************************************************************************
*
* Axis X Manual Control
*
********************************************************************************
* The manual commands for axes X and Y are not available if the zero search
C w.asse0
L DD24 * Load manual speed
C C.UI.V * Convert in inside units
********************************************************************************
*
* Axis Y Manual Control
*
********************************************************************************
* It is similar to that of axis X
C w.asse1
L DD28 * Load manual speed
C C.UI.V * Convert in inside units
********************************************************************************
*
* Axis Z Manual Control
*
*********************************************************************************
* It is similar to that of axes X and Y. Obviously there is no security quota
* interlock of axis Z.
C w.asse2
L DD32 * Load manual speed
C C.UI.V * Convert in inside units
********************************************************************************
*
* Zero search control
*
********************************************************************************
* The zero search immediately starts the zero search for axis Z is, then for 8
* axes X and Y. When the whole zero search procedure is over the M80.2 flag is
* set up. The zero search procedure can be interrupted by pressing again the
* zero search key.
********************************************************************************
*
* Wait for start input
*
********************************************************************************
* During the automatic function mode. When START button is pressed,the item-
* counter is reset, axis Z reaches the position(quota 0). If it is below the
* security quota (M24.0) axes X and Y go to the first point (X1,Y1). At key
* pressure the variables dX and dY are copied into the work variables (DD100 and
* DD104).
ENDIF
********************************************************************************
*
* Wait for arrival at quota
*
********************************************************************************
* When axes X and Y arrive at quota, axis Z moves to
* quota Z1.
********************************************************************************
*
* Wait for axis Z positioning end
*
********************************************************************************
* At the end of positioning, axis Z waits for a set time in DD52, then goes
* back to its position quota.
C ?fermo
= M24.3
********************************************************************************
*
* Control if the working is finished
*
********************************************************************************
* The M101.7 flag is set up if working is not finished.
********************************************************************************
*
* Working not finished: position X Y on the next point
*
********************************************************************************
*
* If the working is not finished, it is necessary to move to the next point.
*
C w.asse1
L DD104 * dY Working
C C.U.I * Conversion in impulses
L DD40 * Axis Y speed
C C.UI.V * Conversion in inside units
C cm-movei * Incremental Positioning
ENDIF
********************************************************************************
*
* Working finished: position X Y on point zero
*
********************************************************************************
********************************************************************************
*
* Cycle stop control
*
********************************************************************************
* If the STOP input is pressed when the machine is in automatic, all axes are
* stopped and the MW100 flags are reset.
T MW100
ENDIF
********************************************************************************
*
* Control Axes in Error
*
********************************************************************************
* If an axis enters an error mode, all axes must be immediately stopped and all
* M64.6 M64.7 and M65.0 alarm flags must be set up, while MW90 and MW100 flags
* must be reset.
C w.asse0
C R.modo
L KZ12
=F
= M25.0 * Axis X in error
S M64.6 * Axis X in error
C w.asse1
C R.modo
L KZ12
=F
= M25.1 * Axis Y in error
S M64.7 * Axis Y in error
C w.asse2
C R.modo
L KZ12
=F
= M25.2 * Axis Z in error
S M65.0 * Axis Z in error
********************************************************************************
*
* Control function mode light
*
********************************************************************************
* The light for function mode can mean the following:
* off = manual
* slow flashing = zero search on-going
* fast flashing = working on-going
* on = automatic - waiting for cycle start
U M80.3 * Manual
U M90.0 * Zero Search
U M33.1 * Slow flashing
O
U M80.4 * Automatic
U M100.0 * Cycle started
U M33.0 * Fast flashing
O
U M80.4 * Automatic
UN M100.0 * Cycle not started
= A0.5
********************************************************************************
*
* Alarm control
*
********************************************************************************
* In case of alarm, as MW64 contains a value different from zero, the alarms’spy
* should automatically switch on. If the alarm spy is on by pressing the alarm
* acquisition input, MW64 is reset.
********************************************************************************
*
* Quota reading
*
********************************************************************************
* The quotas of the three axes are restored in DD200, DD204 and DD208 to be
* monitored during program tuning-up.
C w.asse0
C R.P1 * Read quota in impulses
C C.I.U * Conversion in units
T DD200
C w.asse1
C R.P1 * Read quota in impulses
C C.I.U * Conversion in units
T DD204
C w.asse2
C R.P1 * Read quota in impulses
C C.I.U * Conversion in units
T DD208
BE * Program End
CORRECTION
In this correction are described some commands non included in the manual. These commands
regard the systems CTN320 – CTN350 – CTN560. For each comman it is specified what systems
support it.
cm-?btb (CTN320-350-560)
NOTE
The function cm-?btb substitute the function ?btb. For compatibility, the old function is still present in the
AWL vocabolary. We suggest you to use cm-?btb
cm-?i2t (CTN320-350-560)
NOTE
The function cm-?i2t substitute the function ?i2t. For compatibility, the old function is still present in the AWL
vocabolary. We suggest you to use cm-?i2t
cm-?nstop (CTN320-350)
NOTE
The function cm-?nstop substitute the function ?nstop. For compatibility, the old function is still present in the
AWL vocabolary. We suggest you to use cm-?nstop
cm-?pstop (CTN320-350)
NOTE
The function cm-?pstop substitute the function ?pstop. For compatibility, the old function is still present in the
AWL vocabolary. We suggest you to use cm-?pstop
cm-abibtb (CTN320-350-560)
cm-abii2t (CTN320-350)
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-abibtb, cm-disbtb, cm-disi2t
cm-copp (CTN320-350)
It sets percentage of the maximun torque with the ACC1 value. The command must be given once,
not repetitively.
cm-coppia (CTN320-350)
It enables the digital output for switching from speed command to torque command. Thish function
must be used only in drivers with torque control option.
cm-disbtb (CTN320-350-560)
cm-disi2t (CTN320-350)
cm-lib (CTN320-350-560)
It disable the driver of the selected axis. This is possible only if the system manages the driver
enabling operation by its special output.
cm-nolib (CTN320-350-560)
It enable the driver of the selected axis. This is possible only if the system manages the driver
enabling operation by its special output.
cm-rcopp (CTN320-350)
It reset the torque of the selected axis. This function must be used to synchronize the digital
potentiometer. Give the comand just once.
cm-veloc (CTN320-350)
It disables the digital output used to switch from speed to torque control.
R.Cerr
It returns the Cerr variable value of the selected axis in ACC1. The variable Cerr indicates the error
code when the axis is in mode 12 (= axis in overflow) according to the following custom:
W.N.FC (CTN320-350)
It sets the N.FC variable of the selected axis with the value contained in ACC!. The Value –1
disables teh test on the positive extraswitch. Every other value enables it.
W.N.IC (CTN320-350)
It sets the N.FC variable of the selected axis with the value contained in ACC!. The Value –1
disables teh test on the negative extraswitch. Every other value enables it.