Carola Order Processing¶
Transfer of orders from an MES or ERP system.
Introduction¶
With C-Gate, it is possible to send production orders from most ERP/MES systems to the QIROX robot via the OPC UA protocol.
Two data points are available at C-Gate for this type of data transmission. Each of these data points has 100 variables that can be sent to or received by the robot.
ReadVar– Robot to MESWriteVar– MES to robot
C-Gate only acts as a communication endpoint and mediation medium for the transfer. The actual logic is customised and must be implemented in the ERP/MES system and on the robot using the Carola programming.
Tip
UA Expert can be used to try out the examples of this guide with the Connector OPC UA Interface. See OPC UA Interface documentation
Examples¶
Example: A simple order transfer sequence¶
In the following example, the MES and the robot each use a status variable to control communication. Other variables are used by the ERP/MES to provide order information. The variables are located on the indexes as follows:
- Status (Index 1)
- Order number (Index 2)
- Program name (Index 3)
Sequence diagram¶
Carola Programming code¶
In Carola language reading and writing can be done by running
OPCUAVAR(0,X,VAR,'VAR') !** Send Variable called 'VAR' to MES at index X-1 (READVAR)
OPCUAVAR(1,X,VAR,'VAR') !** Read Variable called 'VAR' to MES at index X-1 (WRITEVAR)
Warning
In Carola language the index starts 1 but on the OPC UA interface the array of variables starts at index 0. Thats why X-1 is used in the previous Carola code example. The variable range on the robot is 1-100 and on the OPC UA interface its 0-99.
Info
The textual status values have been replaced by integer values in the following program. This is necessary as the variables and variable types in the WriteVar list are initially empty and set to integer type when the robot is started. This leads to an error on the robot if the program is started before the MES or ERP system has been able to write to the variables. If there are any discrepancies, the following error will appear on the controller: F3974: DATA-types are not identical !
Robot Status table
| Status | Meaning |
|---|---|
| 0 | NO STATUS |
| 1 | RECEIVED |
| 2 | ACCEPTED |
| 3 | REJECTED |
MES Status table
| Status | Meaning |
|---|---|
| 0 | NO STATUS |
| 1 | READY |
| 2 | SEND |
Warning
The data type of the variable in the OPC data structure must be set correctly by the MES. In addition, the variable name must match exactly the name specified in the OPCUAVAR command. If there are any discrepancies, the following error will appear on the controller: F3974: DATA-types are not identical !
| Data type | Meaning |
|---|---|
| 0 | Integer |
| 1 | Float |
| 2 | String |
!** RESET STATUS TO EMPTY AND THEN READY
CGRESET:
STIMER (4,10000) !** SET 10sec timer
CGSTATUS:=0 !** CGSTATUS=EMPTY
OPCUAVAR(0,1,CGSTATUS,'STATUS') !** SEND CGATE STATUS
WAITM (500)
CGSTATUS:=1 !** CGSTATUS=READY
OPCUAVAR(0,1,CGSTATUS,'STATUS') !** SEND CGATE STATUS
WAITM (500)
STATUS:=0
!** WAIT FOR NEW ORDER DATA AND PROCESS IT
CGSTART:
OPCUAVAR(1,1,STATUS,'') !** READ MES STATUS
GOTOXY (1,12)
IF STATUS=0 THEN WRITE ('C-GATE-MES: OFFLINE...') !** STATUS=EMPTY
IF STATUS=1 THEN WRITE ('C-GATE-MES: ONLINE: WAITING FOR DATA...') !** STATUS=READY
IF STATUS=2 THEN WRITE ('C-GATE-MES: DATA RECEIVED...') !** STATUS=SEND
WAITS (1)
!** IF NO DATA FOR MORE THAN 10 SECONDS RESET
GTIMER (4,MSEC)
IF MSEC<0 THEN IF STATUS<>2 THEN JUMP CGRESET !** STATUS<>SEND
IF STATUS<>'2' THEN JUMP CGSTART !** WAITING FOR DATA
!** ORDER RECEIVED
OPCUAVAR(1,2,ORDERNUM,'ORDERNUMBER')
OPCUAVAR(1,3,PROGRAM,'PROGRAMNUMBER')
GOTOXY (1,12) WRITE ('DATA RECEIVED: PLEASE CHECK!')
GOTOXY (1,13) WRITE ('ORDERNUMBER: ',ORDERNUM)
GOTOXY (1,14) WRITE ('PROGRAMNAME: ',PROGRAM)
!** SEND STATUS: ORDER ACCEPTED
CGSTATUS:= 2 !** CGSTATUS=ACCEPTED
OPCUAVAR(0,1,CGSTATUS,'STATUS') !** SEND CGATE STATUS
WAITM (500)
GOTOXY (1,12) WRITE ('ORDER ACCEPTED: WAITING FOR CONFIRMATION...')
!** WAITING UNTIL MES IS READY
CGREADY:
OPCUAVAR(1,1,STATUS,'') !** READING MES STATUS
WAITM (500)
IF STATUS<>1 THEN JUMP CGREADY !** STATUS<>READY