Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:appnote:an008 [2017/05/03 18:04] – [Sviluppo di un applicativo per effettuare un posizionamento in interpolazione] qem103 | en:appnote:an008 [2019/08/29 17:01] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== AN008 - Example of using and calibrating the JOINT device | ||
+ | JOINT can be considered a device that combines the functionality of three EANPOS device to control respectively three axes that are called X, Y and Z. Therefore placements are made using a control of P.I.D. type as for the EANPOS device.\\ | ||
+ | The novelty item than the simple single-axis positioner is the ability to make interpolated movements: by this we mean draw arcs precisely to join such as two line segments. | ||
+ | |||
+ | In this section we want to describe the first steps that will make the userin its first approach to the device. You also want to provide a simple example using the JOINT device so that the user has a starting point from which to develop your application. | ||
+ | |||
+ | We can divide in the following sections, the proceed of the operation: | ||
+ | |||
+ | * device declaration in the configuration unit | ||
+ | * introduction of parameters in order to correctly calibrate inputs and outputs | ||
+ | * development of the application according to the needs | ||
+ | |||
+ | ==== Device declaration in the configuration unit ==== | ||
+ | |||
+ | As was already explained in the description of the JOINT device,You must program properly the unit application configuration. It is very important to the part of code that declares the device, here you should indicate the hardware resources to use to ensure proper operation. It will be the responsibility of the programmer to pick and choose the most appropriate inputs and outputs.For example with the following line of code: | ||
+ | |||
+ | <code QCL> | ||
+ | ; | ||
+ | ; Internal device declaration | ||
+ | ; | ||
+ | INTDEVICE | ||
+ | .. | ||
+ | < | ||
+ | 1.CNT01 1 1.INP01 1.AN01 | ||
+ | 1.CNT02 2 1.INP02 1.AN02 | ||
+ | 2.CNT01 3 2.INP01 2.AN01 | ||
+ | 3.OUT01 3.OUT02 3.OUT03 3.OUT04 | ||
+ | </ | ||
+ | |||
+ | You define a JOINT device with name " | ||
+ | This is followed by three rows that are inserted the configuration parameters of the axes (respectively X, Y and Z) as should be done for an EANPOS device. There are: the hardware address of bi-directional meter for the acquisition of the position, the digital address for interruption and a digital address for enable to be used in the homing procedure and finally the address of the analog output for control of the drive connected to the motor you intend to move. This configuration is repeated for the remaining two axes (if you are using 3, otherwise you use currency symbol X or X.Xas usual if you do not use any resource).\\ | ||
+ | Finally you have the ability to declare 4 digital outputs that you can use with this device. | ||
+ | |||
+ | An application that has just inside the device Declaration in the configuration unit and a qcl unit that it does not run anything (excluding the forced WAIT) already allows to perform the first operations using the capabilities of the device. In fact after downloading the application tool and have done work, It can change the parameters, | ||
+ | This is very convenient in the early stages of planning When you just want to make some runs or debugged phase. | ||
+ | |||
+ | ==== Correct device parameterization ==== | ||
+ | |||
+ | ^: | ||
+ | |||
+ | Once declared hardware resources properly to use you need to set some parameters depending on the components that are attached to the Qmove product to properly configure each axis. The operations will be repeated for the three axes. The parameters taken from the EANPOS device have the same name with postponed a letter indicating the axis you are configuring. | ||
+ | |||
+ | === Measure and pulse introduction === | ||
+ | |||
+ | Let us consider the case the bi-directional transducer is a digital encoder. Suppose that the encoder is directly keyed on an engine that is to move an axis. You will need to set the correctly the //measure// and //pulse// parameters so that the latter can interpret the pulses arriving at QMove, the tool will then calculate the position of the axis. The //measure// and //pulse// introduction establishes a correspondence between a space in a unit of your choice and a certain number of pulses. In the event that the user already knows the space covered in a round encoder then you'll proceed directly to projecting values.\\ | ||
+ | Let's clarify this concept with an example: If the encoder emits 1000 pulses/Rev and you know that the axis moves about 5 cm when the encoder execute exactly one round then you can insert the following values: | ||
+ | <code QCL> | ||
+ | Axis: | ||
+ | Axis:pulsex = 4000 | ||
+ | </ | ||
+ | |||
+ | The //measure// value introduced it also involves choosing a unit of measure of mm for measuring positions, in the //pulse// parameter introduces a value equal to the number of encoder impulses multiplied by 4 (the number of fronts generated by the encoder). It is remember that the // | ||
+ | |||
+ | When the user does not know in advance the measurement parameters, will still be able to make the correct calibration by following these steps: | ||
+ | |||
+ | * give the command to //INIT// at device, verify that the //st_init// status switch to 1 | ||
+ | * through the " | ||
+ | * sets //measure// and //pulse// both to 1 value | ||
+ | * move the axis manually having him make a move a position easily measurable | ||
+ | * read the //posit// value | ||
+ | * now insert the desired measurement unit the measured value in the //measure// parameter and the value of the //posit// parameter in the //pulse// parameter | ||
+ | |||
+ | The encoder resolution is now correctly set. | ||
+ | |||
+ | A further important operation is set the //maxpos// and //minpos// parameters that define respectively the maximum and the minimum position accessible from an axis. | ||
+ | |||
+ | === Choice of speed unit measure === | ||
+ | |||
+ | The instantaneous speed unit measure of the axis is choice by //unitvel// and //decpt// parameters. You can select the unit of time of speed with the //unitvel// parameter: If this is equal to 0 then the speed is measured in Um/min, if it is equal to 1 then is measured in Um/s. The //decpt// parameter instead determines whether multiple speed-measuring of the basic measure unit Um. For example, if hte basic measure unit Um=mm, and unitvel=1 you get the speed indicator in the //vel// variable in:\\ | ||
+ | mm/s (with decpt = 0),\\ | ||
+ | cm/s (with decpt = 1),\\ | ||
+ | dm/s (with decpt = 2),\\ | ||
+ | m/s (with decpt = 3).\\ | ||
+ | Then you need to set the proper display on the terminal operator to adjust the correct decimal point position. | ||
+ | |||
+ | === Analogue output calibration === | ||
+ | |||
+ | ^: | ||
+ | |||
+ | We review the case that your device uses an analogue output implemented with a DAC system: this will assume 16 bit resolution input discrete values (so between -32768 and 32767) to give analog voltage output range ±10V. With the calibration function this analog output can be controlled with a constant value in order to test links and functionality. | ||
+ | |||
+ | ==== Preliminary motion ==== | ||
+ | |||
+ | This section describes the operations to be execute to verify the accuracy of the connections and the functionality of the system. | ||
+ | |||
+ | * give the //INIT// command to device, verify that the //st_init// status switch to 1 | ||
+ | * give the //RESUME// command to remove a possible emergency condition (// | ||
+ | * enable axis calibration status give the //CALON// command, the //st_cal// status switch to 1 | ||
+ | * in these conditions you can set the analog voltage through the //vout// parameter: the value is expressed in tenths of a Volt (therefore the range of values entered is ±100). It is recommended to introduce low values (5, 10, 15 ...) | ||
+ | * because now the device is used as " | ||
+ | * if output voltage 0 V you notice that the axis is moving due to offset voltages, these can be compensate using the //offset// parameter. For an optimal result of the calibration, | ||
+ | * Now you can disable calibration status with the command //CALOFF// (the //st_cal// state switch to 0). | ||
+ | |||
+ | ==== Analog output parameterization (setting maxvel parameter) ==== | ||
+ | |||
+ | The device generates the voltage value of the analog output based on a proportion between maximum axis speed and maximum output voltage. To do this you need to set the //maxvel// parameter, that is the speed at which it moves the axis when maximum voltage is given to the drive. Obviously the axis must have a symmetrical behavior compared to the zero value of analog voltage, so the speed must be the same (in module) To the maximum voltage both positive and negative.\\ | ||
+ | To know the maximum speed there are two ways: the " | ||
+ | If you do not know the maximum declared speed of the motor you must proceed in this way: | ||
+ | |||
+ | * enter in the calibration mode (as described above) | ||
+ | * if possible, provide maximum voltage to the drive and read the value of //vel// parameter | ||
+ | * you can also provide a lower voltage and calculate the maximum speed with the proportion //vout// : 10 V = //vel// : //maxvel// | ||
+ | |||
+ | Now you can then enter the value of the maximum speed in the //maxvel// parameter. | ||
+ | |||
+ | === First movement === | ||
+ | |||
+ | ^: | ||
+ | |||
+ | The procedures described here have allowed to complete the first phase of the device parameterization. Now it is possible to execute a simple movement of the axis. For example, follow these steps: | ||
+ | |||
+ | * give the //INIT// command to device, verify that the //st_init// status switch to 1 | ||
+ | * move the axis to a position for execute a space without bump the limit switches | ||
+ | * set the parameter that defines the time used by the axis takes to reach the maximum speed from 0 (and vice versa) // | ||
+ | * set the positioning speed with the //setvel// parameter | ||
+ | * set the position quota with the //setpos// parameter | ||
+ | * set the //feedfw// parameter to 1000 (100%) | ||
+ | * reset any emergency status with the //RESUME// command | ||
+ | * start positioning with the //START// command, to stop the movement give the //STOP// command (or // | ||
+ | |||
+ | This first movement was performed without activating the ring of space reaction, so any error introduced by offset voltage values or from external agents is not corrected. | ||
+ | |||
+ | === Using the RECDATA device to calibrate the PID controller === | ||
+ | |||
+ | When the programmer intends to fine tune the parameters of the PID controller, he can use an internal device that allows you to record data of the type: position in primary pulses, Axis Virtual Positions, analog outputs, following error, inputs and outputs states. This tool is called RECDATA and use the RAM of the QMove CPU, therefore, when it is used, The use of the data memory must not exceed the 50% of the total. | ||
+ | |||
+ | The effects of the PID Regulation produce very difficult events to appreciate with the naked eye, the RECDATA device It becomes very useful when you want to calibrate parameters such as //pgain//, //integt// or //derivt//. The events such as overshoot or a slowdown due to excessive value of the integral time must be keep in consideration in the parameterization phase. | ||
+ | |||
+ | Because the RECDATA device use is simple, it's sufficient to declare it in the configuration unit with a line of the type: | ||
+ | <code QCL> | ||
+ | ; | ||
+ | ; Internal device declaration | ||
+ | ; | ||
+ | INTDEVICE | ||
+ | Recorder | ||
+ | </ | ||
+ | |||
+ | The device is particularly suitable to monitor the device parameters in fact it allows you to view: The position values in primary pulses (directly taking data from the bidirectional transducer), | ||
+ | |||
+ | A more detailed description of the RECDATA device you can find it in the appropriate section, Here we limit ourselves to list the steps to follow to use it: | ||
+ | |||
+ | * device declaration in the configuration unit entering as inputs and outputs parameters also used by the JOINT device | ||
+ | * give the STARTR command in the moment that you want to start recording, and STOPR When you want to stop | ||
+ | * to completed operations from the QView " | ||
+ | * in the windos that will open are available several options, The most important task to do is give the "Start data acquiring" | ||
+ | * on cartesian axes, at the end of loading, will compare the value of the monitored parameters | ||
+ | |||
+ | ^: | ||
+ | |||
+ | ==== Development of an application to execute an interpolation position ==== | ||
+ | |||
+ | In the previous section was explained what are the first steps to follow. This example uses only a narrow spectrum of the settable parameters of the device, in this section we insert a sample code, commented, from which the user can take a cue to develop an application.\\ | ||
+ | The way the device should be declared is explained previously, And so this section omits the configuration unit. [[#Device declaration in the configuration unit|See here.]] | ||
+ | |||
+ | Suppose you have to make placements with interpolation of three axes as to the path shown in the picture, we analyze what the program code could be. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | <code QCL> | ||
+ | ; | ||
+ | ; Configuration unit (are shown only the declarations of variables and | ||
+ | ; are omitted statements of the bus and the device) | ||
+ | ; | ||
+ | ; | ||
+ | ; Array GLOBAL definition | ||
+ | ; | ||
+ | ARRGBL | ||
+ | awPosX | ||
+ | awPosY | ||
+ | awPosZ | ||
+ | awCodeSt | ||
+ | ; | ||
+ | ; SYSTEM Variables definition | ||
+ | ; | ||
+ | SYSTEM | ||
+ | |||
+ | ; | ||
+ | ; GLOBAL Variables definition | ||
+ | ; | ||
+ | GLOBAL | ||
+ | gbi B | ||
+ | |||
+ | ; | ||
+ | ; INPUT Variables definition | ||
+ | ; | ||
+ | INPUT | ||
+ | ifStart | ||
+ | |||
+ | ; | ||
+ | ; OUTPUT Variables definition | ||
+ | ; | ||
+ | OUTPUT | ||
+ | |||
+ | |||
+ | ; | ||
+ | ; Unit qcl | ||
+ | ; | ||
+ | |||
+ | ; | ||
+ | ; axis parameterization | ||
+ | ; | ||
+ | ; | ||
+ | Axis: | ||
+ | Axis:pulsex = 40000 ;how to calculate measure and pulse is explained in specific paragraph.* | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:decptx = 0 ;decimal digits in speed calculation | ||
+ | Axis: | ||
+ | ;o deceleration from zero speed to maximum speed) | ||
+ | Axis: | ||
+ | Axis:tinvx = 0 ;axis inversion Time | ||
+ | Axis:tollx = 5 ; | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:pgainx = 10 ; | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | |||
+ | ; | ||
+ | Axis: | ||
+ | Axis:pulsey = 40000 ;how to calculate measure and pulse is explained in specific paragraph.* | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:decpty = 0 ;decimal digits in speed calculation | ||
+ | Axis: | ||
+ | ;o deceleration from zero speed to maximum speed) | ||
+ | Axis: | ||
+ | Axis:tinvy = 0 ;axis inversion Time | ||
+ | Axis:tolly = 5 ; | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:pgainy = 10 ; | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | |||
+ | ; | ||
+ | Axis: | ||
+ | Axis:pulsez = 40000 ;how to calculate measure and pulse is explained in specific paragraph.* | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:decptz = 0 ;decimal digits in speed calculation | ||
+ | Axis: | ||
+ | ;o deceleration from zero speed to maximum speed) | ||
+ | Axis: | ||
+ | Axis:tinvz = 0 ;axis inversion Time | ||
+ | Axis:tollz = 5 ; | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:pgainz = 10 ; | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | |||
+ | ;****Device parameters**** | ||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis:tacci = 100 ; | ||
+ | Axis: | ||
+ | |||
+ | |||
+ | ;****Device initializing**** | ||
+ | INIT Axis ; | ||
+ | WAIT Axis: | ||
+ | CNTUNLOCKX Axis ; | ||
+ | WAIT NOT Axis: | ||
+ | CNTUNLOCKY Axis ; | ||
+ | WAIT NOT Axis: | ||
+ | CNTUNLOCKZ Axis ; | ||
+ | WAIT NOT Axis: | ||
+ | CNTDIRX Axis ;Sets the sense of position acquisition of X axis | ||
+ | WAIT NOT Axis: | ||
+ | CNTDIRY Axis ;Sets the sense of position acquisition of Y axis | ||
+ | WAIT NOT Axis: | ||
+ | CNTDIRZ Axis ;Sets the sense of position acquisition of Z axis | ||
+ | WAIT NOT Axis: | ||
+ | REGONX Axis ; | ||
+ | WAIT NOT Axis: | ||
+ | REGONY Axis ; | ||
+ | WAIT NOT Axis: | ||
+ | REGONZ Axis ; | ||
+ | WAIT NOT Axis: | ||
+ | RESUMEX Axis ;Remove the x-axis from any emergency status | ||
+ | WAIT NOT Axis: | ||
+ | RESUMEY Axis ;Remove the y-axis from any emergency status | ||
+ | WAIT NOT Axis: | ||
+ | RESUMEZ Axis ;Remove the z-axis from any emergency status | ||
+ | WAIT NOT Axis: | ||
+ | LOOPONX Axis ;Hook x axis reaction Loops | ||
+ | WAIT Axis: | ||
+ | LOOPONY Axis ;Hook y axis reaction Loops | ||
+ | WAIT Axis: | ||
+ | LOOPONZ Axis ;Hook z axis reaction Loops | ||
+ | WAIT Axis: | ||
+ | |||
+ | ; | ||
+ | ; Setting up the Placement Program | ||
+ | ; | ||
+ | ;X axis coordinates | ||
+ | awPosX[1] = 0 | ||
+ | awPosX[2] = 100 | ||
+ | awPosX[3] = 600 | ||
+ | awPosX[4] = 500 | ||
+ | awPosX[5] = 300 | ||
+ | |||
+ | ;Y axis coordinates | ||
+ | awPosY[1] = 0 | ||
+ | awPosY[2] = 200 | ||
+ | awPosY[3] = 200 | ||
+ | awPosY[4] = 0 | ||
+ | awPosY[5] = 100 | ||
+ | |||
+ | ;Z axis coordinates | ||
+ | awPosZ[1] = 0 | ||
+ | awPosZ[2] = 0 | ||
+ | awPosZ[3] = 0 | ||
+ | awPosZ[4] = 0 | ||
+ | awPosZ[5] = 600 | ||
+ | |||
+ | ;Step codes in Intepolation | ||
+ | awCodeSt[1] = 0 | ||
+ | awCodeSt[1] = 0 | ||
+ | awCodeSt[1] = 0 | ||
+ | awCodeSt[1] = 3000 ;Wait 1 second after 4° placement | ||
+ | awCodeSt[1] = 10001 ; | ||
+ | |||
+ | ; | ||
+ | ; Writing steps in the program | ||
+ | ; | ||
+ | Axis: | ||
+ | FOR (gbi=1, gbi LE 5, 1) | ||
+ | Axis:stepin = gbi | ||
+ | Axis:codex1 = awPosX[gbi] | ||
+ | Axis:codey1 = awPosY[gbi] | ||
+ | Axis:codez1 = awPosZ[gbi] | ||
+ | Axis: | ||
+ | Axis: | ||
+ | WRITESTEP Axis | ||
+ | WAIT Axis: | ||
+ | NEXT | ||
+ | |||
+ | ;The Placements program table is now complete | ||
+ | |||
+ | Axis: | ||
+ | Axis: | ||
+ | Axis: | ||
+ | |||
+ | MAIN: | ||
+ | IF ifStart | ||
+ | STARTPRG Axis | ||
+ | ENDIF | ||
+ | </ | ||
+ | |||
+ | [[#Measure and pulse introduction|How to calculate measure and pulse is explained in the appropriate section.]] | ||
+ | |||
+ | To make simple placements the operations to be carried out are the same ones that have been analyzed in the description of the EANPOS device. |