fsfw/thermal/ThermalModule.h

96 lines
2.2 KiB
C
Raw Normal View History

#ifndef THERMALMODULE_H_
#define THERMALMODULE_H_
2020-05-17 01:17:11 +02:00
#include <framework/datapoolglob/GlobalDataSet.h>
2020-05-17 22:20:54 +02:00
#include <framework/datapoolglob/GlobalPoolVariable.h>
#include <framework/devicehandlers/HealthDevice.h>
#include <framework/events/EventReportingProxyIF.h>
#include "ThermalModuleIF.h"
#include <list>
#include "tcsDefinitions.h"
#include "RedundantHeater.h"
class PowerSwitchIF;
2020-01-15 13:52:18 +01:00
/**
* @brief Allows creation of different thermal control domains within a system.
*/
class ThermalModule: public ThermalModuleIF {
friend class ThermalController;
public:
struct Parameters {
float heaterOn;
float hysteresis;
};
ThermalModule(uint32_t moduleTemperaturePoolId, uint32_t currentStatePoolId,
2020-05-17 01:17:11 +02:00
uint32_t targetStatePoolId, GlobDataSet *dataSet, Parameters parameters,
RedundantHeater::Parameters heaterParameters);
2020-05-17 01:17:11 +02:00
ThermalModule(uint32_t moduleTemperaturePoolId, GlobDataSet *dataSet);
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-05-17 13:37:50 +02:00
gp_float_t moduleTemperature;
RedundantHeater *heater;
2020-05-17 13:37:50 +02:00
gp_int8_t currentState;
gp_int8_t targetState;
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_ */