Scripts - Omron CX-Supervisor User Manual

Hide thumbs Also See for CX-Supervisor:
Table of Contents

Advertisement

Scripts

20-5
Scripts
268
To make Workspace navigation of objects easy, reduce the number of top
level objects by collecting objects together into Groups. Grouped objects
can be nested on other groups in a natural hierarchy e.g. a machine has
several panels that have keypads that have buttons.
Create object libraries
Keep a common look and feel between pages and speed up development
by creating libraries of commonly used objects e.g. displays or buttons.
These can also be reused in later projects.
Use Copy and Paste
Making good use of Copy and Paste to duplicate similar objects can
reduce development time.
Use Alignment functions
Create professional looking applications by prevent unsightly errors
quickly using 'Align Top/Left' and 'Make Same Width/Height'.
Draw perfect circles
Quickly draw perfect circles by holding <Ctrl> while drawing an Ellipse.
Use meaningful object names
Instead of accepting the default object and group names rename them to
something more helpful e.g. Conveyor1, InstrumentPanel, StartButton etc
This section covers some good practices for writing scripts.
Never use 'On Regular Interval' scripts
You should (almost!) never need to use 'On Regular Interval' scripts.
Always question:
If it is used for logging - use the logging facilities instead
If it is used for timing - use PLC ladder instead as this is much more
reliable.
When they start with (or contain) "IF <condition> THEN ..." you
should probably be using an "On Condition" script using <condition>
from the IF statement.
When they perform calculations on PLC or memory points (e.g. "Z =
X * Y), use "On Condition" to recalculate when the source data
changes e.g. with a condition X || Y || TRUE (which forces execution
even if value changes to value 0). This will guarantee the calculated
is up to date with the latest source information, plus stress the
system much less while the value doesn't change.
Never use the Sleep() command
You should (almost!) never need to use the Sleep command. It can also
create confusing applications as it can create re-entrant scripts and
asynchronous PLC communications. Always question:
If it is used for timing - use PLC ladder instead as this is much more
reliable.
Consider if the code following the Sleep should in fact be executed
on an event e.g. after completion flag returned from PLC instruction
or new data value etc
Use Animations if possible
Always choose direct object animations in preference to page/object
scripts: blink, colour, disable, height, width, horizontal%fill, vertical%fill,
move, rotate, display and close. These are both quicker and clearer.
SECTION 20 Best Practices

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 3.1

Table of Contents