diff --git a/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.h b/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.h index 03e6dda01060d5a6d1044614d3644395d3a4dbaa..61a2ecb1f84aea826335a5eb0c6d7d52e568b2a8 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.h +++ b/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.h @@ -24,8 +24,8 @@ #define CEPAPPLMGR_H //# Includes -#include <ALC/ACAsyncClient.h> #include <GCF/TM/GCF_Handler.h> +#include <ALC/ACAsyncClient.h> #include <APL/APLCommon/CTState.h> //# local includes diff --git a/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt b/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt index 78eaac88f09dbdaa1bf7780c706432a75172ad94..a97577bda5839778d9b90238fada73087b9f2d39 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt +++ b/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt @@ -9,3 +9,5 @@ lofar_add_bin_program(OnlineControl OnlineControlMain.cc OnlineControl.cc CEPApplMgr.cc) + +lofar_add_executable(tPVSSMapping tPVSSMapping.cc) diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc b/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc index 8a5b5c45af27b7379a1424cae1dfb37127dac9e2..81ef1a54b1ed2a40a80e647070d3583856ad3529 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc +++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc @@ -20,20 +20,20 @@ //# //# $Id$ #include <lofar_config.h> -#include <Common/LofarLogger.h> - #include <signal.h> +#include <Common/LofarLogger.h> +#include <Common/LofarLocators.h> #include <Common/StreamUtil.h> -//#include <Common/lofar_vector.h> -//#include <Common/lofar_string.h> #include <Common/ParameterSet.h> +#include <Common/ParameterRecord.h> #include <Common/Exceptions.h> -#include <ApplCommon/StationInfo.h> -#include <GCF/PVSS/GCF_PVTypes.h> #include <Common/SystemUtil.h> +#include <ApplCommon/StationInfo.h> +#include <ApplCommon/Observation.h> #include <ApplCommon/LofarDirs.h> #include <MACIO/MACServiceInfo.h> #include <GCF/TM/GCF_Protocols.h> +#include <GCF/PVSS/GCF_PVTypes.h> #include <APL/APLCommon/APL_Defines.h> #include <APL/APLCommon/APLUtilities.h> #include <APL/APLCommon/ControllerDefines.h> @@ -43,6 +43,7 @@ #include <PLC/PCCmd.h> #include "OnlineControl.h" +#include <OTDB/TreeValue.h> // << need to include this after OnlineControl! ??? #include "PVSSDatapointDefs.h" using namespace LOFAR::GCF::PVSS; @@ -53,6 +54,7 @@ using namespace std; namespace LOFAR { using namespace APLCommon; using namespace ACC::ALC; + using namespace OTDB; namespace CEPCU { // static pointer to this object for signal handler @@ -64,6 +66,7 @@ static OnlineControl* thisOnlineControl = 0; OnlineControl::OnlineControl(const string& cntlrName) : GCFTask ((State)&OnlineControl::initial_state,cntlrName), itsPropertySet (0), + itsBGPApplPropSet (0), itsPropertySetInitialized (false), itsParentControl (0), itsParentPort (0), @@ -304,10 +307,9 @@ void OnlineControl::_databaseEventHandler(GCFEvent& event) // // initial_state(event, port) // -// Setup all connections. +// Create my own propertySet // -GCFEvent::TResult OnlineControl::initial_state(GCFEvent& event, - GCFPortInterface& port) +GCFEvent::TResult OnlineControl::initial_state(GCFEvent& event, GCFPortInterface& port) { LOG_INFO_STR ("initial:" << eventName(event) << "@" << port.getName()); @@ -320,7 +322,8 @@ GCFEvent::TResult OnlineControl::initial_state(GCFEvent& event, case F_INIT: { // Get access to my own propertyset. // uint32 obsID = globalParameterSet()->getUint32("Observation.ObsID"); - string propSetName(createPropertySetName(PSN_ONLINE_CONTROL, getName())); + string obsDPname = globalParameterSet()->getString("_DPname"); + string propSetName(createPropertySetName(PSN_ONLINE_CONTROL, getName(), obsDPname)); LOG_DEBUG_STR ("Activating PropertySet: "<< propSetName); itsPropertySet = new RTDBPropertySet(propSetName, PST_ONLINE_CONTROL, @@ -330,12 +333,12 @@ GCFEvent::TResult OnlineControl::initial_state(GCFEvent& event, break; case DP_CREATED: { - // NOTE: thsi function may be called DURING the construction of the PropertySet. + // NOTE: this function may be called DURING the construction of the PropertySet. // Always exit this event in a way that GCF can end the construction. DPCreatedEvent dpEvent(event); LOG_DEBUG_STR("Result of creating " << dpEvent.DPname << " = " << dpEvent.result); itsTimerPort->cancelAllTimers(); - itsTimerPort->setTimer(0.0); + itsTimerPort->setTimer(0.5); } break; @@ -344,7 +347,63 @@ GCFEvent::TResult OnlineControl::initial_state(GCFEvent& event, LOG_TRACE_FLOW ("Updateing state to PVSS"); itsPropertySet->setValue(PN_FSM_CURRENT_ACTION, GCFPVString("initial")); itsPropertySet->setValue(PN_FSM_ERROR, GCFPVString("")); - + + LOG_DEBUG ("Going to create BGPAppl datapoint"); + TRAN(OnlineControl::propset_state); // go to next state. + } + break; + + case F_CONNECTED: + ASSERTSTR (&port == itsParentPort, "F_CONNECTED event from port " << port.getName()); + break; + + case F_DISCONNECTED: + break; + + default: + LOG_DEBUG_STR ("initial, default"); + status = GCFEvent::NOT_HANDLED; + break; + } + return (status); +} + +// +// propset_state(event, port) +// +// Connect to BGPAppl DP and start rest of tasks +// +GCFEvent::TResult OnlineControl::propset_state(GCFEvent& event, GCFPortInterface& port) +{ + LOG_INFO_STR ("propset:" << eventName(event) << "@" << port.getName()); + + GCFEvent::TResult status = GCFEvent::HANDLED; + + switch (event.signal) { + case F_ENTRY: { + // Get access to my own propertyset. +// uint32 obsID = globalParameterSet()->getUint32("Observation.ObsID"); + string obsDPname = globalParameterSet()->getString("_DPname"); + string propSetName(createPropertySetName(PSN_BGP_APPL, getName(), obsDPname)); + LOG_DEBUG_STR ("Activating PropertySet: "<< propSetName); + itsBGPApplPropSet = new RTDBPropertySet(propSetName, + PST_BGP_APPL, + PSAT_RW, + this); + } + break; + + case DP_CREATED: { + // NOTE: this function may be called DURING the construction of the PropertySet. + // Always exit this event in a way that GCF can end the construction. + DPCreatedEvent dpEvent(event); + LOG_DEBUG_STR("Result of creating " << dpEvent.DPname << " = " << dpEvent.result); + itsTimerPort->cancelAllTimers(); + itsTimerPort->setTimer(0.5); + } + break; + + case F_TIMER: { // must be timer that PropSet is online. // start StopTimer for safety. LOG_INFO_STR("Starting QUIT timer that expires 5 seconds after end of observation"); ptime now(second_clock::universal_time()); @@ -361,15 +420,14 @@ GCFEvent::TResult OnlineControl::initial_state(GCFEvent& event, break; case F_CONNECTED: - ASSERTSTR (&port == itsParentPort, - "F_CONNECTED event from port " << port.getName()); + ASSERTSTR (&port == itsParentPort, "F_CONNECTED event from port " << port.getName()); break; case F_DISCONNECTED: break; default: - LOG_DEBUG_STR ("initial, default"); + LOG_DEBUG_STR ("propset, default"); status = GCFEvent::NOT_HANDLED; break; } @@ -441,6 +499,7 @@ GCFEvent::TResult OnlineControl::active_state(GCFEvent& event, GCFPortInterface& itsLogControlPort->send(announce); // execute this state _setState(CTState::CONNECT); + _setupBGPmappingTables(); _doBoot(); // start ACC's and boot them break; } @@ -560,6 +619,7 @@ GCFEvent::TResult OnlineControl::finishing_state(GCFEvent& event, GCFPortInterfa } case F_TIMER: + _passMetadatToOTDB(); GCFScheduler::instance()->stop(); break; @@ -572,6 +632,84 @@ GCFEvent::TResult OnlineControl::finishing_state(GCFEvent& event, GCFPortInterfa return (status); } +// +// _setupBGPmappingTables +// +void OnlineControl::_setupBGPmappingTables() +{ + Observation theObs(globalParameterSet(), false); + int nrStreams = theObs.streamsToStorage.size(); + LOG_DEBUG_STR("_setupBGPmapping: " << nrStreams << " streams found."); + + // e.g. CS001 , [0,2,3,6] , [L36000_SAP000_SB000_uv.MS, ...] , [1,3,5,4] + GCFPValueArray ionodeArr; + GCFPValueArray locusArr; + GCFPValueArray adderArr; + GCFPValueArray writerArr; + GCFPValueArray dpArr; + GCFPValueArray dptypeArr; + + uint prevPset = (nrStreams ? theObs.streamsToStorage[0].sourcePset : -1); + vector<string> locusVector; + vector<int> adderVector; + vector<int> writerVector; + vector<string> DPVector; + vector<string> DPtypeVector; + for (int i = 0; i < nrStreams; i++) { + if (theObs.streamsToStorage[i].sourcePset != prevPset) { // other Pset? write current vector to the database. + ionodeArr.push_back(new GCFPVInteger(prevPset)); + { stringstream os; + writeVector(os, locusVector); + locusArr.push_back (new GCFPVString(os.str())); + } + { stringstream os; + writeVector(os, adderVector); + adderArr.push_back (new GCFPVString(os.str())); + } + { stringstream os; + writeVector(os, writerVector); + writerArr.push_back(new GCFPVString(os.str())); + } + { stringstream os; + writeVector(os, DPVector); + dpArr.push_back (new GCFPVString(os.str())); + } + { stringstream os; + writeVector(os, DPtypeVector); + dptypeArr.push_back(new GCFPVString(os.str())); + } + // clear the collecting vectors + locusVector.clear(); + adderVector.clear(); + writerVector.clear(); + DPVector.clear(); + DPtypeVector.clear(); + prevPset = theObs.streamsToStorage[i].sourcePset; + } + // extend vector with info + locusVector.push_back (theObs.streamsToStorage[i].destStorageNode); + adderVector.push_back (theObs.streamsToStorage[i].adderNr); + writerVector.push_back(theObs.streamsToStorage[i].writerNr); + DPVector.push_back (theObs.streamsToStorage[i].filename); + DPtypeVector.push_back(theObs.streamsToStorage[i].dataProduct); + } + itsBGPApplPropSet->setValue(PN_BGPA_IO_NODE_LIST, GCFPVDynArr(LPT_DYNINTEGER, ionodeArr)); + itsBGPApplPropSet->setValue(PN_BGPA_LOCUS_NODE_LIST, GCFPVDynArr(LPT_DYNSTRING, locusArr)); + itsBGPApplPropSet->setValue(PN_BGPA_ADDER_LIST, GCFPVDynArr(LPT_DYNSTRING, adderArr)); + itsBGPApplPropSet->setValue(PN_BGPA_WRITER_LIST, GCFPVDynArr(LPT_DYNSTRING, writerArr)); + itsBGPApplPropSet->setValue(PN_BGPA_DATA_PRODUCT_LIST, GCFPVDynArr(LPT_DYNSTRING, dpArr)); + itsBGPApplPropSet->setValue(PN_BGPA_DATA_PRODUCT_TYPE_LIST, GCFPVDynArr(LPT_DYNSTRING, dptypeArr)); + + // release claimed memory. + for (int i = ionodeArr.size()-1; i>=0; i--) { + delete ionodeArr[i]; + delete locusArr[i]; + delete adderArr[i]; + delete writerArr[i]; + delete dpArr[i]; + delete dptypeArr[i]; + } +} // // _doBoot() @@ -695,6 +833,83 @@ void OnlineControl::_doQuit(void) } } +// +// _passMetadatToOTDB(); +// THIS ROUTINE IS A MODIFIED COPY FROM PYTHONCONTROL.CC +// +void OnlineControl::_passMetadatToOTDB() +{ + // No name specified? + uint32 obsID(globalParameterSet()->getUint32("Observation.ObsID", 0)); + string feedbackFile = observationParset(obsID)+"_feedback"; + LOG_INFO_STR ("Expecting metadata to be in file " << feedbackFile); + if (feedbackFile.empty()) { + return; + } + + // read parameterset + ParameterSet metadata; + metadata.adoptFile(feedbackFile); + + // Try to setup the connection with the database + string confFile = globalParameterSet()->getString("OTDBconfFile", "SASGateway.conf"); + ConfigLocator CL; + string filename = CL.locate(confFile); + LOG_INFO_STR("Trying to read database information from file " << filename); + ParameterSet otdbconf; + otdbconf.adoptFile(filename); + string database = otdbconf.getString("SASGateway.OTDBdatabase"); + string dbhost = otdbconf.getString("SASGateway.OTDBhostname"); + OTDBconnection conn("paulus", "boskabouter", database, dbhost); + if (!conn.connect()) { + LOG_FATAL_STR("Cannot connect to database " << database << " on machine " << dbhost); + return; + } + LOG_INFO_STR("Connected to database " << database << " on machine " << dbhost); + + TreeValue tv(&conn, getObservationNr(getName())); + + // Loop over the parameterset and send the information to the KVTlogger. + // During the transition phase from parameter-based to record-based storage in OTDB the + // nodenames ending in '_' are implemented both as parameter and as record. + ParameterSet::iterator iter = metadata.begin(); + ParameterSet::iterator end = metadata.end(); + while (iter != end) { + string key(iter->first); // make destoyable copy + rtrim(key, "[]0123456789"); +// bool doubleStorage(key[key.size()-1] == '_'); + bool isRecord(iter->second.isRecord()); + // isRecord doubleStorage + // -------------------------------------------------------------- + // Y Y store as record and as parameters + // Y N store as parameters + // N * store parameter + if (!isRecord) { + LOG_DEBUG_STR("BASIC: " << iter->first << " = " << iter->second); + tv.addKVT(iter->first, iter->second, ptime(microsec_clock::local_time())); + } + else { +// if (doubleStorage) { +// LOG_DEBUG_STR("RECORD: " << iter->first << " = " << iter->second); +// tv.addKVT(iter->first, iter->second, ptime(microsec_clock::local_time())); +// } + // to store is a node/param values the last _ should be stipped of + key = iter->first; // destroyable copy +// string::size_type pos = key.find_last_of('_'); +// key.erase(pos,1); + ParameterRecord pr(iter->second.getRecord()); + ParameterRecord::const_iterator prIter = pr.begin(); + ParameterRecord::const_iterator prEnd = pr.end(); + while (prIter != prEnd) { + LOG_DEBUG_STR("ELEMENT: " << key+"."+prIter->first << " = " << prIter->second); + tv.addKVT(key+"."+prIter->first, prIter->second, ptime(microsec_clock::local_time())); + prIter++; + } + } + iter++; + } + LOG_INFO_STR(metadata.size() << " metadata values send to SAS"); +} // -------------------- Application-order administration -------------------- // diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.h b/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.h index c6c29e2e052d4810a05eaf6641b6d3aaa2c5894f..09e695da178ecd507c4aea046f97d215ec09545e 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.h +++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.h @@ -65,15 +65,14 @@ public: explicit OnlineControl(const string& cntlrName); ~OnlineControl(); - // During the initial state all connections with the other programs are made. - GCFEvent::TResult initial_state (GCFEvent& e, - GCFPortInterface& p); + // Connect to our own propertyset. + GCFEvent::TResult initial_state (GCFEvent& e, GCFPortInterface& p); + // Connect to BGPAppl propset and start remaining tasks. + GCFEvent::TResult propset_state (GCFEvent& e, GCFPortInterface& p); // Normal control mode. - GCFEvent::TResult active_state (GCFEvent& e, - GCFPortInterface& p); + GCFEvent::TResult active_state (GCFEvent& e, GCFPortInterface& p); // Finishing mode. - GCFEvent::TResult finishing_state(GCFEvent& event, - GCFPortInterface& port); + GCFEvent::TResult finishing_state(GCFEvent& event, GCFPortInterface& port); // Interrupthandler for switching to finisingstate when exiting the program static void signalHandler (int signum); @@ -95,6 +94,7 @@ private: OnlineControl(const OnlineControl&); OnlineControl& operator=(const OnlineControl&); + void _setupBGPmappingTables(); void _doBoot(); void _doQuit(); void _finishController (uint16_t result); @@ -102,6 +102,7 @@ private: void _disconnectedHandler (GCFPortInterface& port); void _setState (CTState::CTstateNr newState); void _databaseEventHandler(GCFEvent& event); + void _passMetadatToOTDB (); // Send a command to all (or the first) applications. void startNewState (CTState::CTstateNr newState, @@ -121,6 +122,7 @@ private: // ----- datamembers ----- RTDBPropertySet* itsPropertySet; + RTDBPropertySet* itsBGPApplPropSet; bool itsPropertySetInitialized; // pointer to parent control task diff --git a/MAC/APL/CEPCU/src/OnlineControl/PVSSDatapointDefs.h b/MAC/APL/CEPCU/src/OnlineControl/PVSSDatapointDefs.h index cbd965ef734851eac9ee2fe781706f559b0efca9..95cadd7cb63cd86cb01c7f49b46f759020968018 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/PVSSDatapointDefs.h +++ b/MAC/APL/CEPCU/src/OnlineControl/PVSSDatapointDefs.h @@ -1,4 +1,4 @@ -// This file was generated by create_db_files v1.0 on Thu Mar 19 14:56:58 UTC 2009 +// This file was generated by create_db_files v2.0 on Fri Apr 13 09:04:54 UTC 2012 #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" @@ -63,22 +62,68 @@ #define PN_OBS_BEAMS_DIRECTION_TYPE "Beams.directionType" #define PN_OBS_BEAMS_BEAMLET_LIST "Beams.beamletList" #define PN_OBS_BEAMS_SUBBAND_LIST "Beams.subbandList" +#define PN_OBS_TIED_ARRAY_BEAMS_BEAM_INDEX "TiedArrayBeams.beamIndex" +#define PN_OBS_TIED_ARRAY_BEAMS_ANGLE1 "TiedArrayBeams.angle1" +#define PN_OBS_TIED_ARRAY_BEAMS_ANGLE2 "TiedArrayBeams.angle2" +#define PN_OBS_TIED_ARRAY_BEAMS_DIRECTION_TYPE "TiedArrayBeams.directionType" +#define PN_OBS_TIED_ARRAY_BEAMS_DISPERSION "TiedArrayBeams.dispersion" +#define PN_OBS_TIED_ARRAY_BEAMS_COHERENT "TiedArrayBeams.coherent" // ObservationControl #define PSN_OBSERVATION_CONTROL "LOFAR_ObsSW_@observation@_ObservationControl" #define PST_OBSERVATION_CONTROL "ObservationControl" +#define PN_OBSCTRL_COMMAND "command" + +// Adder +#define PSN_ADDER "@adder@" +#define PST_ADDER "Adder" +#define PN_ADD_DROPPING "dropping" +#define PN_ADD_NR_BLOCKS_DROPPED "nrBlocksDropped" +#define PN_ADD_DATA_PRODUCT_TYPE "dataProductType" +#define PN_ADD_FILE_NAME "fileName" +#define PN_ADD_STORAGE_NODE "storageNode" +#define PN_ADD_DIRECTORY "directory" +#define PN_ADD_OBSERVATION_NAME "observationName" + +// 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" + +// Storage +#define PSN_STORAGE "@storage@" +#define PST_STORAGE "Storage" +#define PN_STR_TIME "time" +#define PN_STR_COUNT "count" +#define PN_STR_DROPPED "dropped" // OnlineControl #define PSN_ONLINE_CONTROL "LOFAR_ObsSW_@observation@_OnlineControl" #define PST_ONLINE_CONTROL "OnlineControl" -// Correlator -#define PSN_CORRELATOR "LOFAR_ObsSW_@observation@_OnlineControl_Correlator" -#define PST_CORRELATOR "Correlator" - -// StorageAppl -#define PSN_STORAGE_APPL "LOFAR_ObsSW_@observation@_OnlineControl_StorageAppl" -#define PST_STORAGE_APPL "StorageAppl" +// BGPAppl +#define PSN_BGP_APPL "LOFAR_ObsSW_@observation@_OnlineControl_BGPAppl" +#define PST_BGP_APPL "BGPAppl" +#define PN_BGPA_IO_NODE_LIST "ioNodeList" +#define PN_BGPA_LOCUS_NODE_LIST "locusNodeList" +#define PN_BGPA_ADDER_LIST "adderList" +#define PN_BGPA_WRITER_LIST "writerList" +#define PN_BGPA_DATA_PRODUCT_LIST "dataProductList" +#define PN_BGPA_DATA_PRODUCT_TYPE_LIST "dataProductTypeList" // Cabinet #define PSN_CABINET "LOFAR_PIC_@cabinet@" @@ -217,10 +262,15 @@ #define PN_RCU_TRIGGER_FILTER "Trigger.filter" #define PN_RCU_TRIGGER_WINDOW "Trigger.window" #define PN_RCU_TRIGGER_OPERATING_MODE "Trigger.operatingMode" -#define PN_RCU_TRIGGER_COEFF0 "Trigger.coeff0" -#define PN_RCU_TRIGGER_COEFF1 "Trigger.coeff1" -#define PN_RCU_TRIGGER_COEFF2 "Trigger.coeff2" -#define PN_RCU_TRIGGER_COEFF3 "Trigger.coeff3" +#define PN_RCU_TRIGGER_TRIGGER_MODE "Trigger.triggerMode" +#define PN_RCU_TRIGGER_FILTER0_COEFF0 "Trigger.filter0.coeff0" +#define PN_RCU_TRIGGER_FILTER0_COEFF1 "Trigger.filter0.coeff1" +#define PN_RCU_TRIGGER_FILTER0_COEFF2 "Trigger.filter0.coeff2" +#define PN_RCU_TRIGGER_FILTER0_COEFF3 "Trigger.filter0.coeff3" +#define PN_RCU_TRIGGER_FILTER1_COEFF0 "Trigger.filter1.coeff0" +#define PN_RCU_TRIGGER_FILTER1_COEFF1 "Trigger.filter1.coeff1" +#define PN_RCU_TRIGGER_FILTER1_COEFF2 "Trigger.filter1.coeff2" +#define PN_RCU_TRIGGER_FILTER1_COEFF3 "Trigger.filter1.coeff3" // TBBoard #define PSN_TB_BOARD "LOFAR_PIC_@cabinet@_@subrack@_@TBBoard@" @@ -294,7 +344,7 @@ #define PN_ANT_RCUY "RCUY" #define PN_ANT_DELTAX "deltaX" #define PN_ANT_DELTAY "deltaY" -#define PN_ANT_DELTAH "deltaH" +#define PN_ANT_DELTAZ "deltaZ" // StnObservation #define PSN_STN_OBSERVATION "LOFAR_ObsSW_@observation@" @@ -302,6 +352,9 @@ #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" +#define PN_OBS_HB_ABITMAP "HBAbitmap" +#define PN_OBS_LB_ABITMAP "LBAbitmap" // BeamControl #define PSN_BEAM_CONTROL "LOFAR_ObsSW_@observation@_BeamControl" @@ -338,5 +391,6 @@ #define PN_TBC_TRIGGER_PEAK_VALUE "trigger.peakValue" #define PN_TBC_TRIGGER_FLAGS "trigger.flags" #define PN_TBC_TRIGGER_TABLE "trigger.table" +#define PN_TBC_TRIGGER_MISSED "trigger.missed" #endif diff --git a/MAC/APL/CEPCU/src/PythonControl/PythonControl.cc b/MAC/APL/CEPCU/src/PythonControl/PythonControl.cc index 6ca68cbe2fd7f54e5800358cc0b2055af4d643e2..ac863758473e20476fe6708ea4f4763015592975 100644 --- a/MAC/APL/CEPCU/src/PythonControl/PythonControl.cc +++ b/MAC/APL/CEPCU/src/PythonControl/PythonControl.cc @@ -185,6 +185,10 @@ bool PythonControl::_startPython(const string& pythonProg, } } + // Readin parameters from the obsercationfile. + itsFeedbackFile = observationParset(obsID)+"_feedback"; + LOG_INFO_STR ("Expect metadata to be in file " << itsFeedbackFile); + // construct system command string startCmd; string startScript("startPython.sh"); @@ -203,13 +207,23 @@ bool PythonControl::_startPython(const string& pythonProg, myHostname(true).c_str(), parentService.c_str(), itsPythonName.c_str()); } LOG_INFO_STR("About to start: " << startCmd); - - int32 result = system (startCmd.c_str()); - LOG_INFO_STR ("Result of start = " << result); - - // Readin parameters from the obsercationfile. - itsFeedbackFile = observationParset(obsID)+"_feedback"; - LOG_INFO_STR ("Expecting metadata in file " << itsFeedbackFile); +#if 1 + FILE* pipe = popen(startCmd.c_str(), "r"); + if (!pipe) { + LOG_FATAL_STR("Couldn't execute '" << startCmd << ", errno = " << strerror(errno)); + return (false); + } + LOG_INFO("Output of command: ..."); + while (!feof(pipe)) { + char buffer[1024]; + LOG_INFO_STR(fgets(buffer, 1024, pipe)); + } + LOG_INFO("... end of command output"); + int result = pclose(pipe); +#else + int result = system (startCmd.c_str()); +#endif + LOG_INFO_STR ("Result of command = " << result); if (result == -1) { return (false);