Using S7-PROSIM with Siemens S7-PLCSIM

S7PROSIM is interface component for control, manipulate data PLCSIM  from user program.

S7PROSIM will be installed on your hard disk with installation of the S7-PLCSIM.

Exist 2 various version:

  1. OCX –  ActiveX-Controls  for S7-PLCSIM version 5.3 and before ;
  2. COM – model for S7-PLCSIM version 5.4.

You must consider that update to the new version of STEP 7 (eg 5.4, 5.5) is automatically installed an new version of S7-PLCSIM with S7PROSIM COM component instead of OCX and therefore management programs S7-PLCSIM for these versions are incompatible.

S7PROSIM – OCX component provides programmatic access to the simulated PLC interface of S7-PLCSIM. The API interface is based on ActiveX-Controls, which permits the required process variables to be dynamically simulated with all Windows applications supporting the active X technology (e.g. Microsoft Dot.Net, Delphi, C++). With this version only possible read and write I/O interface of simulated PLC.

Possible communication scenario:

  • Connect S7-PROSIM to S7-PLCSIM
  • BeginScanNotify
  • WriteInputPoint/WriteInputImage
  • ExecuteNmsScan, ExecuteNScans
  • ReadOutputPoint/ReadOutputImage
  • Update user Interface and calculate values of the process simulation
  • EndScanNotify
  • Repeat(go to write step) or disconnect


  • Connect or ConnectExt
  • Disconnect
  • ReadOutputPoint
  • ReadOutputImage
  • WriteInputPoint
  • WriteInputImage
  • other

Example VB 6.0 application with S7-PLCSIM version 5.2 and S7-PROSIM  OCX component:


S7PROSIM – COM API provides programmatic access to the simulated PLC interface of S7-PLCSIM. The API interface can be used with all Windows applications supporting the Component Object Model technology (e.g. Microsoft Dot.Net, Microsoft Excel, C++). With COM component can read not only I/O interface, but variables (flags, int16, dint, DB) too.


Example VB.NET application with S7-PLCSIM version 5.4 and S7-PROSIM  COM API:

Private WithEvents S7ProSim As New S7PROSIMLib.S7ProSim



Sub Data()
 Dim pDataB As Byte
 Dim pDataW As Short
 Dim pDataI As Integer
 Dim pDataInA(3) As Short
 Dim pDataInB(2) As Byte

 'Write bit input 100.4
 S7ProSim.WriteInputPoint(100, 5, True)

 'Write inputs array 3x-16 bit integer, address 120, 122, 124
 pDataInA(0) = 12
 pDataInA(1) = 34
 pDataInA(2) = CShort(TrackBar1.Value)
 S7ProSim.WriteInputImage(120, pDataInA)

 'Write inputs WORD, address 130
 pDataInB(0) = 12
 pDataInB(1) = 24
 S7ProSim.WriteInputImage(130, pDataInB)

 'Read Byte output, address 100.0 (S7PROSIMLib.PointDataTypeConstants.S7_Byte = 2)
 S7ProSim.ReadOutputPoint(100, 0, 2, pDataB)
 CheckBox1.Checked = IsBitSet(pDataB, 4)

 'Read Byte from DB, address 156 byte address 20 (S7PROSIMLib.PointDataTypeConstants.S7_Byte = 2)
 S7ProSim.ReadDataBlockValue(156, 20, 0, 2, pDataB)
 LabelByte.Text = CStr(pDataB)

 'Read integer MW 16 bit (S7PROSIMLib.PointDataTypeConstants.S7_Word = 3)
 S7ProSim.ReadFlagValue(1200, 0, 3, pDataW)
 LabelWord.Text = CStr(pDataW)

 'Read DWORD from DB 12 address 58 (S7PROSIMLib.PointDataTypeConstants.S7_DoubleWord = 4)
 S7ProSim.ReadDataBlockValue(12, 58, 0, 4, pDataI)
 LabelInt.Text = CStr(pDataI)

 'Read float 32 bit from DB 10 DWORD address 64 (S7PROSIMLib.PointDataTypeConstants.S7_DoubleWord = 4)
 S7ProSim.ReadDataBlockValue(10, 64, 0, 4, pDataI)
 LabelFL.Text = String.Format("{0,10:N2}", CDbl(BitConverter.ToSingle(BitConverter.GetBytes(pDataI), 0)))
 'LabelFL = 738.45

End Sub

Public Function IsBitSet(ByVal InByte As Byte, ByVal Bit As Byte) As Boolean
  IsBitSet = ((InByte And (2 ^ Bit)) > 0)
End Function

BioGas-TIA VS_source VS2010

VS_source VS2008

S7PROSIM-Solitaire VS_source VS2010


  • PLCSIM emulates an MPI connection, you must choose this connection.
  • When user program(VB) connect with PLCSIM, the PLCSIM switch automatically from Continuous Scan  to Single Scan. You must switch it back to Continuous Scan manually from PLCSIM menu or in the user program(VB) S7ProSim.SetScanMode(1).


