SIMATIC And Simulink Use Case 1 - Siemens

2y ago
162 Views
40 Downloads
3.04 MB
44 Pages
Last View : 2m ago
Last Download : 3m ago
Upload by : Wren Viola
Transcription

Digitalization with TIA Portal:Virtual Commissioning withSIMATIC and SimulinkUse case 1:Connecting Simulink modelsto SIMATIC PLCSIM Advancedvia APISIMATIC S7-PLCSIM port

Legal informationLegal information Siemens 2020 All rights reservedUse of application examplesApplication examples illustrate the solution of automation tasks through an interaction of severalcomponents in the form of text, graphics and/or software modules. The application examples area free service by Siemens AG and/or a subsidiary of Siemens AG ("Siemens"). They arenon-binding and make no claim to completeness or functionality regarding configuration andequipment. The application examples merely offer help with typical tasks; they do not constitutecustomer-specific solutions. You yourself are responsible for the proper and safe operation of theproducts in accordance with applicable regulations and must also check the function of therespective application example and customize it for your system.Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have theapplication examples used by technically trained personnel. Any change to the applicationexamples is your responsibility. Sharing the application examples with third parties or copying theapplication examples or excerpts thereof is permitted only in combination with your own products.The application examples are not required to undergo the customary tests and quality inspectionsof a chargeable product; they may have functional and performance defects as well as errors. It isyour responsibility to use them in such a manner that any malfunctions that may occur do notresult in property damage or injury to persons.Disclaimer of liabilitySiemens shall not assume any liability, for any legal reason whatsoever, including, withoutlimitation, liability for the usability, availability, completeness and freedom from defects of theapplication examples as well as for related information, configuration and performance data andany damage caused thereby. This shall not apply in cases of mandatory liability, for exampleunder the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss oflife, bodily injury or damage to health, non-compliance with a guarantee, fraudulentnon-disclosure of a defect, or culpable breach of material contractual obligations. Claims fordamages arising from a breach of material contractual obligations shall however be limited to theforeseeable damage typical of the type of agreement, unless liability arises from intent or grossnegligence or is based on loss of life, bodily injury or damage to health. The foregoing provisionsdo not imply any change in the burden of proof to your detriment. You shall indemnify Siemensagainst existing or future claims of third parties in this connection except where Siemens ismandatorily liable.By using the application examples you acknowledge that Siemens cannot be held liable for anydamage beyond the liability provisions described.Other informationSiemens reserves the right to make changes to the application examples at any time withoutnotice. In case of discrepancies between the suggestions in the application examples and otherSiemens publications such as catalogs, the content of the other documentation shall haveprecedence.The Siemens terms of use (https://support.industry.siemens.com) shall also apply.Security informationSiemens provides products and solutions with Industrial Security functions that support the secureoperation of plants, systems, machines and networks.In order to protect plants, systems, machines and networks against cyber threats, it is necessaryto implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.Siemens’ products and solutions constitute one element of such a concept.Customers are responsible for preventing unauthorized access to their plants, systems, machinesand networks. Such systems, machines and components should only be connected to anenterprise network or the Internet if and to the extent such a connection is necessary and onlywhen appropriate security measures (e.g. firewalls and/or network segmentation) are in place.For additional information on industrial security measures that may be implemented, please emens’ products and solutions undergo continuous development to make them more secure.Siemens strongly recommends that product updates are applied as soon as they are availableand that the latest product versions are used. Use of product versions that are no longersupported, and failure to apply the latest updates may increase customer’s exposure to cyberthreats.To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feedat: https://www.siemens.com/industrialsecurity.Virtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20202

Table of contentsTable of contentsLegal information . 21Introduction . 41.11.21.32Engineering . 72.12.22.32.42.4.12.4.22.4.32.52.62.72.7.12.7.2 Siemens AG 2020 All rights reserved3Operating the PID controller . 34Monitor control result . 35Using the user website. 36Speeding up/slowing down the controller's virtual time . 38Useful information . 404.14.24.35Setting up and starting virtual controller . 7Enabling simulation support in TIA Portal . 8TIA Portal hardware configuration . 9Code generation with SIMATIC Target 1500S . 12Settings for code generation . 12Coding with SIMATIC Target 1500S . 18Description of the generated function blocks . 22Create Step 7 program . 22Insert S-function in Simulink model . 28Commissioning the example application . 31Download project . 31Start Simulink simulation. 33Operation . 343.13.23.33.44Overview . 4Principle of operation . 5Components used . 6Block parameters of the S-function "PLCSIM Advanced" . 40S-function "PLCSIM Advanced" . 41Synchronization . 42Appendix. 435.15.25.35.4Service and support . 43Industry Mall . 44Links and literature. 44Change documentation . 44Virtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20203

1 Introduction1Introduction1.1OverviewThe Simulink software from MathWorks is frequently used in automation andcontrols engineering to simulate processes and create algorithms. The requirementis to simulate the model, the algorithm or the function in a few steps either in avirtual environment with PLCSIM Advanced or, using hardware, via a softwarecontroller.This application example provides you with the S-function "PLCSIM Advanced" forSimulink for the purpose of communication and data exchange with a virtualcontroller via the PLCSIM Advanced API. This makes it possible to validate andvirtually commission a PID control system, running on a virtual controller, in thecontext of a simulated process in Simulink.This document describes the necessary steps for configuring, commissioning andoperating the application example. Siemens AG 2020 All rights reservedThe complete application example consists of the following documents: Main document: Overview of the two use cases and the Simulink model. Use case 1: Connecting Simulink models to SIMATIC PLCSIM Advanced viaAPI (this document). Use case 2: Connecting Simulink models to a SIMATIC S7-1500 softwarecontroller via OPC UA.Figure 1-1: Overview of use casesSimulinkSIMATIC PLCSIMAdvanced SimulinkOpen Controller SimulinkPID ControllerAPIOPC UAProcess modelUse case 1Virtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/2020Use case 24

1 Introduction1.2Principle of operationThis application example provides you with a fully programmed S-function"PLCSIM Advanced". The function makes it possible to write and read tags from aPLCSIM Advanced virtual controller.The function in Simulink is placed in a control loop rather than a controller.The Simulink model of a PID controller is coded with SIMATIC Target 1500S andmade to run on an S7-1500 software controller. This is so that it can then be testedin the context of a simulation model.Tags are exchanged via a global data block in the virtual controller. Here, theexchange always takes place at the controller's cycle control point.The closed-loop controller's results are visualized, and the controller itself iscontrolled via a simulated HMI screen in the WinCC runtime.NoteThe configuration of the HMI is not a part of this application example. Siemens AG 2020 All rights reservedFigure 1-2S-FunctionSIMATIC WinCC RuntimeAPI20 msPIDGlobalSO fileVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20205

1 Introduction1.3Components usedThis application example was created with these hardware and softwarecomponents:Table 1-1: Software components Siemens AG 2020 All rights reservedComponentsItem number / Notes / Link(R2019b)MATLAB V9.7MATLAB Coder V4.3Simulink V10.0Simulink Coder V9.2OPC Toolbox V4.0.8MathWorks online documentation:http://mathworks.com/help/STEP 7 TIC S7-1500 ODK1500S V2.5 SP16ES7806- com/cs/ww/en/ps/13914/manSIMATIC Target 1500Sfor Simulink try.siemens.com/cs/ww/en/ps/24443/manS7-PLCSIM AdvancedV3.0 try.siemens.com/cs/ww/en/view/109773484This application example consists of the following components:Table 1-2: Components of the application exampleComponentsContents109749187 DIGI Usecases MAIN DOC V20 en.pdfMain document.109749187 DIGI Usecases API DOC V20 en.pdfThis document.109749187 DIGI Usecases TIAV16 PROJ V20.zipTIA Portal project for usecases 1 & 2.109749187 DIGI Usecases Simulink PROJ V20.zipSimulink models for usecases 1 & 2.Virtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20206

2 Engineering2Engineering2.1Setting up and starting virtual controller1. Start S7-PLCSIM Advanced V3.0 Upd1. The PLCSIM Advanced icon willappear in the info region of the Windows taskbar. Left-click the icon to open thegraphical interface of PLCSIM Advanced, the Control Panel.2. Start an instance of the virtual controller with the Control Panel.1. Select the PLCSIM Virtual Eth. adapter.2. Enter an instance name, for example "MFP". Siemens AG 2020 All rights reserved3. Enter the IP address 192.168.3.1 and subnet mask 255.255.255.0.4. Click on "Start".UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20207

2 Engineering Siemens AG 2020 All rights reserved3. Check whether the "Siemens PLCSIM Virtual Ethernet Adapter" is enabled.Also check whether "Siemens PLCSIM Virtual Switch" is enabled and "InternetProtocol Version 4 (TCP/IPv4)" is set to "Obtain an IP address automatically".4. Set the PG/PC interface.1. To do this, open your Windows Control Panel.2. Set the appearance to "Small icons".3. Select "Set PG/PC Interface".4. For S7ONLINE (STEP 7), select the Siemens PLCSSIM Virtual EthernetAdapter.TCPIP.1.Unrestricted2.2Enabling simulation support in TIA PortalPerform the following steps to enable simulation support with PLCSIM Advanced.Virtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20208

2 Engineering1. Create a new TIA Portal project.2. Open your project's "Properties".3. Enable simulation support with PLCSIM Advanced under the "Protection" tab.1. Enable "Support simulation during block compilation". Siemens AG 2020 All rights reserved2. Click "OK" to confirm the change.2.3TIA Portal hardware configurationPerform the following steps to set up the hardware configuration for your PLC.1. In the project, add a CPU 1518 MFP with V2.8. Name the PLC "UseCase1".2. Double-click to open the CPU's "Device configuration".UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/20209

2 Engineering3. In the Inspector window under "Properties General PROFINET interface[X1] Ethernet addresses", set the IP address (e.g. 192.168.3.1) for yourCPU. Siemens AG 2020 All rights reserved4. Enable the web server. Acknowledge the security dialog.5. Navigate to "Web server User management" and check all checkboxes under"Access level" to grant full access. Create a password if necessary.NoteIn order to load the SO file to the web server or delete it, the parameters "readfiles" and "write/delete" files must be enabled. Any further parameters areoptional.UnrestrictedUnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202010

2 Engineering6. Download the hardware configuration to the virtual controller. Select"Usecase1" in the project tree. Click the "Download to device" button.7. Select "PN/IE".Select the Ethernet interface "Siemens PLCSIM Virtual Ethernet Adapter".–Select "Direct at Slot '1 X1'".–Click "Start search".–Click "Load". Siemens AG 2020 All rights reserved–UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202011

2 Engineering8. Confirm the "Assign IP address" dialog with "Yes" and allow the SiemensPLCSIM Virtual Ethernet Adapter to assign an IP address.9. Confirm all subsequent dialogs until the download is complete.2.4Code generation with SIMATIC Target 1500SThe following chapter describes how to prepare the simulated model of the PIDcontroller with Simulink for coding with Target 1500S, then how to carry it out. Siemens AG 2020 All rights reserved2.4.1Settings for code generationMake the following code generation settings for your model.1. Open your model "Pendulum Controlled.slx".2. In the menu bar, click on "Code Settings C/C Code generationsettings ".3. Navigate to "Code Generation".1. Click the "Browse" button to open the target selection window.2. Select "Target 1500S V4 0 grt.tlc".3. Confirm the setting with "Apply".UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202012

2 Engineering4. Navigate to "Solver".1. Leave "Start time" at "0".2. Change "Stop time" to "inf". This ensures that the External Mode will beused without a definite end. Siemens AG 2020 All rights reserved3. Leave "Solver" on the default "auto (Automatic solver selection)".5. Navigate to "Code Generation Optimization".–Set the parameter "Default parameter behavior" to "Tunable".After code generation, this setting gives you access with STEP 7 (TIA Portal)to all internal parameters of the model.Unrestricted6. Click on "Target 1500S Options Target 1500s Options".Virtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202013

2 Engineering7. Navigate to "TIA Portal integration".1. Select your TIA project under "TIA Portal project".2. For "Device", set "UseCase1".3. For "PROFINET interface", select the [X1] interface. The IP address ismodified automatically.4. Make sure that "Import the generated SCL file to STEP 7" is checked. Siemens AG 2020 All rights reserved5. Confirm with "Apply"UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202014

2 Engineering8. Navigate to "Accessibility".1. Check the box for "Enable parameter access with Step 7".2. Check the box for "Enable Step 7 access to internal model signals".3. Make sure that "Generate model diagrams for PLC Web server" ischecked. Siemens AG 2020 All rights reserved4. Confirm with "Apply"UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202015

2 Engineering Siemens AG 2020 All rights reserved9. Navigate to "Post-build options" and make sure that the box by "Transfer thegenerated SO file to the CPU" is checked.UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202016

2 Engineering10. Navigate to "ODK options".1. For "ODK 1500S version", select V2.5.2. Check the box for "Copy all referenced files to ODK project". Siemens AG 2020 All rights reserved3. Confirm with "Apply"NoteThe parameters "Heap size for dynamic memory allocation in kByte" and "Maxblock size for dynamic memory allocation in Byte" only need to be adjusted ifthere are problems with the code generation.For further information on this topic, please consult the Target 1500S n/ps/24443/manand the SIMATIC S7-1500 ODK 1500S n/ps/13914/man.11. Close the dialog by clicking "OK".UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202017

2 Engineering2.4.2Coding with SIMATIC Target 1500S1. Open your own model, or the supplied model "Pendulum Controlled.slx".2. Right-click to select the subsystem "PID Controller" and click "Code C/C Code Build This Subsystem" in the selection window. Siemens AG 2020 All rights reserved3. The "Build code for Subsystem:PID Controller" window will open. Confirm thiswith "Build".–Simulink cannot be operated while the code is generating.–SIMATIC Target 1500S compiles the Simulink model"Pendulum Controlled" with its input and output tags to "C/C " code.–This source code is then used to generate the SO file and SCL source withthe ODK compiler of the SIMATIC ODK 1500S.UnrestrictedVirtual Commissioning with SIMATIC and Simulink - Use case 1Entry-ID: 109749187, V2.0, 09/202018

2 Engineering4. Once the code generation is done, you can click the "View." link in the statusbar of the Simulink window. Siemens AG 2020

1 Introduction 1.1 Overview The Simulink software from MathWorks is frequently used in automation and controls engineering to simulate processes and create algorithms. The requirement is to simulate the model,

Related Documents:

SITRAIN INDIA, KALWA. List of courses at SITRAIN-Kalwa & Authorized Training Centers (ATC) Sr. No. Title Days 1 PLC : SIMATIC S7-200 5 2 PLC : TIA Basic with SIMATIC S7-300 & Step7 8 3 PLC : TIA Advanced with SIMATIC S7-400 6 4 SIMATIC NET 5 5 SIMATIC WinCC 6 6 SIMATIC HMI Panels 3 7 DCS: SIMATIC PCS 7 Basic 8 8 DCS: SIMATIC PCS 7 Advanced 10

Power supply Article No. PM 1207 6EP1332-1SH71 System accessories Article No. SIMATIC memory card SIMATIC memory card 4 MB 6ES7954-8LC02-0AA0 SIMATIC memory card 12 MB 6ES7954-8LE03-0AA0 SIMATIC memory card 24 MB 6ES7954-8LF03-0AA0 SIMATIC memory card 256 MB 6ES7954-8LL03-0AA0 SIMATIC memory card 2 GB 6ES7954-8LP02-0AA0 SIMATIC memory card 32 GB 6ES7954-8LT03-0AA0 .

ES360 Introduction to Controls Engineering MATLAB and SIMULINK Help Page 2 of 6 Starting SIMULINK SIMULINK can be started by: 1) Opening a SIMULINK model file (model files use the .mdl extension). 2) Starting MATLAB and clicking on the icon in the tool bar. The SIMULINK Library Browser SIMULINK

