![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 23
|
Siemens S7 PID Control Problem
Hello All,
I’m afraid that I’m new to PID control but what I have read on the subject so far leads me down the following path..... I am programming an application to control the water level of a tank. To achieve this I am using a PID loop to control a pump via a variable speed drive that is controlled by an Analogue Output 4-20mA. The value that I write to the Analogue Output will be derived from a Siemens PID Data Block DB201 CONT_C after being “unscaled” to give the appropriate analogue speed signal to the drive. I also think that I need the following values inputted into DB201 to allow for the control of the drive: Update Time (seconds) – CYCLE Control Level (metres) – SP_INT Actual Water Level (metres) – PV_IN Gain – GAIN Integral Time (seconds) – TI DeadBand (metres) – DEADB_W Can anyone give their opinion on whether or not I’m on the right track or if I am missing further variable/bits that need to be written to the DB in order for the PID loop to produce an output? Any advice on this matter will be greatly appreciated. As I say, I am new to the whole PID philosophy and although I can appreciate what the overall outcome will be, I’m not overly sure of all the components that are needed to/from Data Block 201 to achieve this. That's if 201 is the right Data Block to use? Many Thanks Qee. |
![]() |
![]() |
#2 |
Member
|
Just a quick thought as I'm not familiar with S7 PID:
It doesn't sound to me that you need to use a PID for keeping the water level in a tank, unless it have to be very accurate. If it doesn't need to be accurate, you can choose to use a 3-point regulation rather than the PID, even though the PID is more fun getting to work. |
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Mar 2007
Location: --
Posts: 7
|
have you ever solved this ?
I need to do the exactly same thing using sinamics S120 vector control. I wonder if I would use regulation with certain points (which seems not to be that easy either) or pid control. Any help/ideas would be much appreciated ![]() |
![]() |
![]() |
#4 | |
Member
|
Quote:
Place this in OB35 (Time based Interupt set as 100mSec by default) Call FB41 and used whatever DB you want (as long as it's unused elesewhere). You will need to use the following: Update Time (seconds) – CYCLE, Set it for 1Sec (T#1.0S) Control Level (metres) – SP_INT (Variable Setpoint 0.0~100.0 Real) Actual Water Level (metres) – PV_IN (Variable Feedback (Scale it 0~100.0% Gain – GAIN (Try 2.0 and tweek from there) Integral Time (seconds) – TI (try T#20.0S) DeadBand (metres) – DEADB_W (Leave as 0.0 for now) LMN_HLM (Hight limit) 100.0 LMN_LLM (Low limit) 0.0 Output (Real 0-100.0) LMN Download the works and you should be in business (OB35, FB41, DBxxx) Scale LMN to what you need and throw it at drive) Nick (S120 has built in PID) |
|
![]() |
![]() |
#5 |
Member
![]() ![]() Join Date: Mar 2007
Location: --
Posts: 7
|
Thank you nick.
"S120 has built in PID" --> you suggest using that one ? Or do I need the block FB41 together with it ? There are some conditions. When there is taken very less water, we dont want the pump to be pumping at for example 10 hz. In such case we want to wait a little longer at 0 hz so it can pump at higher speed at little later. Is this all possible with PID regulation ? Does that work with the high/low limit I feed to the pid ? The output value could be a value between 0 and 100% if I understand this well. Could I just scale that to the drive setpoint range ? Or how would I start this. Is there any way to test pid regulation offline (simulation) ? I really would like a simple alternative to put in it too. The installation is already in the field. The first time it's restarted I want to be sure I have something that certainly works. Last edited by JGS; March 15th, 2007 at 04:43 AM. |
![]() |
![]() |
#6 |
Member
![]() ![]() Join Date: Mar 2004
Location: .
Posts: 1,136
|
Nick_B
There's one very important piece of information for running FB41 successfully that I can't see in your advice. There is no point in leaving OB35 set at 100mS (which calls FB41 every 100mS) but then telling FB41 that its cycle time is 1S. If it's being run at 100mS tell it the truth! Tell it 100mS, or else adjust the cycle interrupt time for OB35 to 1S. Whatever the frequency of execution is, you have to tell FB41 the correct value. Otherwise calculations can start to get screwed up. Let's say a process change takes place between two calls of FB41 which results in the PV_IN altering by 1%. FB41 thinks it took 1S for this second to occur but in reality it happened in 100mS, 10x faster. FB41 won't adjust parts of the output enough, especially the integral component, to compensate and meanwhile the change continues uncorrected. Regards Ken |
![]() |
![]() |
#7 | |
Member
|
Quote:
I see what your saying but should he need to do another Time Based Interrupt the CPU he's got may not support this and he'll have to do a hardware download and change value back. OB35 defaults at 100mSec and as such I didn't want to confuse him with to many steps. He's doing level control...I suspect 10 Sec would work. I was just trying to keep it simple and not load up his CPU with superfluous tasks. Nick |
|
![]() |
![]() |
#8 | |
Member
|
See below:
Quote:
|
|
![]() |
![]() |
#9 | |
Member
![]() ![]() Join Date: Mar 2004
Location: .
Posts: 1,136
|
Nick
Quote:
You may get away with it in this application and other slow dynamic applications but it will catch someone out some day on another job. The trouble with open forums like this is you're never just answering one person about one problem. Many people will read and use this guidance in other PID applications whether we mean them to or not. We have a duty to them as well not to miss bits out. If other timed-interrupt tasks are needed then the correct way to handle this is by doing task scheduling within OB35. If you leave it running at 100mS but only want FB41 to cycle every 1S, then only call FB41 once every tenth execution of OB35. I've seen a PLC like this where 20 PIDs were needed, all at a 1S interval. One alternative was to have OB35 run once a second and call all 20 instances of FB41 in that scan. You can imagine the effect that had on the scan time during that one scan! The other alternative was to have it running at 100mS and call nos.1 and 2 during cycle one, 3 and 4 during cycle two, 5 and 6 during cycle three etc. Only two FB41s were being executed at a time, but they were all being updated once a second, and the effect on the scan time was smeared out across all scans. Now then OB35 was running at 100mS and the loops were being executed at 1S intervals, so what was the correct value for CYCLE_TIME? Well, T#1S. This connection absolutely has to be correct if you want accurate control. Regards Ken |
|
![]() |
![]() |
#10 | |
Member
|
Quote:
I was answering his specific question and application. Question based on what he wanted to do and limited information (he didn't even list which FB he wanted to use I offered my suggestion). In the future I will ask for a PO and let my lawyer look it over before I cut it loose. I have two questions for you: 1. Does it work? 2. Is the person who asked the initial question happy? On the matter of whether it's wrong. I understand it's different platform but look at the way Siemens generates code for the S7-200 wizard. They do largely the same thing. Generate a 100mSec Interrupt and count off 10 times before it executes. In a PCS7 project from memory the wizard does about the same thing. Oh and a Ken...he's not running 20 PID's...then I would have answered accordingly. Nick |
|
![]() |
![]() |
#11 |
Lifetime Supporting Member
|
Simply put, Ken is right.
Don't take shortcuts, 'Even If It Works'. You are telling the PID FB that is is updating 10 times slower than it actually is. As pointed out in several other threads here, that will throw the gains completely off, especially if the interrupt time is changed, or the PID is copied to another project. The update time for the FB should be equal to the period in which it is called. End of story. |
![]() |
![]() |
#12 |
Member
![]() ![]() Join Date: Mar 2007
Location: --
Posts: 7
|
I must say this is pointless, I was far enough to get the idea that the sample time should be correct and I'm happy with nick's answers.
He seems to be the only one that replies that is actually trying to help me further in stead of discussing endlessly about the sample time. If you are so good with it, help me than please ![]() Anyhow if anyone still wants to help. This is what I can try to do. Correct me where I'm wrong The situation: - 2 pumps of 11 Kw are filling a pressure tank and this water is also going to the field. - 1 pump works as hot spare or it could also help when one pump is not enough (this never happened yet) - This installation is pretty old and will now be updated with the following key components: Siemens CPU 315-DP 2x Sinamics S 120 (with cu310) 1x analog water level measurement in pressure tank 1x analog pressure meter The idea: Not starting and stopping the pumps as often as before. The pumps are regulated by the water level in the pressure tank How could I do it ? a)Using a simple on/off between 2 water levels b)perhaps trying to use PID BUT I dont want the pumps to be running at too slow speeds because the efficency would be too low. So if I understand correctly: - I can use the FB41 - I can just update the setpoint in the sinamics via profibus with the output from my PID (with properly scaling the output) - if I config the drive for example for a minimum speed of 20 hz, will that fix my problem ? Or would I better calculate this myself ? LMN_HLM (Hight limit) 100.0 LMN_LLM (Low limit) 0.0 This is the input I suppose ? No option to set a minimum output in the pid fb ? I have PLCSIM but I cant imagine how I can simulate the process in a good way (I cant update the input like it would be more or less in reality I THINK) Or do you have a good simulation idea about this ? Any tips/hints I should know when I try to start up this thing ? Will it act weird ? Other things I should know ? Thanks for your input thus far ![]() Last edited by JGS; March 15th, 2007 at 04:43 PM. |
![]() |
![]() |
#13 |
Member
![]() ![]() Join Date: May 2005
Posts: 340
|
CALL "CONT_C" , DB10
COM_RST := MAN_ON :="piddata".mode[1] PVPER_ON:= P_SEL := I_SEL := INT_HOLD:= I_ITL_ON:= D_SEL := CYCLE := SP_INT :="piddata".setpoint[1] PV_IN :="piddata".pv[1] PV_PER := MAN :="piddata".moutput[1] GAIN :="piddata".gain[1] TI :="piddata".ti[1] TD :="piddata".td[1] TM_LAG := DEADB_W := LMN_HLM := LMN_LLM := PV_FAC := PV_OFF := LMN_FAC := LMN_OFF := I_ITLVAL:= DISV := LMN :="piddata".blk_output[1] LMN_PER := QLMN_HLM:= QLMN_LLM:= LMN_P := LMN_I := LMN_D := PV := ER := why do not u used the logic in the drive . Micromaster 440 has a pi algorithm |
![]() |
![]() |
#14 | |
Member
|
Quote:
I kept it simple and I feel gave him enough info to get started. Depending on which CPU he has he may not have another Time based Interrupt to use. I left it as and I stand by it would and does work well. He doesn't have 20 PID's and we seems happy with what I gave him. I suggest seeing as you know better you right a more comprehensive example. It does not through the gains off...try it yourself. Nick |
|
![]() |
![]() |
#15 | ||||
Member
![]() ![]() Join Date: Mar 2004
Location: .
Posts: 1,136
|
Nick and JGS
Let's start with an apology. Sometimes our words run away with us and meanings get implied and inferred which should never have been there in the first place. So, I'll say I'm sorry if we've got a bit tangled up in this issue. However ... ![]() Nick Quote:
Quote:
Quote:
JGS Quote:
Regards Ken |
||||
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PID control using Siemens S7 315-2 PLC | tomcoll | LIVE PLC Questions And Answers | 6 | November 13th, 2013 08:15 AM |
Siemens S7 Ethernet Problem | S7Guy | LIVE PLC Questions And Answers | 7 | February 4th, 2008 04:51 PM |
problem with PID control | cardmaster24 | LIVE PLC Questions And Answers | 6 | December 7th, 2004 01:44 AM |
GE Fanuc VersaMax PID control problem | Shawn Cassidy | LIVE PLC Questions And Answers | 6 | May 16th, 2004 10:10 AM |
how often should I trigger the PID? | Ron Beaufort | LIVE PLC Questions And Answers | 11 | February 22nd, 2003 12:57 PM |