move from tabs to spaces
This commit is contained in:
parent
a6aad07f05
commit
fa45072998
86 changed files with 2611 additions and 2486 deletions
|
|
@ -14,72 +14,72 @@ Regulator::Regulator(QObject* parent): Actor(parent)
|
|||
|
||||
void Regulator::setSensor(const Sensor sensor)
|
||||
{
|
||||
sensor_ = sensor;
|
||||
sensor_ = sensor;
|
||||
}
|
||||
|
||||
void Regulator::sensorEvent(Sensor sensor)
|
||||
{
|
||||
if(active && sensor == sensor_)
|
||||
{
|
||||
if( sensor.field < setPoint_-band_ && (sensor.field < sensor_.field || sensor_.field > setPoint_-band_ || first) )
|
||||
{
|
||||
sigValue(triggerValue);
|
||||
}
|
||||
else if( sensor.field > setPoint_+band_ && (sensor.field > sensor_.field || sensor_.field < setPoint_+band_ || first) )
|
||||
{
|
||||
sigValue(!triggerValue);
|
||||
}
|
||||
first = false;
|
||||
sensor_ = sensor;
|
||||
}
|
||||
if(active && sensor == sensor_)
|
||||
{
|
||||
if( sensor.field < setPoint_-band_ && (sensor.field < sensor_.field || sensor_.field > setPoint_-band_ || first) )
|
||||
{
|
||||
sigValue(triggerValue);
|
||||
}
|
||||
else if( sensor.field > setPoint_+band_ && (sensor.field > sensor_.field || sensor_.field < setPoint_+band_ || first) )
|
||||
{
|
||||
sigValue(!triggerValue);
|
||||
}
|
||||
first = false;
|
||||
sensor_ = sensor;
|
||||
}
|
||||
}
|
||||
|
||||
void Regulator::setPoint(float setPoint)
|
||||
{
|
||||
setPoint_ = setPoint;
|
||||
setPoint_ = setPoint;
|
||||
}
|
||||
|
||||
void Regulator::setBand ( float band )
|
||||
{
|
||||
band_ = band;
|
||||
band_ = band;
|
||||
}
|
||||
|
||||
void Regulator::setInvert( bool invert )
|
||||
{
|
||||
invert_ = invert;
|
||||
invert_ = invert;
|
||||
}
|
||||
|
||||
void Regulator::store(QJsonObject& json)
|
||||
{
|
||||
json["Type"] = "Regulator";
|
||||
Actor::store(json);
|
||||
json["Band"] = band_;
|
||||
json["SetPoint"] = setPoint_;
|
||||
json["SensorType"] = static_cast<int>(sensor_.type);
|
||||
json["SensorId"] = static_cast<int>(sensor_.id);
|
||||
json["SensorField"] = sensor_.field;
|
||||
json["SensorName"] = sensor_.name;
|
||||
json["Type"] = "Regulator";
|
||||
Actor::store(json);
|
||||
json["Band"] = band_;
|
||||
json["SetPoint"] = setPoint_;
|
||||
json["SensorType"] = static_cast<int>(sensor_.type);
|
||||
json["SensorId"] = static_cast<int>(sensor_.id);
|
||||
json["SensorField"] = sensor_.field;
|
||||
json["SensorName"] = sensor_.name;
|
||||
}
|
||||
|
||||
void Regulator::load(const QJsonObject& json, bool preserve)
|
||||
{
|
||||
Actor::load(json, preserve);
|
||||
band_ = json["Band"].toDouble(1);
|
||||
setPoint_ = json["SetPoint"].toDouble(22);
|
||||
sensor_.type = json["SensorType"].toInt(0);
|
||||
sensor_.id = json["SensorId"].toInt(0);
|
||||
sensor_.field = json["SensorField"].toInt(0);
|
||||
sensor_.name = json["SensorName"].toString("Sensor");
|
||||
Actor::load(json, preserve);
|
||||
band_ = json["Band"].toDouble(1);
|
||||
setPoint_ = json["SetPoint"].toDouble(22);
|
||||
sensor_.type = json["SensorType"].toInt(0);
|
||||
sensor_.id = json["SensorId"].toInt(0);
|
||||
sensor_.field = json["SensorField"].toInt(0);
|
||||
sensor_.name = json["SensorName"].toString("Sensor");
|
||||
}
|
||||
|
||||
QString Regulator::getName() const
|
||||
{
|
||||
if(name_.size() > 0) return name_;
|
||||
else
|
||||
{
|
||||
QString string;
|
||||
string = "Regulate \"" + sensor_.name + "\" to ";
|
||||
string.append(QString::number(setPoint_) + " ");
|
||||
return string;
|
||||
}
|
||||
if(name_.size() > 0) return name_;
|
||||
else
|
||||
{
|
||||
QString string;
|
||||
string = "Regulate \"" + sensor_.name + "\" to ";
|
||||
string.append(QString::number(setPoint_) + " ");
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue