Some error fixed. two main problem to solve at this point: adjust the periodic reading of the data through the dh, adjust the operations of the components (error in reading the target state).
This commit is contained in:
parent
868a461acb
commit
04cfb85311
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -150,13 +150,13 @@ void InitMission::createTasks(){
|
||||
#endif
|
||||
|
||||
//Main thread sleep
|
||||
sif::debug << "Starting Tasks in 2 seconds" << std::endl;
|
||||
TaskFactory::delayTask(2000);
|
||||
sif::debug << "Starting Tasks in 3.2 seconds" << std::endl;
|
||||
TaskFactory::delayTask(3200);
|
||||
distributerTask->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
//serializeTask->startTask();
|
||||
arduinoTask->startTask();
|
||||
//arduinoTask->startTask();
|
||||
controllerTask->startTask();
|
||||
|
||||
//payloadTask->startTask();
|
||||
|
@ -17,9 +17,9 @@ ReturnValue_t pollingSequenceArduinoFunction(
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0, 0);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.2, 1);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.4, 2);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.6, 3);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.8, 1);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.8, 2);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.8, 3);
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
@ -67,7 +67,7 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
||||
this->pstStep = counter;
|
||||
|
||||
if (getComAction() == SEND_WRITE) {
|
||||
sif::debug<<" DH_base: performOp1"<<std::endl;
|
||||
sif::debug<<"DH_base: performOp1"<<std::endl;
|
||||
cookieInfo.state = COOKIE_UNUSED;
|
||||
readCommandQueue();
|
||||
doStateMachine();
|
||||
@ -83,22 +83,22 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
||||
switch (getComAction()) {
|
||||
case SEND_WRITE:
|
||||
if ((cookieInfo.state == COOKIE_UNUSED)) {
|
||||
sif::debug<<" DH_base: performOp2"<<std::endl;
|
||||
sif::debug<<"DH_base: performOp2"<<std::endl;
|
||||
buildInternalCommand();
|
||||
}
|
||||
sif::debug<<" DH_base: performOp3"<<std::endl;
|
||||
sif::debug<<"DH_base: performOp3"<<std::endl;
|
||||
doSendWrite();
|
||||
break;
|
||||
case GET_WRITE:
|
||||
sif::debug<<" DH_base: performOp4"<<std::endl;
|
||||
sif::debug<<"DH_base: performOp4"<<std::endl;
|
||||
doGetWrite();
|
||||
break;
|
||||
case SEND_READ:
|
||||
sif::debug<<" DH_base: performOp5"<<std::endl;
|
||||
sif::debug<<"DH_base: performOp5"<<std::endl;
|
||||
doSendRead();
|
||||
break;
|
||||
case GET_READ:
|
||||
sif::debug<<" DH_base: performOp6"<<std::endl;
|
||||
sif::debug<<"DH_base: performOp6"<<std::endl;
|
||||
doGetRead();
|
||||
cookieInfo.state = COOKIE_UNUSED;
|
||||
break;
|
||||
@ -669,7 +669,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
|
||||
handleReply(receivedData, foundId, foundLen);
|
||||
break;
|
||||
case APERIODIC_REPLY: {
|
||||
sif::debug<<" DH_base: debug1"<<std::endl;
|
||||
sif::debug<<"DH_base: debug1"<<std::endl;
|
||||
result = interpretDeviceReply(foundId, receivedData);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug<<" DH_base: debug2"<<std::endl;
|
||||
|
@ -24,6 +24,13 @@ TCS_ThermalComponent::TCS_ThermalComponent(object_id_t reportingObjectId,
|
||||
ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL),
|
||||
Heater(Heater), RedundantHeater(RedundantHeater),
|
||||
nopParameters({ parameters.lowerNopLimit, parameters.upperNopLimit }) {
|
||||
|
||||
//Set thermal state once, then leave to operator.
|
||||
/*DataSet mySet;
|
||||
PoolVariable<int8_t> writableTargetState(targetStatePoolId, &mySet, PoolVariableIF::VAR_WRITE);
|
||||
writableTargetState = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
|
||||
mySet.commit(PoolVariableIF::VALID);*/
|
||||
|
||||
}
|
||||
|
||||
TCS_ThermalComponent::~TCS_ThermalComponent() {
|
||||
@ -31,6 +38,7 @@ TCS_ThermalComponent::~TCS_ThermalComponent() {
|
||||
|
||||
ThermalComponentIF::HeaterRequest TCS_ThermalComponent::performOperation(uint8_t opCode, bool redundancy, bool dual) {
|
||||
|
||||
sif::debug<<"DEBUG_COMPONENT: 1"<<std::endl;
|
||||
// Heater define the Internal State
|
||||
if (Heater != NULL) {
|
||||
Heater->performOperation(0);
|
||||
@ -40,9 +48,11 @@ ThermalComponentIF::HeaterRequest TCS_ThermalComponent::performOperation(uint8_t
|
||||
RedundantHeater->performOperation(0);
|
||||
}
|
||||
}
|
||||
sif::debug<<"DEBUG_COMPONENT: 2"<<std::endl;
|
||||
|
||||
HeaterRequest request = HEATER_DONT_CARE;
|
||||
request = CoreComponent::performOperation(0);
|
||||
sif::debug<<"DEBUG_COMPONENT: 3"<<std::endl;
|
||||
|
||||
/*if (Heater == NULL) {
|
||||
informComponentsAboutHeaterState(false, NONE, priority, request);
|
||||
@ -56,26 +66,38 @@ ThermalComponentIF::HeaterRequest TCS_ThermalComponent::performOperation(uint8_t
|
||||
//Components overwrite the module request.
|
||||
heating = ((request == ThermalComponentIF::HEATER_REQUEST_ON) ||
|
||||
(request == ThermalComponentIF::HEATER_REQUEST_EMERGENCY_ON));
|
||||
sif::debug<<"DEBUG_COMPONENT: 4"<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
// strategy NOT-PASSIVE as default
|
||||
if (heating) {
|
||||
ReturnValue_t result = Heater->set();
|
||||
if (redundancy){
|
||||
if (result != HasReturnvaluesIF::RETURN_OK || dual) {
|
||||
sif::debug<<"DEBUG_COMPONENT: 5"<<std::endl;
|
||||
RedundantHeater->set();
|
||||
sif::debug<<"DEBUG_COMPONENT: 6"<<std::endl;
|
||||
} else {
|
||||
sif::debug<<"DEBUG_COMPONENT: 7"<<std::endl;
|
||||
RedundantHeater->clear(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK)
|
||||
Heater->clear(false);
|
||||
sif::debug<<"DEBUG_COMPONENT: 8"<<std::endl;
|
||||
}
|
||||
} else {
|
||||
sif::debug<<"DEBUG_COMPONENT: 9"<<std::endl;
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug<<"DEBUG_COMPONENT: 10"<<std::endl;
|
||||
Heater->clear(false);
|
||||
sif::debug<<"DEBUG_COMPONENT: 11"<<std::endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sif::debug<<"DEBUG_COMPONENT: 12"<<std::endl;
|
||||
Heater->clear(false);
|
||||
RedundantHeater->clear(false);
|
||||
sif::debug<<"DEBUG_COMPONENT: 13"<<std::endl;
|
||||
}
|
||||
sif::debug<<"DEBUG_COMPONENT: 14"<<std::endl;
|
||||
|
||||
/*if (strategy == PASSIVE) {
|
||||
informComponentsAboutHeaterState(false, NONE, priority, request);
|
||||
|
@ -44,11 +44,9 @@ protected:
|
||||
TCS_Heater *Heater;
|
||||
TCS_Heater *RedundantHeater;
|
||||
|
||||
State getState(float temperature, CoreComponent::Parameters parameters,
|
||||
int8_t targetState);
|
||||
State getState(float temperature, CoreComponent::Parameters parameters, int8_t targetState);
|
||||
virtual void checkLimits(State state);
|
||||
virtual HeaterRequest getHeaterRequest(int8_t targetState, float temperature,
|
||||
CoreComponent::Parameters parameters);
|
||||
virtual HeaterRequest getHeaterRequest(int8_t targetState, float temperature, CoreComponent::Parameters parameters);
|
||||
State getIgnoredState(int8_t state);
|
||||
|
||||
enum Informee {
|
||||
|
@ -10,17 +10,17 @@
|
||||
|
||||
ThermalController::ThermalController(object_id_t objectId, object_id_t powerSwitcher, size_t commandQueueDepth):
|
||||
ControllerBase(objectId, 0, commandQueueDepth),
|
||||
powerSwitcherId(powerSwitcher), TempValueVec(datapool::Temperature_value, &TCSData, PoolVariableIF::VAR_READ),
|
||||
TEMPERATURE_SENSOR_CH1(objects::TCS_SENSOR_CH1, &TempValueVec[0], &TempValueVec, 0, TEMPERATURE_SENSOR_CONFIG, datapool::TEMP_SENSOR_CH1, &TCSData, NULL),
|
||||
TEMPERATURE_SENSOR_CH2(objects::TCS_SENSOR_CH2, &TempValueVec[1], &TempValueVec, 1, TEMPERATURE_SENSOR_CONFIG, datapool::TEMP_SENSOR_CH2, &TCSData, NULL),
|
||||
powerSwitcherId(powerSwitcher), TempValueVec(datapool::Temperature_value, &SensorData, PoolVariableIF::VAR_READ),
|
||||
TEMPERATURE_SENSOR_CH1(objects::TCS_SENSOR_CH1, &TempValueVec[0], &TempValueVec, 0, TEMPERATURE_SENSOR_CONFIG, datapool::TEMP_SENSOR_CH1, &SensorData, NULL),
|
||||
TEMPERATURE_SENSOR_CH2(objects::TCS_SENSOR_CH2, &TempValueVec[1], &TempValueVec, 1, TEMPERATURE_SENSOR_CONFIG, datapool::TEMP_SENSOR_CH2, &SensorData, NULL),
|
||||
HEATER_1(objects::TCS_HEATER_1, objects::TCS_SWITCH_1),
|
||||
REDUNDANT_HEATER_1(objects::TCS_REDUNDANT_HEATER_1, objects::TCS_SWITCH_1R),
|
||||
HEATER_2(objects::TCS_HEATER_2, objects::TCS_SWITCH_2),
|
||||
REDUNDANT_HEATER_2(objects::TCS_REDUNDANT_HEATER_2, objects::TCS_SWITCH_2R),
|
||||
TEMPERATURE_COMPONENT_1(objects::TCS_COMPONENT_1, COMPONENT_DOMAIN_ID, datapool::TEMP_SENSOR_CH1, datapool::TargetState_COMPONENT_1, datapool::CurrentState_COMPONENT_1,
|
||||
datapool::HeaterRequest_COMPONENT_1, &TCSData, &TEMPERATURE_SENSOR_CH1, NULL, NULL, &HEATER_1, &REDUNDANT_HEATER_1, NULL, COMPONENT1_CONFIG, ThermalComponentIF::SAFE),
|
||||
datapool::HeaterRequest_COMPONENT_1, &ComponentData, &TEMPERATURE_SENSOR_CH1, NULL, NULL, &HEATER_1, &REDUNDANT_HEATER_1, NULL, COMPONENT1_CONFIG, ThermalComponentIF::SAFE),
|
||||
TEMPERATURE_COMPONENT_2(objects::TCS_COMPONENT_2, COMPONENT_DOMAIN_ID + 1, datapool::TEMP_SENSOR_CH2, datapool::TargetState_COMPONENT_2, datapool::CurrentState_COMPONENT_2,
|
||||
datapool::HeaterRequest_COMPONENT_2, &TCSData, &TEMPERATURE_SENSOR_CH2, NULL, NULL, &HEATER_2, &REDUNDANT_HEATER_2, NULL, COMPONENT2_CONFIG, ThermalComponentIF::SAFE)
|
||||
datapool::HeaterRequest_COMPONENT_2, &ComponentData, &TEMPERATURE_SENSOR_CH2, NULL, NULL, &HEATER_2, &REDUNDANT_HEATER_2, NULL, COMPONENT2_CONFIG, ThermalComponentIF::SAFE)
|
||||
{
|
||||
sensors.push_back(TEMPERATURE_SENSOR_CH1);
|
||||
sensors.push_back(TEMPERATURE_SENSOR_CH2);
|
||||
@ -88,38 +88,36 @@ ReturnValue_t ThermalController::handleCommandMessage(CommandMessage *message) {
|
||||
|
||||
ReturnValue_t ThermalController::performOperation(uint8_t opCode) {
|
||||
|
||||
sif::debug<<"\nDEBUG_TCS: Start of controller operations"<<std::endl;
|
||||
std::cout << "\nDEBUG_TCS: Start of controller operations" << std::endl;
|
||||
sif::debug<<"DEBUG_TCS: Start of controller operations"<<std::endl;
|
||||
|
||||
for (std::list<ArduinoTCSTemperatureSensor>::iterator iter = sensors.begin(); iter != sensors.end(); iter++) {
|
||||
iter->performHealthOp();
|
||||
}
|
||||
sif::debug<<"\nDEBUG_TCS: Health ops"<<std::endl;
|
||||
sif::debug<<"DEBUG_TCS: Health ops"<<std::endl;
|
||||
|
||||
ControllerBase::performOperation(0);
|
||||
sif::debug<<"\nDEBUG_TCS: Controller ops"<<std::endl;
|
||||
sif::debug<<"DEBUG_TCS: Controller ops"<<std::endl;
|
||||
|
||||
if (mode == MODE_OFF) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
TCSData.read();
|
||||
SensorData.read();
|
||||
for (std::list<ArduinoTCSTemperatureSensor>::iterator iter = sensors.begin(); iter != sensors.end(); iter++) {
|
||||
iter->performOperation(0);
|
||||
}
|
||||
TCSData.commit();
|
||||
sif::debug<<"\nDEBUG_TCS: Sensor ops"<<std::endl;
|
||||
SensorData.commit();
|
||||
sif::debug<<"DEBUG_TCS: Sensor ops"<<std::endl;
|
||||
|
||||
TCSData.read(); // ?check the read, separate dataset
|
||||
ComponentData.read();
|
||||
//calculateStrategy(true, true);
|
||||
ThermalComponentIF::HeaterRequest request;
|
||||
for (std::list<TCS_ThermalComponent>::iterator iter = components.begin(); iter != components.end(); iter++) {
|
||||
request = iter->performOperation(0, true, false); // request returnvalue
|
||||
request = iter->performOperation(0, true, false); // request returnvalue to check, overridden
|
||||
//request = iter->performOperation(0, ThermalComponentIF::SAFE, true, false);
|
||||
}
|
||||
TCSData.commit();
|
||||
sif::debug<<"\nDEBUG_TCS: Component ops"<<std::endl;
|
||||
std::cout << "\nDEBUG_TCS: End of controller operations" << std::endl;
|
||||
ComponentData.commit();
|
||||
sif::debug<<"DEBUG_TCS: Component ops"<<std::endl;
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ private:
|
||||
object_id_t powerSwitcherId;
|
||||
|
||||
// definition of dataset
|
||||
DataSet TCSData;
|
||||
DataSet SensorData;
|
||||
DataSet ComponentData;
|
||||
|
||||
// definition of dataset variables from datapool
|
||||
PoolVector <float, 36> TempValueVec;
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <mission/DeviceHandler/ArduinoCookie.h>
|
||||
|
||||
#include <fsfw/serialize/SerializeAdapter.h>
|
||||
//#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
|
||||
@ -200,7 +199,7 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
||||
buffer = &buf_ptr;*/
|
||||
*buffer = read_buf;
|
||||
|
||||
close(Cookie->Serial_port_number);
|
||||
//close(Cookie->Serial_port_number);
|
||||
return RETURN_OK;
|
||||
|
||||
}
|
||||
|
@ -34,10 +34,6 @@ public:
|
||||
ArduinoComIF(object_id_t objectId);
|
||||
virtual ~ArduinoComIF();
|
||||
|
||||
/**
|
||||
* DeviceCommunicationIF overrides
|
||||
* (see DeviceCommunicationIF documentation)
|
||||
*/
|
||||
ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
||||
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData,
|
||||
size_t sendLen) override;
|
||||
@ -49,24 +45,22 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// DELETE
|
||||
/**
|
||||
* Send TM packet which contains received data as TM[17,130].
|
||||
* Wiretapping will do the same.
|
||||
* @param data
|
||||
* @param len
|
||||
*/
|
||||
void sendTmPacket(const uint8_t *data,uint32_t len);
|
||||
//void sendTmPacket(const uint8_t *data,uint32_t len);
|
||||
|
||||
AcceptsTelemetryIF* funnel = nullptr;
|
||||
/*AcceptsTelemetryIF* funnel = nullptr;
|
||||
MessageQueueIF* tmQueue = nullptr;
|
||||
size_t replyMaxLen = 0;
|
||||
|
||||
using ReplyBuffer = std::vector<uint8_t>;
|
||||
std::map<address_t, ReplyBuffer> replyMap;
|
||||
|
||||
uint8_t dummyReplyCounter = 0;
|
||||
|
||||
uint16_t packetSubCounter = 0;
|
||||
uint16_t packetSubCounter = 0;*/
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,5 +68,6 @@ void ObjectFactory::produceGenericObjects() {
|
||||
new TestDevice(objects::TEST_DEVICE_HANDLER, objects::TEST_ECHO_COM_IF,
|
||||
testCookie, true);
|
||||
#endif*/
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user