FB41 in Simatic S7

L

Thread Starter

Lee Rehorn

Now that I've got velocity and position control programs for my S7-300 written and working well, I want to incorporate PID control. I thought this would be easy: just plop in FB41, fill in the blanks, and poof! This hasn't turned out to be true: I get a permanently-overdamped response in my velocity control program (regardless of my P gain) and no response at all in my position control program. As I say, both programs work well with just the use of MUL_R acting as a proportional gain (multiplying the difference between input and feedback). My big questions are: WHAT output do I use (LMN vs. ER), and what am I doing wrong with regards to my input? Below is a copy of the FB41 that I'm using in my position control program:

CALL "CONT_C" , DB1
COM_RST :=
MAN_ON :=L20.1
PVPER_ON:=
P_SEL :=L20.3
I_SEL :=L20.4
INT_HOLD:=
I_ITL_ON:=
D_SEL :=L20.7
CYCLE :=
SP_INT :=#input_angle
PV_IN :=#feedback_angle
PV_PER :=
MAN :=
GAIN :=3.500000e+000
TI :=T#10S
TD :=T#20S
TM_LAG :=
DEADB_W :=
LMN_HLM :=
LMN_LLM :=
PV_FAC :=
PV_OFF :=
LMN_FAC :=
LMN_OFF :=
I_ITLVAL:=
DISV :=
LMN :=
LMN_PER :=
QLMN_HLM:=
QLMN_LLM:=
LMN_P :=
LMN_I :=
LMN_D :=
PV :=
ER :=#PID_error

DB1 and FB41 have both been downloaded into the PLC (no errors at runtime). All variables have been defined as temporary REAL values, which works fine without PID. I am using the switches on the training module's control board to include/exlude the differen gains.

If anyone has a working PID block that they could e-mail me, I would be very appreciative!

Thank you to all who respond,
Lee Rehorn
student at the University of Western Ontario
 
S

Shahid Waqas Chaudhry

You should use the LMN (Manipulated) output of the block. The ER output is
the error signal (PV - SP).

Shahid
 
I believe that someone ought to write to siemens about their PID block. A
lot of people seem to have problems understanding it and working with it.

Anand
 
D

D. C. Pittendrigh

Have a look inside the instance DB there is a bit for switching the integral
on and off, I think it is defaulted to off when you generate the DB, maybe
you are running with no integral.

The Siemens PID configuration package is a little expensive but gives a very
good graphical representation of the PID usefull for setting up and tuning

Cheers
Donald Pittendrigh

 
D

D. C. Pittendrigh

Hi All

I am sure that Siemens will welcome any feedback on the quality of their
product, however I would like to add that Siemens does two things to make
the PID experience very easy for a novice Siemens programmer. Firstly all
the documentation you could ever need on the topic is available for free on
their website and it discusses in depth the meaning and use of the various
parameters for this software, and secondly they produce a graphical setup
and optimisation tool that removes the need to even read the documentation
as the whole PID structure is set up graphically, really very simple
excercise if you do it properly.

Regards
Donald Pittendrigh
 
L
The question is, WHICH Siemens website contains this storehouse of information? Every time I search for Siemens PLC info, I always get a different page dealing with the same basic thing. I have no idea how many Siemens pages are out there, but apparently there are tons. Can you give me the URL for the page that has all of this info?
 
S

Shahid Waqas Chaudhry

You should use the LMN (Manipulated) output of the block. The ER output is
the error signal (PV - SP).

Shahid
 
L
Thanks to all for your replies. I did finally get the block to work, but I find that I have to have my integral gain exceptionally high in order to simply reduce instability (always unstable) - I'm talking 700 seconds! Is this normal??

 
M

Michael Griffin

I am not familiar with FB41. However, if you are referring to "700 seconds" as being the time required to settle out after a set point change, then no this is not normal.
If however you are referring to "700 seconds" as being the integral gain parameter, then don't worry about what the units are - they don't really mean anything useful. Some people refer to integral gain as "reset", and give the gain parameter in units of "seconds per reset", or "resets per second". Most PID controls I have seen don't bother to apply any units. The gain parameters are just numbers and you add more or less gain as required to tune the loop.


**********************
Michael Griffin
London, Ont. Canada
**********************
 
