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

Subject: Re: Triggered autosave on exit
From: Tim Mooney <[email protected]>
To: Yong Hu <[email protected]>
Cc: Di Maio Franck <[email protected]>, [email protected]
Date: Fri, 5 Oct 2012 14:09:28 -0500 (CDT)

----- Original Message -----
> From: "Yong Hu" <[email protected]>
> To: "Mark Rivers" <[email protected]>, "Tim Mooney" <[email protected]>, "Di Maio Franck"
> <[email protected]>
> Cc: [email protected]
> 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
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Mark Rivers
> Sent: Friday, October 05, 2012 10:42 AM
> To: Tim Mooney; Di Maio Franck
> Cc: [email protected]
> Subject: RE: Triggered autosave on exit
> 
> Can I have a PV that does that when I type "exit" on my softIoc?
> 
> I agree that what Frank suggests would be very nice.
> 
> Mark
> 
> 
> ________________________________________
> From: [email protected] [[email protected]] on
> behalf of Tim Mooney [[email protected]]
> Sent: Friday, October 05, 2012 9:08 AM
> To: Di Maio Franck
> Cc: [email protected]
> Subject: Re: Triggered autosave on exit
> 
> Franck,
> 
> You can use a trigger PV to cause the save set to be written whenever
> the trigger PV posts a value.
> You can do this with a monitor save set that is also monitored:
> 
> create_monitor_set("auto_settings.req",30,"P=xxx:")
> create_triggered_set("auto_settings.req","xxx:myTrigger","P=xxx:")
> 
> Because the save-set name is the same in both calls, the second
> doesn't add a new save set, but instead adds a new method to the
> existing save set.
> 
> Tim
> 
> ----- Original Message -----
> From: "Di Maio Franck" <[email protected]>
> To: [email protected]
> Sent: Friday, October 5, 2012 4:55:12 AM
> Subject: Triggered autosave on exit
> 
> Dear Experts, Gurus and Educated Friends
> 
> A question that probably already popped-up in the past...
> 
> If we want that when the IOC process exits (in an healthy state)
> because it has been requested so (i.e. not crashed), the autosave is
> executed before the exit ... how can that be done?
> 
> The objective is to prevent that the changes made few seconds before a
> "restart" are lost (a use case during tests).
> And we don't want to reduce the autosave period only for this case.
> 
> Thanks!
> 
> Franck
> 
> 
> Franck Di Maio
> CODAC System Designer
> CODAC Section
> 
> ITER Organization, Building 519/027, CHD, Control System Division
> Route de Vinon sur Verdon - 13115 St Paul Lez Durance - France
> Phone: +33 4 42 17 64 05
> 
> 
> 
> --
> Tim Mooney ([email protected]) (630)252-5417 Software Services Group
> (www.aps.anl.gov) Advanced Photon Source, Argonne National Lab

-- 
Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab

Replies:
RE: Triggered autosave on exit Hu, Yong
Re: Triggered autosave on exit Ralph Lange
References:
RE: Triggered autosave on exit Hu, Yong

Navigate by Date:
Prev: RE: Lambda-TDK Genesys support Szalata, Zenon M.
Next: RE: Triggered autosave on exit Hu, Yong
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Triggered autosave on exit Eric Norum
Next: RE: Triggered autosave on exit Hu, Yong
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·