Documentation:Tutorial:APIs - MdsWiki
Personal tools

From MdsWiki

Jump to: navigation, search

In the first lesson we have seen how to create and fill a MDSplus tree. It is worth noting that in the real world most data in the tree will be written by data acquisition or elaboration programs. Only configuration data and set-up parameters will be stored in the tree using TCL or jTraverser.

In this lesson, we'll learn:

  1. How to export your MDSplus trees to the world;
  2. How to read/write data into MDSPlus trees using Matlab, IDL, Fortran and C.

IMPORTANT: please note the this section describes the old data access interface of MDSplus. C++, Java and Python programmers are recommended to use the Object Oriented interface of MDSplus described in the next section. MATLAB programmers may decide to use either the interface described in this chapter or to take advantage of the Java Object Oriented interface since MATLAB allows a direct interface to Java objects (more on this in the next section). There are no plans to port the IDL interface to the new one (IDL does not support a true OO interface), while volunteers are expected to start the porting of the new interface to F90.

For most users, accessing MDSplus data represents all the required knowledge for using MDSplus. In fact, except for people working in data acquisition, looking at acquired waveforms and developing or running analysis programs are the operations routinely executed by physicists and engineers.

Exporting MDSplus trees to the world

One of the key features of MDSplus is the ability of exporting the contents of MDSplus trees (and not only) over the network in a transparent way. So, you can see your data on any computer connected to the network in quite the same way you would do if you were working on the computer hosting the tree.

Remote data access is achieved via the mdsip protocol, a TCP/IP based protocol which allows remote expression evaluation. As you already know, in MDSPlus everything is an expression. Therefore, to access data, it suffices to evaluate an expression consisting in the reference to a tree node. You can do more, of course, such as evaluating an arbitrary expression involving more than one tree node.

Being based on TCP/IP, the mdsip protocol uses one port number. The default port for mdsip is 8000, but is can be changed in the case that port is used for some other service.

To export data, you need to start a mdsip server on the computer hosting the MDSPlus tree. If you installed MDSplus on a Windows system, all you need is to press Start->Programs->MDSplus->DataServer->Install mdsip service. At this point the mdsip server is activated as a Windows service, and you can forget about it.

You can activate the mdsip server manually, provided your PATH environment variable includes also the directory containing the program mdsip (for Windows usually Program Files\MDSplus, on Unix usually /usr/local/mdsplus/bin), with the command:

mdsip -p 8000 -m -h mdsip.hosts

where flag -p indicates the port number to which the mdsip server listens to, and flag -h indicates the protection file. The default mdsip.hosts file, provided with the MDSplus distribution allows access to everybody from everywhere. You can define some restrictions in data access by changing the content of the mdsip.hosts file (the default mdsip.hosts file includes a brief description of the required syntax). For example,

    indicates that user jas has access permission from node and the same local permission of local user MDSPLUS
  • *@132.169.8.* | nobody
    indicates that every user from subnet 132.169.8 has access with the same local permission of user nobody.

In general, the name to the left of @ indicates the remote user, the name to the right of @ and to the left of | indicates the IP address of the remote node (wildchars can be used for both), and the name to the right of | indicates the privileges on the server, taken from that of the specified username (this last feature is available only under UNIX).

Note that the remote user name is provided by the connecting client and not verified, so you can not use it for authentication.

To connect to a mdsip server, MDSplus clients need to specify the IP address (and optionally the port) of the mdsip server. We shall see in the rest of this lesson how to access remote or local data through jScope or through a programming language