From 1c5fb7408c88f46e96fa57a3293455ff48858568 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Mon, 28 Mar 2011 18:26:14 +0000 Subject: [PATCH] New file --- motorApp/MotorSimSrc/motorSimDriver.h | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 motorApp/MotorSimSrc/motorSimDriver.h diff --git a/motorApp/MotorSimSrc/motorSimDriver.h b/motorApp/MotorSimSrc/motorSimDriver.h new file mode 100644 index 00000000..3f63c006 --- /dev/null +++ b/motorApp/MotorSimSrc/motorSimDriver.h @@ -0,0 +1,68 @@ +/* +FILENAME... motorSimController.h +USAGE... Simulated Motor Support. + +Based on drvMotorSim.c + +Mark Rivers +March 28, 2010 + +*/ + + +#include +#include + +#include "asynMotorDriver.h" +#include "route.h" + +#define NUM_SIM_CONTROLLER_PARAMS 0 + +class motorSimAxis +{ +public: + motorSimAxis(class motorSimController *pController, int axis, double lowLimit, double hiLimit, double home, double start); + asynStatus velocity(double velocity, double acceleration); + class motorSimController *pController_; + int axis_; + ROUTE_ID route_; + route_reroute_t reroute_; + route_demand_t endpoint_; + route_demand_t nextpoint_; + double lowHardLimit_; + double hiHardLimit_; + double enc_offset_; + double home_; + int homing_; + epicsTimeStamp tLast_; + double deferred_position_; + int deferred_move_; + int deferred_relative_; + friend class motorSimController; +}; + +class motorSimController : asynMotorController { +public: + motorSimController(const char *portName, int numAxes, int priority, int stackSize); + asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value); + asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value); + void report(FILE *fp, int level); + asynStatus moveAxis(asynUser *pasynUser, double position, int relative, double min_velocity, double max_velocity, double acceleration); + asynStatus moveVelocityAxis(asynUser *pasynUser, double min_velocity, double max_velocity, double acceleration); + asynStatus homeAxis(asynUser *pasynUser, double min_velocity, double max_velocity, double acceleration, int forwards); + asynStatus stopAxis(asynUser *pasynUser, double acceleration); + asynStatus profileMove(asynUser *pasynUser, int npoints, double positions[], double times[], int relative, int trigger); + asynStatus triggerProfile(asynUser *pasynUser); + asynStatus configAxis(int axis, int hiHardLimit, int lowHardLimit, int home, int start); + void motorSimTask(); // Should be pivate, but called from non-member function + +private: + motorSimAxis* getAxis(asynUser *pasynUser); + void process(motorSimAxis *pAxis, double delta ); + asynStatus processDeferredMoves(); + epicsThreadId motorThread_; + epicsTimeStamp now_; + int movesDeferred_; + int numAxes_; + motorSimAxis** pAxes_; +};