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  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  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <2024
<== Date ==> <== Thread ==>

Subject: RE: automatically start the IOC via procServ
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: 周逸媚 <zhouym at sari.ac.cn>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Tue, 11 Jun 2024 17:01:54 +0000
  • Each time the processor is turned on, the PVs is 0 for all outputs.

What do you mean by “the processor is turned on”?  Is something power-cycled, or are you just starting the IOC?

 

Please send the complete output when the IOC is first started with procServ and is not working correctly.

 

Mark

 

 

From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of ??? via Tech-talk
Sent: Tuesday, June 11, 2024 2:19 AM
To: tech-talk at aps.anl.gov
Subject: automatically start the IOC via procServ

 

Dear, sir

I have a question about procServ starting an IOC.

When I run the IOC through ../../bin/linux-arm/SHINE st.cmd

all pvs run normally and output the correct results.

 

Then, I automatically start the IOC via procServ.

Each time the processor is turned on, the PVs is 0 for all outputs.

These pv variables are in ai or longin form and are output via setDoubleParam or setIntegerParam.

in SHINE.db:

record(ai, "$(P)$(R)BPM_X")                        
{                                                           
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))BPM_X")
   field(SCAN, "I/O Intr")                        
}

in SHINE.cpp

setDoubleParam(P_BPM_X,        (signed)bpm_x/1000.00);

callParamCallbacks();

 

or waveforms

record(waveform, "$(P)$(R)CH1_RAW_WAVEFORM")
{
    field(DTYP, "asynFloat64ArrayIn")
    field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))CH1_RAW_WAVEFORM")
    field(FTVL, "DOUBLE")
    field(NELM, "2048")
    field(SCAN, "I/O Intr")
}

doCallbacksFloat64Array(pData_CH1_waveform, imglen, P_CH1_Waveform, 0);

 

 

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

When I check the PVs,they show <undefined> 0 UDF INVALID

 

root@snk2-debian-project:~# telnet localhost 20001
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
@@@ Welcome to procServ (procServ Process Server 2.7.0)
@@@ Use ^X to kill the child, auto restart is ON, use ^T to toggle auto restart
@@@ procServ server PID: 356
@@@ Server startup directory: /home/EPICS/SHINE-IOC/iocBoot/iocSHINE
@@@ Child startup directory: /home/EPICS/SHINE-IOC/iocBoot/iocSHINE
@@@ Child "SHINE-IOC" started as: ./st.cmd
@@@ Child "SHINE-IOC" PID: 363
@@@ procServ server started at: Wed Jun  5 13:13:59 2024
@@@ Child "SHINE-IOC" started at: Wed Jun  5 13:13:59 2024
@@@ 0 user(s) and 0 logger(s) connected (plus you)
dbpr SHINE-BI:BPM_X
AMSG:               ASG :               DESC:               DISA: 0             
DISV: 1             NAME: SHINE-BI:BPM_X                    NAMSG:              
RVAL: 0             SEVR: INVALID       STAT: UDF           SVAL: 0             
TPRO: 0             VAL : 0

 

However,if I restart the IOC, they show up fine.

 

