Skip to content
Snippets Groups Projects
Commit 70ebc466 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1284: Added support for external ABORT command.

parent e5bf351d
No related branches found
No related tags found
No related merge requests found
......@@ -128,12 +128,6 @@ ObservationControl::ObservationControl(const string& cntlrName) :
// need port for timers.
itsTimerPort = new GCFTimerPort(*this, "TimerPort");
// startup claimManager task
// itsClaimMgrTask = ClaimMgrTask::instance();
// ASSERTSTR(itsClaimMgrTask, "Can't construct a claimMgrTask");
// itsClaimMgrPort = new GCFITCPort (*this, *this, "ClaimMgrPort",
// GCFPortInterface::SAP, CM_PROTOCOL);
registerProtocol (CONTROLLER_PROTOCOL, CONTROLLER_PROTOCOL_STRINGS);
registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS);
registerProtocol (CM_PROTOCOL, CM_PROTOCOL_STRINGS);
......@@ -190,66 +184,6 @@ void ObservationControl::setState(CTState::CTstateNr newState)
itsParentControl->nowInState(getName(), newState);
}
//
// initial_state(event, port)
//
// Create top datapoint of this observation in PVSS.
//
GCFEvent::TResult ObservationControl::initial_state(GCFEvent& event,
GCFPortInterface& port)
{
static bool firstPass;
LOG_DEBUG_STR ("initial:" << eventName(event) << "@" << port.getName());
GCFEvent::TResult status = GCFEvent::HANDLED;
switch (event.signal) {
case F_INIT: // must exist in initializing FSM
break;
case F_ENTRY: {
itsTimerPort->cancelAllTimers();
itsTimerPort->setTimer(0.0);
firstPass = true;
}
break;
case F_TIMER: {
if (!firstPass) {
LOG_ERROR_STR("Can't get real name of databasePoint for "<<observationName(itsTreeID));
}
// Ask claimMgrTask to get the DPname of this observation
itsClaimMgrTask->claimObject("Observation",
"LOFAR_ObsSW_"+observationName(itsTreeID), *itsClaimMgrPort);
// will result in CM_CLAIM_RESULT event
itsTimerPort->setTimer(10.0); // set emergency timer.
firstPass = false;
}
break;
case CM_CLAIM_RESULT: {
// TODO: implement error checking and retrying.
CMClaimResultEvent cmEvent(event);
LOG_INFO_STR(cmEvent.nameInAppl << " is mapped to " << cmEvent.DPname);
itsObsDPname = cmEvent.DPname;
itsTimerPort->cancelAllTimers();
TRAN(ObservationControl::starting_state); // go to next state.
}
break;
default:
LOG_DEBUG_STR ("initial, default");
status = GCFEvent::NOT_HANDLED;
break;
}
return (status);
}
//
// starting_state(event, port)
//
......@@ -780,17 +714,32 @@ void ObservationControl::_databaseEventHandler(GCFEvent& event)
return;
}
// abort request?
if (strstr(dpEvent.DPname.c_str(), PN_OBSCTRL_COMMAND) != 0) {
string command = ((GCFPVString*) (dpEvent.value._pValue))->getValue();
if (command == "ABORT") {
LOG_INFO("Received manual request for abort, accepting it.");
itsTimerPort->cancelTimer(itsStopTimer); // cancel old timer
itsStopTimer = itsTimerPort->setTimer(0.0); // expire immediately
}
return;
LOG_INFO_STR ("Received unknown command " << command << ". Ignoring it.");
}
// Change of claim_period?
if (strstr(dpEvent.DPname.c_str(), PN_OBS_CLAIM_PERIOD) != 0) {
uint32 newVal = ((GCFPVInteger*) (dpEvent.value._pValue))->getValue();
LOG_INFO_STR ("Changing ClaimPeriod from " << itsClaimPeriod << " to " << newVal);
itsClaimPeriod = newVal;
return;
}
// Change of prepare_period?
else if (strstr(dpEvent.DPname.c_str(), PN_OBS_PREPARE_PERIOD) != 0) {
uint32 newVal = ((GCFPVInteger*) (dpEvent.value._pValue))->getValue();
LOG_INFO_STR ("Changing PreparePeriod from " << itsPreparePeriod << " to " << newVal);
itsPreparePeriod = newVal;
return;
}
// Change of start or stop time?
......
// This file was generated by create_db_files v1.0 on Wed Mar 11 12:40:11 UTC 2009
// This file was generated by create_db_files v2.0 on Tue Sep 8 12:34:54 UTC 2009
#ifndef LOFAR_DEPLOYMENT_PVSSDATAPOINTS_H
#define LOFAR_DEPLOYMENT_PVSSDATAPOINTS_H
......@@ -42,7 +42,6 @@
#define PST_OBSERVATION "Observation"
#define PN_OBS_CLAIM_CLAIM_DATE "claim.claimDate"
#define PN_OBS_CLAIM_NAME "claim.name"
#define PN_OBS_RECEIVER_BITMAP "receiverBitmap"
#define PN_OBS_CLAIM_PERIOD "claimPeriod"
#define PN_OBS_PREPARE_PERIOD "preparePeriod"
#define PN_OBS_START_TIME "startTime"
......@@ -67,18 +66,40 @@
// ObservationControl
#define PSN_OBSERVATION_CONTROL "LOFAR_ObsSW_@observation@_ObservationControl"
#define PST_OBSERVATION_CONTROL "ObservationControl"
#define PN_OBSCTRL_COMMAND "command"
// OnlineControl
#define PSN_ONLINE_CONTROL "LOFAR_ObsSW_@observation@_OnlineControl"
#define PST_ONLINE_CONTROL "OnlineControl"
// Adder
#define PSN_ADDER "@adder@"
#define PST_ADDER "Adder"
#define PN_ADD_DROPPING "dropping"
#define PN_ADD_NR_BLOCKS_DROPPED "nrBlocksDropped"
#define PN_ADD_LOG_LINE "logLine"
// Correlator
#define PSN_CORRELATOR "LOFAR_ObsSW_@observation@_OnlineControl_Correlator"
#define PST_CORRELATOR "Correlator"
// InputBuffer
#define PSN_INPUT_BUFFER "@inputbuffer@"
#define PST_INPUT_BUFFER "InputBuffer"
#define PN_IPB_STATION_NAME "stationName"
#define PN_IPB_STREAM0_BLOCKS_IN "stream0.blocksIn"
#define PN_IPB_STREAM0_PERC_BAD "stream0.percBad"
#define PN_IPB_STREAM0_REJECTED "stream0.rejected"
#define PN_IPB_STREAM1_BLOCKS_IN "stream1.blocksIn"
#define PN_IPB_STREAM1_PERC_BAD "stream1.percBad"
#define PN_IPB_STREAM1_REJECTED "stream1.rejected"
#define PN_IPB_STREAM2_BLOCKS_IN "stream2.blocksIn"
#define PN_IPB_STREAM2_PERC_BAD "stream2.percBad"
#define PN_IPB_STREAM2_REJECTED "stream2.rejected"
#define PN_IPB_STREAM3_BLOCKS_IN "stream3.blocksIn"
#define PN_IPB_STREAM3_PERC_BAD "stream3.percBad"
#define PN_IPB_STREAM3_REJECTED "stream3.rejected"
#define PN_IPB_LATE "late"
#define PN_IPB_IO_TIME "IOTime"
// StorageAppl
#define PSN_STORAGE_APPL "LOFAR_ObsSW_@observation@_OnlineControl_StorageAppl"
#define PST_STORAGE_APPL "StorageAppl"
// Storage
#define PSN_STORAGE "@storage@"
#define PST_STORAGE "Storage"
#define PN_STR_TIME "time"
#define PN_STR_COUNT "count"
#define PN_STR_DROPPED "dropped"
// Cabinet
#define PSN_CABINET "LOFAR_PIC_@cabinet@"
......@@ -136,6 +157,7 @@
#define PN_RSP_VOLTAGE33 "voltage33"
#define PN_RSP_VERSION "version"
#define PN_RSP_ALERT "alert"
#define PN_RSP_SPLITTER_ON "splitterOn"
#define PN_RSP__ETHERNET_STATUS_STATE "Ethernet.status.state"
#define PN_RSP__ETHERNET_STATUS_CHILD_STATE "Ethernet.status.childState"
#define PN_RSP__ETHERNET_STATUS_MESSAGE "Ethernet.status.message"
......@@ -260,6 +282,7 @@
#define PST_HARDWARE_MONITOR "HardwareMonitor"
#define PN_HWM_RSP_CONNECTED "RSP.connected"
#define PN_HWM_TBB_CONNECTED "TBB.connected"
#define PN_HWM_EC_CONNECTED "EC.connected"
// SoftwareMonitor
#define PSN_SOFTWARE_MONITOR "LOFAR_PermSW_SoftwareMonitor"
......@@ -300,6 +323,7 @@
#define PN_OBS_NAME "name"
#define PN_OBS_CLAIM_CLAIM_DATE "claim.claimDate"
#define PN_OBS_CLAIM_NAME "claim.name"
#define PN_OBS_RECEIVER_BITMAP "receiverBitmap"
// BeamControl
#define PSN_BEAM_CONTROL "LOFAR_ObsSW_@observation@_BeamControl"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment