source: specdomain/src/round1/test/testbarrier.mac @ 907

Last change on this file since 907 was 907, checked in by jemian, 11 years ago

necessary?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.5 KB
Line 
1
2# $Id: testbarrier.mac 907 2012-06-11 22:53:33Z jemian $
3# sample file to test sphinx documentation of SPEC macro files
4
5#%
6# This file contains SPEC macro fragments to test various
7# parts of the SPHINX documentation builder.
8
9###############################################################################
10#        User macros to configure spec with the Image Server program
11###############################################################################
12
13def ccdhelp '
14    printf("\nUser macros for the BCDA ccd package\n")
15    printf("\t%c%sccdsetup\n",27,"[1m")
16    # ...
17'
18
19local A2Rp0
20      A2Rp0 = 15.759                    ;#  A2Rp center
21
22
23#==============================================================================
24#%
25# common/shutter
26# ==============
27#
28# NAME
29#   shutter.mac
30#
31# SUMMARY
32#   Commands to control a fast photon shutter.
33#
34# DESCRIPTION
35#   The macro causes the fast photon shutter to be opened immediately prior to
36#   any count command, and closed again upon its completion. A configurable
37#   delay time assures that the shutter is fully open before issuing the
38#   count command.
39#
40#   The photon shutter is controlled via an EPICS binary output channel, and
41#   the shutter status is optionally monitored via a binary input channel (in
42#   which case the delay time is not used, but the monitor signal is used to
43#   check for completion of the opening process).
44#
45# AUTHOR
46#   Christian M. Schlepuetz (CS, cschlep)
47#
48# CREATION DATE
49#   2004/11/06
50#
51# COPYRIGHT
52#   Copyright 2006-2011 by the above authors (see AUTHOR/AUTHORS)
53#
54#   This program is free software: you can redistribute it and/or modify
55#   it under the terms of the GNU General Public License as published by
56#   the Free Software Foundation, either version 3 of the License, or
57#   (at your option) any later version.
58#
59#   This program is distributed in the hope that it will be useful,
60#   but WITHOUT ANY WARRANTY; without even the implied warranty of
61#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
62#   GNU General Public License for more details.
63#
64#   You should have received a copy of the GNU General Public License
65#   along with this program.  If not, see http://www.gnu.org/licenses/.
66#
67# VERSION::
68#
69#   $. Date: 2010-11-04 19:06:06 -0400 (Thu, 04 Nov 2010) $
70#   $. Author: cschlep $
71#   $. URL: file:///data/svn/software/spec/trunk/common/shutter.mac $
72#   $. Revision: 17 $
73#
74# DEPENDENCIES
75#   Chained macro definitions affected by this macro:
76#   - user_precount
77#   - user_getcounts
78#   - cleanup_always
79#
80# HISTORY
81#   2004/11/06 (CS):
82#   
83#   - modified the first original version to comply with naming and format
84#     conventions
85#   - implemented help-file support and wrote help texts.
86#     2010/03/30 (CS):
87#   - added the following global variables to make macro more easily portable::
88#
89#           SHUTTER_CONTROL_PV      # EPICS PV name for the shutter control (bo)
90#           SHUTTER_CONTROL_OPEN    # EPICS control value for open shutter
91#           SHUTTER_CONTROL_CLOSED  # EPICS control value for closed shutter
92#           SHUTTER_STATUS_PV       # EPICE PV name for the shutter status (bi)
93#           SHUTTER_STATUS_OPEN     # EPICS status value for open shutter
94#           SHUTTER_STATUS_CLOSED   # EPICS status value for closed shutter
95#           SHUTTER_IS_ON           # flag for automatic shutter control
96#           SHUTTER_SLEEP_TIME      # SPEC sleep time after opening shutter
97#
98#   2010/07/23 (CS):
99#   - added SVN keywords (replacing CVS keywords)
100#
101#   2011/12/19 (CS):
102#   - reformatted code documentation to work with ROBODoc
103#   - added shutter_setup with following internal macros:
104#
105#     * _shutter_print_setup
106#     * _shutter_set_option
107#     * _clear_screen
108#
109#   - replaced SHUTTER_STATUS* with SHUTTER_MONITOR*
110#   - replaced global variables _OPEN with _OPEN_VAL and
111#     _CLOSED with _CLOSED_VAL
112#
113#==============================================================================
114
115#==============================================================================
116# Define some global variables
117# ----------------------------
118
119    global SHUTTER_MAC
120           SHUTTER_MAC = DOFILE
121
122    # EPICS PV of the binary output which controls the shutter
123    #
124    global SHUTTER_CONTROL_PV
125           SHUTTER_CONTROL_PV = "X04SA-ES3-SC:FPS"
126
127    global SHUTTER_CONTROL_OPEN_VAL
128           SHUTTER_CONTROL_OPEN_VAL = "On"
129
130    global SHUTTER_CONTROL_CLOSED_VAL
131           SHUTTER_CONTROL_CLOSED_VAL = "Off"
132
133    # EPICS PV of the binary input which monitors the state of the shutter
134    # if SHUTTER_MONITOR_PV = "", no monitoring is performed
135    #
136    global SHUTTER_MONITOR_PV
137           SHUTTER_MONITOR_PV = ""
138
139    global SHUTTER_MONITOR_OPEN_VAL
140           SHUTTER_MONITOR_OPEN_VAL = "open"
141
142    global SHUTTER_MONITOR_CLOSED_VAL
143           SHUTTER_MONITOR_CLOSED_VAL = "closed"
144
145    global SHUTTER_IS_ON
146           SHUTTER_IS_ON = 0
147
148    global SHUTTER_SLEEP_TIME
149           SHUTTER_SLEEP_TIME = 0.1
150
151
152#==============================================================================
153# This macro file contains the following commands:
154#==============================================================================
155
156#------------------------------------------------------------------------------
157#%
158# shutter/sh_help, shutter_help
159# =============================
160#
161# Displays the shutter help text.
162#
163# usage::
164#
165#   > sh_help
166#
167# .. note::
168#   The help text is generated by simply displaying the text file
169#   shutter_mac.txt, which should reside in the same directory as shutter.mac.
170#   If the file does not exist, a generic help text is shown.
171
172def shutter_help 'sh_help'
173
174def sh_help '{
175#   =======
176
177  unix (sprintf ("dirname %s", SHUTTER_MAC), _1)
178  ll = length (_1)
179  if (substr (_1, ll, 1) == "\n") _1 = substr (_1, 1, (ll - 1))
180  file = sprintf ("%s/shutter_mac.txt", _1)
181  if (file_info (file, "-e")) {
182    unix (sprintf ("cat %s", file))
183  } else {
184    printf("\n  Macros available in file shutter.mac:\n")
185    printf(  "                           ===========\n")
186    printf("\n")
187    printf("  sh_help      - creates this help text\n")
188    printf("  shop         - opens the fast shutter\n")
189    printf("\n")
190  }
191}'
192
193# there is more in shutter.mac
194
195#==============================================================================
196
197def _ascan ''
198
199kohzuMove_PV = "32ida:KohzuPutBO"
200Und_Delay = 0.1
201
202def kohzuE_cmd(mne,key,p1) '{
203     if (key == "set_position") {
204      return
205     }
206}'
207
208def show_und'
209   printf("\n%40.40s","Current Undulator Status")
210'
211
212  # cleanup macro for ^C usage
213  rdef _cleanup3 \'resetUSAXS\'
214  rdef _cleanup3 \'\'
215     cdef("Fheader", fheader,  "UCOL", 0x20)
216     rdef Flabel \'""\'
217
218#==============================================================================
219
220global kohzu_PV kohzuMV_PV UND_PV Und_Off UNDE_TRACK_ON
221global       kohzuStop_PV kohzuMode_PV      kohzuMove_PV
222global CCD_PREFIX            # EPICS PV for CCD server
223global CCD_OVERHEAD_SECS        # readout time
224global CCD_OVERHEAD_SECS_MEASURED   # measured readout time
225
226    global @A_name[] @B_name[]
227       unglobal @A_name
228       unglobal @B_name
229global CCD_DARK_NUM CCDDARK CCD_THROW
230global MULTI_IMGS # useful 8-ID's imm fileformat; currently not used
231
232constant TWO_PI 6.283
233local _newspaper
234
235#==============================================================================
236
237# TODO: need some good test cases for arrays.
238# But this is not the highest priority.
239
240#[[extern] shared] [type] array var[cols]
241#    Declares a one-dimensional data array.
242#
243#[[extern] shared] [type] array var[rows][cols]
244#    Declares a two-dimensional data array.
245
246
247#==============================================================================
248# End of $Id: testbarrier.mac 907 2012-06-11 22:53:33Z jemian $
249#==============================================================================
Note: See TracBrowser for help on using the repository browser.