Siemens PLC-SIM simulation

spaderkung

Member
Join Date
Aug 2007
Location
South Sweden
Posts
389
Hello,

I would like to use PLC-SIM together with some PC-software, for instance VB, and have my PLC-program connected to a PC-based plant model (fancy words for having S7 read from cells in XL).

With InTouch and Dassidirect I can pretty much accomplish this, but it still requires a physical PLC. I assume there's a price attached to the software option sas well, but it will not take up any physical space.

Regards
Jon
 
You can use the S7ProSim COM Object with vb6 and vb.net its included with plcsim. Detailed information can be found in the manual XX\Siemens\Plcsim\s7manual\s7wsi\s7wspscb.pdf
 
Couldn't find the edit, so here's a new post with update.

Got the ProSim working; wrote a VB app that scans, pauses, read/write DB and so on. However, some of the events are not triggered from PLC-Sim but only from the VB app. (PauseStateChanged triggers for instance only when "pause" is pressed in my app).

Next step is to decode the German logic behind the floating-point format so I can handle more than bools and signed integers.
 
There is no 'German logic' behind the floating-point numbers used in S7. Step 7 simply uses the 32 bit implementation of the IEEE 754 standard, which can be reviewed here.

Kind regards,


 
After writing conversion functions to and from "readable" format and IEEE.Single, i realize that there's no need. The interface will handle real(!) signals and anlogue signals are not fp, but words (PQW, PIW).
 
Hi, I am doing the same thing...

I build a block in step7 and want to test it. But i have no PLC.
I am using Prosim to simulate it.

I want it to read input from an excel file and write the output to another excel file. I am new to VB. Could you share what you did to do that?

Please. Really appreciate any help
 
I have neglected this project. The way I do it is like this: ProSim talks to VB. VB handles file I/O and I use a .txt file. The idea is that VB acts as an interpreter between any third party simulation software capable of writing/reading .txt and ProSim.

Help on VB... Use VB.net or any other "new" version. I have found the help on M$ www surprisingly useful. As many others I learned VB from VBA in XL over a period of many years. Copy&Paste from existing programs is a good method.

Please bump the thread and elaborate on your fp problem if you still have it.
 
hey thanks for the reply...

I am now slowly progressing.. my block works..

now the problem is at floating point.
'***** Read 2 DoubleWords at the starting address Q 50.0 *****
DataType = S7DoubleWord 'Read type DoubleWord
lStartIndex = 50 'Start at addresse Q 50.0
lElementsToRead = 2 'Read 2 Elements (DoubleWords)
errReadOutputImage = S7ProSim1.ReadOuputImage(lStartIndex, _
lElementsToRead, DataType, vData)
If errReadOutputImage = S_OK Then
D = CLng(vData(0))
Else
ShowError errReadOutputImage
End If


It works fine in the loop, siemens S7 reads it just as i want it.

But when I print it out in a text it is all Long numbers.

i tried Cdbl(D) but it still doesn't print as a double nor floating point.

I need to in decimal form so that i can then manipulate it in Matlab.
 
The PQWs are (read as) integer values. Then you need to convert it to a useful fp value. If you read 12345 as a control signal from ProsSim you would prob want to scale it either in VB or ML to 45%. Why not let ML read the long nbr and do the manipulation in there?
 
Yes, it's either one of the option. I would like to do it in matlab as it is more straightfoward number calculations but
What do you mean by 45%? I don't know the formula for scaling

1058918147 to it's fp value of 0.61644 nor 1058918147

1060002323 into 0.681062. It's not a direct multiplication.

I have been searching for the formula but couldn't find it anywhere yet.

Anyone has an idea?

1058918147
 
Sorry. I assumed that you read your PQW from VB, and that you the use the default scale in S7 0..27648. If this is the control signal to a valve/pump/whatever then 12345 would mean 45% of the full scale. As I recall the ReadOutputImage did not work for me, so I used ReadOutputPoint and a for loop.
 

Similar Topics

Hello Everybody, Is there a way to connect factory talk ME with siemens plcim. So that i can simulate my simatic step 7 logic and factory talk hmi?
Replies
1
Views
1,940
Ok so I know that SIMATIC S7-PLCSIM is out there to act as an emulator if you don't have a physical PLC to write and test programs with... but it...
Replies
4
Views
8,760
Hi I have the attached code and am testing it using PLC SIM. The PLC goes to STOP mode with an "Error when allocating local data", requested...
Replies
6
Views
3,975
I have been using PLCSIM v5.2 with hotfix 1 in conjunction with S7 V5.2 SP1.. it works very nicely. I have not yet been able to make my Protool...
Replies
13
Views
12,353
HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
9
Views
295
Back
Top Bottom