PLC Simulator
PLC Simulator
EIO0000001714 10/2013
Unity Pro
PLC Simulator
10/2013
EIO0000001714.00
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical
characteristics of the performance of the products contained herein. This documentation is not
intended as a substitute for and is not to be used for determining suitability or reliability of these
products for specific user applications. It is the duty of any such user or integrator to perform the
appropriate and complete risk analysis, evaluation and testing of the products with respect to the
relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or
subsidiaries shall be responsible or liable for misuse of the information contained herein. If you
have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or
mechanical, including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and
using this product. For reasons of safety and to help ensure compliance with documented system
data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant
instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may
result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
© 2013 Schneider Electric. All rights reserved.
2 EIO0000001714 10/2013
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
About the Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Chapter 1 Simulating a PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Loading a Project in the Simulator. . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Simulator Icon in the Toolbar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Chapter 2 Differences Between the Simulator and a Real CPU. . 17
Limitations of the PLC Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
System Bits and System Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Chapter 3 Menu Commands and Dialog Boxes in the PLC
Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Simulator Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Simulator Control for Unknown PLC . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Simulator Control for Quantum PLC . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Simulator Control for Quantum Safety PLC. . . . . . . . . . . . . . . . . . . . . 41
Simulator Control for Premium PLC . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Simulator Control for M340 PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Memory Card for M340 PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Event Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Power Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Timing (simulator) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Processor Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Priority of the Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Data in the User Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Minimal Sample Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Info. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Ending the Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Index ......................................... 67
EIO0000001714 10/2013 3
4 EIO0000001714 10/2013
Safety Information
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to warn of potential hazards or to call attention
to information that clarifies or simplifies a procedure.
EIO0000001714 10/2013 5
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of
the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation
of electrical equipment and its installation, and has received safety training to recognize and avoid
the hazards involved.
6 EIO0000001714 10/2013
About the Book
At a Glance
Document Scope
This document describes the PLC Simulator for Unity Pro.
Validity Note
This document is valid from Unity Pro Version 8.0
EIO0000001714 10/2013 7
8 EIO0000001714 10/2013
Unity Pro
Simulating a PLC
EIO0000001714 10/2013
Chapter 1
Simulating a PLC
Simulating a PLC
Overview
This chapter describes simulating a PLC.
EIO0000001714 10/2013 9
Simulating a PLC
Introduction
Installation
The simulator is automatically installed with Unity Pro.
NOTE: PLC simulator under Microsoft Windows XP SP2 and Microsoft Windows Vista
A firewall dialog box will be displayed during the initial startup of the PLC simulator under Microsoft
Windows XP SP2 and Microsoft Windows Vista. The cause is that the integrated firewall detects
unauthorized TCP/IP activities (the PLC simulator is a TCP/IP server on Schneider Port 502). To
start the PLC simulator, press Release in the firewall dialog box.
Area of Use
The simulator allows you to simulate a CPU of a PLC.
The use of Breakpoints, Stepping and the GoTo function enables you to test your user program in
the simulated PLC.
The Simulator Symbol shown in the task bar offers the following features:
z display of the current status of the simulated PLC (see page 14)
z QuickInfo (Tooltips) shows the IP address of the host PC for the simulator, the used port number
and the name of the loaded project.
z shortcut menu (right mouse button) to control the simulator
10 EIO0000001714 10/2013
Simulating a PLC
Introduction
The process for loading a project to the simulator is identical in principle to loading a project on a
real PLC.
Loading a Project
Loading a project in the simulator
Step Action
1 In Unity Pro, enable the simulator mode using the menu command PLC →
Simulation mode or the symbol on the toolbar:
EIO0000001714 10/2013 11
Simulating a PLC
Step Action
5 Press the Transfer button.
Result: The project is loaded on the simulator and the simulator icon looks as
follows in the toolbar:
For further information on password protection of safety projects please refer to the Unity Pro XLS
Specifics manual, chapter Protection of a Safety Project with Unity Pro XLS.
Creating a Connection
It is standard procedure for the simulator to be installed on the same PC as Unity Pro (Local Host).
When the menu command PLC →Connect is selected, a connection to the Local Host PC on the
default port 502 (Schneider Port) is automatically created. The project can also be loaded on a
simulator in another PC via a TCP/IP connection or on a simulator running on a different port.
In this case you must specify the TCP/IP address and port number of the target PC in the Loading
a project procedure before carrying out step 3 (creating a connection).
Then select the Unity Pro menu command PLC →Set Address, and in the Simulator text box
Address enter the TCP/IP address and the optional port number of the target PC (i.e.:
139.158.106.127:123 where 123 is the port number). Then continue with step 3.
12 EIO0000001714 10/2013
Simulating a PLC
If you want to load the project in the Local Host PC simulator running on default port 502 (Unity Pro
and simulator on the same PC), you do not have to carry out this step as the Local Host PC address
and port number is automatically entered.
Representation of the default dialog box:
Step Action
1 Call the menu command Exit Simulation from the shortcut menu for the
simulator icon in the toolbar or the simulator dialog box.
Result: The simulator is closed.
EIO0000001714 10/2013 13
Simulating a PLC
Introduction
After launching the simulators the simulator icon appears in the toolbar. This icon identifies the
active simulator and displays the different states of the simulated PLC.
General Structure
The simulator icon is composed according to the following rules.
The background color represents the basic state.
The inner symbol shows the current PLC state, such as NOCONF, IDLE, STOPPED, RUN.
14 EIO0000001714 10/2013
Simulating a PLC
Error States
Meaning of the symbols
Internal States
The following symbols represent temporary internal states which should not be seen normally. It is
not possible to recover from these states, so the PLC simulator must be closed and restarted
again.
EIO0000001714 10/2013 15
Simulating a PLC
16 EIO0000001714 10/2013
Unity Pro
Differences
EIO0000001714 10/2013
Chapter 2
Differences Between the Simulator and a Real CPU
Overview
This chapter describes the difference between the simulator and a real PLC.
EIO0000001714 10/2013 17
Differences
General
General limitations
z The PLC simulator simulates a complete project with its user tasks. However, the runtime
behavior of the simulator cannot be compared to that of a real PLC and cannot be used to draw
conclusions about the behavior of a real PLC. This includes Multitasking behavior and time
information.
z The PLC Simulator does not support any form of I/O. Although the simulation contains project
components for I/Os, they are not processed by the PLC simulator. Inputs and outputs can only
be accessed via the project or via the Unity Pro online functions (read, write, force, animate, ...).
z With the PLC simulator I/O events can not be triggered by setting/forcing %I bits.
z For limitations concerning the memory card please refer to Memory Card for M340 PLC,
page 49.
z The PLC Simulator does not support any Hot Standby feature.
18 EIO0000001714 10/2013
Differences
Memory Structure
The different PLC families vary in memory structure. For detailed information about storage
principles and memory structure refer to chapter Application Memory structure (see Unity Pro,
Program Languages and Structure, Reference Manual ).
WARNING
UNINTENDED EQUIPMENT OPERATION
Improper data mapping will occur where memory structures are different. When managing data
exchanges between M340 projects and Premium or Quantum projects, ensure that the structure
of the exchanged data has identical alignments.
Otherwise, the data will not be exchanged properly.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Communication
Communication limitations
z The PLC simulator only supports TCP/IP based communication (Schneider Port 502). In other
cases a Modbus error is returned.
z Modbus, Modbus Plus or Uni-TE are not supported by the PLC simulator.
z The PLC simulator does not support communication to other PCs or PLC simulators, neither
remote nor local.
z The PLC simulator has no communication timeout.
z Communication network, such as Uni-Telway, Ethway, Fipway, Modbus, Modbus Plus, etc., are
not supported by the PLC simulator.
The PLC simulator supports the following native Modbus commands:
EIO0000001714 10/2013 19
Differences
Debugging Limitations
The PLC simulator could enter HALT state when executing the Step Info or Step Over debugging
command in textual languages.
If the current element is a complex instruction (i.e. copying a huge array from one variable to
another), the execution of this instruction takes a very long time, because it will be executed in
single step mode on the PLC simulator.
Setting a breakpoint on the next instruction and executing the Go command avoids this problem.
20 EIO0000001714 10/2013
Differences
System Bits
The following subsets of %S system bits (see Unity Pro, Program Languages and Structure,
Reference Manual ) are supported:
NOTE: %S0 is not set to 1 using Reset with the PLC simulator (in contrast
to a real PLC).
%S0 is not always set in the first scan of the PLC. If a signal set for every
start of the PLC is needed, %S21 should be used instead.
%S1 warm restart Normally at 0, this bit is set to 1 by :
WARMSTART (not for safety PLCs) z power restoration with data save
z the user program
z the terminal
z action on change of cartridge
It is reset to 0 by the system at the end of the first complete cycle and
before the outputs are updated.
%S1 is not always set in the first scan of the PLC. If a signal set for every
start of the PLC is needed, %S21 should be used instead.
%S4 time base 10 ms An internal timer regulates the change in status of this bit.
TB10MS (not for safety PLCs) It is asynchronous in relation to the PLC cycle.
Graph:
EIO0000001714 10/2013 21
Differences
It is reset to 0 by the system at the end of the first complete cycle and
before the outputs are updated.
%S12 PLC in RUN This bit is set to 1 by the system when the PLC is in RUN.
PLCRUNNING It is set to 0 by the system as soon as the PLC is no longer in RUN (STOP,
INIT, etc.).
%S13 first cycle after Normally set to 0, this is set to 1 by the system during the first cycle of the
1RSTSCANRUN switching to RUN master task after the PLC is set to RUN.
%S15 character string fault Normally set to 0, this bit is set to 1 when the destination zone for a
STRINGERROR (not for safety PLCs) character string transfer is not of sufficient size (including the number of
characters and the end of string character) to receive this character string.
The application stops in error state if the %S78 bit has been to set to 1.
This bit must be reset to 0 by the application.
%S17 rotate or shift output normally at 0
CARRY During a rotate or shift operation, this bit takes the state of the outgoing
bit.
%S18 overflow or arithmetic Normally set to 0, this bit is set to 1 in the event of a capacity overflow if
OVERFLOW error there is:
z a result greater than + 32 767 or less than - 32 768, in single length
z a result greater than + 65 535, in unsigned integer
z a result greater than + 2 147 483 647 or less than - 2 147 483 648, in
double length
z result greater than +4 294 967 296, in double length or unsigned
integer
z real values outside limits
z division by 0
z the root of a negative number
z forcing to a non-existent step on a drum
z stacking up of an already full register, emptying of an already empty
register
It must be tested by the user program after each operation where there is
a risk of overflow, and then reset to 0 by the user if there is indeed an
overflow.
When the %S18 bit switches to 1, the application stops in error state if the
%S78 bit has been set to 1.
%S19 task period overrun Normally set to 0, this bit is set to 1 by the system in the event of a time
OVERRUN (periodical scanning) period overrun (i.e. task execution time is greater than the period defined
by the user in the configuration or programmed into the %SW word
associated with the task). The user must reset this bit to 0. Each task
manages its own %S19 bit.
22 EIO0000001714 10/2013
Differences
%S76 configured This bit is set to 1 by the system when the diagnostics option has been
DIAGBUFFCONF diagnostics buffer configured. Then, a diagnostics buffer for storage of errors found by
diagnostics DFBs is reserved.
This bit is read-only.
%S77 full diagnostics buffer This bit is set to 1 by the system when the buffer that receives errors from
DIAGBUFFFULL the diagnostics function blocks is full.
This bit is read-only.
EIO0000001714 10/2013 23
Differences
NOTE: Quantum Safety PLCs specific system bits usage is described in the Unity_Pro_XLS
Software Operating Modes Specifics guide.
24 EIO0000001714 10/2013
Differences
System Words
The following subsets of %SW system word (see Unity Pro, Program Languages and Structure,
Reference Manual ) are supported:
%SW11 watchdog duration Reads the duration of the watchdog. The duration is expressed in
WDGVALUE milliseconds (10...1500 ms).
This word cannot be modified.
NOTE: The duration range in Quantum Safety PLCs is: 20...990 ms.
%SW12 mode of application This word indicates the operating mode of the application processor.
APMODE processor Possible values are:
(for safety PLCs only) z 16#A501: application processor is in Maintenance Mode
z 16#5AFE: application processor is in Safety Mode
EIO0000001714 10/2013 25
Differences
This word is reset to 0 by the system on cold start, and also by the
program for re-usage purposes.
%SW18 absolute time counter %SW18 is the low and %SW19 the high word for calculating
%SW19 durations. Both are incremented every 1/10th of a second by the
100MSCOUNTER system (even when the PLC is in STOP, they are no longer
incremented if it is powered down). They can be read and written by
the user program or by the terminal.
%SW20 absolute time counter The low word %SW20 and the high word %SW21 are incremented
%SW21 every 1/1000th of a second by the system (even when the PLC is in
MSCOUNTER STOP, they are no longer incremented if it is powered down). They
can be read by the user program or by the terminal. %SW20 and
%SW21 are reset on a cold start, but not on a warm start.
%SW26 number of requests This system word allows to verify on server side the number of
processed requests processed by PLC per second.
NOTE: This system word is available only for Modicon M340 CPU.
%SW30 master task execution This word indicates the execution time of the last master task cycle
MASTCURRTIME time (in ms).
Note: In general %SW30 works, but keep in mind that a PC is much
faster as a PLC. For a short application a scan time less than 1ms
is possible, in such a case %SW30 remains at 0. %SW30 will not be
updated when an exception (division by 0, overflow, etc.) occurs
during execution of the user logic or after any user debug activity. If
an application throws an exception in each cycle, %SW30 will remain
at 0 and %SW31, %SW32 will remain at 32768 and 32767 from the
beginning.
%SW31 maximum master task This word indicates the longest master task execution time since the
MASTMAXTIME execution time last cold start (in ms).
26 EIO0000001714 10/2013
Differences
EIO0000001714 10/2013 27
Differences
28 EIO0000001714 10/2013
Differences
%SW75 Timer-type event counter This word contains the number of timer-type events in the queue.
TIMEREVTNB (1): Not available on the following processors: TSX 57 1•/2•/3•/4•/5•.
This word is not available on Quantum Safety PLCs.
%SW75 timer-type event counter This word contains the number of timer-type events in the queue.
TIMEREVTNB (not for safety PLCs)
%SW76 diagnostics function: Result of the last registration:
DLASTREG recording z = 0 if the recording was successful,
z = 1 if the diagnostics buffer has not been configured,
z = 2 if the diagnostics buffer is full.
EIO0000001714 10/2013 29
Differences
%SW96 command and diagnostic This word is used to copy or delete the current value of %MW to or
CMDDIAGSAVEREST of save and restore from internal flash memory and to give the action’s status. It can be
read by the user program or by the terminal:
z %SW96.0: Request to copy current value of %MW to internal Flash
memory. Set to 1 by the user to request a save, and set to 0 by
the system when a save is in progress.
NOTE: You must stop the processor before copying via %SW96.0.
30 EIO0000001714 10/2013
Differences
When the PLC is put in safety error state the content of %SW125 is
updated and can be read after the next restart of the PLC (see
below).
%SW125 last fault detected The code of the last fault detected is given in this word: The following
BLKERRTYPE error codes cause the PLC to stop if %S78 is set to 1. %S15, %S18
and %S20 are always activated independently of %S78:
z 16#0002: verification of PCMCIA signature fails,
z 16#2258: execution of HALT instruction,
z 16#2302: call to non supported system function in a user function
block,
z 16#9690: error of application CRC detected in background,
z 16#DE87: calculation error on floating-point numbers (%S18,
these errors are listed in the word %SW17),
z 16#DEB0: Watchdog overflow (%S11),
z 16#DEF0: division by 0 (%S18)
z 16#DEF1: character string transfer error (%S15),
z 16#DEF2: arithmetic error (%S18),
z 16#DEF3: index overflow (%S20).
Note: The codes 16#8xxx and 16#7xxx do not stop the application
and indicate an error on function blocks.
In case of a safety error, the PLC will stop. After power off and restart
of the PLC, %SW125 will contain the code of the cause of the error:
z 0x5AF1: Sequence check error (unpredictable execution in CPU)
z 0x5AF2: Error in memory (address fault)
z 0x5AF3: Comparison error (execution results of Intel and
application processor differ)
z 0x5AF4: Real-time clock failure
z 0x5AF5: Error initializing double code execution
z 0x5AF6: Watchdog activation error
z 0x5AF7: Error during memory check (takes more than 8 hours)
z 0x5AF8: Error in memory check (RAM failure)
EIO0000001714 10/2013 31
Differences
NOTE: Quantum Safety PLCs specific system words usage is described in the Unity_Pro_XLS
Software Operating Modes Specifics guide.
32 EIO0000001714 10/2013
Unity Pro
Menu Commands
EIO0000001714 10/2013
Chapter 3
Menu Commands and Dialog Boxes in the PLC Simulator
Overview
This chapter describes the menu commands and dialog boxes in the PLC simulator.
EIO0000001714 10/2013 33
Menu Commands
Simulator Control
Description
You can open and close the simulator dialog with
z the menu command Simulator Control in the context menu of the simulator symbol in the task
bar or the simulator symbol.
z a double click with the left mouse button on the simulator symbol in the task bar.
One of the following dialog boxes is opened or closed depending on the project loaded:
z Simulator Control for Unknown PLC, page 35
z Simulator Control for Quantum PLC, page 38
z Simulator Control for Quantum Safety PLC, page 41
z Simulator Control for Premium PLC, page 44
z Simulator Control for M340 PLC, page 46
34 EIO0000001714 10/2013
Menu Commands
Introduction
This dialog box is shown if the simulator does not know which PLC type should be simulated.
This is the case e.g.,
z directly after the simulator is started, before a project is loaded
z if the simulated PLC is in NOCONF state, i.e. a valid project is not loaded in the simulator
EIO0000001714 10/2013 35
Menu Commands
The second line shows the current state of the project and can contain the following texts:
Events
With this command button, you can open and close the event dialog box (see page 53).
The command button is shown if IO events are defined in the project currently loaded, i.e. if the
project uses event tasks.
Reset
With this command button, you can reset the simulated PLC (and the simulator). This corresponds
to a cold start of the PLC (the connection between the Unity Pro and simulator is broken, project
variables are reset).
This command button corresponds to the reset button on a real CPU.
Power Cycle
With the command button, you simulate a warm start of the PLC, i.e. the connection between
Unity pro and the simulator is broken, the current project variables remain and the simulator goes
into the state RUN (autostart active) or STOP (autostart deactivated).
This command button corresponds to the reset button of a Premium power supply or the
unplugging and plugging in of a power supply.
36 EIO0000001714 10/2013
Menu Commands
Host PC name
This text field shows the DNS name of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Host IP address
This text field shows the TCP/IP address of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Project name
This text field shows the name of the loaded project.
Clients connected
The list box shows current clients connected with the PC (PCs which are connected via TCP/IP
with the Host PC of the simulator, see also Creating a Connection, page 12). The DNS name and
TCP/IP address of its host PC are shown for each client.
EIO0000001714 10/2013 37
Menu Commands
Introduction
The dialog box is shown if the simulator is simulating a PLC from the Quantum family.
Representation of the dialog box
38 EIO0000001714 10/2013
Menu Commands
Key Switch
By clicking with the mouse on the switch symbol, various switch positions can be simulated.
Meaning of the switch positions:
Events
With this command button, you can open and close the event dialog box (see page 53).
The command button is shown if IO events are defined in the project currently loaded, i.e. if the
project uses event tasks.
Reset
With this command button, you can reset the simulated PLC (and the simulator). This corresponds
to a cold start of the PLC (the connection between Unity Pro, the simulator is broken, project
variables are reset and the simulator goes in RUN (if auto start is activated) or in STOP (if auto
start is deactivated)).
Reset corresponds to the reset button on a real CPU.
Power Cycle
With this command button, you execute a power cycle (power off/ power on) for the simulated PLC
(and the simulator). This corresponds to a warm start of the PLC (the connection between Unity
Pro and simulator is broken and the current project variables remain).
A power cycle corresponds to the unplugging and plugging in of a real power supply.
Host PC name
This text field shows the DNS name of the host PC for the simulator
If the PC has multiple network cards, only the first is shown.
EIO0000001714 10/2013 39
Menu Commands
Host IP address
This text field shows the TCP/IP address of the host PC for the simulator
If the PC has multiple network cards, only the first is shown.
Project name
This text field shows the name of the loaded project.
Clients connected
The list box shows current clients connected with the PC (PCs which are connected via TCP/IP
with the Host PC of the simulator, see also Creating a Connection, page 12). The DNS name and
TCP/IP address of its host PC are shown for each client.
40 EIO0000001714 10/2013
Menu Commands
Introduction
The dialog box is shown if the simulator is simulating a PLC from the Quantum safety family.
Representation of the dialog box
EIO0000001714 10/2013 41
Menu Commands
For further information on the different modes please refer to the Unity Pro XLS Software Specifics
manual.
Key Switch
By clicking with the mouse on the switch symbol, various switch positions can be simulated.
Meaning of the switch positions
42 EIO0000001714 10/2013
Menu Commands
Reset
With this command button, you can reset the simulated PLC (and the simulator). This corresponds
to a cold start of the PLC (the connection between the Unity Pro and simulator is broken, project
variables are reset).
This command button corresponds to the reset button on a real CPU.
Power Cycle
With the command button, you simulate a cold start of the PLC (since a safety PLC does not
support warm start), i.e. the connection between Unity Pro and the simulator is broken, the
simulator goes into the state RUN (autostart active) or STOP (autostart deactivated).
This command button corresponds to the unplugging and plugging in of a power supply.
Host PC name
This text field shows the DNS name of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Host IP address
This text field shows the TCP/IP address of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Project name
This text field shows the name of the loaded project.
Clients connected
The list box shows current clients connected with the PC (PCs which are connected via TCP/IP
with the Host PC of the simulator). The DNS name and TCP/IP address of its host PC are shown
for each client.
EIO0000001714 10/2013 43
Menu Commands
Introduction
The dialog box is shown if the simulator is simulating a PLC from the Premium family.
Representation of the dialog box
When data is being exchanged between Unity Pro and the simulator, the TER LED is flashing.
The LEDs CH0, CH1, CH2, CH3, I/O and FIP are no supported by the simulator.
44 EIO0000001714 10/2013
Menu Commands
Events
With this command button, you can open and close the event dialog box (see page 53).
The command button is shown if IO events are defined in the project currently loaded, i.e. if the
project uses event tasks.
Reset
With this command button, you can reset the simulated PLC (and the simulator). This corresponds
to a cold start of the PLC (the connection between Unity Pro, the simulator is broken, project
variables are reset and the simulator goes in RUN (if auto start is activated) or in STOP (if auto
start is deactivated)).
Reset corresponds to the reset button on a real CPU.
Power Cycle
With this command button, you execute a power cycle (power off/ power on) for the simulated PLC
(and the simulator). This corresponds to a warm start of the PLC (the connection between Unity
Pro and simulator is broken and the current project variables remain).
A power cycle corresponds to the reset button of a Premium power supply or the unplugging and
plugging in of a power supply.
Host PC name
This text field shows the DNS name of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Host IP address
This text field shows the TCP/IP address of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Project name
This text field shows the name of the loaded project.
Clients connected
The list box shows current clients connected with the PC (PCs which are connected via TCP/IP
with the Host PC of the simulator, see also Creating a Connection, page 12). The DNS name and
TCP/IP address of its host PC are shown for each client.
EIO0000001714 10/2013 45
Menu Commands
Introduction
The dialog box is shown if the simulator is simulating a PLC from the M340 family.
Representation of the dialog box
46 EIO0000001714 10/2013
Menu Commands
When data is being exchanged between Unity Pro (or other clients) and the simulator, the SER
COM LED is flashing.
The CARDERR LED is ON if a problem occurs during card access or if the memory card is
removed.
The LEDs I/O, CAN RUN, CAN ERR, ETH ACT, ETH STS and 10/100 are not supported by the
simulator.
CardAcc
The CardAcc LED is ON when the card is accessible.
Memory Card
The following features of a memory card can be simulated for the M340 PLC:
z files on the memory card generated by the data storage function blocks
z remove/insert memory card
z memory card full
z write protection
Reset
With this command button, you can reset the simulated PLC (and the simulator). This corresponds
to a cold start of the PLC (the connection between Unity Pro, the simulator is broken, project
variables are reset and the simulator goes in RUN (if auto start is activated) or in STOP (if auto
start is deactivated)).
Reset corresponds to the reset button on a real CPU.
Power Cycle
With this command button, you execute a power cycle (power off/ power on) for the simulated PLC
(and the simulator). This corresponds to a warm start of the PLC (the connection between Unity
Pro and simulator is broken and the current project variables remain).
A power cycle corresponds to the unplugging and plugging in of a power supply.
EIO0000001714 10/2013 47
Menu Commands
Host PC name
This text field shows the DNS name of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Host IP address
This text field shows the TCP/IP address of the host PC for the simulator.
If the PC has multiple network cards, only the first is shown.
Project name
This text field shows the name of the loaded project.
Clients connected
The list box shows current clients connected with the PC (PCs which are connected via TCP/IP
with the Host PC of the simulator, see also Creating a Connection, page 12). The DNS name and
TCP/IP address of its host PC are shown for each client.
48 EIO0000001714 10/2013
Menu Commands
Overview
The M340 PLC simulator panel displays a memory card in the bottom left corner of the virtual front
plate. See Simulator Control for M340 PLC, page 46.
The memory card is inserted by default after the startup of the PLC Simulator.
No Backup/Restore
On a real M340 PLC the memory card is separated in 2 parts:
z a part for the OS, where the application is stored persistent (backup/restore mechanism)
z a part for the application, where the application can store data by using data storage function
blocks
NOTE: The simulator does not simulate the backup/restore part of the memory card.
EIO0000001714 10/2013 49
Menu Commands
NOTE: There will be no tracking of the size and the number of the files written into the memory
card.
Step Action
1 Set the system bit %S65 (CARDIS).
Result: After a potential card access has finished the CardAcc LED goes out.
2 Open the context menu by clicking on the memory card with the right mouse
button.
3 Select Remove Memory Card....
Result: The virtual front plate shows an empty memory card slot and the
CARDERR LED is on.
NOTE: Removing the memory card has no influence on the used directory and the files, but the
access to the files is disabled inside the simulator.
50 EIO0000001714 10/2013
Menu Commands
Step Action
1 Open the context menu by clicking on the memory card with the right mouse
button.
2 Select Insert Memory Card....
Result: A Windows standard file selection dialog opens. The selection is pre-
initialized with the last used memory card directory.
Note: The file selection box also has a Write protected checkbox to insert a write
protected virtual memory card.
3 Proceed with one of the 2 following possibilities:
z Use the pre-initalized directory.
Result: The last removed memory card is inserted.
z Select another directory.
Result: Another memory card (e.g. different in content or empty) is inserted.
Result: The CARDERR LED goes off.
4 Reset the system bit %S65 (CARDIS).
Result: The virtual front plate shows a memory card and the CardAcc LED goes
on.
Since a directory and its content represent the memory card, exchanging the content of the
directory can simulate the exchange of a memory card. This can be done my normal Windows
means (cut/copy/paste of files or renaming/moving folders).
EIO0000001714 10/2013 51
Menu Commands
Write Protection
By default the memory card is not write protected at simulator start.
At any time it is possible to simulate that the memory card is write protected.
This is done by opening the context menu (clicking on the memory card with the right mouse
button) and checking the menu item Write Protection.
After this menu item is checked
z data writing is not possible
z read accesses are possible
NOTE: It is not possible to access the files via an FTP client through the simulator, since the files
are directly accessible by Windows features.
52 EIO0000001714 10/2013
Menu Commands
Event Dialog
Introduction
You can open and close the event dialog with
z the menu command Event dialog in the context menu of the simulator symbol in the task bar
or the simulator symbol
z the command button Events in the simulator dialog (only open)
Selection Condition
The menu command and the command button are enabled if IO events are defined in the project
currently loaded, i.e. if the project uses event tasks.
Representation
Event dialog:
EVT0 Event
Possible events for the EVT0 task are shown here. This user task has the highest priority in the
system and can only contain one IO event.
If this task is part of the project, the event command button is enabled.
EVTi IO Event
Possible events for the EVTi IO task are shown here. This user task can process up to 96 events.
The maximum number of tasks depends on the PLC simulated.
The event command buttons are enabled according to the number of events defined in the project.
EIO0000001714 10/2013 53
Menu Commands
Clear
Introduction
With Clear, you can remove the currently loaded project from the simulator memory and put the
simulated PLC (and the simulator) into NOCONF status.
This corresponds to a cold start of the PLC without valid project loaded (the connection between
Unity Pro and the simulator is broken).
You can execute Clear with the menu command Clear in the context menu of the simulator symbol
in the task bar.
54 EIO0000001714 10/2013
Menu Commands
Reset
Introduction
With Reset, you can reset the simulated PLC (and the simulator). This corresponds to a cold start
of the PLC (the connection between Unity Pro, the simulator is broken, project variables are reset
and the simulator goes in RUN (if auto start is activated) or in STOP (if auto start is deactivated)).
Reset corresponds to the reset button on a real CPU.
You can execute reset with
z the menu command Reset in the context menu of the simulator symbol in the task bar or the
simulator symbol
z the command button Reset in the simulator dialog.
NOTE: %S0 is not set to 1 using Reset with the PLC simulator (in contrast to a real PLC).
EIO0000001714 10/2013 55
Menu Commands
Power Cycle
Introduction
With Power Cycle, you execute a power cycle (power off/ power on) for the simulated PLC (and
the simulator). This corresponds to a warm start of the PLC (the connection between Unity Pro and
simulator is broken and the current project variables remain).
A power cycle corresponds to the reset button of a Premium power supply or the unplugging and
plugging in of a power supply.
You can execute a power cycle with
z the menu command Power Cycle in the context menu of the simulator symbol in the task bar
or the simulator symbol
z the command button Power Cycle in the simulator dialog
NOTE: In case of a safety PLC, power cycle simulates a cold start. Project variables are reset.
56 EIO0000001714 10/2013
Menu Commands
Options
Description
In this dialog box, you can define special settings for the simulator.
You can open the dialog with the menu command Options in the context menu of the simulator
symbol in the task bar or the simulator symbol.
Representation
Options
Always on Top
If you activate this check box, the simulator control window is always on top of other dialog boxes
and windows.
Tone
If you activate this check box, the simulator plays a tone in the following situations
z starting and exiting the simulator
z error in project
EIO0000001714 10/2013 57
Menu Commands
Timing (simulator)
Description
With this menu command, you can open and close the timing dialog box. This dialog box shows
simulator statistics for CPU use, process priority and user scan time. Additionally, you can change
the priority and the sleep time in this dialog box, to optimize simulator timing and adjust the PC
load.
Representation of the dialog box
58 EIO0000001714 10/2013
Menu Commands
Processor Load
Introduction
The processor load (on the PC) caused by the entire simulation and the individual user tasks is
shown here.
Process
This bar graph shows the actual processor load caused by the simulator process in percent.
Unlike the display in the Windows task manager which only indicates the current value, this bar
graph indicates the average value over the time shown at the end of the bar graph.
The time entry at the end of the bar graph is the time that has passed since the simulator was
started or since the last time reset was pressed.
Overhead
This bar graph shows the average processor load caused by the simulator process overhead in
percent.
The overhead is calculated as follows:
load caused by the entire process - load caused by the user tasks
This can be an absolute or relative value for the processor load caused by the simulator. This
setting can be made in the Display area.
The time entry at the end of the bar graph is the time that has passed since the simulator was
started or since the last time Reset was pressed.
Display: Absolute
If you activate this option button, the actual value is shown in the bar graph. This is shown as a
percentage of the entire processor load for the PC.
EIO0000001714 10/2013 59
Menu Commands
Display: Relative
If you activate this option button, the relative processor load is shown in the bar graph. This is
shown as a percentage of the processor load caused by the simulator.
Reset
If you press this command button, time measurements in this area are reset.
This is required to achieve a consistent representation of the times which have passed because
the individual times are not started simultaneously when opening the simulator.
60 EIO0000001714 10/2013
Menu Commands
Introduction
In this area, you can define the priority of the simulator process.
It may be necessary to assign a high priority to the simulator because the cycle times of the
individual user tasks can deviate greatly if there is a heavy load on the PC. These deviations are
directly caused by the Windows operating system and can reach 100 ms with Normal priority. In
most cases, the watchdog timer is also affected. In this case, setting the simulator priority higher
can prevent the watchdog from being triggered.
Real-time
In this priority, user task cycle times only deviate by a few milliseconds.
NOTE: This priority should be used with care because the simulator has the highest possible
priority in this case and interrupts the Windows system. If you use this priority with a very small
sleep time and a cyclic user task, the PC may cease proper operation.
High
In this priority, user task cycle times normally do not deviate by more than 10 ms.
Normal
In this priority, user task cycle times can deviate up to several 100 ms.
Low
This priority quickly causes the watchdog to be triggered and should only be used on a PC with
nearly no load.
Apply
If you press this command button, settings in this area are applied and used immediately.
EIO0000001714 10/2013 61
Menu Commands
Introduction
2 histograms are shown in this area
z the cycle time histogram for the selected user task
z the sleep time histogram for the selected user task
Cycle time
This histogram shows the relative frequency of cycle time values in the user task currently
selected. See also Minimal Sample Time, page 63
The counter to the left under the histogram counts the number of cycles in RUN mode represented
in this histogram.
Sleep time
This histogram shows the relative frequency of sleep time values in the user task currently
selected. See also Minimal Sample Time, page 63
For cycle tasks, normally a single value is shown with 100 %. This is the minimum sleep time for
user tasks. If you change the value for the minimum sample time, a second peak is created for the
new value.
User tasks cycles are included in this histogram (regardless of the PLC mode).
Cycle Counter
The counter to the left under the histogram counts the number of cycles in RUN mode represented
in the cycle time histogram.
This counter has no meaning for the sleep time histogram because cycles are included there
(regardless of the PLC mode).
Reset
If you press this command button, the histograms for the user task currently selected is reset and
a new statistic is started.
62 EIO0000001714 10/2013
Menu Commands
Description
The simulator is not the only thing running on the PC, therefore the other programs must be given
a chance to be executed. Therefore the user task is assigned a fixed sample time.
The sample time is calculated according to the following formula:
Sample Time = Cycle Time + Sleep Time.
Time of the user task
Legend
Time Meaning
Sample time Time which is made available for running the user task.
Cycle time Time which is actually required for running the user task.
Sleep time Time in which the other programs on the PC can be executed.
NOTICE
LOSS OF PC OPERATION
Do not use a small sample time when selected in combination with a high simulator priority and
cyclic user tasks.
Failure to follow these instructions can result in equipment damage.
Apply
If you press this command button, the minimum sample time is applied to the selected user task
and used immediately.
EIO0000001714 10/2013 63
Menu Commands
Info
Description
With this menu command, you can open and close the info dialog box. This dialog box shows the
current version of the simulator and its components.
64 EIO0000001714 10/2013
Menu Commands
Help
Description
With this menu command, you can open the online help for the simulator.
EIO0000001714 10/2013 65
Menu Commands
Description
With this menu command, you can exit the simulator.
66 EIO0000001714 10/2013
Unity Pro
Index
EIO0000001714 10/2013
Index
D
dialog boxes, 33
M
menu commands, 33
S
simulating a PLC, 9
simulation, 9
EIO0000001714 10/2013 67
Index
68 EIO0000001714 10/2013