Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Committer:
jmarkel44
Date:
Tue Sep 20 17:45:57 2016 +0000
Revision:
90:7d9731dec0da
Parent:
89:55ac65d7f206
Child:
91:0e8d76030598
added actingDir;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmarkel44 5:5e77a1db4d45 1 /******************************************************************************
jmarkel44 5:5e77a1db4d45 2 *
jmarkel44 5:5e77a1db4d45 3 * File: SetpointControl.h
jmarkel44 5:5e77a1db4d45 4 * Desciption: ICE Timer Control Class
jmarkel44 5:5e77a1db4d45 5 *
jmarkel44 5:5e77a1db4d45 6 *****************************************************************************/
jmarkel44 5:5e77a1db4d45 7 #ifndef SETPOINTCONTROL_H
jmarkel44 5:5e77a1db4d45 8 #define SETPOINTCONTROL_H
jmarkel44 5:5e77a1db4d45 9
jmarkel44 28:c410a61238bb 10 #include "MbedJSONValue.h"
jmarkel44 5:5e77a1db4d45 11 #include <string>
jmarkel44 46:4cb96ab2d1c8 12
jmarkel44 13:c80c283f9db2 13 using namespace std;
jmarkel44 5:5e77a1db4d45 14
jmarkel44 5:5e77a1db4d45 15 class SetpointControl
jmarkel44 5:5e77a1db4d45 16 {
jmarkel44 5:5e77a1db4d45 17 private:
jmarkel44 5:5e77a1db4d45 18 string controlFile; // name of the control file
jmarkel44 20:653923c2f37a 19 string id; // control identifier
jmarkel44 28:c410a61238bb 20 int priority; // control priority
jmarkel44 20:653923c2f37a 21 string input; // control input
jmarkel44 28:c410a61238bb 22 string output; // control output
jmarkel44 89:55ac65d7f206 23 double setpoint; // setpoint value
jmarkel44 30:738359dfdab1 24 double productFactor;
jmarkel44 90:7d9731dec0da 25 int actingDir; // acting direction
jmarkel44 30:738359dfdab1 26 double highAlert;
jmarkel44 30:738359dfdab1 27 double lowAlert;
jmarkel44 30:738359dfdab1 28 double highFailsafe;
jmarkel44 30:738359dfdab1 29 double lowFailsafe;
jmarkel44 51:66b820f203a5 30 enum State {
jmarkel44 51:66b820f203a5 31 STATE_STARTUP,
jmarkel44 51:66b820f203a5 32 STATE_CONTROL_OFF,
jmarkel44 51:66b820f203a5 33 STATE_CONTROL_ON,
jmarkel44 51:66b820f203a5 34 STATE_DISABLE,
jmarkel44 51:66b820f203a5 35 STATE_PAUSE,
jmarkel44 51:66b820f203a5 36 STATE_MAX
jmarkel44 51:66b820f203a5 37 };
jmarkel44 51:66b820f203a5 38 State currentState;
jmarkel44 28:c410a61238bb 39
jmarkel44 5:5e77a1db4d45 40 public:
jmarkel44 51:66b820f203a5 41 // ctor
jmarkel44 19:9bc8fabeddfa 42 SetpointControl() {};
jmarkel44 51:66b820f203a5 43 // dtor
jmarkel44 12:ea87887ca7ad 44 ~SetpointControl() {
jmarkel44 12:ea87887ca7ad 45 printf("\r%s destructor invoked\n", __func__);
jmarkel44 86:189c125d8878 46 // TODO: unregister the control with the output task
jmarkel44 28:c410a61238bb 47 }
jmarkel44 28:c410a61238bb 48
jmarkel44 86:189c125d8878 49 // load the control data
jmarkel44 28:c410a61238bb 50 bool load(string filename);
jmarkel44 86:189c125d8878 51
jmarkel44 86:189c125d8878 52 // register the control with the output task
jmarkel44 51:66b820f203a5 53 void registerControl(void);
jmarkel44 86:189c125d8878 54
jmarkel44 51:66b820f203a5 55 // unregister the control with the output task
jmarkel44 86:189c125d8878 56 void unregisterControl(void);
jmarkel44 86:189c125d8878 57
jmarkel44 86:189c125d8878 58 // start the control
jmarkel44 51:66b820f203a5 59 void start(void);
jmarkel44 86:189c125d8878 60
jmarkel44 51:66b820f203a5 61 // update the control
jmarkel44 86:189c125d8878 62 void update(void);
jmarkel44 86:189c125d8878 63
jmarkel44 51:66b820f203a5 64 bool underLimit();
jmarkel44 51:66b820f203a5 65 bool overLimit();
jmarkel44 86:189c125d8878 66
jmarkel44 86:189c125d8878 67 // state transition functions
jmarkel44 51:66b820f203a5 68 void startFeed();
jmarkel44 51:66b820f203a5 69 void stopFeed();
jmarkel44 28:c410a61238bb 70
jmarkel44 86:189c125d8878 71 string getControlFile(void) const {
jmarkel44 12:ea87887ca7ad 72 return controlFile;
jmarkel44 12:ea87887ca7ad 73 }
jmarkel44 86:189c125d8878 74 string getId(void) const {
jmarkel44 28:c410a61238bb 75 return id;
jmarkel44 28:c410a61238bb 76 }
jmarkel44 86:189c125d8878 77 unsigned int getPriority(void) const {
jmarkel44 28:c410a61238bb 78 return priority;
jmarkel44 28:c410a61238bb 79 }
jmarkel44 86:189c125d8878 80 string getInput(void) const {
jmarkel44 28:c410a61238bb 81 return input;
jmarkel44 28:c410a61238bb 82 }
jmarkel44 86:189c125d8878 83 string getOutput(void) const {
jmarkel44 28:c410a61238bb 84 return output;
jmarkel44 28:c410a61238bb 85 }
jmarkel44 86:189c125d8878 86 float getProductFactor(void) const {
jmarkel44 28:c410a61238bb 87 return productFactor;
jmarkel44 28:c410a61238bb 88 }
jmarkel44 90:7d9731dec0da 89 int getActingDir(void) const {
jmarkel44 90:7d9731dec0da 90 return actingDir;
jmarkel44 90:7d9731dec0da 91 }
jmarkel44 86:189c125d8878 92 float getSetpoint(void) const {
jmarkel44 86:189c125d8878 93 return setpoint;
jmarkel44 86:189c125d8878 94 }
jmarkel44 86:189c125d8878 95 float getHighAlert(void) const {
jmarkel44 28:c410a61238bb 96 return highAlert;
jmarkel44 28:c410a61238bb 97 }
jmarkel44 86:189c125d8878 98 float getLowAlert(void) const {
jmarkel44 28:c410a61238bb 99 return lowAlert;
jmarkel44 28:c410a61238bb 100 }
jmarkel44 86:189c125d8878 101 float getHighFailsafe(void) const {
jmarkel44 28:c410a61238bb 102 return highFailsafe;
jmarkel44 28:c410a61238bb 103 }
jmarkel44 86:189c125d8878 104 float getLowFailsafe(void) const {
jmarkel44 28:c410a61238bb 105 return lowFailsafe;
jmarkel44 28:c410a61238bb 106 }
jmarkel44 89:55ac65d7f206 107
jmarkel44 86:189c125d8878 108 State getCurrentState(void) const {
jmarkel44 51:66b820f203a5 109 return currentState;
jmarkel44 51:66b820f203a5 110 }
jmarkel44 5:5e77a1db4d45 111 };
jmarkel44 5:5e77a1db4d45 112
jmarkel44 51:66b820f203a5 113 #endif