2018-07-12 16:29:32 +02:00
|
|
|
#ifndef THERMALMODULE_H_
|
|
|
|
#define THERMALMODULE_H_
|
|
|
|
|
2020-09-06 15:25:56 +02:00
|
|
|
#include "../datapoolglob/GlobalDataSet.h"
|
|
|
|
#include "../datapoolglob/GlobalPoolVariable.h"
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../devicehandlers/HealthDevice.h"
|
|
|
|
#include "../events/EventReportingProxyIF.h"
|
2018-07-12 16:29:32 +02:00
|
|
|
#include "ThermalModuleIF.h"
|
|
|
|
#include <list>
|
|
|
|
#include "tcsDefinitions.h"
|
|
|
|
#include "RedundantHeater.h"
|
|
|
|
class PowerSwitchIF;
|
|
|
|
|
2020-09-06 15:25:56 +02: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;
|
|
|
|
};
|
|
|
|
|
|
|
|
ThermalModule(uint32_t moduleTemperaturePoolId, uint32_t currentStatePoolId,
|
2020-09-06 15:25:56 +02:00
|
|
|
uint32_t targetStatePoolId, GlobDataSet *dataSet, Parameters parameters,
|
2018-07-12 16:29:32 +02:00
|
|
|
RedundantHeater::Parameters heaterParameters);
|
|
|
|
|
2020-09-06 15:25:56 +02:00
|
|
|
ThermalModule(uint32_t moduleTemperaturePoolId, GlobDataSet *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;
|
|
|
|
|
|
|
|
float survivalTargetTemp;
|
|
|
|
|
|
|
|
float targetTemp;
|
|
|
|
|
|
|
|
bool heating;
|
|
|
|
|
|
|
|
Parameters parameters;
|
|
|
|
|
2020-09-06 15:25:56 +02:00
|
|
|
gp_float_t moduleTemperature;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
RedundantHeater *heater;
|
|
|
|
|
2020-09-06 15:25:56 +02:00
|
|
|
gp_int8_t currentState;
|
|
|
|
gp_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);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* THERMALMODULE_H_ */
|