Sample Step7 PID algorithm

mhmtfthnl

Member
Join Date
Nov 2003
Location
everywhere I can go
Posts
42
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 sample program, may you send it to me.Thank you so much.
 
Well, here are the figures I tend to use -

Sample rate : 1s
Gain : 12.5
Rate : 6.7m
Reset : 23.75s

Of course, I've never actually managed to control anything with these figures so they might not work for you either.

Ken
 
What I mean is how to program a pid algorithm.Namely how can i do that.For example input value is temperature and output value is a fan speed.What and how can I use parameters in the FB41 or FB42 blocks.Thank you.
 
I think you'll have to do some further research in to PID, perhaps by searching at this forum. There's lots of good guidance in to this potentially very complex area of process automation.

I know the Siemens FB41 and FB42 blocks have pretty extensive help files associated with them in STEP7 (just press F1 when you have one of these blocks highlighted). That should tell you exactly what each input and output parameter does and what datatype is expected for each one. You don't need to apply actual values to all of the parameters. Selectively use the ones you need. Unfortunately I can't say what ones you will need. Maybe you don't need PID, you only need PI. Is the temperature a raw analog input, or is it already a scaled degrees value as a result of some other operation in your code? Teaching PID by e-mail or internet is like trying to teach someone how to ride a bike by telephone.

One very important hint : call the FB from a timed interrupt OB like OB35, not from the variable scan OB1. Whatever time interval is configured for OB35 must be used as the same value for the sample time of the block itself. You can adjust OB35's execution interval in the CPU Properties in the Hardware Config of STEP7.

Regards

Ken.
 
Not sure I can see why Ken wants to call the continuous PID controller from a timed interrupt OB , I've enveloped FB41 into my own purpose built block , making the interface really easy - also allowing the user to select STI type operation , or a fixed operation time , user selectable . I have found that this works just fine for most applications .
 
Hi 10baseT

The main issue I was trying to impress on mhmtfthnl (have I spelled that correctly?) was that of timing. Given the entry level of his initial question I must admit I gave him a method without explaining in detail why.

There is no point in attempting to execute the FB41 PID block when the intervals between calling it are not regular. If the timebase for each succesive execution varies then how can the integration calculation be accurate, among other things? If he just calls it from OB1 then, almost by definition, the execution interval will vary. Calling it from within a timed interrupt like OB35 removes that problem entirely.

Of course, mhmtfthnl could write additional code in OB1 based on some time source to call his block at intervals. Again, I wasn't sure that recommending "oh, just write some code to do ... " was the appropriate answer for someone whose PID understanding appeared low. Anyway, since the feature exists already in the CPU I didn't see any need to re-invent the wheel.

Finally, what do you mean by STI operation and fixed time operation? I think I understand the latter (is this what I'm recommending?) but I'm not sure about the former. Have I missed something along the way in my handling of PID FBs?

Regards

Ken
 
STI - it comes from AB-world, doesn't it ? And it means timed interrupt routine (which is same as OB3x in Siemens-world). Right, 10baseT ?
 
Sorry for creating confusion !
rather than loading the processor up with unnecessary PID calculations , I tend to use 100ms as a "cycle time" , which is settable on the outside of the block , rather than a call in OB35 , which is obviously more difficult to change on the fly . Dependent on the process , PID controllers can run a good deal slower than you might think whilst still controlling the process . This can be particularly important with the lower end processors and multiple loops - I have managed 22 loops on a 315 processor , it still ran well .
 

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,253
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...
Replies
4
Views
6,610
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,849
I am looking for any simple sample isp plc file for a Delta PLC. I currently have version 3.06 if that matters. I am looking to practice...
Replies
1
Views
586
Hello Guys, Can anyone share the Combined tube autopilot program If anybody worked with it.. we have newly installed this Auto pilot CT which is...
Replies
8
Views
1,348
Back
Top Bottom