13
1 EPICS/MDSplus Interface Methods Paul Sichta, NSTX Project in collaboration with Mikyung Park, KSTAR Project Gabriele Manduchi, RFX Project EPICS Collaboration Meeting June 2-4, 2010 Aix-en-Provence, France Culham Sci Ctr U St. Andrews York U Chubu U Fukui U Hiroshima U Hyogo U Kyoto U Kyushu U Kyushu Tokai U NIFS Niigata U U Tokyo JAERI Hebrew U Ioffe Inst RRC Kurchatov Inst TRINITI NFRI KAIST ENEA, Frascati CEA, Cadarache IPP, Jülich IPP, Garching ASCR, Czech Rep U Quebec College W&M Colorado Sch Mines Columbia U Comp-X General Atomics INEL Johns Hopkins U LANL LLNL Lodestar MIT Nova Photonics New York U Old Dominion U ORNL PPPL PSI Princeton U SNL Think Tank, Inc. UC Davis UC Irvine UCLA UCSD U Colorado U Maryland U Rochester U Washington U Wisconsin Supported by Office of Science

EPICS/MDSplus Interface Methods

  • Upload
    nura

  • View
    41

  • Download
    0

Embed Size (px)

DESCRIPTION

Office of Science. Supported by. EPICS/MDSplus Interface Methods. Paul Sichta, NSTX Project in collaboration with Mikyung Park, KSTAR Project Gabriele Manduchi, RFX Project EPICS Collaboration Meeting June 2-4, 2010 Aix-en-Provence, France. College W&M Colorado Sch Mines Columbia U - PowerPoint PPT Presentation

Citation preview

Page 1: EPICS/MDSplus Interface Methods

1

EPICS/MDSplus Interface Methods

Paul Sichta, NSTX Projectin collaboration with

Mikyung Park, KSTAR ProjectGabriele Manduchi, RFX Project

EPICS Collaboration MeetingJune 2-4, 2010

Aix-en-Provence, France

Culham Sci CtrU St. Andrews

York UChubu UFukui U

Hiroshima UHyogo UKyoto U

Kyushu UKyushu Tokai U

NIFSNiigata UU Tokyo

JAERIHebrew U

Ioffe InstRRC Kurchatov Inst

TRINITINFRI

KAISTENEA, Frascati

CEA, CadaracheIPP, Jülich

IPP, GarchingASCR, Czech Rep

U Quebec

College W&MColorado Sch MinesColumbia UComp-XGeneral AtomicsINELJohns Hopkins ULANLLLNLLodestarMITNova PhotonicsNew York UOld Dominion UORNLPPPLPSIPrinceton USNLThink Tank, Inc.UC DavisUC IrvineUCLAUCSDU ColoradoU MarylandU RochesterU WashingtonU Wisconsin

Supported byOffice ofScience

Page 2: EPICS/MDSplus Interface Methods

NSTXNSTX EPICS Spring 2010

Introduction

In the beginning (NSTX 1999),

Engineering used EPICS and Physics used MDSplus Separate organizational units were implementing each framework

Both frameworks were being deployed for the first time at PPPL.

Both were “free” and “open source”.

As machine operations matured the benefits of integration became apparent.

The organizational units were unified

Page 3: EPICS/MDSplus Interface Methods

EPICS/MDSplus Interface Methods at NSTX

Use a client that speaks both EPICS and MDSplus C programs (on Unix) calling both EPICS CA and

MDSplus libraries IDL using EZCA_IDL for EPICS and community-

developed IDL functions for MDSplus Unix shell scripts

Client

New EPICS records were prototyped in 2005, but never matured into production (Mastrovito, 5th IAEA TM on Control, Data Acquisition…)

» Performance was poor

» A low-priority project

Page 4: EPICS/MDSplus Interface Methods

EPICS/MDSplus Interface Methods at KSTAR

From Linux IOC

– IOC "C" code

– Sequencer Program Using dual-client method on Linux

– IDL using EZCA_IDL

– Matlab using MCA

Page 5: EPICS/MDSplus Interface Methods

New EPICS/MDSplus Interface Methods are in Development

NSTX will resume and expand the scope of the 2005 effort;

C-based MDSplus records on a Linux IOC.

Now, collaborate

RFX (Manduchi) has developed EPICS records for MDSplus .... see his presentation.

C++ MDSplus records on a Linux IOC.

Page 6: EPICS/MDSplus Interface Methods

EPICS/MDSplus Interface plans at KSTAR

1) To transfer and store MDSplus data to the tree in run-time during shot for supporting the long pulse (300 seconds) experiments.

– MDSplus segmented records

2) In KSTAR, the machine operational data generated continuously at low rate is archived using EPICS channel archiver and the pulse-based experimental data is archived using MDSplus.

Some users want to see plasma data in conjunction with machine operational data.

Page 7: EPICS/MDSplus Interface Methods

Develop other EPICS/MDSplus interfaces ?

CSS plug-ins for MDSplus to duplicate functions provided by MDSplus-native tools:

– Traverser

– Scope (waveform plots)

– Event & Data I/O (put/get)

– “ArchiveViewer” for Channel Archiver (from MDSplus data pool)

