Acknowledgements: This work has been carried out within the framework of the Contract of Association between the European Atomic Energy Community and "Instituto Superior Técnico" (IST). Also received financial support from "Fundação para a Ciência e Tecnologia" in the frame of the Contract of Associated Laboratory. The views and opinions expressed herein do not necessarily reflect those of the European Commission.
MARTe
EPICS as a MARTe Configuration EnvironmentD.F. Valcárcel*, A. Neto, A.S. Duarte, D. Alves, B.B. Carvalho,
P.J. Carvalho, J. Sousa, H. Fernandes, B. GonçalvesAssociação EURATOM/IST,
Instituto de Plasmas e Fusão Nuclear — Laboratório Associado,Instituto Superior Técnico,
Av. Rovisco Pais, 1049-001 Lisboa, Portugal
F. SartoriFusion for Energy
08019 Barcelona, Spain
A. Barbalace, G. ManduchiEURATOM-ENEA Association
Consorzio RFX35127 Padova, Italy
*E-mail address: [email protected]
EPICS•The Experimental Physics and Industrial Control System (EPICS) is a set of Open Source software tools, libraries and applications (...) to create distributed soft real-time control systems for scientific instruments (...).(in http://www.aps.anl.gov/epics/)
•Channel Access (CA) is the layer that enables subsystems to exchange data (Process Variables, PV) or communicate.•Input-Output Controller (IOC), Databases and Records enable building controllers.
•The Multithreaded Application Real-Time executor (MARTe) is a C++ framework for the execution of real-time code.•Runs in Linux, Linux+RTAI, VxWorks, Solaris and MS Windows.•Key points: data driven, component based (reusable and easily maintainable), portable.•Provide live introspection tools without sacrificing real-time.
Motivation•EPICS is widely used in large physics experiments and MARTe is a real-time framework used in fusion.•E P I C S p r o v i d e s a n e x c e l l e n t configuration and monitoring environment.•MARTe lacks configurability without stopping real-time.•There are great benefits in enabling MARTe in tegra t ion in the EPICS environment.•There are two issues to address: the MARTe side interface and the EPICS side interface•This work presents some design solutions to address these issues.
Interfacing EPICSSeveral possibilities to interface MARTe with EPICS:1.Outside MARTe, via a traditional IOC2.Inside MARTe, using a module to interface with Channel Access3.Inside MARTe, using a GAM based approach
(1) Traditional IOC•Records translate MARTe data into PVs•Signals are accessed via streaming•Properties are accessed via the ConfigLib•Access via TCP/IP
(2) MARTe CA module•Channel access is integrated as a MARTe module•Signals are accessed directly from the DDB•Properties are accessed via the ConfigLib
(3) GAM based•EPICSGAM queries CA for PVs and translates them as MARTe signals•EPICSStatistic can be queried by CA to export MARTe signals as PVs
MARTe
RTTh
GAM
DDB
MessageBroker
DataStreaming
EPICS IOC
Channel Access
Database
Record
Network
CAC CAC IOCIOC
MessageMessage
MARTe
RTTh
GAM
DDB
Channel Access
Network
CAC
CAC IOC
IOC
Messag
e
Discussion(1) Traditional IOC+Can be used to interface MARTe and EPICS with minimal changes to MARTe-N eeds s t r eam ing and t he Message Broker as intermediate agents in MARTe-Does not access PVs from EPICS
(2) MARTe CA module+Eliminates the streaming and the Message Broker as intermediate agents•An entire IOC can be used inside MARTe or just the CA part (MARTe is effectively used as an IOC)-Does not access PVs from EPICS
(3) GAM based+Can access PVs from EPICS-D o e s n o t d e a l w i t h properties, only signals
Conclusions:•Properties are configurable entities (data) that belong to GAMs•The ConfigLib can be used to configure GAMs, regardless of the EPICS interface method•A traditional IOC or MARTe CA module can expose MARTe to EPICS (properties and signals), but...•... a GAM based approach seems necessary to access PVs from MARTe
Interfacing MARTeMake accessible:
!"#$%&'(")*"+','-."/!+0'"123'4"#(3.'53
6'%373.'-,'
8)-.%)99'%
+'*'%'-,'":'-;
/)4'9
0757-: #7:-29"<
#7:-29"=
#7:-29">
#7:-29"?
@2%4A2%'"BCD
6'%373.'-,'
8)-.%)99'%
+'*'%'-,'":'-;
@2%4A2%'"BCD
0757-: #7:-29"<
#7:-29"=
#7:2-9"<
#7:-29"E
/!+0'
F!/3
!"#$%&$"'()&*+,-$.!"/)&01-(&+2"*-3-.-(&!"4+5$"6(+2.7".+5$"5(*)2$!"8$).+'-2-19"+&*"5+-&1+-&+'-2-19!"4-5)2+1-(&!"8$:2+0$"+01)+1(,."+&*":2+&1.";-1<"5(*$2.
8)-G:$%2.7)-
H%7.'
+'24
!"#"$
8)--',.7-:"F!/3/27-"74'23
=>)21-!:2+1?(,5"@AA"5-**2$;+,$""!#$')6"+&*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$7"S[SRW7"/,+&0$
#%&'$(%$")*+,-%(+."(/"0(,"
!-4%^"?'.)#-(6("F23$."""""""""""""""""""D)0+"m(&0+6&-J$*,("fP"@+,3+2<(#+&-$2"/P"H+20t,0$2F&1(&-("m+,'+2+0$L-+&5+,-+"#$"B(55+.-_(,t0-("/$,&+&*$./-2-::("4+,1(,-T&d("H-1+2$8-00+,*("H-1$22-D)0+"u+'$(
1 1
1 1
1
2
3 4
5267
!,R-)A9'4:'5'-.3
B<-.";(,C";+.".)::(,1$*"'9"1<$"T),(:$+&"@(55)&-1-$.")&*$,"1<$"0(&1,+01"(?"F..(0-+1-(&"'$1;$$&"Tj8FB`>aG4B"+&*";+."0+,,-$*"()1";-1<-&"1<$"?,+5$;(,C"(?"1<$"T),(:$+&"/).-(&"#$3$2(:5$&1"F6,$$5$&1P"4$$"1<$"F::$&*-E"(?"/P"8(5+&$22-"$1"+2P7"/).-(&"T&$,69"@(&?$,$&0$"\RRW"MJ,(0P"\\&*"G&1P"@(&?P"L$&$3+7"\RRWO"GFTF7"M\RRWOP"B<$"3-$;.+&*"(:-&-(&."$E:,$..$*"<$,$-&"*("&(1"&$0$..+,-29",$k$01"1<(.$"(?"1<$"T),(:$+&"@(55-..-(&P
Real-TimeSignals
Properties
For configuration and introspection of MARTe internal data, must be granted access to:
•Real-time signals (read-only)
•Properties: configurable data belonging to a GAM
Interface with Properties:•Configuration library (ConfigLib) developed to get/set properties•Message-based configuration conforming to a well defined protocol
Interface with Signals:•From inside the MARTe process, signals can be accessed directly via the Dynamic Data Buffer (DDB, entities that hold the signals in memory in a highly optimized fashion).•From outside MARTe signals can be accessed via data streaming
Parameters Possible Outcomes
GetPropertyList
GetPropertyInformation
GetProperty
SetProperty
None List of properties available
Property name Property information (type, readable, writable, etc.)
Property does not exist
Property name Property value
Property does not exist
Property name Property set OK
Property value Property does not exist
Property not writable
Fig. 4. The real-time thread acts a module micro-scheduler. In this figurea group of seven GAMs is executed at each cycle. The first GAM acquiresdata from a device and outputs it to the memory data buffer. Once processedsome of the data is written back to the hardware.
execution of MARTe is arrested up to the arrival of an externalinterrupt. If polling is selected the system will continuouslyquery the interface until an answer is provided. In both caseswhen an answer arrives the absolute time is updated and theframework checks if a new cycle is to begin.
As this is one of the most delicate parts of the system aseries of checks and timeouts can be configured. The systemdesigner must decide what actions to perform when a timeoutor error occurs.
E. Multiple real-time threads
MARTe is able to handle a collection of real-time threads.These can either be configured to run concurrently on the sameprocessor or in parallel. The only way of sharing data betweenthreads is to use a special IOGAM, provided by the framework,as the output of the thread producing data, connected to aninput acquisition module in the thread consuming the signals.For MARTe these two synchronization GAMs emulate thepresence of a physical hardware which would produce andconsume the data, allowing to have the two threads completelydecoupled. The output module can also be used as the timingsource for the driven thread and can be configured to sendunder sampled filtered data, allowing to specify differentrunning frequencies.
IV. INTERFACING TO MARTE
As stated in the previous section, the only compulsoryrequirement for the start-up of a MARTe based application isthe existence of at least one real-time thread. Fig. 4 illustratesa collection of available external interfaces to MARTe, whichare not bounded to a particular project. These permit tointerchange information with the framework, both by queryingits components internal values and by actively updating thestate or values of some of the components.
A. Message InterfaceUsing the BaseLib2 message protocol it permits to send
synchronous messages to the framework. MARTe internalservices are started and stopped upon the receive of a specificmessage. The interface is designed to be connected to anexternal object that is able do decode an external configurationprotocol, for instance from a human machine interface, intoa MARTe recognized message. This is the preferred way tochange the list of modules to be executed and to update GAMsparameters. After receiving a message, the framework verifiesits validity and forwards it internally. If reconfiguration isrequired the threads being executed are eventually stopped.
B. HTTP InterfaceThe framework uses the HTTP server provided by BaseLib2
and supplies a collection of HTTP based components thatallow to setup a communication channel with all the internalelements. Examples of these utilities are a remote configura-tion file upload and a signal server to download data acquiredduring a certain period of time. Live diagnosis of threadingand memory activity are also available, together with the list ofall the registered objects. All the modules that expose renderinformation are also highlighted.
V. FIRST APPLICATION - JET VERTICAL STABILISATION
The Joint European Torus (JET) is the largest magneticconfinement fusion device [3] in the world. Plasma is confinedinside the chamber using strong magnetic fields and its posi-tion and shape controlled by a combination of coils. In orderto obtain better fusion performances the plasma is forced to bevertically elongated, unfortunately such plasmas are verticallyunstable [4] and must be controlled in closed loop. The aimof the Vertical Stabilisation (VS) system is to control theinstability by driving the current in a set of Poloidal Field (PF)coils so that a radial magnetic field is produced. The lose orerroneous control of the instability can have huge negativeimpacts, as plasma disruptions (complete loss of thermaland magnetic energy) may occur, inducing large currentsand forces in the machine vessel. An international ongoingproject for the upgrade of the JET plasma control (PCU) [5]will allow to greatly enhance the current VS system. Therequirements are the execution of the closed loop cycle within50 µs with a maximum jitter of 2.5 µs, comprising theinterface with hardware and data processing. An applicationfulfilling these requirements was designed using the MARTeframework, where a multi-disciplinary team contributed to thedifferent parts of the system: hardware and software engineersdeveloped the integration with hardware and the overall setupof the system, while control engineers produced the GAMsfor modeling and control.
Although JET is a pulsed machine, with experiments thatcan last up to 2 minutes and where the presence of the VSsystem is vital, it was decided from the beginning to havethe vertical stabilization always running and guaranteeing real-time, making no distinction between operational phases. Thisis particularly relevant for future fusion devices like ITER [6],where subsystems will have to adapt to a steady state operation
6
Pioneering Science andTechnology
Office of ScienceU.S. Department
of EnergyGetting Started with EPICS: Introductory Session II
Channel Access
• Allows other programs (CA
Clients) to see and change values
of Process Variables in an IOC (CA
Server)
• CA Clients may
- Put (write)
- Get (read)
- Monitor
data of Process Variables
• IOCs are both CA clients and CA
servers. They can interact with
data in other IOCs
• A CA Client can connect to many
servers
• A CA Server may serve many
clients
• A very efficient an reliable protocol
Workstation
CA Client
CA Server
Network
IOC
(Image: http://www.aps.anl.gov/epics/)
CAC Query
CAS Reply