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.
Diff: ICE-Application/src/ConfigurationHandler/Controls/SetpointControl.h
- Revision:
- 2:02cb20446785
- Parent:
- 1:b2e90cda7a5a
--- a/ICE-Application/src/ConfigurationHandler/Controls/SetpointControl.h Tue Jan 24 19:06:45 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/******************************************************************************
- *
- * File: SetpointControl.h
- * Desciption: ICE Timer Control Class
- *
- *****************************************************************************/
-#ifndef SETPOINTCONTROL_H
-#define SETPOINTCONTROL_H
-
-#include <string>
-#include <stdio.h>
-
-typedef enum {
- SETPOINT_CONTROL_OK,
- SETPOINT_CONTROL_UNK_STATE,
- SETPOINT_CONTROL_ERROR,
- SETPOINT_CONTROL_DESTROY
-} SetpointControlError_t;
-
-// A setpoint control is a control based on a process variable with respect
-// to a user defined control band. The output of this control object is a
-// true/false decision (for a relay, true means power on the relay).
-
-//! SetpointControl - implements a setpoint control
-class SetpointControl
-{
-private:
- std::string controlFile; // name of the control file
- std::string id; // control identifier
- int priority; // control priority
- std::string input; // control input
- std::string output; // control output
- double setpoint; // setpoint value
- double productFactor;
- bool actingDir; // acting direction, 1 direct - pH, 0 indirect - inhibitor
-#if 0
- double highAlert;
- double lowAlert;
- double highFailsafe;
- double lowFailsafe;
-#endif
- double tolerance; // the error margining
- enum State {
- STATE_INIT,
- STATE_STARTUP,
- STATE_CONTROL_OFF,
- STATE_CONTROL_ON,
- STATE_DISABLE,
- STATE_RELOAD,
- STATE_MAX
- };
- State currentState;
-
- bool validateControlData(const char *buf);
- void copyControlData(const char *buf);
-
- bool underLimit(); // check if reading is under the limit
- bool overLimit(); // check if reading is over the limit
-
- void startFeed(void); // start a feed
- void stopFeed(void); // stop a feed
-
- bool isVirtualOutput; // output is virtual
-public:
- /// create a setpoint control
- SetpointControl() {
- currentState = STATE_INIT;
- };
- /// destroy a setpoint control
- ~SetpointControl() {
- printf("\r%s invoked\n", __func__);
- }
-
- /// load setpoint control data from a JSON configuration file
- bool load(std::string filename);
-
- /// unregister a setpoint control from the output thread
- void unregisterControl(void);
-
- /// start a setpoint control instance
- void start(void);
-
- /// update a setpoint control instance
- SetpointControlError_t update(void);
-
- //display the pertinents
- void display(void);
-
- std::string getControlFile(void) const {
- return controlFile;
- }
- std::string getId(void) const {
- return id;
- }
- unsigned int getPriority(void) const {
- return priority;
- }
- std::string getInput(void) const {
- return input;
- }
- std::string getOutput(void) const {
- return output;
- }
- float getProductFactor(void) const {
- return productFactor;
- }
- int getActingDir(void) const {
- return actingDir;
- }
- float getSetpoint(void) const {
- return setpoint;
- }
-
- State getCurrentState(void) const {
- return currentState;
- }
-};
-
-#endif
\ No newline at end of file