source: specdomain/src/round1/test/sphinx_shutter.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: 6.1 KB
Line 
1
2# $Id: sphinx_shutter.mac 907 2012-06-11 22:53:33Z jemian $
3# from Christian Schlepuetz (formatted for RoboDoc)
4
5#==============================================================================
6#%
7# common/shutter
8# ==============
9#
10# NAME
11#   shutter.mac
12#
13# SUMMARY
14#   Commands to control a fast photon shutter.
15#
16# DESCRIPTION
17#   The macro causes the fast photon shutter to be opened immediately prior to
18#   any count command, and closed again upon its completion. A configurable
19#   delay time assures that the shutter is fully open before issuing the
20#   count command.
21#
22#   The photon shutter is controlled via an EPICS binary output channel, and
23#   the shutter status is optionally monitored via a binary input channel (in
24#   which case the delay time is not used, but the monitor signal is used to
25#   check for completion of the opening process).
26#
27# AUTHOR
28#   Christian M. Schlepuetz (CS, cschlep)
29#
30# CREATION DATE
31#   2004/11/06
32#
33# COPYRIGHT
34#   Copyright 2006-2011 by the above authors (see AUTHOR/AUTHORS)
35#
36#   This program is free software: you can redistribute it and/or modify
37#   it under the terms of the GNU General Public License as published by
38#   the Free Software Foundation, either version 3 of the License, or
39#   (at your option) any later version.
40#
41#   This program is distributed in the hope that it will be useful,
42#   but WITHOUT ANY WARRANTY; without even the implied warranty of
43#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44#   GNU General Public License for more details.
45#
46#   You should have received a copy of the GNU General Public License
47#   along with this program.  If not, see http://www.gnu.org/licenses/.
48#
49# VERSION::
50#
51#   $. Date: 2010-11-04 19:06:06 -0400 (Thu, 04 Nov 2010) $
52#   $. Author: cschlep $
53#   $. URL: file:///data/svn/software/spec/trunk/common/shutter.mac $
54#   $. Revision: 17 $
55#
56# DEPENDENCIES
57#   Chained macro definitions affected by this macro:
58#   - user_precount
59#   - user_getcounts
60#   - cleanup_always
61#
62# HISTORY
63#   2004/11/06 (CS):
64#   
65#   - modified the first original version to comply with naming and format
66#     conventions
67#   - implemented help-file support and wrote help texts.
68#     2010/03/30 (CS):
69#   - added the following global variables to make macro more easily portable::
70#
71#           SHUTTER_CONTROL_PV      # EPICS PV name for the shutter control (bo)
72#           SHUTTER_CONTROL_OPEN    # EPICS control value for open shutter
73#           SHUTTER_CONTROL_CLOSED  # EPICS control value for closed shutter
74#           SHUTTER_STATUS_PV       # EPICE PV name for the shutter status (bi)
75#           SHUTTER_STATUS_OPEN     # EPICS status value for open shutter
76#           SHUTTER_STATUS_CLOSED   # EPICS status value for closed shutter
77#           SHUTTER_IS_ON           # flag for automatic shutter control
78#           SHUTTER_SLEEP_TIME      # SPEC sleep time after opening shutter
79#
80#   2010/07/23 (CS):
81#   - added SVN keywords (replacing CVS keywords)
82#
83#   2011/12/19 (CS):
84#   - reformatted code documentation to work with ROBODoc
85#   - added shutter_setup with following internal macros:
86#
87#     * _shutter_print_setup
88#     * _shutter_set_option
89#     * _clear_screen
90#
91#   - replaced SHUTTER_STATUS* with SHUTTER_MONITOR*
92#   - replaced global variables _OPEN with _OPEN_VAL and
93#     _CLOSED with _CLOSED_VAL
94#
95#==============================================================================
96
97#==============================================================================
98# Define some global variables
99# ----------------------------
100
101    global SHUTTER_MAC
102           SHUTTER_MAC = DOFILE
103
104    # EPICS PV of the binary output which controls the shutter
105    #
106    global SHUTTER_CONTROL_PV
107           SHUTTER_CONTROL_PV = "X04SA-ES3-SC:FPS"
108
109    global SHUTTER_CONTROL_OPEN_VAL
110           SHUTTER_CONTROL_OPEN_VAL = "On"
111
112    global SHUTTER_CONTROL_CLOSED_VAL
113           SHUTTER_CONTROL_CLOSED_VAL = "Off"
114
115    # EPICS PV of the binary input which monitors the state of the shutter
116    # if SHUTTER_MONITOR_PV = "", no monitoring is performed
117    #
118    global SHUTTER_MONITOR_PV
119           SHUTTER_MONITOR_PV = ""
120
121    global SHUTTER_MONITOR_OPEN_VAL
122           SHUTTER_MONITOR_OPEN_VAL = "open"
123
124    global SHUTTER_MONITOR_CLOSED_VAL
125           SHUTTER_MONITOR_CLOSED_VAL = "closed"
126
127    global SHUTTER_IS_ON
128           SHUTTER_IS_ON = 0
129
130    global SHUTTER_SLEEP_TIME
131           SHUTTER_SLEEP_TIME = 0.1
132
133
134#==============================================================================
135# This macro file contains the following commands:
136#==============================================================================
137
138#------------------------------------------------------------------------------
139#%
140# shutter/sh_help, shutter_help
141# =============================
142#
143# Displays the shutter help text.
144#
145# usage::
146#
147#   > sh_help
148#
149# .. note::
150#   The help text is generated by simply displaying the text file
151#   shutter_mac.txt, which should reside in the same directory as shutter.mac.
152#   If the file does not exist, a generic help text is shown.
153
154def shutter_help 'sh_help'
155
156def sh_help '{
157#   =======
158
159  unix (sprintf ("dirname %s", SHUTTER_MAC), _1)
160  ll = length (_1)
161  if (substr (_1, ll, 1) == "\n") _1 = substr (_1, 1, (ll - 1))
162  file = sprintf ("%s/shutter_mac.txt", _1)
163  if (file_info (file, "-e")) {
164    unix (sprintf ("cat %s", file))
165  } else {
166    printf("\n  Macros available in file shutter.mac:\n")
167    printf(  "                           ===========\n")
168    printf("\n")
169    printf("  sh_help      - creates this help text\n")
170    printf("  shop         - opens the fast shutter\n")
171    printf("  shcl         - closes the fast shutter\n")
172    printf("  shon         - activate automatic shutter opening and closing\n")
173    printf("  shoff        - turn automatic shutter opening and closing off\n")
174    printf("  sh_status    - display whether the shutter is open or closed\n")
175    printf("  sh_show      - display shutter configuration and status\n")
176    printf("  sh_setup     - modify the shutter configuration\n")
177    printf("\n")
178  }
179}'
180
181# there is more in shutter.mac
182
183#==============================================================================
184# End of $Id: sphinx_shutter.mac 907 2012-06-11 22:53:33Z jemian $
185#==============================================================================
Note: See TracBrowser for help on using the repository browser.