Creating simulation template project

Creating and adding a new simulation PLC is done via selection and activating the Contextmenu entry "Create Simulation PLC-Project" of the PLC runtime that is intended to be simulated in the configuration navigation tree (see Figure 1).

Within the now appearing Dialog, the Simulation PLC runtime must be selected (Figure 2). This dialog shows the currently available target systems. If the designated simulation system is not in the tree, it can be added via the "Search" button. With leaving the dialog over "OK" the TwinCAT Simulation Manager generates a simulation framework for the selected PLC, assigns it to the specified target system and runtime and adds it to the TwinCAT Simulation Manager configuration project.

This PLC framework project will contain all located IO-Symbols of the original PLC project in reversed/mirrored allocation (inputs --> outputs and outputs --> inputs, see Table 1).

Creating simulation template project 1:
Figure 1: Creation of a Simulation PLC Project via Context menu
Creating simulation template project 2:
Figure 2: Selection of the PLC target sytem

A template PLC project can be created via the menu item 'Edit' --> 'Generate simulation PLC project'. This template is created from the currently integrated original PLC projects. The following components of the original project(s) are considered and possibly adopted in the simulation PLC project.

 

Original PLC symbol

Device I/O

Signal direction

Simulation PLC symbol

Description

1

VAR_INPUT
Allocation (%I)

Input

<--

VAR_OUTPUT (%O)

A device delivers a signal to the PLC, e.g. an "On" switch. In the simulation mode, the simulation PLC delivers the switch position via an output symbol to the original PLC.

2

VAR_OUTPUT
Allocation %Q

Output

-->

VAR_INPUT (%I)

A block output signal is transmitted to a device, e.g. a 'bRunning' flag to a light

3

VAR_INPUT
Allocation %Q

Output

-->

VAR_OUTPUT (%I)

The symbol specifies the interface to a device input. The block is not usually filled with code

4

VAR_OUTPUT
Allocation %I

Input

<--

VAR_INPUT (% Q)

The symbol specifies the interface to a device output. The block is not usually filled with code

Table 1: Generation rules for "reverse" or "mirrored" symbolic

Creating simulation template project 3:
Figure 3: Case 1 and 2 (original mode)

Creating simulation template project 4: Figure 4: Case 1 and 2 (simulated)

Restrictions:

The next step is to fill the empty shell of the simulation project with simulation code. This is specific to the application. For this task PLC Control Application can be opened via context menu "Open PlcControl ...".

In the simulation mode, the original symbols with their correspondences are connected in the simulation PLC.