it doesnt work? comment it !

This commit is contained in:
Robin Müller 2020-11-30 14:13:52 +01:00
parent 25f08b8c1f
commit e7a96d5ad8
8 changed files with 99 additions and 99 deletions

View File

@ -20,7 +20,7 @@ namespace Factory {
void setStaticFrameworkObjectIds();
}
class LocalDataSetBase;
class LocalPoolDataSetBase;
class HousekeepingPacketUpdate;
/**

View File

@ -43,7 +43,7 @@ public:
* If nullptr, the variable is not registered.
* @param setReadWriteMode Specify the read-write mode of the pool variable.
*/
LocalPoolVar(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
LocalPoolVar(HasLocalDataPoolIF* hkOwner, lp_id_t poolId,
DataSetIF* dataSet = nullptr,
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);

View File

@ -6,9 +6,8 @@
#endif
template<typename T>
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId,
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
pool_rwm_t setReadWriteMode):
inline LocalPoolVar<T>::LocalPoolVar(HasLocalDataPoolIF* hkOwner,
lp_id_t poolId, DataSetIF* dataSet, pool_rwm_t setReadWriteMode):
LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {}
template<typename T>

View File

@ -21,12 +21,12 @@ public:
InternalErrorDataset(object_id_t objectId):
StaticLocalDataSet(sid_t(objectId , ERROR_SET_ID)) {}
lp_var_t<uint32_t> tmHits = lp_var_t<uint32_t>(TM_HITS,
hkManager->getOwner(), this);
lp_var_t<uint32_t> queueHits = lp_var_t<uint32_t>(QUEUE_HITS,
hkManager->getOwner(), this);
lp_var_t<uint32_t> storeHits = lp_var_t<uint32_t>(STORE_HITS,
hkManager->getOwner(), this);
lp_var_t<uint32_t> tmHits = lp_var_t<uint32_t>(hkManager->getOwner(),
TM_HITS, this);
lp_var_t<uint32_t> queueHits = lp_var_t<uint32_t>(hkManager->getOwner(),
QUEUE_HITS, this);
lp_var_t<uint32_t> storeHits = lp_var_t<uint32_t>(hkManager->getOwner(),
STORE_HITS, this);
};

View File

