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(); void setStaticFrameworkObjectIds();
} }
class LocalDataSetBase; class LocalPoolDataSetBase;
class HousekeepingPacketUpdate; class HousekeepingPacketUpdate;
/** /**

View File

@ -43,7 +43,7 @@ public:
* If nullptr, the variable is not registered. * If nullptr, the variable is not registered.
* @param setReadWriteMode Specify the read-write mode of the pool variable. * @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, DataSetIF* dataSet = nullptr,
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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