EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: PV save and restore tool sought
From: "Elder Matias" <[email protected]>
To: <[email protected]>
Date: Thu, 28 Jun 2007 14:01:43 -0600
 
To add to the list of save/restore programs, I have attached the
description of the program we are running.  The original inspiration for
the CLS save/restore was the save/restore that existed in the old
(pre-EPICS) control system.  Several people here have worked on it at
CLS over the years (Glen did the original design and implementation and
David did the most recent set of changes).  

In addition to doing a deliberate save or restore the other key feature
is the system takes an hourly snapshot of all the IOCs, providing the
equivalent of a global undo.  Basically after going to a new setup of
the machine if you decide you want to go back to how things were a few
hours ago you or a few days ago you can do a restore based on the hourly
save.

The idea of having a save/restore integrated info the data archiver
sounds interesting.

Elder

-----------------------------

Date: Thu, 28 Jun 2007 12:43:19 -0400
From: John Sinclair <[email protected]>
Subject: Re: PV save and restore tool sought
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

One simple-minded approach I have recently taken works with Kay's 
channel archiver.

I made a simple mod to the archiveExport utility so that the command

ArchiveExport -snapshot -format decimal -precision 6 -start "06/27/2007 
00:00:00" -end "06/27/2007 00:00:00" /a/20070614_015041/Arc 
t:esx_t-2:volt_ctl

produces the following kind of output:

#06/26/2007 07:16:50.242633762
caput t:esx_t-2:volt_ctl "2.930956"

The mod makes the -snapshot option available, so don't try this with the

current
distribution.

----------------

So, then I build a file from a list of pvs like the following:

echo "Timestamp: $1"
echo "Archive:   $2"
echo "Output file is: out"
ArchiveExport -snapshot -format decimal -precision 6 -start "$1" -end 
"$1" $2 t:h2_c4_L2 >>  out
ArchiveExport -snapshot -format decimal -precision 6 -start "$1" -end 
"$1" $2 t:h2_c11_L2 >>  out
ArchiveExport -snapshot -format decimal -precision 6 -start "$1" -end 
"$1" $2 t:h2_c16_L2 >>  out
    .
    .
    .

-----------------------------

The saved values are restored by executing the output file, as shown
below.

./out

-----------------------------

OK, not very nice, but an integrated utility to do all this in a 
straightforward manner would be
great to have.

- John Sinclair


Andrew Johnson wrote:
> Matthias Clausen wrote:
>>
>> Is there a volunteer to compute a list of 'problems to be solved' 
>> versus 'tools to be used'?
>> At least I would add our tools to that list.
>>
>> Could this be a wiki page at APS? - Andrew??
>
> Sure, that would seem appropriate - if anyone doesn't already have a 
> Wiki account they should email me to have one created.  I created an 
> initial page with a pointer to the SynApps Autosave package for 
> starters, linked from the HowTo Documents wiki page, found at
>
http://www.aps.anl.gov/epics/wiki/index.php/What_PV_Save_and_Restore_Too
ls_are_available 
>
>
> Note that there are a number of save/restore tools listed on the Soft 
> Support page at http://www.aps.anl.gov/epics/modules/soft.php - this 
> would be a good place to start for more tools.
>
> - Andrew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2230 bytes
Desc: S/MIME Cryptographic Signature
Url :
http://www.aps.anl.gov/pipermail/tech-talk/attachments/20070628/8d3676a1
/smime.bin

------------------------------

Title: AutoSaveRestore - CID


AutoSaveRestore

From CID

Jump to: navigation, search

Contents

AutoSave, Auto Restore, Manual Restore of IOC Setpoint PV's

Current Version

Each IOC can have a file in the '/home/control/autosave' directory which lists PV's to get an hourly snapshot. These files are named 'IOCNAME.pvlist'. The files generated from these pvlist files are named WEEKDAY/IOCNAME.HH.settings', where WEEKDAY is the three-letter representation of the day of the week, IOCNAME corresponds to the IOCNAME part of the pvlist file, and HH is the hour (00-23) when the snapshot was taken.

