当前位置:网站首页>pyepics --Auto-saving: simple save/restore PVs
pyepics --Auto-saving: simple save/restore PVs
2022-06-09 16:56:00 【yuyuyuliang00】
autosave The module is PVs Simple is provided save/restore function , Have function save_pvs() and restore_pvs() And one. AutoSaver class . These are similar to those used for IOCs Of synApps Of autosave modular , In that module , They use a description of what to save PVs Compatible request file, And a compatible that holds the saved value save file. Currently, channel access is used for reading and writing , And there is no need to work with a single IOC Related to .
This module needs to be installed pyparsing package . This is a fairly common third party Python package , Included in many package managers , Or use something like easy_install or pip install , Or from PyPI download .
Request and Save The file is designed to be compatible synApps autosave. Be careful : Macro replacement is supported file command , So you can have one like this Request:
# My.req
file "SimpleMotor.req", P=IOC:, Q=m1This SimpleMotor.req File for :
# SimpleMotor.req
$(P)$(Q).VAL
$(P)$(Q).DIR
$(P)$(Q).FOFFIt can be used for a SimpleMotor Many examples of . But not used to find request File automation mechanism . You will need to include these in your working directory or specify an absolute path .
There is such a document , Just use :
import epics.autosave
epics.autosave.save_pvs("My.req", "my_values.sav")The corresponding... Will be saved PVs To the file my_values.sav. After a while , These values can be restored with the following :
import epics.autosave
epics.autosave.restore_pvs("my_values.sav")The saved file will be associated with autosave The mechanism saves files in almost the same format , also restore_pvs() Functions can be used from autosave Of save File read and restore values . Be careful : Purpose and standard here autosave The purpose of the module (autosave Modules are designed to hold values , Make in IOC Initialization at startup PVs) Very different . Using the function here will perform a test on the saved value caput().
autosave.save_pvs(request_file, save_file)
Save in request_file The current values listed in to save_file.
Parameters :
- request_file: Read the... To be saved PVs Of Request The name of the document
- save_file: Write the values to be saved to this file .
As mentioned above ,request_file According to from synApps Of autosave The rules of the module .
autosave.restore_pvs(save_file)
from save_file Read the value and set the corresponding PVs Restore them .
Parameters :
save_file: Read the saved value from the file with this name
Be careful :restore_pvs() Will restore all values it can , Skip any values that it cannot recover .
Autosaver class
Autosaver Class is a convenient way : Repeat save in one request Listed in the file PVs, Without having to reconnect all PVs.Autosaver Retain PV Connect , And provide a save current PV Value to a file save(). Default , Name that file from this request file and the current time . This makes you do things like this :
#!/usr/bin/env python
# save PVs from a request file once per minute
import time
from epics.autosave import AutoSaver
my_saver = AutoSaver("My.req")
# save all PVs every minute for a day
t0 = time.time()
while True:
if time.localtime().tm_sec < 5:
my_saver.save()
time.sleep(30 - time.localtime().tm_sec)
if time.time() - t0 > 86400.0:
break
time.sleep(0.5)This will be like My_2017Oct02_141800.sav Name of the file saved PVs.
class autosave.AutoSaver(request_file)
Create an automation based on a request file Saver.
Parameters :
request_file: Name of the request file .
AutoSaver There are two ways :read_request_file() Read a request file , and save() Save results .
autosave.read_request_file(request_file)
Read and parse request file , To begin PV Connect .
Parameters :
request_file: Name of the request file .
autosave.save(save_file=None, verbose=False)
Read the current PV value , Write save file .
Parameters :
- save_file: Save the name of the file or None. If None, The file and timestamp of the requested file will be used ( Turn into seconds ) To build a file name . Be careful : There is no need to check the rewritten file .
- verbose: Whether to print the results to the screen [ Default False]
Supported file types
It can be used autosave Routine saves and restores all scalars PV value . Some are right waveform( Array ) Data support . for example , Containing a long string waveform Can be saved and restored . Besides , Can be saved and restored in waveform Array of values in . For array data , The results may not be fully compatible autosave modular .
Example
A use autosave A simple example of a module :
import epics.autosave
# save values
epics.autosave.save_pvs("my_request_file.req",
"/tmp/my_recent_save.sav")
# wait 30 seconds
time.sleep(30)
# restore those values back
epics.autosave.restore_pvs("/tmp/my_recent_save.sav")边栏推荐
- 10 questions that must be asked in software testing interview
- phalapi框架改进方案,在一套phalapi系统上,管理多套api应用
- 八连冠!浪潮云连续8年蝉联中国政务云市场第一位
- 【华东师范大学】初试复试考研资料分享
- Laravel8 framework seven cattle cloud upload
- Elk is not fragrant! I use grayog, which is much lighter
- 笔试题—华为机试~待续
- The applet modifies the data of the previous page
- 苹果赢了 美法官驳回iPhone和iPad安全缺陷集体诉讼
- 鸿蒙 TabList 配合Fraction 实现顶部切换效果
猜你喜欢

Phalapi framework improvement scheme: manage multiple API applications on a set of phalapi system

使用ffmpeg合并mp4文件
![[East China Normal University] information sharing for the first and second examinations](/img/f9/68b5b5ce21f4f851439fa061b477c9.jpg)
[East China Normal University] information sharing for the first and second examinations
How to use cloud notes to record and sort out the graduation notes given by teachers to students

中原银行统一日志平台

UE4 BSP the light source in the brush needs to be rebuilt (x the object is not built)

Kali intranet penetration shell

Right click the project to add a reference, prompting that the call to the COM component returned an error HResult e_ FAIL

记一次找因redis使用不当导致应用卡死bug的过程

Experience sharing in application for assessment of doctor of management - Information Collection
随机推荐
Leetcode 1979. 找出数组的最大公约数
UEditor图片跨域上传解决方案
Elk is not fragrant! I use grayog, which is much lighter
Ueeditor image cross domain upload solution
10 questions that must be asked in software testing interview
不看后悔,appium自动化环境完美搭建
在华为写了十几年代码,一个程序员的自我修养
Ts编译配置
AutoRunner自动化测试工具用户界面之工具栏按钮详解-Alltesting|泽众云测试
pyepics CA -- 3
Ppt icon download
八连冠!浪潮云连续8年蝉联中国政务云市场第一位
关于在C#中因没有添加:mysql.data.dll 而报错这件事
World War II fell into these four misunderstandings, and another year will be useless!
pycharm安装scrapy库时出现报错Error occurred when installing package ‘Scrapy‘
从 0 到 1,探究百亿流量验证下的 MVVM 框架设计
phalapi框架改进方案,在一套phalapi系统上,管理多套api应用
Querylist asynchronously fetches web page data
苹果赢了 美法官驳回iPhone和iPad安全缺陷集体诉讼
笔试题—华为机试~待续