Skip to content
Snippets Groups Projects

add a chiller_cycle tool

Open Zhicai Zhang requested to merge zhicaiz/labRemote:zz_chillerRC211C0 into devel
Files
3
@@ -11,8 +11,10 @@ REGISTER_CHILLER(SPSRC211)
SPSRC211::SPSRC211(const std::string& name) : IChiller(name, {"SPSRC211"}) {}
void SPSRC211::init() {
logger(logINFO) << "Initialize chiller ... ";
command("POLL"); // verify establishment of communication
command("DEGREES=0"); // set temperature unit to be Celsius
command("CLRALARM"); // clear alarm
int faultcode = getFaultStatus();
if (faultcode != 0) {
@@ -59,13 +61,14 @@ std::string SPSRC211::command(const std::string& cmd) {
float SPSRC211::parseString(const std::string& output) {
// example output: F044=+0021.78!
// need to return +21.78
if (output.length() != 14 || output[4] != '=' || output[13] != '!') {
size_t idx_equal = output.find("=");
if (idx_equal == std::string::npos) {
logger(logERROR) << __PRETTY_FUNCTION__
<< " -> Received an invalid output from chiller: "
<< output;
throw std::runtime_error("Received an invalid output from chiller");
}
return std::stof(output.substr(5, 8));
return std::stof(output.substr(idx_equal+1, 8));
}
void SPSRC211::turnOn() {
@@ -82,6 +85,8 @@ void SPSRC211::turnOff() {
command("STOP");
logger(logDEBUG) << "Chiller has been turned "
<< (getStatus() ? "ON" : "OFF");
logger(logWARNING)
<< "For safety reasons, please wait 1 min before turning back ON";
}
void SPSRC211::setRampRate(float RR) {
Loading