An application, pvMonitor2, monitors for changes to a list of PV's specified in a configuration file (currently test.config, put eventually the name should be PV.config) and runs commands based on the change in PV value. The most common use of this is to list a PV named IOCNAME:Init, and watch for this PV to change to a value of '1'. When this occurs, the pvMonitor2 software runs the following sequence of commands: IOCNAME:Init is set to 0. "/home/control/bin/IOCrestore IOCNAME" is run.

The IOCrestore process finds the most recent 'good' save of process variables, and resets the PV's to the values found in the settings file.

Restoring an explicit .settings file: restoring an explicit file (or list of files) may be done by running IOCrestore file1.settings file2.settings file3.settings .... and all the named files will be reloaded.

Format of .pvlist and .settings files The pvlist files can have comments; all lines starting with '#' are ignored. If a PV is listed with the keyword 'norestore', this keyword is copied to any generated .settings files. The .settings files look like a pvlist file, but each line has an additional entry, which is the value of the PV. When restoring, any PV line with the keyword 'norestore' is not reset.

Next Revision

Each accelerator and services IOC can have a file in the '/home/control/autosave' directory which lists PV's to get an hourly snapshot. These files are named 'IOCNAME.pvlist'. The files generated from these pvlist files are named WEEKDAY/IOCNAME.HH.settings', where WEEKDAY is the three-letter representation of the day of the week, IOCNAME corresponds to the IOCNAME part of the pvlist file, and HH is the hour (00-23) when the snapshot was taken.

For beamline related save/restore files should be stored in the associated beamline administrative account. e.g., ~hxma/autosave; ~sgm/autosave

The save and restore files will be reconfigured to use the following structure:

  • Beamline file that include each IOC
  • IOC file that include each VME Crate, PLC etc.
  • VME Crate or PLC file containing itâ??s own pvlist.

pvMonitor2

An application, pvMonitor2, monitors for changes to a list of PV's specified in a configuration file (currently test.config, put eventually the name should be PV.config) and runs commands based on the change in PV value. The most common use of this is to list a PV named IOCNAME:Init, and watch for this PV to change to a value of '1'. When this occurs, the pvMonitor2 software runs the following sequence of commands: IOCNAME:Init is set to 0. "/home/control/bin/IOCrestore IOCNAME" is run.

IOCrestore

The IOCrestore process finds the most recent 'good' save of process variables, and resets the PV's to the values found in the settings file.

Restoring an explicit .settings file: restoring an explicit file (or list of files) may be done by running IOCrestore file1.settings file2.settings file3.settings .... and all the named files will be reloaded.

clsSave

The clsSave program is used to save pv values from a .pvlist file and restore pv values from a .settings file.

Usage

clsSave [-r -d] file1 file2

   -r
       restore
   -d
       print debug information

If the -r option is given and if 1 file is given, the file extension must be ".settings". If 2 files are given then the first file is ignored and the second file must have the ".settings" file extension. This is for backwards compatability for older versions where both files were required.

   clsSave -r file.settings
   clsSave -r file.pvlist file.settings

If the -r option is not given and a single file is given, this file must have a file extension of ".pvlist", and the resulting save will go to STDOUT. If two files are given, the first again must have a ".pvlist" extension and the second a ".settings" extension. This second file will be used to save the data.

   clsSave file.pvlist
   clsSave file.pvlist file.settings

Format of .pvlist and .settings files

There are 5 different save/restore command types. This shows how a line will look in each file.

Save/Restore Commands

  • pvName
This is the same as the previous version of clsSave. A single pvName is given with format options following
    .pvlist
         pvName (format)
    .settings
         pvName (format) value
  • $overwrite
The value of pv1 will be stored during a save to be restored into pv2
    .pvlist
         $overwrite pv1 pv2 (format)
    .settings
         $overwrite pv1 pv2 (format) value
If a connection to pv2 can not be made during a save, the save will still be considered valid but a warning comment will appear in the saved file. During a restore if a connection to pv2 still can not be made the restore for this pv will fail.
    .pvlist
         $overwrite pv1 pv2
    .settings
         $overwrite pv1 pv2 value    #***Warning pvName could not connect***
  • $return