How PLCSIM connect with other visualization software?

PLCSIM emulates an MPI connection with Windows service called „SIMATIC IEPG Helper“ running in the background. You can stopped this service and use another service NetToPLCsim.

NetToPLCsim is TCP/IP-Network extension for the PLC simulation software Siemens PLCSim (Step 7 V5.4). With NetToPLCSim you are able to simulate e.g. SCADA systems over Network in combination with your simulated PLC.

NetToPLCSim  is open source project you can download at:

  • IsoOnTcpServer.dll
  • NetToPLCSim.exe
  • Nettoplcsim-S7online-documentation-en-v0.9.1.pdf

Other examples:

Also other projects with PLCSIM, NetToPLCsim, LibNoDave and visualization with C + + and C # applications  you can found at:

If you want to link S7PROSIM COM API with Java or JavaFX application you can access COM API with JACOB – Java COM Bridge software. You can download software from:

But only for testing and visualizing simulated PLC software, that will be little bit complicated.


10 Responses to “Using S7-PROSIM with Siemens S7-PLCSIM”

  1. Ali Naghibzadeh Says:

    Hello Alex
    Thank you for your informative website.
    I am trying to connect PLCsim to Matlab. I have succeeded to connect through COM object and have performed some methods like GetState, SetState, Connect, WriteOutputPoint, etc but the following three main methods do not work:

    Although there is no error report in matlab after perfroming the following commands but they do not pass and get any data:

    h.ReadOutputPoint(0,1,1,j) //j=libpointer
    h.ReadOutputPoint(0,1,2,j) //j=libpointer(‘uint8’)
    (h is handle h=actxserver(s7progid))

    Do you have any idea?

    Best regards
    A. Naghibzadeh

    • alexsentcha Says:

      Hi Ali,
      That’s right no feedback as to the function are wrong, Siemens uses smart object. You make small error in the functions. You must watch out for type and number of variables.

      For example, you need read a 16bit integer variable.
      Dim A(1) As Short
      h.WriteInputImage (762, A)

      For example, you need read at output bit 0.6 in byte.
      Dim j(1) As Byte
      h.ReadOutputPoint (0,6,2, j(6))


  2. Ali Naghibzadeh Says:

    Hi Alex,
    Thank you for your reply.
    Although I have still the smae problem with Matlab. Because matlab does not have types like Byte or Short, it shall be defined as uint8 (unsigned integer 8 bits), int16(signed integer 16bits) etc.
    In the PROsim manual, the type of variables for input / output is defined as variant (pointer). I think the problem in Matlab is that neither variant nor pointer can be defined easily.
    the first example you have mentioned shall be written in Matlab like this:
    a=uint8( avalue e.g. 125 )
    but there will be no transfer in this case.

    I have even tried a pointer like this:
    but it does not work.

    Best regards

    • alexsentcha Says:

      Hi Ali,
      numericCells is a 1-by-3 cell array, but numericVector is a 1-by-3 array of type double:
      numericCells = [1] [2] [3]
      numericVector = 1 2 3
      and in S7-Prosim function pointer to first member like
      h.WriteInputImage(762, numericCells).

      Go to….
      …Overview of Numeric Classes…All numeric types support basic array operations…. May be this help you.

      With array of 10 members you can read/write 10 values.
      Try use array. I think this should work. You just need to ensure that variables in the PLC must have same size.

      Best regards

  3. Alireza naghibzadeh Says:

    Hi alex
    Thanks again for your reply. However there is no result by cell arays or normal arrays also. I think that matlab can not pass pointer by reference. Do you know that such inter connection ever have done (between Matlab and PROsim)?

    P.s. i have already connected the two softwares via OPC server but it seems that direct connection with COM object is not possible.

    Best regards

  4. Alireza Naghibzadeh Says:

    Hi Alex,

    I have finally connected the two software but by using C++. It seems that direct connection is not possible.

    Best regards

  5. Slawomir Ajon Says:

    Alieza -> Can you share your solutions with us?? I have exactly the same problem. I didn’t find proper solution yet. I’m not C++ programer and it will take a long time for me to find out how to write this application.

    Thank you in advance.

    Best regards,

  6. redbull Says:

    I want to write a simple code in VB6 (Excell), to connect to PLC-SIM via ProSIM. Just Connect and Write a boolean to an address!!!
    But the Only method that works is StartPLCSim! and none of them works!!The event rises and says it is not connected.
    Would you please help me and write a pactical code as simple as it can be?!!

  7. Steven Says:

    redbull, use the Connect or ConnectExt(number) (where number is an instance number of plcsim before sending commands)

  8. Thongchai Says:

    hi Alex,
    I try to connect to the download SolitairePL plcsim v5.4 can not connect.
    I know that in plcsim v5.4 to download program or not.Please send samples plc sim to me.
    Thank You.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: