Table of Contents
TSX / UNITY PREMIUM path general informations
This chapter gives the general informations of TSX to UNITY conversion path.
Variables translation schemes
Internal variables
Mapping
| TYPE | PL7-3 Serie7 | UNITY | COMMENT |
|---|---|---|---|
| EBOOL | Bx | %Mx | Same address source - target |
| BOOL | Wx,y | %MWx.y | Same address source - target |
| BOOL | CWx,y | %KWx.y | Same address source - target |
| BOOL | Ixy,z | %Ix.y.z | The address can be changed by mapping |
| BOOL | Oxy,z | %Qx.y.z | The address can be changed by mapping |
| BOOL | IWxy,z,t | %IWx.y.z.t | The address can be changed by mapping |
| BOOL | OWxy,z,t | %QWx.y.z.t | The address can be changed by mapping |
| BOOL | RIxy,z | %I\3.0.x\y.z | FIPIO address is the same |
| BOOL | ROxy,z | %Q\3.0.x\y.z | FIPIO address is the same |
| BOOL | RIWxy,z,t | %IW\3.0.x\y.z | FIPIO address is the same |
| BOOL | ROWxy,z,t | %QW\3.0.x\y.z | FIPIO address is the same |
| WORD/INT | DWx | %MDx | Same address source - target |
| WORD/INT | CDWx | %KDx | Same address source - target |
| REAL | Fx | %MFx | Same address source - target |
| REAL | CFx | %KFx | Same address source - target |
Variable Name and comment
The name and comment of the variables are kept with their initial values.
Some variables names may be not supported under target (i.e. reserved mnemonic, ….These variables are renamed by adding a suffix or a prefix to the original mnemonic.
For variables with no name, a name is created from the address.
Examples:
- W100 will be named W100
- B10 will be named B10
System variables
System variable Mapping
The system variables are not all converted.
The list of UNITY correspondence convention for system variables is given in the following chart.
| TYPE | PL7-3 TSX | UNITY | COMMENT |
|---|---|---|---|
| Bool | SY0 | %S0 | Cold Start |
| Bool | SY1 | %S1 | Warm Start |
| Bool | SY4 | %S4 | 100ms |
| Bool | SY5 | %S5 | 10ms |
| Bool | SY6 | %S6 | 1s |
| Bool | SY7 | %S7 | 1mn |
| Bool | SY9 | %S9 | Positioning Output fallback |
| Bool | SY10 | %S10 | I/O Error |
| Bool | SY16 | %S16 | I/O Error Task |
| Bool | SY17 | %S17 | Carry |
| Bool | SY18 | %S18 | Overflow |
| Bool | SY19 | %S19 | Overrun |
| Bool | SY20 | %S20 | Index Overflow |
| Bool | SY40 | %S40 | I/O Rack0/1 Error |
| Bool | SY41 | %S41 | I/O Rack2/3 Error |
| Bool | SY42 | %S42 | I/O Rack4/5 Error |
| Bool | SY43 | %S43 | I/O Rack6/7 Error |
| Bool | SY44 | %S44 | I/O Rack8/9 Error |
| Bool | SY45 | %S47 | I/O RackA/B Error |
| Bool | SY46 | %S46 | I/O RackC/D Error |
| Bool | SY47 | %S47 | I/O RackE/F Error |
| Bool | SY118 | %S118 | Remote I/O Error |
| Bool | SY119 | %S119 | Rack I/O Error |
| Int | SW2 | %SW13 | XWAY NETWORK ADRESS |
| Int | SW40 | %SW33 | FAST CURRENT TIME |
| Int | SW41 | %SW30 | MAST CURRENT TIME |
| Int | SW42 | %SW36 | AUX0 CURRENT TIME |
| Int | SW43 | %SW39 | AUX1 CURRENT TIME |
| Int | SW44 | %SW42 | AUX2 CURRENT TIME |
| Int | SW45 | %SW45 | AUX3 CURRENT TIME |
| Int | SW60 | %SW124 | CPU ERROR |
<note> Variables from SY40 to SY47 (I/O Rackx/y Error) must be revised depending on configuration of the destination PLC. </note>
<note> For variables without UNITY Pro correspondence, an internal variable of the same type is created and named with the same name as the TSX variable. </note>
Digital input/output
The mapping of the digital input/output of the source must be done by the user to define the new location in the new hardware I/O configuration.
I/O Name and comment
The names and comments of the I/O are kept.
For I/O with no name, a name is created from the address.
Examples:
- I2.0 will be named I2_0
Analog input/output
The mapping of the analog input/output of the source must be completed by the user to define the new location in the new hardware configuration.
<note> For some analog cards, the number of physical address does not match with the number of channels. For example, the acquisition card AEM 811, eight measurements are multiplexed into four registers. Each registers corresponds to a physical address. At cycle n, the 4 registers correspond to channels 0, 1, 2 and 3. At cycle n +1, to channels 4, 5, 6 and 7. In this case, a manual override code is required. </note>
Analog Input/Analog Output Name and comment
The names and comments of the AI/AO are kept.
For AI/AO with no name, a name is created from the address.
Codes modules translation schemes
Tasks
Usually, TSX codes have several tasks.
One MAST task, one FAST task and 1 or more auxiliary tasks (AUX0 to AUX3).
Each task can be run with the command start CTRLn. (wherein n represents the task)
| PL7-3 TSX | UNITY | TASK |
|---|---|---|
| CTRL1 | %S38 | Interruptive Task: Currently not supported |
| CTRL2 | %S31 | FAST |
| CTRL4 | %S32 | AUX0 |
| CTRL5 | %S33 | AUX1 |
| CTRL6 | %S34 | AUX2 |
| CTRL7 | %S35 | AUX3 |
In the new hardware configuration, the processor P57 5634M is chosen in order to support the auxiliary tasks.
Periods of each task are kept.
The user can change the type of processor using Unity. <note> Warning change the type of processor can lead to a significant recovery of the code. </note>
Mast task
Case 1 : without SFC declaration
The “Main” program module is translated by Mast_main section in the MAST task.
Case 2 : with SFC declaration
- The “Prel” program module is translated by Mast_prel section in the MAST task.
- The “Post” program module is translated by Mast_post section in the MAST task.
- Each SFC is translated by Chart_Xn SFC section (n is the number of the initial step)
- Each Macro State is translated by XMn (n is the number of the macro state step)
- Each transition code are in the subdirectory “Transitions” (one program module by transition)
- Each Action code are in the subdirectory “Actions” (one program module by action)
Five program modules are created:
- Mast_Init_Chart ⇒ SFC initialization
- Mast_Clear_Chart ⇒ Clear SFC
- Mast_Freeze_Chart ⇒ Freeze SFC
- Mast_Partial_Clear_Chart ⇒ Clear Marcro
- Mast_Reset_Grafcet_Chart ⇒ Reset SFC
Mast Task Subroutines
All subroutines are translated. their names are prefixed by “Mast_”. Example, SR0 ⇒ Mast_sr0
Fast task
The “Main” program module is translated by Fast_main section in the FAST task.
Fast Task Subroutines
All subroutines are translated. their names are prefixed by “Fast_”. Example, SR0 ⇒ Fast_sr0
Auxiliary task
The “Main” program module is translated by Auxn_main section in the AUXn task.(Where n is the Task Identifier)
Auxiliary Task Subroutines
All subroutines are translated. their names are prefixed by “Auxn_”. Example, AUX0 SR0 ⇒ Aux0_sr0
Languages
In general, the type of language is kept.
| PL7-PRO TSX | UNITY |
|---|---|
| Ladder | Ladder |
| Literal | Literal |
| SFC | SFC |
The Comments of the program
<note> The program comments are kept for the Ladder and literal languages but not for the SFC. </note>
System functions
Timers, counters and registers
The timer blocks, counters and register are translated into DFB.
| TSX PL7-3 bloc | UNITY DFB |
|---|---|
| T | Tmr |
| M | Mo |
| C | Co |
| R | Register |
Each timer, counter, register in the code are an instance of DFB.
The name of instance is the original bloc name : Exemple TSX T0 ⇒ T0 (instance of Tmr)
<note>
For timers, counters, monostable implemented in literal language, a section or subroutine (Mast_Update_Tmc_Calls) is created.
In this section, each of these counters, timers, monostable are called without parameters.
This section is called at the end of the MAST task cycle.
</note>
Other Conversion Conventions
Indexed variable
If an instruction “Var (index)” is found in the TSX code,
array variable is generated “Var_ar [0 .. L]” where L is the memory length - Var address.
example:
TSX memory map: w0 to w100
TSX code : w10 (w5) → w1;
UNITY ⇒ create array w10_ar [0 .. 90]
Translated code :
w1: = w10_ar [w5];
TSX Array
if in a same code we find different range usage for arrays at the same address (remember that in TSX w10[x] means an array of x elements starting at address w10).
eg:
…w10[2]….
….
….
…w10[20]…
….
….
…w10[5]…
after translation, only the largest index is translated into array
| TSX | UNITY |
|---|---|
| w10[2] | w10:2 |
| w10[20] | w10_ar |
| w10[5] | w10:5 |
Where w10_ar is ARRAY[0..19] OF INT
Variables read and written in the same rung
The evaluation of an expression in ladder language is not the same between TSX and UNITY. This is why,
in TSX ladder, when a variable is read and written in the same rung. During the conversion, this variable is renamed with prefix of _pre_.
This variable will replace the variables read in the rung.
Conversion Limitation
For all the following items, manual rewriting is necessary.
System variables
Variables from SY40 to SY47 (I/O Rackx/y Error) will resume depending on configuration.
For variables without UNITY correspondence, an internal variable of the same type is created and named with the same name as the TSX variable.
Inputs/Output mapping
New I / O depends on the new configuration
SFC without initial State
Sometimes, we can find SFC without initial state in TSX code .
In this case, the SFC is not converted.
The TSX source code is needed to be edited manually with XTEL workbench, and set an initial step on this SFC.
SFC comments
SFC comments are lost during the translation.
The Special functions : Text Blocs (TXT) and OFBs
The Text Bloc (TXT) and Optional Function Block (OFB) are usually used to make special functions such as:
boards configuration, communications, regulation, axes, motion, …
The body of these blocs are not translated and only interfaces are kept.
All the code where these blocks are called are needed to be manually rewritten.
A large part of these configurations can be completed under UNITY Pro.
