EPICS: Software IOC: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
Boiarino (talk | contribs)
No edit summary
Boiarino (talk | contribs)
No edit summary
Line 138: Line 138:
Existing IOCs have different structure, they can be found in baseB/src/, for example see inside CAEN_HV/.
Existing IOCs have different structure, they can be found in baseB/src/, for example see inside CAEN_HV/.
To make it realy useful *.db files and medm GUI must be generated - see corresponding sections. For example: [[EPICS: generation of DBs and GUIs for HV]]
To make it realy useful *.db files and medm GUI must be generated - see corresponding sections. For example: [[EPICS: generation of DBs and GUIs for HV]]
To run IOC as service on Linux '/etc/init.d/softioc' script must be provided. Following example shows such script for gamma profiler running on clonpc1:

Revision as of 22:35, 9 January 2007

Software IOC is the process running on Linux or Solaris. For initial setting do following:

 ssh boiarino@clonpc1
 cd $CLAS/R3.14.8.2
 source .setup (usually done by $CLAS/.setup)
 cd $CLAS/R3.14.8.2/EPICS (this is the 'epicsB' directory)
 source .setup (usually done by $CLAS/R3.14.8.2/.setup above)
 cd baseB (or 'cd $BASEB')

New application can be done using 'makeBaseApp.pl' script (More detailed explained here and nicer here). To see possible application types use following:

 makeBaseApp.pl -l

It will show:

 Valid application types are:
       support
       ioc
       example
       caClient
       caServer
 Valid iocBoot types are:
       example
       ioc

Following command will create new type 'example' application named 'test1' (it will NOT create new Makefile and configure/ directory if they exists already, otherwise it will !):

 makeBaseApp.pl -b $EPICS_BASE -t example test1
   to make 'default' ioc: makeBaseApp.pl -b $EPICS_BASE -t ioc iocCore

It will create subdirectory test1App with appropriate contents; do following:

 cd test1App
 make

To make boot script do following:

 makeBaseApp.pl -b $EPICS_BASE -i -t example test1

Following dialog:

 The following target architectures are available in base:
   solaris-sparc
   vxWorks-ppc604_long
   solaris-x86
   linux-x86
 What architecture do you want to use? linux-x86
 The following applications are available:
   test1
 What application should the IOC(s) boot?
 The default uses the IOC's name, even if not listed above.
 Application name? test1

It will do following:

 create iocBoot/ and iocBoot/Makefile if do not exists already
 create iocBoot/iostest1 with appropriate contents
 creade db/ if does not exist already (?)
 copy *.db files from test1App/Db/ to db/ 
 create dbd/ if does not exist already (?)
 copy some (?) *.dbd files from test1App/ to dbd/ (xxxRecord.dbd, xxxSupport.dbd)
 create dbd/test1.dbd (copies some templete from base ???)
 create include/ if does not exist (?)
 copy xxxRecord.h file to include/ (from some templete ?) (corresponds to some dbd file ?)
 copy libxxxSupport.a and libxxxSupport.so to lib/linux-x86/ (or whatever platform is)

To create environment envPaths:

 cd iocBoot
 make

It will create ioctest1/envPaths

To start IOC:

 cd ioctest1/
 chmod 755 st.cmd
 ./st.cmd

Following output:

 #!../../bin/linux-x86/test1
 ## You may have to change test1 to something else
 ## everywhere it appears in this file
 < envPaths
 epicsEnvSet(ARCH,"linux-x86")
 epicsEnvSet(IOC,"ioctest1")
 epicsEnvSet(TOP,"/usr/local/clas/devel/R3.14.8.2/EPICS/baseB")
 cd /usr/local/clas/devel/R3.14.8.2/EPICS/baseB
 ## Register all support components
 dbLoadDatabase("dbd/test1.dbd")
 test1_registerRecordDeviceDriver(pdbbase)
 ## Load record instances
 dbLoadRecords("db/dbExample1.db","user=boiarinoHost")
 dbLoadRecords("db/dbExample2.db","user=boiarinoHost,no=1,scan=1 second")
 dbLoadRecords("db/dbExample2.db","user=boiarinoHost,no=2,scan=2 second")
 dbLoadRecords("db/dbExample2.db","user=boiarinoHost,no=3,scan=5 second")
 dbLoadRecords("db/dbSubExample.db","user=boiarinoHost")
 ## Set this to see messages from mySub
 #var mySubDebug 1
 cd /usr/local/clas/devel/R3.14.8.2/EPICS/baseB/iocBoot/ioctest1
 iocInit()
 Starting iocInit
 ############################################################################
 ###  EPICS IOC CORE built on Sep 21 2006
 ###  EPICS R3.14.8.2 $R3-14-8-2$ $2006/01/06 15:55:13$
 ############################################################################
 iocInit: All initialization complete
 ## Start any sequence programs
 #seq sncExample,"user=boiarinoHost"
 epics>

To list all available channels:

 epics> dbl
 boiarinoHost:aiExample
 boiarinoHost:aiExample1
 boiarinoHost:aiExample2
 boiarinoHost:aiExample3
 boiarinoHost:calcExample
 boiarinoHost:calcExample1
 boiarinoHost:calcExample2
 boiarinoHost:calcExample3
 boiarinoHost:compressExample
 boiarinoHost:subExample
 boiarinoHost:xxxExample
 epics>

Use 'help' on 'epics>' prompt to get full list of commands.

Channels can be accessed now, for example type on another machine:

 caget boiarinoHost:aiExample

It will return digit from 0 to 9 every time it called.

Existing IOCs have different structure, they can be found in baseB/src/, for example see inside CAEN_HV/. To make it realy useful *.db files and medm GUI must be generated - see corresponding sections. For example: EPICS: generation of DBs and GUIs for HV

To run IOC as service on Linux '/etc/init.d/softioc' script must be provided. Following example shows such script for gamma profiler running on clonpc1: