EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPID Record
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: "Jemian, Pete R." <jemian at anl.gov>, "benjamin.franksen at helmholtz-berlin.de" <benjamin.franksen at helmholtz-berlin.de>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Sun, 14 Feb 2021 02:18:37 +0000
Ben wrote:

> That means KI must *always* be non-zero. I find it a bit strange that it
> initially has to move away from the correct output value only to arrive
> at that value some steps later. Is it possible to preload the I with a
> non-zero value if one has a good guess what its initial value should be?


No, that is not true.


Pete wrote:

> The epid record has the feature you describe.  Set the .I value (it is
> writable, too) before you turn it on and it will start from that value.

No, that is not necessary:

The soft device support contains this code:

            if (pepid->fbon) {
                if (!pepid->fbop) {
                    /* Feedback just made transition from off to on.  Set the integral
                       term to the current value of the controlled variable */
                    if (pepid->outl.type != CONSTANT) {
                        if (dbGetLink(&pepid->outl,DBR_DOUBLE,&i,0,0)) {
                            recGblSetSevr(pepid,LINK_ALARM,INVALID_ALARM);
                        }
                    }

Whenever feedback make the transition from off to on the value of the integral term is set to the current value of the controlled variable.  So, for example:

- Your DAC is set to the value 1.64 V that sets the furnace to 400 C
- You set the setpoint (.VAL) to 400 C.
- You turn on feedback.  The integral term (I) will be set to the current value of the DAC, 1.64.  This means that turning on feedback is "bumpless".
- Now you can change the setpoint to 500 C, and it will use PID to get there.
- If you set the VAL to 500 before turning on the feedback it still behaves reasonably, since the I term is set to the DAC value for the current temperature, 400 C.

I apologize that this behavior is not documented.  The documentation is clearly very out of date, since it refers to MPF and not to ASYN, which is what it currently uses for fast-feedback.

Pull requests for documentation updates welcome.

Mark


________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Jemian, Pete R. via Tech-talk <tech-talk at aps.anl.gov>
Sent: Saturday, February 13, 2021 6:39 PM
To: tech-talk at aps.anl.gov
Subject: Re: EPID Record

Ben:

The epid record has the feature you describe.  Set the .I value (it is
writable, too) before you turn it on and it will start from that value.

For others who may want to find the epid record documentation:
https://epics.anl.gov/bcda/synApps/std/epidRecord.html

Pete

On 2/13/2021 5:44 PM, Ben Franksen via Tech-talk wrote:
> Hi Mark
>
> I slightly re-arranged your reply.
>
> Am 13.02.21 um 13:32 schrieb Mark Rivers:
>>> Suppose we have been at the target position for some time, i.e.
>>> VAL=OVAL, so that E(n)=0 for all n. Then all terms become 0 and the
>>> output is OVAL=0 as well. But shouldn't it be OVAL=VAL instead?
>> Your statement that "we have been at the target position for some
>> time, i.e. VAL=OVAL" is also incorrect.  When it is at the target
>> position VAL=CVAL, not OVAL.
> Yes, sorry, I have confused OVAL and CVAL here.
>
>> I think your statement that "all terms become 0" is incorrect.  The
>> integral term (I) does not become zero even when sitting at the
>> desired setpoint for infinite time, because it is the integral from
>> time=T0, where T0 is the time that the feedback was turned on.
> So that means if we start the feedback when E=VAL-CVAL=0 then we will
> first move the system *away* from the desired VAL (unless it happens to
> be equal to zero). Then we accumulate the errors, increasing I at each
> step, until after a while I is large enough to compensate our initial error.
>
> That means KI must *always* be non-zero. I find it a bit strange that it
> initially has to move away from the correct output value only to arrive
> at that value some steps later. Is it possible to preload the I with a
> non-zero value if one has a good guess what its initial value should be?
>
>> The integral term is what prevents "droop", e.g. it is what supplies
>> the constant power required to keep a furnace at 500 C even when the
>> error is 0.
> Ok, I think I understand this now. Thanks.
>
>> I use the EPID record for lots of tasks and it seems to work fine.
>> Have you observed an issue which led you to post this message?
> Not me personally. Some physicists wanted to understand the behavior of
> one of our control loops better, looked at the formula and came up with
> the above objection. I agree that with a non-zero KI it should work
> (after enough initial cycles).
>
> Cheers
> Ben
>

--
----------------------------------------------------------
Pete R. Jemian, Ph.D.                 <jemian at anl.gov>
Beam line Controls and Data Acquisition (BC, aka BCDA)
Advanced Photon Source,    Argonne National Laboratory
Argonne, IL  60439                    630 - 252 - 3189
-----------------------------------------------------------
       Education is the one thing for which people
          are willing to pay yet not receive.
-----------------------------------------------------------



Replies:
Re: EPID Record Mark Rivers via Tech-talk
Re: EPID Record Ben Franksen via Tech-talk
Re: EPID Record Ben Franksen via Tech-talk
References:
EPICS Record Ben Franksen via Tech-talk
Re: EPID Record Ben Franksen via Tech-talk
Re: EPID Record Mark Rivers via Tech-talk
Re: EPID Record Ben Franksen via Tech-talk
Re: EPID Record Jemian, Pete R. via Tech-talk

Navigate by Date:
Prev: Re: LUA: Segmentation fault on Raspberry for IOC being invoked from shell prompt; no problem via gdb execution. Lang, Keenan C. via Tech-talk
Next: Re: EPID Record Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Re: EPID Record Jemian, Pete R. via Tech-talk
Next: Re: EPID Record Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 15 Feb 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·