epics> ^C@@@ Current time: Wed Jun  5 13:18:57 2024
@@@ Child process is shutting down, a new one will be restarted shortly
@@@ ^R or ^X restarts the child, ^Q quits the server
@@@ @@@ @@@ @@@ @@@
@@@ Received a sigChild for process 363. The process was killed by signal 2
@@@ Restarting child "SHINE-IOC"
@@@    (as ./st.cmd)
@@@ The PID of new child "SHINE-IOC" is: 443
@@@ @@@ @@@ @@@ @@@
#!../../bin/linux-arm/SHINE
< envPaths
epicsEnvSet("IOC","iocSHINE")
epicsEnvSet("TOP","/home/EPICS/SHINE-IOC")
epicsEnvSet("EPICS_BASE","/home/EPICS/base-7.0.7")
epicsEnvSet("SUPPORT","/home/EPICS/support")
epicsEnvSet("ASYN","/home/EPICS/support/asyn4-38")
epicsEnvSet("AUTOSAVE","/home/EPICS/support/autosave-R5-10-2")
cd "/home/EPICS/SHINE-IOC"
## Register all support components
dbLoadDatabase "dbd/SHINE.dbd"
SHINE_registerRecordDeviceDriver pdbbase
## Load record instances
#dbLoadTemplate "db/user.substitutions"
#dbLoadRecords "db/SHINEVersion.db", "user=root"
#dbLoadRecords "db/dbSubExample.db", "user=root"
##### ZYM ###########
SHINEConfigure("testAPD", 1000)
#############mode_type = 2
################# mmap finished ##################
------------pre_value_ddr=30100000
################# value setting finished ##################
dbLoadRecords("db/SHINE.db","P=SHINE-BI:,R=,PORT=testAPD,ADDR=0,TIMEOUT=10000")
#dbLoadRecords("db/asynRecord.db","P=SHINE-BI:,R=,PORT=testAPD,ADDR=0,OMAX=,IMAX=")
######################
########## AUTOSAVE ##########
set_requestfile_path(".")
set_savefile_path("/home/EPICS/","autosave")
save_restoreSet_IncompleteSetsOk(1)
save_restoreSet_DatedBackupFiles(0)
set_pass0_restoreFile("shineioc.sav")
############################
cd "/home/EPICS/SHINE-IOC/iocBoot/iocSHINE"
iocInit
Starting iocInit
############################################################################
## EPICS R7.0.7
## Rev. 2023-04-11T16:40+0800
## Rev. Date build date/time:
############################################################################
reboot_restore: entry for file 'shineioc.sav'
reboot_restore: Found filename 'shineioc.sav' in restoreFileList.
*** restoring from '/home/EPICS/autosave/shineioc.sav' at initHookState 6 (before record/device init) ***
reboot_restore: done with file 'shineioc.sav'
iocRun: All initialization complete
create_monitor_set("shineioc.req",10,"P=SHINE-BI:")
------------value_ddr=7010000a
## Start any sequence programs
#seq sncExample, "user=root"
epics> shineioc.sav: 38 of 38 PV's connected
dbpr SHINE-BI:BPM_X
AMSG:               ASG :               DESC:               DISA: 0             
DISV: 1             NAME: SHINE-BI:BPM_X                    NAMSG:              
RVAL: 0             SEVR: NO_ALARM      STAT: NO_ALARM      SVAL: 0             
TPRO: 0             VAL : -3739.613

 

 

########################################

The autostart service is

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

[Unit]
Description=Start EPICS IOC for asyn port driver
After=network.target
[Service]
Type=forking
Restart=on-failure
RestartSec=5
ExecStart=/home/EPICS/runioc.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=/usr/bin/sleep 5
TimeoutStopSec=5
User=root
[Install]
WantedBy=multi-user.target

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

The runioc.sh is:

#!/bin/bash
export EPICS_CA_MAX_ARRAY_BYTES=50000000
cd /home/EPICS/SHINE-IOC/iocBoot/iocSHINE
procServ -n "SHINE-IOC" -I ^D^C 20001 ./st.cmd

 

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

Best regards,

Yimei Zhou

 


References:
automatically start the IOC via procServ 周逸媚 via Tech-talk

Navigate by Date:
Prev: A Tribute to Professor LIU Songqiang Hu, Yong via Tech-talk
Next: web-pvtools: PV client tools for web Wang, Lin via Tech-talk
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  2018  2019  2020  2021  2022  2023  <2024
Navigate by Thread:
Prev: automatically start the IOC via procServ 周逸媚 via Tech-talk
Next: EPICS module/service that can be used for saving waveform data/metadata to HDF5 Wlodek, Jakub via Tech-talk
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  2018  2019  2020  2021  2022  2023  <2024
ANJ, 12 Jun 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·