advertisement
▼
Scroll to page 2
of 54
Preface, Contents SIMATIC PLC Simulation for S7-300 and S7-400 Installing the PLC Simulation Software 1 Getting Started with S7-PLCSIM 2 Running a Program on the Simulated PLC 3 Monitoring and Modifying Data with the View Objects 4 Appendix Troubleshooting A S7 Reference Information B Manual Index C79000-G7076-C201-01 Edition 1 Safety Guidelines ! ! ! This manual contains notices which you should observe to ensure your own personal safety, as well as to protect the product and connected equipment. These notices are highlighted in the manual by a warning triangle and are marked as follows according to the level of danger: Danger indicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken. Warning indicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken. Caution indicates that minor personal injury or property damage can result if proper precautions are not taken. Note draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation. Qualified Personnel The device/system may only be set up and operated in conjunction with this manual. Only qualified personnel should be allowed to install and work on this equipment. Qualified persons are defined as persons who are authorized to commission, to ground, and to tag circuits, equipment, and systems in accordance with established safety practices and standards. Correct Usage ! Note the following: Warning This device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens. This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended. Trademarks SIMATIC and SINEC are registered trademarks of SIEMENS AG. Some of the other designations used in these documents are also registered trademarks; the owners’ rights may be violated if they are used by third parties for their own purposes. Copyright Siemens AG 1997 All rights reserved Disclaimer of Liability The reproduction, transmission or use of this document or its contents is not permitted without express written authority. Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved. We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed. Siemens AG Automation Group Industrial Automation Systems P.O. Box 4848, D-90327 Nuremberg Technical data subject to change. Siemens AG 1997 Siemens Aktiengesellschaft 6ES7841-0AA0-BA0-01 Preface Purpose S7-PLCSIM is an optional software product for STEP 7 version 3.1. The S7-PLCSIM software enables you to run and test your program on a simulated programmable logic controller (PLC) that exists on your computer or programming device (such as a PG 740). Because the simulation exists completely within the STEP 7 software, you do not need to be connected to any S7 hardware (CPU or I/O modules). With the simulated S7 CPU, you can test and debug programs for both the S7-300 and S7-400 CPUs. S7-PLCSIM provides a simple interface for monitoring and modifying different parameters used by the program (such as for turning inputs on and off). You can also use the various applications of the STEP 7 software while you are running your program on the simulated CPU. This allows you to use such tools as the variable table (VAT) to monitor and modify variables. Audience This manual is intended for engineers, programmers, and maintenance personnel who have a general knowledge of programmable logic controllers. Scope of the Manual This manual describes the features and the operation of S7-PLCSIM version 3.0. In order to install S7-PLCSIM, you must have an authorized version of STEP 7 version 3.1 installed on your computer. Other Manuals You can find information in the online help for STEP 7 and for S7-PLCSIM. In addition, the following manuals provide information about STEP 7. Title Content System Software for S7-300 and S7-400 Program Design Programming Manual The System Software for S7-300/S7-400 Program Design Programming Manual provides basic information on the structure of the operating system and of a user program of an S7 CPU. S7-300 and S7-400 System and Standard Functions Reference Manual The S7 CPUs have integrated system functions and organization blocks included with their operating system, which you can use when programming. This manual provides you with descriptions of the system functions, organization blocks, and loadable standard functions available in S7. STEP 7 User Manual The STEP 7 User Manual explains the main usage and the functions of the STEP 7 automation software. This manual provides you with an overview of the procedures used to configure, program, and start up an S7-300/S7-400 PLC. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 iii Preface Title Statement List, Ladder Logic, S7GRAPH 1, SCL 1, and FBD 1 Manuals 1 Additional Assistance iv Content The manuals for the programming language packages Statement List, Ladder Logic, and SCL (Structured Control Language) contain both the user’s guide and the reference description of the programming language or representation type. Optional package for system software for S7-300/S7-400 If you have any questions not answered in this or one of the other STEP 7 manuals, if you need information on ordering additional documentation or equipment, or if you need information on training, please contact your Siemens distributor or sales office. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Contents 1 2 3 Installing the PLC Simulation Software 1.1 Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PLC Features Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Limitations of the Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Differences between a Simulated PLC and a Real PLC . . . . . . . . . . . . . . . 1-2 1-2 1-2 1-3 1-3 1-3 1.2 Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 1.3 Installing and Uninstalling the S7-PLCSIM Software . . . . . . . . . . . . . . . . . . 1-6 Getting Started with S7-PLCSIM 2.1 Downloading the Sample Program to the Simulated PLC . . . . . . . . . . . . . . Selecting and Downloading the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 2-2 2.2 Setting Up the Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating View Objects for the Sample Program . . . . . . . . . . . . . . . . . . . . . . 2-3 2-3 2.3 Running the Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting the Execution Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Saving the Layout of View Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 2-4 2-4 2-5 2.4 Using STEP 7 Tools to Monitor the Program . . . . . . . . . . . . . . . . . . . . . . . . . Using a Variable Table to Monitor or Modify Data . . . . . . . . . . . . . . . . . . . . . Using the Program Editor to Monitor Status . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 2-6 2-7 Running a Program on the Simulated PLC 3.1 Starting the PLC Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3-2 3.2 Downloading a Program to the Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . 3-3 3.3 Selecting Simulation Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting Execution Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the Pause Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cycling Power On and Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 3-4 3-4 3-4 3.4 Accessing Data in the Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the S7-PLCSIM View Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the STEP 7 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using a Variable Table to Monitor or Modify Data . . . . . . . . . . . . . . . . . . . . . 3-5 3-5 3-5 3-6 3-6 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 v Contents 3.5 4 Opening, Saving, and Closing the Simulated PLC . . . . . . . . . . . . . . . . . . . . Opening a Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Saving the Configuration of a Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . . Saving the Layout of View Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Closing the Simulated PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 3-7 3-7 3-7 3-7 Monitoring and Modifying Data with the View Objects 4.1 Controlling the CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the CPU View Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying the Status of the CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the CPU Operating Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Resetting the CPU Memory (MRES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 4-2 4-2 4-3 4-3 4.2 Monitoring and Modifying the Data Used by the Program . . . . . . . . . . . . . . Accessing the Data Stored in the CPU Memory . . . . . . . . . . . . . . . . . . . . . . Creating View Objects for Accessing Program Data . . . . . . . . . . . . . . . . . . Using the View Objects to Modify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4-4 4-5 4-5 4.3 Displaying the Symbolic Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting the Symbol Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Showing Symbol Names in View Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 4-6 4-6 4.4 Accessing the Accumulators, Status Word, and Address Registers . . . . . 4-7 4.5 Monitoring the Block Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying the Contents of the Block Registers . . . . . . . . . . . . . . . . . . . . . . . 4-8 4-8 4.6 Monitoring the Data in the CPU Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Monitoring the Nesting Stack and the MCR Stack . . . . . . . . . . . . . . . . . . . . 4-9 4-9 A Troubleshooting B S7 Reference Information B.1 Memory Areas for the S7-300 and S7-400 CPUs . . . . . . . . . . . . . . . . . . . . . B-2 B.2 S7-PLCSIM Notation for Entering Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-4 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1 vi PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Contents Figures 2-1 2-2 2-3 2-4 2-5 2-6 2-7 2-8 3-1 3-2 3-3 3-4 3-5 4-1 4-2 4-3 4-4 4-5 4-6 B-1 Downloading the S7_ZEBRA Program to the Simulated PLC . . . . . . . . . . View Objects for the S7_ZEBRA Sample Program . . . . . . . . . . . . . . . . . . . . Selecting Continuous Scan Program Execution . . . . . . . . . . . . . . . . . . . . . . Selecting RUN Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Turning on Input PI0.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sample View Objects Showing Status in RUN Mode . . . . . . . . . . . . . . . . . . Example of a STEP 7 Variable Table (VAT) . . . . . . . . . . . . . . . . . . . . . . . . . . Monitoring Program Status in the Ladder View . . . . . . . . . . . . . . . . . . . . . . . Selecting PLC Simulation with the SIMATIC Manager . . . . . . . . . . . . . . . . . Options for Downloading a Program to the Simulated PLC . . . . . . . . . . . . Toolbar Buttons for Program Execution Options . . . . . . . . . . . . . . . . . . . . . . Toolbar Buttons for Creating View Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . Example of a STEP 7 Variable Table (VAT) . . . . . . . . . . . . . . . . . . . . . . . . . . CPU View Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variable View Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Showing Symbol Names for Program Elements . . . . . . . . . . . . . . . . . . . . . . Accumulators and Status Word View Object . . . . . . . . . . . . . . . . . . . . . . . . . Block Registers View Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stacks View Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Memory Areas for the S7-300 and S7-400 CPUs . . . . . . . . . . . . . . . . . . . . . 2-2 2-3 2-4 2-4 2-4 2-5 2-6 2-7 3-2 3-3 3-4 3-5 3-6 4-2 4-5 4-6 4-7 4-8 4-9 B-2 Memory Areas for the S7-300 and S7-400 CPUs . . . . . . . . . . . . . . . . . . . . . Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Memory Areas for the S7-300 and S7-400 CPUs . . . . . . . . . . . . . . . . . . . . . Data Formats for the “Variables” View Object . . . . . . . . . . . . . . . . . . . . . . . . 4-4 A-1 B-3 B-4 Tables 4-1 A-1 B-1 B-2 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 vii Contents viii PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Installing the PLC Simulation Software 1 Overview The Setup program guides you through the installation of the S7-PLCSIM software by means of dialogs and menus. You call the Setup program using the standard Windows 95 software installation procedure. System Requirements To install the S7-PLCSIM software, you require the following: A programming device or PC with the STEP 7 (Release 3.1 or greater) Standard package already installed, and with the following capabilities: – 80486 processor (or higher) – 16 Mbytes RAM A VGA monitor, keyboard, and mouse which are supported by Microsoft Windows 95 A hard drive with a memory capacity of 5 Mbytes for the S7-PLCSIM optional package At least 1 Mbyte free memory capacity on drive C for the Setup program (Setup files are deleted when the installation is complete.) Windows 95 operating system Chapter Overview Section Description Page 1.1 Product Overview 1-2 1.2 Authorization 1-4 1.3 Installing and Uninstalling the S7-PLCSIM Software 1-6 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 1-1 Installing the PLC Simulation Software 1.1 Product Overview Description The S7-PLCSIM software enables you to run and test your program on a simulated PLC that exists on your computer or programming device (such as a PG 740). Because the simulation exists completely within the STEP 7 software, you do not need to be connected to any S7 hardware (CPU or I/O modules). With the simulated S7 CPU, you can test and debug programs for both the S7-300 and S7-400 CPUs. S7-PLCSIM provides a simple interface for monitoring and modifying different parameters used by the program (such as for turning inputs on and off). You can also use the various applications of the STEP 7 software while you are running your program on the simulated CPU. This allows you to use such tools as the variable table (VAT) to monitor and modify variables. Features S7-PLCSIM offers the following features for running a program on a simulated PLC: A button on the SIMATIC Manager toolbar turns the routing to simulation on or off. With the simulation button turned on, any new connection goes automatically to the simulated PLC. When the simulation button is turned off, any new connection goes to the real PLC. The simulated PLC runs programs intended for either the S7-300 or S7-400 CPU. You can create “view objects” that allow you to access the input and output memory areas, accumulators, and registers of the simulated CPU. You can modify any of this data. You can choose to have the timers run automatically, or you can set or reset the timers manually. You can change the CPU operating mode (STOP, RUN, and RUN-P) as with a real CPU. In addition, S7-PLCSIM provides a Pause function that allows you to halt the CPU momentarily without affecting the state of the program. S7-PLCSIM also allows you to use all of the STEP 7 tools to monitor and modify the activities of the simulated PLC. 1-2 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Installing the PLC Simulation Software PLC Features Supported The simulated PLC functions as either an S7-300 or S7-400 CPU. It provides the following capabilities: Timers: 512 (T 0 to T 511). Timers use a “virtual” clock rather than a real-time clock. Each timer instruction decrements using a simulation clock which is based on the instructions executed in the program. Timers can run faster or slower than real time depending on the size of the program and the computer hardware used to run the simulation. Although the timers do not run in real time, they will time out consistently relative to program execution (even if you use single-scan program execution or single-step debugging). Memory bits: up to 16,384 bits (2048 bytes) of M memory I/O memory: up to 16,384 bits (2048 bytes) of I/O memory Logic blocks and data blocks: 2048 function blocks (FBs) and functions (FCs), and 2048 data blocks (DBs) System functions (SFCs): SFC20, SFC21, SFC22, SFC23, SFC26, SFC27, SFC46, SFC52, and SFC64 For SFC26 and SFC27, the only input parameter supported is 0. OBs: OB1 (main program cycle), OB100 (complete restart), and OB101 (restart) Limitations of the Simulated PLC S7-PLCSIM has the following limitations: You can run only one simulated PLC at a time. The simulated PLC does not support all of the error messages written to the diagnostic buffer. It supports only the information available from the RUN mode transitions. It also supports diagnostics of fatal errors and time-out events, such as infinite loops. System data blocks (SDBs) are downloaded with your program, but are ignored by the simulated PLC. Differences between a Simulated PLC and a Real PLC The simulated PLC provides the following capabilities which are not available in a real PLC: The Pause function halts the simulated CPU and allows you to resume the execution of the program at the instruction where the program was halted. Any change that you make with a view object immediately updates the contents of the memory location. The CPU does not wait until the beginning or the end of the scan to update any changed data. Execution options allow you to select how the CPU runs the program: – Single Scan executes the program for one scan and then waits for you to start the next scan. – Continuous Scan executes the program like a real PLC: it starts a new scan immediately after the previous one finishes. Using STOP mode does not change the state of the outputs (PQ). PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 1-3 Installing the PLC Simulation Software 1.2 Authorization Overview The S7-PLCSIM programming software requires a product-specific authorization (or license for use). The software is therefore copy-protected and can be used only if the relevant authorization for the program or software package has been found on the hard disk of the respective programming device or PC. Authorization Disk A read-only authorization disk is included with the software. It contains the authorization and the program required to display, install, and remove the authorization called AUTHORS. For more information and rules on how to handle authorizations, see the STEP 7 User Manual. ! Installing the Authorization for the First Time Caution Note the information in the README.TXT file on the authorization disk. If you do not adhere to these guidelines, the authorization may be irretrievably lost. When installing your software for the first time, a message prompts you to install the authorization. Follow the steps outlined below: 1. When prompted, insert the authorization disk in a drive. 2. Acknowledge the prompt. The authorization is transferred to a physical drive and your computer registers the fact that the authorization has been installed. 1-4 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Installing the PLC Simulation Software Adding an Authorization at a Later Date If you attempt to start the S7-PLCSIM software and there is no authorization available for the software, a message informs you of this. If you want to install the authorization, use the AUTHORS program on the authorization disk. This program allows you to display, install, and remove authorizations. The program is menu-driven. Note Always enter drive C as the destination drive for the authorization for S7-PLCSIM. Removing an Authorization If you should need to repeat the authorization, for example, if you want to reformat the drive on which the authorization is located, you must remove the authorization first. You need the original authorization disk to do this. To transfer the authorization back to the authorization disk, follow the steps outlined below: 1. Insert the original authorization disk in your floppy disk drive. 2. Start the program AUTHORS.EXE from the authorization disk. 3. Select the menu command Authorization Remove. 4. In the dialog box, enter the drive on which the authorization is located and confirm the dialog box. A list of all authorizations on the respective drive is displayed. 5. Select the authorization you want to remove and confirm the dialog box. If the process is completed without error, the following message appears: ”Authorization <Name> successfully removed from drive <X:>.” 6. Acknowledge the message. The dialog box with the list of authorizations remaining on the drive is then displayed. Close the dialog box if you do not want to remove any more authorizations. You can then use the disk again to install an authorization. If Your Hard Drive is Defective... If a fault occurs on your hard disk before you can back up the authorization, contact your local Siemens representative. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 1-5 Installing the PLC Simulation Software 1.3 Installing and Uninstalling the S7-PLCSIM Software Overview S7-PLCSIM includes a Setup program which executes the installation automatically. Prompts on the screen guide you step by step through the installation procedure. Preparing for Installation Before you can start installing the software, Windows 95 must be started and the STEP 7 basic package loaded. ’ Starting the Installation Program The Setup program guides you step by step through the installation process. You can switch to the next step or to the previous step from any position. To start the installation program, proceed as follows: 1. Start the dialog box for installing software under Windows 95 by double-clicking on the Add/Remove Programs icon in the Control Panel. 2. Click on “Install...” 3. Insert disk 1 and click on “Next.” Windows 95 searches automatically for the installation program SETUP.EXE. 4. Follow the instructions displayed by the installation program step by step. If a Version of S7-PLCSIM is Already Installed If the installation program finds another version of S7-PLCSIM on the programming device, the program reports this and prompts you to decide how to proceed by offering the following choices: Abort the installation so that you can uninstall the old S7-PLCSIM version under Windows 95 and then start the installation again. Continue the installation and overwrite the old version with the new version. Your software is better organized if you uninstall any older versions before installing the new version. Overwriting an old version with a new version has the disadvantage that if you then uninstall, any remaining components of the old version are not removed. During installation, queries are shown in dialog boxes for you to answer, and options are displayed for you to select. Read the following notes so you can reply to the queries faster and more easily. Uninstalling Use the usual Windows 95 procedure to uninstall: 1. Start the dialog box for installing software under Windows 95 by double-clicking on the Add/Remove Programs icon in the Control Panel. 2. Select the SIMATIC S7-PLCSIM entry in the displayed list of installed software. Click on the “Add/Remove...” button to uninstall the software. 3. If the “Remove Enable File” dialog boxes appear, click the “No” button if you are unsure how to respond. 1-6 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Installing the PLC Simulation Software Using the Scope of Installation All languages of the user interface and all examples require approximately 5 Mbytes of memory capacity. Using Authorization During installation, the program checks to see whether an authorization is installed on the hard disk. If no authorization is found, a message appears that the software can be used only with an authorization. If you wish, you can run the authorization program immediately or continue the installation and execute the authorization at a later date. In the first case, insert the authorization disk when you are prompted to do so. (See Section 1.2.) Result of the Installation Once the installation has been completed successfully, a message to that effect is displayed on the screen. If Errors Occur during the Installation The following errors may cause the installation to fail: Initialization error immediately after starting Setup: The SETUP.EXE program was probably not started under Windows 95. Not enough memory: You need at least 5 Mbytes of free space on your hard disk. Bad disk: Verify that the disk is bad, then call your local Siemens representative. Operator error: Start the installation again and read the instructions carefully. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 1-7 Installing the PLC Simulation Software 1-8 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Getting Started with S7-PLCSIM Overview 2 STEP 7 provides a sample program called “S7_ZEBRA”. You can use this program to become familiar with the features of the S7-PLCSIM software. This chapter provides the basic steps for downloading and running the program on a simulated CPU. It also provides information about using the different view objects and a variable table (VAT) with the simulation. Chapter Overview Section Description Page 2.1 Downloading the Sample Program to the Simulated PLC 2-2 2.2 Setting Up the Simulated PLC 2-3 2.3 Running the Sample Program 2-4 2.4 Using STEP 7 Tools to Monitor the Program 2-6 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 2-1 Getting Started with S7-PLCSIM 2.1 Downloading the Sample Program to the Simulated PLC Selecting and Downloading the Program STEP 7 provides a sample program that you can download to the simulated PLC. Use the following procedure to download the sample program: 1. Start the SIMATIC Manager. 2. Turn on the routing to the simulator by clicking on the Simulation On/Off button located on the SIMATIC Manager toolbar, as shown in Figure 2-1, or by selecting the menu command Options Simulate Modules. 3. Use the SIMATIC Manager menu command File Open Project to open the S7_ZEBRA project. This project is supplied with the STEP 7 software. 4. Navigate through the object hierarchy until you get to the blocks object. Figure 2-1 shows the S7_ZEBRA project structure. 5. Select the menu command PLC Download or click on the download button to download the blocks object to the simulated CPU. (Downloading the blocks automatically creates the simulated CPU.) The S7-PLCSIM application window opens with a default CPU view object. The Windows taskbar displays an icon to alert you that there is a simulated PLC. (If you place the mouse cursor on the icon, a tool tip displays the MPI number.) ✂ SIMATIC Manager - S7_ZEBRA File Edit Insert PLC View Options Window Help S7_ZEBRA - <Standard Hierarchy, Offline> (Project) SIMATIC 300-Station(1) S7_ZEBRA SIMATIC 300-Station(1) MPI-Netz(1) CPU314(1) S7-Program(1) Download button Source Files Blocks Simulation On/Off button ZEBRA blocks object Press F1 for Help Figure 2-1 2-2 NUM Downloading the S7_ZEBRA Program to the Simulated PLC PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Getting Started with S7-PLCSIM 2.2 Setting Up the Simulated PLC Creating View Objects for the Sample Program The S7_ZEBRA sample program uses several inputs, outputs and timers. You can use a view object to turn the inputs on and off, and you can watch the timer values and outputs change as the program runs. Figure 2-2 shows the view objects used with the sample program. Use the following procedure to create the different view objects: 1. Create a view object that accesses the inputs used by the program: – Select the menu command Insert Input Variable. – The default value is PIB0 (for peripheral input byte 0). Press ENTER to accept. 2. Create a view object that accesses the outputs used by the program: – Select the menu command Insert Output Variable. – The default value is PQB0 (for peripheral output byte 0). Press ENTER to accept. 3. Create three view objects to access the timers used by the program: – Select the menu command Insert Timer. – The default value is T 0, with the 0 highlighted. Type 2 in the view object (for Timer T 2) and press ENTER. – Repeat for timers T 3 and T 4. PLC Simulation – Zebra.plc PLC Execute View Options Window Help ✂ Simulation Edit Insert PIB CPU 300/400 SF DC RUN STOP T T RUN-P PIB RUN STOP 7 0 6 Bits 5 4 3 T 2 0 PQB 0 7 5 T T=0 3 6 T 3 T 0 sec Bits 4 3 2 1 0 T=0 4 4 0 ms T=0 NUM Ready Figure 2-2 2 1 0 MRES 2 0 ms PQB 0 View Objects for the S7_ZEBRA Sample Program PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 2-3 Getting Started with S7-PLCSIM 2.3 Running the Sample Program Selecting the Execution Option With the sample program downloaded to the CPU, you can now run the program. Before starting the program, ensure that the program execution is set for continuous scan. Use the menu command Execute Mode Continuous Scan or click on the toolbar button (shown in Figure 2-3) to select the execution control option for running the program continuously. Click here for Continuous Scan program execution. Figure 2-3 Starting the Program Selecting Continuous Scan Program Execution Use the following procedure to switch the CPU into RUN mode and to start the program. 1. Click the RUN check box in the CPU view object. See Figure 2-4. CPU 300/400 SF DC RUN STOP Figure 2-4 RUN-P Click here to switch CPU to RUN mode. RUN STOP MRES Selecting RUN Mode 2. Click either bit 0 or bit 1 in the Input Variable view object to turn on PI0.0 or PI0.1, as shown in Figure 2-5. PIB PIB 7 Figure 2-5 2-4 0 0 6 Bits 5 4 3 2 1 0 Click here to turn on input bit PI0.0. Turning on Input PI0.0 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Getting Started with S7-PLCSIM In the view objects, you can watch the timer values as they change and the outputs as they turn on or off, as shown in Figure 2-6. As each timer reaches its preset value, the corresponding outputs turn on or off. To speed up the operation of the sample program, you can reset the timers in turn by clicking on the “T = 0” button in the Timer view objects. Saving the Layout of View Objects You can save your layout of view objects within the simulated PLC window by selecting the menu command Simulation Layout Save.... You can then retrieve the saved layout at any time by selecting the menu command Simulation Layout Open... PLC Simulation – Zebra.plc PLC Execute View Options Window Help ✂ Simulation Edit Insert PIB CPU 300/400 SF DC RUN STOP T T RUN-P PIB RUN STOP 7 0 6 Bits 5 4 3 2 1 T 2 PQB 0 7 5 T T=0 3 6 T 3 T 0.0 sec Ready Figure 2-6 0 0 Bits 4 3 2 1 0 MRES 2 2840 ms PQB 0 T=0 4 4 0 ms T=0 NUM Sample View Objects Showing Status in RUN Mode PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 2-5 Getting Started with S7-PLCSIM 2.4 Using STEP 7 Tools to Monitor the Program Using a Variable Table to Monitor or Modify Data STEP 7 allows you to use a variable table (VAT) to monitor the status of any variable in your program. Figure 2-7 shows a VAT for the sample program. You can also modify the variables which are defined for the VAT. To monitor program status using the variable table, follow these steps: 1. Access the SIMATIC Manager window. 2. Select VAT1 and double-click with the mouse or use the menu command Edit Open Object to open the variable table for the “S7_ZEBRA” project. 3. Select the menu command PLC Connect To Configured PLC to establish an online connection with the program in the simulated PLC. You can now observe the values of the input, output, and timer elements in the Monitor Value column of the VAT, as shown in Figure 2-7. S7_ZEBRA\SIMATIC 300–Station1\CPU314(1)\S7–Program(1)\...\VAT1 Address Monitor Format Monitor Value Modify Value Q 0.1 “Ped_green” BIN 2#0 ––– Q 0.5 “Car_red” BIN 2#0 ––– Q 0.6 “Car_orange” BIN 2#1 ––– Q 0.7 “Car_green” BIN 2#0 ––– T 4 “Car_delay_red” SIMATIC_TIME S5T#4s820ms S5T#0ms T 5 “Car_red_orange_phase” SIMATIC_TIME S5T#0ms S5T#0ms T 6 “Ped_delay_green” SIMATIC_TIME S5T#0ms S5T#0ms I 0.0 “Switch_right” BIN 2#1 2#1 I 0.1 “Switch_left” BIN 2#0 2#1 Figure 2-7 2-6 Symbol Example of a STEP 7 Variable Table (VAT) PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Getting Started with S7-PLCSIM Using the Program Editor to Monitor Status To view the execution of program logic in the ladder view of the program, follow these steps: 1. Access the SIMATIC Manager window. 2. Select FC1 in the online view and double-click with the mouse or use the menu command Edit Open Object to open the program for the “S7_ZEBRA” project. If necessary, select View LAD in the LAD/STL/FBD application to switch from the statement list view to the ladder view. 3. Select the menu command Debug Monitor to enable the animation of program execution in the ladder networks. You can now observe the power flow to the inputs, outputs, memory bits, and timer elements in the ladder networks, as shown in Figure 2-8. LAD/STL/FDB – [S7_ZEBRA\SIMATIC 300–STATION(1)\CPU 314(1)\...\ - [FC1 - <On-line>] Network 1 : Determining green request for pedestrians Determining whether I 0.0 or I 0.1 is set I0.0 T6 T5 M0.0 I0.1 M0.0 Network 2 : Green phase for cars If I 0.0 or I 0.1 are not set, the light stays green for cars. M0.0 Figure 2-8 Q0.7 Monitoring Program Status in the Ladder View PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 2-7 Getting Started with S7-PLCSIM 2-8 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Running a Program on the Simulated PLC Overview Chapter Overview 3 S7-PLCSIM works with the STEP 7 software to test and debug your program on a simulated PLC. This chapter describes how to start the PLC simulation, download a program, select execution options, and access data in the program. Section Description Page 3.1 Starting the PLC Simulation 3-2 3.2 Downloading a Program to the Simulated PLC 3-3 3.3 Selecting the Simulator Options 3-4 3.4 Accessing Data in the Simulated PLC 3-5 3.5 Opening, Saving, and Closing the Simulated PLC 3-7 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 3-1 Running a Program on the Simulated PLC 3.1 Starting the PLC Simulation You use the SIMATIC Manager to determine whether a program that you download will go to a real PLC or to a simulated PLC. Selecting Simulation STEP 7 provides a button on the SIMATIC Manager toolbar that turns the routing to S7-PLCSIM on or off. With the simulation button turned on, any new request for an online CPU connection is re-routed to a simulated CPU. Be aware, however, that selecting simulation does not close any online connections that you may have with a real PLC. Because of the risk of unintentionally editing a real online program, you cannot start a simulation session until you close all windows or applications that are connected to real PLCs. Figure 3-1 shows the SIMATIC Manager window with the Simulation On/Off button. Note You can have only one simulated PLC active at a time. When the Simulation On/Off button is turned on, clicking on the Accessible Nodes button shows the node address for the simulated CPU that you have created. When the Simulation On/Off button is turned off, the Accessible Nodes window shows the network of real PLCs. ✂ SIMATIC Manager - S7_ZEBRA File Edit Insert PLC View Options Window Help S7_ZEBRA - <Standard Hierarchy, Offline> (Project) SIMATIC 300-Station(1) S7_ZEBRA SIMATIC 300-Station(1) MPI-Net(1) CPU314(1) S7-Program(1) Source Files Simulation On/Off button Blocks Accessible Nodes button Press F1 for Help Figure 3-1 3-2 NUM Selecting PLC Simulation with the SIMATIC Manager PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Running a Program on the Simulated PLC 3.2 Downloading a Program to the Simulated PLC S7-PLCSIM starts when you download a program to the simulated PLC. STEP 7 provides two options for downloading a program: You can download an existing program with the SIMATIC Manager. You can download your program from the program editor. After you download your program, an icon appears in the Windows taskbar to inform you that there is an active connection to the simulated PLC. For more information about downloading programs, refer to the STEP 7 User Manual. SIMATIC Manager Program Editor SIMATIC Manager - S7_ZEBRA Edit Insert PLC View Options Window Help Network 1 : ✂ File S7_ZEBRA - <Offline> (Project) SIMATIC 300-Station(1) S7_ZEBRA SIMATIC 300-Station(1) MPI-Netz(1) CPU314(1) S7-Program(1) Source Files Blocks Network 2 : Press F1 for Help NUM S7-PLCSIM PLC Simulation – SimView1 CPU 300/400 SF DC RUN STOP Figure 3-2 RUN-P RUN STOP MRES Options for Downloading a Program to the Simulated PLC PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 3-3 Running a Program on the Simulated PLC 3.3 Selecting Simulation Options Selecting Execution Options You select the program execution options with the Execute menu commands. You can also access these options with the toolbar buttons, as shown in Figure 3-3. These options control the execution of the program: S Continuous Scan: The CPU executes one complete scan and then starts another scan. Each scan consists of the CPU reading the peripheral inputs (PI), executing the program, and then writing the results to the peripheral outputs (PQ). S Single Scan: The CPU executes one scan and then waits for you to initiate another scan. Each scan consists of the CPU reading the peripheral inputs (PI), executing the program, and then writing the results to the peripheral outputs (PQ). Using the Pause Function The Pause function allows you to halt the execution of a program temporarily. Unlike placing the CPU into STOP mode (which restarts the execution of the program at the first instruction in your program when you return to RUN mode), halting the execution of a program lets you resume the execution at the instruction where you halted the program. You can turn the Pause function on and off with the Execute " Pause menu command, or you can use the toolbar button, as shown in Figure 3-3. Cycling Power On and Off You can simulate turning power on and off for the CPU. This allows you to check the different startup OBs. Use the PLC " Power Off/Power On menu commands to cycle power. (You must turn the power on before you change the node address for the CPU.) S7-PLCSIM Toolbar Next Scan Single Scan Pause Continuous Scan Figure 3-3 3-4 Toolbar Buttons for Program Execution Options PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Running a Program on the Simulated PLC 3.4 Accessing Data in the Simulated PLC Overview You can access data in the simulated PLC with the “view objects” provided by the main S7-PLCSIM window, or with the standard STEP 7 tools for monitoring program status, or a combination of both. Using the S7-PLCSIM View Objects View objects allow you to monitor the program by displaying the values or the states of the variables used by the program. Some view objects are read-only; others allow you to change the values of specific memory locations. S7-PLCSIM provides view objects for the following types of data: Variable data. This view object allows you to display or modify the values of timers, counters, I/O bits, or other memory locations. The following view objects can provide useful information for debugging a program when used with the breakpoint function in STEP 7: Accumulators and the status word. The read-only “ACCUs & Status Word” view object accesses the contents of the accumulators and the values stored in the pointer address registers (AR1 and AR2). It also displays the states of the status word bits. Block registers. The read-only “Block Regs” view object accesses the contents of the data block address registers (DB1 and DB2). It also displays the identity of the logic block being executed and the step address counter (SAC). Stacks (nesting stack and MCR stack). The read-only “Stacks” view object accesses the contents of the nesting stack, which consists of the RLO bit and the OR bit of the status word. (The nesting stack shows the state of the status word for each instruction in the logic string.) This view object also shows the state of the MCR (master control relay) stack. There is no restriction on the number of view objects that you can create and display. For more information on using view objects, see Chapter 4. Create “Variable” view object Figure 3-4 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Create “Stacks” view object Create “ACCUs & Status Word” view object Create “Block Regs” view object Toolbar Buttons for Creating View Objects 3-5 Running a Program on the Simulated PLC Using the STEP 7 Tools You can use the STEP 7 tools to monitor and modify the program that is being executed by the simulated CPU. This allows you to create and test a variable table (VAT) or to use the debugging tools provided by STEP 7. For more information about the STEP 7 tools, see the STEP 7 User Manual or the manual for your programming language. Remember to disconnect any STEP 7 tool before closing the simulated CPU or exiting the S7-PLCSIM application. Note Using the Pause function can cause the STEP 7 tools to disconnect from the simulated PLC because of a time-out while STEP 7 waits for a request to be acknowledged. After you turn Pause off, you can reconnect the STEP 7 tool. Using a Variable Table to Monitor or Modify Data You can use a variable table (VAT) to monitor the status of any variable in your program. You can also modify the variables which are defined for the VAT. You can use the simulated CPU to test a VAT that is being prepared as an interface. Figure 3-5 shows a sample VAT for the S7_ZEBRA program. S7_ZEBRA\SIMATIC 300–Station1\CPU314(1)\S7–Program(1)...\VAT1 Address Monitor Format Monitor Value Modify Value Q 0.1 “Ped_green” BIN ––– Q 0.5 “Car_red” BIN ––– Q 0.6 “Car_orange” BIN ––– Q 0.7 “Car_green” BIN ––– T 4 “Car_delay_red” SIMATIC_TIME S5T#0ms T 5 “Car_red_orange_phase” SIMATIC_TIME S5T#0ms T 6 “Ped_delay_green” SIMATIC_TIME S5T#0ms I 0.0 “Switch_right” BIN 2#1 I 0.1 “Switch_left” BIN 2#1 Figure 3-5 3-6 Symbol Example of a STEP 7 Variable Table (VAT) PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Running a Program on the Simulated PLC 3.5 Opening, Saving, and Closing the Simulated PLC Opening a Simulated PLC You can open a simulated PLC in one of the following ways: S With the Simulation On/Off button on, you can download a program from the SIMATIC Manager or the program editor. S If you have already saved one or more simulated PLCs to a file, you can open a specific PLC by using the Simulation " Open menu command. Note S7-PLCSIM supports only one simulated PLC at a time. Saving the Configuration of a Simulated PLC Use the Simulation " Save or Simulation " Save As... menu command to archive a simulated PLC. The following elements are saved with the PLC: S Program S CPU operating mode (RUN-P, RUN, or STOP) S Power state (on or off) S Execution control option (continuous scan or single scan) S The status of the I/O (PI and PQ memory areas) S Timer values Saving the Layout of View Objects To save the layout of the view objects you have inserted for the simulated PLC, select the menu command Simulation " Layout Save.... Any time you reopen a saved simulated PLC, you can also open a saved layout using the Simulation " Layout Open... menu command. Closing the Simulated PLC You can close a PLC either by selecting the Simulation " Close menu command or by clicking on the button in the top-right corner of the CPU view object. Closing the simulated PLC ends the simulation of the program, but does not exit the S7-PLCSIM application. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 3-7 Running a Program on the Simulated PLC 3-8 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Monitoring and Modifying Data with the View Objects Overview 4 S7-PLCSIM provides view objects that allow you to display the following information: Variable data, such as timers, counters, inputs, and outputs Accumulators and status word Address registers Nesting stack and MCR stack Any change made by a view object affects the program immediately. When you use a STEP 7 variable table to change a value, the CPU reads that change at the beginning of the next scan. Chapter Overview Section Description Page 4.1 Controlling the CPU 4-2 4.2 Monitoring and Modifying the Data Used by the Program 4-4 4.3 Displaying the Symbolic Addresses 4-6 4.4 Accessing the Accumulators, Status Word, and Address Registers 4-7 4.5 Monitoring the Block Registers 4-8 4.6 Monitoring the Data in the CPU Stacks 4-9 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 4-1 Monitoring and Modifying Data with the View Objects 4.1 Controlling the CPU Using the CPU View Object After you download a program, the S7-PLCSIM application window displays a CPU view object that has the same node address as the downloaded program. Figure 4-1 shows a sample CPU view object. From this view object, you can perform the following functions: Change the CPU operating mode (STOP, RUN, and RUN-P) Reset the CPU memory (MRES) Displaying the Status of the CPU A real CPU provides LED indicators for displaying the status of the CPU. The CPU view object also provides the following indicators that display the CPU status: SF (system fault) indicates an error condition. DC (power supply) indicates that power to the CPU is on. RUN indicates that the CPU is in RUN mode. STOP indicates that the CPU is in STOP mode. For more information about the S7-300 and S7-400 CPUs, refer to the System Software for S7-300 and S7-400 Program Design Programming Manual or to the online help for STEP 7. CPU 300/400 SF DC RUN STOP CPU status indicators Figure 4-1 4-2 CPU operating mode controls RUN-P RUN STOP MRES CPU View Object PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Monitoring and Modifying Data with the View Objects Changing the CPU Operating Mode The check boxes on the CPU view object allow you to change the CPU operating modes: S In STOP mode, the CPU is not executing the program. To download a program that includes SDBs or to change the node address, you must place the CPU in STOP mode. Unlike a real CPU, placing the CPU in STOP mode does not change the state of the outputs (PQ). S In RUN mode, the CPU executes the program. As with a real CPU, you cannot download any new programs or logic blocks when the CPU is in RUN mode. You can use the STEP 7 tools to monitor (but not to modify) the variables. S In RUN-P mode, the CPU executes the program. When the CPU is in RUN-P mode, you can download new programs or logic blocks, and you can modify the variables with the STEP 7 tools. To change the CPU mode, click on the box for STOP, RUN, or RUN-P. The CPU status indicators show whether the CPU is in RUN (or RUN-P) mode or in STOP mode. Resetting the CPU Memory (MRES) The CPU view object provides an MRES button for resetting the memory of the CPU. When you reset the CPU memory, the simulated CPU performs the following tasks: S The memory areas are reset. S The program blocks are deleted. Use the following procedure to reset the CPU memory: 1. Place the CPU in STOP mode. 2. Click on the MRES button, or select the menu command PLC " Clear/Reset. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 4-3 Monitoring and Modifying Data with the View Objects 4.2 Monitoring and Modifying the Data Used by the Program You can create view objects that access the data stored in the different memory areas of the simulated CPU. S7-PLCSIM provides view objects that contain default addresses for a timer, a counter, an input, and an output. You can also create a generic view object to access the data stored in other memory areas. Accessing the Data Stored in the CPU Memory The view objects that you create with the Insert menu commands allow you not only to display the contents of the different memory areas within the CPU, but also to modify those values and immediately see the effect on your program. When you change a value in a data field, press ENTER for it to be accepted. You can use these view objects to access not only the inputs and outputs, but also the timers, counters, and the data used by the program. Table 4-1 lists the memory areas that can be accessed. For more information about the memory areas, refer to the System Software for S7-300 and S7-400 Program Design Programming Manual or to the online help for STEP 7. Note The peripheral input (PI) memory area overwrites the input (I) memory area at the beginning of every CPU scan. If you use the view object to modify a value in the I memory area, that value is overwritten at the beginning of the next scan. To enter an input value that will not be overwritten on every scan, enter the value to the PI memory area. Table 4-1 Memory Areas for the S7-300 and S7-400 CPUs Memory Area PI peripheral (external) input Description The CPU writes the PI memory to the I memory at the beginning of each scan. PQ peripheral (external) output The CPU writes the Q memory to the PQ memory at the end of every scan. I process-image input The I memory area is overwritten by the PI memory area at the beginning of every scan. Q process-image output The Q memory area overwrites the PQ memory area at the end of each scan. M bit memory The M memory area provides storage for interim results calculated in the program. T timer The T memory area provides the timers used by the program. C counter The C memory area provides the counters used by the program. DB data block 4-4 The DB memory address references the data stored in the data blocks for the program. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Monitoring and Modifying Data with the View Objects Creating View Objects for Accessing Program Data To create view objects for monitoring and modifying the data used by the program, use the Insert menu commands. Figure 4-2 shows several examples of the view objects. Use the following procedure to access a memory address with a view object: 1. Enter the memory address to be accessed and press ENTER. For example: “PIB0” accesses byte 0 of the PI memory area and “T 2” accesses timer 2. 2. Use the drop-down list box to select the appropriate representation for the data that will be displayed or entered (such as binary, decimal, or hexadecimal). PIB PIB 7 0 T 0 6 T Bits 5 4 3 2 1 2 2 0 0 ms PIW PIW 0 0 PIW PIW Decimal 8 8 Hex 0 Figure 4-2 Using the View Objects to Modify Data T=0 0 Variable View Objects Use the following guidelines to modify data in the view objects: When you select bit format for a variable such as a peripheral input byte, the eight check boxes correspond to bits 0 through 7. To activate any of the bits in the view object, click on the corresponding check box to change the state from off to on (0 to 1). A check mark appears, indicating a state of 1 or on. Clear the check box to turn the bit off. For variables that you specify as bytes, words, or double words, use the drop-down list box to select the appropriate representation for the data that you want to enter (such as binary, decimal, or hexadecimal). Enter the value in the text field in the corresponding format and press ENTER. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 4-5 Monitoring and Modifying Data with the View Objects 4.3 Displaying the Symbolic Addresses Selecting the Symbol Table You can display the symbol names assigned to the absolute addresses in any of the view objects of your simulated PLC. To establish a link to the symbol table associated with the downloaded program, follow these steps: 1. Select the menu command Options Show Symbols... 2. Use the browser dialog box to select the symbol table associated with the downloaded program. 3. Click on the “OK” button to confirm the selection. Showing Symbol Names in View Objects To show the symbol name associated with an element in your program, follow these steps: 1. Select the view object of a variable that you want to display with its symbol name. 2. With the cursor in the address field, click the right mouse button to open a pop-up menu. 3. Select Show Symbol from the menu. (If there is no symbol name associated with the variable, Show Symbol is unavailable.) You can point to any address that has a symbol name associated with it and see the full symbol name in a tool tip. For bits of a byte address, the only way to see the symbol names is to display the tool tip for each bit check box. Figure 4-3 shows examples of view objects with the symbol names displayed in the address field. Note that the absolute address is still displayed in the title bar of the view object. Q Click the right mouse button. Q 7 Undo 0.1 Cut Bits Copy 0.1 6 5 Paste 3 2 1 Delete 4 0 Select All Select Q 0.1 T Ped_green 7 6 5 ✓ Show Symbol Bits 4 3 2 1 4 Car_delay_red 0 0 ms Figure 4-3 4-6 T=0 Showing Symbol Names for Program Elements PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Monitoring and Modifying Data with the View Objects 4.4 Accessing the Accumulators, Status Word, and Address Registers You can display the contents of the accumulators, the status word, and the address registers in the CPU by opening the “ACCUs & Status Word” view object. Select the menu command View Accumulators to open this view object. Figure 4-4 shows the “ACCUs & Status Word” view object. For more information about the status word and the accumulators for the S7-300 and S7-400 CPUs, refer to the System Software for S7-300 and S7-400 Program Design Programming Manual or to the online help for STEP 7. ACCUs & Status Word Accumulators 1 100 2 300 Dec 3 0 4 0 Address Registers 1 0 2 0 Figure 4-4 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Hex Status Word 8 BR CC 1 7 6 CC 0 5 OV 4 OS 3 OR 2 STA 1 RLO /FC 0 Accumulators and Status Word View Object 4-7 Monitoring and Modifying Data with the View Objects 4.5 Monitoring the Block Registers Displaying the Contents of the Block Registers You can view the contents of the data and logic block registers by opening the “Block Regs” view object. Select the menu command View Block Registers to open this view object. Figure 4-5 shows the “Block Regs” view object. For more information about the block registers for the S7-300 and S7-400 CPUs, refer to the System Software for S7-300 and S7-400 Program Design Programming Manual or to the online help for STEP 7. Block Regs Data Block 1 0 2 0 Figure 4-5 4-8 Logic Block 1 OB 1 SAC 16 2 0 0 Block Registers View Object PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Monitoring and Modifying Data with the View Objects 4.6 Monitoring the Data in the CPU Stacks Monitoring the Nesting Stack and the MCR Stack The “Stacks” view object displays the status of both the nesting stack and the master control relay (MCR) stack. These stacks help you to monitor the state changes of individual instructions in your program: S The nesting stack stores up to seven entries. For each entry, the nesting stack stores the states of the RLO and OR bits of the status word for the And (A), And Not (AN), Or (O), Or Not (ON), Exclusive Or (X), and Exclusive Or Not (XN) instructions. S The MCR stack stores up to eight levels of nesting for an MCR. To create the view object for viewing the nesting stack and the MCR stack, use the View " Stacks menu command. Figure 4-6 shows the “Stacks” view object. Refer to the Statement List (STL) for S7-300 and S7-400 Programming Manual for more information about the nesting stack and the MCR stack. Stacks Nesting Stack RLO OR 1 2 3 4 5 6 7 Figure 4-6 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 MCR MA bit RLO 0 1 2 3 4 5 6 7 Stacks View Object 4-9 Monitoring and Modifying Data with the View Objects 4-10 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 A Troubleshooting Table A-1 Troubleshooting Problem Your program does not download to the simulated PLC. Possible Cause Verify that the CPU is in either STOP mode or RUN-P mode. As with a real CPU, you cannot download your program if the simulated CPU is in RUN mode. Also, you cannot download your program when the simulated CPU is in Pause mode. If your program contains an SDB, verify that the CPU is in STOP mode. As with a real CPU, you can download SDBs only when the simulated CPU is in STOP mode. Verify that the CPU and the program use the same node address. As with a real MPI network, the node address defined for the program must match the node address of the CPU. When you download a program and there is no simulated PLC connected to STEP 7, S7-PLCSIM creates a simulated PLC with the correct node address for the program; however, if there is already a simulated PLC connected to STEP 7 and the node address does not match the node address for the program, STEP 7 displays an error message. When you attempt to close the simulated If you attempt to close the simulated PLC while one of the STEP 7 tools PLC, a message alerts you that there is a (such as a variable table) is monitoring the program, STEP 7 alerts you to connection open. disconnect the STEP 7 tool from the simulated PLC. Always disconnect any STEP 7 tool by turning off the monitoring of the program status or by closing the tool before closing the simulated PLC. You enter an input value for the simulated PLC, but this value is overwritten. If you want the input value to remain from one scan to the next, use the peripheral input (PI) memory area instead of the input memory area. As with a real CPU, the simulated CPU writes the state of the process image (containing the peripheral input memory) to the input memory area. Even though there are no input modules in the simulated PLC, the process image contains “data” (a value of 0) that corresponds to the PI memory. The input (I) memory area is always overwritten by the PI memory at the beginning of every scan. The S7-PLCSIM application does not First, check to see if Single Scan execution control or the Pause function respond and appears to have “locked up.” is on. Either one can appear as a lock-up. Turn off Pause, or select Continuous Scan mode. If the software does not respond to one of the actions above, press the Ctrl+Alt+Del keys simultaneously, and end the S7-PLCSIM application. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 A-1 Troubleshooting A-2 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 B S7 Reference Information Overview S7-PLCSIM provides view objects for accessing the information stored in the simulated CPU. You can access any of the memory areas, using the standard S7/STEP 7 notation for entering the memory addresses. This appendix provides descriptions of the memory areas, accumulators, and address registers. It also provides a quick reference for the different formats for displaying or modifying the data. Chapter Overview Section Description Page B.1 Memory Areas for the S7-300 and S7-400 CPUs B-2 B.2 S7-PLCSIM Notation for Entering Data B-4 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 B-1 S7 Reference Information B.1 Memory Areas for the S7-300 and S7-400 CPUs Figure B-1 shows the memory areas, accumulators, address registers, and the status word for the S7-300 and S7-400 CPUs. S7-PLCSIM uses the view objects to access the values stored in the simulated CPU. Table B-1 describes the different memory areas. CPU Accumulators and Registers Accumulators 32 bits Memory Areas Peripheral I/O PI, PQ Accumulator 1 (ACCU 1) Accumulator 2 (ACCU 2) Accumulator 3 (ACCU 3) S7-400 only Accumulator 4 (ACCU 4) S7-400 only Address Registers Outputs Q Inputs I Bit Memory M Timers T Counters C 32 bits Address Register 1 (AR1) Executable user program: Logic blocks Data blocks Address Register 2 (AR2) Data Block Registers 32 bits DB number for the open DB DB number for the open instance DB (DI) Status Word Status bits 16 bits Local data for the current block L Figure B-1 Memory Areas for the S7-300 and S7-400 CPUs B-2 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 S7 Reference Information Table B-1 Memory Areas for the S7-300 and S7-400 CPUs Name Input (I) Memory Area Process-image input table Function of Memory Area At the beginning of the scan cycle, the operating system reads the inputs from the process and records the values in this table. The program uses these values in its normal processing. For every CPU cycle, Input memory stores the state of the inputs in the process-image input table. The process-image input table maps the first 512 bytes of the peripheral input memory. Output (Q) Process-image output table During the scan cycle, the program calculates output values and places them in this table. At the end of the scan cycle, the operating system reads the calculated output values from this table and sends them to the process outputs. The process-image output table maps the first 512 bytes of the peripheral output memory. Bit memory (M) Memory bits This area provides storage for interim results calculated in the program. You designate whether the data are to be accessed as bits, bytes, words, etc. Peripheral input (PI) I/O: external inputs Peripheral memory allows direct access to the field devices (physical, or external, inputs and outputs). Peripheral output (PQ) I/O: external outputs Peripheral memory can be accessed in byte, word, and double-word format, but not as bits. Timer (T) Timer This area provides storage for timer cells. Clock timing accesses the time cells in this area to update them by decrementing the time value. Timer instructions access the time cells here. Counter (C) Counter This area provides storage for counters. Counter instructions access them here. Data block (DB) Part of the program DBs store the information for the program. PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 B-3 S7 Reference Information B.2 S7-PLCSIM Notation for Entering Data The “Variables” view object provides a variety of formats for displaying or entering the data in your program. The formats allowed are determined by the size entered with the address: byte (B), word (W), or double word (D). Table B-2 lists the formats that are available. Table B-2 Data Formats for the “Variables” View Object Data Format B-4 Size Example Bits B Binary B and W 10010011 Decimal B, W, and D 232 Hex (hexadecimal) B, W, and D 9A S7 Format B, W, and D D#16#09A2FF23 Integer W and D 623, –2370 BCD (binary-coded decimal) W and D 400 Real D –2134.232323 = off = on PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Index A Accessible nodes location of button, 3-2 viewing the simulated PLCs, 3-2 Accessing the CPU memory areas, 4-4 Accumulators, 4-7, B-2 Address registers (AR1 and AR2), 4-7, B-2 Addresses, symbolic or absolute, 4-6 Assistance, technical, iv Authorization, 1-4, 1-7 original disk, 1-5 transfer, 1-5 AUTHORS.EXE, 1-5 B BCD (binary-coded decimal), format, B-4 Binary data, format, B-4 Bit memory area of memory, description, B-2 Blocks, FBs, FCs, DBs, OBs, 1-3 CPU, continued resetting the memory (MRES), 4-3 using a variable table, 2-6, 3-6 CPU scan continuous scan, 3-4 single scan mode, 3-4 Creating view objects, 4-5 Cycling power, 3-4 D Data block (DB), 4-8 description as area of memory, B-2 Data formats, B-4 Decimal data, format, B-4 Diagnostic information, 1-3 Differences between simulated and real PLCs, 1-3 Disconnecting STEP 7 tools before closing CPU, 3-6 Downloading a program, 3-3 selecting the simulator, 3-2 C Changing the CPU operating mode, 4-3 Changing the node address, turning the power off, 3-4 Closing the simulated PLC, 3-7 Continuous scan, 3-4 Controlling the execution of a program, simulator options, 3-4 Copy-protection, 1-4 Counters, accessing counter data, 4-4 CPU areas of memory, B-2 changing operating modes, 4-3 cycling power, 3-4 disconnect STEP 7 tools before closing, 3-6 downloading a program, 3-3 indicators, 4-2 memory areas, 4-4 memory reset (MRES), 4-3 opening a CPU view object, 3-7 operating modes, 4-3 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 E Entering data, B-4 Errors, during installation, 1-7 Execution control, selecting type of, 3-4 Exiting the application, 3-7 F Features supported, 1-2, 1-3 H Halting the program effect of Pause on STEP 7 tools, 3-6 Pause, 3-4 Hardware requirements, 1-1 Hexadecimal data, format, B-4 Index-1 Index I I/O memory supported, 1-3 Input area of memory, description, B-2 Inputs setting bits, 2-4, 4-5 turning on and off, 4-4 Installation error, 1-7 overview, 1-1 requirements, 1-1 Installing, PLCSIM, 1-6 Integer, format, B-4 L L Stack, description of temporary local memory, B-2 Ladder logic program, monitoring status, 2-7 Layout of view objects, saving, 2-5 LEDs (status indicators), 4-2 Logic blocks supported, 1-3 M Manuals, STEP 7 set, iii–iv Master control relay. See MCR stack MCR stack, 3-5, 4-9 Memory areas, 4-4 Memory bits supported, 1-3 Memory requirements, 1-1 Memory reset (MRES), 4-3 Modes, changing CPU operation, 4-3 Monitoring and modifying data, 4-4 Monitoring and modifying the program using a variable table, 2-6, 3-6 using view objects, 2-4–2-5, 3-5 MPI address. See Node address MRES. See Memory reset (MRES) N Nesting stack, 3-5, 4-9 Node address only one PLC at a time, 3-7 turning the power off before changing, 3-4 O Opening a layout, 2-5 Opening a PLC, 3-7 Index-2 Operating modes, changing CPU, 4-3 Operating system requirements, 1-1 Options, simulation, 3-4 Organization blocks (OBs) supported, 1-3 Output area of memory, description, B-2 Outputs, accessing Q and PQ memory, 4-4 Overview installation, 1-1 product features, 1-2 P Pause function, 3-4 with STEP 7 tools, 3-6 Peripheral input and output areas of memory accessing, 4-4 description, B-2 PLC closing, 3-7 opening, 3-7 saving configuration, 3-7 PLCSIM errors during installation, 1-7 Installation, 1-6 Power on/off CPU indicator, 4-2 cycling power, 3-4 Product overview, 1-2 Program editor downloading a program, 3-3 monitoring status, 2-7 R Real number, format, B-4 Requirements, for installing PLCSIM, 1-1 Resetting the CPU memory, 4-3 Resetting timers, 2-5 RUN mode changing the CPU mode to, 4-2 CPU indicator, 4-2 Running a program, 2-4–2-5 RUN-P mode, changing the CPU mode to, 4-2 S S7 format, B-4 Sample program, running, 2-4–2-5 Saving a layout of view objects, 2-5 the PLC configuration, 3-7 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Index Scan modes, 3-4 Showing symbol names, 4-6 SIMATIC Manager downloading a program, 3-3 selecting the simulator, 3-2 Simulation session, turning on and off, 3-2 Simulator button, SIMATIC Manager, 3-2 Simulator options continuous scan, 3-4 Pause, 3-4 single scan mode, 3-4 Single scan mode, 3-4 Stacks, 3-5, 4-9 Starting the program, 2-4 Status indicators (LEDs), 4-2 Status word, 4-7 STEP 7 manuals, iii–iv STEP 7 tools disconnect before closing CPU, 3-6 monitoring logic execution, 2-7 variable table (VAT), 2-6, 3-6 STOP mode changing the CPU mode to, 4-2 CPU indicator, 4-2 Stop mode, before resetting CPU memory (MRES), 4-3 Symbol names for addresses, 4-6 System fault (SF), CPU indicator, 4-2 System functions (SFCs) supported, 1-3 Timers accessing timer data, 4-4 creating, 2-3 execution times, 1-3 resetting, 2-5 Toolbar buttons in PLCSIM window, 2-4, 3-4, 3-5 in SIMATIC Manager, 2-2, 3-2 U Uninstalling, PLCSIM, 1-6 Using STEP 7 tools, 2-6–2-7 V Variable table, monitoring and modifying the program, 2-6, 3-6 Variables, modifying data, 4-5 Variables view object, data formats, B-4 VAT. See Variable table View object accessing data in memory, 4-4–4-5 accumulators, 3-5 block registers, 3-5 CPU, 3-7, 4-2 saving the PLC, 3-7 stacks, 3-5, 4-9 variable, 3-5 T Technical assistance, iv Timer area of memory, description, B-2 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 W Windows 95 operating system, 1-1 Index-3 Index Index-4 PLC Simulation for S7-300 and S7-400 C79000-G7076-C201-01 Siemens AG AUT E 146 Östliche Rheinbrückenstr. 50 D–76181 Karlsruhe Federal Republic of Germany From: Your Name: _ _ _ _ Your Title: _ _ _ _ Company Name: _ Street: _ City, Zip Code_ Country: _ Phone: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Please check any industry that applies to you: Automotive ❒ Pharmaceutical ❒ Chemical ❒ Plastic ❒ Electrical Machinery ❒ Pulp and Paper ❒ Food ❒ Textiles ❒ Instrument and Control ❒ Transportation ❒ Nonelectrical Machinery ❒ Other _ _ _ _ _ _ _ _ _ _ _ ❒ Petrochemical ✄ ❒ PLC Simulation for S7-300 and S7-400 6ES7841-0AA00-8BA0-01 1 Remarks Form Your comments and recommendations will help us to improve the quality and usefulness of our publications. Please take the first available opportunity to fill out this questionnaire and return it to Siemens. Please give each of the following questions your own personal mark within the range from 1 (very good) to 5 (poor). 1. Do the contents meet your requirements? 2. Is the information you need easy to find? 3. Is the text easy to understand? 4. Does the level of technical detail meet your requirements? 5. Please rate the quality of the graphics/tables: Additional comments: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ PLC Simulation for S7-300 and S7-400 6ES7841-0AA00-8BA0-01 _ _ _ _ _ _ _ _ _ _ _ _
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
advertisement