First steps
Prerequisites:
- The Original (to be simulated) PLCs projects are ready and the system manager configuration has been created and is activated on the target.
- The PLC projects used should contain the TcSimMan.lib for simulation purposes.
- At minimum one PLC must be free on the local system (local simulation) or on a remote system (distributed simulation).
- All used target systems (local or remote) must have a valid configuration activated.
- The PLC runtimes must contain the Symbol description files
- PLC runtimes must be configured as boot project
see also Requirements for Simulation configurations.
Creation of new TwinCAT Simulation Manager project
Select "File --> New" in the main menu (see Picture 1)
An "Open new Project" dialog appears and a valid Project name and Location path must be inserted. Press "OK" (see Picture 2).
After selecting "OK" the TwinCAT Simulation Manager creates an project folder and project file.
To create a simulation environment the next necessary step will be to select the target systems where the original (to be simulated) projects and configurations exist. For that please activate "Edit --> Select target Systems ..." in the main menu (see Picture 3). As reaction the "Add original Systems" Dialog opens (Picture 4). The dialog shows all TwinCAT target systems that are found within the connected subnetworks.
Within this dialog select all systems that are intended to be simulated and add it to the right-hand-side List (Push-Button ">>"). With pressing "OK", the TwinCAT Simulation Manager adds these systems to its own simulation project configuration. If any target system is not assigned to the actual routes of the local system, the TwinCAT simulation manager asks to add this route. If the access to the target systems is possible the actual configuration will be downloaded and cached locally. The same happens for all PLC symbol information (*.tsm files) that are active on the targets.
If all necessary information is found and the data is downloaded successfully the TwinCAT Simulation Manager shows all selected systems within its configuration navigation tree (Picture 5).
Creating a new simulation PLC
Up to now, the TwinCAT Simulation Manager only contains the original systems - the ones that must be simulated. Creating and adding a new simulation PLC is done as follows:
- Select the PLC runtime that is intended to be simulated within the Configuration navigation tree (see Picture 5)
- Activate "Create Simulation PLC-Project" from the context menu.
- Within the now appearing Dialog, the Simulation PLC runtime must be selected (Picture 6). 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.
The PLC framework project will contain all located IO-Symbols (see Picture 7) of the original PLC project in reversed/mirrored allocation (inputs --> outputs and outputs --> inputs) and is ready to fill with simulation code. 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 ...".
As the Picture 7 shows, the TwinCAT Simulation Manager code generator generates synonymous symbols with the same name originating from the original project within the simulation project. The TwinCAT Simulation Manager will take advantage of this during computing the default mappings (connecting Original to Simulation symbols) later on.
Inserting an existing Simulation PLC Project
Inserting an existing simulation project can be done as follows.
- Adding the target system to the list of project systems with calling "Edit -> Select target systems" within the main menu (Picture 3 and Picture 4).
- Calling "Edit->PLC project mappings" within the main menu (Picture 8)
- Assignment of the Simulation project to it's appropriate original PLC project (Picture 9).
Configuration of the simulation mode
The project state is now as follows:
The original and simulation target systems are designated and at least the interfaces of the simulation functionality generated. For supporting not existing hardware, the simulation settings must be adjusted. That means:
- Disabling of nonexistent Devices
- Simulation of non-existing Axes and Drives
- Replacing of IO functionality by the simulation PLC
The devices will be disabled like shown in Picture 10 and Picture 11. The red 'S' marks the hardware that is deactivated in simulation mode.
The simulation of Axes will be configured via the Context Menu within the Axis list view (Picture 12).
Finally, the created or added simulation PLC projects must be bound to the orginal PLCs. There are two options to do this task:
- Manually adjustment Symbol by Symbol or
- Using a default mapping algorithm
The manual configuration works simply be clicking the checkboxes (or context menu) on the appropriate symbols (see Picture 13) within the mapping targets view (upper right-hand-side list box). Dependent of the selection of the symbol in the left-hand-side "Configuration" navigation tree the mapping targets view collects all "Original" or "Simulation" symbols with the same datatype within its list. Potentially every single symbol of these target symbols can be bound to the source symbol.
The automatic configuration happens if "Create Default Mappings" is activated from the "Edit" main menu of the TwinCAT Simulation Manager (Picture 14). This functionality iterates over all Symbols within the original PLC projects and binds it to simulation symbols of the same symbolic name / access path, same datatype but reversed location (see Picture 15). This should be the default option because it ends up with a good standard configuration that can be fine tuned manually afterwards.
Switching the Simlation-Machine-Modes (Original <--> SImulation)
If the configuration of the Simulation project is complete, the the mode of the system can be switched to Simulation Mode and back by simple Activation over the Main Menue "Edit --> SimulationMode" or the Simulation Symbol within the TwinCAT Simulation Manager ControlBar.
Because the switchover process includes several steps that usually need (safety) confirmation(s), the TwinCAT Simulation Manager volunteers the User by an intelligent Machine configuration wizard step by step.
The descriptions of this wizard and the specifics of the machine reconfiguration and restarting can be found here:
Resetting the simulation settings
The Simulation settings can be removed from the main menu "Edit--> Reset Simulation Settings ..."