Simulating "real world" applications with a Siemens PLC

Borte

Member
Join Date
Feb 2004
Location
Norway
Posts
238
Hello guys!

I had a earlier discussion about a simple encoder (http://www.plctalk.net/qanda/showthread.php?t=15464) but now I would like to simulate this to develop the program.

The problem is that it's kinda hard to simulate a rotating disc with sensors on it... So I was wondering about how you guys do it when you want to test an application which has to have real life IO to work. I know I can use the S7 PLCSim but I need something to simulate the IO's specifically for this situation. Do I have to greate something in VB?

Cheers
Borte
 
Depending on how you've grouped your I/O, there is a possibility that you could achieve what you want in PLCSim. There is a record function in PLCSim so that you can record a series of operations and then "play them back". You can adjust the playback speed (within limits) to give you more or less real world speed of operation. While the playback is running you can then set other inputs and check whether the program reacts - or interacts - as expected.

Unfortunately, Siemens have ruined what could have been a super tool by a bit of cheapskate software development. During the "record" phase PLCSim records the state of its I/O BYTE- or WORD-wise (can't remember which at the moment) which means that you can't "play" with any I/O that is in a Byte (or Word) that you recorded, because it will get overwritten when that word is played back. You can work around it by mapping your I/O to other Bits for test purposes, but it's a bit of a shame really. Another case of spoiling the ship for a hap'worth of tar!
 
Hi


i usually write a small program to do so


A T1
=m0.0
an t1
l s5t#1s
sd t1


then u have a pulse generated every 1s

i also do not add the I/O in the hardware configuration while
simulating in that way u can replace m0.0 by the input u are using
 
Amr Hassan said:
Hi


i usually write a small program to do so


A T1
=m0.0
an t1
l s5t#1s
sd t1


then u have a pulse generated every 1s

i also do not add the I/O in the hardware configuration while
simulating in that way u can replace m0.0 by the input u are using
You can get the pulse directly using the built in clock memory of the plc but it doesn't help me in this case. I know I can build logic on the plc to simulate it but I wanna do it externally.
 
If you go to the hardware properties of the plc (Siemens 300/400) you'll see the "Cycle/clock memory" tab. Here you can set a memory byte you want to use for clock memory / pulses.
This byte will give you the following pulses:

Bit Frequency
7: 0.5 (2s)
6: 0.625 (1.6s)
5: 1 (1s)
4: 1.25 (0.8s)
3: 2 (0.5s)
3: 2.5 (0.4s)
1: 5 (0.2s)
0: 10 (0.1s)
 
No Problem, thanks for trying though!

Btw: note that each pulse is not a "one shot" so if you base a counter or something else on the bits you have to use a edge detection.

Cheers
Borte
 
I know I can build logic on the plc to simulate it but I wanna do it externally.
Why ?
I normally include simulation code in my programs. With the change of a bit I switch to simulation. If you are worried about using up valuable memory, then simply make a special version of your program with the simulation.
 
JesperMP said:
Why ?
I normally include simulation code in my programs. With the change of a bit I switch to simulation. If you are worried about using up valuable memory, then simply make a special version of your program with the simulation.
What do you simulate? I/O?
 
Yes, I simulate both digital and analog i/o.
Some of the simulation is automatically included when I use one of my standard FB's.
Some of the other simulation has to be specially adapted to the case.

The end result is that I can simulate everything with only my PC. I can then test both my PLC and HMI programs so much that there are few surprises when I start the real project. It saves invaluable time when it is the most expensive.
 
I do the same thing, mostly so I can test my code before the hardware is ready. Even my deliverable code contains the simulator.

I have defined a data bit as "Simulation Mode", and when it is on, I execute code that simulates encoders, cylinders, etc. I even allow various machine speeds. The key is to make sure all of this stuff is external to your regular code, and just map the simulation bits to the real world IO, so the regular code doesn't even know the IO is being simulated. Works like a charm.
 
So you guys are using "=" or "S/R" on inputs?
I guess this will take som time to code but the savings in the end is worth it.

Cheers
Borte
 
I usually represent all of my IO as bits in a data block anyway, so I use L/T. For instance:

L IW 0
T DB10.DBW 0

From that point on, I only address data bits. If I wanted to add some simulation, I would do something like this:

L #SimulatedInputs
A #SimulationEnabled
JC m001
L IW 0
m001: T DB10.DBW 0

From there, the rest of the code doesn't have to be touched. And, if you don't even have any IO connected yet, you won't get any faults because you don't even address the IO.

You would follow the same scheme with outputs.
 

Similar Topics

I'm simulated a few different styles of dosing with my rslogix5000 emulator and a wonderware application I made for it. Everything works great and...
Replies
2
Views
2,109
Hi Do any of you have some experience with simulating a servo drive with Emulate3D? I have tried to research and thinking of a way to do it...
Replies
0
Views
1,488
Hello all, Trying to simulate with TIA V15 because the hardware won't be ready for a few weeks. I have the PLC simulated and running. Can go...
Replies
8
Views
12,546
1)Is there a way to simulate Analog input instead of a instrument in the simulator mode to test the software? like plcsim in Siemens you are...
Replies
3
Views
2,106
Hi Everyone, As part of FAT testing, I am looking to test the PLC logic by simulating the analog inputs. Is there any way to feed analog input...
Replies
3
Views
2,843
Back
Top Bottom