Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
src/ConfigurationHandler/Controls/SetpointControl.h@86:189c125d8878, 2016-09-20 (annotated)
- Committer:
- jmarkel44
- Date:
- Tue Sep 20 15:40:11 2016 +0000
- Revision:
- 86:189c125d8878
- Parent:
- 51:66b820f203a5
- Child:
- 89:55ac65d7f206
minor command tweaks and setpoint added to object
Who changed what in which revision?
User | Revision | Line number | New 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 | 20:653923c2f37a | 20 | string name; // friendly name |
jmarkel44 | 28:c410a61238bb | 21 | int priority; // control priority |
jmarkel44 | 20:653923c2f37a | 22 | string input; // control input |
jmarkel44 | 28:c410a61238bb | 23 | string output; // control output |
jmarkel44 | 30:738359dfdab1 | 24 | double productFactor; |
jmarkel44 | 86:189c125d8878 | 25 | double setpoint; // setpoint value |
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 | 30:738359dfdab1 | 30 | double tol; |
jmarkel44 | 51:66b820f203a5 | 31 | enum State { |
jmarkel44 | 51:66b820f203a5 | 32 | STATE_STARTUP, |
jmarkel44 | 51:66b820f203a5 | 33 | STATE_CONTROL_OFF, |
jmarkel44 | 51:66b820f203a5 | 34 | STATE_CONTROL_ON, |
jmarkel44 | 51:66b820f203a5 | 35 | STATE_DISABLE, |
jmarkel44 | 51:66b820f203a5 | 36 | STATE_PAUSE, |
jmarkel44 | 51:66b820f203a5 | 37 | STATE_MAX |
jmarkel44 | 51:66b820f203a5 | 38 | }; |
jmarkel44 | 51:66b820f203a5 | 39 | State currentState; |
jmarkel44 | 28:c410a61238bb | 40 | |
jmarkel44 | 5:5e77a1db4d45 | 41 | public: |
jmarkel44 | 51:66b820f203a5 | 42 | // ctor |
jmarkel44 | 19:9bc8fabeddfa | 43 | SetpointControl() {}; |
jmarkel44 | 51:66b820f203a5 | 44 | // dtor |
jmarkel44 | 12:ea87887ca7ad | 45 | ~SetpointControl() { |
jmarkel44 | 12:ea87887ca7ad | 46 | printf("\r%s destructor invoked\n", __func__); |
jmarkel44 | 86:189c125d8878 | 47 | // TODO: unregister the control with the output task |
jmarkel44 | 28:c410a61238bb | 48 | } |
jmarkel44 | 28:c410a61238bb | 49 | |
jmarkel44 | 86:189c125d8878 | 50 | // load the control data |
jmarkel44 | 28:c410a61238bb | 51 | bool load(string filename); |
jmarkel44 | 86:189c125d8878 | 52 | |
jmarkel44 | 86:189c125d8878 | 53 | // register the control with the output task |
jmarkel44 | 51:66b820f203a5 | 54 | void registerControl(void); |
jmarkel44 | 86:189c125d8878 | 55 | |
jmarkel44 | 51:66b820f203a5 | 56 | // unregister the control with the output task |
jmarkel44 | 86:189c125d8878 | 57 | void unregisterControl(void); |
jmarkel44 | 86:189c125d8878 | 58 | |
jmarkel44 | 86:189c125d8878 | 59 | // start the control |
jmarkel44 | 51:66b820f203a5 | 60 | void start(void); |
jmarkel44 | 86:189c125d8878 | 61 | |
jmarkel44 | 51:66b820f203a5 | 62 | // update the control |
jmarkel44 | 86:189c125d8878 | 63 | void update(void); |
jmarkel44 | 86:189c125d8878 | 64 | |
jmarkel44 | 51:66b820f203a5 | 65 | bool underLimit(); |
jmarkel44 | 51:66b820f203a5 | 66 | bool overLimit(); |
jmarkel44 | 86:189c125d8878 | 67 | |
jmarkel44 | 86:189c125d8878 | 68 | // state transition functions |
jmarkel44 | 51:66b820f203a5 | 69 | void startFeed(); |
jmarkel44 | 51:66b820f203a5 | 70 | void stopFeed(); |
jmarkel44 | 28:c410a61238bb | 71 | |
jmarkel44 | 86:189c125d8878 | 72 | string getControlFile(void) const { |
jmarkel44 | 12:ea87887ca7ad | 73 | return controlFile; |
jmarkel44 | 12:ea87887ca7ad | 74 | } |
jmarkel44 | 86:189c125d8878 | 75 | string getId(void) const { |
jmarkel44 | 28:c410a61238bb | 76 | return id; |
jmarkel44 | 28:c410a61238bb | 77 | } |
jmarkel44 | 86:189c125d8878 | 78 | string getName(void) const { |
jmarkel44 | 28:c410a61238bb | 79 | return name; |
jmarkel44 | 28:c410a61238bb | 80 | } |
jmarkel44 | 86:189c125d8878 | 81 | unsigned int getPriority(void) const { |
jmarkel44 | 28:c410a61238bb | 82 | return priority; |
jmarkel44 | 28:c410a61238bb | 83 | } |
jmarkel44 | 86:189c125d8878 | 84 | string getInput(void) const { |
jmarkel44 | 28:c410a61238bb | 85 | return input; |
jmarkel44 | 28:c410a61238bb | 86 | } |
jmarkel44 | 86:189c125d8878 | 87 | string getOutput(void) const { |
jmarkel44 | 28:c410a61238bb | 88 | return output; |
jmarkel44 | 28:c410a61238bb | 89 | } |
jmarkel44 | 86:189c125d8878 | 90 | float getProductFactor(void) const { |
jmarkel44 | 28:c410a61238bb | 91 | return productFactor; |
jmarkel44 | 28:c410a61238bb | 92 | } |
jmarkel44 | 86:189c125d8878 | 93 | float getSetpoint(void) const { |
jmarkel44 | 86:189c125d8878 | 94 | return setpoint; |
jmarkel44 | 86:189c125d8878 | 95 | } |
jmarkel44 | 86:189c125d8878 | 96 | float getHighAlert(void) const { |
jmarkel44 | 28:c410a61238bb | 97 | return highAlert; |
jmarkel44 | 28:c410a61238bb | 98 | } |
jmarkel44 | 86:189c125d8878 | 99 | float getLowAlert(void) const { |
jmarkel44 | 28:c410a61238bb | 100 | return lowAlert; |
jmarkel44 | 28:c410a61238bb | 101 | } |
jmarkel44 | 86:189c125d8878 | 102 | float getHighFailsafe(void) const { |
jmarkel44 | 28:c410a61238bb | 103 | return highFailsafe; |
jmarkel44 | 28:c410a61238bb | 104 | } |
jmarkel44 | 86:189c125d8878 | 105 | float getLowFailsafe(void) const { |
jmarkel44 | 28:c410a61238bb | 106 | return lowFailsafe; |
jmarkel44 | 28:c410a61238bb | 107 | } |
jmarkel44 | 86:189c125d8878 | 108 | float getTol(void) const { |
jmarkel44 | 28:c410a61238bb | 109 | return tol; |
jmarkel44 | 20:653923c2f37a | 110 | } |
jmarkel44 | 86:189c125d8878 | 111 | State getCurrentState(void) const { |
jmarkel44 | 51:66b820f203a5 | 112 | return currentState; |
jmarkel44 | 51:66b820f203a5 | 113 | } |
jmarkel44 | 5:5e77a1db4d45 | 114 | }; |
jmarkel44 | 5:5e77a1db4d45 | 115 | |
jmarkel44 | 51:66b820f203a5 | 116 | #endif |