My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
rtcnetcoms.h
1 #ifndef rtcnetcoms_h
2 #define rtcnetcoms_h
3 
4 /*
5  * This file defines the network interfaces between the host control-program
6  * and the real-time controller task, and between control-clients and
7  * the control program.
8  */
9 #include "netbuf.h"
10 #include "netobj.h"
11 #include "genericregs.h"
12 #include "const.h"
13 
14 #include "gcp/control/code/unix/libscan_src/scan.h"
15 
16 #include "gcp/util/common/Ports.h"
17 
18 namespace gcp {
19  namespace control {
20 
21 #define GENERIC_NETMSG_IDS \
22  NET_LOG_MSG, /* A message to be logged */ \
23  NET_DRIVE_DONE_MSG, /* A drive transaction-completion message */ \
24  NET_BENCH_DONE_MSG, /* A drive transaction-completion message */ \
25  NET_SCAN_DONE_MSG, /* A scan transaction-completion message */ \
26  NET_SOURCE_SET_MSG, /* A warning message that the source has set */ \
27  NET_SETREG_DONE_MSG, /* A setreg transaction completion message */ \
28  NET_TV_OFFSET_DONE_MSG,/* A tv_offset transaction completion message */ \
29  NET_ID_MSG, /* A message from an antenna to identify itself */ \
30  NET_FRAME_DONE_MSG, /* A frame transaction-completion message */\
31  NET_GREETING_MSG, /* A handshake message */ \
32  NET_NAV_UPDATE_MSG, /* A request from the controller for a */ \
33  /* re-initialization of ephemeris */ \
34  /* positions from the navigator thread */
35 
36 #define SPECIFIC_NETMSG_IDS \
37  NET_CALTERT_DONE_MSG, /* A caltert transaction-completion message */ \
38  NET_IFMOD_DONE_MSG, /* An antenna IF transaction-completion message */ \
39  NET_CAN_DONE_MSG, /* A CAN transaction-completion message */ \
40  NET_NOISE_DONE_MSG, /* A noise source completion message */ \
41  NET_SCRIPT_DONE_MSG, /* A script completion message */ \
42 
43  /*-----------------------------------------------------------------------
44  * Define the ids of control-program to controller messages along with
45  * the corresponding message containers.
46  */
47  typedef enum {
48  GENERIC_NETMSG_IDS
49  SPECIFIC_NETMSG_IDS
50  } NetMsgId;
51 
55  typedef struct {
56  NetUint revision;
57  NetUint nReg;
58  NetUint nByte;
60 
61  /*
62  * The following object is used to forward log messages from the real-time
63  * control system to the control program. Note that cnt_send_log_message()
64  * in controller.c relies on the text[] member of NetLogMsg being the
65  * last member (in order not to have to copy all NET_LOG_MAX+1 bytes of
66  * text[] if the string in text[] is shorter).
67  */
68  enum {NET_LOG_MAX=127};
69  typedef struct {
70  unsigned seq; // A unique sequence number associated
71  // with this message
72  short bad; // True if the text describes an error
73  // condition
74  char text[NET_LOG_MAX+1]; // The text of the log message
75 
76  bool end;
77  } NetLogMsg;
78 
79  /*
80  * The following object is used by the Scanner task to report
81  * the completion of noise source transactions.
82  */
83  typedef struct {
84  NetUint seq; /* The sequence number of the transaction that completed */
86 
87  /*
88  * The following object is used by the receiver-control task to report
89  * the completion of a setreg transactions.
90  */
91  typedef struct {
92  NetUint seq; /* The sequence number of the transaction that completed */
94 
99  typedef struct {
100  NetUint seq; // The sequence number of the transaction that
101  // completed
103 
104  /*
105  * The following object is used by the scanner task to report
106  * the completion of a tv_offset transaction.
107  */
108  typedef struct {
109  NetUint seq; /* The sequence number of the transaction that completed */
111 
112  /*
113  * The following object is used by the tracker task to report
114  * target acquisition.
115  */
116  typedef struct {
117  NetUint seq; /* The sequence number of the transaction
118  that completed */
120 
121  /*
122  * The following object is used by the tracker task to report
123  * target acquisition.
124  */
125  typedef struct {
126  NetUint seq; /* The sequence number of the transaction
127  that completed */
128  } NetFrameDoneMsg;
129 
130  /*
131  * The following object is used by the tracker task to report
132  * target acquisition.
133  */
134  typedef struct {
135  NetUint seq; // The sequence number of the transaction
136  // that completed
137  } NetCanDoneMsg;
138 
139  /*
140  * The following object is used by the rx task to report
141  * target IF switch acquisition.
142  */
143  typedef struct {
144  NetUint seq; /* The sequence number of the transaction
145  that completed */
146  } NetIFModDoneMsg;
147 
148  /*
149  * The following object is used by the tracker task to report
150  * target acquisition.
151  */
152  typedef struct {
153  NetUint seq; /* The sequence number of the transaction
154  that completed */
155  } NetDriveDoneMsg;
156 
157  /*
158  * The following object is used by the tracker task to report
159  * bench position acquisition.
160  */
161  typedef struct {
162  NetUint seq; /* The sequence number of the transaction
163  that completed */
164  } NetBenchDoneMsg;
165 
166  /*
167  * The following object is used by the tracker task to report
168  * target acquisition.
169  */
170  typedef struct {
171  NetUint seq; /* The sequence number of the transaction
172  that completed */
173  } NetScanDoneMsg;
174 
175  /*
176  * The following object is used by the tracker task to report
177  * if the telescope can't reach the current source due to it being
178  * too low in the sky.
179  */
180  typedef struct {
181  NetUint seq; /* The sequence number of the transaction that resulted */
182  /* in the telescope needing to point too low. */
183  } NetSourceSetMsg;
184 
185 #define GENERIC_NETMSG_MEMBERS \
186  NetGreetingMsg greeting; /* A greeting message */ \
187  NetLogMsg log; /* A message to be logged */ \
188  NetNoiseDoneMsg noise_done; /* A noise source completion message */ \
189  NetDriveDoneMsg drive_done; /* A tracker transaction-completion message */ \
190  NetBenchDoneMsg bench_done; /* A tracker transaction-completion message */ \
191  NetScanDoneMsg scan_done; /* A tracker transaction-completion message */ \
192  NetSourceSetMsg source_set; /* A source-has-set advisory message */\
193  NetSetregDoneMsg setreg_done; /* A setreg transaction completion message */\
194  NetTvOffsetDoneMsg tv_offset_done;/* A tv_offset transaction*/ \
195  /* completion message*/ \
196 
197 
198 #define SPECIFIC_NETMSG_MEMBERS \
199  NetCalTertDoneMsg calTertDone; /* A caltert transaction*/ \
200  /* completion message*/ \
201  NetIFModDoneMsg IFModDone; /* An antenna IF transaction*/ \
202  /* completion message*/ \
203  NetCanDoneMsg canDone; /* A CAN completion message*/ \
204  NetFrameDoneMsg frameDone; /* A FRAME completion message*/ \
205  NetNoiseDoneMsg noiseDone; /* A noise source completion message*/ \
206  NetScriptDoneMsg scriptDone; /* A script completion message*/ \
207 
208  /*
209  * Create a union of the above message containers.
210  */
211  typedef union {
212  GENERIC_NETMSG_MEMBERS
213  SPECIFIC_NETMSG_MEMBERS
214  } NetMsg;
215 
216  struct RtcNetMsg {
217  NetUint antenna;
218  NetMsg msg;
219  unsigned size();
220  };
221  }
222 }
223 /*
224  * The following object description table, defined in rtcnetcoms.c,
225  * describes the messages that are sent from the real-time controller
226  * to the control program.
227  */
228 extern const NetObjTable rtc_msg_table;
229 
230 namespace gcp {
231  namespace control {
232  /*-----------------------------------------------------------------------
233  * Define the ids of controller to control-program commands along with
234  * the corresponding message containers.
235  */
236  typedef enum {
237  NET_SHUTDOWN_CMD, // A request to shutdown the control system
238  NET_INTERVAL_CMD, // A request to change the hardware integration time
239  NET_INHIBIT_CMD, // Inhibit or resume integration readout
240  NET_STROBE_CMD, // A request to take a register snapshot
241  NET_SETREG_CMD, // Change the value of a given register
242  NET_GETREG_CMD, // Change the value of a given register
243  NET_SETDIO_CMD, // Modify the output register of a digital I/O board
244  NET_UNFLAG_CMD, // Resume monitoring of a previously unreachable board
245  NET_PHASE_MOTOR_CMD, // Switch on or off a given set of phase shift motors
246  NET_PHASE_SHIFT_CMD, // Set the positions of a given set of phase shifters
247  NET_SELECT_RX_CMD, // Select a receiver type as the target of
248  // the next command
249  NET_SET_BIAS_CMD, // Set a receiver bias
250  NET_RX_HEATER_CMD, // Switch on or off a given set of heaters
251  NET_RX_COLDHEAD_CMD, // Switch on or off a given set of coldheads
252  NET_RX_TEMP_CMD, // Set the temperatures of a given set of heaters
253  NET_LO_CMD, // A command to configure the LO chain
254  NET_RX_QUAD_CMD, // Set the state of the phase quadrature network
255  NET_RX_POLAR_CMD, // Define a polarization state-encoder
256  // association for a receiver
257  NET_POLWALSH_CMD, // Define a polarization state-encoder
258  // association for a receiver
259  NET_SITE_CMD, // Specify the location of the SZA
260  NET_LOCATION_CMD, // Specify the location of an antenna
261  NET_DELAYREF_CMD, // Specify the location of the delay reference
262  NET_INIT_CMD, // Mandatory controller initialization command
263  NET_HALT_CMD, // Halt the telescope drives
264  NET_STOP_CMD, // Put the telescope in STOP mode
265  NET_SLEW_CMD, // Slew to a given az,el,dk
266  NET_TRACK_CMD, // Append to the track of the current source
267  NET_MOUNT_OFFSET_CMD,// Adjust the az,el,dk tracking offsets
268  NET_EQUAT_OFFSET_CMD,// Adjust the equatorial ra and dec tracking offsets
269  NET_TV_OFFSET_CMD, // Adjust the tracking offsets to move a
270  // star by a on the tv monitor of the
271  // optical telescope.
272  NET_TV_ANGLE_CMD, // The deck angle at which the vertical
273  // direction on the tv monitor of the
274  // optical telescope matches the direction
275  // of increasing topocentric elevation.
276  NET_SKY_OFFSET_CMD, // Tell the tracker to continually adjust
277  // the tracking offsets to maintain the
278  // telescope pointed at a given fixed sky
279  // offset from the normal pointing center.
280  NET_UT1UTC_CMD, // Append to the UT1-UTC interpolation table
281  NET_EQNEQX_CMD, // Append to the equation-of-the-equinoxes
282  // interpolation table
283  NET_ENCODER_CALS_CMD, // Tell the tracker task the current encoder scales
284  NET_ENCODER_LIMITS_CMD,// Tell the tracker task the current encoder limits
285  NET_ENCODER_ZEROS_CMD, // Set the zero points of the telescope encoders
286  NET_SLEW_RATE_CMD, // Set the slew rate of each telescope axis
287  NET_TILTS_CMD, // Calibrate the axis tilts of the telescope
288  NET_FLEXURE_CMD, // Calibrate the axis flexure of the telescope
289  NET_COLLIMATE_CMD, // Calibrate the collimation of the telescope
290  NET_MODEL_CMD, // Select the optical or radio pointing model
291  NET_YEAR_CMD, // Tell the control system what the current year is
292  NET_DECK_MODE_CMD, // Tell the tracker how to position the deck
293  // axis while tracking sources.
294  NET_ATMOS_CMD, // Supply atmospheric conditions to weather task
295  NET_FEATURE_CMD, // Change the set of feature markers to be
296  // recorded in one or more subsequent
297  // archive frames.
298  NET_GPIB_SEND_CMD, // Send a message to a given GPIB device
299  NET_GPIB_READ_CMD, // Read a message from a given GPIB device
300  NET_POWER_CMD, // Turn the power on/off to an antennas power strip
301  NET_POWER_DT_CMD, // Set the interval of noise-cal power-meter readings
302  NET_POWER_METER_CMD,// Send a command to the power meter
303  NET_NOISE_CAL_CMD, // Connect or disconnect the noise-calibration source
304  NET_CHZR_POWER_CMD, // Initiate a command to search for the
305  // attenuations that result in outputs from
306  // specified total-power detectors that are
307  // close to a given power level.
308  NET_CHZR_ZERO_CMD, // Initiate a command to measure the
309  // zero-offset of one or more total-power
310  // detectors
311  NET_CHZR_ATTN_CMD, // Set the attenuations of one or more IF channels
312  NET_CHZR_SWITCH_CMD,// Turn one or more IF amplifiers on or off
313  NET_CHZR_ENABLE_CMD,// Temporarily disable, or reenable the channelizer
314  NET_RXSIM_CMD, // Configure the receiver simulation box
315  NET_THERMO_CMD, // Send a command to the DS1820 digital thermometers
316  NET_DS_DT_CMD, // Set the interval for DS1820 temperature readouts.
317  NET_CAMERA_CMD, // Forward a command to the optical camera controller.
318  NET_OPTCAM_CNTL_CMD,// Turn the optical camera/stepper motor on/off
319  NET_PTEL_SHUTTER_CMD, // Open and close pointing telescope shutter
320  NET_PTEL_HEATER_CMD, // Turn pointing telescope heater on, overriding thermostat
321  NET_DEICING_HEATER_CMD, // Turn deicing heater on or off
322  NET_CABIN_SHUTTER_CMD, // Open and close cabin shutter
323  NET_BENCH_ZERO_POSITION_CMD, // Set optical bench zero position
324  NET_BENCH_OFFSET_CMD, // Set optical bench offset
325  NET_BENCH_USE_BRAKES_CMD, // Set optical bench use brakes
326  NET_BENCH_SET_ACQUIRED_THRESHOLD_CMD, // Set optical bench acquired threshold
327  NET_BENCH_SET_FOCUS_CMD, // Set optical bench focus
328  NET_STEPPER_CMD, // Step the stepper motor
329  NET_GRABBER_CMD, // Step the stepper motor
330  NET_FLATFIELD_CMD, // Toggle flat fielding of frame grabber frames
331  NET_FG_CMD, // Write to a register on the frame grabber board
332  NET_CONFIGURE_FG_CMD, // Configure the frame grabber
333  NET_TPCAL_CMD, // Install total power calibration factors
334  NET_WALSH_CMD, // Toggle slow walshing on or off
335  NET_PAGER_CMD, // Turn the pager on or off
336  NET_REBOOT_DRIVE_CMD,// Reboot the antenna drive controller
337 
338  // Downconverter control commands
339 
340  NET_PSYS_CMD, // Set the DC power
341  NET_PSYS_ATTEN_CMD, // Set the Psys attenuation
342  NET_IFOUT_CMD, // Set the IF output power
343  NET_IFOUT_ATTEN_CMD, // Set the IF output attenuation
344  NET_RF_AMP_CMD, // Enable the RF amp
345  NET_IF_ALC_CMD, // Enable the IF automatic level control
346 
347  // Noise Source control commands
348 
349  NET_NOISE_POWER_CMD, // Set the noise source power.
350  NET_NOISE_ATTEN_CMD, // Set the noise source attenuation.
351  NET_TONE_ATTEN_CMD, // Set the tone attenuation.
352  NET_NOISE_CMD, // Turn the noise source on/off
353  NET_TONE_CMD, // Turn the tone on/off
354 
355  // Quadrature Modulator control commands
356 
357  NET_QUAD_POWER_CMD, // Set the noise source power.
358  NET_QUAD_ATTEN_CMD, // Set the noise source attenuation.
359  NET_QUAD_WALSH_COLUMN_CMD, // Set the tone attenuation.
360  NET_QUAD_CMD, // Turn the noise source on/off.
361  NET_QUAD_WALSH_TABLE_CMD, // Set the tone attenuation.
362  NET_QUAD_PHASE_CMD, // Set the phase state of the QuadMod.
363 
364  // CAN module reset command
365 
366  NET_RESET_CMD, // Reset a module.
367 
368  // Receiver CAN commands
369 
370  NET_FAST_SAMPLING_CMD, // Set fast sampling
371 
372  // Delay commands
373 
374  NET_SET_ANTENNA_COORDS_CMD,// Set antenna coordinates
375 
376  // Lobe Rotator commands
377 
378  NET_DDS_CMD, // Command the output state of the
379  // DDS channels of the lobe rotator
380  NET_SET_ANTENNA_DDS_CMD, // Associate a DDS channel with an
381  // antenna
382 
383  NET_SET_LR_PHASE_CMD, // Set the phase on a LR DDS or input channel
384  NET_SET_LR_FREQ_CMD, // Set the frequency on a LR of input channel
385  NET_ENABLE_DDS_WALSHING_CMD,// Set the walshing state on a DDS channel
386  NET_SET_DDS_WALSH_COLUMN_CMD,// Set the walsh state on a DDS channel
387  NET_SET_OUTPUT_REGS_CMD, // Set the delay on a LR input channel
388  NET_SET_LR_DELAY_CMD, // Set the delay on a LR input channel
389  NET_SET_ANTENNA_PHASE_CMD, // Set the phase on an antenna channel
390  NET_SET_ANTENNA_FREQ_CMD, // Set the frequency on an antenna channel
391  NET_SET_ANTENNA_PARAMS_CMD,// Set antenna parameters
392  NET_SET_DELAY_CMD, // Set a delay
393  NET_REF_ANT_CMD, // Select a reference antenna
394  NET_SET_WEATHER_PARAMS_CMD,// Set weather parameters
395  NET_USE_DELAY_CMD, // Use a delay
396  NET_SCAN_CMD, // Scan
397 
398  // CalTert command
399 
400  NET_CALTERT_CMD,
401 
402  // Antenna IF command
403 
404  NET_IFMOD_CMD,
405 
406  // IntMod command
407 
408  NET_INTMOD_CMD,
409 
410  // Flip delay signs?
411 
412  NET_FLIP_DELAY_CMD,
413 
414  // Toggle fringe tracking on/off
415 
416  NET_FRINGE_TRACKING_CMD,
417 
418  // A command for the Thermal module
419 
420  NET_THERMAL_CMD,
421 
422  // A command to configure the DIO filter
423 
424  NET_SETFILTER_CMD,
425 
426  // A command to run a script
427 
428  NET_RUN_SCRIPT_CMD,
429 
430  // A directory command
431 
432  NET_SCRIPT_DIR_CMD,
433 
434  NET_GPIB_CMD,
435 
436  NET_SERVO_CMD,
437 
438  NET_RX_CMD,
439 
440  NET_ROACH_CMD,
441 
442  NET_LNA_CMD
443 
444  } NetCmdId;
445 
449  typedef enum {
450  HARD_RESTART, /* Restart the control system via a reboot */
451  SOFT_RESTART, /* Re-initialize the running control-system */
452  HARD_SHUTDOWN, /* Reboot the CPU and wait at the boot prompt */
453  SOFT_SHUTDOWN /* Terminate the control system but don't reboot */
454  } RtcShutdownMethod;
455 
456  /*
457  * The NetScanCmd is used to command the telescope to perform a scan.
458  * Sequential commands containing the same scan name will be combined
459  * to form a scrolling table of offsets of up to SCAN_NET_NPT points
460  * at a time.
461  *
462  * A non-zero sequence number will indicate the start of a new scan.
463  */
464  typedef struct {
465  char name[SCAN_LEN]; /* The name of the scan (see cbiregs.h for
466  SCAN_LEN) */
467  int seq; /* The sequence number of this command */
468  NetUint nreps; /* The number of times to execute this command */
469 
470  NetUint istart; /* The start index */
471  NetUint ibody; /* The start of the body sequence */
472  NetUint iend; /* The start of the end sequence */
473  NetUint npt; /* The number of points sent with this
474  command */
475  NetUint msPerSample; // The number of milliseconds per offset in this scan
476  unsigned int index[SCAN_NET_NPT];
477  unsigned int flag[SCAN_NET_NPT];
478 
479  // Don't make these unsigned or negative offsets won't work!
480 
481  int azoff[SCAN_NET_NPT];
482  int eloff[SCAN_NET_NPT];
483 
484  bool add;
485  } NetScanCmd;
486 
487  /*
488  * Define the contents of the shutdown command.
489  */
490  typedef struct { /* The context of NET_SHUTDOWN_CMD */
491  NetEnum method; /* A RtcShutdownMethod enumeration identifier */
492  } NetShutdownCmd;
493 
494  /*
495  * The following command sets the hardware integration interval.
496  */
497  typedef struct { /* The context of NET_INTERVAL_CMD */
498  unsigned short exponent; /* Integration time is (12.8us * 2^(6+exponent)) */
499  } NetIntervalCmd;
500 
501  /*
502  * The following command sets or clears the integration inhibit flag.
503  */
504  typedef struct { /* The context of NET_INHIBIT_CMD */
505  NetBool flag; /* True to inhibit, false to resume readout */
506  } NetInhibitCmd;
507 
508  /*
509  * The slow_walsh command toggles slow walshing on or off.
510  */
511 
512  typedef struct {
513  NetBool on; /* True to start slow walshing. False to turn it off. */
515 
516  /*
517  * The pager command turns the pager on or off
518  */
519  typedef struct {
520  NetEnum state; /* A PagerState enumerator */
521  } NetPagerCmd;
522  /*
523  * Enumerate the supported pager states.
524  */
525  typedef enum {
526  PAGER_ON, /* Turn the pager on */
527  PAGER_OFF, /* Turn the pager off */
528  PAGER_IP,
529  PAGER_EMAIL,
530  PAGER_ENABLE, /* Enable paging */
531  PAGER_DISABLE, /* Disable paging */
532  PAGER_CLEAR,
533  PAGER_LIST,
534  PAGER_STATUS
535  } PagerState;
536  /*
537  * The setreg command sets the value of a specified register to a given
538  * value.
539  */
540  typedef struct {
541  unsigned int value; /* The value to write to the register */
542  unsigned short board; /* The host-board of the register */
543  unsigned short block; /* The block number of the register */
544  unsigned short index; /* The index of the first element to be set */
545  unsigned short nreg; /* The number of elements to be set */
546  unsigned int seq; /* The sequence number of this transaction */
547  } NetSetregCmd;
548 
549  /*
550  * The getreg command reads the value of a specified register out of the
551  * register map
552  */
553  typedef struct {
554  unsigned short board; /* The host-board of the register */
555  unsigned short block; /* The block number of the register */
556  unsigned short index; /* The index of the first element to be set */
557  } NetGetregCmd;
558 
559  /*
560  * The setdio command sets the value of the 4-byte output register of
561  * a digital I/O card as a 32-bit bit-mask.
562  *
563  * Specify the operations that can be used to combine a template bit mask with
564  * an established bit mask.
565  */
566  typedef enum {
567  BIT_MASK_SET, /* For each bit that is set in the template, set the */
568  /* corresponding bit in the established bit mask. */
569  BIT_MASK_CLEAR, /* For each bit that is set in the template, clear the */
570  /* corresponding bit in the established bit mask. */
571  BIT_MASK_ASSIGN, /* Set the established bit mask equal to the template. */
572  } BitMaskOper;
573 
574  typedef struct {
575  unsigned int value; /* The value to write to the register */
576  unsigned short board; /* The host-board of the register */
577  NetEnum oper; /* A BitMaskOper enumerator */
578  } NetSetDioCmd;
579 
580  /*
581  * A board becomes flagged as unreachable after a bus or access error occurs
582  * wrt any of its registers. Once this happens, modules such as the scanner
583  * stop trying to access the board. After fixing the problem, or if the
584  * problem is transient, the unflag command can be used to mark the board
585  * as reachable again. If this turns out to be incorrect and another bus
586  * error occurs on a subsequent register access, the board will be reflagged.
587  */
588  typedef struct {
589  unsigned short board; /* The register map index of the board to unflag */
590  } NetUnflagCmd;
591 
592  /*
593  * The following command turns on or off a given set of phase-shifter
594  * motors.
595  */
596  typedef struct {
597  NetBool on; /* True to switch the specified motors on, false */
598  /* to switch them off */
599  NetMask receivers; /* The bit-set of receivers whose shifters are to */
600  /* be switched. The phase shifter of receiver n */
601  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
603 
604  /*
605  * The NetSetPolarCmd command sets up an association between a
606  * polarization state and an encoder position for a given set of
607  * receivers.
608  */
609  typedef enum {
610  LEFT, /* Left circular polarization */
611  RIGHT /* Right circular polarization */
612  } PolarState;
613 
614  typedef struct {
615  NetMask receivers; /* The bit-set of receivers whose shifters are to */
616  /* be switched. The phase shifter of receiver n */
617  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
618  NetEnum state; /* The PolarState enumeration */
619  NetUint posn; /* The desired encoder position (1..1023) */
620 
621  } NetRxPolarCmd;
622 
623  /*
624  * The NetPolWalshCmd command sets the polarization state of receivers to the
625  * requested step of receiver Walsh functions
626  */
627  typedef struct {
628  NetUint seq; /* The sequence number of this command */
629  NetMask receivers; /* The bit-set of receivers whose shifters are to */
630  /* be switched. The phase shifter of receiver n */
631  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
632  NetBool half_step; /* True to use a half-step for extra precision */
633  NetUint walshstep; /* The desired step of the Walsh cycle */
634  } NetPolWalshCmd;
635 
636  /*
637  * The following command sets the positions of a given set of phase-shifter
638  * motors.
639  */
640  typedef struct {
641  NetUint seq; /* The sequence number of this command */
642  NetUint posn; /* The desired encoder position (0..1023) */
643  NetBool half_step; /* True to use a half-step for extra precision */
644  NetMask receivers; /* The bit-set of receivers whose shifters are to */
645  /* be moved. The phase shifter of receiver n, */
646  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
648 
649  /*
650  * The following command selects a receiver
651  */
652  typedef struct {
653  NetEnum band; /* The receiver to select */
654  unsigned seq;
655  } NetSelectRxCmd;
656 
657  /*
658  * The following command sets a bias
659  */
660  typedef enum {
661  AMP = 0x1, // Biasing an amplifier
662  RX = 0x2, // Biasing a whole receiver
663  } BiasType;
664 
665  typedef struct {
666  NetEnum amp; // The amplifier bias to select
667  short bias; // The value to set
668  NetEnum biasType; // Are we biasing an amplifier or a receiver?
669  NetEnum rxId; // The receiver to select
670  unsigned seq;
671  } NetSetBiasCmd;
672 
673  /*
674  * The following command turns on or off a given set of heaters.
675  */
676  typedef struct {
677  NetBool on; /* True to switch the specified heaters on, false */
678  /* to switch them off */
679  NetMask heaters; /* The bit-set of heater types to be switched, the 3 */
680  /* least significant bits correspond to the first */
681  /* three elements of the rxn.htr_on[] register */
682  NetMask receivers; /* The bit-set of receivers whose heaters are to */
683  /* be switched. The heater of receiver n */
684  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
685  } NetRxHeaterCmd;
686 
687  /*
688  * The following command turns on or off a given set of coldheads.
689  */
690  typedef struct {
691  NetMask receivers; /* The bit-set of receivers whose heaters are to */
692  /* be switched. The heater of receiver n */
693  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
694  NetBool on; /* True to switch the specified coldheads on, false */
695  /* to switch them off */
697 
698  /*
699  * The following command sets the target sensor output voltages of the
700  * control-loops of a given set of heaters.
701  */
702  typedef struct {
703  NetUint value; /* The output voltage multiplied by 409.6, (0-4096) */
704  NetMask heaters; /* The bit-set of heater types to be switched, the 3 */
705  /* least significant bits correspond to the first */
706  /* three elements of the rxn.htr_req[] register */
707  NetMask receivers; /* The bit-set of receivers whose heaters are to */
708  /* be switched. The heater of receiver n */
709  /* (n=0..12) is to be set if set&(1<<n))!=0. */
710  } NetRxTempCmd;
711 
712  typedef enum {
713  LO_NONE,
714  LO_DAMPGAIN,
715  LO_FREQ,
716  LO_DEFAULT_FREQ,
717  LO_LOOPGAIN,
718  LO_TOGGLE,
719  LO_VOLTAGE,
720  LO_YIGID,
721  LO_TUNINGTABLE,
722  LO_ONEWIRE,
723  LO_AUTOLOCK,
724  LO_SETDACCOEFF
725  } LoMsgId;
726 
727  /*
728  * The following command enables or disables a given set of local
729  * oscillator stages in a given set of receivers.
730  */
731  typedef struct {
732  NetEnum msgId; // Which LO message is this?
733  NetEnum oscs; // The bit-set of oscillators whose stages we
734  // wish to switch on or off.
735  NetEnum stages; // The bit-set of stages to switch on or off. The
736  NetEnum rxId; // A mask of Rx::Ids
737  NetBool on; // True to switch the specified stages on,
738  // false to switch them off
739  unsigned short dampGain; // Used to set the damping gain of the Yig
740  unsigned short frequency; // Used to set the frequency of the Yig
741  unsigned short loopGain; // Used to set the loop gain of Var/Yig
742  unsigned short voltage; // Used to set the voltage of the Yig
743  unsigned char id; // Used to set the Yig ID
744  unsigned char month; // Used to set the Yig ID
745  unsigned char day; // Used to set the Yig ID
746  unsigned char year; // Used to set the Yig ID
747  float coeff; // Used to set the DAC coefficient
748  } NetLoCmd;
749 
750  /*.......................................................................
751  * The following command turns fast sampling on/off
752  */
753  typedef struct {
754  NetUint channel;
755  NetBool start;
757 
761  typedef enum {
762  FIXED = 0x1,
763  ADJUSTABLE = 0x2,
764  GEOMETRIC = 0x4,
765  THERMAL = 0x8,
766  IONOSPHERIC = 0x10,
767  TROPOSPHERIC = 0x20
768  } DelayType;
769 
773  typedef struct {
774  double x;
775  double y;
776  double z;
777  double longitude;
778  double latitude;
779  double axisMis;
781 
785  typedef enum {
786  DDS_ENABLE,
787  DDS_DISABLE,
788  DDS_RESET,
789  } DDSState;
790 
794  typedef struct {
795  NetEnum state;
796  } NetDDSCmd;
797 
801  typedef struct {
802  int ddsId;
804 
808  typedef struct {
809  int input;
810  short phase;
811  NetEnum type;
813 
817  typedef struct {
818  int input;
819  double freq;
820  NetEnum type;
821  } NetSetLRFreqCmd;
822 
823  typedef enum {
824  LR_DDS,
825  LR_INPUT
826  } LRType;
827 
832  typedef struct {
833  int input;
834  int column;
836 
840  typedef struct {
841  int input;
842  bool enable;
844 
848  typedef struct {
849  int input;
850  double delay;
851  double mjd;
852  NetBool disc;
854 
858  typedef struct {
859  int input;
860  int freg;
861  int preg;
863 
867  typedef struct {
868  short phase;
870 
874  typedef struct {
875  double freq;
877 
881  typedef struct {
882  double pntRa;
883  double pntDec;
884  double phsRa;
885  double phsDec;
886  double freq;
887  double distance;
888  double mjd;
889  NetBool discontinuity;
891 
895  typedef struct {
896  double airTemp;
897  double atmPressure;
898  double dewPoint;
899  double relHumid;
901 
905  typedef struct {
906  double delay;
907  NetEnum delayType;
908  } NetSetDelayCmd;
909 
913  typedef struct {
914  NetBool use;
915  NetEnum delayType;
916  } NetUseDelayCmd;
917 
921  typedef struct {
922  NetBool on;
923  NetEnum target;
925 
926  /*
927  * The following command selects between 4 quadrature phase shifts per
928  * receiver.
929  */
930 
931  typedef enum { /* Enumerate the possible quadrature network states */
932  QUAD_0 = 0, /* No phase shift */
933  QUAD_90 = 1, /* A phase shift of 90 degrees */
934  QUAD_180 = 2, /* A phase shift of 180 degrees */
935  QUAD_270 = 3 /* A phase shift of 270 degrees */
936  } QuadPhase;
937 
938  typedef struct {
939  NetEnum state; /* A QuadPhase enumerator */
940  NetMask receivers; /* The bit-set of receivers whose oscillators are to */
941  /* be switched. The oscillator of receiver n */
942  /* (n=0..12) is to be switched if set&(1<<n))!=0. */
943  } NetRxQuadCmd;
944 
945  /*
946  * The following command is used to inform the control system of the
947  * location of the SZA.
948  */
949 #define SZA_MAX_ALT 10000.0 /* The max altitude above or below sea-level (m) */
950 
951  typedef struct {
952  double lon; /* The SZA intitude (east +ve) [-pi..pi] (milli-arcsec) */
953  double lat; /* The SZA latitude [-pi/2..pi/2] (milli-arcsec) */
954  double alt; /* The SZA altitude (mm) */
955  } NetSiteCmd;
956 
957  typedef struct {
958  double north; /* The north offset of an antenna */
959  double east; /* The east offset of an antenna */
960  double up; /* The up offset of an antenna */
961  } NetLocationCmd;
962 
963  typedef struct {
964  double east; /* The east offset of an antenna */
965  double north; /* The north offset of an antenna */
966  double up; /* The up offset of an antenna */
967  } NetDelayRefCmd;
968 
969  /*
970  * The first command sent to the controller after startup must be
971  * the following. Note that this command can not be sent at any
972  * other time. When a connection is first initiated to the
973  * translator layer, the scheduler automatically runs its
974  * initialization script. On start-up, the controller will send
975  * this message with start=true, and after the scheduler has
976  * completely sent the initialization script, it will queue this
977  * command to be sent with start=false.
978  */
979  typedef struct {
980  NetBool start;
981  } NetInitCmd;
982 
983  /*
984  * The following object is sent to halt the telescope.
985  */
986  typedef struct {
987  NetUint seq; // The tracker sequence number of this command
988  NetMask antennas; // A bitwise union of antennas to control
989  } NetHaltCmd;
990 
991  /*
992  * The following object is sent to reboot the pmac
993  */
994  typedef struct {
995  NetUint seq; /* The tracker sequence number of this command */
997 
998  /*
999  * The following object is used to request a telescope slew to a given
1000  * mount position.
1001  */
1002  typedef enum { /* This must be kept in step with source.h::SourceAxes*/
1003  DRIVE_AZ_AXIS=1, /* Slew the azimuth axis */
1004  DRIVE_EL_AXIS=2, /* Slew the elevation axis */
1005  DRIVE_DK_AXIS=4, /* Slew the deck axis */
1006  DRIVE_ALL_AXES = DRIVE_AZ_AXIS | DRIVE_EL_AXIS | DRIVE_DK_AXIS
1007  } DriveAxes;
1008 
1009  typedef struct {
1010  char source[SRC_LEN]; /* The name of the source (see genericregs.h for SRC_LEN) */
1011  NetUint number; /* The catalog number of this source */
1012  NetUint seq; /* The sequence number of this command */
1013  NetMask mask; /* A bitwise union of DriveAxes enumerated */
1014  /* bits used to specify which of the following axis */
1015  /* positions are to be used. */
1016  double az; /* The target azimuth (0..360 degrees in mas) */
1017  double el; /* The target elevation (0..90 degrees in mas) */
1018  double dk; /* The target deck angle (-180..180 in mas) */
1019  NetEnum type; // An sza::util::Tracking::Type enumerator
1020  NetEnum slewType; // An sza::util::Tracking::SlewType enumerator
1021  } NetSlewCmd;
1022 
1023  /*
1024  * The NetTrackCmd is used to command the telescope to track a source.
1025  * Sequential commands containing the same source name will be
1026  * combined to form a scrolling interpolation table of up to 3 points
1027  * at a time.
1028  *
1029  * On source changes the control program is expected to send three
1030  * ephemeris entries for the source, one preceding the current time
1031  * and two following it. It is thereafter expected to send a new
1032  * ephemeris entry whenever the current time passes that of the
1033  * second point in the table. The new entry must be for a later time
1034  * than the existing 3rd entry.
1035  *
1036  * On receipt of a track command with a new source name, the tracker
1037  * task will immediately command a slew to the first position received.
1038  * It is anticipated that by the time the slew ends, the control program
1039  * will have had more than enough time to send two more entries. If only
1040  * one more entry has been received, linear interpolation will be used. If
1041  * no new entries have been received then the details of the single entry
1042  * will be used without any interpolation.
1043  */
1044 
1045  typedef struct {
1046  char source[SRC_LEN]; /* The name of the source (see genericregs.h
1047  for SRC_LEN) */
1048  NetUint number; /* The catalog number of the source */
1049  NetEnum srcType; /* The source type */
1050  NetUint seq; /* The sequence number of this command */
1051  int mjd; /* The Terrestrial Time at which ra,dec are valid, */
1052  /* as a Modified Julian Day number */
1053  int tt; /* The number of TT milliseconds into day 'mjd' */
1054  int ra; /* The desired apparent Right Ascension */
1055  /* (0..360 degrees in mas) */
1056  int dec; /* The desired apparent Declination */
1057  /* (-180..180 degrees in mas) */
1058  int dist; // The distance to the source if it is
1059  // near enough for parallax to be
1060  // significant. Specify the distance in
1061  // micro-AU Send 0 for distant sources.
1062  NetEnum type; // An sza::util::Tracking::Type enumerator
1063  } NetTrackCmd;
1064 
1065  /*
1066  * The following enumerators specify how new offsets are to effect
1067  * existing offsets.
1068  */
1069  typedef enum {
1070  OFFSET_ADD, /* Add the new offsets to any existing offsets */
1071  OFFSET_SET /* Replace the existing offsets with the new offsets */
1072  } OffsetMode;
1073 
1074  /*
1075  * The following command establishes new horizon pointing offsets.
1076  */
1077  typedef struct {
1078  NetUint seq; /* The tracker sequence number of this command */
1079  NetMask axes; /* The set of axes to offset, as a union of SkyAxis */
1080  /* enumerators. */
1081  NetEnum mode; /* The effect of the offsets on existing offsets, chosen */
1082  /* from the above OffsetMode enumerators. */
1083  double az,el,dk; /* The offsets for the azimuth, elevation and deck axes */
1084  /* Only those values that correspond to axes included in */
1085  /* the 'axes' set will be used. */
1087 
1088  /*
1089  * The following command enables or disables azimuth tilt corrections based on
1090  * structure tilt meter readings.
1091  */
1092  typedef struct {
1093  NetBool enable; /* If true enable tilt corrections */
1095 
1096  /*
1097  * The following command sets the zeroing offsets for the structure tilt meter
1098  */
1099  typedef struct {
1100  double x; /* x axis tilt meter offset (radians) */
1101  double y; /* y axis tilt meter offset (radians) */
1103 
1104  /*
1105  * The following command sets the angle between zero azimuth and the x tilt meter direction.
1106  */
1107  typedef struct {
1108  double angle; /* Tilt meter x axis direction (radians) */
1110 
1111  /*
1112  * The following command sets the maximum allowed absolute value of tilt meter angle.
1113  * The average reading from each tilt meter is clipped to this value.
1114  */
1115  typedef struct {
1116  double maxAngle; /* max absolute value of tilt meter reading (radians) */
1118 
1119  /*
1120  * The following command sets the time period over which the moving average of
1121  * the structure tilt meters is calculated.
1122  */
1123  typedef struct {
1124  double interval; /* moving average interval (seconds) */
1126 
1127  /*
1128  * The following command enables or disables azimuth, elevation and azimuth axis tilt corrections based on
1129  * yoke arm linear sensor readings.
1130  */
1131  typedef struct {
1132  NetBool enable; /* If true enable linear sensor corrections */
1134 
1135  /*
1136  * The following command sets the zeroing offsets for the structure linear sensors
1137  */
1138  typedef struct {
1139  double L1; /* Left 1 delta distance (millimeters) */
1140  double L2; /* Left 2 delta distance (millimeters) */
1141  double R1; /* Right 1 delta distance (millimeters) */
1142  double R2; /* Right 2 delta distance (millimeters) */
1144 
1145  /*
1146  * The following command sets the maximum allowed absolute value of tilt meter angle.
1147  * The average reading from each tilt meter is clipped to this value.
1148  */
1149  typedef struct {
1150  double maxDistance; /* max absolute value of linear sensor reading (millimeters) */
1152 
1153  /*
1154  * The following command sets the time period over which the moving average of
1155  * the yoke linear sensors is calculated.
1156  */
1157  typedef struct {
1158  double interval; /* moving average interval (seconds) */
1160 
1161 
1162  // The following command sets the time period over which the
1163  // moving average of the yoke linear sensors is calculated.
1164 
1165  typedef struct {
1166  unsigned sec;
1167  unsigned msec;
1169 
1170  // A structure for containing a generic GPIB command
1171 
1172  enum {
1173  GPIB_CRYOCON,
1174  GPIB_LAKESHORE
1175  };
1176 
1177  enum {
1178  GPIB_SETUP,
1179  GPIB_HEAT,
1180  GPIB_COOL,
1181  GPIB_UNITS,
1182  GPIB_CLR_STATUS,
1183  GPIB_RESET,
1184  GPIB_STOP_LOOP,
1185  GPIB_ENGAGE_LOOP,
1186  GPIB_SET_SKY_TEMP,
1187  GPIB_SET_CHANNEL,
1188  GPIB_SET_LOOP_RANGE,
1189  GPIB_SET_P,
1190  GPIB_SET_I,
1191  GPIB_SET_D,
1192  GPIB_SET_POWER_OUTPUT,
1193  GPIB_SET_HEATER_LOAD,
1194  GPIB_SET_LOOP_TYPE,
1195  };
1196 
1197  typedef struct {
1198  unsigned device; // Which device is this intended for?
1199  unsigned cmdId; // What command does this struct contain?
1200  int intVals[2]; // Command inputs...
1201  float fltVal; // Command inputs...
1202  } NetGpibCmd;
1203 
1204 
1205  /*
1206  * The following are the new tracker specific commands
1207  */
1208  enum {
1209  SERVO_ENGAGE,
1210  SERVO_INITIALIZE_ANTENNA,
1211  SERVO_LOAD_PARAMETERS,
1212  SERVO_ENABLE_CLUTCHES,
1213  SERVO_ENABLE_BRAKES,
1214  SERVO_ENABLE_CONTACTORS,
1215  };
1216 
1217  typedef struct {
1218  unsigned cmdId; // What command does this struct contain?
1219  int intVal; // Command inputs...
1220  float fltVal; // Command inputs...
1221  float fltVals[10]; // Command inputs...
1222  } NetServoCmd;
1223 
1224 
1225  /*
1226  * The following are the new receiver backend specific commands
1227  */
1228  enum {
1229  RX_SETUP_ADC,
1230  RX_RESET_FPGA,
1231  RX_RESET_FIFO,
1232  RX_SET_SWITCH_PERIOD,
1233  RX_SET_BURST_LENGTH,
1234  RX_SET_INTEGRATION_PERIOD,
1235  RX_SET_TRIM_LENGTH,
1236  RX_ENABLE_SIMULATOR,
1237  RX_ENABLE_NOISE,
1238  RX_ENABLE_WALSHING,
1239  RX_ENABLE_ALT_WALSHING,
1240  RX_ENABLE_FULL_WALSHING,
1241  RX_ENABLE_NONLINEARITY,
1242  RX_GET_BURST_DATA,
1243  RX_ENABLE_ALPHA,
1244  RX_SET_ALPHA,
1245  RX_SET_NONLIN,
1246  };
1247 
1248  typedef struct {
1249  unsigned cmdId; // What command does this struct contain?
1250  float fltVal; // Command inputs...
1251  int stageNumber; // stage
1252  int channelNumber; // channel
1253  } NetRxCmd;
1254 
1255  /*
1256  * The following are the new receiver backend specific commands
1257  */
1258  enum {
1259  ROACH_COMMAND,
1260  };
1261 
1262  typedef struct {
1263  unsigned cmdId; // What command does this struct contain?
1264  char stringCommand[11];
1265  float fltVal; // Command inputs...
1266  int roachNum; // stage
1267  } NetRoachCmd;
1268 
1269 
1270  /*
1271  * The following are the new lna controller commands
1272  */
1273  enum {
1274  LNA_SET_DRAIN_VOLTAGE,
1275  LNA_SET_DRAIN_CURRENT,
1276  LNA_SET_GATE_VOLTAGE,
1277  LNA_SET_BIAS,
1278  LNA_SET_MODULE,
1279  LNA_CHANGE_VOLTAGE,
1280  LNA_GET_VOLTAGE,
1281  LNA_ENABLE_BIAS_QUERY,
1282  };
1283 
1284  typedef struct {
1285  unsigned cmdId; // What command does this struct contain?
1286  float drainVoltage; // What value to set it to
1287  float drainCurrent; // What value to set it to
1288  int lnaNumber; // Number of the LNA
1289  int stageNumber; // Number of LNA stage
1290  } NetLnaCmd;
1291 
1292 
1293  /*
1294  * The following command establishes new equatorial pointing offsets.
1295  */
1296  typedef enum { /* The set of offsetable equatorial axes */
1297  EQUAT_RA_AXIS=1, /* The Right-Ascension axis */
1298  EQUAT_DEC_AXIS=2 /* The declination axis */
1299  } EquatAxis;
1300 
1301  typedef struct {
1302  NetUint seq; /* The tracker sequence number of this command */
1303  NetMask axes; /* The set of equatorial axes to offset, as a union of */
1304  /* EquatAxis enumerators */
1305  NetEnum mode; /* The effect of the offsets on existing offsets, chosen */
1306  /* from OffsetMode enumerators. */
1307  int ra,dec; /* The offsets for the right-ascension and declination axes */
1308  /* Only those values that correspond to axes included in */
1309  /* the 'axes' set will be used. */
1311 
1312  /*
1313  * The following command asks the tracker to add to the az and el
1314  * tracking offsets such that the image on the tv monitor of the
1315  * optical-pointing telescope moves by given amounts horizontally
1316  * and vertically.
1317  */
1318  typedef struct {
1319  NetUint seq; /* The tracker sequence number of this command */
1320  int up; /* The amount to move the image up on the display (mas) */
1321  int right; /* The amount to move the image right on the display (mas) */
1322  } NetTvOffsetCmd;
1323 
1324  /*
1325  * The following command sets the deck angle at which the vertical
1326  * direction on the tv monitor of the optical telescope matches
1327  * the direction of increasing topocentric elevation.
1328  */
1329  typedef struct {
1330  int angle; /* The deck angle at which the camera image is upright (mas) */
1331  } NetTvAngleCmd;
1332 
1333  /*
1334  * The SkyOffset command tells the tracker to track a point at a given
1335  * fixed sky offset from the normal pointing center, regardless of
1336  * elevation or declination. This is used primarily for making beam
1337  * maps.
1338  */
1339  typedef enum { /* Set members for the NetSkyOffsetCmd axes member. */
1340  SKY_X_AXIS = 1, /* The NetSkyOffsetCmd::x axis */
1341  SKY_Y_AXIS = 2, /* The NetSkyOffsetCmd::y axis */
1342  } SkyXYAxes;
1343 
1344  typedef struct {
1345  NetUint seq; /* The tracker sequence number of this command */
1346  NetMask axes; /* The set of axes to offset, as a union of SkyXYAxes */
1347  /* enumerators. */
1348  NetEnum mode; /* The effect of the new offsets on any existing offsets, */
1349  /* chosen from OffsetMode enumerators. */
1350  int x,y; /* The 2-dimensional angular offset, expressed as distances */
1351  /* along two great circles that meet at right angles at the */
1352  /* normal pointing center. The y offset is directed along */
1353  /* the great circle that joins the normal pointing center */
1354  /* to the zenith. The x offset increases along the */
1355  /* perpendicular great circle to this, increasing from */
1356  /* east to west. Both offsets are measured in */
1357  /* milli-arcseconds. */
1358  } NetSkyOffsetCmd;
1359 
1360  /*
1361  * The NetUt1UtcCmd and NetEqnEqxCmd commands are used to send occasional
1362  * updates of variable earth orientation parameters.
1363  *
1364  * For each command the control system retains a table of the 3 most
1365  * recently received updates. These three values are quadratically
1366  * interpolated to yield orientation parameters for the current time.
1367  * On connection to the control system, the control program is expected
1368  * to send values for the start of the current day, the start of the following
1369  * day and the start of the day after that. Thereafter, at the start
1370  * of each new day, it should send parameters for a time two days
1371  * in the future.
1372  *
1373  * On startup of the control system, requests for ut1utc and eqex
1374  * will return zero. On receipt of the first earth-orientation command,
1375  * requests for orientation parameters will return the received values.
1376  * On the receipt of the second, requesters will receive a linear
1377  * interpolation of the parameters. On receipt of the third and subsequent
1378  * commands, requesters will receive quadratically interpolated values
1379  * using the parameters of the three most recently received commands.
1380  */
1381  typedef struct {
1382  int mjd; /* The UTC to which this command refers as a Modified */
1383  /* Julian Day number */
1384  int utc; /* The number of UTC milliseconds into day 'mjd' */
1385  int ut1utc; /* The value of ut1 - utc (us) */
1386  } NetUt1UtcCmd;
1387 
1388  typedef struct {
1389  int mjd; /* The Terrestrial Time to which this command refers, */
1390  /* as a Modified Julian day number */
1391  int tt; /* The number of TT milliseconds into day 'mjd' */
1392  int eqneqx; /* The equation of the equinoxes (mas) */
1393  } NetEqnEqxCmd;
1394 
1395  /*
1396  * The NetEncoderCalsCmd is used to calibrate the scales and directions
1397  * of the telescope encoders.
1398  */
1399  typedef struct {
1400  NetUint seq; /* The tracker sequence number of this command */
1401  int az; /* Azimuth encoder counts per turn */
1402  int el; /* Elevation encoder counts per turn */
1403  int dk; /* Deck encoder counts per turn */
1405 
1406  /*
1407  * The NetEncoderZerosCmd is used to set the zero points of the telescope
1408  * encoders. The angles are measured relative to the position at which the
1409  * encoders show zero counts.
1410  */
1411  typedef struct {
1412  NetUint seq; // The tracker sequence number of this command
1413  double az; // Azimuth encoder angle at zero azimuth, measured in
1414  // the direction of increasing azimuth (radians).
1415  double el; // Elevation encoder angle at zero elevation,
1416  // measured in the direction of increasing elevation
1417  // (radians).
1418  double dk; // Deck encoder angle at the deck reference position,
1419  // measured clockwise when looking towards the sky
1420  // (radians).
1422 
1423  /*
1424  * The NetSlewRateCmd is used to set the slew speeds of each of the
1425  * telescope axes. The speed is specified as a percentage of the
1426  * maximum speed available.
1427  */
1428  typedef struct {
1429  NetUint seq; /* The tracker sequence number of this command */
1430  NetMask mask; /* A bitwise union of DriveAxes enumerated */
1431  /* bits, used to specify which of the following axis */
1432  /* rates are to be applied. */
1433  int az; /* Azimuth slew rate (0-100) */
1434  int el; /* Elevation slew rate (0-100) */
1435  int dk; /* Deck slew rate (0-100) */
1436  } NetSlewRateCmd;
1437 
1438  /*
1439  * The NetTiltsCmd is used to calibrate the axis tilts of the
1440  * telescope.
1441  */
1442  typedef struct {
1443  NetUint seq; /* The tracker sequence number of this command */
1444  int ha; /* The hour-angle component of the azimuth-axis tilt (mas) */
1445  int lat; /* The latitude component of the azimuth-axis tilt (mas) */
1446  int el; /* The tilt of the elevation axis perpendicular to the */
1447  /* azimuth ring, measured clockwise around the direction */
1448  /* of the azimuth vector (mas) */
1449  } NetTiltsCmd;
1450 
1451  /*
1452  * The NetFlexureCmd is used to calibrate the gravitational flexure of the
1453  * telescope.
1454  */
1455  typedef struct {
1456  NetUint seq; /* The tracker sequence number of this command */
1457  NetEnum mode; /* An sza::util::PointingMode enumeration */
1458  int sFlexure; /* Gravitational flexure (milli-arcsec per sine elevation) */
1459  int cFlexure; /* Gravitational flexure (milli-arcsec per cosine elevation) */
1460  unsigned ptelMask;
1461  } NetFlexureCmd;
1462 
1463  /*
1464  * The NetCollimateCmd command is used to calibrate the collimation of
1465  * the optical or radio axes.
1466  */
1467  typedef struct {
1468  NetUint seq; /* The tracker sequence number of this command */
1469  NetEnum mode; /* An sza::util::PointingMode enumeration */
1470  int x; /* The magnitude of the azimuthal offset (mas) */
1471  int y; /* The magnitude of the elevation offset (mas) */
1472  NetEnum type; /* An sza::util::PointingMode enumeration */
1473  int magnitude; /* The magnitude of the elevation offset (mas) */
1474  int direction; /* The magnitude of the elevation offset (mas) */
1475 
1476  NetEnum addMode; // The effect of the new offsets on any
1477  // existing offsets, chosen from OffsetMode
1478  // enumerators.
1479  unsigned ptelMask;
1480  } NetCollimateCmd;
1481 
1482  /*
1483  * The NetEncoderLimitsCmd command tells the tracker task what the limits
1484  * on encoder values are.
1485  */
1486  typedef struct {
1487  NetUint seq; /* The tracker sequence number of this command */
1488  int az_min; /* The lower azimuth limit (encoder counts) */
1489  int az_max; /* The upper azimuth limit (encoder counts) */
1490  int el_min; /* The lower elevation limit (encoder counts) */
1491  int el_max; /* The upper elevation limit (encoder counts) */
1492  int pa_min; /* The lower pa limit (encoder counts) */
1493  int pa_max; /* The upper pa limit (encoder counts) */
1495 
1496  /*
1497  * The NetModelCmd command selects between the optical and radio pointing
1498  * models.
1499  */
1500  typedef struct {
1501  NetUint seq; // The tracker sequence number of this command
1502  NetEnum mode; // A PointingMode enumeration
1503  unsigned ptelMask; // The model to apply
1504 
1505  } NetModelCmd;
1506 
1507  /*
1508  * The NetYearCmd command tells the control system what the
1509  * current year is. This is necessary because the gps time-code reader
1510  * doesn't supply year information.
1511  */
1512  typedef struct {
1513  short year; /* The current Gregorian year */
1514  } NetYearCmd;
1515 
1516  /*
1517  * The NetDeckModeCmd command tells the track task how to position
1518  * the deck axis while tracking a source.
1519  */
1520  typedef struct {
1521  NetUint seq; /* The tracker sequence number of this command */
1522  NetEnum mode; /* A DeckMode enumerator from genericregs.h */
1523  } NetDeckModeCmd;
1524 
1525  /*
1526  * The atmosphere command is used to supply atmospheric parameters for
1527  * refraction computations in the weather-station task. It is not
1528  * needed when the weather station is functioning.
1529  */
1530  typedef struct {
1531  double temperatureInK; // The outside temperature (K)
1532  double humidityInMax1; // The relative humidity (0-1)
1533  double pressureInMbar; // The atmospheric pressure (milliBar)
1534  } NetAtmosCmd;
1535 
1536  /*
1537  * The feature command conveys a bit-mask to be added or removed from the
1538  * set of feature bits to be recorded with one or more subsequent archive
1539  * frames. Once a feature bit has been added to the transient or persistent
1540  * set of feature bits, it is guaranteed to be recorded in at least one
1541  * frame. For transient markers the feature bits are recorded in the next
1542  * frame only, whereas persistent feature markers will continue to appear
1543  * in subsequent frames until they are cancelled.
1544  */
1545  typedef enum {
1546  FEATURE_ADD, /* Add the new set of feature bits to those that are */
1547  /* to be recorded in subsequent frames. */
1548  FEATURE_REMOVE, /* Remove the specified set of features from those that */
1549  /* have previously been registered with FEATURE_ADD */
1550  FEATURE_ONE /* Add the new set of feature bits to the transient set */
1551  /* which is to be recorded just in the next frame. */
1552  } FeatureMode;
1553 
1554  typedef struct {
1555  NetUint seq; /* The mark-command sequence number of this message */
1556  NetEnum mode; /* What to do with the bit mask */
1557  unsigned int mask; /* The bit-mask to merge with any existing bit mask. */
1558  } NetFeatureCmd;
1559 
1560  /*
1561  * Specify the maximum size of a GPIB data message.
1562  * Note that this effects both the size of network communications
1563  * buffers and the size of some message queue nodes, so it shouldn't
1564  * be made too large.
1565  */
1566 #define GPIB_MAX_DATA 80
1567 
1568  /*
1569  * The gpib-send command tells the GPIB control task to try to send the
1570  * specified message to a given GPIB device.
1571  */
1572  typedef struct {
1573  unsigned short device; /* The generic address of the target */
1574  /* GPIB device (0..30). */
1575  char message[GPIB_MAX_DATA+1]; /* The message to be sent. */
1576  } NetGpibSendCmd;
1577 
1578  /*
1579  * The gpib-read command tells the GPIB control task to try to read a
1580  * message from a given GPIB device.
1581  */
1582  typedef struct {
1583  unsigned short device; /* The generic address of the source */
1584  /* GPIB device (0..30). */
1585  } NetGpibReadCmd;
1586 
1587  /*
1588  * Turns power on/off to one or more antenna breakers
1589  */
1590  typedef struct {
1591  NetUint breaker;
1592  NetBool power;
1593  } NetPowerCmd;
1594 
1595  /*
1596  * The noise-times command changes the time between noise-cal power
1597  * readouts.
1598  */
1599  typedef struct {
1600  unsigned int seconds; /* The interval between power readings (seconds) */
1601  } NetPowerDtCmd;
1602 
1603  /*
1604  * The NetPowerMeterCmd sends a command to the noise-cal power meter.
1605  *
1606  * Enumerate the supported power-meter commands in order of decreasing
1607  * priority. Commands with higher priority will be transacted before
1608  * those of lower priority.
1609  */
1610  typedef enum {
1611  NCAL_POWER_RESET, /* Reinstate the power meter's power-on settings */
1612  NCAL_POWER_ZERO, /* Perform a zero calibration */
1613  NCAL_POWER_READ, /* Take periodic power readings */
1614  /* The next enumerator must always be last */
1615  NCAL_POWER_NCMD /* The number of commands enumerated above */
1616  } NcalPowerCmd;
1617 
1618  typedef struct {
1619  NetEnum cmd; /* One of the commands listed above */
1620  } NetPowerMeterCmd;
1621 
1622  /*
1623  * The chzr_power command initiates a search for the IF attenuations
1624  * that result in outputs from specified total-power detectors that
1625  * are close to a given power level.
1626  */
1627  typedef struct {
1628  NetUint seq; /* The sequence number of this command */
1629  NetMask bands; /* The bit-set of bands whose attenuators are to */
1630  /* be configured. The attenuator of band n */
1631  /* (n=0..N_BAND-1) is to be configured if */
1632  /* set&(1<<n))!=0. */
1633  NetMask receivers; /* The bit-set of receivers whose attenuators are to */
1634  /* be configured. The attenuator of receiver n */
1635  /* (n=0..N_ANT-1) is to be configured if */
1636  /* set&(1<<n))!=0. */
1637  float power; /* The desired output of the total-power
1638  In calibrated units */
1639  } NetChzrPowerCmd;
1640 
1641  /*
1642  * The chzr_zero command initiates a procedure that measures the
1643  * zero-offset of a given set of total-power detectors.
1644  */
1645  typedef struct {
1646  NetUint seq; /* The sequence number of this command */
1647  NetMask bands; /* The bit-set of bands whose sensor zero-offsets */
1648  /* are to be found. Band n (n=0..N_BAND-1) is to */
1649  /* be processed if (bands & (1<<n))!=0. */
1650  NetMask receivers; /* The bit-set of receivers whose sensor */
1651  /* zero-offsets are to be measured. Receiver n */
1652  /* (n=0..N_ANT-1) is to be configured if */
1653  /* (receivers & (1<<n))!=0. */
1654  } NetChzrZeroCmd;
1655  /*
1656  * The tpcal command installs total powers calibration factors for a given set'* of receivers and bands.
1657  */
1658  typedef struct {
1659  NetMask bands; /* The bit-set of bands whose total power
1660  calibration sare to be changed */
1661  NetMask receivers; /* The bit-set of receivers whose total offsets
1662  are to be changed. */
1663  float offset; /* The offset to apply to the total powers */
1664  NetBool offset_present;/* Was an offset change requested in this command? */
1665  float factor; /* The factor to apply to the total powers */
1666  NetBool factor_present;/* Was an factor change requested in this command? */
1667  } NetTpcalCmd;
1668 
1669  /*
1670  * The following enumerators specify if the attn avlue is absolute
1671  * or additive
1672  */
1673  typedef enum {
1674  ATTN_ADD, /* Add the new attn to the existing attn */
1675  ATTN_SET /* Replace the existing attn with the new attn */
1676  } AttnMode;
1677 
1678  /*
1679  * The chzr_attn command sets the inserted attenuations of a given
1680  * set of IF channels.
1681  */
1682  typedef struct {
1683  NetMask bands; /* The bit-set of bands whose attenuators */
1684  /* are to be set. Band n (n=0..N_BAND-1) is to */
1685  /* be configured if (bands & (1<<n))!=0. */
1686  NetMask receivers; /* The bit-set of receivers whose attenuators */
1687  /* are to be set. Receiver n (n=0..N_ANT-1) is */
1688  /* to be configured if (receivers & (1<<n))!=0. */
1689  int attn; /* The desired attenuation (-31-31db) */
1690  NetEnum mode; /* Additive or absolute attenuation value */
1691  } NetChzrAttnCmd;
1692 
1693  /*
1694  * The chzr_switch command sets the on/off states of a given
1695  * set of IF channels.
1696  */
1697  typedef struct {
1698  NetMask bands; /* The bit-set of bands whose switches */
1699  /* are to be set. Band n (n=0..N_BAND-1) is to */
1700  /* be configured if (bands & (1<<n))!=0. */
1701  NetMask receivers; /* The bit-set of receivers whose switches */
1702  /* are to be set. Receiver n (n=0..N_ANT-1) is */
1703  /* to be configured if (receivers & (1<<n))!=0. */
1704  NetBool on; /* True to switch the specified channels on, false */
1705  /* to switch them off */
1706  } NetChzrSwitchCmd;
1707 
1708  /*
1709  * The chzr_enable command temporarily disables or reenables all of
1710  * the channelizer IF amplifiers. Note that the switch states are
1711  * ORed with those set by the chzr_switch command, so that on using
1712  * this command to reenable the IFs, those that had been disabled
1713  * separately by the chzr_switch command, remain disabled.
1714  */
1715  typedef struct {
1716  NetBool on; /* True to switch the IFs on, false to switch */
1717  /* them off */
1718  } NetChzrEnableCmd;
1719 
1720  /*
1721  * The noise_cal command connects or disconnects the noise-calibration
1722  * signal from all of the receivers.
1723  */
1724  typedef struct {
1725  NetBool on; /* True to connect the noise-source, false to */
1726  /* disconnect it. */
1727  } NetNoiseCalCmd;
1728 
1729  /*
1730  * The NetRxSimCmd configures the receiver simulation box.
1731  */
1732  typedef enum { /* Enumerated bit values for NetRxSimCmd::what */
1733  RX_SIM_NOISE=1, /* Configure the noise generators */
1734  RX_SIM_SKY=2, /* Configure the fake-sky signal generator */
1735  RX_SIM_QUAD=4 /* Configure the quadrature phase-shifters */
1736 
1737  } RxSimSel;
1738 
1739  typedef struct {
1740  NetMask what; /* A bitwise union of RxSimSel enumeration values */
1741  /* specifying which of the following members should */
1742  /* used to configure the receiver simulator. */
1743  NetMask noise; /* The bit-set of receivers whose noise sources */
1744  /* are to be enabled. Receiver n (n=0..N_ANT-1) is */
1745  /* to be enabled if (noise & (1<<n))!=0. */
1746  NetMask quad; /* The bit-set of receivers whose 90 degree */
1747  /* phase-shifters are to be enabled. */
1748  /* Receiver n (n=0..N_ANT-1) is to be enabled */
1749  /* if (noise & (1<<n))!=0. */
1750  NetBool sky; /* True to switch the fake sky signal on */
1751  } NetRxSimCmd;
1752  /*
1753  * Enumerate the allowed DS commands
1754  */
1755  typedef enum {
1756  DS_READ_CMD, /* Read the temp from a single device */
1757  DS_READALL_CMD, /* Read the temp from all devices */
1758  DS_ADDRESS_CMD, /* Call out an address */
1759  DS_RESET_CMD, /* Reset the controller */
1760  DS_INIT_CMD, /* Re-initialize the serial port connection */
1761  DS_SEARCH_CMD, /* Search the bus for devices */
1762  DS_ROMID_CMD, /* Install a ROM id in the list of known devices */
1763  DS_FLAG_CMD, /* Flag a device as unreachable */
1764  DS_UNFLAG_CMD, /* Flag a device as reachable */
1765  DS_DISPLAY_CMD, /* Display known devices */
1766  DS_CHECK_CMD, /* Add checksumming to commands */
1767  DS_NOCHECK_CMD, /* Remove checksumming */
1768  } DsCommand;
1769 
1770  /*
1771  * The thermometer command sends commands to the DS1820 digital thermometers.
1772  */
1773  typedef struct {
1774  NetEnum command; /* The enumerated command above to send */
1775  unsigned char address[16];/* The optional address to send */
1776  NetUint index; /* The index to assign this address to */
1777  NetBool checksum; /* Add checksumming? */
1778  } NetThermoCmd;
1779  /*
1780  * The ds-times command changes the time between DS1820 temperature
1781  * readouts.
1782  */
1783  typedef struct {
1784  unsigned int seconds; /* The interval between power readings (seconds) */
1785  } NetDsDtCmd;
1786  /*
1787  * The NetStepperCmd controls the stepper motor.
1788  */
1789  typedef struct {
1790  int count; /* The stepper motor count. */
1791  } NetStepperCmd;
1792  /*
1793  * The NetOptCamCntlCmd controls the camera/stepper motor power.
1794  */
1795  typedef struct {
1796  NetEnum target; /* Which device to control */
1797  NetBool on; /* Turn device on/off? */
1798  } NetOptCamCntlCmd;
1799  /*
1800  * The NetOptCamCmd controls miscellaneous camera functions.
1801  */
1802  typedef struct {
1803  NetEnum target; /* The enumerated target of this operation */
1804  NetEnum action; /* The action to take. */
1805  } NetOptCamCmd;
1806  /*
1807  * Enumerate the optical camera target options.
1808  */
1809  typedef enum {
1810  OPTCAM_FRAME, /* Target is the frame grabber */
1811  OPTCAM_CAMERA, /* Controls power to the camera */
1812  OPTCAM_CONTROLLER,/* Commands intended for the controller box. */
1813  OPTCAM_STEPPER, /* Controls power to the stepper motor */
1814  OPTCAM_FOCUS, /* Controls the stepper motor count. */
1815  OPTCAM_IRIS, /* Camera iris commands. */
1816  OPTCAM_SHUT, /* Controls camera shutter speed. */
1817  OPTCAM_SENS_AUTO, /* Electronic sensitivity enhancement. */
1818  OPTCAM_SENS_MANU, /* Electronic sensitivity enhancement. */
1819  OPTCAM_AGC, /* Auto gain control. */
1820  OPTCAM_ALC, /* Auto light control setting. */
1821  OPTCAM_MANU_IRIS, /* Manual Iris (Toggles to ELC?) */
1822  OPTCAM_SUPERD, /* Super D mode */
1823  } OptCamTarget;
1824  /*
1825  * Enumerate the optical camera action options.
1826  */
1827  typedef enum {
1828  OPTCAM_ID=20000,/* Request the controller id. Note that the first element in
1829  this list must be set to 20000 */
1830  OPTCAM_GRAB, /* Tell the frame grabber to take a frame */
1831  OPTCAM_RBC, /* Request the controller to drop buffered commands rbc. */
1832  OPTCAM_OPEN, /* Open the iris */
1833  OPTCAM_CLOSE, /* Close the iris */
1834  OPTCAM_STOP, /* Stop the iris? */
1835  OPTCAM_PRESET, /* Reset the iris, or when used with the
1836  OPTCAM_CAMERA Target, reset the entire camera to
1837  factory presets */
1838  OPTCAM_ON, /* Turn target on */
1839  OPTCAM_OFF, /* Turn target off */
1840  OPTCAM_INC, /* Increment target */
1841  OPTCAM_DEC, /* Decrement target */
1842  OPTCAM_LOW, /* Set the gain to low */
1843  OPTCAM_MID, /* Set the gain to mid */
1844  OPTCAM_HIGH, /* Set the gain to high */
1845  OPTCAM_100, /* Set shutter speed to 1/100 s */
1846  OPTCAM_250, /* Set shutter speed to 1/250 s */
1847  OPTCAM_500, /* Set shutter speed to 1/500 s */
1848  OPTCAM_1000, /* Set shutter speed to 1/1000 s */
1849  OPTCAM_2000, /* Set shutter speed to 1/2000 s */
1850  OPTCAM_4000, /* Set shutter speed to 1/4000 s */
1851  OPTCAM_10000, /* Set shutter speed to 1/10000 s */
1852  OPTCAM_CENTER, /* Move to the peak of the image */
1853  } OptCamAction;
1854 
1855  typedef enum
1856  {
1857  SHUTTER_CLOSED,
1858  SHUTTER_OPEN
1859  } ShutterState;
1860 
1861  typedef struct {
1862  NetEnum target;
1863  NetBool open;
1865 
1866  typedef enum
1867  {
1868  PTEL_HEATER_OFF,
1869  PTEL_HEATER_ON,
1870  PTEL_HEATER_PID,
1871  PTEL_HEATER_TUNE
1872  } PTelHeaterState;
1873 
1874  typedef struct {
1875  NetEnum target;
1876  NetBool on;
1877  NetBool pid;
1878  NetBool tune;
1879  double setpoint;
1880  double proportional;
1881  double integral;
1882  double derivative;
1883  } NetPTelHeaterCmd;
1884 
1885  typedef enum
1886  {
1887  DEICING_HEATER_OFF,
1888  DEICING_HEATER_ON
1889  } DeicingHeaterState;
1890 
1891  typedef struct {
1892  NetEnum target;
1893  NetBool on;
1895 
1896  typedef struct {
1897  NetBool open;
1899 
1900  typedef struct {
1901  NetUint seq; // The sequence number of the transaction that completed
1902  double y1;
1903  double y2;
1904  double y3;
1905  double x4;
1906  double x5;
1907  double z6;
1909 
1910  typedef struct {
1911  NetUint seq; // The sequence number of the transaction that completed
1912  double y1;
1913  double y2;
1914  double y3;
1915  double x4;
1916  double x5;
1917  double z6;
1919 
1920  typedef struct {
1921  NetUint seq; // The sequence number of the transaction that completed
1922  bool use_brakes;
1924 
1925  typedef struct {
1926  NetUint seq; // The sequence number of the transaction that completed
1927  double acquired_threshold;
1929 
1930  typedef struct {
1931  NetUint seq; // The sequence number of the transaction that completed
1932  double focus;
1934 
1935  /*
1936  * The NetFgCmd writes to miscellaneous frame grabber registers.
1937  */
1938  typedef struct {
1939  NetEnum target; /* The enumerated target of this operation */
1940  unsigned int value; /* The value to write to the register */
1941  } NetFgCmd;
1942  /*
1943  * The NetFlatFieldCmd toggles frame grabber flat fielding
1944  */
1945  typedef struct {
1946  NetBool on; /* If true, flat field frame grabber images */
1947  } NetFlatFieldCmd;
1948 
1949  /*
1950  * Enumerate the frame grabber register options.
1951  */
1952  typedef enum {
1953  FG_INCSR1_REG,
1954  FG_INCSR2_REG,
1955  FG_OUTCSR_REG,
1956  FG_CURSOR_REG,
1957  FG_INDEX_REG,
1958  FG_INLUT_REG,
1959  FG_REDGRN_REG,
1960  FG_BLUE_REG,
1961  } FgReg;
1962 
1963  /*
1964  * Enumerate the frame grabber peak options.
1965  */
1966  typedef enum {
1967  PEAK_X,
1968  PEAK_Y,
1969  PEAK_XABS,
1970  PEAK_YABS,
1971  } Peak;
1972 
1973  /*
1974  * Enumerate the frame grabber image statistic options.
1975  */
1976  typedef enum {
1977  IMSTAT_PEAK,
1978  IMSTAT_SNR
1979  } Imstat;
1980 
1984  typedef enum {
1985  FG_NONE = 0x0,
1986  FG_CHAN = 0x1,
1987  FG_COMBINE = 0x2,
1988  FG_FLATFIELD = 0x4,
1989  FG_TAKE_FLATFIELD = 0x8,
1990  FG_INTERVAL = 0x10,
1991  FG_TAKE_IMAGE = 0x20,
1992  FG_SEARCH_BOX = 0x40
1993  } FgOpt;
1994 
1995  /*
1996  * The NetConfigureFrameGrabberCmd configures the frame grabber.
1997  */
1998  typedef struct {
1999  unsigned mask; // The mask of parameters to configure
2000  unsigned channelMask; // The mask of channel numbers to apply
2001  // this configuration to
2002  unsigned nCombine; // The number of frames to combine
2003  unsigned flatfield; // The flatfielding mode
2004  unsigned seconds; // The timeout seconds
2006 
2007  //------------------------------------------------------------
2008  // Downconverter control commands.
2009  //------------------------------------------------------------
2010 
2011  // Set the Psys power
2012 
2013  typedef struct {
2014  double power;
2015  NetBool preset;
2016  NetMask bands;
2017  } NetPsysCmd;
2018 
2019  // Set the Psys attenuation
2020 
2021  typedef struct {
2022  double atten;
2023  NetMask bands;
2024  } NetPsysAttenCmd;
2025 
2026  // Set the Ifout power
2027 
2028  typedef struct {
2029  double power;
2030  NetBool preset;
2031  NetMask bands;
2032  } NetIfoutCmd;
2033 
2034  // Set the Ifout attenuation
2035 
2036  typedef struct {
2037  double atten;
2038  NetMask bands;
2039  } NetIfoutAttenCmd;
2040 
2041  // Enable the RF amplifier
2042 
2043  typedef struct {
2044  bool enable;
2045  NetMask bands;
2046  } NetRfAmpCmd;
2047 
2048  // Enable the IF automatic level control
2049 
2050  typedef struct {
2051  bool enable;
2052  NetMask bands;
2053  } NetIfAlcCmd;
2054 
2055  //-----------------------------------------------------------------------
2056  // Noise source commands.
2057  //-----------------------------------------------------------------------
2058 
2059  // Set the output power
2060 
2061  typedef struct {
2062  double power;
2063  NetBool preset;
2064  } NetNoisePowerCmd;
2065 
2066  // Set the noise source attenuation
2067 
2068  typedef struct {
2069  unsigned short atten;
2070  } NetNoiseAttenCmd;
2071 
2072  // Set the tone (?) attenuation
2073 
2074  typedef struct {
2075  unsigned short atten;
2076  } NetToneAttenCmd;
2077 
2078  //------------------------------------------------------------
2079  // Noise diode commands
2080  //------------------------------------------------------------
2081 
2082  typedef enum {
2083  NOISE_SIMPLE, // Toggle just the noise diode
2084  NOISE_ALL // Toggle noise diode, quadmods, and configure
2085  // the correlator
2086  } NoiseType;
2087 
2088  // Turn the noise source on
2089 
2090  typedef struct {
2091  NetMask mask; // A bitwise union of NoiseType enumerations
2092  bool enable; // True if the noise source is to be enabled
2093  NetUint seq; // The sequence number of the transaction that completed
2094  } NetNoiseCmd;
2095 
2096  // Turn the tone on
2097 
2098  typedef struct {
2099  bool enable;
2100  } NetToneCmd;
2101 
2102  //-----------------------------------------------------------------------
2103  // Quad Mod commands.
2104  //-----------------------------------------------------------------------
2105 
2106  // Set the output power
2107 
2108  typedef struct {
2109  double power;
2110  NetBool preset;
2111  } NetQuadPowerCmd;
2112 
2113  // Set the quad attenuation
2114 
2115  typedef struct {
2116  unsigned short atten;
2117  } NetQuadAttenCmd;
2118 
2119  // Set the quad walsh state column
2120 
2121  typedef struct {
2122  unsigned short column;
2124 
2125  // Turn quad modulation on
2126 
2127  typedef struct {
2128  bool enable;
2129  } NetQuadCmd;
2130 
2131  // Set the quad phase state
2132 
2133  typedef struct {
2134  unsigned short phase;
2135  } NetQuadPhaseCmd;
2136 
2137  //-----------------------------------------------------------------------
2138  // CAN module control
2139  //-----------------------------------------------------------------------
2140 
2141  typedef struct {
2142  NetEnum modules;
2143  NetMask bands;
2144  NetBool hard;
2145  } NetResetCmd;
2146 
2147  //-----------------------------------------------------------------------
2148  // CalTert control
2149  //-----------------------------------------------------------------------
2150 
2151  enum CalTertMsg {
2152  CALTERT_POSITION_CAL,
2153  CALTERT_HOME_TERT,
2154  CALTERT_POSITION_TERT,
2155  CALTERT_ENABLE_TERT,
2156  CALTERT_RESET_STEPPER,
2157  CALTERT_INDEX_TERT,
2158  CALTERT_ONE_WIRE,
2159  CALTERT_SET_ENCODER,
2160  CALTERT_STORE_ENCODER
2161  };
2162 
2163  // Enumerate special values which will signify indexed tertiary positions
2164 
2165  enum TertPos {
2166  TERTPOS_RX30GHZ = 0x10000, // Note that these must all be >= 2^16 (see
2167  // szatypes.c, where they are used)
2168  TERTPOS_RX90GHZ = 0x20000,
2169  TERTPOS_RX230GHZ = 0x40000,
2170  };
2171 
2172  typedef struct {
2173  NetEnum msgId;
2174  NetEnum rxId;
2175  short tertPosition;
2176  NetEnum calPosition;
2177  NetBool enable;
2178  NetEnum owDevice;
2179  NetEnum owCommand;
2180  NetUint seq;
2181  } NetCalTertCmd;
2182 
2183  enum ThermalMsg {
2184  THERMAL_SET_TEMP,
2185  THERMAL_SET_MODE,
2186  THERMAL_SET_LOOP_GAIN,
2187  THERMAL_SET_INTEG_CONST,
2188  THERMAL_SET_LOOP_BW,
2189  THERMAL_SET_RATE_CONST,
2190  THERMAL_SET_PROP_CONST,
2191  THERMAL_SET_VOLTAGE_OFFSET,
2192  THERMAL_SET_EBOX_EQ_STATE,
2193  THERMAL_SET_EBOX_INT_ERROR
2194  };
2195 
2196  typedef struct {
2197  NetEnum msgId;
2198  NetEnum target;
2199  float value;
2200  NetEnum mode;
2201  NetEnum state;
2202  } NetThermalCmd;
2203 
2204  enum {
2205  FILTER_NONE=0x0,
2206  FILTER_FREQ=0x1,
2207  FILTER_NTAP=0x2
2208  };
2209 
2210  typedef struct {
2211  NetMask mask;
2212  double freqHz;
2213  NetUint ntaps;
2214  } NetSetFilterCmd;
2215 
2216  typedef struct {
2217  unsigned seq; // A unique sequence number associated
2218  // with this message
2219  char script[NET_LOG_MAX+1];// The text of the command to be run
2220 
2221  } NetRunScriptCmd;
2222 
2223  typedef struct {
2224  char dir[NET_LOG_MAX+1];// The directory in which to output
2225  // files
2226 
2227  } NetScriptDirCmd;
2228 
2229  // Antenna IntMod command
2230 
2231  enum IntModMsg {
2232  INTMOD_SET_ATTEN,
2233  INTMOD_SET_DEFAULT_ATTEN,
2234  };
2235 
2236  typedef struct {
2237  NetEnum msgId;
2238  unsigned char atten;
2239  } NetIntModCmd;
2240 
2241  // Antenna IF command
2242 
2243  enum IFModMsg {
2244  IFMOD_SET_LEVEL,
2245  IFMOD_SET_ATTEN,
2246  IFMOD_POSITION_SWITCH
2247  };
2248 
2249  typedef struct {
2250  NetEnum msgId;
2251  NetEnum band;
2252  double level;
2253  NetEnum attenSet;
2254  double total;
2255  double input;
2256  double output;
2257  NetUint seq;
2258  } NetIFModCmd;
2259 
2260  enum FlipDelayTarget {
2261  FLIP_DELAY = 0x1,
2262  FLIP_RATE = 0x2,
2263  FLIP_BOTH = FLIP_DELAY | FLIP_RATE
2264  };
2265 
2266  enum DelayTarget {
2267  DELAY_CORR = 0x1,
2268  DELAY_LR = 0x2,
2269  DELAY_ALL = DELAY_CORR | DELAY_LR
2270  };
2271 
2272  typedef struct {
2273  NetEnum target;
2274  NetEnum delayTarget;
2275  bool delay;
2276  bool rate;
2277  } NetFlipDelayCmd;
2278 
2279  /*
2280  * Create a union of the above command containers.
2281  */
2282  typedef union {
2283  NetShutdownCmd shutdown;
2284  NetIntervalCmd interval;
2285  NetInhibitCmd inhibit;
2286  NetSetregCmd setreg;
2287  NetSetDioCmd setdio;
2288  NetUnflagCmd unflag;
2289  NetPhaseMotorCmd phase_motor;
2290  NetPhaseShiftCmd phase_shift;
2291  NetSelectRxCmd selectRx;
2292  NetSetBiasCmd setBias;
2293  NetRxHeaterCmd rx_heater;
2294  NetRxColdheadCmd rx_coldhead;
2295  NetRxTempCmd rx_temp;
2296  NetLoCmd lo;
2297  NetRxQuadCmd rx_quad;
2298  NetRxPolarCmd rx_polar;
2299  NetPolWalshCmd rx_polwalsh;
2300  NetSiteCmd site;
2301  NetLocationCmd location;
2302  NetDelayRefCmd delayref;
2303  NetInitCmd init;
2304  NetHaltCmd halt;
2305  NetSlewCmd slew;
2306  NetTrackCmd track;
2307  NetMountOffsetCmd mount_offset;
2308  NetEquatOffsetCmd equat_offset;
2309  NetTvOffsetCmd tv_offset;
2310  NetTvAngleCmd tv_angle;
2311  NetSkyOffsetCmd sky_offset;
2312  NetUt1UtcCmd ut1utc;
2313  NetEqnEqxCmd eqneqx;
2314  NetEncoderCalsCmd encoder_cals;
2315  NetEncoderLimitsCmd encoder_limits;
2316  NetEncoderZerosCmd encoder_zeros;
2317  NetSlewRateCmd slew_rate;
2318  NetTiltsCmd tilts;
2319  NetFlexureCmd flexure;
2320  NetCollimateCmd collimate;
2321  NetModelCmd model;
2322  NetYearCmd year;
2323  NetDeckModeCmd deckMode;
2324  NetAtmosCmd atmos;
2325  NetFeatureCmd feature;
2326  NetGpibSendCmd gpib_send;
2327  NetGpibReadCmd gpib_read;
2328  NetPowerCmd power;
2329  NetPowerDtCmd power_dt;
2330  NetPowerMeterCmd power_meter;
2331  NetNoiseCalCmd noise_cal;
2332  NetChzrPowerCmd chzr_power;
2333  NetChzrZeroCmd chzr_zero;
2334  NetTpcalCmd tpcal;
2335  NetChzrAttnCmd chzr_attn;
2336  NetChzrSwitchCmd chzr_switch;
2337  NetChzrEnableCmd chzr_enable;
2338  NetRxSimCmd rxsim;
2339  NetThermoCmd thermometer;
2340  NetDsDtCmd ds_dt;
2341  NetStepperCmd stepper;
2342  NetOptCamCmd camera;
2343  NetOptCamCntlCmd optcam_cntl;
2344  NetPTelShutterCmd ptel_shutter;
2345  NetPTelHeaterCmd ptel_heater;
2346  NetDeicingHeaterCmd deicing_heater;
2347  NetCabinShutterCmd cabin_shutter;
2348  NetBenchZeroPositionCmd bench_zero_position;
2349  NetBenchOffsetCmd bench_offset;
2350  NetBenchUseBrakesCmd bench_use_brakes;
2351  NetBenchSetAcquiredThresholdCmd bench_set_acquired_threshold;
2352  NetBenchSetFocusCmd bench_set_focus;
2353  NetFgCmd fg;
2354  NetFlatFieldCmd flatfield;
2355  NetConfigureFrameGrabberCmd configureFrameGrabber;
2356  NetWalshStateCmd walshstate;
2357  NetPagerCmd pager;
2358  NetRebootDriveCmd reboot_drive;
2359 
2360  // Downconverter control
2361 
2362  NetPsysCmd psys;
2363  NetPsysAttenCmd psys_atten;
2364  NetIfoutCmd ifout;
2365  NetIfoutAttenCmd ifout_atten;
2366  NetRfAmpCmd rf_amp;
2367  NetIfAlcCmd if_alc;
2368 
2369  // Noise source control
2370 
2371  NetNoisePowerCmd noise_power;
2372  NetNoiseAttenCmd noise_atten;
2373  NetToneAttenCmd tone_atten;
2374  NetNoiseCmd noise;
2375  NetToneCmd tone;
2376 
2377  // Quad Mod control
2378 
2379  NetQuadPowerCmd quad_power;
2380  NetQuadAttenCmd quad_atten;
2381  NetQuadWalshColCmd quad_walshcol;
2382  NetQuadCmd quad;
2383  NetQuadPhaseCmd quad_phase;
2384 
2385  // CAN module commands
2386 
2387  NetResetCmd reset;
2388  NetFastSamplingCmd fast_sampling;
2389 
2390  // Delay commands
2391 
2392  NetSetAntennaCoordsCmd setAntennaCoords;
2393  NetDDSCmd DDS;
2394  NetSetAntennaDDSCmd setAntennaDDS;
2395  NetSetLRPhaseCmd setLRPhase;
2396  NetSetLRFreqCmd setLRFreq;
2397  NetEnableDDSWalshingCmd enableDDSWalshing;
2398  NetSetDDSWalshColumnCmd setDDSWalshColumn;
2399  NetSetOutputRegsCmd setOutputRegs;
2400  NetSetLRDelayCmd setLRDelay;
2401  NetSetAntennaPhaseCmd setAntennaPhase;
2402  NetSetAntennaFreqCmd setAntennaFreq;
2403 
2404  NetSetAntennaParamsCmd setAntennaParams;
2405  NetSetDelayCmd setDelay;
2406  NetSetWeatherParamsCmd setWeatherParams;
2407  NetUseDelayCmd useDelay;
2408  NetScanCmd scan;
2409 
2410  // CalTert commands
2411 
2412  NetCalTertCmd caltert;
2413 
2414  // Antenna IF command
2415 
2416  NetIFModCmd IFMod;
2417 
2418  // IntMod
2419 
2420  NetIntModCmd intmod;
2421 
2422  // Flip delays
2423 
2424  NetFlipDelayCmd flipDelay;
2425 
2426  // Fringe tracking
2427 
2428  NetFringeTrackingCmd fringeTracking;
2429 
2430  // Thermal commands
2431 
2432  NetThermalCmd thermal;
2433 
2434  // Filter commands
2435 
2436  NetSetFilterCmd setFilter;
2437 
2438  // Script commands
2439 
2440  NetRunScriptCmd runScript;
2441 
2442  // Script commands
2443 
2444  NetScriptDirCmd scriptDir;
2445 
2446  NetGpibCmd gpib;
2447 
2448  NetServoCmd servo;
2449 
2450  NetRxCmd rx;
2451 
2452  NetRoachCmd roach;
2453 
2454  NetLnaCmd lna;
2455 
2456  } NetCmd;
2457 
2458  /*
2459  * Create a structure that merges the above union with a mask of
2460  * antennas for whom the command is intended.
2461  */
2462  struct RtcNetCmd {
2463  NetMask antennas;
2464  NetCmd cmd;
2465  };
2466  }
2467 }
2468 
2469 /*
2470  * The following object description table, defined in rtcnetcoms.c,
2471  * describes the commands that are sent from the control program to
2472  * the real-time controller.
2473  */
2474 extern const NetObjTable rtc_cmd_table;
2475 #endif
2476 
Definition: rtcnetcoms.h:1248
Definition: rtcnetcoms.h:1874
Definition: rtcnetcoms.h:1795
Definition: rtcnetcoms.h:2223
Definition: rtcnetcoms.h:116
Definition: rtcnetcoms.h:1099
unsigned size()
Definition: rtcnetcoms.c:1394
Definition: rtcnetcoms.h:1381
Definition: rtcnetcoms.h:125
Definition: rtcnetcoms.h:676
Definition: rtcnetcoms.h:134
Definition: rtcnetcoms.h:2282
Definition: rtcnetcoms.h:1512
Definition: rtcnetcoms.h:1411
Definition: rtcnetcoms.h:1724
Definition: rtcnetcoms.h:1930
Definition: rtcnetcoms.h:794
Definition: rtcnetcoms.h:2127
Definition: rtcnetcoms.h:1197
Definition: rtcnetcoms.h:55
Definition: rtcnetcoms.h:1467
Definition: rtcnetcoms.h:512
Definition: rtcnetcoms.h:1107
Definition: rtcnetcoms.h:1092
Definition: rtcnetcoms.h:858
Definition: rtcnetcoms.h:2115
Definition: rtcnetcoms.h:1645
Definition: rtcnetcoms.h:957
Definition: rtcnetcoms.h:994
Definition: rtcnetcoms.h:161
Definition: rtcnetcoms.h:1262
Definition: rtcnetcoms.h:1739
Definition: rtcnetcoms.h:840
Definition: rtcnetcoms.h:211
Definition: rtcnetcoms.h:1077
Definition: rtcnetcoms.h:801
Definition: rtcnetcoms.h:1009
Definition: rtcnetcoms.h:1658
Definition: rtcnetcoms.h:1530
Definition: rtcnetcoms.h:1783
Definition: rtcnetcoms.h:1896
Definition: rtcnetcoms.h:519
Definition: rtcnetcoms.h:951
Definition: rtcnetcoms.h:2141
Definition: rtcnetcoms.h:1329
Definition: rtcnetcoms.h:690
Definition: rtcnetcoms.h:1572
Definition: rtcnetcoms.h:2133
Definition: rtcnetcoms.h:1165
Definition: rtcnetcoms.h:1945
Definition: rtcnetcoms.h:180
Definition: rtcnetcoms.h:1599
Definition: rtcnetcoms.h:2210
Definition: rtcnetcoms.h:2028
Definition: rtcnetcoms.h:895
Definition: rtcnetcoms.h:99
Definition: rtcnetcoms.h:1486
Definition: rtcnetcoms.h:2021
Definition: rtcnetcoms.h:2061
Definition: rtcnetcoms.h:1715
Definition: rtcnetcoms.h:152
Definition: rtcnetcoms.h:1697
Definition: rtcnetcoms.h:1301
Definition: rtcnetcoms.h:1115
Definition: rtcnetcoms.h:1344
Definition: rtcnetcoms.h:596
Definition: rtcnetcoms.h:874
Definition: rtcnetcoms.h:588
Definition: rtcnetcoms.h:963
Definition: rtcnetcoms.h:817
Definition: rtcnetcoms.h:1938
Definition: rtcnetcoms.h:1682
Definition: rtcnetcoms.h:1149
Definition: rtcnetcoms.h:881
Definition: rtcnetcoms.h:1998
Definition: rtcnetcoms.h:1590
Definition: rtcnetcoms.h:2043
Definition: rtcnetcoms.h:1520
Definition: rtcnetcoms.h:848
Definition: rtcnetcoms.h:2196
Definition: rtcnetcoms.h:497
Definition: rtcnetcoms.h:913
Definition: rtcnetcoms.h:1500
Definition: rtcnetcoms.h:1802
Definition: rtcnetcoms.h:665
Definition: rtcnetcoms.h:1217
Definition: rtcnetcoms.h:1388
Definition: rtcnetcoms.h:614
Definition: rtcnetcoms.h:2013
Definition: rtcnetcoms.h:1891
Definition: rtcnetcoms.h:490
Definition: rtcnetcoms.h:1920
Definition: rtcnetcoms.h:986
Definition: rtcnetcoms.h:2462
Definition: rtcnetcoms.h:1045
Definition: rtcnetcoms.h:1773
Definition: rtcnetcoms.h:905
Definition: rtcnetcoms.h:1399
Definition: rtcnetcoms.h:773
Definition: rtcnetcoms.h:574
Definition: rtcnetcoms.h:867
Definition: rtcnetcoms.h:464
Definition: netobj.h:69
Definition: rtcnetcoms.h:1582
Definition: rtcnetcoms.h:731
Definition: rtcnetcoms.h:2074
Definition: rtcnetcoms.h:1284
Definition: rtcnetcoms.h:1861
Definition: rtcnetcoms.h:2050
Definition: rtcnetcoms.h:504
Definition: rtcnetcoms.h:1618
Definition: rtcnetcoms.h:808
Definition: rtcnetcoms.h:2249
Definition: rtcnetcoms.h:216
Definition: rtcnetcoms.h:1910
Definition: rtcnetcoms.h:702
Definition: rtcnetcoms.h:1627
Definition: rtcnetcoms.h:627
Definition: rtcnetcoms.h:1138
Definition: rtcnetcoms.h:83
Definition: rtcnetcoms.h:1789
Definition: rtcnetcoms.h:2172
Definition: rtcnetcoms.h:1131
Definition: rtcnetcoms.h:832
Definition: rtcnetcoms.h:170
Definition: rtcnetcoms.h:979
Definition: rtcnetcoms.h:2036
Definition: rtcnetcoms.h:921
Definition: rtcnetcoms.h:91
Definition: rtcnetcoms.h:108
Definition: rtcnetcoms.h:1554
Definition: rtcnetcoms.h:652
Definition: rtcnetcoms.h:1442
Definition: rtcnetcoms.h:2216
Definition: rtcnetcoms.h:640
Definition: rtcnetcoms.h:1428
Definition: rtcnetcoms.h:2236
Definition: rtcnetcoms.h:2108
Definition: rtcnetcoms.h:2098
Definition: rtcnetcoms.h:1455
Definition: rtcnetcoms.h:1900
Definition: rtcnetcoms.h:2090
Definition: rtcnetcoms.h:753
Definition: rtcnetcoms.h:69
Definition: rtcnetcoms.h:143
Definition: rtcnetcoms.h:2068
Definition: rtcnetcoms.h:1318
Definition: rtcnetcoms.h:553
Definition: rtcnetcoms.h:2272
Definition: rtcnetcoms.h:2121
Definition: rtcnetcoms.h:938
Definition: rtcnetcoms.h:540