Building up an Experimental Control Software @ BL14B2

16-17, Nov. 2010

1. Beamline Control System at SPring-8○

MADOCA (Message And Database Oriented Control Architecture) Framework
Message Exchange based control system
BL-WS(Linux virtualMachine)

put/mono/10keV

put/theta/205248pulse

ExpWS/PC(MacOS,Windows,Linux, Solaris,..)BL-VME(Solaris9)

ID-VME(Solaris9)

Diffractometer(Experimental Statin)

Insertion device

Message format is S/V/O/C (usually S is automatically appended bythe system).
○Messages to control a monochromator @ BL14B2

Your PC

BL-WS

Monochromator

get/bl_14b2_tc1_stmono_1/angle

bl_14b2_tc1_stmono_1/get/
/7.5degree

put/bl_14b2_tc1_stmono_1/8degre

bl_14b2_tc1_stmono_1/put/
/ok

start motion

bl_14b2_tc1_stmono_1/put/
/theta
stop detection
get/bl_14b2_tc1_stmono_1/query

bl_14b2_tc1_stmono_1/put/
/ok

rotationget/bl_14b2_tc1_stmono_1/query2. Summary of messages for the monochromator and countersVO

C (send)C (return)put

bl_14b2_tc1_stmono_1%fkev

ok / failput

bl_14b2_tc1_stmono_1%fangstrome

ok / failput

bl_14b2_tc1_stmono_1%fdegreeok / failget

bl_14b2_tc1_stmono_1

energy%fkev / failget

bl_14b2_tc1_stmono_1

wavelength%fangstrome / failget

bl_14b2_tc1_stmono_1

angle%fdegree / failget

bl_14b2_tc1_stmono_1

queryok / theta / y1 / alpha1 / alpha2 /running / stoping / failput

bl_14b2_tc1_stmono_1

stop

ok / failput

bl_14b2_tc1_stmono_1

emstopok / failput

bl_14b2_tc1_stmono_1

recoverok / failput

bl_14b2_tc1_stmono_1_netplane 111 / 311 /511

ok / failget

bl_14b2_tc1_stmono_1

netplanesi111 / si311 / si511 / failVO

C (send)C (return)put

bl_14b2_st1_counter_1

clear

ok / failput

bl_14b2_st1_counter_1%dsec

ok / failget

bl_14b2_st1_counter_1

query

inactive_%dcount... / counting_%dcount... / failget

bl_14b2_st1_counter_1

count%dcount_%dcount_%dcount_%dcount / failSingle message command for testing
tellms <command>○Example>tellms get/bl_14b2_tc1_stmono_1/angle
tellms::received message=bl_14b2_tc1_stmono_1/get/5400_tellms_furukawa_vaios90s/12degree>tellms put/bl_14b2_tc1_stmono_1/8.1kev
tellms::received message=bl_14b2_tc1_stmono_1/put/5408_tellms_furukawa_vaios90s/ok>tellms get/bl_14b2_st1_counter_1/counttellms::received
message=bl_14b2_st1_counter_1/get/5414_tellms_furukawa_vaios90s/0count_0count_0count_0cou
nt>tellms put/bl_14b2_st1_counter_1/clear
tellms::received message=bl_14b2_st1_counter_1/put/5426_tellms_furukawa_vaios90s/ok>tellms put/bl_14b2_st1_counter_1/1sec
tellms::received message=bl_14b2_st1_counter_1/put/5434_tellms_furukawa_vaios90s/ok>tellms get/bl_14b2_st1_counter_1/query
tellms::received
message=bl_14b2_st1_counter_1/get/5440_tellms_furukawa_vaios90s/counting_0count_0count_0c
ount_0count>tellms get/bl_14b2_st1_counter_1/query
tellms::received
message=bl_14b2_st1_counter_1/get/5446_tellms_furukawa_vaios90s/inactive_0count_0count_0c
ount_0countTry several commands and consider message sequence to obtain XAFS
sepectra.
NOTE: Please do not change the netplane today.
○More details of control commands (in the SPring-8 site only)
http://madoca/for_staff_and_users/beamline/usr_svoc/

3. Python
◦
◦

◦
◦

◦

Before starting communication with the MS, you need callpy2ms.open(“<app_name>”);
You can send/receive messages using following functions▪ py2ms.send( “<msg to be sent>”)▪ py2ms.recv();
You have to close communication before terminating your program using▪ py2ms.close();Example▪ import py2ms▪ py2ms.open(“test”);▪ py2ms.send( “get/bl_14b2_tc1_stmono_1/energy”);▪ recv = ms_recv();▪ print recv;▪ py2ms.close();You can obtain each part of the message (S/V/O/C) by splitting themessage using string.split() function▪ import string▪ recv = ms_recv();▪ re = string.split(recv, “/”);▪ print “S=%s V=%s O=%s C=%s”%{re[0], re[1], re[2], re[3]};Try to make a XAFS measurement program using python.

4. Command Interpreter(CI)○○○○CI is used to control individual axis of the beamline components likethe monochromator's two theta axis)
The CI refers a configuration file which describes how an abstract
message is interpreted and how to decompose it into primitive messages.
You can describe the sequence to obtain XAFS spectra in theconfiguration file.
Example1: SUBSECTION FUNCTION
2: apply put/count_%dsec_%dtimes
3:
4: function $i [ 0 ]5: while [ $i < target(2) ]6:function bl_14b2_st1_counter_1 [ “clear” ]7:
function bl_14b2_st1_counter_1 [ target(1) ] sec
8:sequence
9:
print [ count_1 ] counts
10:
print [ new_line() ]11:function $i [ $i + 1 ]12: endwhile
13: ENDSUBSECTION

1: Declaration of new abstract message section
2: Abstract message, %d, %f and %s denote a integer number, real numberand string, respectively.
4: Initialization of internal variable. “$” denotes an internalvariable.
6: send “put/bl_14b2_st1_counter_1/clear”
7: send “put/bl_14b2_st1_counter_1/1sec”, time length is described inthe second part of C in the abstract message from client.
8: Wait for counting end
9: Display on screen result. The variable “count_1” is described inother section.
Try to make a XAFS measurement sequence into the configuration file.