From 8722fba0c16bbade7b26134e93e52516b2186058 Mon Sep 17 00:00:00 2001 From: Ruud Overeem <overeem@astron.nl> Date: Wed, 6 Dec 2006 15:51:21 +0000 Subject: [PATCH] BugID: 679 Weekly update. --- .../ObservationControl/ObservationControl.cc | 43 +++++++++++----- .../ObservationControl/ObservationControl.h | 2 + .../StationCU/src/BeamControl/BeamControl.cc | 50 ++++++++++--------- .../src/BeamControl/BeamControlDefines.h | 1 + .../CalibrationControl/CalibrationControl.cc | 28 +++++++---- .../CalibrationControlDefines.h | 7 ++- .../DigitalBoardControl.cc | 4 +- .../StationCU/src/StationControl/ActiveObs.cc | 50 ++++++++++++++++--- .../src/StationControl/StationControl.cc | 14 +++--- 9 files changed, 136 insertions(+), 63 deletions(-) diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc index c2f37972d5e..4d63c9fac7f 100644 --- a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc +++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc @@ -421,24 +421,28 @@ GCFEvent::TResult ObservationControl::active_state(GCFEvent& event, GCFPortInter } else if (timerEvent.id == itsClaimTimer) { setState(CTState::CLAIM); + itsChildResult = CT_RESULT_NO_ERROR; itsClaimTimer = 0; LOG_DEBUG("Requesting all childs to execute the CLAIM state"); itsChildControl->requestState(CTState::CLAIMED, ""); } else if (timerEvent.id == itsPrepareTimer) { setState(CTState::PREPARE); + itsChildResult = CT_RESULT_NO_ERROR; itsPrepareTimer = 0; LOG_DEBUG("Requesting all childs to execute the PREPARE state"); itsChildControl->requestState(CTState::PREPARED, ""); } else if (timerEvent.id == itsStartTimer) { setState(CTState::RESUME); + itsChildResult = CT_RESULT_NO_ERROR; itsStartTimer = 0; LOG_DEBUG("Requesting all childs to go operation state"); itsChildControl->requestState(CTState::RESUMED, ""); } else if (timerEvent.id == itsStopTimer) { setState(CTState::FINISH); + itsChildResult = CT_RESULT_NO_ERROR; itsStopTimer = 0; LOG_DEBUG("Requesting all childs to quit"); itsChildControl->requestState(CTState::FINISHED, ""); @@ -490,45 +494,41 @@ GCFEvent::TResult ObservationControl::active_state(GCFEvent& event, GCFPortInter case CONTROL_CLAIMED: { CONTROLClaimedEvent msg(event); LOG_DEBUG_STR("Received CLAIMED(" << msg.cntlrName << ")"); - // TODO: do something usefull with this information! --> OE 837 + itsChildResult |= msg.result; break; } case CONTROL_PREPARED: { CONTROLPreparedEvent msg(event); LOG_DEBUG_STR("Received PREPARED(" << msg.cntlrName << ")"); - // TODO: do something usefull with this information! --> OE 837 + itsChildResult |= msg.result; break; } case CONTROL_RESUMED: { CONTROLResumedEvent msg(event); LOG_DEBUG_STR("Received RESUMED(" << msg.cntlrName << ")"); - // TODO: do something usefull with this information! --> OE 837 + itsChildResult |= msg.result; break; } case CONTROL_SUSPENDED: { CONTROLSuspendedEvent msg(event); LOG_DEBUG_STR("Received SUSPENDED(" << msg.cntlrName << ")"); - // TODO: do something usefull with this information! --> OE 837 + itsChildResult |= msg.result; break; } case CONTROL_RELEASED: { CONTROLReleasedEvent msg(event); LOG_DEBUG_STR("Received RELEASED(" << msg.cntlrName << ")"); - // TODO: do something usefull with this information! --> OE 837 + itsChildResult |= msg.result; break; } - case CONTROL_FINISH: { + case CONTROL_FINISH: { // Note: request iso answer CONTROLFinishEvent msg(event); LOG_DEBUG_STR("Received FINISH(" << msg.cntlrName << ")"); -// CONTROLFinishedEvent answer; -// answer.cntlrName = msg.cntlrName; -// answer.result = CT_RESULT_NO_ERROR; -// port.send(answer); break; } @@ -676,23 +676,42 @@ void ObservationControl::setObservationTimers() // void ObservationControl::doHeartBeatTask() { + // re-init heartbeat timer. + itsTimerPort->cancelTimer(itsHeartBeatTimer); itsHeartBeatTimer = itsTimerPort->setTimer(1.0 * itsHeartBeatItv); + // find out how many controllers are still busy. uint32 nrChilds = itsChildControl->countChilds(0, CNTLRTYPE_NO_TYPE); vector<ChildControl::StateInfo> lateCntlrs = itsChildControl->getPendingRequest("", 0, CNTLRTYPE_NO_TYPE); + + // all controllers up to date? if (lateCntlrs.empty()) { LOG_DEBUG_STR("All (" << nrChilds << ") controllers are up to date"); if (itsState == CTState::FINISH) { LOG_DEBUG_STR("Time for me to shutdown"); TRAN(ObservationControl::finishing_state); + return; } +// TODO: ParentControl asserts with: +// _doRequestedAction:MCU001:ObservationControl[0]{13} : Claimed-->Connected [ParentControl.cc:342] +// Assertion: parent->currentState == CTState::CONNECT; Unexpected state:9 [ParentControl.cc:374] +// +// if (itsBusyControllers) { // last time not all cntrls ready? +// CTState cts; +// sendControlResult(*itsParentPort, cts.signal(itsState), getName(), +// itsChildResult); +// TODO +// DO NOT SEND RESULT TO MACSCHEDULER BUT CALL setState with right state(curstate+1)... +// itsBusyControllers = 0; +// } return; } - LOG_DEBUG_STR (lateCntlrs.size() << " controllers are still out of sync"); + itsBusyControllers = lateCntlrs.size(); + LOG_DEBUG_STR (itsBusyControllers << " controllers are still out of sync"); CTState cts; - for (uint32 i = 0; i < lateCntlrs.size(); i++) { + for (uint32 i = 0; i < itsBusyControllers; i++) { ChildControl::StateInfo* si = &lateCntlrs[i]; LOG_DEBUG_STR(si->name << ":" << cts.name(si->currentState) << " iso " << cts.name(si->requestedState)); diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h index 04e14f5b9b9..0e23be716a4 100644 --- a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h +++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h @@ -140,6 +140,8 @@ private: GCFTimerPort* itsTimerPort; CTState::CTstateNr itsState; + uint32 itsBusyControllers; + uint16 itsChildResult; // timers for the several stages. uint32 itsClaimTimer; diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControl.cc b/MAC/APL/StationCU/src/BeamControl/BeamControl.cc index 3ef20250b76..f81c3bfe0ed 100644 --- a/MAC/APL/StationCU/src/BeamControl/BeamControl.cc +++ b/MAC/APL/StationCU/src/BeamControl/BeamControl.cc @@ -74,9 +74,6 @@ BeamControl::BeamControl(const string& cntlrName) : itsTreePrefix = globalParameterSet()->getString("prefix"); itsInstanceNr = globalParameterSet()->getUint32("_instanceNr"); - // Instruct codeloggingProcessor - LOG_INFO_STR("MACProcessScope: " << itsTreePrefix + cntlrName); - // attach to parent control task itsParentControl = ParentControl::instance(); itsParentPort = new GCFITCPort (*this, *itsParentControl, "ParentITCport", @@ -96,6 +93,7 @@ BeamControl::BeamControl(const string& cntlrName) : registerProtocol (CONTROLLER_PROTOCOL, CONTROLLER_PROTOCOL_signalnames); registerProtocol (PA_PROTOCOL, PA_PROTOCOL_signalnames); registerProtocol (BS_PROTOCOL, BS_PROTOCOL_signalnames); + registerProtocol (F_PML_PROTOCOL, F_PML_PROTOCOL_signalnames); setState(CTState::CREATED); } @@ -109,7 +107,7 @@ BeamControl::~BeamControl() LOG_TRACE_OBJ_STR (getName() << " destruction"); if (itsPropertySet) { - itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("down")); + itsPropertySet->setValue(PVSSNAME_FSM_STATE, GCFPVString("down")); itsPropertySet->disable(); } @@ -125,8 +123,7 @@ void BeamControl::setState(CTState::CTstateNr newState) if (itsPropertySet) { CTState cts; - itsPropertySet->setValue(string(PVSSNAME_FSM_STATE), - GCFPVString(cts.name(newState))); + itsPropertySet->setValue(PVSSNAME_FSM_STATE, GCFPVString(cts.name(newState))); } } @@ -220,10 +217,10 @@ GCFEvent::TResult BeamControl::initial_state(GCFEvent& event, case F_INIT: { // Get access to my own propertyset. string propSetName(createPropertySetName(PSN_BEAM_CTRL, getName())); - LOG_DEBUG_STR ("Activating PropertySet" << propSetName); + LOG_INFO_STR ("Activating PropertySet" << propSetName); itsPropertySet = GCFMyPropertySetPtr(new GCFMyPropertySet(propSetName.c_str(), PST_BEAM_CTRL, - PS_CAT_TEMPORARY, + PS_CAT_TEMP_AUTOLOAD, &itsPropertySetAnswer)); itsPropertySet->enable(); // Wait for timer that is set in PropertySetAnswer on ENABLED event @@ -234,10 +231,15 @@ GCFEvent::TResult BeamControl::initial_state(GCFEvent& event, if (!itsPropertySetInitialized) { itsPropertySetInitialized = true; + // Instruct codeloggingProcessor + // TODO + uint32 treeID = getObservationNr(getName()); + LOG_INFO_STR("MACProcessScope: LOFAR.ObsSW.Observation" << treeID << ".BeamCtrl"); + // update PVSS. LOG_TRACE_FLOW ("Updateing state to PVSS"); - itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("initial")); - itsPropertySet->setValue(string(PVSSNAME_FSM_ERROR),GCFPVString("")); + itsPropertySet->setValue(PVSSNAME_FSM_STATE,GCFPVString("initial")); + itsPropertySet->setValue(PVSSNAME_FSM_ERROR,GCFPVString("")); // Start ParentControl task LOG_DEBUG ("Enabling ParentControl task and wait for my name"); @@ -262,7 +264,7 @@ GCFEvent::TResult BeamControl::initial_state(GCFEvent& event, setState(CTState::CONNECTED); sendControlResult(port, CONTROL_CONNECTED, msg.cntlrName, CT_RESULT_NO_ERROR); - LOG_DEBUG ("Going to started state"); + LOG_INFO ("Going to started state"); TRAN(BeamControl::started_state); // go to next state. break; } @@ -291,7 +293,7 @@ GCFEvent::TResult BeamControl::started_state(GCFEvent& event, GCFPortInterface& case F_ENTRY: { // update PVSS // itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("started")); - itsPropertySet->setValue(string(PVSSNAME_FSM_ERROR),GCFPVString("")); + itsPropertySet->setValue(PVSSNAME_FSM_ERROR,GCFPVString("")); break; } @@ -303,7 +305,7 @@ GCFEvent::TResult BeamControl::started_state(GCFEvent& event, GCFPortInterface& ASSERTSTR (&port == itsBeamServer, "F_CONNECTED event from port " << port.getName()); itsTimerPort->cancelAllTimers(); - LOG_DEBUG ("Connected with BeamServer, going to claimed state"); + LOG_INFO ("Connected with BeamServer, going to claimed state"); setState(CTState::CLAIMED); sendControlResult(*itsParentPort, CONTROL_CLAIMED, getName(), CT_RESULT_NO_ERROR); TRAN(BeamControl::claimed_state); // go to next state. @@ -314,7 +316,7 @@ GCFEvent::TResult BeamControl::started_state(GCFEvent& event, GCFPortInterface& port.close(); ASSERTSTR (&port == itsBeamServer, "F_DISCONNECTED event from port " << port.getName()); - LOG_DEBUG("Connection with BeamServer failed, retry in 2 seconds"); + LOG_WARN ("Connection with BeamServer failed, retry in 2 seconds"); itsTimerPort->setTimer(2.0); break; } @@ -365,7 +367,7 @@ GCFEvent::TResult BeamControl::claimed_state(GCFEvent& event, GCFPortInterface& case F_ENTRY: { // update PVSS // itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("claimed")); - itsPropertySet->setValue(string(PVSSNAME_FSM_ERROR),GCFPVString("")); + itsPropertySet->setValue(PVSSNAME_FSM_ERROR, GCFPVString("")); break; } @@ -377,7 +379,7 @@ GCFEvent::TResult BeamControl::claimed_state(GCFEvent& event, GCFPortInterface& port.close(); ASSERTSTR (&port == itsBeamServer, "F_DISCONNECTED event from port " << port.getName()); - LOG_DEBUG("Connection with BeamServer lost, going to reconnect state."); + LOG_WARN("Connection with BeamServer lost, going to reconnect state."); TRAN(BeamControl::started_state); break; } @@ -404,7 +406,7 @@ GCFEvent::TResult BeamControl::claimed_state(GCFEvent& event, GCFPortInterface& uint16 result = handleBeamAllocAck(event); if (result == CT_RESULT_NO_ERROR) { setState(CTState::PREPARED); - LOG_DEBUG("Beam allocated, going to active state"); + LOG_INFO("Beam allocated, going to active state"); TRAN(BeamControl::active_state); } else { @@ -441,7 +443,7 @@ GCFEvent::TResult BeamControl::active_state(GCFEvent& event, GCFPortInterface& p case F_ENTRY: { // update PVSS // itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("active")); - itsPropertySet->setValue(string(PVSSNAME_FSM_ERROR),GCFPVString("")); + itsPropertySet->setValue(PVSSNAME_FSM_ERROR, GCFPVString("")); break; } @@ -453,7 +455,7 @@ GCFEvent::TResult BeamControl::active_state(GCFEvent& event, GCFPortInterface& p port.close(); ASSERTSTR (&port == itsBeamServer, "F_DISCONNECTED event from port " << port.getName()); - LOG_DEBUG("Connection with BeamServer lost, going to reconnect"); + LOG_WARN("Connection with BeamServer lost, going to reconnect"); TRAN(BeamControl::started_state); break; } @@ -503,12 +505,12 @@ GCFEvent::TResult BeamControl::active_state(GCFEvent& event, GCFPortInterface& p // -------------------- EVENTS RECEIVED FROM BEAMSERVER -------------------- case BS_BEAMFREEACK: { if (!handleBeamFreeAck(event)) { - LOG_DEBUG("Error in freeing beam, staying in active_state"); + LOG_WARN("Error in freeing beam, staying in active_state"); sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), CT_RESULT_BEAMFREE_FAILED); } else { - LOG_DEBUG("Released beam going back to 'claimed' mode"); + LOG_INFO("Released beam going back to 'claimed' mode"); setState(CTState::RELEASED); sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), CT_RESULT_NO_ERROR); @@ -541,7 +543,7 @@ GCFEvent::TResult BeamControl::quiting_state(GCFEvent& event, GCFPortInterface& // update PVSS setState(CTState::FINISH); // itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("quiting")); - itsPropertySet->setValue(string(PVSSNAME_FSM_ERROR),GCFPVString("")); + itsPropertySet->setValue(PVSSNAME_FSM_ERROR, GCFPVString("")); itsBeamServer->close(); break; } @@ -556,7 +558,7 @@ GCFEvent::TResult BeamControl::quiting_state(GCFEvent& event, GCFPortInterface& case F_CLOSED: { ASSERTSTR (&port == itsBeamServer, "F_DISCONNECTED event from port " << port.getName()); - LOG_DEBUG("Connection with BeamServer down, sending FINISH"); + LOG_INFO("Connection with BeamServer down, sending FINISH"); CONTROLFinishEvent request; request.cntlrName = getName(); request.result = CT_RESULT_NO_ERROR; @@ -576,7 +578,7 @@ GCFEvent::TResult BeamControl::quiting_state(GCFEvent& event, GCFPortInterface& case CONTROL_FINISHED: { CONTROLFinishedEvent msg(event); LOG_DEBUG_STR("Received FINISHED(" << msg.cntlrName << ")"); - LOG_DEBUG_STR("Normal shutdown of " << getName()); + LOG_INFO_STR("Normal shutdown of " << getName()); setState(CTState::FINISHED); stop(); break; diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h b/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h index 848fb618ba5..7beeb303631 100644 --- a/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h +++ b/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h @@ -35,6 +35,7 @@ namespace LOFAR { // next lines should be defined somewhere in Common. #define PVSSNAME_FSM_STATE "state" #define PVSSNAME_FSM_ERROR "error" +#define PVSSNAME_FSM_LOGMSG "logmsg" }; // MCU }; // LOFAR diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc index 7a7399347b1..7566b12b7bd 100644 --- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc +++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc @@ -75,9 +75,6 @@ CalibrationControl::CalibrationControl(const string& cntlrName) : itsInstanceNr = globalParameterSet()->getUint32("_instanceNr"); itsObsPar = Observation(globalParameterSet()); - // Instruct CodeLoggingProcessor - LOG_INFO_STR("MACProcessScope: " << itsTreePrefix + cntlrName); - // attach to parent control task itsParentControl = ParentControl::instance(); itsParentPort = new GCFITCPort (*this, *itsParentControl, "ParentITCport", @@ -112,6 +109,7 @@ CalibrationControl::~CalibrationControl() if (itsPropertySet) { itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("down")); + itsPropertySet->disable(); } // ... @@ -212,10 +210,10 @@ GCFEvent::TResult CalibrationControl::initial_state(GCFEvent& event, case F_ENTRY: { // Get access to my own propertyset. string propSetName(createPropertySetName(PSN_CAL_CTRL, getName())); - LOG_DEBUG_STR ("Activating PropertySet" << propSetName); + LOG_INFO_STR ("Activating PropertySet" << propSetName); itsPropertySet = GCFMyPropertySetPtr(new GCFMyPropertySet(propSetName.c_str(), PST_CAL_CTRL, - PS_CAT_TEMPORARY, + PS_CAT_TEMP_AUTOLOAD, &itsPropertySetAnswer)); itsPropertySet->enable(); // Wait for timer that is set in PropertySetAnswer on ENABLED event @@ -226,10 +224,16 @@ GCFEvent::TResult CalibrationControl::initial_state(GCFEvent& event, if (!itsPropertySetInitialized) { itsPropertySetInitialized = true; + // Instruct CodeLoggingProcessor + // TODO + uint32 treeID = getObservationNr(getName()); + LOG_INFO_STR("MACProcessScope: LOFAR.ObsSW.Observation" << treeID << ".CalCtrl"); + // update PVSS. LOG_TRACE_FLOW ("Updateing state to PVSS"); itsPropertySet->setValue(string(PVSSNAME_FSM_STATE),GCFPVString("initial")); itsPropertySet->setValue(string(PVSSNAME_FSM_ERROR),GCFPVString("")); + itsPropertySet->setValue(string(PN_CC_CONNECTED),GCFPVBool(false)); // Start ParentControl task LOG_DEBUG ("Enabling ParentControl task and wait for my name"); @@ -254,7 +258,7 @@ GCFEvent::TResult CalibrationControl::initial_state(GCFEvent& event, setState(CTState::CONNECTED); sendControlResult(port, CONTROL_CONNECTED, msg.cntlrName, CT_RESULT_NO_ERROR); - LOG_DEBUG ("Going to started state"); + LOG_INFO ("Going to started state"); TRAN(CalibrationControl::started_state); break; } @@ -293,7 +297,8 @@ GCFEvent::TResult CalibrationControl::started_state(GCFEvent& event, ASSERTSTR (&port == itsCalServer, "F_CONNECTED event from port " << port.getName()); itsTimerPort->cancelAllTimers(); - LOG_DEBUG ("Connected with CalServer, going to claimed state"); + itsPropertySet->setValue(string(PN_CC_CONNECTED),GCFPVBool(true)); + LOG_INFO ("Connected with CalServer, going to claimed state"); setState(CTState::CLAIMED); sendControlResult(*itsParentPort, CONTROL_CLAIMED, getName(), CT_RESULT_NO_ERROR); TRAN(CalibrationControl::claimed_state); // go to next state. @@ -303,7 +308,8 @@ GCFEvent::TResult CalibrationControl::started_state(GCFEvent& event, port.close(); ASSERTSTR (&port == itsCalServer, "F_DISCONNECTED event from port " << port.getName()); - LOG_DEBUG("Connection with CalServer failed, retry in 2 seconds"); + itsPropertySet->setValue(string(PN_CC_CONNECTED),GCFPVBool(false)); + LOG_WARN("Connection with CalServer failed, retry in 2 seconds"); itsTimerPort->setTimer(2.0); break; @@ -365,7 +371,7 @@ GCFEvent::TResult CalibrationControl::claimed_state(GCFEvent& event, port.close(); ASSERTSTR (&port == itsCalServer, "F_DISCONNECTED event from port " << port.getName()); - LOG_DEBUG("Connection with CalServer lost, going to reconnect state."); + LOG_WARN("Connection with CalServer lost, going to reconnect state."); TRAN(CalibrationControl::started_state); break; @@ -393,7 +399,7 @@ GCFEvent::TResult CalibrationControl::claimed_state(GCFEvent& event, case CAL_STARTACK: { CALStartackEvent ack(event); if (ack.status == SUCCESS || ack.status == ERR_ALREADY_REGISTERED) { - LOG_DEBUG ("Start of calibration was succesful"); + LOG_INFO ("Start of calibration was succesful"); sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(), CT_RESULT_NO_ERROR); setState(CTState::PREPARED); @@ -486,7 +492,7 @@ GCFEvent::TResult CalibrationControl::active_state(GCFEvent& event, GCFPortInter case CAL_STOPACK: { CALStopackEvent ack(event); if (ack.status == SUCCESS) { - LOG_DEBUG ("Calibration successfully stopped"); + LOG_INFO ("Calibration successfully stopped"); sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), CT_RESULT_NO_ERROR); setState(CTState::RELEASED); diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h index 0ab51a724a1..83b7add17e3 100644 --- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h +++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h @@ -28,14 +28,17 @@ namespace LOFAR { #define CC_TASKNAME "CalCtrl" -#define PSN_CAL_CTRL "LOFAR_PermSW_CalCtrl@instance@" -#define PST_CAL_CTRL "CalCtrl" +#define PSN_CAL_CTRL "LOFAR_ObsSW_@observation@_CalCtrl" +#define PST_CAL_CTRL "CalCtrl" +#define PN_CC_CONNECTED "connected" +#define PN_CC_SUBARRAYS "subarrays" #define PROPNAME_FUNCTIONALITY "functionality" // next lines should be defined somewhere in Common. #define PVSSNAME_FSM_STATE "state" #define PVSSNAME_FSM_ERROR "error" +#define PVSSNAME_FSM_LOGMSG "logmsg" }; // MCU diff --git a/MAC/APL/StationCU/src/DigitalBoardControl/DigitalBoardControl.cc b/MAC/APL/StationCU/src/DigitalBoardControl/DigitalBoardControl.cc index 2c94ad5440f..ee0dc23a53a 100644 --- a/MAC/APL/StationCU/src/DigitalBoardControl/DigitalBoardControl.cc +++ b/MAC/APL/StationCU/src/DigitalBoardControl/DigitalBoardControl.cc @@ -73,7 +73,7 @@ DigitalBoardControl::DigitalBoardControl(const string& cntlrName) : itsClock = globalParameterSet()->getUint32(itsTreePrefix + "sampleClock"); // TODO - LOG_INFO("MACProcessScope: LOFAR.PermSW.iDigBoardCtrl"); + LOG_INFO("MACProcessScope: LOFAR.PermSW.DigBoardCtrl"); // need port for timers. itsTimerPort = new GCFTimerPort(*this, "TimerPort"); @@ -125,7 +125,7 @@ DigitalBoardControl::~DigitalBoardControl() // void DigitalBoardControl::handlePropertySetAnswer(GCFEvent& answer) { - LOG_DEBUG_STR ("handlePropertySetAnswer:" << eventstr(answer)); + LOG_TRACE_FLOW_STR ("handlePropertySetAnswer:" << eventstr(answer)); switch(answer.signal) { case F_MYPS_ENABLED: diff --git a/MAC/APL/StationCU/src/StationControl/ActiveObs.cc b/MAC/APL/StationCU/src/StationControl/ActiveObs.cc index 3cac6c2eaef..306024fa75a 100644 --- a/MAC/APL/StationCU/src/StationControl/ActiveObs.cc +++ b/MAC/APL/StationCU/src/StationControl/ActiveObs.cc @@ -30,6 +30,7 @@ #include <APL/APLCommon/ChildControl.h> #include <APL/APLCommon/ControllerDefines.h> #include <APL/APLCommon/Controller_Protocol.ph> +#include "StationControlDefines.h" #include "ActiveObs.h" // Observation @@ -73,6 +74,10 @@ ActiveObs::ActiveObs(const string& name, // ActiveObs::~ActiveObs() { + if (itsPropertySet) { + itsPropertySet->disable(); + delete itsPropertySet; + } } // @@ -118,6 +123,14 @@ void ActiveObs::handlePropertySetAnswer(GCFEvent& answer) // LOG_DEBUG_STR("Received clock change from PVSS, clock is now " << itsClock); // break; // } + + // don't watch state and error fields. + if ((strstr(pPropAnswer->pPropName, PVSSNAME_FSM_STATE) != 0) || + (strstr(pPropAnswer->pPropName, PVSSNAME_FSM_ERROR) != 0) || + (strstr(pPropAnswer->pPropName, PVSSNAME_FSM_LOGMSG) != 0)) { + return; + } + LOG_WARN_STR("Got VCHANGEMSG signal from unknown property " << pPropAnswer->pPropName); } @@ -205,14 +218,14 @@ GCFEvent::TResult ActiveObs::starting(GCFEvent& event, GCFPortInterface& /*port* ChildControl::instance()->startChild(CNTLRTYPE_CALIBRATIONCTRL, itsObsPar.treeID, itsInstanceNr, - myHostname(true)); + myHostname(false)); // Results in CONTROL_CONNECT in StationControl Task. LOG_DEBUG_STR("Starting controller " << itsBeamCntlrName); ChildControl::instance()->startChild(CNTLRTYPE_BEAMCTRL, itsObsPar.treeID, itsInstanceNr, - myHostname(true)); + myHostname(false)); // Results in CONTROL_CONNECT in StationControl Task. } break; @@ -423,6 +436,22 @@ GCFEvent::TResult ActiveObs::operational(GCFEvent& event, GCFPortInterface& /*po case CONTROL_SUSPENDED: break; + case CONTROL_RESUME: { + // pass event through to controllers + LOG_DEBUG("Passing RESUME event to childs"); + itsBeamCntlrReady = false; + itsCalCntlrReady = false; + ChildControl::instance()-> + requestState(CTState::RESUMED, itsBeamCntlrName, 0, CNTLRTYPE_NO_TYPE); + ChildControl::instance()-> + requestState(CTState::RESUMED, itsCalCntlrName, 0, CNTLRTYPE_NO_TYPE); + // will result in CONTROL_RESUMED + } + break; + + case CONTROL_RESUMED: + break; + case CONTROL_RELEASE: { // release beam at the BeamController LOG_DEBUG_STR("Asking " << itsBeamCntlrName << " to stop the beam"); @@ -434,10 +463,19 @@ GCFEvent::TResult ActiveObs::operational(GCFEvent& event, GCFPortInterface& /*po case CONTROL_RELEASED: { CONTROLReleaseEvent msg(event); - ASSERTSTR(msg.cntlrName == itsBeamCntlrName, - "Received released event of unknown controller: " << msg.cntlrName); - LOG_DEBUG_STR("Beam is stopped, going to standby mode"); - TRAN(ActiveObs::standby); + if (msg.cntlrName == itsBeamCntlrName) { + LOG_DEBUG_STR("Beam is stopped, stopping calibration"); + ChildControl::instance()-> + requestState(CTState::RELEASED, itsCalCntlrName, 0, CNTLRTYPE_NO_TYPE); + break; + } + if (msg.cntlrName == itsCalCntlrName) { + LOG_DEBUG_STR("Calibration is stopped, going to standby mode"); + TRAN(ActiveObs::standby); + break; + } + ASSERTSTR(false, "RELEASE event received from unknown controller:" + << msg.cntlrName); } break; diff --git a/MAC/APL/StationCU/src/StationControl/StationControl.cc b/MAC/APL/StationCU/src/StationControl/StationControl.cc index 7ad946bf58a..274b744f649 100644 --- a/MAC/APL/StationCU/src/StationControl/StationControl.cc +++ b/MAC/APL/StationCU/src/StationControl/StationControl.cc @@ -125,7 +125,7 @@ StationControl::~StationControl() // void StationControl::handlePropertySetAnswer(GCFEvent& answer) { - LOG_DEBUG_STR ("handlePropertySetAnswer:" << eventstr(answer)); + LOG_TRACE_FLOW_STR ("handlePropertySetAnswer:" << eventstr(answer)); switch(answer.signal) { case F_MYPS_ENABLED: @@ -299,15 +299,16 @@ GCFEvent::TResult StationControl::connect_state(GCFEvent& event, itsChildControl->startChild(CNTLRTYPE_DIGITALBOARDCTRL, 0, // treeID, 0, // instanceNr, - myHostname(true)); + myHostname(false)); // will result in CONTROL_STARTED (and CONTROL_CONNECTED if no error). } break; case CONTROL_STARTED: { CONTROLStartedEvent msg(event); - ASSERTSTR(msg.cntlrName == controllerName(CNTLRTYPE_DIGITALBOARDCTRL, 0 ,0), - "Started event of unknown controller: " << msg.cntlrName); +// ASSERTSTR(msg.cntlrName == controllerName(CNTLRTYPE_DIGITALBOARDCTRL, 0 ,0), +// "Started event of unknown controller: " << msg.cntlrName); +// note: hostname is now in controller. if (msg.successful) { LOG_INFO_STR("Startup of " << msg.cntlrName << " succesful, waiting for connection"); @@ -325,8 +326,9 @@ GCFEvent::TResult StationControl::connect_state(GCFEvent& event, case CONTROL_CONNECTED: { CONTROLConnectedEvent msg(event); - ASSERTSTR(msg.cntlrName == controllerName(CNTLRTYPE_DIGITALBOARDCTRL, 0 ,0), - "Connect event of unknown controller: " << msg.cntlrName); +// ASSERTSTR(msg.cntlrName == controllerName(CNTLRTYPE_DIGITALBOARDCTRL, 0 ,0), +// "Connect event of unknown controller: " << msg.cntlrName); +// note: hostname is now in controller. // inform parent the chain is up CONTROLConnectedEvent answer; -- GitLab