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

TYPEPL7-3 Serie7UNITYCOMMENT
EBOOLBx%MxSame address source - target
BOOLWx,y%MWx.ySame address source - target
BOOLCWx,y%KWx.ySame address source - target
BOOLIxy,z%Ix.y.zThe address can be changed by mapping
BOOLOxy,z%Qx.y.zThe address can be changed by mapping
BOOLIWxy,z,t%IWx.y.z.tThe address can be changed by mapping
BOOLOWxy,z,t%QWx.y.z.tThe address can be changed by mapping
BOOLRIxy,z%I\3.0.x\y.zFIPIO address is the same
BOOLROxy,z%Q\3.0.x\y.zFIPIO address is the same
BOOLRIWxy,z,t%IW\3.0.x\y.zFIPIO address is the same
BOOLROWxy,z,t%QW\3.0.x\y.zFIPIO address is the same
WORD/INTDWx%MDxSame address source - target
WORD/INTCDWx%KDxSame address source - target
REALFx%MFxSame address source - target
REALCFx%KFxSame 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:

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.

TYPEPL7-3 TSXUNITYCOMMENT
BoolSY0%S0Cold Start
BoolSY1%S1Warm Start
BoolSY4%S4100ms
BoolSY5%S510ms
BoolSY6%S61s
BoolSY7%S71mn
BoolSY9%S9Positioning Output fallback
BoolSY10%S10I/O Error
BoolSY16%S16I/O Error Task
BoolSY17%S17Carry
BoolSY18%S18Overflow
BoolSY19%S19Overrun
BoolSY20%S20Index Overflow
BoolSY40%S40I/O Rack0/1 Error
BoolSY41%S41I/O Rack2/3 Error
BoolSY42%S42I/O Rack4/5 Error
BoolSY43%S43I/O Rack6/7 Error
BoolSY44%S44I/O Rack8/9 Error
BoolSY45%S47I/O RackA/B Error
BoolSY46%S46I/O RackC/D Error
BoolSY47%S47I/O RackE/F Error
BoolSY118%S118Remote I/O Error
BoolSY119%S119Rack I/O Error
IntSW2%SW13XWAY NETWORK ADRESS
IntSW40%SW33FAST CURRENT TIME
IntSW41%SW30MAST CURRENT TIME
IntSW42%SW36AUX0 CURRENT TIME
IntSW43%SW39AUX1 CURRENT TIME
IntSW44%SW42AUX2 CURRENT TIME
IntSW45%SW45AUX3 CURRENT TIME
IntSW60%SW124CPU 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:

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 TSXUNITYTASK
CTRL1%S38Interruptive Task: Currently not supported
CTRL2%S31FAST
CTRL4%S32AUX0
CTRL5%S33AUX1
CTRL6%S34AUX2
CTRL7%S35AUX3

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

Five program modules are created:

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 TSXUNITY
LadderLadder
LiteralLiteral
SFCSFC

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 blocUNITY 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

TSXUNITY
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.