Used to restore the current date and time to a pv
    .pvlist
         $return pvName $year
         $return pvName $month
         $return pvName $day
         $return pvName $hour
         $return pvName $min
    .settings
         $return pvName $year
         $return pvName $month
         $return pvName $day
         $return pvName $hour
         $return pvName $min
$year causes the current year i.e. 2006 to be restored
$month causes the current month to be restored (01->12)
$day causes the current day of the month to be restored (01->31)
$hour causes the current hour of the day to be restored (00->23)
$min causes the current minute of the hour to be restored (00->59)
NOTE: there are no formatting options fr this command
  • $write
Used to write a specified value during restoration
    .pvlist
         $write pvName (format) (format) value
    .settings
         $write pvName (format) (format) value
  • $run
This command give the ability to run a user written script or program during restore process. Notice that each pv can have its own (format). With this command you can also pass static values by placing "$" before the value. i.e. $4 will pass "4" and $Hello will pass "Hello" to the script.
    .pvlist
         $run function(pv1 (format), pv2 (format), $val)
    .settings
         $run function(pv1 (format) value, pv2 (format) value, $val)
NOTE: It is recommended that a full file path be used to indicate the location of the script to prevent accidental execution of system programs or any other unintended applications.
  • $include
The $include command allows for nesting of pvlist files. This way a .pvlist file can be created to contain other .pvlist files.
   .pvlist
       $include file.pvlist
   .settings
       #$include file.pvlist
       pvName value
       #end $include file.pvlist
NOTE: It is recommended that a full file path be used to indicate the location of the pvlist files.

Comments

Comments begin with a '#'. Everything after a line after the # will be considered part of the comment. Comments will be copied to the saved file. They can appear as a line on its own, or after any restore command. Comments after or within $run command will be ignored and will not be copied to the saved file. All other comments will be copied to the saved .settings file.

   .pvlist
       #Comments in file.pvlist
       pvName #Comment after a restore command
       $run programName(pv1 #comment, $10) #comment after $run command
   .settings
       #Comments in file.pvlist
       pvName value #Comment after a restore command
       $run programName(pv1 value, $10)

Format

There are several special keywords that can be used to specify formatting options for pv's. Be carefull with the format options, trying to restore an incorect data type to a pv may cause a CA error and the restore for that pv will fail.

  • prec || precision
Used to specify the precision of the value to be saved. will be saved to 'prec' decimal places.
   .pvlist
       pvName prec=X
   .settings
       pvName value
Note: precision is ignored with strings and integers
  • string
Used to specify a string type of pv. If the keyword string is used the value saved will be within quotes i.e. "23" or "On"
   .pvlist
       pvName string
   .settings
       pvName string "value"
  • int || integer
Used to specify a value of type integer.
   .pvlist
       pvName int
   .settings
       pvName int value
  • real || double
Used to specify a value of type double. This is the default case. The keyword will not be copied to the .settings file.
   .pvlist
       pvName real
   .settings
       pvName value

Additional Keywords

  • norestore
The norestore keyword in a .pvlist file indicates that the value should be saved but should not be restored. This keyword will also appear in a .settings file if an error occurred during the save and a valid restore can not be done.
   pvName norestore
  • unknown
This keyword indicates that a connection the the specified pv could not be made and therefore can not be restored and should only appear in the .settings file.
   .pvlist
       pvName
   .settings
       pvName unknown norestore


Error Handling

When conflicting format keywords are found the first one is used, any subsequent keyword will be ignored and added to a comment at the end of the line.

   .pvlist
       pvName string int
   .settings
       pvName string "value"    #Rejected tokens: int

Any line within a pvlist file that can not be parsed will appear in the .settings file as a comment. In the following example the line can not be parsed due to incorrect numberof arguments.

   .pvlist
       $overwrite pv1
   .settings
       #Parse Error: $overwrite pv1

Navigate by Date:
Prev: Re: medm, edm, other on fc6 John Sinclair
Next: asyn record support - output Heinrich du Toit
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Record info nodes? Re: PV save and restore tool sought Tim Mooney
Next: Re: PV save and restore tool sought Elder Matias
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·