.. _ioc_guidelines: IOC Guidelines ############## The EPICS IOCs used for control and monitoring in the NUSTAR DCS sub-systems should follow some general guidelines. Guidelines ========== Standard records ---------------- The IOC database should contain a few standardised records * `ioc:status` record The status record provides a standard record to indicate that a certain IOC is active:: record(bi, "$(PREFIX):ioc:status") { field(DESC, "NUSTAR DCS status") field(ZNAM, "Not OK") field(ONAM, "OK") field(VAL, "1") field(PINI, "YES") } * `ioc:error` record The error record provides a standard record for error/state messages. Other records in the IOC should use this record to communicate error and state conditions (29 characters maximum):: record(state, "$(PREFIX):ioc:error") { field(DESC, "NUSTAR DCS error message") field(VAL, "Undefined") field(PINI, "YES") } * `ioc:state` record The state record is used in sub-system overview IOCs and provides a standard record that shows the state of the sub-system state machine (see also :ref:`nustar_dcs_sub_system_state_machine`):: record(state, "$(PREFIX):ioc:state") { field(DESC, "NUSTAR DCS state") field(VAL, "Undefined") field(PINI, "YES") } IOC Startup ----------- * IOC installed on single-purpose PC (only for one or more IOCs): * IOC should start automatically at boot-up. This can be realised e.g. using an entry in the crontab * IOC should be started in the background using `procServ`, on standard port 2222 * IOC installed on a multi-purpose PC (also other functionality): * IOC should be started from within a screen session IOC Reboot ---------- After a reboot of the IOC, the device should be in a safe and usable state. It should be fully controllable by only using Process Variables defined in the IOC. If possible, the IOC should make use of the `bumpless reboot` feature offered via the `autosave` module. This allows for automatic restoration of the previously set values.