STEP7 OB's sample time issue

Pandiani

Lifetime Supporting Member
Join Date
Apr 2005
Location
Tz
Posts
718
Helo guys,
I wrote a couple of STEP7 SCL programs that simulates behaviors of discrete systems. I hope someone remembers STEP 7 SOPDT simulator in one of previous threads. I always placed my implementations in OB35 with default cyclic time of 100 ms. My main motiv was to ensure precise sample time. If I entered sample time as parameter and doing calculation inside, I had to ensure code to be executed with time that correspond to entered sample time. I remember once I had a lot of problems with FB41 (PID block) placed in OB1. Later I found out that because of variable cyclic time of OB1, Integrator and Derivator's time constants would not mean much unless FB41 is executed ad precise time intervals entered as parameter to the function block. I know that strange behavior was due to scan time jitter that exists with OB1 (every sac time can last more or less than from previous one).
Is same thing applies to every calculation that takes time constant in order to work?
If that is true, that means every discrete model that I implement must be placed in OB35. Is there any way I can measure and see how same code will do in different OBs (OB1 and OB35) and compare them that way?

Thanks
 
What do you want to measure and are you interested in a qualitative or a quantitative comparison? Will executing the code in OB1 and OB35 respectively and monitoring the behaviour suffice?

I believe the scan time is accessible and thus possible to record. It will quantify the cause.

You will also need a known scan time for other discrete systems, such as filters.
 
You could toggle an output every time the block is processed and measure the on/off time using an oscilloscope on those outputs. It would give you at least an idea about the (ir)regularity of processing the blocks.


Kind regards,
 
spaderkung said:
What do you want to measure and are you interested in a qualitative or a quantitative comparison? Will executing the code in OB1 and OB35 respectively and monitoring the behaviour suffice?

Well, last year or so, I posted on the Siemens AD forum expecting to get complete information about the fact that PID cannot be used in OB1 (it can but it behaves much differently than you would expect). The thread can be found HERE.
Can you comment what is written there?

I have read that OB35 cyclic block is precise up to 1 ms. I would like to execute same code, for example my STEP 7 SOPDT simulator (can be found on this forum) in OB1 and Ob35 and to learn (if possible) how much bigger jitter in OB1 is comparing with OB35. I don't know STEP 7 that good to figure out these details.

Basically I'm trying to find out how critical real time requirements can be satisfied with OB1.
 
Unless you add some unrelated conditional logic I think you will find OB1 surprisingly consistent. If the plc is made to execute the same instructions every scan and perform the same housekeeping every scan the scan time will come back very close to the same every time. The OB35 calls may be enough to add some inconsistency for you so make sure you either run these concurrently or allow OB35 to run with some code in it when you run the OB1 test. Comms may also be enough to induce some scan variation.

The thing you won't get with OB35 that you will get with OB1 are the 'flyers'. Every once in a while system requirements line up just right and the scan time of the continuous task will jump to some relatively high number. For example, you typical scan time may be 10 msec but every once in a while you will see a scan time of 30 msec. This is where I really see the value of the timed interrupts. You don't get the flyers.

This isn't a concern for plc internal simulations, be also keep in mind that there is a component of variation due to I/O update times in the plc. This variation is most likely larger than the general variation of the plc scan. If you are calling FB41 unconditionally from OB1 this effect may be amplified as you could get multiple OB1 passes over a single I/O update.

As you said, your best course of action is probably to run the simulation in both formats and see how the results vary. However, I would trigger the FB41 call in OB1 at as close as possible to the same rate as the OB35 call. This will gaive you a common comparison point. It will also tend to minimize the effect of OB1 scan variation as you will be seeing a single scan variation over a longer period of time. This makes the variation a smaller percent. You can use bytes 6 and 7 of the DATE_AND_TIME object in the OB1 temp data to determine a delta and trigger FB41 on that.

Keith
 

Similar Topics

Hi! I am desperately looking for some simple sample programs to learn Step7. Something like the manual of Working with Step7...
Replies
52
Views
20,329
Hi everyone.I am new at Step7.I will request sample Step 7 PID algorithm including #sample, #gain, #rate, #reset knowledge of you.If you have a...
Replies
15
Views
8,079
Well, and what about permanent dealing of patterns, sample of image, algorithm of WinCC v6.0 Step7 Protool etc. Now I put some samples to file...
Replies
0
Views
3,856
This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
146
When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC...
Replies
6
Views
142
Back
Top Bottom