@ -1,9 +1,9 @@
#include "ThermalComponent.h"
ThermalComponent::ThermalComponent(object_id_t reportingObjectId,
uint8_t domainId, uint32_t temperaturePoolId,
uint32_t targetStatePoolId, uint32_t currentStatePoolId,
uint32_t requestPoolId, GlobDataSet* dataSet,
uint8_t domainId, gp_id_t temperaturePoolId,
gp_id_t targetStatePoolId, gp_id_t currentStatePoolId,
gp_id_t requestPoolId, LocalPoolDataSetBase* dataSet,
AbstractTemperatureSensor* sensor,
AbstractTemperatureSensor* firstRedundantSensor,
AbstractTemperatureSensor* secondRedundantSensor,
@ -78,13 +78,13 @@ ThermalComponentIF::State ThermalComponent::getState(float temperature,
}
void ThermalComponent::checkLimits(ThermalComponentIF::State state) {
if (targetState == STATE_REQUEST_OPERATIONAL || targetState == STATE_REQUEST_IGNORE) {
ThermalComponentCore::checkLimits(state);
return;
}
//if (targetState == STATE_REQUEST_OPERATIONAL || targetState == STATE_REQUEST_IGNORE) {
// ThermalComponentCore::checkLimits(state);
// return;
//}
//If component is not operational, it checks the NOP limits.
temperatureMonitor.translateState(state, temperature.value,
nopParameters.lowerNopLimit, nopParameters.upperNopLimit, false);
//temperatureMonitor.translateState(state, temperature.value,
// nopParameters.lowerNopLimit, nopParameters.upperNopLimit, false);
}
ThermalComponentIF::HeaterRequest ThermalComponent::getHeaterRequest(

View File

@ -45,9 +45,9 @@ public:
* @param priority
*/
ThermalComponent(object_id_t reportingObjectId, uint8_t domainId,
uint32_t temperaturePoolId, uint32_t targetStatePoolId,
uint32_t currentStatePoolId, uint32_t requestPoolId,
GlobDataSet *dataSet, AbstractTemperatureSensor *sensor,
gp_id_t temperaturePoolId, gp_id_t targetStatePoolId,
gp_id_t currentStatePoolId, gp_id_t requestPoolId,
LocalPoolDataSetBase *dataSet, AbstractTemperatureSensor *sensor,
AbstractTemperatureSensor *firstRedundantSensor,
AbstractTemperatureSensor *secondRedundantSensor,
ThermalModuleIF *thermalModule, Parameters parameters,

View File

@ -3,22 +3,22 @@
ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
uint8_t domainId, gp_id_t temperaturePoolId,
gp_id_t targetStatePoolId, gp_id_t currentStatePoolId,
gp_id_t requestPoolId, LocalDataSetBase* dataSet, Parameters parameters,
StateRequest initialTargetState) :
gp_id_t requestPoolId, LocalPoolDataSetBase* dataSet,
Parameters parameters, StateRequest initialTargetState) :
temperature(temperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE),
targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ),
currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE),
heaterRequest(requestPoolId, dataSet, PoolVariableIF::VAR_WRITE),
parameters(parameters),
temperatureMonitor(reportingObjectId, domainId + 1,
GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0),
COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
parameters(parameters), domainId(domainId) {
//temperatureMonitor(reportingObjectId, domainId + 1,
// GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0),
// COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
//Set thermal state once, then leave to operator.
GlobDataSet mySet;
gp_uint8_t writableTargetState(targetStatePoolId, &mySet,
PoolVariableIF::VAR_WRITE);
writableTargetState = initialTargetState;
mySet.commit(PoolVariableIF::VALID);
//GlobDataSet mySet;
//gp_uint8_t writableTargetState(targetStatePoolId, &mySet,
// PoolVariableIF::VAR_WRITE);
//writableTargetState = initialTargetState;
//mySet.commit(PoolVariableIF::VALID);
}
void ThermalComponentCore::addSensor(AbstractTemperatureSensor* sensor) {
@ -57,19 +57,19 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
HeaterRequest request = HEATER_DONT_CARE;
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
temperature = getTemperature();
updateMinMaxTemp();
if ((temperature != INVALID_TEMPERATURE)) {
temperature.setValid(PoolVariableIF::VALID);
State state = getState(temperature, getParameters(), targetState);
currentState = state;
checkLimits(state);
request = getHeaterRequest(targetState, temperature, getParameters());
} else {
temperatureMonitor.setToInvalid();
temperature.setValid(PoolVariableIF::INVALID);
currentState = UNKNOWN;
request = HEATER_DONT_CARE;
}
//updateMinMaxTemp();
//if ((temperature != INVALID_TEMPERATURE)) {
//temperature.setValid(PoolVariableIF::VALID);
//State state = getState(temperature, getParameters(), targetState);
//currentState = state;
//checkLimits(state);
//request = getHeaterRequest(targetState, temperature, getParameters());
//} else {
// temperatureMonitor.setToInvalid();
// temperature.setValid(PoolVariableIF::INVALID);
// currentState = UNKNOWN;
// request = HEATER_DONT_CARE;
//}
currentState.setValid(PoolVariableIF::VALID);
heaterRequest = request;
heaterRequest.setValid(PoolVariableIF::VALID);
@ -77,11 +77,12 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
}
void ThermalComponentCore::markStateIgnored() {
currentState = getIgnoredState(currentState);
//currentState = getIgnoredState(currentState);
}
object_id_t ThermalComponentCore::getObjectId() {
return temperatureMonitor.getReporterId();
//return temperatureMonitor.getReporterId();
return 0;
}
float ThermalComponentCore::getLowerOpLimit() {
@ -119,7 +120,7 @@ void ThermalComponentCore::setOutputInvalid() {
currentState.setValid(PoolVariableIF::INVALID);
heaterRequest = HEATER_DONT_CARE;
heaterRequest.setValid(PoolVariableIF::INVALID);
temperatureMonitor.setToUnchecked();
//temperatureMonitor.setToUnchecked();
}
float ThermalComponentCore::getTemperature() {
@ -169,8 +170,8 @@ ThermalComponentIF::State ThermalComponentCore::getState(float temperature,
void ThermalComponentCore::checkLimits(ThermalComponentIF::State state) {
//Checks operational limits only.
temperatureMonitor.translateState(state, temperature.value,
getParameters().lowerOpLimit, getParameters().upperOpLimit);
//temperatureMonitor.translateState(state, temperature.value,
// getParameters().lowerOpLimit, getParameters().upperOpLimit);
}
@ -220,17 +221,17 @@ ThermalComponentIF::State ThermalComponentCore::getIgnoredState(int8_t state) {
}
}
void ThermalComponentCore::updateMinMaxTemp() {
if (temperature == INVALID_TEMPERATURE) {
return;
}
if (temperature < minTemp) {
minTemp = temperature;
}
if (temperature > maxTemp) {
maxTemp = temperature;
}
}
//void ThermalComponentCore::updateMinMaxTemp() {
// if (temperature == INVALID_TEMPERATURE) {
// return;
// }
// if (temperature < minTemp) {
// minTemp = temperature;
// }
// if (temperature > maxTemp) {
// maxTemp = temperature;
// }
//}
uint8_t ThermalComponentCore::getDomainId() const {
return domainId;
@ -243,38 +244,38 @@ ThermalComponentCore::Parameters ThermalComponentCore::getParameters() {
ReturnValue_t ThermalComponentCore::getParameter(uint8_t domainId,
uint16_t parameterId, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues, uint16_t startAtIndex) {
ReturnValue_t result = temperatureMonitor.getParameter(domainId,
parameterId, parameterWrapper, newValues, startAtIndex);
if (result != INVALID_DOMAIN_ID) {
return result;
}
if (domainId != this->domainId) {
return INVALID_DOMAIN_ID;
}
switch (parameterId) {
case 0:
parameterWrapper->set(parameters.heaterOn);
break;
case 1:
parameterWrapper->set(parameters.hysteresis);
break;
case 2:
parameterWrapper->set(parameters.heaterSwitchoff);
break;
case 3:
parameterWrapper->set(minTemp);
break;
case 4:
parameterWrapper->set(maxTemp);
break;
case 10:
parameterWrapper->set(parameters.lowerOpLimit);
break;
case 11:
parameterWrapper->set(parameters.upperOpLimit);
break;
default:
return INVALID_IDENTIFIER_ID;
}
//ReturnValue_t result = temperatureMonitor.getParameter(domainId,
// parameterId, parameterWrapper, newValues, startAtIndex);
// if (result != INVALID_DOMAIN_ID) {
// return result;
// }
// if (domainId != this->domainId) {
// return INVALID_DOMAIN_ID;
// }
// switch (parameterId) {
// case 0:
// parameterWrapper->set(parameters.heaterOn);
// break;
// case 1:
// parameterWrapper->set(parameters.hysteresis);
// break;
// case 2:
// parameterWrapper->set(parameters.heaterSwitchoff);
// break;
// case 3:
// parameterWrapper->set(minTemp);
// break;
// case 4:
// parameterWrapper->set(maxTemp);
// break;
// case 10:
// parameterWrapper->set(parameters.lowerOpLimit);
// break;
// case 11:
// parameterWrapper->set(parameters.upperOpLimit);
// break;
// default:
// return INVALID_IDENTIFIER_ID;
// }
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -41,7 +41,7 @@ public:
ThermalComponentCore(object_id_t reportingObjectId, uint8_t domainId,
gp_id_t temperaturePoolId, gp_id_t targetStatePoolId,
gp_id_t currentStatePoolId, gp_id_t requestPoolId,
LocalDataSetBase* dataSet, Parameters parameters,
LocalPoolDataSetBase* dataSet, Parameters parameters,
StateRequest initialTargetState =
ThermalComponentIF::STATE_REQUEST_OPERATIONAL);
@ -96,7 +96,7 @@ protected:
Parameters parameters;
ThermalMonitorReporter temperatureMonitor;
//ThermalMonitorReporter temperatureMonitor;
const uint8_t domainId;
@ -111,7 +111,7 @@ protected:
virtual State getIgnoredState(int8_t state);
void updateMinMaxTemp();
//void updateMinMaxTemp();
virtual Parameters getParameters();
};