Script

Top  Previous  Next

 

In the script a short piece of AWL-Code can be written for each element to modify the properties or to reproduce hardware outside the PLC. As an example we take a conveyor that can not work if a safeguarding case happened in the motor circuit-breaker.

 

The script would be:

 

A “Q motor”

// motor circuit-breaker (input)

A “O motor”

// output motor start

= “#bool0”


 

Now #bool0 has taken the place in the drive mask that was 'O motor' before.

 

The #bool0 is a bit of the instance data block that is assigned to each element individually. All static variables of this IDB are only known inside the element and keep their value from one simulation step to the next, unless they are in an interface panel of a writing element.

 

The declaration of the static variables can be displayed and edited with the button VAR.

 

There you can declare new variables (and also change the name of the predefined #bool0, #int0, #dint0). The data types BOOL, BYTE, INT, WORD, DINT, DWORD and REAL are permitted. You can choose all addresses up to 20.0. The address allocation is not controlled that strictly in TrySim as in Fbs, even overlapping addresses can be entered. Overlapping addresses can be useful if e.g. you want to access Words bit by bit. However, the free address allocation requires also more attention in generating.

 

At the left margin the values of the operands are displayed. Please mind that not the result of logic operation (RLO) and not the accu contents are shown. You can change these by a click on the LED or the number.

 

You can see the advantage of these scripts especially when reuse machines for the next project. Almost everything that was placed in OB2 and OB3 is now directly in the element and is adopted with it. Furthermore we made more transparent the things influencing the behavior of an element outside the PLC program additionally.

 

The script is also useful if you don't want to write a 'real' PLC grogram but need a controlled simulation only for demonstration purposes.

 

You can access the static variables of the superior element e.g. with #father.bool0 (only symbolically). This has been proved useful for communication of elements among each other, since no absolute addresses (e.g. marker or data blocks) have to be assigned anymore.

 

We prepare an access in a freer way (then probably via e.g. #friend.bool0). An easy access to internal data, on which you only could access with peek and poke elements so far, will also be possible with the syntax e.g. #element.position_x.

 

Suggestions from practice for the script are very welcome.

 

March 2009

 

Common properties