Control Sheet Cosylab’s Newsletter Volume 28
ISSN: 1855-9255
September 2016 Table of Contents
2 3 5 10
An Insider’s View on the EPICS V4 Future with Matej Šekoranja This issue features the next in our Cosylab Experts series of articles. In this issue, Matej Šekoranja talks about EPICS V4.
Medical Processes Key Success Factor at Heavy Ion Medical Machine in Lanzhou, China We look at one of the two heavy ion demo facilities currently being built in Lanzhou City, China.
Modular Accelerator Device Integration Environment: The Integrator’s API Cosylab’s experience on device integration and distributed control systems, has allowed us to develop a flexible, user friendly framework, that would speeds up our work. We introduce MADIE.
The Photo Board Some pictures from IPAC’16 and PTCOG 55. Also, what you shared with us about why your software projects are always on-time or late.
Cosylab d.d., Teslova ulica 30, SI-1000 Ljubljana, SLOVENIA Phone: +386 1 477 66 76 Email: controlsheet@cosylab.com URL: www.cosylab.com
page:
Volume 28
Control Sheet
2
ISSN: 1855-9255
Cosylab Experts
An Insider’s View on the EPICS V4 Future with Matej Šekoranja “[in April 2007] Matthias [Clausen] had Matej and me come to DESY for a couple of days [...]. After the daily meetings, Matej and I would take a long walk and then have dinner together. This is when we got to know and respect each other. Matej and I became close collaborators. From then until about the end of 2010 Matej and I were the only developers for javaIOC and the beginnings of EPICS V4.” --Marty Kraimer, 2016 Fall Collaboration Meeting On the client side, you can use V4 client interfaces that support different implementations of channel providers. This means one can use the same API in order to access records via CA or the pvAccess protocol.
What this quote tells us is that calling Cosylab veteran Matej Šekoranja merely an insider to the story of EPICS V4 is an understatement. So, about a decade of hard work and intense collaboration on EPICS V4 later, it is more than time to ask Matej for a status update and ask him for his vision on the future of EPICS V4.
Control Sheet:
Control Sheet: Hi Matej, can you quickly
remind us what EPICS V4 is about and why it was conceived? Also, where it wants to improve on current technologies? Matej:
First of all, EPICS V4 is not a direct replacement of current EPICS [v3. xx] as the name might imply. Sure, it has a pvAccess protocol that replaces EPICS Channel Access (CA), but it has no real-time database engine (yet). EPICS V4 is all about complementing V3, providing parts that were missing until now (e.g. group/atomic access to set of records, structures) and providing useful services to higher level applications. A primary use of EPICS V4 is to provide middle layer services. One example is a service that accesses a mongoDB database, another example is a service that accesses the areaDetector data. The conception history is too long for
Matej Šekoranja
a few lines. It’s better if you read Marty Kraimer’s overview that he prepared for this year’s fall EPICS collaboration meeting. [1] Control Sheet:
How do you foresee the adoption of V4? Can labs do a gradual introduction, or rather a big switchover, or, … ?
Matej: EPICS V4 provides the means for
a gradual integration of V4 into existing EPICS installations. Basically it’s all about replacing the EPICS CA protocol with the V4 pvAccess protocol. On the server side, one can install the pvaSrv piece of software that gives you access to existing EPICS records via the pvAccess protocol.
A related question: with the TANGO controls framework we observe a faster update of major version number, V4, 5, ... , 8 and now 9, update every few years. With EPICS it looks, maybe at the superficial level, different, i.e. a slower rate of major number updates? What are your thoughts on that? Matej:
That’s a tough one! Let me say this, EPICS 3 is a mature and stable software. There are several versions available, stable 3.14 and the newer 3.15. There are 2 releases per year on average. I think that’s reasonable. New features will be part of 3.16+ releases. With EPICS we adhere to the strict policy that the major version number is only increased when there is a nonbackwards compatible change to the interfaces, the API. Given that EPICS has such a large install base, it would need a lot of consideration before doing so.
Control Sheet: Does V4 already have mileage in actual use? How will it be
page:
Control Sheet
Volume 28 maintained and maybe evolve? Matej:
EPICS V4 has been used in a couple of subsystems for a year or two. Eventually EPICS V4 will become a part of the EPICS base distribution and will be maintained and evolve in the scope of it. For example, at SNS (ORNL, Oak Ridge), they use V4 for the transport of neutron events from the detectors of the Spallation Neutron Source (SNS) to data acquisition and experiment monitoring systems. This includes live stream visualization in production as well as diagnostics
3
ISSN: 1855-9255
and calibration of detectors and the overall system. The EPICS V4 development team helped them with ironing out a few initial issues and they are using V4 in production for over 18 months on 8 beam lines. [2]
tribution, but is a likely candidate. It is lightweight compared to TCP based protocols and efficient where sending (large) data to multiple clients is a concern. There’s a github for those interested [3].
Control Sheet:
Control Sheet: Matej, thanks for shedding some light on what’s in the works with EPICS V4!
You’ve worked on it extensively. Are there any specific achievements you’re particularly proud of?
Matej:
Besides my work on the pvAccess communication protocol I would like to point out the reliable multicast protocol called pvDS. It is not yet part of the current EPICS V4 dis-
REFERENCES [1] https://conference.sns.gov/event/11/ [2] http://icalepcs.synchrotron.org.au/papers/ wepgf105.pdf [3] https://github.com/msekoranja/pvDS
Medical Processes Key Success Factor at Heavy Ion Medical Machine in Lanzhou, China Matej Klun (Cosylab), Frank Amand (Cosylab) and Samo Tuma (Cosylab)
In 2012, 3.2 million people in China were diagnosed with cancer; by 2030 this number is expected to reach 5 million per annum [1]. About 70 % of these patients are expected to require radiation therapy.
There are several kinds of established radiation therapy using electrons, photons and then there are protons and heavy ions. The “Bragg peak” effect [2] means that protons and heavy ions have superior dose distribution properties compared to electrons and photons (Figure 1). For China, to treat these cases in the best possible way, more than 100 particle therapy facilities would be needed to cope with the demand. The Institute of Modern Physics (IMP),
which is a part of the Chinese Academy of Sciences (CAS), and the Chinese Government have chosen a twostep approach towards building the required number of therapy facilities. The first step entails the construction of two research and development therapy facilities which will be used to further improve the concepts and truly capitalize on the investment into proton therapy. This will be followed by a large-scale industrialization step.
Heavy Ion Medical Machine (HIMM) Currently, there are two heavy ion therapy facilities being built in Gansu Province. The first, HIMM-1, is in WuWei, while the second, HIMM-2, is in Lanzhou, a fast growing city located on the Silk Road. Both HIMM-1 and HIMM-2 are being designed with a range of unique features, which have never been used before in medical accelerators. There
page:
Volume 28
Figure 1: Bragg Peak [2]
is, for example, a combination of a cyclotron injector and a compact synchrotron which can produce a 400 MeV energy beam in a small form factor. Using both active and passive scanning, and horizontal, vertical and 45 degree beam lines , the treatment plan can be adapted to every patient’s unique needs.
Cosylab’s Contribution to HIMM A collaboration between Cosylab and the IMP started in 2014 with a small project, which quickly grew into a cooperation on a much larger scale. In 2015, IMP and Cosylab embarked on a mutually beneficial collaboration, where Cosylab had the honour of sharing its vast expertise and experience in medical accelerators. This was of great value in the rapid development of the accelerator control system for HIMM. So far, Cosylab’s main responsibilities have been defined as: 1. Design and implementation of a number of the accelerator control system components • Presentation layer (60 device panels, with synoptic views, integrated into the existing accelerator infrastructure) • Timing system, (sub-microsecond synchronization)
Control Sheet
4
ISSN: 1855-9255
Figure 2: Model of the layout of HIMM-2
• High speed data distribution service
2. Medical certification consulting • Establishing a medical software development process that conforms to the Chinese Food and Drug Administration (CFDA) standards • Preparing the environment to provide the full traceability needed by medical processes • Training people (lectures were targeted during the training session for the specific audience and were recorded for future reference)
The Challenge The development of a medical particle accelerator is a technical challenge on its own because it’s necessary to satisfy ambitious beam requirements, to achieve the stability, uptime and precision needed to operate such an accelerator efficiently. Often overlooked is the fact that this machine needs to be inherently safe, meaning that it is our job as engineers to ensure that every risk is identified, discussed and that a mitigation course of action is determined. Of course, this is a simplification and there is much more. For HIMM, we are following the Chinese FDA, which imposes a large number of regulations, standards, guidelines and processes, necessary during the development of any medical product for it to be certified and allowed on the market. For illustration; a mod-
erately complex system that needs medical documentation usually needs about 1000 pages of documentation. It is easy to imagine that creating documentation represents a significant proportion of total effort required to develop a complex device like a medical particle accelerator. Presently, IMP and Cosylab engineers are working hard on the documentation required by the Beijing Institute of Medical Technology (BIMT), for the medical certification of the HIMM-2 medical device. To facilitate these new medical development processes, new tools were required. We introduced several tools into the IMP infrastructure for streamlining documentation management and for tracking bugs-and-features efficiently, with full traceability, as required by the standards. Additionally Cosylab helped prepare document templates, which simplified training of new people and facilitated good communication and discussion among teams. This proved essential to overcoming the challenges of medical product development! IMP already has development processes that have been established over many years. Incorporating the new medical processes into existing research-oriented processes requires in-
page:
Volume 28 tensive dialogue, and hands-on work, with flexibility and an open mindset from both IMP and Cosylab. So far we are making good progress and believe that we have both learned a lot from each other. By having a constant onsite presence of at least two Cosylab engineers, any issues with the introduction of the numerous changes were resolved quickly and efficiently. After half a year of intensive on-site work, IMP and Cosylab have managed to successfully deploy this new alignment of existing processes with medical development processes. It has now been adopted by all IMP medical subsystem groups involved in the development of the HIMM-2 medical accelerator.
Control Sheet to the medical standards as well as to IMP’s way of working. We take pride in our flexibility and open minded spirit that are key ingredients for such endeavors.
5
ISSN: 1855-9255
REFERENCES [1] Proton Therapy world market report, Edition 2015 (http://medraysintell. com/Protontherapy.html)
The established medical processes are [2] Bragg Peak (https://en.wikipedia.org/ wiki/Bragg_peak) both a great benefit as well as a legal requirement for any medical device project: in the hands of experts, they are effective, and an enabler for supe- ABOUT THE AUTHORS rior quality. Matej Klun joined Cosylab in February 2011 as a softCosylab wishes to kindly thank our colleagues at IMP, for their hospitality that remains unmatched to this day, and their patience with us being slow to learn Chinese. 谢谢
We worked shoulder to shoulder with IMP to establish a version of the wellknown V-model for IMP’s local software development, that both caters
Figure 3: Nothing forges the bonds of friendship more than working shoulder to shoulder on a difficult task.
ware/hardware engineer. Currently he is in the role of a project manager, but when there is time left he enjoys a pint of his own home-made beer. Frank Amand joined Cosylab in 2011. His previous work experience includes 12 years with Royal Philips in Belgium and the Netherlands in a variety of software engineering related roles. His technical expertise lays in the domain of human-computer interaction, GUI design and usability. He is currently Cosylab’s Head of Marketing. Samo Tuma joined Cosylab 2013 as a software engineer. He spent most of his time working on the MedAustron and HIMM projects. Currently, Samo can be found working on-site in Switzerland. When he is not working, he loves a good game of basketball, fishing in the sea, travelling the world or enjoying a bite into a hot chilly pepper!
Figure 4: Another hard working business meeting about to take place! J
page:
Control Sheet
Volume 28
6
ISSN: 1855-9255
Modular Accelerator Device Integration Environment: The Integrator’s API by: Žiga Čikič (Cosylab), Samo Tuma (Cosylab)
Introduction
worry about the support functions.
Cosylab has done a great deal of work on device integration and distributed control systems, and for some time now we have felt that there’s a need for a flexible, user friendly framework, that would speed up our work. So we put those decades of cumulative experience to work, gathered requirements and suggestions from our own integration experts, and MADIE was born. The key benefits of MADIE are:
Developed in LabVIEW, MADIE supports National Instruments devices natively, without a need for creating new device drivers. This gives device integrators access to a large pool of ready-made hardware devices to choose from. Another advantage of MADIE is that it
gracefully enforces a lightweight unified architecture incorporating a well thought out state machine design pattern. With this, integration, debugging and maintenance tasks become simple and fast. For the system as a whole, MADIE represents an abstraction layer. This abstraction layer hides device-specific
1. Provides a user API for faster and more efficient work 2. Provides a unified interface to highertier devices and SCADA systems 3. Plug-in based architecture 4. Simple configuration 5. Provides common services like logging, high-speed data transmission, control interfaces,… 6. LabVIEW based -> native support for National Instrument (NI) hardware.
Let’s now look under the hood and see how it all works!
Why would a project use MADIE? MADIE takes care of all concerns about how to interact with devices and the distributed control system, how to log important information, how to send large volumes of data and many other features by providing common services with an easy-to-use high level API. With MADIE, the integrator can focus on supporting the device, and not
Figure 1: For the higher tier devices MADIE plugins (devices) all have the same interface, which simplifies its design and promotes scalability.
page:
Volume 28
Control Sheet
7
ISSN: 1855-9255 in front of Accelerator. For medical devices, documentation procedures and additional safety features are required and must be enforced. This is where MADIE shines. It provides the necessary Services (Figure 2) that handle the surrounding tasks and enforces a unified architecture that helps with writing the code and the documentation.
Figure 2: MADIE provides services with an easy to use API, which hides the complexity from the integrator.
interfaces and details. The higher tier devices only see the standardized MADIE interface. This makes all the devices look the same on the outside, which simplifies SCADA development (Figure 1). MADIE supports multiple SCADA interfaces, from the industry standard OPC UA to the more scientific and research orientated EPICS CA interface. Support for other interface types can be easily added with no need to change the integrated devices. MADIE is to the NI platform what EPICS and TANGO are to VME and Linux.
need to be supported and connected into a distributed control system. This does not only include device Integration but also communication with the SCADA system, logging, alarming, and handling device errors, transferring of large acquisition files, monitoring of device states, loading configuration files etc. Things may get even more complicated when you put the word Medical
The OPC UA Manager is one of the services included in the MADIE framework. It takes care of communication via the OPC UA protocol. OPC UA is needed when communication with more industrial orientated SCADA systems, like WinCC OA, is required. The OPC UA Manager provides a server to which OPC UA data-points are deployed. The SCADA system then has access to this server, through which it controls the integrated device. When a control interface is required for sending commands to systems that need to react faster than the OPC UA interface can manage, a ZeroMQ based service called ZMQ_CMD can be chosen. It sends commands to MADIE plugins and replies with the response to the command. Commands can be MADIE specific (e.g. state transition commands) or user-defined. User defined commands will be forwarded to the user-accessible part of
How is MADIE able to fit into the big picture of a control system? Accelerators usually have a large number of devices from different manufacturers, with a wide range of platforms, communication protocols, driver availability and other things. Connecting and unifying them can be a nightmare for any software engineer, but if you want to run the accelerator from a single computer, all of these devices Figure 3: Example of a GUI in WinCC made for HIMM
page:
Volume 28
Control Sheet
8
ISSN: 1855-9255
the state machine. The High Speed Data Distribution Service (HDDS) is used to transfer large amounts of data. It is a publishsubscribe based service with a central server. The central server eliminates the need for each device to know the location of each other device. This makes access to the published data easier. In practise, it works similar to Twitter, where you subscribe to a tag and receive all messages published to that tag, but here you are not limited to 140 charactersJ. HDDS can stream data with high speeds, limited only by the network hardware. When something goes wrong with a device, the user needs a way of finding out what happened. MADIE provides an option for local and remote logging. Both of the logging services provide the option to set multiple log levels with a configurable logging level threshold. This enables the user to log only the information he wishes, while still having the option to log even more details. Log messages can be localized, and simultaneous log-
Figure 4: Creating a starting point for your new device is just a click away
ging in two languages is supported. With this, devices can be localized for the customers and at the same time logs can be kept in the language support staff understand. Access and loading of files is simplified with MADIE’s integrated File service. It can load files either from a local hard drive or from an HTTP server. Files formatted in JSON and XML can even be validated for grammatical consistency, ensuring that devices receive properly formatted data.
To make sure everything runs smoothly, the Watchdog Service monitors service and plug-in responsiveness. It indicates the activity of all integrated devices and reports the activity to the user. This means that users are notified immediately when their integrated device does not respond.
We supported the devices. What now? Usually there are many instances of the same device type, all with different configurations, different device lo-
Figure 5: MADIE service functions can be easily dragged and dropped from MADIE palette to your code.
page:
Control Sheet
Volume 28 cations, etc. Deploying them manually can be a long and tiresome job. Configuration management tools have been prepared to ease this job. They take care of everything from building to deployment in an organized manner, with minimal user interaction required. As the devices are deployed, users need to have a way of interfacing with them. This is provided by the Presentation layer and its GUIs. They are a part of the SCADA system, which has access to devices integrated into MADIE trough OPC UA, EPICS CA or TCP interfaces. GUI templates for selected SCADA systems have been prepared that provide easy access to MADIE interface (Figure 3).
MADIE in Action Figures 4, 5 and 6 show some screenshots of MADIE in use.
Conclusion So, in summary, MADIE has many features, which make it a big time saver to anyone facing integrating a device into a distributed control system. There is much more to MADIE than we described here so feel free to contact us at info@cosylab.com if you have any questions that we have not covered in this article.
Figure 6: MADIE tools automate common tasks
ABOUT THE AUTHORS Žiga Čikič is a Software developer at Cosylab, where he started working in 2015, after finishing his Physics studies. His preferred programming language is LabVIEW, and he is a Certified LabVIEW Developer (CLD). He is currently working on MADIE upgrades and maintenance. When not working, he enjoys spending time with his family, fixing things and doing DIY projects.
Samo Tuma joined Cosylab 2013 as a software engineer. He spent most of his time working on the MedAustron and HIMM projects. Currently, Samo can be found working on-site in Switzerland. When he is not working, he loves a good game of basketball, fishing in the sea, travelling the world or enjoying a bite into a hot chilly pepper!
9
ISSN: 1855-9255
The Picture Board Unwinding after a long day at the Cosylab conference booth. Note the computer - he’s actually still working!
Prof. In Soo Ko (Postech and PAL, Korea) Prof. Masakazu Yoshioka (Sendai and KEK, Japan) take a break on the CosyCouch at IPAC’16 (Busan, Korea).
Prof. Guoqing Xiao, Director of Institute of Modern Physics, Chinese Academy of Sciences (second from left) with Mark Pleško, Samo Tuma and Gašper Pajor of Cosylab visiting the Cosylab booth at PTCOG 55 in Prague, Czech Republic.
In your words...
Happy in Cosylab T-shirts at IPAC’16 (Busan, Korea).
At IPAC’16, we gave away our infamous CSL t-shirts in return for your answers to the following: Our software projects always finish on time/late because: We got back a range of answers and here is a small sample of what you said.
under lways
se I a becau ... late e I need. the tim
ate
estim
... late because there is always one more bug!
... on-time because scheduling is key.
we allow pi times ... on-time because than the initial more time to finish estimate
... lat e with because (it’s) the r h proje ig cts (s ht exper ard to fin ience oftw are t d pe are), o augh t so no to work o ple rmal n the ly be ginne se rs ... late needs because (w e)
under
s
urce
estim
ate so ftwar
... late because (of) lack of requirements
ost the m is e ar softw oject cause he pr e t b f o e t t r la a . .. dp licate comp ... late whole because of projec Manag t em
ent o f the
e
Cosylab d.d., Teslova ulica 30, SI-1000 Ljubljana, SLOVENIA Phone: +386 1 477 66 76
we are hacks.
... la t time e becau se whic workin we spe g on nt t h se oo ems not time m much to w a ork chines out!
e s com e idea are is h t e s becau softw ew ... late d when the have n n s a t is ic s y first, the ph ready, ideas.
eso d r mite ad i l (of ) worklo se u a c lable be avai te .. . la ared to p com
... late b ecause
Email: controlsheet@cosylab.com
URL: www.cosylab.com