powerSupply is an example of creating a service that requires a somewhat complicated top level PVStructure. Look at the code for details.
This is an example of creating a service that requires a somewhat complicated top level PVStructure.
The example has a top level pvStructure:
structure
alarm_t alarm
time_t timeStamp
structure power
double value
structure voltage
double value
structure current
double value
It is designed to be accessed via a channelPutGet request. The client sets power.value and voltage.value When the record processes it computes current.value. In addition the timeStamp is set to the time when process is called.
The example can be run on linux as follows:
mrk> pwd /home/epicsv4/master/exampleCPP/powerSupply mrk> bin/$EPICS_HOST_ARCH/powerSupplyMain
To start powerSupply as part of a V3IOC:
mrk> pwd /home/hg/exampleCPP/powerSupply/iocBoot/powerSupply mrk> ../../../bin/$EPICS_HOST_ARCH/powerSupply st.cmd
mrk> pwd /home/epicsv4/master/exampleCPP/powerSupply mrk> bin/$EPICS_HOST_ARCH/powerSupplyMonitor
mrk> pwd /home/epicsv4/master/exampleCPP/powerSupply mrk> bin/$EPICS_HOST_ARCH/powerSupplyClient
NOTE: The client ends by requesting a voltage of 0. This results in the power supply record thowing an exception. This results in problems including the powerSupplyMonitor no longer updating. Needs investigation.
The directory layout is:
powerSupply
configure
ExampleRELEASE.local
...
src
pv
powerSupplyRecord.h
powerSupplyRecord.cpp
powerSupplyInclude.dbd
powerSupplyMain.cpp
powerSupplyClient.cpp
powerSupplyMonitor.cpp
powerSupplyRegister.cpp
powerSupplyRegister.dbd
ioc
Db
...
src
powerSupplyInclude.dbd
powerSupplyMain.cpp
iocBoot
powerSupply
st.cmd
...
where
powerSupplyCreateRecord powerSupply
Multiple commands can be issued to create multiple powerSupply records.
If only a main program is desired then the directory layout is:
powerSupply
configure
ExampleRELEASE.local
...
src
pv
powerSupplyRecord.h
code
powerSupplyRecord.cpp
powerSupplyMain.cpp
Thus if only a main program is required the directory layout is simple.
Also many sites will want to build the src directory in an area separate from where the iocs are build.