2020-12-03 18:32:32 +01:00
|
|
|
#ifndef FSFW_THERMAL_THERMALMODULE_H_
|
|
|
|
#define FSFW_THERMAL_THERMALMODULE_H_
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
#include "ThermalModuleIF.h"
|
|
|
|
#include "tcsDefinitions.h"
|
|
|
|
#include "RedundantHeater.h"
|
2020-12-03 18:32:32 +01:00
|
|
|
|
|
|
|
#include "../datapoollocal/LocalPoolDataSetBase.h"
|
|
|
|
#include "../datapoollocal/LocalPoolVariable.h"
|
|
|
|
#include "../devicehandlers/HealthDevice.h"
|
|
|
|
#include "../events/EventReportingProxyIF.h"
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
class PowerSwitchIF;
|
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
/**
|
|
|
|
* @brief Allows creation of different thermal control domains within a system.
|
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
class ThermalModule: public ThermalModuleIF {
|
|
|
|
friend class ThermalController;
|
|
|
|
public:
|
|
|
|
struct Parameters {
|
|
|
|
float heaterOn;
|
|
|
|
float hysteresis;
|
|
|
|
};
|
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
ThermalModule(gp_id_t moduleTemperaturePoolId, gp_id_t currentStatePoolId,
|
|
|
|
gp_id_t targetStatePoolId, LocalPoolDataSetBase *dataSet,
|
|
|
|
Parameters parameters, RedundantHeater::Parameters heaterParameters);
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
ThermalModule(gp_id_t moduleTemperaturePoolId,
|
|
|
|
LocalPoolDataSetBase *dataSet);
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
virtual ~ThermalModule();
|
|
|
|
|
|
|
|
void performOperation(uint8_t opCode);
|
|
|
|
|
|
|
|
void performMode(Strategy strategy);
|
|
|
|
|
|
|
|
float getTemperature();
|
|
|
|
|
|
|
|
void registerSensor(AbstractTemperatureSensor *sensor);
|
|
|
|
|
|
|
|
void registerComponent(ThermalComponentIF *component,
|
|
|
|
ThermalComponentIF::Priority priority);
|
|
|
|
|
|
|
|
ThermalComponentIF *findComponent(object_id_t objectId);
|
|
|
|
|
|
|
|
void initialize(PowerSwitchIF* powerSwitch);
|
|
|
|
|
|
|
|
void setHeating(bool on);
|
|
|
|
|
|
|
|
virtual void setOutputInvalid();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
enum Informee {
|
|
|
|
ALL, SAFE, NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ComponentData {
|
|
|
|
ThermalComponentIF *component;
|
|
|
|
ThermalComponentIF::Priority priority;
|
|
|
|
ThermalComponentIF::HeaterRequest request;
|
|
|
|
};
|
|
|
|
|
|
|
|
Strategy oldStrategy;
|
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
float survivalTargetTemp = 0.0;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
float targetTemp = 0.0;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
bool heating = false;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
Parameters parameters;
|
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
lp_var_t<float> moduleTemperature;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
RedundantHeater *heater = nullptr;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
lp_var_t<int8_t> currentState;
|
|
|
|
lp_var_t<int8_t> targetState;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
std::list<AbstractTemperatureSensor *> sensors;
|
|
|
|
std::list<ComponentData> components;
|
|
|
|
|
|
|
|
void calculateTemperature();
|
|
|
|
|
|
|
|
ThermalComponentIF::HeaterRequest letComponentsPerformAndDeciceIfWeNeedToHeat(bool safeOnly);
|
|
|
|
|
|
|
|
void informComponentsAboutHeaterState(bool heaterIsOn,
|
|
|
|
Informee whomToInform);
|
|
|
|
|
|
|
|
bool calculateModuleHeaterRequestAndSetModuleStatus(Strategy strategy);
|
|
|
|
|
|
|
|
void updateTargetTemperatures(ThermalComponentIF *component, bool isSafe);
|
|
|
|
};
|
|
|
|
|
2020-12-03 18:32:32 +01:00
|
|
|
#endif /* FSFW_THERMAL_THERMALMODULE_H_ */
|