PSI update

r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-02-12 12:20:21 +11:00
committed by Douglas Clowes
parent 634f2023b1
commit 3168325921
157 changed files with 29053 additions and 910 deletions

36
mcstas/dmc/README Normal file
View File

@ -0,0 +1,36 @@
VIRTUAL DMC
This is the SICS-McStas virtual instrument DMC modelled after the real
powder diffcractometer DMC at SINQ:
http://sinq.web.psi.ch/sinq/instr/dmc/dmc.html
The McStas simulation used for this system has been verified against
the real instrument. The basic usage is to start the SICServer with:
./SICServer vdmc.tcl
in this directory. Then you can connect to SICS at localhost/2911
with any SICS client and start issuing commands.
In order to save simulation time, the simulation works with
neutron data files presimulated for four wavelength up to the sample.
This is why you get your wavelength coerced to the nearest
precalculated value.
If you desire to "measure" your own sample on virtual DMC, you first
have to create a LazyPulverix output file. You then can proceed to
load the sample into SICS with the SICS command:
sample load path-to-lazy-pulverix-outputfile
The command:
sample list
tells you which samples virtual DMC already knows about.
Questions and comments to: Mark.Koennecke@psi.ch

8454
mcstas/dmc/dmcafter.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@
# This is the scripted version using nxscript
#
# Mark Koennecke, May 2004
# This is a special version for virtual DMC on lns00
#---------------------------------------------------------------------------
proc storeMonochromator {} {
@ -75,14 +76,34 @@ proc makeLinks {} {
nxscript makelink dana dtnstep
nxscript makelink dana mlambda
}
#------------------------------------------------------------------------
proc makeSimFileName args {
global datahome
sicsdatanumber incr
set num [SplitReply [sicsdatanumber]]
return [makeSimForNum $num]
}
#------------------------------------------------------------------------
proc makeSimForNum {num} {
global datahome
set pre [string trim [SplitReply [sicsdataprefix]]]
set po [string trim [SplitReply [sicsdatapostfix]]]
return [format "%s/%s2006n%6.6d%s" $datahome $pre $num $po]
}
#-------------------------------------------------------------------------
# store DMC data
#-------------------------------------------------------------------------
proc storedata {} {
global home
set fil [newFileName]
global home wwwMode
if {$wwwMode == 1} {
set fil [makeSimFileName]
} else {
set fil [newFileName]
}
lastdatafile $fil
clientput "Opening $fil for writing"
nxscript create4 $fil $home/dmc.dic
nxscript createxml $fil $home/dmc.dic
writeStandardAttributes $fil
writeTextVar etitle title

View File

@ -1,13 +1,19 @@
# --------------------------------------------------------------------------
#--------------------------------------------------------------------------
# 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
set home $env(HOME)/src/workspace/sics/mcstas/dmc
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
@ -120,18 +126,20 @@ SicsDataPrefix vdmc
#--------- make data number
MakeDataNumber SicsDataNumber $home/DataNumber
VarMake SicsDataPostFix Text Internal
SicsDataPostFix ".hdf"
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
@ -139,7 +147,6 @@ commandlog auto
commandlog intervall 5
#----------- enable sycamore
#InstallProtocolHandler
#InstallSinfox
#source sycFormat.tcl
#source /usr/lib/tcllib1.6.1/stooop/stooop.tcl
@ -147,3 +154,95 @@ commandlog intervall 5
#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

View File

@ -15,7 +15,9 @@ if { [info exists vdmcinit] == 0 } {
Publish copydmcdata User
Publish sample User
Publish wwwsics Spy
Publish wwwfilefornumber Spy
mcinstall
Publish gethm Spy
}
source $home/log.tcl
source $home/nxsupport.tcl
@ -38,12 +40,19 @@ proc washlazy {name} {
if { [string first "H K L THETA 2THETA D VALUE" $line] > 0} {
break
}
#-------- A second version to treat the messed up lazy pulverix files
# uploaded through the WWW-interface
if { [string first "H K L THETA" $line] >= 0} {
break
}
}
#------- process data lines
puts $out "// mult Q(hkl) F2 DW w"
clientput "HKL found at: $line"
while { [gets $in line] >= 0} {
set num [scan $line "%d %d %d %f %f %f %f %f %d %d %d %f %f %f %f %f %d"\
h k l th th2 d di sin h2 k2 l2 I F A B ang mul]
clientput "Line = $num, $line"
if { $num == 17} {
set q [expr (2.*3.14159265358979323846)/$d]
set f2 [expr $F * $F]
@ -155,6 +164,7 @@ proc rundmcoptsim {mode preset } {
} else {
return $msg
}
wait 5
}
#------------------------------------------------------------------------
proc copydmcdataold { } {
@ -363,7 +373,7 @@ proc wwwpar {type mot} {
}
#------------- wwwuser formats user information into a html table
proc wwwuser {} {
lappend list title sample user email phone adress
lappend list title user email phone adress
append txt "<table>"
foreach e $list {
set ret [catch {$e} msg]
@ -376,6 +386,14 @@ proc wwwuser {} {
}
return $txt
}
#------------- wwwfilefornumber returns the path to a data file for a
# number
proc wwwfilefornumber {num} {
return [makeSimForNum $num]
}
#-------------------------------------------------------------------
proc gethm {} {
banana uuget 0
}