it compiles again
This commit is contained in:
@ -8,17 +8,16 @@
|
||||
|
||||
object_id_t Fuse::powerSwitchId = 0;
|
||||
|
||||
Fuse::Fuse(object_id_t fuseObjectId, uint8_t fuseId, VariableIds ids,
|
||||
Fuse::Fuse(object_id_t fuseObjectId, uint8_t fuseId,
|
||||
sid_t variableSet, VariableIds ids,
|
||||
float maxCurrent, uint16_t confirmationCount) :
|
||||
SystemObject(fuseObjectId), oldFuseState(0), fuseId(fuseId), powerIF(
|
||||
NULL),
|
||||
SystemObject(fuseObjectId), oldFuseState(0), fuseId(fuseId),
|
||||
currentLimit(fuseObjectId, 1, ids.pidCurrent, confirmationCount,
|
||||
maxCurrent, FUSE_CURRENT_HIGH),
|
||||
powerMonitor(fuseObjectId, 2,
|
||||
GlobalDataPool::poolIdAndPositionToPid(ids.poolIdPower, 0),
|
||||
powerMonitor(fuseObjectId, 2, ids.poolIdPower,
|
||||
confirmationCount),
|
||||
set(), voltage(ids.pidVoltage, &set), current(ids.pidCurrent, &set),
|
||||
state(ids.pidState, &set),
|
||||
set(variableSet), voltage(ids.pidVoltage, &set),
|
||||
current(ids.pidCurrent, &set), state(ids.pidState, &set),
|
||||
power(ids.poolIdPower, &set, PoolVariableIF::VAR_READ_WRITE),
|
||||
parameterHelper(this), healthHelper(this, fuseObjectId) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue();
|
||||
@ -73,19 +72,19 @@ ReturnValue_t Fuse::check() {
|
||||
checkFuseState();
|
||||
calculateFusePower();
|
||||
//Check if power is valid and if fuse state is off or invalid.
|
||||
if (!power.isValid() || (state == 0) || !state.isValid()) {
|
||||
result = powerMonitor.setToInvalid();
|
||||
} else {
|
||||
float lowLimit = 0.0;
|
||||
float highLimit = RESIDUAL_POWER;
|
||||
calculatePowerLimits(&lowLimit, &highLimit);
|
||||
result = powerMonitor.checkPower(power, lowLimit, highLimit);
|
||||
if (result == MonitoringIF::BELOW_LOW_LIMIT) {
|
||||
reportEvents(POWER_BELOW_LOW_LIMIT);
|
||||
} else if (result == MonitoringIF::ABOVE_HIGH_LIMIT) {
|
||||
reportEvents(POWER_ABOVE_HIGH_LIMIT);
|
||||
}
|
||||
}
|
||||
// if (!power.isValid() || (state == 0) || !state.isValid()) {
|
||||
// result = powerMonitor.setToInvalid();
|
||||
// } else {
|
||||
// float lowLimit = 0.0;
|
||||
// float highLimit = RESIDUAL_POWER;
|
||||
// calculatePowerLimits(&lowLimit, &highLimit);
|
||||
// result = powerMonitor.checkPower(power, lowLimit, highLimit);
|
||||
// if (result == MonitoringIF::BELOW_LOW_LIMIT) {
|
||||
// reportEvents(POWER_BELOW_LOW_LIMIT);
|
||||
// } else if (result == MonitoringIF::ABOVE_HIGH_LIMIT) {
|
||||
// reportEvents(POWER_ABOVE_HIGH_LIMIT);
|
||||
// }
|
||||
// }
|
||||
set.commit();
|
||||
return result;
|
||||
}
|
||||
@ -136,7 +135,7 @@ void Fuse::calculateFusePower() {
|
||||
return;
|
||||
}
|
||||
//Calculate fuse power.
|
||||
power = current * voltage;
|
||||
//power = current * voltage;
|
||||
power.setValid(PoolVariableIF::VALID);
|
||||
}
|
||||
|
||||
@ -189,20 +188,20 @@ void Fuse::checkFuseState() {
|
||||
oldFuseState = 0;
|
||||
return;
|
||||
}
|
||||
if (state == 0) {
|
||||
if (oldFuseState != 0) {
|
||||
reportEvents(FUSE_WENT_OFF);
|
||||
}
|
||||
}
|
||||
oldFuseState = state;
|
||||
// if (state == 0) {
|
||||
// if (oldFuseState != 0) {
|
||||
// reportEvents(FUSE_WENT_OFF);
|
||||
// }
|
||||
// }
|
||||
// oldFuseState = state;
|
||||
}
|
||||
|
||||
float Fuse::getPower() {
|
||||
if (power.isValid()) {
|
||||
return power;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
// if (power.isValid()) {
|
||||
// return power;
|
||||
// } else {
|
||||
// return 0.0;
|
||||
// }
|
||||
}
|
||||
|
||||
void Fuse::setDataPoolEntriesInvalid() {
|
||||
|
Reference in New Issue
Block a user