Files
sinqepicsapp/sinqEPICSApp/src/PhytronDriver.h
koennecke 72afd02b4e Many improvements to the MasterMACS motor driver. It is working but the hardware is shaky.
Added support for dose rate controlled Phytron motors. Not tested!
Small bug fixes
2023-05-31 09:13:41 +02:00

110 lines
2.9 KiB
C++

/*
FILENAME... PhytronDriver.h
USAGE... Motor driver support for the Phytron MCC-2 motor controller.
Mark Koennecke
September 2016
Updated to go through SINQAxis for -MsgTxt support
Added a selector to support multiple phytrons on a connection
Mark Koennecke, January 2019
Added PhytronDoseAxis. The speed of this axis is controlled by the
neutron dose rate fed in as analog signal
Mark Koennecke, April 2023
*/
#include "SINQController.h"
#include "SINQAxis.h"
#define COMLEN 80
class PhytronController;
class PhytronDoseController;
class PhytronAxis : public SINQAxis
{
public:
/* These are the methods we override from the base class */
PhytronAxis(class PhytronController *pC, int axis, int enc);
void report(FILE *fp, int level);
asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration);
asynStatus moveVelocity(double min_velocity, double max_velocity, double acceleration);
asynStatus home(double min_velocity, double max_velocity, double acceleration, int forwards);
asynStatus stop(double acceleration);
asynStatus poll(bool *moving);
asynStatus setPosition(double position);
asynStatus setClosedLoop(bool closedLoop);
int setBrake(int brakeIO);
protected:
char phytronChar;
PhytronController *pC_; /**< Pointer to the asynMotorController to which this axis belongs.
* Abbreviated because it is used very frequently */
double position;
int homing;
int homing_direction; /*1 forward, 0 backwards */
time_t next_poll;
int encoder;
int haveBrake;
int brakeIO;
friend class PhytronController;
};
class PhytronDoseAxis : public PhytronAxis
{
// A special version of PhytronAxis where the speed is controlled by the neutron flux.
public:
PhytronDoseAxis(class PhytronController *pC, int axis, int enc);
asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration);
friend class PhytronDoseController;
protected:
char doseChar;
PhytronDoseController *pC_;
};
class PhytronController : public SINQController {
public:
PhytronController(const char *portName, const char *PhytronPortName, const char *selector,
int encX, int encY);
void report(FILE *fp, int level);
PhytronAxis* getAxis(asynUser *pasynUser);
PhytronAxis* getAxis(int axisNo);
friend class PhytronAxis;
protected:
asynUser *pasynUserController_;
asynStatus transactController(int axisNo, char command[COMLEN], char reply[COMLEN]);
const char *selector;
};
class PhytronDoseController : public PhytronController {
public:
PhytronDoseController(const char *portName, const char *PhytronPortName, const char *selector,
int encX, int encY);
PhytronDoseAxis* getAxis(asynUser *pasynUser);
PhytronDoseAxis* getAxis(int axisNo);
friend class PhytronDoseAxis;
protected:
asynUser *pasynUserController_;
const char *selector;
};