IOCs - ISISComputingGroup/ibex_developers_manual GitHub Wiki

Wiki > The Backend System > Creating and Basics of IOCs

Before Creating an IOC

Remember, EPICS is a collaboration! Why create an IOC when you can just use one that's already out there? If the device is not ISIS specific, before thinking about creating an IOC check whether it is listed here and, if not, email the mailing list here.

Creating an IOC

Building a new IOC? Before you get started, take a look at the relevant instrument page to see if there's any useful information for the device you're about to write an IOC for. Otherwise, let's get going. If you have problems see See IOC and device Troubleshooting.

There are two sorts of IOCs, EPICs and pycaspy. For EPICs type see the automatic creation below for pycaspy see the pycaspy ioc.

Need more than 1 IOC? See IOC Duplication

Automatically

If you're building a new StreamDevice IOC you can use the IOC Generator script, for developer info see the wiki.

Manually

If you're not creating a StreamDevice IOC or you would like to know how an IOC could be created manually see:

Fleshing out the IOC

  1. You can now flesh out your IOC to work. I would encourage you to do this in a TDD style (if not write the tests afterwards) and make sure you follow the conventions. To write in a TDD style use:

    If you used the script to create your IOC an empty emulator and IOC tests will have been created for you.

  2. Record simulation

  3. IOC Finishing Touches

  4. Running (and testing) IOC

  5. Add any manuals used to the manuals directory

  6. Add a page about the device in the correct categories in Specific Device IOC

  7. Create an OPI and send it to instrument scientists for approval.

Conventions

Other

Remake and run IOC

When modifying and testing an IOC it helps if you chain the commands to make and run the IOC like below:

cd C:\Instrument\Apps\EPICS\support\<IOC name>\master && make clean uninstall && make && cd C:\Instrument\Apps\EPICS\ioc\master\<IOC name>\ && make clean uninstall && make && cd C:\Instrument\Apps\EPICS\ioc\master\<IOC name>\iocBoot\ioc<name>\ && runioc.bat

Debugging IOCs

Debug builds of IOCs are built in jenkins and can be deployed to instruments, see here.

It can be useful to add a msgBox to pause so you can attach a debugger, see here for instructions. If your error is during or after the db load is to call runioc.bat a this will start he ioc but run a as the start script. Now attach the debug and in the console type < st.cmd. To attach the debugger start the IOC, open visual studio with the code in you wish to debug, set breakpoints as you wish and in the top toolbar select "Debug >> Attach to process" find your process in the list and attach. You can control the debugger as you would other debuggers using the buttons on a toolbar just below the toolbar you clicked on with "Debug" in it.

Specific IOC Information

For information on specific IOCs see Specific Device IOC

Further reading

⚠️ **GitHub.com Fallback** ⚠️