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  <20182019  2020  2021  2022  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  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Sequencer seem to skip states with EPICS 3.16.1
From: Benjamin Franksen <[email protected]>
To: Simon Reiter <[email protected]>, <[email protected]>
Date: Wed, 31 Jan 2018 13:04:42 +0100
On 01/31/2018 11:52 AM, Simon Reiter wrote:
> On 01/31/2018 10:15 AM, Ralph Lange wrote:
>> Have a look at
>> http://www-csr.bessy.de/control/SoftDist/sequencer/Tutorial.html#asynchronous-use-of-pvput
>>
>> I think the SYNC option of pvPut(), which turns it into a blocking
>> call, might help.
>>
>> Cheers,
>> ~Ralph
>>
> I tried this now with
>> #define SET_PV(pv_variable, value) \
>> { \
>>     pv_variable = value; \
>>     pvPut(pv_variable, SYNC);
>> }
> but I still observe the same behavior in EPICS3.16 and EPICS7.
> 
> Switching to ASYNC and using pvPutComplete into the when condition did
> not solve the problem
>> 2018-01-31 11:48:46.633 [fine   ] [sm] new state reached: 6 (STARTING)
>> 2018-01-31 11:48:46.634 [fine   ] [sm] new state reached: 3 (RUNNING)
> The log messages (ASYNC & pvPutComplete) in the IOC looks fine.
> 
> Further ideas?

I have tried to reproduce your problem by simplifying it to the bare
essentials: three states that do nothing but announce themselves through
a PV (using your macro and parts of your enum definition) and then
(unconditionally) go to the next state, looping the whole process for 10
iterations. I camonitor the PV state_current and expect to get a
sequence of values 1 2 3 1 2 3 etc. With normal pvPut this indeed fails:

franksen@tiber: ~ > camonitor state_current
state_current                  2018-01-31 12:54:53.663351 3
state_current                  2018-01-31 12:56:20.357273 1
state_current                  2018-01-31 12:56:20.357293 1
state_current                  2018-01-31 12:56:20.357348 2
state_current                  2018-01-31 12:56:20.357348 2
state_current                  2018-01-31 12:56:20.357418 3
state_current                  2018-01-31 12:56:20.357418 3

The reason it fails is that the fire-and-forget pvPut commands are
issued in a very tight loop here; the server receives the next ca_put
message before it can act (process, issue monitor events) on the first.

But with pvPut(pv_variable, SYNC) I get the expected

franksen@tiber: ~ > camonitor state_current
state_current                  2018-01-31 12:56:20.357418 3
state_current                  2018-01-31 12:57:35.429494 1
state_current                  2018-01-31 12:57:35.429605 2
state_current                  2018-01-31 12:57:35.429714 3
state_current                  2018-01-31 12:57:35.429801 1
state_current                  2018-01-31 12:57:35.429885 2
state_current                  2018-01-31 12:57:35.429965 3
state_current                  2018-01-31 12:57:35.430041 1
state_current                  2018-01-31 12:57:35.430120 2
state_current                  2018-01-31 12:57:35.430234 3
state_current                  2018-01-31 12:57:35.430343 1
state_current                  2018-01-31 12:57:35.430450 2
state_current                  2018-01-31 12:57:35.430590 3
state_current                  2018-01-31 12:57:35.430679 1
state_current                  2018-01-31 12:57:35.430771 2
state_current                  2018-01-31 12:57:35.430865 3
state_current                  2018-01-31 12:57:35.430962 1
state_current                  2018-01-31 12:57:35.431060 2
state_current                  2018-01-31 12:57:35.431153 3
state_current                  2018-01-31 12:57:35.431274 1
state_current                  2018-01-31 12:57:35.431381 2
state_current                  2018-01-31 12:57:35.431476 3
state_current                  2018-01-31 12:57:35.431559 1
state_current                  2018-01-31 12:57:35.431653 2
state_current                  2018-01-31 12:57:35.431745 3
state_current                  2018-01-31 12:57:35.431838 1
state_current                  2018-01-31 12:57:35.431933 2
state_current                  2018-01-31 12:57:35.432038 3
state_current                  2018-01-31 12:57:35.432123 1
state_current                  2018-01-31 12:57:35.432204 2
state_current                  2018-01-31 12:57:35.432281 3

I attached the test program and the db file.

Cheers
Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams
record(mbbo,"state_current") {
}
program problem

option +s;

#define SET_PV(pv_variable, value) \
{ \
    pv_variable = value; \
    pvPut(pv_variable, SYNC); \
}
%%enum { State_UNKNOWN = 0, State_READY = 1, State_STARTING = 2, State_RUNNING = 3 };

int pv_state_current = State_UNKNOWN;
assign pv_state_current to "state_current";

ss problem {
  int counter=0;
  state S_READY {
    entry {
      SET_PV(pv_state_current, State_READY);
    }
    when() {
    } state S_STARTING
  }
  state S_STARTING {
    entry {
      SET_PV(pv_state_current, State_STARTING);
    }
    when() {
    } state S_RUNNING
  }
  state S_RUNNING {
    entry {
      SET_PV(pv_state_current, State_RUNNING);
    }
    when (++counter >= 10) {
    } exit
    when() {
    } state S_READY
  }
}

Attachment: signature.asc
Description: OpenPGP digital signature


Replies:
Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
References:
Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
Re: Sequencer seem to skip states with EPICS 3.16.1 Ralph Lange
Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
Re: Sequencer seem to skip states with EPICS 3.16.1 Ralph Lange
Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter

Navigate by Date:
Prev: Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
Next: Re: EPICS database macro warning Mark Rivers
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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
Next: Re: Sequencer seem to skip states with EPICS 3.16.1 Simon Reiter
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  <20182019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·