Beruflich Dokumente
Kultur Dokumente
4
07/2011
A5E00992430-02
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific task in accordance with the relevant documentation, in particular its warning notices and safety instructions. Qualified personnel are those who, based on their training and experience, are capable of identifying risks and avoiding potential hazards when working with these products/systems.
Trademarks
All names identified by are registered trademarks of Siemens AG. The remaining trademarks in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the information in this publication is reviewed regularly and any necessary corrections are included in subsequent editions.
A5E00992430-02 05/2011
Table of contents
1 2 Introduction................................................................................................................................................ 5 S7ProSim overview ................................................................................................................................... 7 2.1 2.2 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 Adding an S7ProSim COM object to your project..........................................................................7 Programming an interface to S7-PLCSIM with S7ProSim.............................................................8 BeginScanNotify ..........................................................................................................................13 Connect........................................................................................................................................14 ConnectExt...................................................................................................................................15 Continue.......................................................................................................................................16 Disconnect ...................................................................................................................................17 EndScanNotify .............................................................................................................................18 ExecuteNmsScan ........................................................................................................................19 ExecuteNScans ...........................................................................................................................20 ExecuteSingleScan......................................................................................................................21 GetPauseState.............................................................................................................................22 GetScanMode ..............................................................................................................................23 GetStartUpSwitch ........................................................................................................................24 GetState .......................................................................................................................................25 HotStartWithSavedValues ...........................................................................................................26 Pause ...........................................................................................................................................27 ReadDataBlockValue...................................................................................................................28 ReadFlagValue ............................................................................................................................30 ReadOutputImage........................................................................................................................32 ReadOutputPoint .........................................................................................................................34 SavePLC ......................................................................................................................................36 SetScanMode...............................................................................................................................37 SetStartUpSwitch.........................................................................................................................38 SetState .......................................................................................................................................39 StartPLCSim ................................................................................................................................40 StartPLCSimExt ...........................................................................................................................41 WriteDataBlockValue ...................................................................................................................42
Methods................................................................................................................................................... 11
Table of contents
3.27 3.28 3.29 4 4.1 4.2 4.3 4.4 4.5 5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10
WriteFlagValue............................................................................................................................ 44 WriteInputImage.......................................................................................................................... 46 WriteInputPoint............................................................................................................................ 47 ConnectionError .......................................................................................................................... 49 PauseStateChanged ................................................................................................................... 49 PLCSimStateChanged ................................................................................................................ 50 ScanFinished .............................................................................................................................. 50 ScanModeChanged .................................................................................................................... 50 Type definitions ........................................................................................................................... 51 CPURunMode ............................................................................................................................. 51 ImageDataTypeConstants .......................................................................................................... 52 PauseStateConstants ................................................................................................................. 52 PointDataTypeConstants ............................................................................................................ 53 RestartSwitchPosition ................................................................................................................. 53 ScanModeConstants................................................................................................................... 54 tagPauseState............................................................................................................................. 54 ScanInfo constants...................................................................................................................... 55 Error return codes ....................................................................................................................... 55
Events...................................................................................................................................................... 49
Type definitions........................................................................................................................................ 51
Index........................................................................................................................................................ 57
S7ProSim V5.4
Introduction
S7ProSim provides programmatic access to the simulated PLC in S7-PLCSIM. With S7ProSim, you can write software to perform such tasks as changing the key-operated switch position of the simulated PLC, running the control program in single scan mode, reading or writing controller values, and many other work steps.
Target group
This manual is aimed at developers, programmers and maintenance personnel with knowledge of and experience in the areas of programmable S7 controllers and software development in Visual Basic (6.0 or .NET) or Visual C++ (6.0 or .NET).
Other manuals
For additional information, refer to the STEP 7 and S7-PLCSIM online help and the following manuals: Programming with STEP 7 manual. This manual provides the basic information on designing and creating control programs. Use this manual when you are designing a control program with the STEP 7 automation software. System Software for S7-300/400, System and Standard Functions reference manual. In this manual, you can find descriptions of system functions, organization blocks and standard functions which you use when developing a control program. Working with STEP 7, Getting Started. This manual describes how you work the the STEP 7 automation software. It gives you an overview of the procedures for configuring a PLC and developing control programs. S7-PLCSIM - Testing your S7 CPU Program. This manual describes the user interface and functionality of S7-PLCSIM, the S7-SPS simulator. You can find this and other manuals by selecting the menu command Start > SIMATIC > Documentation in the Windows start menu of the computer on which STEP 7 is installed.
Additional support
If you have technical questions or you require information on ordering this product or on training courses, please contact your Siemens representative.
Introduction
S7ProSim V5.4
S7ProSim overview
S7ProSim provides a COM object for program-controlled access to the process simulation user interface of S7-PLCSIM. You can use S7ProSim in any application that supports COM objects for attachment to an S7-PLCSIM process simulation. This online document describes how to add S7ProSim to an application. It also explains the features, user interface, and functions of S7ProSim as well as the software object definitions of the methods and events.
2.1
Procedure
In Microsoft Visual Basic (6.0 or .NET), for example, follow these steps to add an S7ProSim COM object reference: 1. Select the Project > References or Project > Add Reference menu command. 2. In the "References" dialog, select the check box for the Siemens S7ProSim COM object. (IN Visual Basic .NET, this selection is on the "COM" tab of the "References" dialog.) 3. Click "OK". After you add the project reference, you can use the Object Browser to view the methods and events of the S7ProSim COM object. From the Object Browser, select S7PROSIMLib from the drop-down list of libraries. The S7ProSim class contains the methods and events that you can use to program an interface to S7-PLCSIM. In Microsoft Visual Studio C++ V6.0 or in Microsoft Visual C++ .NET, follow the relevant procedure in the specific programming environment to add a COM object. In Microsoft Visual C# .NET, you can add a reference to an S7ProSim COM object by following these steps: 1. Select the Project > Add reference menu command. 2. In the "COM" tab, select the component "Siemens S7ProSim COM Object". 3. Confirm your selection with "OK". 4. End the dialog with "OK".
2.2
Procedure
To use S7ProSim for program-controlled operation of the controller simulated in S7-PLCSIM, you need to perform these tasks: 1. Include the Siemens S7ProSim COM Object in the project. 2. Add a declaration for S7ProSim to your project. Example: Visual Basic 6.0
Option Explicit Private WithEvents S7ProSim As S7PROSIMLib.S7ProSim ... Private Sub Form_Load() Set S7ProSim = New S7PROSIMLIB.S7ProSim ... End Sub
// released // when the application shuts down IS7ProSim * GetPtr() { return m_pProSim; }; // Attributes
S7ProSim V5.4
protected: // IProSimPtr is a CComPtr (smart ptr) for the IProSim // interface // It is from the dll file from #import // CoCreateInstance will be called automatically for the ptr object // in the constructor // of this class // The release of ptr is automatically called by the destructor // of this class IS7ProSimPtr }; m_pProSim;
Example: C#
using S7PROSIMLib; ... private S7ProSim ps; // create the COM Object connection ps = new S7ProSim();
Note In Visual Basic .NET, the "DoEvents" call is not necessary. 4. Add command buttons, text boxes or other objects to your application as needed to access the various S7ProSim methods. Program the code for each command button handler to call S7ProSim methods and set suitable values for text boxes as appropriate for your application.
S7ProSim V5.4
10
Methods
3
Method BeginScanNotify (Page 13) Description Registers S7ProSim for callbacks from the controller. The ScanFinished and PLCSimStateChanged events will be sent when these events occur. Connects S7ProSim to S7-PLCSIM. Connects S7ProSim with the S7-PLCSIM instance with number InstanceNumber. Continues a simulation that has been paused. Disconnects S7ProSim from S7-PLCSIM. Unregisters S7ProSim for callbacks from the controller. The ScanFinished and PLCSimStateChanged events will not be sent. Forces S7-PLCSIM to execute scan cycles for a specified time (Nms) without waiting for the end of the current scan. If scan notification is enabled, the program will be notified when S7-PLCSIM has finished the scans. Forces S7-PLCSIM to execute a specified number of scan cycles without waiting for the end of the current scan. If scan notification is enabled, the program will be notified when S7-PLCSIM has finished the scans. Forces S7-PLCSIM to execute one scan cycle without waiting for the end of the current scan. If scan notification is enabled, the program will be notified when S7-PLCSIM has finished the scan. Returns the current pause state of S7-PLCSIM. Reports the operating mode of S7-PLCSIM. Gets the startup setting (hot restart, warm restart, or cold start) for S7-PLCSIM Returns a string containing the current key switch position of S7-PLCSIM (RUN, RUN-P, or STOP). Sets a Boolean value to specify whether S7-PLCSIM should load saved peripheral I/O values when started in the HotStart state. In order for S7-PLCSIM to start up and load peripheral I/O, the user needs to call HotStartWithSavedValues with a value of TRUE, save the PLC program (SavePLC), and set the startup state for S7-PLCSIM to HotStart (SetStartUpSwitch). When S7-PLCSIM restarts, the peripheral I/O is loaded Pauses a simulation. Reads a particular bit, byte, word, or double word from the DB memory area of S7-PLCSIM. Reads a particular bit, byte, word, or double word from the bit memory area (M) of S7-PLCSIM.
Overview
Connect (Page 14) ConnectExt (Page 15) Continue (Page 16) Disconnect (Page 17) EndScanNotify (Page 18) ExecuteNmsScan (Page 19)
ExecuteSingleScan (Page 21) GetPauseState (Page 22) GetScanMode (Page 23) GetStartUpSwitch (Page 24) GetState (Page 25) HotStartWithSavedValues (Page 26)
11
Methods
Description Reads elements from the peripheral outputs (PQ memory area) of S7-PLCSIM.
ReadOutputPoint (Page 34) Reads a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the peripheral outputs (PQ memory area). SavePLC (Page 36) Saves the current simulated PLC data to a file. The saved data consists of the program, the hardware configuration, the key switch position as indicated by the "CPU" subwindow, the type of program execution (continuous or single scan), the I/O status, time values, symbolic addresses, and the power setting (on or off). Sets the operating mode for S7-PLCSIM. Sets the type of startup (hot restart, warm restart, or cold start) to use when S7-PLCSIM starts up. Sets the current key switch position of S7-PLCSIM (RUN, RUN-P, or STOP). Starts S7-PLCSIM with the specified PLC simulation file (saved from a previous SavePLC call). Starts an instance of S7-PLCSIM with the specified PLC simulation file (saved from a previous call). Writes a particular bit, byte, word, or double word to the DB memory area of S7-PLCSIM. Writes a particular bit, byte, word, or double word to the bit memory area (M) of S7-PLCSIM. Writes elements to the peripheral inputs (PI memory area) of S7-PLCSIM, starting at the StartIndex of the data to which pData points. Writes either a particular bit (Boolean), byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the Data variant to the peripheral inputs (PI memory area).
SetScanMode (Page 37) SetStartUpSwitch (Page 38) SetState (Page 39) StartPLCSim (Page 40) StartPLCSimExt (Page 41) WriteDataBlockValue (Page 42) WriteFlagValue (Page 44) WriteInputImage (Page 46)
S7ProSim V5.4
12
3.1
BeginScanNotify
STDMETHOD(CS7ProSim::BeginScanNotify)()
Description
Registers S7ProSim for callbacks from the controller. The ScanFinished and PLCSimStateChanged events will be sent when these events occur.
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_POWEROFF Meaning 0x00000000 : Success code 0x80004005 : Unspecified error 0x80040211 : S7ProSim is not connected to S7-PLCSIM 0x80040212 : S7-PLCSIM is powered off
13
3.2
Connect
STDMETHOD(Connect)()
Description
Connects S7ProSim with the first instance of S7-PLCSIM which has the instance number "1".
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_PLCISCONNECTED PS_E_POWEROFF Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x8004020E: S7-PLCSIM is connected 0x80040212: S7-PLCSIM is powered off
S7ProSim V5.4
14
3.3
ConnectExt
STDMETHOD (ConnectExt)(/*[in]*/ long InstanceNumber)
Description
Connects S7ProSim with the S7-PLCSIM instance with number InstanceNumber.
Parameters
InstanceNumber [in]: Number of the instance with which S7ProSim is to be connected
Error handling
Errors are reported in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_PLCISCONNECTED PS_E_POWEROFF Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x8004020E: S7-PLCSIM is connected 0x80040212: S7-PLCSIM is powered off
15
3.4
Continue
STDMETHOD(CS7ProSim::Continue)()
Description
Continues a simulation that has been paused.
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000 : Success code 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
16
3.5
Disconnect
STDMETHOD(CS7ProSim::Disconnect)()
Description
Disconnects S7ProSim from S7-PLCSIM.
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_POWEROFF Meaning 0x00000000 : Success code 0x80004005 : Unspecified error 0x80040212 : S7-PLCSIM is powered off
17
3.6
EndScanNotify
STDMETHOD(CS7ProSim::EndScanNotify)()
Description
Unregisters S7ProSim for callbacks from the controller. The ScanFinished and PLCSimStateChanged events are no longer sent.
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_POWEROFF PS_E_NOTREGISTERED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off 0x80040209: S7ProSim is not registered for callbacks from S7PLCSIM
S7ProSim V5.4
18
3.7
ExecuteNmsScan
STDMETHOD(CS7ProSim::ExecuteNmsScan)( long MsNumber)
Description
Forces S7-PLCSIM to execute scan cycles for a specified time (Nms) without waiting for the end of the current scan. If scan notification is enabled, the program will be notified when S7-PLCSIM has finished the scans. S7-PLCSIM must be in single scan mode to use this method.
Parameters
Parameters Declaration Input Description Time (in milliseconds) during which scan cycles will be executed.
MsNumber
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTSINGLESCAN PS_E_PLCNOTRUNNING PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x8004020A: Single scan program execution is not set in S7-PLCSIM 0x8004020E: S7-PLCSIM is not running 0x80040211: S7ProSim is not connected to S7-PLCSIM
19
3.8
ExecuteNScans
STDMETHOD(CS7ProSim::ExecuteNScans)( long NScanNumber)
Description
Forces S7-PLCSIM to execute a specified number of scan cycles without waiting for the end of the current scan. If scan notification is enabled, the program will be notified when S7-PLCSIM has finished the scans. S7-PLCSIM must be in single scan mode to use this method.
Parameters
Parameters Declaration Input Description Number of scan cycles to be executed.
NScanNumber
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTSINGLESCAN PS_E_PLCNOTRUNNING PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x8004020A: Single scan mode is not set in S7-PLCSIM 0x8004020E: S7-PLCSIM is not running 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
20
3.9
ExecuteSingleScan
STDMETHOD(CS7ProSim::ExecuteSingleScan)()
Description
Forces S7-PLCSIM to execute one scan cycle without waiting for the end of the current scan. If scan notification is enabled, the program will be notified when S7-PLCSIM has finished the scan. S7-PLCSIM must be in single scan mode to use this method.
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_PLCNOTRUNNING PS_E_NOTSINGLESCAN PS_E_MODENOTPOSSIBLE Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x8004020E: S7-PLCSIM is not running 0x8004020A: Single scan mode is not set in S7-PLCSIM 0x8004020C: S7-PLCSIM could not set the specified operating mode
21
3.10
GetPauseState
STDMETHOD(CS7ProSim::GetPauseState)( PauseStateConstants *pVal)
Description
Returns the current pause state of S7-PLCSIM.
Parameters
Parameters Declaration Output Description Pointer to the returned S7-PLCSIM state, which is one of the PauseStateConstants settings
pVal
Notes When called from Visual Basic or C# , the pause state is output in the function return value and there is no pVal parameter. When called from C++, the state is returned in the value to which pVal points.
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
22
3.11
GetScanMode
STDMETHOD(CS7ProSim::GetScanMode)( ScanModeConstants *pVal)
Description
Reports the operating mode of S7-PLCSIM.
Parameters
Parameters Declaration Output Description Pointer to the returned operating mode. The returned operating mode is one of the ScanModeConstants
pVal
Notes
When called from Visual Basic or C# , the operating mode is output in the function return value and there is no pVal parameter. When called from C++, the state is returned in the value to which pVal points.
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80040211: S7ProSim is not connected to S7-PLCSIM
23
3.12
GetStartUpSwitch
STDMETHOD(CS7ProSim::GetStartUpSwitch)( RestartSwitchPosition *pPos)
Description
Gets the startup setting (hot restart, warm restart, or cold start) for S7-PLCSIM.
Parameters
Parameters Declaration Output Description Pointer to S7-PLCSIM startup position value, which is one of the RestartSwitchPosition settings
pPos
Notes When called from Visual Basic or C#, the switch position is output in the function return value and there is no pPos parameter. When called from C++, the state is returned in the value to which pPos points.
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
24
3.13
GetState
STDMETHOD(CS7ProSim::GetState)( BSTR *pVal)
Description
Returns a string containing the current key switch position of S7-PLCSIM (RUN, RUN-P, or STOP).
Parameters
Parameters Declaration Output Description Pointer to the returned S7-PLCSIM key switch position value.
pVal
Notes When called from Visual Basic or C# , the state is output in the function return value and there is no pVal parameter. When called from C++, the state is returned in the value to which pVal points.
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL E_INVALID_STATE PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x00008002: Invalid state 0x80040211: S7ProSim is not connected to S7-PLCSIM
25
3.14
HotStartWithSavedValues
STDMETHOD(CS7ProSim::HotStartWithSavedValues)( BOOL val)
Description
Sets a Boolean value to specify whether S7-PLCSIM should load saved peripheral I/O values when started in the HotStart state. In order for S7-PLCSIM to start up and load peripheral I/O, the user needs to call HotStartWithSavedValues with a value of TRUE, save the PLC program (SavePLC), and set the startup state for S7-PLCSIM to HotStart (SetStartUpSwitch). When S7-PLCSIM restarts, it will then load the peripheral I/O.
Parameters
Parameters Declaration Input Description A value of TRUE indicates that S7-PLCSIM will load saved peripheral I/O data during a hot start. A value of FALSE indicates that it will not.
val
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000 : Success code 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
26
3.15
Pause
STDMETHOD(CS7ProSim::Pause)()
Description
Pauses a simulation.
Parameters
None
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000 : Success code 0x80040211 : S7ProSim is not connected to S7-PLCSIM
27
3.16
ReadDataBlockValue
STDMETHOD(CS7ProSim::ReadDataBlockValue)( long BlockNumber, long ByteIndex, long BitIndex, PointDataTypeConstants DataType, VARIANT* pData)
Description
Reads a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the memory area of a data block.
Parameters
Parameters Declaration Input Input Input Input Input, output Description Number of the data block to be read. Valid values for BlockNumber depend on the CPU. Start byte position in the data block to be read. Valid values for ByteIndex depend on the CPU. Start bit position in the data block to be read, if a Boolean value (bit) is read. Valid values for BitIndex are 0 to 7. Data type to be read. DataType must be one of the PointDataTypeConstants. Pointer to the read data. Valid values for data depend on the data type. Make sure you allocate and free this memory area in your application.
Note If the DataType is S7_Bit, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method returns the given bit in pData, and its data type variant is Boolean. If the DataType is S7_Byte, S7_Word or S7_DoubleWord, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method returns the value in pData. The data type variant is Byte, Integer, or Long, depending on the DataType.
S7ProSim V5.4
28
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_POWEROFF PS_E_BADTYPE PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_READFAILED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off 0x80040206: Invalid data type 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040203: Read operation failed
29
3.17
ReadFlagValue
STDMETHOD(CS7ProSim::ReadFlagValue)( long ByteIndex, long BitIndex, PointDataTypeConstants DataType, VARIANT* pData)
Description
Reads a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the bit memory area.
Parameters
Parameters Declaration Input Input Description Represents the start byte position in the bit memory area to be read. Valid values for ByteIndex depend on the CPU. Represents the start bit position in the bit memory area to be read, if a Boolean value (bit) is to be read. Valid values for BitIndex are 0 to 7. Represents the data type to be read. DataType must be one of the PointDataTypeConstants. Pointer to the read data. Valid values for data depend on the data type. Make sure you allocate and free this memory area in your application.
Note If the DataType is S7_Bit, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method returns the given bit in pData, and its data type variant is Boolean. If the DataType is S7_Byte, S7_Word or S7_DoubleWord, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method returns the value in pData. The data type variant is Byte, Integer, or Long, depending on the DataType.
S7ProSim V5.4
30
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_POWEROFF PS_E_BADTYPE PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_READFAILED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off 0x80040206: Invalid data type 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040203: Read operation failed
31
3.18
ReadOutputImage
STDMETHOD(CS7ProSim::ReadOutputImage)( long StartIndex, long ElementsToRead, ImageDataTypeConstants DataType, VARIANT* pData)
Description
Reads elements from the peripheral outputs (PQ memory area) of S7-PLCSIM.
Parameters
Parameters Declaration Input Input Description Represents the start byte position in the peripheral outputs for the read. Valid values for StartIndex depend on the CPU. Represents the number of bytes, words, or double words to be read from the image buffer. Valid values for ElementsToRead are dependent on the CPU. Represents the data type to be read. The DataType value must be one of the ImageDataTypeConstants. Pointer to the read data. Valid values for data depend on the data type. Make sure you allocate and free this memory area in your application.
Note If the DataType is S7_Bit, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method returns the given bit in pData, and its data type variant is Boolean. If the DataType is S7_Byte, S7_Word or S7_DoubleWord, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method returns the value in pData. The data type variant is Byte, Integer, or Long, depending on the DataType.
S7ProSim V5.4
32
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_READFAILED PS_E_BADTYPE PS_E_NOTALLREADSWORKED PS_E_NOTCONNECTED PS_E_POWEROFF Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040203: Read operation failed 0x80040206: Invalid data type 0x8004020F: Not all read operations were successful 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off
33
3.19
ReadOutputPoint
STDMETHOD(CS7ProSim::ReadOutputPoint)( long ByteIndex, long BitIndex, PointDataTypeConstants DataType, VARIANT* pData)
Description
Reads a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the peripheral outputs (PQ memory area).
Parameters
Parameters Declaration Input Input Input Input, output Description Represents the start byte position in the peripheral area for the read. Valid values for ByteIndex depend on the CPU. Represents the bit position (in bytes) in the peripheral area for the read. Valid values are 0 to 7. One of the PointDataTypeConstants Pointer to the data to be read. Valid values for data depend on the data type.
Notes If the DataType is S7_Bit, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method returns the given bit in pData, and its data type variant is Boolean. If the DataType is S7_Byte, S7_Word or S7_DoubleWord, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method returns the value in pData. The data type variant is Byte, Integer, or Long, depending on the DataType.
S7ProSim V5.4
34
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_READFAILED PS_E_BADBITNDX PS_E_BADTYPE PS_E_NOTCONNECTED PS_E_POWEROFF Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040203: Read operation failed 0x80040205: Byte index is invalid 0x80040206: Invalid data type 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off
35
3.20
SavePLC
STDMETHOD(CS7ProSim::SavePLC)( BSTR FileName)
Description
Saves the current simulated PLC data to a file. The saved data consists of the program, the hardware configuration, the key switch position as indicated by the "CPU" subwindow, the type of program execution (continuous or single scan), the I/O status, time values, symbolic addresses, and the power setting (on or off).
Parameters
Parameters Declaration Input Description Name of file in which the data of the simulated PLC will be stored
FileName
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK STG_E_CANTSAVE PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80030103: Cannot save 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
36
3.21
SetScanMode
STDMETHOD(CS7ProSim::SetScanMode)( ScanModeConstants newVal)
Description
Sets the operating mode for S7-PLCSIM.
Parameters
Parameters Declaration Input Description Operating mode to be set for S7-PLCSIM. The operating mode must be one of the ScanModeConstants.
newVal
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80040211: S7ProSim is not connected to S7-PLCSIM
37
3.22
SetStartUpSwitch
STDMETHOD(CS7ProSim::SetStartUpSwitch)( RestartSwitchPosition postion)
Description
Sets the type of startup (hot restart, warm restart, or cold start) to use when S7-PLCSIM starts up.
Parameters
Parameters Declaration Input Description Value to be set for S7-PLCSIM startup position
Position
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK PS_E_NOTCONNECTED Meaning 0x00000000 : Success code 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
38
3.23
SetState
STDMETHOD(CS7ProSim::SetState)( BSTR newVal)
Description
Sets the current key switch position of S7-PLCSIM (RUN, RUN-P, or STOP).
Parameters
Parameters Declaration Input Description Value to be set for the key switch position in S7-PLCSIM. Valid values are RUN, RUN_P, STOP and MRES
newVal
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL E_INVALID_STATE PS_E_NOTCONNECTED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x00008002: Invalid state 0x80040211: S7ProSim is not connected to S7-PLCSIM
39
3.24
StartPLCSim
STDMETHOD(CS7ProSim::StartPLCSim)( BSTR plcFile)
Description
Starts the first instance of S7-PLCSIM with the specified PLC simulation file (saved from a previous SavePLC call).
Parameters
Parameters Declaration Input Description Name of the file with which S7-PLCSIM will be started
plcFile
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL Meaning 0x00000000: Success code 0x80004005: Unspecified error
S7ProSim V5.4
40
3.25
StartPLCSimExt
STDMETHOD(StartPLCSimExt)(/*[in]*/ BSTR plcFile)
Description
Starts an instance of S7-PLCSIM with the specified PLC simulation file (saved from a previous call).
Parameters
Parameters Declaration Input Description Name of the file with which S7-PLCSIM will be started
plcFile [in]
Error handling
Errors are reported in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_MAXINSTANCE Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040214: Maximum number of open S7 PLCSIM instances reached
41
3.26
WriteDataBlockValue
STDMETHOD(CS7ProSim::WriteDataBlockValue)( long BlockNumber, long ByteIndex, long BitIndex, const VARIANT* pData)
Description
Writes a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) in the memory area of a data block.
Parameters
Parameters Declaration Input Input Input Description Represents the number of the data block to be written to. Valid values for BlockNumber depend on the CPU. Represents the start byte position in the data block to be written to. Valid values for ByteIndex depend on the CPU. Represents the start bit position in the data block to be written to, if writing a Boolean value (bit). Valid values for BitIndex are 0 to 7. Pointer to the data to be written. Valid values for data depend on the data type. Make sure you allocate and free this memory area in your application.
Input
Notes If the DataType is S7_Bit, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method writes the specified bit (pData) in the data block with the number BlockNumber. If the DataType is S7_Byte, S7_Word or S7_DoubleWord, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method writes the value in pData. The data type variant is Byte, Integer, or Long, depending on the DataType.
S7ProSim V5.4
42
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_POWEROFF PS_E_BADTYPE PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_WRITEFAILED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off 0x80040206: Invalid data type 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040204: Write operation failed
43
3.27
WriteFlagValue
STDMETHOD(CS7ProSim::WriteFlagValue)( long ByteIndex, long BitIndex, const VARIANT* pData)
Description
Writes a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) in the bit memory area.
Parameters
Parameters Declaration Input Input Description Represents the start byte position in the bit memory area to be written. Valid values for ByteIndex depend on the CPU. Represents the start bit position in the bit memory area to be written, if writing a Boolean value (bit). Valid values for BitIndex are 0 to 7. Pointer to the data to be written. Valid values for data depend on the data type. Make sure you allocate and free this memory area in your application.
Input
Notes If the DataType is S7_Bit, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method writes the specified bit (pData) in the data block with the number BlockNumber. If the DataType is S7_Byte, S7_Word or S7_DoubleWord, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method writes the value in pData. The data type variant is Byte, Integer, or Long, depending on the DataType.
S7ProSim V5.4
44
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_NOTCONNECTED PS_E_POWEROFF PS_E_BADTYPE PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_WRITEFAILED Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off 0x80040206: Invalid data type 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040204: Write operation failed
45
3.28
WriteInputImage
STDMETHOD(CS7ProSim::WriteInputImage)( long StartIndex, const VARIANT* pData)
Description
Writes elements to the peripheral inputs (PI memory area) of S7-PLCSIM, starting at the StartIndex of the data to which pData points.
Parameters
Parameters Declaration Input Input Description Represents the start byte position in the peripheral inputs for the write. Valid values for StartIndex depend on the CPU. Pointer to the data to be written by S7-PLCSIM. Valid values for the data depend on the CPU. Make sure you allocate and free this memory area in your application.
StartIndex pData
Notes The type of elements to be written is determined by the type of the elements in Data. All elements have to be the same data type. A byte array writes bytes, an integer array writes words, and a Long array writes double words. The values written are "raw" and not interpreted or converted by the method in any way. The number of elements written is determined by the size of the array to which Data points.
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_WRITEFAILED PS_E_BADTYPE PS_E_NOTALLWRITESWORKED PS_E_NOTCONNECTED PS_E_POWEROFF Meaning 0x00000000: Success code 0x80004005: Unspecified error 0x80040201: Byte index is invalid 0x80040202: Size of data array is invalid for given start byte index 0x80040204: Write operation failed 0x80040206: Invalid data type 0x80040210: Not all write operations were successful 0x80040211: S7ProSim is not connected to S7-PLCSIM 0x80040212: S7-PLCSIM is powered off
46
3.29
WriteInputPoint
STDMETHOD(CS7ProSim::WriteInputPoint)( long ByteIndex, long BitIndex, const VARIANT* pData)
Description
Writes either a particular bit (Boolean), byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the Data variant to the peripheral inputs (PI memory area).
Parameters
Parameters Declaration Input Input Input Description Represents the start byte position in the peripheral inputs for the write. Valid values for ByteIndex depend on the CPU. Represents the bit position (in bytes) in the peripheral area for the write. Valid values are 0 to 7. Pointer to the data to be written. Valid values for data depend on the data type.
Notes If Boolean is specified as the data type, then ByteIndex and BitIndex must both be set to valid indexes. If successful, the method writes the specified bit in pData. If Byte, Integer, or Long is specified as the data type, then ByteIndex must be set to a valid index (BitIndex is ignored). If successful, the method writes the elements in pData.
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value S_OK E_FAIL PS_E_BADBYTENDX PS_E_BADBYTECOUNT PS_E_WRITEFAILED PS_E_BADBITNDX PS_E_BADTYPE PS_E_NOTCONNECTED PS_E_POWEROFF Meaning 0x00000000 : Success code 0x80004005 : Unspecified error 0x80040201 : Byte index is invalid 0x80040202 : Size of data array is invalid for given start byte index 0x80040204 : Write operation failed 0x80040205 : Byte index is invalid 0x80040206 : Invalid data type 0x80040211 : S7ProSim is not connected to S7-PLCSIM 0x80040212 : S7-PLCSIM is powered off
47
S7ProSim V5.4
48
Events
4
Event ConnectionError (Page 49) PauseStateChanged (Page 49) PLCSimStateChanged (Page 50) ScanFinished (Page 50) ScanModeChanged (Page 50) Meaning Generated when unable to connect to the control engine ("S7PLCSIM") or when an error occurs with any S7ProSim method call. Generated when a Pause/Continue state change is detected. NewState is a string that represents one of the PauseStateConstants. Generated when a new PLC switch state is detected. NewState is the new operating state: "RUN", "RUN_P" or "STOP". Generated when a single scan is finished. ScanInfo provides indexed information about the scan. Generated when an operating mode change is detected. NewState is a string that represents one of the ScanModeConstants.
Overview
4.1
Description
ConnectionError
HRESULT ConnectionError(BSTR ControlEngine, long Error)
Generated when no connection can be established to the simulated PLC in S7-PLCSIM or when an error occurs when calling an S7ProSim method.
4.2
Description
PauseStateChanged
HRESULT PauseStateChanged(BSTR NewState)
Generated when a Pause/Continue state change is detected. NewState is a string that represents one of the PauseStateConstants.
49
4.3
PLCSimStateChanged
HRESULT PLCSimStateChanged(BSTR NewState)
Description
Generated when a new PLC switch state is detected. NewState is the new operating state: "RUN", "RUN_P" or "STOP".
4.4
ScanFinished
HRESULT ScanFinished(VARIANT ScanInfo)
Description
Generated when a single scan is finished. ScanInfo provides indexed information about the scan.
4.5
ScanModeChanged
HRESULT ScanModeChanged(BSTR NewState)
Description
Generated when an operating mode change is detected. NewState is a string that represents one of the ScanModeConstants.
S7ProSim V5.4
50
Type definitions
5.1 Type definitions
Type CPURunMode (Page 51) ImageDataTypeConstants (Page 52) PauseStateConstants (Page 52) PointDataTypeConstants (Page 53) RestartSwitchPosition (Page 53) ScanModeConstants (Page 54) tagPauseState (Page 54) ScanInfo constants (Page 55)
Description Constants for the scan state of the CPU RUN mode Constants for the ReadOutputImage method Constants for the pause state Constants for the ReadOutputPoint method Constants for the front panel startup switch position Constants for the operating mode Constants for the pause state Constants for information about the scan cycle
5.2
CPURunMode
enum CPURunMode { CONTINUOUS_SCAN, SINGLE_SCAN, SINGLE_STEP }
Description
Constants for the scan state of the CPU RUN mode
Elements
CONTINUOUS_SCAN SINGLE_SCAN SINGLE_STEP
51
5.3
ImageDataTypeConstants
enum { S7Byte = 2, S7Word = 3, S7DoubleWord = 4 }
Description
Constants for the ReadOutputImage method
Elements
S7Byte S7DoubleWord S7Word
5.4
PauseStateConstants
enum { Running = 0, Paused = 1, Disabled = 2 }
Description
Constants for the pause state
Elements
DISABLED Paused Running
S7ProSim V5.4
52
5.5
PointDataTypeConstants
enum { S7_Bit = 1, S7_Byte = 2, S7_Word = 3, S7_DoubleWord = 4 }
Description
Constants for the ReadOutputPoint method
Elements
S7_Bit S7_Byte S7_DoubleWord S7_Word
5.6
RestartSwitchPosition
enum { WarmStart = 0, HotStart = 1, ColdStart = 2 }
Description
Constants for the front panel startup switch position
Elements
ColdStartRestart position OB102
HotStartRestart position OB101
53
5.7
ScanModeConstants
enum { SingleScan = 0, ContinuousScan = 1 }
Description
Constants for the operating mode
Elements
ContinuousScan SingleScan
5.8
tagPauseState
enum tagPauseState { ENABLED_RUNNING, ENABLED_PAUSED, DISABLED }
Description
Constants for the pause state
Elements
DISABLED ENABLED_PAUSED ENABLED_RUNNING
S7ProSim V5.4
54
5.9
ScanInfo
ScanInfo constants
The ScanInfo data type variant represents an array of the data type Long. Each Long data type in the array defines some information about the scan, as defined by the ScanInfo constants.
Table 5- 1 Component NUM_OF_SCANINFO_ELEMENTS EXECUTION_TIME_NDX MIN_CYCLE_TIME_NDX LARGEST_CYCLE_TIME_NDX AVERAGE_CYCLE_TIME_NDX IS_PLC_RUNNING_NDX ScanInfo constants Meaning Number of elements in ScanInfo return array. Index 0: Execution time in ms Index 1: Shortest execution time in ms Index 2: Longest execution time in ms Index 3: Average cycle time in ms Index 4: Bit memory: 1 = PLC is running; 0 = PLC is not running Definition 5 0 1 2 3 4
5.10
55
Error return codes PS_E_NOTREGISTERED PS_E_NOTSINGLESCAN PS_E_PLCNOTRUNNING PS_E_POWEROFF PS_E_READFAILED PS_E_WRITEFAILED E_FAIL E_INVALID_STATE S_OK STG_E_CANTSAVE
Meaning 0x80040209: S7ProSim is not registered for callbacks from S7-PLCSIM 0x8004020A: Single scan program execution is not set in S7-PLCSIM 0x8004020E: S7-PLCSIM is not running 0x80040212: S7-PLCSIM is powered off 0x80040203: Read operation failed 0x80040204: Write operation failed 0x80004005: Unspecified error 0x00008002: Invalid state 0x00000000: Success code 0x80030103: Cannot save
S7ProSim V5.4
56
Index
A
AVERAGE_CYCLE_TIME_NDX, 55 Defined constants, 51 CPURunMode, 51 ImageDataTypeConstants, 52 PauseStateConstants, 52 PointDataTypeConstants, 53 RestartSwitchPosition, 53 ScanModeConstants, 54 tagPauseState, 54 Disconnect method, 17
B
BeginScanNotify method, 13 Bit memory Read, 30 Writing, 44 Bit memory value Read, 30 Writing, 44
E
EndScanNotify method, 18 Enumeration types, 51 CPURunMode, 51 ImageDataTypeConstants, 52 PauseStateConstants, 52 PointDataTypeConstants, 53 RestartSwitchPosition, 53 ScanModeConstants, 54 tagPauseState, 54 Error return codes, 55 Event handlers, 8 Events ConnectionError, 49 PauseStateChanged, 49 PLCSimStateChanged, 50 ScanFinished, 50 ScanModeChanged, 50 ExecuteNmsScan method, 19 ExecuteNScans method, 20 ExecuteSingleScan method, 21 EXECUTION_TIME_NDX, 55
C
ColdStart, 53 Setting, 38 Connect method, 14 ConnectExt methods, 15 ConnectionError event, 49 Constants, 51 CPURunMode, 51 ImageDataTypeConstants, 52 PauseStateConstants, 52 PointDataTypeConstants, 53 RestartSwitchPosition, 53 ScanModeConstants, 54 tagPauseState, 54 Continue method, 16 Continuous scan program execution GetScanMode, 23 ScanModeConstants, 54 SetScanMode, 37 CPURunMode, 51
D
Data block (DB) values Read, 28 Writing, 42
G
GetPauseState method, 22 GetScanMode method, 23 GetStartUpSwitch method, 24 GetState method, 25
57
Index
H
HotStart, 53 Setting, 26, 38 HotStartWithSavedValues method, 26 StartPLCSimExt, 41 WriteDataBlockValue, 42 WriteFlagValue, 44 WriteInputImage, 46 WriteInputPoint, 47 MIN_CYCLE_TIME_NDX, 55
I
ImageDataTypeConstants, 52 Introduction, 7 IS_PLC_RUNNING_NDX, 55
N
NUM_OF_SCANINFO_ELEMENTS, 55
K
Key switch position Get, 25 Setting, 39
O
Operating mode Get, 23 Setting, 37 Overview, 7
L
LARGEST_CYCLE_TIME_NDX, 55 Loading peripheral I/O during a hot start, 26 Loading saved .plc files, 40, 41
P
Pause method, 27 Pause state Get, 22 Setting, 16, 27 PauseStateChanged event, 49 PauseStateConstants, 52 PLCSIM, starting, 40, 41 PLCSimStateChanged event, 50 PointDataTypeConstants, 53 Programming an S7ProSim interface to S7-PLCSIM, 8 Project references, 7
M
Methods BeginScanNotify, 13 Connect, 14 ConnectExt, 15 Continue, 16 Disconnect, 17 EndScanNotify, 18 ExecuteNmsScan, 19 ExecuteNScans, 20 ExecuteSingleScan, 21 GetPauseState, 22 GetScanMode, 23 GetStartUpSwitch, 24 GetState, 25 HotStartWithSavedValues, 26 Pause, 27 ReadDataBlockValue, 28 ReadFlagValue, 30 ReadOutputImage, 32 ReadOutputPoint, 34 SavePLC, 36 SetScanMode, 37 SetStartUpSwitch, 38 SetState, 39 StartPLCSim, 40
R
Read Bit memory value (M), 30 Data block values (DB)T, 28 Output, 34 Output image, 32 ReadDataBlockValue method, 28 ReadFlagValue method, 30 ReadOutputImageT method, 32 ReadOutputPoint method, 34 Reference to an S7ProSim COM object Microsoft Visual Basic, 7 Microsoft Visual C#, 7 Microsoft Visual Studio C++, 7 References, 7
S7ProSim V5.4
58
Index
T
tagPauseState, 54 Type definitions, 51 CPURunMode, 51 ImageDataTypeConstants, 52 PauseStateConstants, 52 PointDataTypeConstants, 53 RestartSwitchPosition, 53 ScanModeConstants, 54 tagPauseState, 54
S
S7-PLCSIM, starting, 26, 40, 41 S7ProSim Adding to VB project, 7 Interface to S7-PLCSIM, programming, 8 Overview, 7 S7ProSim Pro methods ReadDataBlockValue, 28 ReadFlagValue, 30 WriteDataBlockValue, 42 WriteFlagValue, 44 SavePLC method, 36 Saving .PLC files, 36 Scan execution methods ExecuteNmsScan, 19 ExecuteNScans, 20 ExecuteSingleScan, 21 Scan notification, 13, 18 ScanFinished event, 50 ScanInfo constants, 55 ScanModeChanged event, 50 ScanModeConstants, 54 SetScanMode method, 37 SetStartUpSwitch method, 38 SetState method, 39 Siemens S7ProSim COM object, adding to project, 7 Single scan program execution ExecuteNmsScan, 19 ExecuteNScans, 20 ExecuteSingleScan, 21 GetScanMode, 23 ScanModeConstants, 54 SetScanMode, 37 StartPLCSim method, 40 StartPLCSimExt methods, 41 Startup switch position, 53 Get, 24 Setting, 38
W
WarmStart, 53 Setting, 38 WriteDataBlockValue method, 42 WriteFlagValue method, 44 WriteInputImage method, 46 WriteInputPoint method, 47 Writing Bit memory value (M), 44 Data block (DB) values, 42 Input image, 46 Input point, 47
59
Index
S7ProSim V5.4
60