From f63eff2995ba6dc21f1a6e6a8a2666a1e4fe5eff Mon Sep 17 00:00:00 2001
From: Ruud Overeem <overeem@astron.nl>
Date: Wed, 17 Sep 2008 14:15:36 +0000
Subject: [PATCH] Bug 1000: Directory cleanup and support of receiverBitMap
 field.

---
 .../src/MACScheduler/MACScheduler.log_prop.in | 20 ----
 MAC/APL/MainCU/src/MACScheduler/Makefile.am   | 12 +--
 MAC/APL/MainCU/src/MACScheduler/ObsClaimer.cc | 11 +++
 .../MainCU/src/ObservationControl/Makefile.am | 13 ---
 .../ObservationControl/ObservationControl.cc  | 92 -------------------
 .../ObservationControl/ObservationControl.h   |  3 -
 .../ObservationControl.log_prop.in            | 20 ----
 7 files changed, 12 insertions(+), 159 deletions(-)
 delete mode 100644 MAC/APL/MainCU/src/MACScheduler/MACScheduler.log_prop.in
 delete mode 100644 MAC/APL/MainCU/src/ObservationControl/ObservationControl.log_prop.in

diff --git a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.log_prop.in b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.log_prop.in
deleted file mode 100644
index b8d1bef7ab1..00000000000
--- a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.log_prop.in
+++ /dev/null
@@ -1,20 +0,0 @@
-# add your custom loggers and appenders here
-#
-
-log4cplus.rootLogger=DEBUG, STDOUT, FILE
-
-log4cplus.logger.TRC=TRACE2
-log4cplus.additivity.TRC=FALSE
-
-log4cplus.appender.STDOUT=log4cplus::ConsoleAppender
-log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout
-log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S.%q} %-5p %c{9} - %m [%.25l]%n
-log4cplus.appender.STDOUT.logToStdErr=true
-
-log4cplus.appender.FILE=log4cplus::RollingFileAppender
-log4cplus.appender.FILE.File=../log/MACScheduler.log
-log4cplus.appender.FILE.MaxFileSize=5MB
-log4cplus.appender.FILE.MaxBackupIndex=5
-log4cplus.appender.FILE.layout=log4cplus::PatternLayout
-log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S.%q} %-5p %c{3} - %m [%.25l]%n
-
diff --git a/MAC/APL/MainCU/src/MACScheduler/Makefile.am b/MAC/APL/MainCU/src/MACScheduler/Makefile.am
index 62ceb65d4c6..05488375dc1 100644
--- a/MAC/APL/MainCU/src/MACScheduler/Makefile.am
+++ b/MAC/APL/MainCU/src/MACScheduler/Makefile.am
@@ -29,19 +29,9 @@ EXTRA_DIST 					= $(configfiles_DATA) $(sysconf_DATA)
 configfilesdir=$(bindir)
 configfiles_DATA 	= 
 
-sysconf_DATA		= MACScheduler.conf \
-					  MACScheduler.log_prop
-
-%.log_prop: %.log_prop.in
-	cp $< $@
+sysconf_DATA		= MACScheduler.conf
 
 %.conf: %.conf.in
 	cp $< $@
 
-%.ctl: %.ctl.in
-	cp $< $@
-
-clean-local:
-	rm -f *.ph
-
 include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.cc b/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.cc
