본문 바로가기

카테고리 없음

mdsplus connection

There are two possible configurations for the data client:
1)Distributed Client

In the distributed client configuration most data access operations are carried out at the client site, except for the disk I/O operations which are demanded to the server.
In this configuration no changes are required in the code, being data redirection carried out only by re-defining the environment variable <experiment name>_path.


More precisely, the variable can contain a search list, separated by semicolons (not colons as for Linux search path). Every element of the search list is composed of three elements in the form:

<mdsip server IP address>:<port>::<directory>


python connection example)

>>> from MDSplus import *

>>>my_tree=Tree('kstar',1)

>>>t.getNode('\\MY_NODE_TAG')


2)Thin Client

In the Thin client configuration, almost all operation are carried out at the data server site.

This configuration can be seen as a Remote Expression Evaluation call. The client prepares a TDI expression and then sends it to the server, which actually evaluates it and sends back the evaluation results. Recall that everything in MDSplus is an expression, including the specification of a data item in the pulse file. For write operations, a write expression whose argument is the data to be written is executed by the data server.

Unlike the Distributed Client configuration, the Thin client configuration requires a different Application Programming Interface. Class Connection is the communication broker. Its constructor requires the specification of the IP address of the machine hosting the mdsip server and optionally of its port (separated by a colon). The Connection methods are listed below

  • openTree(tree, shot) which remotely opens the specified tree
  • closeTree(tree, shot) which remotely closes the specified tree
  • closeAllTrees() which closes all open trees
  • setDefault(char *path) which sets the default position in the currently open tree
  • Data get(expression, arguments) which performs remote expression evaluation. The expression is passed as string argument, but may contain optional arguments, which are then passed as an array of Data objects.
  • put(path, expression, arguments) which writes in the specified item (identified by argument path) the passed expression, containing also optional arguments. Arguments are specified in an expression as dollars. For example the following code snippet

python connection example)

>>> from MDSplus import *

>>> conn=Connection('192.168.1.5:8008')

>>> conn.openTree('kstar',1)

>>> result=conn.get("\\MY_NODE_TAG")