EPICS & MDSplus provide a Python API.

Subroutine record.

– MDSplus runs on vxWorks ... at least partially. MDSplus supports a Java API, RFX has expertise in this area; the

EPICS Java IOC is maturing .... some synergy here?

Page 8: EPICS/MDSplus Interface Methods

Code Snippets

The following code has been modified from its original version. It has been formatted to fit this presentation, to run in

the time allotted and edited for content.

Page 9: EPICS/MDSplus Interface Methods

C-based Client (NSTX)

#include "cadef.h"#include "/usr/local/mdsplus/include/mdslib.h"

.....

SEVCHK(ca_create_channel(capvname[i],NULL,NULL,10, &epicsId[i]),"cm_Mparm: ca_create_channel failure");SEVCHK(ca_get(DBR_LONG,epicsNord[i],(void *)&nord[i]),"cm_Mparm: ca_get failure");SEVCHK(ca_array_get(DBR_LONG,nord[i],epicsId[i],(void *)longArray),"ca_array_get failure");ca_sts=ca_pend_io(PPPL_CATIMO);ca_clear_channel(epicsId[i]);

.....

mdsSocket = MdsConnect(nstxServer);sts=check_mdsOpen(progname,camds_struct[i].MDStree,shotno);dsc = descr(&dataType[i],longArray,&nord[i],&null);sts=MdsPut(camds_struct[i].MDSpath,"$",&dsc,&null);MdsDisconnect();

Header files to include

EPICScode

MDSpluscode

Page 10: EPICS/MDSplus Interface Methods

IDL-based Client (NSTX)

.RUN ezcaIDLCAINIT

name = "ck_ShotNumber"status = caget ( name, shotNo )

MDSCONNECT,'lark1.pppl.gov:8501::' MDSOPEN, mdstree, shotNo, STATUS = sts

sigDataPrefix = mdstree + '::TOP.EPICS.' + subSysNode + '.DIGITIZERS' rawDataPrefix = sigDataPrefix + '.RAWDATA.' + digNodeMDSPUT, rawDataPrefix + ':NUMBER_CHANS', '$', nChansActiveMDSCLOSE , STATUS = sts, /QUIET ; don't quit on error

InitializeEZCA_IDL

EPICScode

MDSpluscode

Page 11: EPICS/MDSplus Interface Methods

MatLab (KSTAR)

1) EPICS interface in Matlab code pvnames={‘XXX_SHOT_NUMBER',‘XXX_STATUS’};

pvs=mcaopen(pvnames);

shotno = mcaget(pvs(1));

status = mcaget(pvs(2));

2) MDSplus interface in Matlab code

>>mdsconnect(‘Server')

>>mdsopen(‘TREE‘,ShotNumber)

>>d=mdsvalue(‘(Node_Path)')

>>plot,d

Page 12: EPICS/MDSplus Interface Methods

Sequencer (KSTAR) (1 of 2)

%% #include <mdslib.h>%% #include <mdsdescrip.h>%% #include <mdsshr.h>

int mdsPutStart;%% int i;%% int j;%% char buf[50];%% char buf1[50];float wfData[8][30000];float timeWf[30000];float trigTime;float nuData[5];%% int noBuf_temp;%% float samRate_temp;string treeSigNode[8];string treeNuNode[5];string errorMsg;

assign wfData to {"ECH:NI:DAQ:AI00","ECH:NI:DAQ:AI04","ECH:NI:DAQ:AI07"};assign treeSigNode to {"ECH_VC","ECH_VB","ECH_IB","ECH_IA","ECH_VFWD2","ECH_VREF2"};assign mdsPutStart to "ECH_DATA_MDS_PUT";%% /* assign mdsIp to "ECH_MDS_IP"; */%% /* assign mdsTree to "ECH_MDS_TREE"; */assign trigTime to "ECH_LTU_T0_p0";

monitor wfData;monitor nuData;monitor treeSigNode

includes

variable declarations and EPICS

record assignements

Page 13: EPICS/MDSplus Interface Methods

Sequencer (KSTAR) (2 of 2)

ss mdsDataPut {state data_put {

when (mdsPutStart==1) {

%% idesc = descr(&dtypeLong, &tstat, &null);%% printf("No Buff : %f and Sam Rate : %f \n",nuData[0], nuData[1]);%% socket = MdsConnect(MDS_SERVER);

status = MdsOpen(ATREE_NAME, &pVar->shotNumber);

/* Data Put loop Start */ %% for(i=0; i<6; i++) { %% sprintf(buf, "\%s", treeNuNode[i]); printf("%s: %d\n", buf, strlen(buf)); %% sprintf(buf1, "FS_FLOAT(%f)", nuData[i] );printf("%s: %f\n", buf1, nuData[i]); %% status = MdsPut(buf, buf1, &null); /* MdsPut !! */

%% if ( !statusOk(status) ) %% fprintf(stderr,"Error Mds Put 1 : %s.\n",MdsGetMsg(status));

%% epicsThreadSleep(.50);%% }

%% status = MdsClose(ATREE_NAME, &pVar->shotNumber);

} state data_put}

MDS connect& tree open

mdsput&

tree close

SNL state statements