[ieee 2010 17th real-time conference - ieee-npss technical committee on computer applications in...

7
The COMPASS Tokamak Plasma Control Software Performance Daniel F. Valcárcel, André Neto, Ivo S. Carvalho, Bernardo B. Carvalho, Horácio Fernandes, Jorge Sousa, Filip Janky, Jan Havlicek, Radek Beˇ no, Jan Horacek, Martin Hron and Radomir Pánek Abstract—The COMPASS tokamak has started operation at the IPP Prague in December 2008. A new control system has been built using an ATCA-based real-time system developed at IST Lisbon. The control software is implemented on top of the MARTe real-time framework attaining control cycles as short as 50 μs, with a peak jitter of less than 9 μs. The controlled parameters, important for the plasma performance, are the plasma current, position of the plasma current center, boundary shape and horizontal and vertical velocities. These are divided in two control cycles: slow at 500 μs and fast at 50 μs. The project has two phases. First, the software implements a digital controller, similar to the analog one used during the COMPASS-D operation in Culham. In the slow cycle the plasma current and position are measured and controlled with PID and feedforward controllers, respectively, the shaping magnetic field is preprogrammed. The vertical instability and horizontal equilibrium are controlled with the faster 50 μs cycle PID controllers. The second phase will implement a plasma shape reconstruction algorithm and controller, aiming at an optimized plasma performance. The system was designed to be as modular as possible, by breaking the functional requirements of the control system into several independent and specialized modules. This splitting enabled to tune the execution of each system part and to use the modules in a variety of applications with different time constraints. This paper presents the design and overall performance of the COMPASS control software. Index Terms—Real-Time, ATCA, Data Acquisition, Plasma Control Software I. I NTRODUCTION R EAL-TIME plasma control plays a very important role on modern tokamak devices for nuclear fusion studies. In particular it is absolutely necessary on advanced plasma scenarios [1]. COMPASS is a tokamak that was previously in operation in Culham (United Kingdom) and in 2008 moved and com- Manuscript received May 28, 2010. D.F. Valcárcel, A. Neto, I.S. Carvalho, B.B. Carvalho, H. Fernandes and J. Sousa are with Associação EURATOM/IST, Instituto de Plasmas e Fusão Nuclear - Laboratório Associado, Instituto Superior Técnico, Av. Rovisco Pais, P-1049-001 Lisboa, Portugal, Email: [email protected]. F. Janky and J. Havlicek are with the Institute of Plasma Physics AS CR, v.v.i., Association EURATOM / IPP.CR, Za Slovankou 3, 182 00 Prague, Czech Republic and with Department of Surface and Plasma Science, Faculty of Mathematics and Physics, Charles University, V Holesovickach 2, 180 00 Praha 8, Czech Republic. R. Beˇ no is with the Department of Control Engineering, Faculty of Electrical Engineering, Czech Technical University, Technicka 2, 166 27 Prague 6, Czech Republic. J. Horacek, M. Hron and R. Pánek are with the Institute of Plasma Physics AS CR, v.v.i., Association EURATOM / IPP.CR, Za Slovankou 3, 182 00 Prague, Czech Republic. missioned to IPP Prague (Czech Republic) [2]. Its scientific research programme involves ELM studies and physics of the pedestal in the H-mode. H-mode is a plasma regime where good confinement is achieved but which must satisfy a stringent set of conditions and physical requirements. In particular for COMPASS it must be operated with a shaped and stabilized plasma [3]. Stability comes in two parts [4], the first being the stability related to the plasma radial equilibrium and it is related to the fact that a current carrying loop tends to naturally expand due to the self-repulsive force on the ring (hoop-force). The second comes from the fact that a shaped plasma is always vertically unstable, meaning that any deviation from its equilibrium position will deviate it even further with an exponential growth rate. This is due to the shaping magnetic field unfavourable configuration and leads to the plasma crashing against the wall. Thus very high temperature and electromagnetic loads are deposited onto the vessel and in-vessel components. These needs induced the design and development of a portable control software, with the added requirement of being able to be reused on other machines. There are several platforms or customized solutions that could be used for this purpose. Traditionally the solutions are based on implementations of the control software in Digital Signal Processor (DSP) or Field Programmable Gate Array (FPGA) components [5], [6]. Although this solution should perform better than a generic one running on a General Purpose Processor (GPP), it is not easily portable to other tokamaks. Moreover, development time is usually larger as the solution is not easily debuggable. The DIII-D Plasma Control System [7] has already proven to act and control DIII-D in a 50 μs timescale but has the disadvantage of not being introspectable or configurable during the real-time phase. The system uses a customized Linux running in several VME GPP Personal Computer (PC) components, it is configured before the plasma discharge and during the discharge external interrupts are disabled. This is a problem especially because in very long discharges, such as in ITER [8], it is important to be able to drive the experiment in human timescales. The GPP approach used on the JET vertical stabilization system [9] is based on the MARTe software framework [10]. It runs on a 50 μs timescale and has shown good results in mitigating the plasma vertical instability [11]. MARTe is designed to run on a variety of Operating Systems (OS), such as Linux, Linux-RTAI, Solaris, Microsoft Windows and VxWorks. For this reason the developed applications are 978-1-4244-7110-2/10/$26.00 ©2010 IEEE

Upload: radomir

Post on 23-Dec-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

The COMPASS Tokamak Plasma Control SoftwarePerformance

Daniel F. Valcárcel, André Neto, Ivo S. Carvalho, Bernardo B. Carvalho, Horácio Fernandes, Jorge Sousa,Filip Janky, Jan Havlicek, Radek Beno, Jan Horacek, Martin Hron and Radomir Pánek

Abstract—The COMPASS tokamak has started operation atthe IPP Prague in December 2008. A new control system hasbeen built using an ATCA-based real-time system developed atIST Lisbon. The control software is implemented on top of theMARTe real-time framework attaining control cycles as shortas 50 µs, with a peak jitter of less than 9 µs. The controlledparameters, important for the plasma performance, are theplasma current, position of the plasma current center, boundaryshape and horizontal and vertical velocities. These are dividedin two control cycles: slow at 500 µs and fast at 50 µs.

The project has two phases. First, the software implementsa digital controller, similar to the analog one used during theCOMPASS-D operation in Culham. In the slow cycle the plasmacurrent and position are measured and controlled with PIDand feedforward controllers, respectively, the shaping magneticfield is preprogrammed. The vertical instability and horizontalequilibrium are controlled with the faster 50 µs cycle PIDcontrollers. The second phase will implement a plasma shapereconstruction algorithm and controller, aiming at an optimizedplasma performance.

The system was designed to be as modular as possible,by breaking the functional requirements of the control systeminto several independent and specialized modules. This splittingenabled to tune the execution of each system part and to usethe modules in a variety of applications with different timeconstraints.

This paper presents the design and overall performance of theCOMPASS control software.

Index Terms—Real-Time, ATCA, Data Acquisition, PlasmaControl Software

I. INTRODUCTION

REAL-TIME plasma control plays a very important roleon modern tokamak devices for nuclear fusion studies.

In particular it is absolutely necessary on advanced plasmascenarios [1].

COMPASS is a tokamak that was previously in operationin Culham (United Kingdom) and in 2008 moved and com-

Manuscript received May 28, 2010.D.F. Valcárcel, A. Neto, I.S. Carvalho, B.B. Carvalho, H. Fernandes and

J. Sousa are with Associação EURATOM/IST, Instituto de Plasmas e FusãoNuclear - Laboratório Associado, Instituto Superior Técnico, Av. Rovisco Pais,P-1049-001 Lisboa, Portugal, Email: [email protected].

F. Janky and J. Havlicek are with the Institute of Plasma Physics AS CR,v.v.i., Association EURATOM / IPP.CR, Za Slovankou 3, 182 00 Prague,Czech Republic and with Department of Surface and Plasma Science, Facultyof Mathematics and Physics, Charles University, V Holesovickach 2, 180 00Praha 8, Czech Republic.

R. Beno is with the Department of Control Engineering, Faculty ofElectrical Engineering, Czech Technical University, Technicka 2, 166 27Prague 6, Czech Republic.

J. Horacek, M. Hron and R. Pánek are with the Institute of Plasma PhysicsAS CR, v.v.i., Association EURATOM / IPP.CR, Za Slovankou 3, 182 00Prague, Czech Republic.

missioned to IPP Prague (Czech Republic) [2]. Its scientificresearch programme involves ELM studies and physics of thepedestal in the H-mode.

H-mode is a plasma regime where good confinement isachieved but which must satisfy a stringent set of conditionsand physical requirements. In particular for COMPASS it mustbe operated with a shaped and stabilized plasma [3].

Stability comes in two parts [4], the first being the stabilityrelated to the plasma radial equilibrium and it is related to thefact that a current carrying loop tends to naturally expand dueto the self-repulsive force on the ring (hoop-force). The secondcomes from the fact that a shaped plasma is always verticallyunstable, meaning that any deviation from its equilibriumposition will deviate it even further with an exponential growthrate. This is due to the shaping magnetic field unfavourableconfiguration and leads to the plasma crashing against thewall. Thus very high temperature and electromagnetic loadsare deposited onto the vessel and in-vessel components.

These needs induced the design and development of aportable control software, with the added requirement ofbeing able to be reused on other machines. There are severalplatforms or customized solutions that could be used for thispurpose.

Traditionally the solutions are based on implementationsof the control software in Digital Signal Processor (DSP) orField Programmable Gate Array (FPGA) components [5], [6].Although this solution should perform better than a genericone running on a General Purpose Processor (GPP), it is noteasily portable to other tokamaks. Moreover, development timeis usually larger as the solution is not easily debuggable.

The DIII-D Plasma Control System [7] has already provento act and control DIII-D in a 50 µs timescale but hasthe disadvantage of not being introspectable or configurableduring the real-time phase. The system uses a customizedLinux running in several VME GPP Personal Computer (PC)components, it is configured before the plasma discharge andduring the discharge external interrupts are disabled. This is aproblem especially because in very long discharges, such asin ITER [8], it is important to be able to drive the experimentin human timescales.

The GPP approach used on the JET vertical stabilizationsystem [9] is based on the MARTe software framework [10].It runs on a 50 µs timescale and has shown good resultsin mitigating the plasma vertical instability [11]. MARTe isdesigned to run on a variety of Operating Systems (OS),such as Linux, Linux-RTAI, Solaris, Microsoft Windows andVxWorks. For this reason the developed applications are

978-1-4244-7110-2/10/$26.00 ©2010 IEEE

Page 2: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

TABLE ITHE COMPASS MAGNETIC FIELD GENERATING CIRCUITS AND THEIRASSOCIATED POWER SUPPLIES. THE ENERGETICS SYSTEM IS THE ONE

DRIVING THE SLOW POWER SUPPLIES AND EACH FAST AMPLIFIER DRIVESTHE FAST MAGNETIC FIELDS.

Circuit PurposeCurrent Range

(kA)Driven By

TFPSMFPSEFPSSFPS

BVBR

Toroidal Field 0 – 96 EnergeticsPlasma Breakdown and Current Induction -18 – 12 Energetics

Slow Radial Equilibrium 0 – 16 EnergeticsPlasma Shaping 0 – 12 Energetics

Fast Radial Equilibrium -5 – 5 Fast AmplifierVertical Stabilization -5 – 5 Fast Amplifier

portable and development can be done on a different OS takingadvantage of existing debugging utilities. It is a multithreadedsoftware that greatly benefits from the current multicore pro-cessor technology and in the case of Linux to attain real-time performances uses the kernel ability to isolate cores fordedicated tasks.

The MARTe workflow for the application developer is todesign and implement modules called Generic ApplicationModules (GAMs). These execute sequentially in real-timethreads and can work together by exchanging signals. A partic-ular MARTe application can have several threads, each runningits own set of GAMs. If they are designed as independentmodules they are also reusable on different applications.

This paper describes the control software design, whichuses the MARTe framework, and its performance results.Suggestions for the improvement of the software are givenon the final section of the paper.

II. THE COMPASS PLASMA CONTROL

A. Description

Fig. 2 depicts the hardware installed for the control project.The main components are the actuator circuits along with theassociated power supplies, the magnetic sensors and the analogintegrators, and the processing module that it is shared withthe data acquisition system.

COMPASS has a set of 6 circuits that generate the magneticfields to control the plasma. Table I summarizes the circuitsand the power supplies that drive them and Fig. 1 showsthe position of the circuits (except the toroidal circuit) ina COMPASS cross-section [12]. These are the toroidal field(TF), magnetising field (MF), equilibrium field (EF), shapingfield (SF) and the radial and vertical fields driven by the fastamplifiers (BR and BV respectively). The former are drivenby power supplies named TFPS, MFPS, EFPS and SFPS andthis set is known as the energetic system.

The TF field along with the poloidal field generated by theplasma current are responsible for the plasma confinement.The MF on COMPASS has two purposes, the first is to inducethe plasma breakdown and the second to drive the plasmacurrent. The field generated by both EFPS and BV is directedto the vertical direction and acts on the plasma radial position.The main difference between these two circuits is on the powersupplies that drive them. The EFPS is slower but stronger.SF is a field that acts on the plasma shape changing it from

Fig. 1. Cross-section of COMPASS showing 3 slow circuits (Magnetizing,Equilibrium and Shaping) and the 2 fast circuits (F). The toroidal circuit isnot shown.

ATCA Shelf

SerialPCI Card

921.6 kbit/s

ATCAMIMOISOLCards

ATCAController

IntelRCoreTM 2Quad

FastAmplifier

Energetic System

FastAmplifier

Mag. Circuits

PCI

PCIe

Optical Serial Communication Current Measurements

Mag. Probes

Current Measurements

TFPS, MFPS, EFPS, SFPS

BR

BV

Thyristor Module

Fig. 2. COMPASS hardware instalation for plasma magnetic control.

circular to a D-shape. Finally the BR is the field important forshaped plasmas to control the vertical instability.

The COMPASS data acquisition and processing system[13] is based on PICMG 3.0 Advanced TelecommunicationsComputing Architecture (ATCA) standard and on multi-corex86 processor technology [14].

The processing module was updated early 2010 for a fasterprocessor and a more recent motherboard. The system usesan ASUS(R) motherboard with an Intel(R) Core(TM)2 QuadQ9550 processor @ 2.83GHz. To communicate with thepower supplies a Lindy(R) PCI Quad RS-232 @ 921.6 kbaudcard is used. The data acquisition cards GPIO-MIMO-ISOLwere developed at Instituto Superior Técnico (IST) and eachsamples 32 channels at 20 kSamples/S for real-time purposes[15]. The MARTe real-time framework runs on the processingmodule on top of the Linux operating system with kernelversion 2.6.29.6 and 3 isolated cores for real-time threads.

The set of analog integrators are the original ones that were

Page 3: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

installed at Culham along with COMPASS-D. They provideconfigurable integration gains and optional sum or subtractionof up to four integrated signals per integrator module. Theoutput signals of these analog integrators drift linearly andthis has to be removed before using the signals in real-time.The integrators are reset electronically and restart drifting fromzero before each plasma discharge.

B. Plasma Current Control

The plasma current IP is induced on a tokamak plasma bytransformer effect. A primary winding driven by a current IMF

generates the magnetic flux that links with the plasma, thesecondary of the transformer. By Faraday’s law of inductionIP is induced by a variable IMF (Eq. 1).

IP ∝dIMF

dt(1)

Thus in order to maintain the plasma current by inductionit is necessary to keep a primary current variation rate. Tocontrol the plasma current a PID controller can be used. Thecontroller output provides the necessary dIMF

dt to induce therequired IP . Because MFPS needs a current setpoint, this mustbe computed using Eq. 2 by measuring the actual current inthe MF circuit.

IMF = ImeasuredMF +

(dIMF

dt

)PID

× ∆t (2)

∆t is the time interval from the last iteration when thecurrent was updated.

C. Equilibrium Control

The plasma radial equilibrium control must be divided in 2contributions as there are 2 sets of vertical field actuators (EFand BV). One needs to keep in mind that EF evolves slowerthan BV but it generates a stronger field.

Regarding the equilibrium problem, [16] shows that for acircular and high aspect ratio plasma Eq. 3 gives the verticalmagnetic field needed to balance the plasma hoop force:

Bz =µIp4πR

[ln

8Ra

− 32

+ βp +li2

](3)

This expression has been shown to work relatively well forlow-aspect ratio tokamaks and even noncircular plasmas [4]. Itshows that the hoop-force depends on the plasma current IP ,the plasma radial position R and radius a, internal inductanceli and poloidal beta βp. The plasma current, position andradius are easily measured during a discharge. The internalinductance and poloidal beta are not so easily measurable butcan be estimated and assumed constant throughout the flat-topphase of the plasma discharge. In reality they are not constant,however this fact can be taken into account as a disturbanceto the model [17].

Thus it is natural to devise a control strategy where Eq. 3provides a feedforward model to drive the EF circuit and thedisturbances are handled by the faster BV circuit driven by afeedback PID control scheme.

D. Vertical Instability Control

For the vertical instability control, reference [18] shows thata PD regulator suffices. Work has been done modeling theCOMPASS vertical instability [19] where a PD regulator hasbeen used in the simulations. The growth rate of the instability[20] determines that the control loop must execute at least onceeach 50 µs.

E. Summary

In the first phase of the project the planned control systemis similar to the one that was implemented at Culham. Thismeans independent controllers for the plasma current, radialequilibrium and vertical instability. The TF and SF are bothprogrammed before the discharge starts. The MF for theplasma current control is driven by a PI controller, for theradial equilibrium the EF is driven by the feedforward modeldescribed in Section II-C and BV by a PI controller thatmeasures the plasma radial position. Finally for the verticalinstability control the BR field is driven by a PD controllerthat measures the plasma vertical position.

The system requires two control cycles. One at 50 µsfor the fast corrections such as vertical instability and fastradial corrections. The second at 500 µs for the control ofslow varying processes such as the plasma current and radialequilibrium. Shaping control, although not required on thisphase, belongs to the slow varying processes class.

III. THE SOFTWARE LIBRARY

A. Description

The real-time software library was designed to fulfill theneeds described in Section II by implenting several indepen-dent modules. These can be classified as Data ProcessingGAMs, Input/Output GAMs (IOGAMs), system managementGAMs and simulation GAMs.

Data processing modules include PID control, waveformgeneration, signal offset and drift removal and measuring theplasma current and position.

The implemented IOGAMs are responsible for communi-cating with the power supplies.

The simulation GAMs are a set of modules developed tosimulate the working system. They test triggers and commu-nication with the power supplies.

Finally the system management GAMs provide funcionalitysuch as determining that a trigger signal arrived, communicat-ing with the control and data acquisition system or convertingbetween different data types.

All of these modules were designed keeping in mind thatthe library should be portable to other applications, especiallyother machines. Thus the number of COMPASS specificmodules was kept to a minimum. Their design and codeimplementation were optimized so that they run on the leasttime possible, allowing a greater application range. The mostimportant modules are detailed in the next sections.

Page 4: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

0.6 0.8 1 1.2 1.4 1.6−12000

−10000

−8000

−6000

−4000

−2000

0

2000

4000

Time (s)

Cur

rent

(A)

MeasuredNo Drift

Fig. 3. The removal procedure in a real case. The red curve is the integratedsignal of a Rogowski probe measuring the EFPS current. The blue curve is thesame signal with drift and offset removed. A linear model fits the samplesremoving the drift and the offset from 0.8 to 1.5 s. The parameters of thelinear model are calculated from 0.5 to 0.8 s. At 0 s TFPS starts ramping upthe toroidal field and the other fields start only after 800 ms. At around 0.5 sthe analog integrators are reset electronically and start drifting from zero (notshown).

B. Linear Drift And Offset Removal GAM

All measured integrated magnetic signals possess an inte-gration drift and an offset that need to be removed prior tothe calculations. The drift is fairly linear on a millisecondtimescale but the slope of the drift is different betweenintegrators and can change on larger timescales.

The module required to eliminate the offset and drift ofthe signals was designed to work on two time windows. Thefirst window is where it calculates the drift and the second iswhere it effectively removes the drift. Usually the first windowis a few hundreds of milliseconds before the plasma dischargeand the removal starts a few milliseconds before and continuesthroughout the discharge.

The drift calculation procedure is illustrated on Fig. 3 wherea χ2 minimization procedure is used to fit a linear model y =α + βx to the measured data. This procedure must be doneon a time window where only linear drift exists.

Sx =∑xi

Sy =∑yi

Sxx =∑x2

i

Sxy =∑xiyi

Syy =∑y2

i

β = nSxy−SxSy

nSxx−S2x

α = Sy

n − β Sx

n

(4)

Eqs. 4 ilustrate the fitting procedure [21]. At each iterationi during the calculation window the sums on these equationsare updated with the last sample read, and α and β providean estimate for the fitting parameters α and β respectively.

C. Waveform Generator GAM

To generate the required waveforms, such as the TF circuitcurrent, the WaveformGeneratorGAM was developed. Thismodule stores in memory an array of time-value pairs thatare reproduced at the correct instants. If the value requiredis not stored in memory then an interpolation using the twonearest points is used. The optimized search on the array of

pairs is always done forward from the last used pair, knowingthat the next pair is not arbitrary because time flows forward.

D. Plasma Current Calculator GAMThe plasma current is measured using the integrated signal

of a Rogowski coil. This signal is measured and a calibrationfactor provides the scaling to obtain the plasma current.

E. Plasma Position Calculator GAMThe plasma position calculation algorithm is still in a testing

phase and was tested to measure its execution time. As SectionIII-I shows the algorithm executes fast enough to be used onthe 50 µs control cycle.

This algorithm determines the plasma current center fromthe measurement of the integrated signal from 4 Mirnovprobes, one pair on the top/bottom and the other on thehigh-field side/low-field side of the poloidal cross section ofCOMPASS. For each pair the ratio between both probes iscomputed. By simulation it is possible to compute previouslya look-up table (LUT) and search in real-time for the positiongiven the ratios.

The algorithm using the Mirnov probes shows reasonableoffline results, however there are two issues regarding themeasurements. The first is that the Mirnov probe signal tonoise ratio is smaller comparably to the one from internalpartial Rogowski probes. The second is that using only 4probes might not be enough as the set is not very sensitiveto radial changes in position. Thus a similar LUT algorithmis being studied and uses set of more than 4 internal partialRogowski probes. The description and results will be thesubject of a future paper.

F. Control GAMsThis module was designed with two features in mind.

One to be able to simultaneously use feedback control, pro-grammed outputs for the actuators and feedforward control.The second feature was that the basic functionality should beeasily extendable, in the object oriented programming sense,to accommodate different solutions for different applications.This GAM has 3 independent channels whose outputs aresummed to get the final result.

The first of these channels is the programmed channel thatstores a waveform with the desired output.

The feedback channel is a fully configurable PID controller.It implements the 3 terms controller with integral anti-windup,setpoint weighting, derivative kick limiter and filtering.

The feedforward channel is not implemented in the basicfunctionality as feedforward is based on application specificmodels. To implement specific behaviour the GAM must besubclassed and the methods related to feedforward overriden.All the implemented basic functionality is inherited.

The Plasma Current Controller GAM is a customized BasicController Core GAM that implements Eq. 2 as customfunctionality to update the MF circuit current.

The Plasma Radial Equilibrium Controller GAM is a cus-tomized Basic Controller Core GAM that implements thefeedforward model of Eq. 3 for the radial equilibrium. ThisGAM is still a work in progress.

Page 5: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

G. Communication GAMs

This is a set of 3 GAMs, one that communicates with theenergetic system and the other two with the fast amplifiersystem. Both communication protocols are serial protocolstransmitted at 921.6 kbaud.

The 9-bit serial Energetic System Communicator GAMimplements cyclic redundancy check (CRC-3) generation andchecking for the transmitted and received messages respec-tively.

The 8-bit serial Fast Amplifier Communicator GAM doesnot implement CRC but instead uses a custom error checkingscheme coupled with parity checking. There is also an auxil-iary Thyristor Module Communicator GAM which turns ONand OFF a thyristor module powering the fast amplifiers anduses a similar serial protocol.

H. Integration on the MARTe Framework

The integration on MARTe of the GAMs described forcontrol purposes is depicted in Fig. 4. The system uses tworeal-time threads to reflect the need of two control cycles. Thefast loop runs at 50 µs and executes the code related to the fastcontrol, the vertical stabilization and the fast radial feedbackcontrol. The slow loop runs at 500 µs and executes the coderelated to the slow magnetic field control.

Data is acquired from the analog channels on the fast loopat 20 kSamples/s and, after the drifts and offsets removed, theplasma position is determined. The result of the calculationis used by two Basic Controller Core GAMs to regulatethe position. At the end of the loop the acquired data andthe plasma position are transfered to the slow loop. The 10samples acquired between consecutive slow loop cycles arefiltered with a finite impulse response filter and decimated.

On the other hand, after receiving the samples the slow loopdetermines the plasma current. Following this the WaveformGenerator GAM outputs the currents for the TF and SFcircuits. An instance of the Plasma Current Controller GAMcontrols the plasma current with the MF and the Plasma RadialEquilibrium Controller GAM provides the EF feedforwardvalue. At the end of the loop the Energetic System Communi-cator GAM send the values of the 4 currents to the energeticsystem. On this loop the Thyristor Module CommunicatorGAM turns the module ON before the discharge and turnsit off after the discharge. Thus it is not necessary to be in thesame thread as the Fast Amplifier Communicator GAMs.

At the end of both loops the Data Collection GAM and theWebstatistic GAM, both reused from the JET library, providedata storage and statistics. Auxiliary GAMs also take part onboth loops.

I. Results

Table II shows the execution times for each GAM, includingthe GAMs used from the JET library, DataCollectionGAMand WebstatisticGAM. Observation of the measured timingsshow that more time is spent on communications with theactuators. This time information is used to determine how longthe execution of the code in Fig. 4 takes, considering that all

TABLE IIMEASURED EXECUTION TIME FOR EACH GAM.

Time (µs) Jitter (%)EnergeticSystemCommunicatorGAMEnergeticSystemSimulatorGAMFAPowerSupplyCommunicatorGAMFAPowerSupplySimulatorGAMFAThyristorBoardCommunicatorGAM

BasicTimingGAMGPIOTriggerConverterGAMGPIOSimulatorGAMWaveGeneratorGAMLinearDriftRemoverGAMSignalConversionGAMPlasmaCurrentControllerGAMPlasmaCurrentCalculatorGAMPlasmaPositionCalculatorGAMCodacGAM

DataCollectionGAMWebStatisticGAM

78.922 ± 0.511 0.6133.209 ± 12.21 9.2

6.251 ± 0.842 13.56.204 ± 0.833 13.44.460 ± 1.209 27.1

0.699 ± 0.061 8.70.557 ± 0.117 21.00.522 ± 0.070 13.41.435 ± 0.535 37.30.923 ± 0.106 11.50.745 ± 0.045 6.01.154 ± 0.276 23.90.550 ± 0.049 8.97.048 ± 2.100 29.80.432 ± 0.053 12.3

1.494 ± 0.666 44.64.071 ± 0.121 3.0

5

C. Results

Figures 5 and 6 show the cycle time for the two threads.Even running on Linux, very good jitter figures can be ob-tained. These are mainly due to the Linux isolcpus feature [18],which forces the operating system to assign its tasks to adefault set of CPUs, allowing MARTe real-time tasks to runon CPUs free from any Linux activity.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.540

42

44

46

48

50

52

54

56

58

Time (s)

Cycle

tim

e (u

s)

Figure 5. Cycle time for the 50 s loop, responsible for the communicationwith the fast amplifiers.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5492

494

496

498

500

502

504

506

508

Time (s)

Cycle

tim

e (u

s)

Figure 6. Cycle time for the slower 500 s loop. The worst jitter is less than2% of the total time.

Figure 7 depicts the system successfully following thecurrent reference for the magnetizing field power supply.COMPASS is already using MARTe as its real-time controllerfor all the coil current control systems. In the near future, withthe algorithms for the plasma shape reconstruction alreadyimplemented and tested, new controller schemes and variablescan be implemented.

0.2 0.3 0.4 0.5 0.6 0.7 0.8−20

−15

−10

−5

0

5

10

Time (s)

Curre

nt (k

A)

Figure 7. Current control for the magnetizing field.

V. ISTTOK TOMOGRAPHY

A. DescriptionIn the last two decades, some tokamaks have tested Alter-

nating plasma Current (AC) discharges [19][20]. These type ofexperiments allow for longer pulses and to test the interactionof plasma with materials from both sides, without moving thesample. One of the problems which arise in AC discharges isthat during the reversing of the plasma current, the magneticdiagnostics fail to provide an accurate measurement of theplasma position. Tomography, being a diagnostic that onlydepends in the emitted radiation from the plasma and that doesnot rely on magnetic measurements, is a strong candidate toprovide this measurement.

A new real-time plasma position controller, based on to-mography, was recently developed at ISTTOK [21]. Thehardware is again based on the same ATCA® solution usedfor the JET VS and COMPASS. The system uses 30 ADCinputs, from one acquisition board, acquired at 2 MHz andlater downsampled to 20 kHz inside the board FPGAs. Thecommunication with the horizontal and vertical field powersupplies is performed using a serial link over fiber optics,sharing the same protocol used in COMPASS. Due to theamount of calculations which have to be performed in the real-time tomography algorithm, the cycle time was set to 100 !s.

B. Software architectureA collection of 10 GAMs is executed for each control

loop. After acquiring the data from the ATCA® IOGAM,the ISTTOK tomography reconstruction and PID algorithmsare executed and the system synchronized to the timingsystem. Subsequently to running the module which generatethe references, the next step is the execution of the GAMsresponsible for the communication with the power supplies,followed by a set of utility and collection GAMs.

Sharing the same hardware interface with the JET VS sys-tem and the same power supplies protocol with the COMPASSarchitecture, enabled the developer to focus in the developmentof the core tomographic and control algorithms.

Fig. 5. 500 µs cycle time measurement. The jitter peaks are under 7 µs andthe mean jitter is under 1 µs.

5

C. Results

Figures 5 and 6 show the cycle time for the two threads.Even running on Linux, very good jitter figures can be ob-tained. These are mainly due to the Linux isolcpus feature [18],which forces the operating system to assign its tasks to adefault set of CPUs, allowing MARTe real-time tasks to runon CPUs free from any Linux activity.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.540

42

44

46

48

50

52

54

56

58

Time (s)

Cycle

tim

e (u

s)

Figure 5. Cycle time for the 50 s loop, responsible for the communicationwith the fast amplifiers.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5492

494

496

498

500

502

504

506

508

Time (s)

Cycle

tim

e (u

s)

Figure 6. Cycle time for the slower 500 s loop. The worst jitter is less than2% of the total time.

Figure 7 depicts the system successfully following thecurrent reference for the magnetizing field power supply.COMPASS is already using MARTe as its real-time controllerfor all the coil current control systems. In the near future, withthe algorithms for the plasma shape reconstruction alreadyimplemented and tested, new controller schemes and variablescan be implemented.

0.2 0.3 0.4 0.5 0.6 0.7 0.8−20

−15

−10

−5

0

5

10

Time (s)

Curre

nt (k

A)

Figure 7. Current control for the magnetizing field.

V. ISTTOK TOMOGRAPHY

A. DescriptionIn the last two decades, some tokamaks have tested Alter-

nating plasma Current (AC) discharges [19][20]. These type ofexperiments allow for longer pulses and to test the interactionof plasma with materials from both sides, without moving thesample. One of the problems which arise in AC discharges isthat during the reversing of the plasma current, the magneticdiagnostics fail to provide an accurate measurement of theplasma position. Tomography, being a diagnostic that onlydepends in the emitted radiation from the plasma and that doesnot rely on magnetic measurements, is a strong candidate toprovide this measurement.

A new real-time plasma position controller, based on to-mography, was recently developed at ISTTOK [21]. Thehardware is again based on the same ATCA® solution usedfor the JET VS and COMPASS. The system uses 30 ADCinputs, from one acquisition board, acquired at 2 MHz andlater downsampled to 20 kHz inside the board FPGAs. Thecommunication with the horizontal and vertical field powersupplies is performed using a serial link over fiber optics,sharing the same protocol used in COMPASS. Due to theamount of calculations which have to be performed in the real-time tomography algorithm, the cycle time was set to 100 !s.

B. Software architectureA collection of 10 GAMs is executed for each control

loop. After acquiring the data from the ATCA® IOGAM,the ISTTOK tomography reconstruction and PID algorithmsare executed and the system synchronized to the timingsystem. Subsequently to running the module which generatethe references, the next step is the execution of the GAMsresponsible for the communication with the power supplies,followed by a set of utility and collection GAMs.

Sharing the same hardware interface with the JET VS sys-tem and the same power supplies protocol with the COMPASSarchitecture, enabled the developer to focus in the developmentof the core tomographic and control algorithms.

Fig. 6. 50 µs cycle time measurement. The jitter peaks are under 9 µs andthe mean jitter is under 1 µs.

Page 6: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

MARTe ServicesFast Stabilization RTTh (50 μs) Plasma Control RTTh (500 μs)

InputGAM(Read ADC Values)

OutputGAM(Send signals to other RTTh)

DataCollectionGAM

WebStatisticGAM

ATCAAdc(ATCA GPIO Driver)

TimeFilteredInputGAM(Get signals from other RTTh)

Basic Timing GAM

Plasma Current Calculator GAM

Energetic System Communicator GAM

Synch

SynchronizingDriver

Fast Serial Card

Linux Serial Driver

Waveform Generator GAM

(Toroidal and Shaping Fields)

DataCollectionGAM

WebStatisticGAM

Offset and Drift Removal GAM

Plasma Position Calculator GAM

Basic Control GAM(Vertical Position)

Fast Amplifier Communicator GAM

Fast Amplifier Communicator GAM

Codac GAM

Basic Timing GAM

Basic Control GAM(Radial Position)

Plasma Radial Equilibrium Control

GAM(Radial Position)

Plasma Current Control GAM(Plasma Current)

HTTP Server

Signal Server

Configuration Uploader

Dyna

mic

Dat

a Bu

ffer

Dyna

mic

Dat

a Bu

ffer

Thyristor Module Communicator GAM

Fig. 4. Software schematic ilustrating the organisation of the GAMs in the Real-Time Threads (RTTh). There are two real-time threads (at the edges), oneMARTe thread (in the middle) and the GAMs execute sequentially from top to bottom on each thread. The Dynamic Data Buffer (DDB) structure has thepurpose of handling data transfer between GAMs.

the controller GAMs take the same time to execute. The codein the 50 µs thread takes 29.045±5.290 µs to execute and thecode in the 500 µs takes 94.371±3.757 µs, both below thethread execution time even considering the associated jitter.

Figs. 5 and 6 show the time evolution of the measured cycletime of the 500 µs and 50 µs threads, respectively. These cycletimes were measured to be 500.06±0.845 µs and 49.997±0.907µs. From the plots it can be seen that the peak deviation fromthe cycle time does not exceed 9 µs and that is an extremecase.

The experimental tests with COMPASS so far were todrive current on TFPS, MFPS, EFPS and SFPS during severalplasma discharges. The results for discharge #1155 are pre-sented. The toroidal and shaping fields are not shown, as theshaping field is zero on a circular shape plasma and the toroidalfield is constant and of little interest for the discharge. Figs.7 and 8 show the MFPS and EFPS currents on the circuits. Itcan be seen that the power supplies follow the requests.

IV. FINAL REMARKS

The system developed complies with the real-time speci-fications and the preliminary tests performed show that thecurrent actuators can follow the reference signals provided bythe system. The next steps in the testing phase are to test thefull current and position feedback, first in a circular plasma

0.8 0.9 1 1.1 1.2 1.3 1.4−14000

−12000

−10000

−8000

−6000

−4000

−2000

0

2000

4000

Time (s)

Cur

rent

(A)

MFPS MeasuredMFPS Requested

Fig. 7. MFPS current driven by the real-time system. The field generatedby this circuit is responsible for the plasma breakdown at around 0.95 s andfor driving the plasma current after that.

without vertical instability and after in a pre-programmedshaped plasma introducing the vertical stabilization.

Regarding the execution time of all the GAMs in the real-time threads, in Section III-I it was shown that in each thread,even with the total jitter, the execution time of all GAMswas less than the thread cycle time. The case of the 50 µsthread is the most critical as the jitter of both the threadcycle (in percentage) and the total GAM execution is larger.Nevertheless if need arises it should be possible to reduce the

Page 7: [IEEE 2010 17th Real-Time Conference - IEEE-NPSS Technical Committee on Computer Applications in Nuclear and Plasma Sciences (RT 2010) - Lisbon, Portugal (2010.05.24-2010.05.28)] 2010

0.8 0.9 1 1.1 1.2 1.3 1.4−500

0

500

1000

1500

2000

2500

3000

3500

Time (s)

Cur

rent

(A)

EFPS MeasuredEFPS Requested

Fig. 8. EFPS current driven by the real-time system. The field generated bythis circuit is responsible for the equilibrium of the radial plasma movements.The peaks seen after 0.95 s are caused by the large derivative in the MFPScurrent, as the MF circuit is inductively coupled with the EF circuit.

jitter by executing the control code in kernel space RTAI, thesolution adopted by JET.

As pointed out in Section II-C the plasma behaviour isinfluenced by disturbances such as variations of βp or li.Because these disturbances are unavoidable it is also necessaryto control the plasma boundary shape. For this purpose twothings are needed, a plasma boundary reconstruction schemeand a Multiple-Input Single-Output boundary controller.

Several boundary reconstruction codes are available, amonstthem there is rtEFIT [22] and XLOC [23]. As we are interestedonly in the boundary reconstruction and there is already animplementation of XLOC for MARTe, Felix [24], this is themost promising candidate.

Typically the control scheme for the plasma shape is basedon approaches such as controlling gaps or the magnetic flux onthe boundary [17]. The gap approach involves controlling theshape ensuring constant distances (gaps) to reference positions(usually the wall). The latter approach means controlling thepoloidal flux on predefined points of the boundary and it isused in tokamaks such as TCV [25].

It is straightforward to integrate this solution in the alreadydeveloped scheme. On the 500 µs real-time thread the FelixGAM must be included after the plasma current calculationand the shape controller receives the result in the form of theshape descriptors.

ACKNOWLEDGMENT

This work has been carried out within the framework ofthe Contracts of Association between the European AtomicEnergy Community and "Instituto Superior Técnico" (IST) andIPP.CR. IST also received financial support from "Fundaçãopara a Ciência e Tecnologia" in the frame of the Contractof Associated Laboratory. The views and opinions expressedherein do not necessarily reflect those of the European Com-mission.

The work at IPP.CR was supported by the Academy ofSciences of the Czech Republic IRP #AV0Z20430508 andthe Ministry of Education, Youth and Sports CR #7G09042.The work of J. Havlicek at the Faculty of Mathematics andPhysics, Charles University was supported by Czech ScienceFoundation grant 202/08/H057.

REFERENCES

[1] J.B. Lister, The evolution of feedback control in tokamaks, Proceedingsof ICALEPCS2003, Gyeongju, Korea.

[2] R. Pánek, O. Bilykova, V. Fuchs, M. Hron, P. Chraska, P. Pavlo, et al.,Reinstallation of the COMPASS-D tokamak in IPP ASCR, CzechoslovakJournal of Physics, Vol. 56 (2006), Suppl. B B125-B137.

[3] S.J. Fielding, J.D. Ashall, P.G. Carolan, et al., The H-mode inCOMPASS-D, Plasma Physics and Controlled Fusion, Vol. 38, 1996,pp. 1091–1102.

[4] R. Albanese, G. Ambrosino, Current, position, and shape control oftokamak plasmas: a literature review, Proceedings of the IEEE Inter-national Conference on Control Applications Anchorage, Alaska, USASeptember 25-27, 2000.

[5] D.F. Valcárcel, I.S. Carvalho, B.B. Carvalho, et al., Fast feedback controlfor plasma positioning with a PCI hybrid DSP/FPGA board, IEEETransactions on Nuclear Science, Vol. 53 (3), June 2006, pp. 838-844.

[6] A.P Rodrigues, L. Pereira, J.-M. Moret, B.P. Duval, C.A.F. Varandas,Real-time data transfer in the TCV advanced plasma control system,Fusion Engineering and Design 81, Issues 15-17, July 2006, pp. 1939-1943.

[7] B.G. Penaflor, J.R. Ferron, R.D. Johnson, D.A. Piglowski, Current statusof the upgraded DIII-D real-time digital plasma control system, FusionEng. Des. (2004) 71, pp. 47-52.

[8] R Aymar, P Barabaschi, Y Shimomura, The ITER design, PlasmaPhysics and Controlled Fusion, Vol. 44, 2002, p. 519.

[9] F. Sartori, F. Crisanti, R. Albanese, G. Ambrosino, et al., The JET PCUproject: An international plasma control project, Fusion Engineering andDesign, Volume 83, Issues 2-3, April 2008, pp. 202-206.

[10] A. Neto, et al., MARTe: A Multi-platform Real-time Framework, IEEETransactions on Nuclear Science, Vol. 57, Issue 2, April 2010, pp. 479-486.

[11] F. Sartori, et al., The PCU JET Plasma Vertical Stabilisa-tion Control System, Fusion Engineering and Design (2010),doi:10.1016/j.fusengdes.2010.02.007.

[12] Application for Preferential Support for Enabling a programme of ITERrelevant plasma studies by transferring and installing COMPASS-D tothe Institute of Plasma Physics AS CR, Association EURATOM-IPP.CR,Institute of Plasma Physics AS CR, v.v.i., Prague, Czech Republic, 2006.

[13] D.F. Valcárcel, et al., An ATCA Embedded Data Acquisition and ControlSystem for the Compass tokamak, Fusion Engineering and Design 84(2009) Issues 7-11, pp. 1901-1904.

[14] A.J.N. Batista, J. Sousa, C.A.F. Varandas, ATCA digital controllerhardware for vertical stabilization of plasmas in tokamaks, Rev. of Sci.Instr. 77 (10F527) (2006) 1-3.

[15] D.F. Valcárcel, A.S. Duarte, A. Neto, et al., Real-time Software for theCOMPASS Tokamak Plasma Control, Fusion Engineering and Design(2010), doi:10.1016/j.fusengdes.2010.03.049.

[16] V.S. Mukhovatov, V.D. Shafranov, Plasma equilibrium in a Tokamak,Nuclear Fusion, Vol. 11, December 1971, pp. 605-633.

[17] G. Ambrosino, R. Albanese, Magnetic control of plasma current, po-sition, and shape in Tokamaks: a survey or modeling and Shape inTokamaks, IEEE Control Systems Magazine, October 2005.

[18] E.A. Lazarus, J.B. Lister, G.H. Nielsen, Control of the vertical instabilityin tokamaks, Nuclear Fusion, Vol. 30, No. 1, 1990, pp. 111-141.

[19] R. Beno, Modeling of the plasma position control in the COMPASStokamak, bachelor dissertation, Czech Technical University, Prague,2008.

[20] P. Vyas, Plasma vertical position control on COMPASS-D, PhD disser-tation, Dept. Eng. Sci., Oxford Univ., Oxford, U.K., 1996.

[21] W.H. Press, et al., Numerical Recipes in C: The Art of ScientificComputing, 2nd edition, 1992, Cambridge University Press.

[22] J.R. Ferron, et al., Real Time Equilibrium Reconstruction for TokamakDischarge Control, Nuclear Fusion, Vol. 38, No. 7 (1998), 1055-1066.

[23] D.P. O’Brien, et al., Local expansion method for fast plasma boundaryidentification in JET, Nuclear Fusion, Vol. 33, No. 3 (1993), 467-474.

[24] L. Zabeo, G. Artaserse, A. Cenedese, F. Piccolo, F. Sartori, A newapproach to the solution of the vacuum magnetic problem in fusion ma-chines, Fusion Engineering and Design, Vol. 82, 2007, pp. 1081–1088.

[25] J.B. Lister, F. Hofmann, et al., The Control of Tokamak ConfigurationVariable Plasmas, Fusion Technology 32, 1997, p. 321.