index 63b1a02ec45..5a966e2a727 100644
--- a/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.cc
+++ b/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.cc
@@ -239,6 +239,17 @@ GCFEvent::TResult ObsClaimer::preparePVSS_state (GCFEvent& event, GCFPortInterfa
 			theObsPS->setValue(PN_OBS_BGL_NODE_LIST, 	GCFPVString (theObs.BGLNodeList), 	  0.0, false);
 			theObsPS->setValue(PN_OBS_STORAGE_NODE_LIST,GCFPVString (theObs.storageNodeList), 0.0, false);
 
+			// the receiver bitmap can be derived from the RCUset.
+			int		nrReceivers(theObs.RCUset.size());
+			string	rbm;
+			rbm.resize(nrReceivers, '0');
+			for (int i = 0; i < nrReceivers; i++) {
+				if (theObs.RCUset[i]) {
+					rbm[i] = '1';
+				}
+			}
+			theObsPS->setValue(PN_OBS_RECEIVER_BITMAP,GCFPVString (rbm), 0.0, false);
+
 			// for the beams we have to construct dyn arrays first.
 			GCFPValueArray		subbandArr;
 			GCFPValueArray		beamletArr;
diff --git a/MAC/APL/MainCU/src/ObservationControl/Makefile.am b/MAC/APL/MainCU/src/ObservationControl/Makefile.am
index cf4b86d9ebc..4a6b706458e 100644
--- a/MAC/APL/MainCU/src/ObservationControl/Makefile.am
+++ b/MAC/APL/MainCU/src/ObservationControl/Makefile.am
@@ -22,17 +22,4 @@ DOCHDRS						= $(pkginclude_HEADERS) $(BUILT_SOURCES)
 
 EXTRA_DIST 					= $(configfiles_DATA) $(sysconf_DATA)
 
-#in case of make install these files will be copied to the bindir beside the test apps
-configfilesdir=$(bindir)
-configfiles_DATA 	= 
-#customPrepPVSSDB.ctl
-
-sysconf_DATA		= ObservationControl.log_prop
-
-%.log_prop: %.log_prop.in
-	cp $< $@
-
-clean-local:
-	rm -f *.ph
-
 include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc
index 933b92cf9bd..1265da7ddc2 100644
--- a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc
+++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc
@@ -239,7 +239,6 @@ GCFEvent::TResult ObservationControl::initial_state(GCFEvent& event,
 		LOG_INFO_STR(cmEvent.nameInAppl << " is mapped to " << cmEvent.DPname);
 		itsObsDPname = cmEvent.DPname;
 		itsTimerPort->cancelAllTimers();
-//		TRAN(ObservationControl::prepDB_state);				// go to next state.
 		TRAN(ObservationControl::starting_state);			// go to next state.
 	}
 	break;
@@ -254,97 +253,6 @@ GCFEvent::TResult ObservationControl::initial_state(GCFEvent& event,
 }
 
 
-//
-// prepDB_state(event, port)
-//
-// Create top datapoint of this observation in PVSS.
-//
-// NOTE: This state becomes obsolete for Navigator 2
-//
-GCFEvent::TResult ObservationControl::prepDB_state(GCFEvent& event, 
-													GCFPortInterface& port)
-{
-	GCFEvent::TResult status = GCFEvent::HANDLED;
-	
-#if 0  
-	uint32	gNrStations = 0;
-
-	LOG_DEBUG_STR ("prepDB:" << eventName(event) << "@" << port.getName());
-
-	switch (event.signal) {
-    case F_INIT:
-   		break;
-
-	case F_ENTRY: {
-		// Create 'Observation<nr>_<station>' datapoint for each station of the observation
-		Observation		theObs(globalParameterSet());
-		vector<string>		stations(theObs.stations);
-		vector<string>::iterator	iter = stations.begin();
-		vector<string>::iterator	end  = stations.end();
-		gNrStations = stations.size();
-		LOG_DEBUG_STR(gNrStations << " stations are used in this Observation.");
-		string	DPobsName(createPropertySetName(PSN_OBSERVATION, getName())+"_Core_");	// observation<nr>_
-		while (iter != end) {
-			string	stationName(PVSSDatabaseName(*iter));
-			LOG_DEBUG_STR ("Creating PropertySet: " << DPobsName+stationName);
-			itsStationDPs[stationName] = new RTDBPropertySet(DPobsName+stationName,
-															 PST_STATION,
-															 PSAT_RW | PSAT_TMP,
-															 this);
-			iter++;
-		}
-	}
-	break;
-	  
-	case DP_CREATED: {
-			// NOTE: thsi 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);
-			gNrStations--;
-			if (!gNrStations) {
-				itsTimerPort->cancelAllTimers();
-				itsTimerPort->setTimer(0.0);
-			}
-			else { 
-				LOG_DEBUG_STR("Still waiting for " << gNrStations << " stationDPs.");
-				itsTimerPort->setTimer(0.0);
-			}
-        }
-		break;
-	  
-	case F_TIMER: {		// must be timer that PropSet has set.
-		// update PVSS.
-		LOG_TRACE_FLOW ("Station DPs created, setting station reference values");
-		string	observationName(createPropertySetName(PSN_OBSERVATION, getName()));
-		map<string, RTDBPropertySet*>::iterator		iter = itsStationDPs.begin();
-		map<string, RTDBPropertySet*>::iterator		end  = itsStationDPs.end();
-		while (iter != end) {
-
-			// write station reference in Observation DP
-			iter->second->setValue("__childDp", iter->first+"="+iter->first+":"+observationName);
-			iter++;
-		}
-		TRAN(ObservationControl::starting_state);				// go to next state.
-	}
-	break;
-
-	case F_CONNECTED:
-		break;
-
-	case F_DISCONNECTED:
-		break;
-	
-	default:
-		LOG_DEBUG_STR ("prepDB, default");
-		status = GCFEvent::NOT_HANDLED;
-		break;
-	}    
-#endif
-	return (status);
-}
-
-
 //
 // starting_state(event, port)
 //
diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h
index b45bdf5e174..2d9a4cb6588 100644
--- a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h
+++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.h
@@ -70,9 +70,6 @@ public:
 	// During this state the top DP LOFAR_ObsSW_<observation> is created
    	GCFEvent::TResult initial_state (GCFEvent& e, GCFPortInterface& p);
 	
-	// During this state station DP's wih references to the stations are created.
-   	GCFEvent::TResult prepDB_state (GCFEvent& e, GCFPortInterface& p);
-	
 	// During this state all connections with the other programs are made.
    	GCFEvent::TResult starting_state (GCFEvent& e, GCFPortInterface& p);
 	
diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.log_prop.in b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.log_prop.in
deleted file mode 100644
index e671bccda67..00000000000
--- a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.log_prop.in
+++ /dev/null
@@ -1,20 +0,0 @@
-# add your custom loggers and appenders here
-#
-
-log4cplus.rootLogger=DEBUG, STDOUT, FILE
-
-log4cplus.logger.TRC=TRACE3
-log4cplus.additivity.TRC=FALSE
-
-log4cplus.appender.STDOUT=log4cplus::ConsoleAppender
-log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout
-log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S.%q} %-5p %c{9} - %m [%.25l]%n
-log4cplus.appender.STDOUT.logToStdErr=true
-
-log4cplus.appender.FILE=log4cplus::RollingFileAppender
-log4cplus.appender.FILE.File=../log/ObservationControl.log
-log4cplus.appender.FILE.MaxFileSize=5MB
-log4cplus.appender.FILE.MaxBackupIndex=5
-log4cplus.appender.FILE.layout=log4cplus::PatternLayout
-log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S.%q} %-5p %c{3} - %m [%.25l]%n
-
-- 
GitLab