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  <20122013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: RE: Triggered autosave on exit
From: "Hu, Yong" <yhu@bnl.gov>
To: "'Tim Mooney'" <mooney@aps.anl.gov>
Cc: Di Maio Franck <Franck.DiMaio@iter.org>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Fri, 5 Oct 2012 19:16:23 +0000
Hi Tim,

Thank you for pointing out using "iocshCmd". It is working for me now. You saved my day.

Thanks again,

Yong 

-----Original Message-----
From: Tim Mooney [mailto:mooney@aps.anl.gov] 
Sent: Friday, October 05, 2012 3:09 PM
To: Hu, Yong
Cc: tech-talk@aps.anl.gov; Mark Rivers; Di Maio Franck
Subject: Re: Triggered autosave on exit


----- Original Message -----
> From: "Yong Hu" <yhu@bnl.gov>
> To: "Mark Rivers" <rivers@cars.uchicago.edu>, "Tim Mooney" <mooney@aps.anl.gov>, "Di Maio Franck"
> <Franck.DiMaio@iter.org>
> Cc: tech-talk@aps.anl.gov
> Sent: Friday, October 5, 2012 11:42:42 AM
> Subject: RE: Triggered autosave on exit Franck's use case of the 
> autosave is very interesting, but I guess it may take efforts to find 
> the solution. I have tried different ways on Linux softioc:
> 
> 1. I tried to add manual_save() to the xxxMain.cpp. Something like
> these:
> 
> iocsh(NULL);
> manual_save("xxx.req");
> epicsThreadSleep(2);
> epicsExit(0);
> 
> However, this will not work since manual_save() is only available in 
> the autosave module and it is not included in the EPICS base.

This works for me:

int main(int argc,char *argv[])
{
    if(argc>=2) {    
        iocsh(argv[1]);
        epicsThreadSleep(.2);
    }
    iocsh(NULL);
    iocshCmd("manual_save('auto_settings.req')");
    epicsThreadSleep(2);
    epicsExit(0);
    return(0);
}

The sleep is needed because manual_save() just makes a request, and returns before the save has occurred.

A better manual save would check the save set's 'save_state', and not return until the MANUAL bit had been cleared.
Maybe I should add an argument to manual_save, to indicate for how long the function should wait for action before returning.

A more general solution might read autosave's list of save sets, and save them all.  (But a user might want some sets to be written only in response to a specific trigger.)


> 2. I tried to use create_triggered_set() in the startup script file
> (st.cmd) just as Tim's suggestion. Also I used the devIocStats module 
> which provides a PV named "yhuHost:SYSRESET" to reboot the IOC. Here 
> are the configurations for st.cmd and db file:
> 
> st.cmd:
> 
> create_monitor_set("auto_settings.req",30,"P=xxx:")
> create_triggered_set("auto_settings.req","yhuHost:resetIOC","P=xxx:")
> 
> db file:
> 
> record(bo,"yhuHost:resetIOC")
> {
> field(ZNAM,"NoRest")
> field(ONAM,"Reset")
> field(FLNK,"yhuHost:seqExample")
> }
> 
> record(seq,"yhuHost:seqExample")
> {
> #delay 2 seconds to reboot the IOC
> field(DLY1,"2")
> field(LNK1,"yhuHost:SYSRESET.PROC ")
> }
> 
> When I do "caput yhuHost:resetIOC 1", the autosave is really executed 
> (the save file "auto_settings.save" is written) and then about 2 
> seconds later, there is a message output "IOC reboot started" from the 
> softioc. However, the IOC is not really rebooted, it is hung up (I 
> still see the Shell "epics>").
> 
> Any suggestion about my second approach? Any other better way?

I cannot get devIocStats SYSRESET to restart a soft ioc by setting it manually either.  It just exits.

xxxMain.cpp could restart the ioc, if there were some way to get the information back to it that this is wanted.
I haven't figured out how to do that.

> Thanks,
> 
> Yong
> 



References:
RE: Triggered autosave on exit Hu, Yong
Re: Triggered autosave on exit Tim Mooney

Navigate by Date:
Prev: Re: Triggered autosave on exit Tim Mooney
Next: First Use Of 3.14.12.2 - target builds try to produce code for host also Duane Voy
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
Navigate by Thread:
Prev: Re: Triggered autosave on exit Tim Mooney
Next: Re: Triggered autosave on exit Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·