To load MDSplus signals, your account will need write-access to the files on VMS used by the MDSplus tree identified in the MDSOPEN call. To get MDSplus signals, your account will need read-access. You also need to be in the Authorized Users file for MDS (if your username is NOT in MDS$ROOT:[SYSMGR]MDSIP.HOSTS on the PPPL VMS Cluster, send email to nstx_sw_dev@pppl.gov ).
On the PPPL VMS cluster:
$ setup mdsplus
On the PPPL Unix/Linux cluster:
% module load nstx/mdsplus
(NOTE that Linux paths at PPPL are different than earlier Solaris
systems -- see the
Beowulf Cluster page for more information.)
Specific examples follow. Additional IDL routines of interest may be found by searching http://nstx.pppl.gov/nstx/Software/Programming/pppl_idl_routines.html in your browser.
To use on VMS or Unix at PPPL: setup nstx
PRO mycode
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA:8501'
shot_num = 100602
MDSOPEN, 'engineering', shot_num, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = '\PC_OH_TOT_CUR'
f = MDSGetSig(signal, stat = ystat, SIGUNITS = fLabel, $
XAXIS = time, XUNITS = timeLabel)
PLOT, time, f/1000., XTITLE = timeLabel, YTITLE = 'milli'+fLabel
ENDELSE
END
You may also wish to use
OpenMDSshot and
MDSGetSig.
; read data from a Private MDSplus tree defined by username$DATA
IF (!VERSION.OS_FAMILY NE 'vms') THEN MDSCONNECT, 'EUROPA'
ID = 10
MDSOPEN, 'username', ID, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'onedim'
data = MDSGETSIG( signal, SIGUNITS=fUnits, XAXIS=time, $
XUNITS=timeUnits)
PLOT, time, data, XTITLE = timeUnits, YTITLE = fUnits, $
TITLE = signal + ' - shot ' + STRTRIM( ID, 2 )
ENDELSE
; read data from a Private MDSplus tree defined by username$DATA
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'username', 10, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'twodim'
f2d = MDSGETSIG( signal, SIGUNITS=fUnits, XAXIS=time, $
XUNITS=timeUnits, YAXIS=rad, YUNITS=radUnits )
CONTOUR, f2d, time, rad, XTITLE=timeUnits, YTITLE=radUnits, $
TITLE=fUnits
ENDELSE
(On VMS, you will have had to do this in DCL:
$ setup mdsplus
$ setup tftr
)
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'tftr', 89725, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = '.waveforms:mb_ip_sl'
f = MDSVALUE( signal )
time = MDSUNITS( signal, /TIME )
flabel = MDSUNITS( signal, /UNITS )
timelabel = MDSUNITS( signal, /TIME, /UNITS )
PLOT, time, f/1000., XTITLE = timelabel, YTITLE = 'milli'+flabel
ENDELSE
(On VMS, you will have had to do this in DCL:
$ setup mdsplus
$ setup tftr
)
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'transp',76778, STATUS=stat ; note ID is not just shot number
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = '\transp::top.pro:cur'
f2d = MDSGETSIG( signal, SIGUNITS=sigUnits, XAXIS=xAxis, $
XUNITS=xUnits, YAXIS=yAxis, YUNITS=yUnits )
CONTOUR, f2d, xAxis, yAxis, XTITLE=xUnits, YTITLE=yUnits, $
TITLE=sigUnits
ENDELSE
; load data into a Private MDSplus tree defined by username$DATA
IF (!VERSION.OS_FAMILY NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'username', 10, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'onedim'
x = FINDGEN(100)
y = sin( x/N_ELEMENTS( x ) * 3 * 2 * !PI )
myXunits = 'X Units'
myYunits = 'Y Units'
MDSLOADSIG, signal, y, SIGUNITS=myYunits, XAXIS=x, $
XUNITS=myXunits, STATUS=stat
ENDELSE
; load data into a Private MDSplus tree defined by username$DATA
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'username', 10, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'twodim'
x = FINDGEN(100)/5.
y = FINDGEN(150)/3.
z = DIST( N_ELEMENTS(x), N_ELEMENTS(y) ) ; this makes a 2-D array
myXunits = 'X units'
myYunits = 'Y units'
myZunits = 'Signal Strength'
MDSLOADSIG, signal, z, SIGUNITS = myZunits, XAXIS = x, $
XUNITS = myXunits, YAXIS = y, YUNITS = myYunits
ENDELSE
To use on VMS or Unix: setup fas
In IDL:
fas_setup ; takes a few seconds the first time called.
!FAS_TREENAME='username' ; not needed if tree is NSTX
fas_read,shot=10,name='onedim' ; can use a list signal names
; Could now do:
; fas_view ; optional to see what channels read in
PLOT, fas_time(1), fas_data(1), XTITLE=y.tinfo.tunits, $
YTITLE=y.dinfo.dunits, TITLE=STRTRIM(y.chan+' - shot '+y.shot, 2)
;-----------------------------------------
y=fas_struct(1) ; some people may want to use this structure
; NOTE that channel indexing is NOT zero based in FAS
; Could now do:
; help,/str,y
; help,/str,y.dinfo
; help,/str,y.tinfo
For an example of accessing MDSplus data from an IDL widget program,
see
http://NSTX.pppl.gov/nstx/Software/IDL/idl_class2.html#MDSW.
Please mail comments to bdavis.