Simatic Engineering Tools Manual
Simatic Engineering Tools Manual
Simatic Engineering Tools Manual
4 ___________________
Introduction 1
___________________
S7ProSim overview 2
___________________
Methods 3
SIMATIC
___________________
Events 4
Engineering tools
S7ProSim V5.4 ___________________
Type definitions 5
Operating Manual
07/2011
A5E00992430-02
Legal information
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
with a safety alert symbol, indicates that minor personal injury can result if proper precautions are not taken.
CAUTION
without a safety alert symbol, indicates that property damage can result if proper precautions are not taken.
NOTICE
indicates that an unintended result or situation can occur if the relevant information is not taken into account.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
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.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
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.
1 Introduction................................................................................................................................................ 5
2 S7ProSim overview ................................................................................................................................... 7
2.1 Adding an S7ProSim COM object to your project..........................................................................7
2.2 Programming an interface to S7-PLCSIM with S7ProSim.............................................................8
3 Methods................................................................................................................................................... 11
3.1 BeginScanNotify ..........................................................................................................................13
3.2 Connect........................................................................................................................................14
3.3 ConnectExt...................................................................................................................................15
3.4 Continue.......................................................................................................................................16
3.5 Disconnect ...................................................................................................................................17
3.6 EndScanNotify .............................................................................................................................18
3.7 ExecuteNmsScan ........................................................................................................................19
3.8 ExecuteNScans ...........................................................................................................................20
3.9 ExecuteSingleScan......................................................................................................................21
3.10 GetPauseState.............................................................................................................................22
3.11 GetScanMode ..............................................................................................................................23
3.12 GetStartUpSwitch ........................................................................................................................24
3.13 GetState .......................................................................................................................................25
3.14 HotStartWithSavedValues ...........................................................................................................26
3.15 Pause ...........................................................................................................................................27
3.16 ReadDataBlockValue...................................................................................................................28
3.17 ReadFlagValue ............................................................................................................................30
3.18 ReadOutputImage........................................................................................................................32
3.19 ReadOutputPoint .........................................................................................................................34
3.20 SavePLC ......................................................................................................................................36
3.21 SetScanMode...............................................................................................................................37
3.22 SetStartUpSwitch.........................................................................................................................38
3.23 SetState .......................................................................................................................................39
3.24 StartPLCSim ................................................................................................................................40
3.25 StartPLCSimExt ...........................................................................................................................41
3.26 WriteDataBlockValue ...................................................................................................................42
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 3
Table of contents
3.27 WriteFlagValue............................................................................................................................ 44
3.28 WriteInputImage.......................................................................................................................... 46
3.29 WriteInputPoint............................................................................................................................ 47
4 Events...................................................................................................................................................... 49
4.1 ConnectionError .......................................................................................................................... 49
4.2 PauseStateChanged ................................................................................................................... 49
4.3 PLCSimStateChanged ................................................................................................................ 50
4.4 ScanFinished .............................................................................................................................. 50
4.5 ScanModeChanged .................................................................................................................... 50
5 Type definitions........................................................................................................................................ 51
5.1 Type definitions ........................................................................................................................... 51
5.2 CPURunMode ............................................................................................................................. 51
5.3 ImageDataTypeConstants .......................................................................................................... 52
5.4 PauseStateConstants ................................................................................................................. 52
5.5 PointDataTypeConstants ............................................................................................................ 53
5.6 RestartSwitchPosition ................................................................................................................. 53
5.7 ScanModeConstants................................................................................................................... 54
5.8 tagPauseState............................................................................................................................. 54
5.9 ScanInfo constants...................................................................................................................... 55
5.10 Error return codes ....................................................................................................................... 55
Index........................................................................................................................................................ 57
S7ProSim V5.4
4 Operating Manual, 07/2011, A5E00992430-02
Introduction 1
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.
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 5
Introduction
S7ProSim V5.4
6 Operating Manual, 07/2011, A5E00992430-02
S7ProSim overview 2
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.
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".
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 7
S7ProSim overview
2.2 Programming an interface to S7-PLCSIM with S7ProSim
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
...
class ProSimWrapper
public:
virtual ~ProSimWrapper()
// released
// when the application shuts down
IS7ProSim * GetPtr()
return m_pProSim;
};
// Attributes
S7ProSim V5.4
8 Operating Manual, 07/2011, A5E00992430-02
S7ProSim overview
2.2 Programming an interface to S7-PLCSIM with S7ProSim
protected:
IS7ProSimPtr m_pProSim;
};
– Example: C#
using S7PROSIMLib;
...
ps = new S7ProSim();
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 9
S7ProSim overview
2.2 Programming an interface to S7-PLCSIM with S7ProSim
3. In Visual Basic, program event handlers for the S7ProSim events. Event handlers are not
necessary in Visual C++ and Visual C#. Within each event handler, you can insert any
custom code for your application.
Example: Visual Basic 6.0
Private Sub S7ProSim_PauseStateChanged(ByVal NewState As String)
DoEvents
...
End Sub
DoEvents
...
End Sub
DoEvents
...
End Sub
DoEvents
End Sub
DoEvents
...
End Sub
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 Operating Manual, 07/2011, A5E00992430-02
Methods 3
Overview
Method Description
BeginScanNotify (Page 13) Registers S7ProSim for callbacks from the controller.
The ScanFinished and PLCSimStateChanged events will be sent when
these events occur.
Connect (Page 14) Connects S7ProSim to S7-PLCSIM.
ConnectExt (Page 15) Connects S7ProSim with the S7-PLCSIM instance
with number InstanceNumber.
Continue (Page 16) Continues a simulation that has been paused.
Disconnect (Page 17) Disconnects S7ProSim from S7-PLCSIM.
EndScanNotify (Page 18) Unregisters S7ProSim for callbacks from the controller.
The ScanFinished and PLCSimStateChanged events will not be sent.
ExecuteNmsScan Forces S7-PLCSIM to execute scan cycles for a specified time (Nms)
(Page 19) 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.
ExecuteNScans (Page 20) 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.
ExecuteSingleScan Forces S7-PLCSIM to execute one scan cycle without waiting for the
(Page 21) end of the current scan. If scan notification is enabled,
the program will be notified when S7-PLCSIM has finished the scan.
GetPauseState (Page 22) Returns the current pause state of S7-PLCSIM.
GetScanMode (Page 23) Reports the operating mode of S7-PLCSIM.
GetStartUpSwitch Gets the startup setting (hot restart, warm restart, or cold start)
(Page 24) for S7-PLCSIM
GetState (Page 25) Returns a string containing the current key switch position of
S7-PLCSIM (RUN, RUN-P, or STOP).
HotStartWithSavedValues Sets a Boolean value to specify whether S7-PLCSIM should load saved
(Page 26) 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
Pause (Page 27) Pauses a simulation.
ReadDataBlockValue Reads a particular bit, byte, word, or double word from the
(Page 28) DB memory area of S7-PLCSIM.
ReadFlagValue (Page 30) Reads a particular bit, byte, word, or double
word from the bit memory area (M) of S7-PLCSIM.
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 11
Methods
Method Description
ReadOutputImage Reads elements from the peripheral outputs (PQ memory area)
(Page 32) 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).
S7ProSim V5.4
12 Operating Manual, 07/2011, A5E00992430-02
Methods
3.1 BeginScanNotify
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 Meaning
S_OK 0x00000000 : Success code
E_FAIL 0x80004005 : Unspecified error
PS_E_NOTCONNECTED 0x80040211 : S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212 : S7-PLCSIM is powered off
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 13
Methods
3.2 Connect
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 Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_PLCISCONNECTED 0x8004020E: S7-PLCSIM is connected
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
S7ProSim V5.4
14 Operating Manual, 07/2011, A5E00992430-02
Methods
3.3 ConnectExt
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 Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_PLCISCONNECTED 0x8004020E: S7-PLCSIM is connected
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 15
Methods
3.4 Continue
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 Meaning
S_OK 0x00000000 : Success code
PS_E_NOTCONNECTED 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
16 Operating Manual, 07/2011, A5E00992430-02
Methods
3.5 Disconnect
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 Meaning
S_OK 0x00000000 : Success code
E_FAIL 0x80004005 : Unspecified error
PS_E_POWEROFF 0x80040212 : S7-PLCSIM is powered off
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 17
Methods
3.6 EndScanNotify
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 Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
PS_E_NOTREGISTERED 0x80040209: S7ProSim is not registered for callbacks from S7-
PLCSIM
S7ProSim V5.4
18 Operating Manual, 07/2011, A5E00992430-02
Methods
3.7 ExecuteNmsScan
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
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTSINGLESCAN 0x8004020A: Single scan program execution is not set in
S7-PLCSIM
PS_E_PLCNOTRUNNING 0x8004020E: S7-PLCSIM is not running
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 19
Methods
3.8 ExecuteNScans
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
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTSINGLESCAN 0x8004020A: Single scan mode is not set in S7-PLCSIM
PS_E_PLCNOTRUNNING 0x8004020E: S7-PLCSIM is not running
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
20 Operating Manual, 07/2011, A5E00992430-02
Methods
3.9 ExecuteSingleScan
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 Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_PLCNOTRUNNING 0x8004020E: S7-PLCSIM is not running
PS_E_NOTSINGLESCAN 0x8004020A: Single scan mode is not set in S7-PLCSIM
PS_E_MODENOTPOSSIBLE 0x8004020C: S7-PLCSIM could not set the
specified operating mode
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 21
Methods
3.10 GetPauseState
3.10 GetPauseState
STDMETHOD(CS7ProSim::GetPauseState)( PauseStateConstants *pVal)
Description
Returns the current pause state of S7-PLCSIM.
Parameters
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 Meaning
S_OK 0x00000000: Success code
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
22 Operating Manual, 07/2011, A5E00992430-02
Methods
3.11 GetScanMode
3.11 GetScanMode
STDMETHOD(CS7ProSim::GetScanMode)( ScanModeConstants *pVal)
Description
Reports the operating mode of S7-PLCSIM.
Parameters
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 Meaning
S_OK 0x00000000: Success code
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 23
Methods
3.12 GetStartUpSwitch
3.12 GetStartUpSwitch
STDMETHOD(CS7ProSim::GetStartUpSwitch)( RestartSwitchPosition *pPos)
Description
Gets the startup setting (hot restart, warm restart, or cold start) for S7-PLCSIM.
Parameters
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 Meaning
S_OK 0x00000000: Success code
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
24 Operating Manual, 07/2011, A5E00992430-02
Methods
3.13 GetState
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
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 Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
E_INVALID_STATE 0x00008002: Invalid state
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 25
Methods
3.14 HotStartWithSavedValues
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
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000 : Success code
PS_E_NOTCONNECTED 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
26 Operating Manual, 07/2011, A5E00992430-02
Methods
3.15 Pause
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 Meaning
S_OK 0x00000000 : Success code
PS_E_NOTCONNECTED 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 27
Methods
3.16 ReadDataBlockValue
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 Description
BlockNumber Input Number of the data block to be read. Valid values for BlockNumber
depend on the CPU.
ByteIndex Input Start byte position in the data block to be read.
Valid values for ByteIndex depend on the CPU.
BitIndex Input 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.
DataType Input Data type to be read. DataType must be one of the
PointDataTypeConstants.
pData Input, output 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 Operating Manual, 07/2011, A5E00992430-02
Methods
3.16 ReadDataBlockValue
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for given start byte
index
PS_E_READFAILED 0x80040203: Read operation failed
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 29
Methods
3.17 ReadFlagValue
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
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 Operating Manual, 07/2011, A5E00992430-02
Methods
3.17 ReadFlagValue
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for given start byte
index
PS_E_READFAILED 0x80040203: Read operation failed
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 31
Methods
3.18 ReadOutputImage
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
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 Operating Manual, 07/2011, A5E00992430-02
Methods
3.18 ReadOutputImage
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for
given start byte index
PS_E_READFAILED 0x80040203: Read operation failed
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_NOTALLREADSWORKED 0x8004020F: Not all read operations were successful
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 33
Methods
3.19 ReadOutputPoint
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
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 Operating Manual, 07/2011, A5E00992430-02
Methods
3.19 ReadOutputPoint
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for
given start byte index
PS_E_READFAILED 0x80040203: Read operation failed
PS_E_BADBITNDX 0x80040205: Byte index is invalid
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 35
Methods
3.20 SavePLC
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
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
STG_E_CANTSAVE 0x80030103: Cannot save
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
36 Operating Manual, 07/2011, A5E00992430-02
Methods
3.21 SetScanMode
3.21 SetScanMode
STDMETHOD(CS7ProSim::SetScanMode)( ScanModeConstants newVal)
Description
Sets the operating mode for S7-PLCSIM.
Parameters
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 37
Methods
3.22 SetStartUpSwitch
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
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000 : Success code
PS_E_NOTCONNECTED 0x80040211 : S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
38 Operating Manual, 07/2011, A5E00992430-02
Methods
3.23 SetState
3.23 SetState
STDMETHOD(CS7ProSim::SetState)( BSTR newVal)
Description
Sets the current key switch position of S7-PLCSIM (RUN, RUN-P, or STOP).
Parameters
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
E_INVALID_STATE 0x00008002: Invalid state
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 39
Methods
3.24 StartPLCSim
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
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
S7ProSim V5.4
40 Operating Manual, 07/2011, A5E00992430-02
Methods
3.25 StartPLCSimExt
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
Error handling
Errors are reported in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_MAXINSTANCE 0x80040214: Maximum number of open S7
PLCSIM instances reached
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 41
Methods
3.26 WriteDataBlockValue
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
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 Operating Manual, 07/2011, A5E00992430-02
Methods
3.26 WriteDataBlockValue
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for given start byte
index
PS_E_WRITEFAILED 0x80040204: Write operation failed
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 43
Methods
3.27 WriteFlagValue
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
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 Operating Manual, 07/2011, A5E00992430-02
Methods
3.27 WriteFlagValue
Error handling
Errors are returned in the ConnectionError event, not by the function call.
Return value
Value Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for given start byte
index
PS_E_WRITEFAILED 0x80040204: Write operation failed
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 45
Methods
3.28 WriteInputImage
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 Description
StartIndex Input Represents the start byte position in the peripheral inputs
for the write. Valid values for StartIndex depend on the CPU.
pData Input 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.
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 Meaning
S_OK 0x00000000: Success code
E_FAIL 0x80004005: Unspecified error
PS_E_BADBYTENDX 0x80040201: Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202: Size of data array is invalid for given
start byte index
PS_E_WRITEFAILED 0x80040204: Write operation failed
PS_E_BADTYPE 0x80040206: Invalid data type
PS_E_NOTALLWRITESWORKED 0x80040210: Not all write operations
were successful
PS_E_NOTCONNECTED 0x80040211: S7ProSim is not connected to
S7-PLCSIM
PS_E_POWEROFF 0x80040212: S7-PLCSIM is powered off
S7ProSim V5.4
46 Operating Manual, 07/2011, A5E00992430-02
Methods
3.29 WriteInputPoint
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 Description
ByteIndex Input Represents the start byte position in the peripheral inputs for the
write. Valid values for ByteIndex depend on the CPU.
BitIndex Input Represents the bit position (in bytes) in the peripheral
area for the write. Valid values are 0 to 7.
pData Input 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 Meaning
S_OK 0x00000000 : Success code
E_FAIL 0x80004005 : Unspecified error
PS_E_BADBYTENDX 0x80040201 : Byte index is invalid
PS_E_BADBYTECOUNT 0x80040202 : Size of data array is invalid for
given start byte index
PS_E_WRITEFAILED 0x80040204 : Write operation failed
PS_E_BADBITNDX 0x80040205 : Byte index is invalid
PS_E_BADTYPE 0x80040206 : Invalid data type
PS_E_NOTCONNECTED 0x80040211 : S7ProSim is not connected to S7-PLCSIM
PS_E_POWEROFF 0x80040212 : S7-PLCSIM is powered off
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 47
Methods
3.29 WriteInputPoint
S7ProSim V5.4
48 Operating Manual, 07/2011, A5E00992430-02
Events 4
Overview
Event Meaning
ConnectionError (Page 49) Generated when unable to connect to the control engine ("S7-
PLCSIM") or when an error occurs with any S7ProSim method call.
PauseStateChanged Generated when a Pause/Continue state change is detected.
(Page 49) NewState is a string that represents one of the
PauseStateConstants.
PLCSimStateChanged Generated when a new PLC switch state is detected. NewState is
(Page 50) the new operating state: "RUN", "RUN_P" or "STOP".
ScanFinished (Page 50) Generated when a single scan is finished. ScanInfo provides indexed
information about the scan.
ScanModeChanged Generated when an operating mode change is detected. NewState is
(Page 50) a string that represents one of the ScanModeConstants.
4.1 ConnectionError
HRESULT ConnectionError(BSTR ControlEngine, long Error)
Description
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 PauseStateChanged
HRESULT PauseStateChanged(BSTR NewState)
Description
Generated when a Pause/Continue state change is detected. NewState is a string that
represents one of the PauseStateConstants.
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 49
Events
4.3 PLCSimStateChanged
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 Operating Manual, 07/2011, A5E00992430-02
Type definitions 5
5.1 Type definitions
Type Description
CPURunMode (Page 51) Constants for the scan state of the CPU RUN mode
ImageDataTypeConstants Constants for the ReadOutputImage method
(Page 52)
PauseStateConstants (Page 52) Constants for the pause state
PointDataTypeConstants (Page 53) Constants for the ReadOutputPoint method
RestartSwitchPosition (Page 53) Constants for the front panel startup switch position
ScanModeConstants (Page 54) Constants for the operating mode
tagPauseState (Page 54) Constants for the pause state
ScanInfo constants (Page 55) 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
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 51
Type definitions
5.3 ImageDataTypeConstants
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 Operating Manual, 07/2011, A5E00992430-02
Type definitions
5.5 PointDataTypeConstants
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
WarmStartRestart position OB100
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 53
Type definitions
5.7 ScanModeConstants
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 Operating Manual, 07/2011, A5E00992430-02
Type definitions
5.9 ScanInfo constants
ScanInfo
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.
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 55
Type definitions
5.10 Error return codes
S7ProSim V5.4
56 Operating Manual, 07/2011, A5E00992430-02
Index
A
AVERAGE_CYCLE_TIME_NDX, 55 Defined constants, 51
CPURunMode, 51
ImageDataTypeConstants, 52
B PauseStateConstants, 52
BeginScanNotify method, 13 PointDataTypeConstants, 53
Bit memory RestartSwitchPosition, 53
Read, 30 ScanModeConstants, 54
Writing, 44 tagPauseState, 54
Bit memory value Disconnect method, 17
Read, 30
Writing, 44
E
EndScanNotify method, 18
C Enumeration types, 51
ColdStart, 53 CPURunMode, 51
Setting, 38 ImageDataTypeConstants, 52
Connect method, 14 PauseStateConstants, 52
ConnectExt methods, 15 PointDataTypeConstants, 53
ConnectionError event, 49 RestartSwitchPosition, 53
Constants, 51 ScanModeConstants, 54
CPURunMode, 51 tagPauseState, 54
ImageDataTypeConstants, 52 Error return codes, 55
PauseStateConstants, 52 Event handlers, 8
PointDataTypeConstants, 53 Events
RestartSwitchPosition, 53 ConnectionError, 49
ScanModeConstants, 54 PauseStateChanged, 49
tagPauseState, 54 PLCSimStateChanged, 50
Continue method, 16 ScanFinished, 50
Continuous scan program execution ScanModeChanged, 50
GetScanMode, 23 ExecuteNmsScan method, 19
ScanModeConstants, 54 ExecuteNScans method, 20
SetScanMode, 37 ExecuteSingleScan method, 21
CPURunMode, 51 EXECUTION_TIME_NDX, 55
D G
Data block (DB) values GetPauseState method, 22
Read, 28 GetScanMode method, 23
Writing, 42 GetStartUpSwitch method, 24
GetState method, 25
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 57
Index
H
HotStart, 53
StartPLCSimExt, 41
Setting, 26, 38
WriteDataBlockValue, 42
HotStartWithSavedValues method, 26
WriteFlagValue, 44
WriteInputImage, 46
WriteInputPoint, 47
I
MIN_CYCLE_TIME_NDX, 55
ImageDataTypeConstants, 52
Introduction, 7
IS_PLC_RUNNING_NDX, 55 N
NUM_OF_SCANINFO_ELEMENTS, 55
K
Key switch position O
Get, 25
Operating mode
Setting, 39
Get, 23
Setting, 37
Overview, 7
L
LARGEST_CYCLE_TIME_NDX, 55
Loading peripheral I/O during a hot start, 26 P
Loading saved .plc files, 40, 41
Pause method, 27
Pause state
Get, 22
M
Setting, 16, 27
Methods PauseStateChanged event, 49
BeginScanNotify, 13 PauseStateConstants, 52
Connect, 14 PLCSIM, starting, 40, 41
ConnectExt, 15 PLCSimStateChanged event, 50
Continue, 16 PointDataTypeConstants, 53
Disconnect, 17 Programming an S7ProSim interface to S7-PLCSIM, 8
EndScanNotify, 18 Project references, 7
ExecuteNmsScan, 19
ExecuteNScans, 20
ExecuteSingleScan, 21 R
GetPauseState, 22
Read
GetScanMode, 23
Bit memory value (M), 30
GetStartUpSwitch, 24
Data block values (DB)T, 28
GetState, 25
Output, 34
HotStartWithSavedValues, 26
Output image, 32
Pause, 27
ReadDataBlockValue method, 28
ReadDataBlockValue, 28
ReadFlagValue method, 30
ReadFlagValue, 30
ReadOutputImageT method, 32
ReadOutputImage, 32
ReadOutputPoint method, 34
ReadOutputPoint, 34
Reference to an S7ProSim COM object
SavePLC, 36
Microsoft Visual Basic, 7
SetScanMode, 37
Microsoft Visual C#, 7
SetStartUpSwitch, 38
Microsoft Visual Studio C++, 7
SetState, 39
References, 7
StartPLCSim, 40
S7ProSim V5.4
58 Operating Manual, 07/2011, A5E00992430-02
Index
RestartSwitchPosition, 53 T
Return values, 55
tagPauseState, 54
Type definitions, 51
CPURunMode, 51
S
ImageDataTypeConstants, 52
S7-PLCSIM, starting, 26, 40, 41 PauseStateConstants, 52
S7ProSim PointDataTypeConstants, 53
Adding to VB project, 7 RestartSwitchPosition, 53
Interface to S7-PLCSIM, programming, 8 ScanModeConstants, 54
Overview, 7 tagPauseState, 54
S7ProSim Pro methods
ReadDataBlockValue, 28
ReadFlagValue, 30 W
WriteDataBlockValue, 42
WarmStart, 53
WriteFlagValue, 44
Setting, 38
SavePLC method, 36
WriteDataBlockValue method, 42
Saving .PLC files, 36
WriteFlagValue method, 44
Scan execution methods
WriteInputImage method, 46
ExecuteNmsScan, 19
WriteInputPoint method, 47
ExecuteNScans, 20
Writing
ExecuteSingleScan, 21
Bit memory value (M), 44
Scan notification, 13, 18
Data block (DB) values, 42
ScanFinished event, 50
Input image, 46
ScanInfo constants, 55
Input point, 47
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
S7ProSim V5.4
Operating Manual, 07/2011, A5E00992430-02 59
Index
S7ProSim V5.4
60 Operating Manual, 07/2011, A5E00992430-02