SIMATIC S7-PLCSIM Advanced V1.0 Simulation with TIA Portal V14 and PLCSIM Advanced Restricted © Siemens AG 2016
siemens.com/tia-portal
Simulation What solutions does Siemens offer?
Requirement
Mapping of the controller functionality in a model
Siemens solution PLCSIM V14 PLCSIM Advanced V1.0
Mechatronics Concept Designer
Mapping of the plant/machine in a model
Process Simulate SIMIT Target 1500S ™ for SIMULINK ®
Restricted © Siemens AG 2016 Page 2
March 2016
NEW
PLCSIM Advanced to create virtual controllers PLCSIMsystem Advanced Simulation Virtual controller
1) With SIMATIC S7-PLCSIM Advanced, virtual controllers can be used for simulation of S7-1500 and ET 200SP CPUs and for comprehensive function simulation. API
2) The virtual controllers can also be tested and validated in in the context of a plant/machine. à To connect to a plant/machine simulation = co-simulation an API is available.
Virtual plant/machine
Plant/Machine simulation = Co-simulation Restricted © Siemens AG 2016 Page 3
March 2016
PLCSIM Advanced Basis for software in the loop Virtual world
S7-1500 hardware controller
PLCSIM Advanced Virtual S7-1500 controller
Controller
Real world
as basis for "Software in the Loop"
Process
API
Co-simulation
Restricted © Siemens AG 2016 Page 4
PLCSIM Advanced
March 2016
§ Extensive function simulation without adapting the STEP 7 program § Interface for a connection to different co-simulations via API
PLCSIM Advanced Supported controllers: S7-1500 CPU incl. C/F/T and ET200SP CPU incl. F
Virtual controller
S7-1500
S7-1500C
S7-1500T(F)
Mapping of the real controller
S7-1500F
Restricted © Siemens AG 2016 Page 5
March 2016
ET 200SP(F) CPU
PLCSIM vs. PLCSIM Advanced What are the differences in the functionality? Real world
Virtual world
Real controller Simulation of the logic of the controller program
Simulation of the controller in the context of the plant / machine
IO simulation
IO simulation
Button/ Simulator LEDs
PLCSIM operator panel
Real controller
PLCSIM Advanced NEW
Prototype/ Real plant
Restricted © Siemens AG 2016 Page 6
PLCSIM
March 2016
Co-simulation
PLCSIM vs. PLCSIM Advanced What are the differences in the functionality? S7-1200 (F)/ S7-1500 (F/T)
/
PLCSIM
/
PLCSIM Advanced
API up to 2
Multiple instances
up to 16
Distributed instances OPC UA Web server Process diagnostics
Integrated controller simulation in STEP 7 in TIA Portal Use case: •
(
)
Traces
(
)
Motion
via softbus
S7 communication
via softbus
Open User communication
Applications: •
Functional test of the STEP 7 program – also in the context of a plant/machine
•
Operator training
•
Virtual commissioning / Factory Acceptance Test (FAT)
know how protected blocks
Functional test and validation of the STEP 7 program
Virtual time Connection of real PLCs/HMIs DNS use
Restricted © Siemens AG 2016 Page 7
Virtual S7-1500 controller
March 2016
Virtual memory card
PLCSIM Advanced Multiple and distributed instances
Various configurations are supported: § Support of multiple instances; recommendation:
PC1
S7-1500 Instance 1
S7-1500 Instance 2
WinCC Panel PC clock
§ 4 GB RAM for one instance § 4 instances on a PC with 8 GB RAM (16 instances can technically be started) § Support of distributed instances PC2
§ for load distribution
S7-1500 Instance 3
§ communication via TCP/IP
PC clock
§ Connection of real devices (HMIs / controllers) is possible Virtual time
§ connection of real I/Os is not possible Slow
Restricted © Siemens AG 2016 Page 8
March 2016
STEP 7
Virtual time
Fast
PLCSIM Advanced Multiple instances in combination with a co-simulation
Various configurations are supported:
PC1
§ Support of multiple instances in combination with a co-simulation
S7-1500 Instance 1
S7-1500 Instance 2
software in the loop
PC clock
§ Connection of PLCSIM Advanced instances with co-simulation via virtual time PC2
Co-simulation
STEP 7
Virtual time Slow
Restricted © Siemens AG 2016 Page 9
March 2016
Virtual time
Fast
PLCSIM Advanced Virtual time – what does it mean and how can it be used?
Two types of clocks are used for the simulation:
OB 1
OB 1
§ Virtual clock: Basis for the user program;
Cycle control point
à Duration between two cycle control points is measured in virtual time § Real clock: Communication with STEP 7
Internal process image of the virtual controller read IOs
write IOs API
How can the virtual time be used? § Gradual debugging of the STEP 7 program; the virtual controller can be stopped (freeze state) at the cycle control point, which is at the end of a OB1 call, and I/Os can be read or manipulated à The freeze state is also used for synchronization with the simulation partners.
Restricted © Siemens AG 2016 Page 10
March 2016
à A freeze state stops the virtual controller at a cycle control point: § Virtual time is stopped § No OBs are running, no timers § User program is not executed any longer § Virtual controller is in a state with consistent input and output data
PLCSIM Advanced How can the virtual time be used? § Manipulation of the virtual time Virtual time
§ Slow motion (scaling factor < 1): e.g. scaling factor 0.5 = virtual time is slowed down by 50% à Cyclic OBs are called less frequently during a OB1 cycle § Fast mode (scaling factor > 1):
Slow motion 0.01
Virtual time
Slow motion OB 1
OB 1
e.g. scaling factor 2 = virtual time runs twice as fast à Cyclic OBs are called more frequently during a OB1 cycle Note: OB1 always runs at the same speed and only depends on the performance of the PC à if you change the scaling factor, more or fewer cycle control points are reached within a fixed time period
Cycle control point Fast mode OB 1
OB 1
Cycle control point Cyclic OB
Restricted © Siemens AG 2016 Page 11
March 2016
Fast mode 100
PLCSIM Advanced Connection with a co-simulation (1) Planning and configuring Automation with TIA Portal
Result
Test in virtual environment
STEP 7 program
PLCSIM Advanced virtual controller
Signal connection via API Hardware configuration (incl. signal list)
Co-simulation • Definition of kinematics
• Sequence planning (sequences)
Mechanical design with CAD CAD model
• Motion relations and profiles • Simulation of kinematics
• Definition of sensors and actuators
Restricted © Siemens AG 2016 Page 12
March 2016
software in the loop
PLCSIM Advanced Connection with a co-simulation Planning and configuring Automation with TIA Portal
Result
Test in virtual environment
STEP 7 program
PLCSIM Advanced virtual controller
Signal connection via API Hardware configuration (incl. signal list)
Plant/machine simulation in C++ / C# • Sequence planning (sequences) • Motion relations and profiles
Plant/machine know-how
Restricted © Siemens AG 2016 Page 13
March 2016
• Definition of sensors and actuators
C++ / C#
software in the loop
PLCSIM Advanced Benefits of a virtual controller
Engineering
Commissioning
Production
• Realistic function test of the STEP 7 program • Early error detection and validation of the functionality à High quality of the STEP 7 program code • No real S7-CPU hardware required à Savings in hardware costs
• Test of the STEP 7 program in combination with a plant/machine simulation prior to commissioning à High quality of the automation project à Reduction in time-toproduction
• Early training of the operator is possible (Operator training) • Increased efficiency thanks to optimization of program parts • Quick replacement of machine components (migration) / quick expansion of existing plants
High engineering quality
High project quality
High productivity
Restricted © Siemens AG 2016 Page 14
March 2016
PLCSIM Advanced as basis for "Software in the Loop"
PLCSIM Advanced Benefits of virtual commissioning
Conventional commissioning
With virtual commis sioning
Concept
Planning and configuring
Operation
Time at the customer plant
Time in the office
Concept
Planning and configuring + Create a model of the plant
Virtual commiss ioning
Restricted © Siemens AG 2016 March 2016
Com missi oning
Operation
Time at the customer plant
Time in the office
Create a model of the plant = effort
Page 15
Commissioning
Reduced commissioning time at the customer plant
Quick Time-to-Production
PLCSIM Advanced Licensing concept and list price
Licensing concept: Instance 1
Instance 2
Instance 3
• Floating license • Enterprise License (EPL) à One license per instance
List price per instance: • €2.500 (download) • €2.750 (DVD) Download available in SIOS from CW16 on: https://support.industry.siemens.com/cs/de/en/view/109745647 Restricted © Siemens AG 2016 Page 16
March 2016
Requirements and restrictions Restricted © Siemens AG 2016
siemens.com/tia-portal
PLCSIM Advanced Basic knowledge required
Knowledge of the following is considered essential:
STEP 7 program
§ Industrial automation and automation technology § Programming with STEP 7 (TIA Portal) § SIMATIC PLCs (S7-1500 & ET200SP PLC) § Development of software in C++ and C# with MS Visual Studio 2015 (WPF and MVVM recommended)
C++ / C#
OR Co-simulation software like MCD V12 and Matlab/ SIMULINK § PC technology / Windows operating system
Restricted © Siemens AG 2016 Page 18
March 2016
Co-simulation
PLCSIM Advanced Basic knowledge required – Data exchange PLCSIM Adv. Instance 1
PII Prg
C
PIO
A
MVVM
B
A B C
Restricted © Siemens AG 2016 Page 19
March 2016
PLCSIM Advanced Basic knowledge required – WPF and MVVM Model View ViewModel
Restricted © Siemens AG 2016 Page 20
March 2016
PLCSIM Advanced Basic knowledge required – WPF and MVVM Model View ViewModel
Restricted © Siemens AG 2016 Page 21
March 2016
PLCSIM Advanced Basic knowledge required – WPF and MVVM Model View ViewModel
Restricted © Siemens AG 2016 Page 22
March 2016
PLCSIM Advanced Hardware/software requirements + supported virtualization platforms
Hardware / software
Minimum requirement
Processor
2.2 GHz Intel Celeron Dual Core
RAM
4 GB for one instance 8 GB for 4 instances
Free hard disk space
5 GB
Operating system (64-bit)
Windows 7 Home Premium SP1 Windows 7 Professional SP1 Windows 7 Enterprise SP1 Windows 7 Ultimate SP1 Windows Server 2012 R2 StdE
Screen resolution
Restricted © Siemens AG 2016 Page 23
March 2016
1024 x 768
Supported virtualization platforms: § VMware vSphere Hypervisor (ESXi) 6.0 § VMWare Workstation 12 Pro § VMware Workstation Player 12 § Microsoft Windows Server 2010 R2 Hyper-V
Specific constraints § S7-PLCSIM Advanced and S7-PLCSIM cannot be installed on the same PC. § Not real-time capable / deterministic à program cannot be evaluated based on the time results of the simulation § No support of bus systems (PROFINET IO, PROFIBUS DP, rear panel bus) § The user interface (API) does not offer authentication and authorization options § No support of security mechanisms for Web server (HTTPS) and for OPC UA (certificates) § The simulation communication across computers is not encrypted. à We recommend using a separated simulation network that is not connected to a productive network. § Integrated I/O modules within the compact PLCs as well as the configured I/O modules are not simulated. § The ODK functionality of the 1517 and 1518 CPUs is not simulated. § No support of S7-1200, ET 200pro (F), ET 200SP CPU Open Controller, Software Controller § No simulation of alarms, recipes, data logging, "backup and restore" of PLCs
Restricted © Siemens AG 2016 Page 24
March 2016
Simulation with PLCSIM Advanced V1.0 in TIA Portal V14 Restricted © Siemens AG 2016
siemens.com/tia-portal
PLCSIM Advanced How to simulate with PLCSIM Advanced within TIA Portal
To use a STEP 7 project with PLCSIM Advanced, the ability to simulate the blocks must first be enabled in the project properties in the Protection tab. 2
1
3
Restricted © Siemens AG 2016 Page 26
March 2016
Compiling the project activates the ability to simulate the blocks à If the project already includes know-how protected blocks, these must be unlocked by entering a password and then these blocks need to be compiled individually.
PLCSIM Advanced Checking the ability to simulate specific blocks
The ability to simulate specific blocks can be checked by means of the block properties under "Compilation". (display field – no input field!)
Restricted © Siemens AG 2016 Page 27
March 2016
PLCSIM Advanced Handling blocks from libraries
Handling of blocks from existing libraries: blocks which have been stored in the library without simulation support:
1 Blocks must be edited / set to "in test"
2 By compiling the blocks again, the check mark for the ability to be simulated is set; a new type of the block must be published in the library
Restricted © Siemens AG 2016 Page 28
March 2016
PLCSIM Advanced V1.0 Control Panel Restricted © Siemens AG 2016
siemens.com/tia-portal
PLCSIM Advanced Control Panel for the PLCSIM Adv. Instance Management
Tray icon in the taskbar § Right-click starts the Control Panel of PLCSIM Advanced
Notes: The Control Panel is optional and is not required for operation of PLCSIM Advanced via the API. The Control Panel is available in English in version V1.0.
Restricted © Siemens AG 2016 Page 30
March 2016
PLCSIM Advanced Control Panel Setting of the communication interface
Selecting the communication interface •
PLCSIM à Softbus
•
PLCSIM Virtual Eth. Adapter à TCP/IP
Softbus
PLCSIM Virtual Ethernet Adapter
§ The communication between different instances is limited to a local PC.
§ Multiple instances can communicate with each other over distributed computers.
§ STEP 7 needs to be installed on the same computer.
§ STEP 7 can be installed on another computer.
§ OPC UA and Web server communication are not supported.
§ OPC UA and Web server communication are supported.
§ Real PLCs / real HMIs cannot be connected.
§ Real T block communication
§ Simulated T block communication Restricted © Siemens AG 2016 Page 31
March 2016
§ Real PLCs/ real HMIs can be connected.
PLCSIM Advanced Control Panel Setting of the communication interface and the virtual time
Selecting the network adapter for distributed communication
disables the PLCSIM virtual switch and disconnects the instances from the real network = local TCP/IP communication.
Setting of the virtual time: § 100 = 100x faster than PC clock § 0.01 = 100x slower than PC clock
Restricted © Siemens AG 2016 Page 32
March 2016
PLCSIM Advanced Control Panel Creating virtual controllers (PLCSIM Softbus)
Creating the virtual controllers; definition of •
Instance name; when the name already exists in the directory of the Virtual SIMATIC Memory Card, this existing instance is started.
•
PLC type (unspecified 1500/ET200SP PLC)
Visual feedback regarding the status of the instances •
Up to 16 instances can be started
•
Acitvation and deactivation of individual instances is possible
Restricted © Siemens AG 2016 Page 33
March 2016
PLCSIM Advanced Control Panel Creating virtual controllers (PLCSIM Virtual Eth. Adapter – TCP/IP) Creating the virtual controllers; definition of •
Instance name; when the name already exists in the directory of the Virtual SIMATIC Memory Card, this existing instance is started
•
IP address; each virtual PLC needs a unique IP address
•
Subnet mask
•
PLC type (unspecified 1500/ET200SP CPU)
Visual feedback regarding the status of the instances •
Up to 16 instances can be started
•
Enabling and disabling of individual instances is possible
Restricted © Siemens AG 2016 Page 34
March 2016
PLCSIM Advanced Control Panel Settings Activation and setting of the Runtime Manager Port for distributed instances Is saved and therefore identical after a restart. Storage location of the SIMATIC Memory Card data of the virtual PLCs The STEP 7 user program, the hardware configuration and the retentive data are saved on the virtual SIMATIC Memory Card. Setting of Balloon Messages Link to the manual Exit Control Panel All local instances are closed. Restricted © Siemens AG 2016 Page 35
March 2016
PLCSIM Advanced V1.0 Communication & Download Restricted © Siemens AG 2016
siemens.com/tia-portal
PLCSIM Advanced Operating principle of virtual switch and virtual network adapter
PLCSIM Advanced installs a virtual network adapter and a virtual switch
PC 2
à Connection to the real world is established by means of the virtual switch
PLCSIM Adv. Instance 1
Virtual network adapter with own IP address
PC 1
PLCSIM Adv. Instance 1 on PC 2 can be loaded by means of its IP 10.11.7.20 from the TIA Portal
IP: 10.11.7.20
TIA Portal Virtual adapter IP: 10.11.7.12
Virtual switch connects virtual adapter with real network adapter
Virtual switch
Network adapter
Network adapter
IP: 10.11.7.11
IP: 10.11.7.10
Network Restricted © Siemens AG 2016 Page 37
March 2016
Communication takes place via real network adapter
PLCSIM Advanced Distributed operation – Virtual Switch To use the PLCSIM Virtual Switch across multiple computers, it must be enabled in a real network adapter via: § Control panel § System control Note: You have to ensure that the PLCSIM Virtual Switch is enabled in only one network adapter (if a computer has more than one network adapter). à In the project tree, all stations are shown which can be accessed by means of the Virtual Ethernet Adapter.
Restricted © Siemens AG 2016 Page 38
March 2016
PLCSIM Advanced Distributed operation – Download from TIA Portal When PLCSIM Virtual Switch is enabled for a real network adapter (TIA Portal and PLCSIM Advanced are located on different computers)
Restricted © Siemens AG 2016 Page 39
March 2016
Download directly via Virtual Ethernet Adapter (TIA Portal and PLCSIM Advanced are located on the same computer)
PLCSIM Advanced V1.0 API Restricted © Siemens AG 2016
siemens.com/tia-portal
PLCSIM Advanced Access to instances via the Control Panel and the API
Through the Control Panel you can only access an instance that is available on the local PC. 1 In case of distributed communication, the Runtime API accesses the instance of the other PC with the Runtime Manager. 2
PC 1
PC 2
Control Panel
Control Panel
Runtime API
Runtime API
1
2
The Runtime Manager Port can be set in the Control Panel of the respective PC (also possible directly via API)
Restricted © Siemens AG 2016 Page 41
March 2016
2
Runtime Manager
Runtime Manager
Runtime instance 1
Runtime instance 1
Virtual 1500 CPU
Virtual 1500 CPU
PLCSIM Advanced API interface
§ API offers methods for: § Access to PLC data
Simulation Runtime
(I/Os, bit memories, DBs, timers)
à Comprehensive functionality for C++/C# programming with Visual Studio à Co-simulations can connect to the Runtime Manager by means of the provided API interface
Restricted © Siemens AG 2016 Page 42
March 2016
Co-simulation 1 Runtime Manager
Runtime instance 1
Runtime instance 2
Virtual 1500 CPU
Virtual 1500 CPU
Runtime API
§ Configuring and controlling PLCSIM Advanced instances
Co-simulation 2
PLCSIM Advanced Code example Register instance at the SimulationRuntimeManager: IInstance myInstance = SimulationRuntimeManager.RegisterInstance("MyVirtualController"); Start PLCSIM instance: Set CPU to RUN:
myInstance.PowerOn();
myInstance.Run();
Write output (O0.0):
myInstance.OutputArea.WriteBit(0, 0, true);
Read input (I0.0): bool value = myInstance.InputArea. ReadBit(0, 0); Set CPU to STOP: myInstance.Stop();
Restricted © Siemens AG 2016 Page 43
March 2016
PLCSIM Advanced V1.0 Applications Restricted © Siemens AG 2016
siemens.com/tia-portal
PLCSIM Advanced Applications – Valve simulation 1 Valve_chocolate
PLCSIM Adv. Instance 1
HMI
•
Controlling the valves with FB library and Faceplate: • Chocolate • Vanille
•
Simulation the IOs of each valve • Set open • Set close • Open_feedback • Close_feedback
set_open set_close Open_feedback Close_feedback
Valve library with alarms included
Restricted © Siemens AG 2016 Page 45
March 2016
Valve face plate
PLCSIM Advanced Applications – Valve simulation 2 Valve_chocolate
PLCSIM Adv. Instance 1
HMI
•
Controlling the valves with FB library and Faceplate: • Chocolate • Vanille
•
Simulation the IOs of each valve • Set open • Set close • Open_feedback • Close_feedback
set_open set_close Open_feedback Close_feedback
Valve library with alarms included
Restricted © Siemens AG 2016 Page 46
March 2016
Valve face plate
PLCSIM Advanced Applications – Cross Link
PLCSIM Adv. Instance 2
Cross Link C# based
A
PLCSIM Adv. Instance 1
B
HMI
•
Controlling a conveyor belt by monitoring a sensor that detects when it has passed the end
•
Simulation the actual position of the transported object and the sensor signal
mainController IP: 192.168.0.11
coSimController IP: 192.168.0.1
A B Restricted © Siemens AG 2016 Page 47
March 2016
PLCSIM Advanced Applications – OPC UA Matlab/ SIMULINK
OPC UA
PLCSIM Adv. Instance 1
.Control_Value .Process_Value OPC UA Client
OPC UA Server
•
Controlling the alignment of the PENDULUM by PID Compact
•
Simulation of the PENDULUM process behavior using a state space model with Matlab/ SIMULINK
HMI
PENDULUM
Restricted © Siemens AG 2016 Page 48
March 2016
PLCSIM Advanced Applications – Open User Communication PLCSIM Adv. Instance 2
PLCSIM Adv. Instance 1
S7-1500F IP: 192.168.0.100
Pn_io_controller IP: 192.168.0.102
Restricted © Siemens AG 2016 Page 49
March 2016
•
Pn_io_controller is establishing a OpenUserCommunication
PLCSIM Advanced Applications – Open User Communication PLCSIM Adv. Instance 1
PLCSIM Adv. Instance 2
S7-1500F IP: 192.168.0.100
Restricted © Siemens AG 2016 Page 50
March 2016
Pn_io_controller IP: 192.168.0.102
•
Pn_io_controller is sending frequently data
•
S7-1500F controller is receiving data
Your questions – our answers 1. Is it possible to simulate blocks from a SIEMENS library like SIWAREX which are know how protect? We cannot remove know how protect from those blocks. In this case the Owner of the Siemens library block (e.g. SIWAREX) has to flag the block with the property “Support simulation during block compilation”. If this is not done, it is not possible to simulate this library block with PLCSIM Advanced 2. There is the possibility to connect a PLC SIM Advanced to communicate with a real CPU, Do you have an example of this? I have no example but this scenario is not so difficult to realize. The only thing to consider is to start the PLCSIM Advanced Instance with Online Access “PLCSIM Virtual Ethernet Adapter” and to activate the virtual switch (“TCP/IP communication with: …) on the physical network card which is connected to the real PLC. 3. Where can we have more info on this please? In the function manual some basics are described.
Restricted © Siemens AG 2016 Page 51
March 2016
Thank you for your attention! Annika Simmel Product Management DF FA AS E&C PRM 1 Gleiwitzer Str. 555 90475 Nuremberg, Germany
Phone:
+49 (911) 895-3236
E-mail: [email protected]
siemens.com/tia-portal Restricted © Siemens AG 2016 Page 52
March 2016