#-------------------------------------------------------------------------- # Initialization script for a virtual DMC instrument using a McStas # simulationas a data source # # Dr. Mark Koennecke, June 2005 #--------------------------------------------------------------------------- # O P T I O N S # wwwMode = 1 when running for the WWW-VDMC application set wwwMode 0 if {$wwwMode == 1} { set home /home/lnswww/vinstrument/mcstas/dmc set datahome /home/lnswww/www/vinstrument } else { set home $env(HOME)/psi/workspace/sics/mcstas/dmc } #--------------------------------- first all the server options are set #ServerOption RedirectFile $home/stdcdmc ServerOption ReadTimeOut 10 ServerOption AcceptTimeOut 10 ServerOption ReadUserPasswdTimeout 500000 ServerOption LogFileBaseName "$home/vdmclog" ServerOption LogFileDir $home/ ServerOption ServerPort 2911 ServerOption statusfile $home/vdmcstatus.tcl ServerOption InterruptPort 3007 ServerOption TelnetPort 1301 ServerOption TelWord sicslogin #--------------------------------------------------------------------------- # U S E R S SicsUser lnsmanager lnsSICSlns 1 SicsUser Manager Manager 1 SicsUser user looser 2 SicsUser Spy 007 1 #-------------------------------------------------------------------------- # D E V I C E S : M O T O R S #--------------------------------------------------------------------------- ClientPut "Installing Motors" Motor OmegaM SIM 0 120 -.1 2. Motor TwoThetaM SIM 30 100 -.1 1. Motor MonoX SIM -30 30 -.1 3.0 Motor MonoY SIM -30 30 -.1 3.0 Motor CurveM SIM 0 20 -.1 3.0 Motor MonoPhi SIM -30 30 -.1 3.0 Motor MonoChi SIM -30 30 -.1 3.0 # sample Table Motor Table SIM -180 360 -.1 2. Motor TwoThetaD SIM -10 120 -.1 1. #------------------------------------------------------------- # Monochromator #------------------------------------------------------------- MakeMono Mono "PG-002" OmegaM TwoThetaM CurveM Mono DD 3.3537 Mono vk1 -0.025942 Mono vk2 5.351660 # Syntax MakeWaveLength name MonochromatorToUse MakeWaveLength lambda Mono #-------------------------------------------------------------------------- # Configure Detector # NOTE: the McStas objects have to be created first, otherwise # the initialisation will fail. #-------------------------------------------------------------------------- MakeMcStasReader MakeMcStasController allowexec $home/dmcafter allowexec $home/dmc_sics05 ClientPut "Installing counter" MakeCounter counter mcstas counter SetExponent 1 MakeHM banana mcstas banana configure HistMode Normal banana configure OverFlowMode Ceil banana configure Rank 1 banana configure dim0 400 banana configure BinWidth 4 banana preset 100. banana CountMode Timer banana configure Counter counter banana configure init 0 banana init banana exponent 3 #------------------------------------------------------------------------- # Aliases #------------------------------------------------------------------------- SicsAlias OmegaM A1 SicsAlias TwoThetaM A2 SicsAlias Table A3 SicsAlias TwoThetaD A4 SicsAlias MonoX A5 SicsAlias MonoY A6 SicsAlias MonoPhi A7 SicsAlias MonoChi A8 SicsAlias CurveM A9 DefineAlias TT temperature #-------------------------------------------------------------------------- # V A R I A B L E S # now a few general variables are created # Syntax: VarMake name type access # type can be one of: Text, Int, Float #access can be one of: Internal, Mugger, User, Spy #----------------------------------------------------------------------------- VarMake SicsDataPath Text Internal SicsDataPath "$home/" SicsDataPath lock VarMake DetStepWidth Float Internal DetStepWidth 0.2 DetStepWidth lock VarMake Instrument Text Internal Instrument "Virtual DMC driven by McStas" Instrument lock VarMake Title Text User VarMake User Text User VarMake Collimation Text User VarMake SampleIntern Text User SampleIntern Kellerit VarMake comment1 Text User VarMake comment2 Text User VarMake comment3 Text User VarMake starttime Text User starttime "" VarMake SicsDataPrefix Text Internal SicsDataPrefix vdmc #--------- make data number MakeDataNumber SicsDataNumber $home/DataNumber VarMake SicsDataPostFix Text Internal SicsDataPostFix ".xml" VarMake Adress Text User VarMake phone Text User VarMake fax Text User VarMake email Text User VarMake sample_mur Float User VarMake lastdatafile Text User #-------------------------------------------------------------------------- # P R O C E D U R E S #-------------------------------------------------------------------------- MakeDrive MakeBatchManager MakeNXScript MakeRuenBuffer #-------------------- initialize scripted commands source $home/vdmccom.tcl #-------------------- configure commandlog commandlog auto commandlog intervall 5 #----------- enable sycamore #InstallSinfox #source sycFormat.tcl #source /usr/lib/tcllib1.6.1/stooop/stooop.tcl #namespace import stooop::* #source sinfo.tcl #source sycamore.tcl #Publish sinfo Spy #==================== install Hipadaba proc hdbReadOnly {} { error "Parameter is READ ONLY" } #------------------------------------ proc maketwotheta {} { set txt [TwoThetaD] set l [split $txt =] set start [string trim [lindex $l 1]] for {set i 0} {$i < 400} {incr i } { append result [expr $start + $i * .2] " " } return $result } #------------------------------------- InstallProtocolHandler InstallHdb MakeStateMon hmake /dmc spy none hsetprop /dmc type instrument #-------- experiment hmake /dmc/experiment spy none hattach /dmc/experiment title title hattach /dmc/experiment user user hattach /dmc/experiment starttime starttime hattach /dmc/experiment user user hattach /dmc/experiment/user adress address hattach /dmc/experiment/user phone phone hattach /dmc/experiment/user email email hattach /dmc/experiment comment1 comment1 hattach /dmc/experiment comment2 comment2 hattach /dmc/experiment comment3 comment3 #------- SINQ hmake /dmc/sinq spy none hmakescript /dmc/sinq/proton_monitor "counter getmonitor 4" hdbReadOnly int sicspoll /dmc/sinq/proton_monitor hdb 10 #-------- monochromator hmake /dmc/monochromator spy none hattach /dmc/monochromator lambda wavelength hattach /dmc/monochromator OmegaM theta hattach /dmc/monochromator TwoThetaM two_theta hattach /dmc/monochromator MonoX x_translation hattach /dmc/monochromator MonoY y_translation hattach /dmc/monochromator MonoChi chi hattach /dmc/monochromator MonoPhi phi hattach /dmc/monochromator CurveM vertical_focusing hmakescript /dmc/monochromator/d_value "mono dd" "mono dd" float hsetprop /dmc/monochromator/d_value priv manager hmakescript /dmc/monochromator/scattering_sense "mono ss" "mono ss" int hsetprop /dmc/monochromator/scattering_sense priv manager #----------- sample hmake /dmc/sample spy none hmakescript /dmc/sample/name sample sample Text hattach /dmc/sample Table rotation hmakescript /dmc/sample/monitor "counter getmonitor 1" hdbReadOnly int hsetprop /dmc/sample/monitor priv internal #---------- detector hmake /dmc/detector spy none hattach /dmc/detector TwoThetaD two_theta hmakescript /dmc/detector/preset "counter getpreset" hdbReadOnly float hsetprop /dmc/detector/preset priv internal hmakescript /dmc/detector/countmode "counter getmode" hdbReadOnly text hsetprop /dmc/detector/countmode priv internal sicspoll add /dmc/detector/preset hdb 30 sicspoll add /dmc/detector/countmode hdb 30 #------------ commands hmake /commands spy none hcommand /commands/count count hsetprop /commands/count type command hmake /commands/count/mode user text hmake /commands/count/preset user float hset /commands/count/preset 5 hset /commands/count/mode timer #---------------- graphics hmake /Graphics spy none hmake /Graphics/powder_diagram spy none hsetprop /Graphics/powder_diagram type graphdata hsetprop /Graphics/powder_diagram viewer default hmake /Graphics/powder_diagram/rank internal int hset /Graphics/powder_diagram/rank 1 hmake /Graphics/powder_diagram/dim internal intar 1 hset /Graphics/powder_diagram/dim 400 hmakescript /Graphics/powder_diagram/two_theta maketwotheta hdbReadOnly floatar 400 sicspoll add /Graphics/powder_diagram/two_theta hdb 30 hsetprop /Graphics/powder_diagram/two_theta type axis hsetprop /Graphics/powder_diagram/two_theta dim 0 hattach /Graphics/powder_diagram banana counts hsetprop /Graphics/powder_diagram/counts type data hsetprop /Graphics/powder_diagram/counts priv internal sicspoll add /Graphics/powder_diagram/counts hdb 60