> If however you are referring to "700 seconds" as being the integral
> gain parameter, then don't worry about what the units are - they don't
> really mean anything useful.

Yes, 700S is the integral gain. After further experimentation, it seems that the system can never quite reach stability. If I turn on the system with all three gains activated, the motor quivers back and forth and draws far more current than it is meant to handle. However, if I dial in each gain one at a time, it works smoothly for the first two or three minutes; after this time, it begins to quiver again. I've messed with all of the gains, but nothing seems to correct this. Should I have some sort of "error range" for my value, so that if the difference between my setpoint and feedback point is, say, 2%, then the system will ignore it? The constant quiver suggests to me that the motor is overshooting when it corrects, and it keeps doing this over and over. Or is there something else that I should do?

While I have your guys' expert attention, how do I get the S7-300 to output NEGATIVE voltages? FC106 (the "unscale" block that converts a REAL value to a voltage) won't accept negative values, so I don't know how to make use of the -10V part of the +/-10V capability.

Thanks again to everyone for their input (pun!)
Lee Rehorn
[email protected]
 
D

D. C. Pittendrigh

Hi All

Please let me know what is the Word address of this time constant, It should be in DBD 24 in TIME format. If this value is really showing a time of 700S and not 700mS then the integral portion of your controller is reset every 11.6 minutes, I would say you could switch it off and forget about it, it is contributing virtually nothing to the equation. What are you controlling?
Perhaps as all you have now is a simple proportional controller, some form of limit value monitor might be more appropriate.

Regards
Donald Pittendrigh
 
M

Michael Griffin

At 14:00 26/07/01 -0400, Lee Rehorn wrote:
<clip>
>Yes, 700S is the integral gain. After further experimentation, it seems
>that the system can never quite reach stability. If I turn on the system
>with all three gains activated, the motor quivers back and forth and draws
>far more current than it is meant to handle. However, if I dial in each
>gain one at a time, it works smoothly for the first two or three minutes;
>after this time, it begins to quiver again. I've messed with all of the
>gains, but nothing seems to correct this. Should I have some sort of
>"error range" for my value, so that if the difference between my setpoint
>and feedback point is, say, 2%, then the system will ignore it? The
>constant quiver suggests to me that the motor is overshooting when it
>corrects, and it keeps doing this over and over. Or is there something
>else that I should do?

Your problem sounds like incorrect tuning. Fiddling with the output value outside of the PID block is not the answer - it is just likely to make things worse. Are you following one of the established tuning methods, or are you just fiddling with the numbers? If the latter, there are far more ways to get things wrong than to get them right.

There are other gentlemen on this list who would be much better at PID tuning than I am, but I will attempt to give a few suggestions.
1) If you are not following an established PID tuning method (e.g. Ziegler-Nickols), then I would suggest you research this subject. Stay away from any method that looks overly complicated though. You might search the
message archives on this list for any discussions on this.
2) The motor characteristics will change slightly as it warms up, so don't try to tune it too tightly. You don't have a real servo motor
controller, so don't expect too much from your hardware.
3) Make sure you have some form of anti-integral (or anti-reset) wind-up active. This shouldn't affect steady state performance, but should help for large set-point changes.
4) You might try leaving out using derivative, as this can be tricky. We've done somewhat similar things with integral gain only (no proportional and no derivative), and it worked reasonably well.
5) Write down the different gain parameters and the results as you are tuning. This will help you keep track of what you did, otherwise it is easy to become confused.


>While I have your guys' expert attention, how do I get the S7-300 to
>output NEGATIVE voltages? FC106 (the "unscale" block that converts a REAL
>value to a voltage) won't accept negative values, so I don't know how to
>make use of the -10V part of the +/-10V capability.
<clip>
I'm not sure how your drive has been operating, but if you haven't been able to output negative values, this may have some relation to your above mentioned tuning problems. I would suggest you should try to fix this before attempting to tune the system.
I don't have any Siemens documentation handy on the various FCs available. However, if FC106 only handles positive numbers and there is no equivalent FC for +/- values, then there is no reason why you couldn't simply write your own FC and use that instead. The manual (PDF file) which
covers that module will describe the analogue value representation in great detail.


**********************
Michael Griffin
London, Ont. Canada
**********************
 
Top