CARMA C++
SisReceiver.h
Go to the documentation of this file.
1 
11 #ifndef CARMA_ANTENNA_COMMON_SISRECEIVER_H
12 #define CARMA_ANTENNA_COMMON_SISRECEIVER_H
13 
14 // Carma includes
16 #include "carma/canbus/Types.h"
17 #include "carma/util/PthreadMutex.h"
18 
19 // C++ Standard Library Includes
20 #include <map>
21 
22 
23 namespace log4cpp {
24  // Forward dec
25  class Category;
26 } // End namespace log4cpp
27 
28 namespace carma {
29 
30 namespace monitor {
31  class AntennaCommon;
32  class SisReceiver;
33  class StateMonitorPointEnum;
34  class Xac;
35 } // End namespace monitor
36 
37 namespace antenna {
38 namespace common {
39 
40 class AntennaIF;
41 
46 public:
47 
60  carma::monitor::AntennaCommon & antCommon,
61  carma::monitor::StateMonitorPointEnum & state,
62  carma::monitor::SisReceiver & sis,
63  carma::monitor::Xac & xac,
65 
69  virtual ~SisReceiver();
70 
78 
87 
99  bool sim);
100 
107 
113  void updateFrameData();
114 
115  // Public control commands.
122  void tuneMixer( float frequencyInGhz ) const;
123 
129  void setVj( float VjInMilliVolts ) const;
130 
136  void setIj( float IjInMicroAmps ) const;
137 
143  void setLoAttenuation( float loAttenPercent ) const;
144 
151  void setVd( short stageNo, float VdInVolts ) const;
152 
159  void setId( short stageNo, float IdInMilliAmps ) const;
160 
167  void setVg( short stageNo, float Vg ) const;
168 
186  void doIVCurve( float startInMilliVolts,
187  float stopInMilliVolts,
188  float stepInMilliVolts,
189  int timeDeltaMilliSeconds,
190  int seqNo,
191  bool doPower );
192 
196  typedef enum {
197  STORED = 0x00,
198  MESSAGE = 0x01,
199  IV_CURVE = 0x02
200  } CurrentModeType;
201 
210  void getVgap( CurrentModeType mode, float Igap ) const;
211 
218  void setIgap( float Igap ) const;
219 
223  typedef enum {
224  VJ_CLOSED = 0x00,
225  VJ_OPEN = 0x01,
226  VJ_FINITE = 0x02
227  } VjLoopModeType;
228 
235  void setVjLoopMode(VjLoopModeType mode) const;
236 
240  typedef enum {
241  IJ_CLOSED = 0x00,
242  IJ_FINITE = 0x01
243  } IjLoopModeType;
244 
245  // These IV Curve definitions exist independently from the idl definitions
246  // to maintain separation of canbus device impls from specific control
247  // communication mechanisms.
248 
255  void setIjLoopMode(IjLoopModeType mode) const;
256 
260  struct IVPoint {
261  double fjd;
262  float Ij;
263  float Vj;
264  };
265 
266  typedef ::std::vector< IVPoint > IVDataVec;
267 
271  struct IVCurve {
272  IVDataVec data;
273  bool doPowerRequested;
274  IVCurve( ) : doPowerRequested( false ) { };
275  };
276 
284 
285  static const carma::canbus::msgType RX_3MM_LEFT_POL_NODE_ID = 1;
286  static const carma::canbus::msgType RX_3MM_RIGHT_POL_NODE_ID = 2;
287  static const carma::canbus::msgType RX_1MM_LEFT_POL_NODE_ID = 3;
288  static const carma::canbus::msgType RX_1MM_RIGHT_POL_NODE_ID = 4;
289 
290 protected:
291 
292  // Method to process IV Curve Point
293  virtual void processIVCurvePoint(carma::canbus::DataVector &data);
294  virtual void processBlankingFramePacket1(carma::canbus::DataVector &data);
295  virtual void processBlankingFramePacket3(carma::canbus::DataVector &data);
296 
297 private:
298 
299  // Copying or assignment not allowed.
300  SisReceiver(const SisReceiver &);
301  SisReceiver &operator=(const SisReceiver &);
302 
303  // Methods to process individual blanking frame packets.
304  virtual void processBlankingFramePacket2(carma::canbus::DataVector &data);
305  virtual void processBlankingFramePacket4(carma::canbus::DataVector &data);
306  virtual void processBlankingFramePacket5(carma::canbus::DataVector &data);
307  virtual void processBlankingFramePacket6(carma::canbus::DataVector &data);
308  virtual void processBlankingFramePacket7(carma::canbus::DataVector &data);
309  virtual void processBlankingFramePacket8(carma::canbus::DataVector &data);
310 
311 
312  // Methods to produce individual simulated blanking frame CAN packets.
313  carma::canbus::Message simBlankingFramePacket1();
314  carma::canbus::Message simBlankingFramePacket2();
315  carma::canbus::Message simBlankingFramePacket3();
316  carma::canbus::Message simBlankingFramePacket4();
317  carma::canbus::Message simBlankingFramePacket5();
318  carma::canbus::Message simBlankingFramePacket6();
319  carma::canbus::Message simBlankingFramePacket7();
320  carma::canbus::Message simBlankingFramePacket8();
321 
322  // Member variables
323  log4cpp::Category &log_; // Reference to system logger.
324  carma::monitor::AntennaCommon & common_;
325  carma::monitor::StateMonitorPointEnum & state_;
326  carma::monitor::SisReceiver & mon_;
327  carma::monitor::Xac & xacMon_;
328 
329  IVCurve ivCurve_; // Last IV curve.
330  carma::util::PthreadMutex ivCurveMutex_; // Mutex protecting it..
331 
332  // Structure to facilitate the collection of IV Curve points and
333  // assembly into a complete IV curve.
334  typedef struct {
335  int pendingSequenceNumber;
336  unsigned int nPointsExpected;
337  unsigned int nPointsReceived;
338  IVCurve tempIVCurve; // Temporary IV curve.
339  carma::util::PthreadMutex mutex; // Mutex to protect shared data.
340  } IVCurveCollationInfo;
341 
342  IVCurveCollationInfo ivCurveCollationInfo_;
344 
345 }; // End class SisReceiver
346 }}} // End namespace carma::antenna::common
347 #endif
void setIjLoopMode(IjLoopModeType mode) const
Set Ij Loop Mode Determines whether the current in the mixer is controlled continuously or periodical...
void setVd(short stageNo, float VdInVolts) const
Set Vd.
Continuous adjustment of Ij to set value.
Definition: SisReceiver.h:241
IjLoopModeType
Ij Loop Mode Enumerator.
Definition: SisReceiver.h:240
virtual ~SisReceiver()
Destructor.
carma::canbus::MsgBriefMap getHalfSecMonitors() const
Retrieve brief description of this devices half second monitor points.
carma::canbus::MsgBriefMap getSlowMonitors() const
Retrieve brief description of this devices slow (5 second) monitor points.
void processMsg(carma::canbus::msgType mid, carma::canbus::DataVector &data, bool sim)
Process a CAN message from the SisReceiver module.
Declarations of carma::canbus types.
10m &amp; 6m SIS Receiver Control CAN module device class.
Definition: SisReceiver.h:45
Base Antenna IF CAN module device class.
Definition: AntennaIF.h:46
Class to encapsulate a CAN message.
Definition: Message.h:21
Continuous adjustment of Vj to set value.
Definition: SisReceiver.h:224
void setLoAttenuation(float loAttenPercent) const
Set LO attenuation Sets the LO attenuation.
void setIgap(float Igap) const
Set Igap Sets the value of current to be used as the default for Igap measurements.
CurrentModeType
Current Mode Enumerator.
Definition: SisReceiver.h:196
XacDevice canbus::device class implementation.
Definition: XacDevice.h:37
double fjd
Fractional Julian Day.
Definition: SisReceiver.h:261
void setIj(float IjInMicroAmps) const
Set Ij Sets the SIS junction current.
void setVj(float VjInMilliVolts) const
Set Vj.
void getVgap(CurrentModeType mode, float Igap) const
Get Vgap Measures the junction gap voltage, which is reported in the blanking frames.
Use value stored in module.
Definition: SisReceiver.h:197
unsigned short nodeType
Carma Node Type id type.
Definition: Types.h:66
::std::map< ::carma::canbus::msgType,::std::string > MsgBriefMap
Alias for message descriptions keyed by message id.
Definition: Types.h:74
carma::canbus::Message simulateMsg(carma::canbus::msgType mid)
Simulate a CAN message for the given message id.
SisReceiver(carma::canbus::nodeType node, carma::canbus::CanOutput &io, carma::monitor::AntennaCommon &antCommon, carma::monitor::StateMonitorPointEnum &state, carma::monitor::SisReceiver &sis, carma::monitor::Xac &xac, carma::antenna::common::AntennaIF &antIF)
Constructor.
Use a fixed number of iterations.
Definition: SisReceiver.h:226
::std::vector< ::carma::canbus::byteType > DataVector
Alias for CAN data.
Definition: Types.h:72
void doIVCurve(float startInMilliVolts, float stopInMilliVolts, float stepInMilliVolts, int timeDeltaMilliSeconds, int seqNo, bool doPower)
Do IV-Curve Measures and reports the junction IV-curve.
void tuneMixer(float frequencyInGhz) const
Tune mixer.
VjLoopModeType
Loop Mode Enumerator.
Definition: SisReceiver.h:223
carma::canbus::devices::XacDevice class declaration.
void setVjLoopMode(VjLoopModeType mode) const
Set Vj Loop Mode Determines whether the voltage on the mixer is controlled open or or closed (softwar...
Use a fixed number of iterations.
Definition: SisReceiver.h:242
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41
unsigned short msgType
Carma Message id type.
Definition: Types.h:69
void setId(short stageNo, float IdInMilliAmps) const
Set Id.
IVCurve getIVCurve()
Retrieve IV Curve.
CanOutput interface.
Definition: CanOutput.h:26
void setVg(short stageNo, float Vg) const
Set Vg.
void updateFrameData()
Update Frame Data.
DAC is set to nominal value for mixer voltage.
Definition: SisReceiver.h:225
Determine current from IV-curve measurement.
Definition: SisReceiver.h:199