Test Driven Development powered by MATLAB and Simulink 45 Model-Based Design –Simulink and Stateflow Manage Requirements –Simulink Requirements Author and Execute Tests –Simulink Test Measure Test Completeness –Simulink Coverage Refactor and Verify Compliance –Simulink Check

Simulink and LEGO MINDSTORMS EV3 9 P a g e Project 1: Explore Simulink and LEGO MINDSTORMS EV3 P1.1 Get Started: Program EV3 Status Light with Simulink Motivation At the end of this project you will be able to program an EV3 brick from Simulink. Objective Create first model in Simulink Check hardware and software installation

Introduction to Simulink Todd Atkins tatkins@mathworks.com. 4 Outline What is Simulink? Working with Simulink. How Simulink works. Continuous and discrete models Componentizing models. 5 Simulink Applications. 6 Simulink

_SIMATIC Automation Tool _ SIMATIC S7/HMI SIMATIC Automation Tool V3.1 SP1 User Guide Manual V3.1 SP1, 05/2018 A5E43616265-AA Preface Downloading, licensing, and installing the SIMATIC Automation Tool 1 SIMATIC Automation Tool overview 2 Prerequisites and communication setup 3 Getting started with the SIMATIC Automation Tool 4

SIMATIC STEP 7 version 15 or higher The contents of the S7-1500 column also apply to SIMATIC S7-1500 Software Controller CPU 150xS SIMATIC S7-1200 firmware 4.2 or higher. SIMATIC S7-1200 only supports LAD, FBD and SCL. SIMATIC S7-1500 firmware 2.5 or hi