From f7d1c46a7ab7d23608aebde3ff647dcbb1116c1e Mon Sep 17 00:00:00 2001
From: blaakmeer <sdos@astron.nl>
Date: Wed, 1 Sep 2004 12:14:55 +0000
Subject: [PATCH] %[ER: 117]% integration test

---
 MAC/APL/APLCommon/src/Makefile.am             |  3 +
 .../PAC/_VirtualTelescope/src/AVTDefines.h    |  1 +
 .../src/AVTLogicalDeviceScheduler.cc          | 29 ++++----
 .../src/AVTStationBeamformer.cc               |  8 +--
 MAC/APL/PAC/_VirtualTelescope/src/Makefile.am | 26 ++++---
 MAC/APL/PAC/_VirtualTelescope/src/avt.top.in  | 36 +++++-----
 .../PAC/_VirtualTelescope/test/AVTTestTask.cc |  8 +--
 .../PAC/_VirtualTelescope/test/Makefile.am    | 16 ++---
 .../PIC/_RegisterAccess/src/ARAConstants.h    |  3 +-
 .../_RegisterAccess/src/ARAPropertyDefines.h  | 16 +++--
 .../src/ARARegisterAccessTask.cc              | 10 +--
 .../src/ARARegisterAccessTask.h               | 17 ++++-
 MAC/APL/PIC/_RegisterAccess/src/Makefile.am   | 20 ++++--
 MAC/APL/PIC/_RegisterAccess/src/ara.ns.in     |  7 +-
 MAC/APL/PIC/_RegisterAccess/src/ara.top.in    |  4 +-
 .../_RegisterAccess/test/ARATestDriverTask.cc | 68 ++++++++++++++++---
 .../_RegisterAccess/test/ARATestDriverTask.h  |  4 ++
 MAC/APL/PIC/_RegisterAccess/test/Makefile.am  | 13 ++--
 MAC/APL/configure.in                          |  2 +
 19 files changed, 192 insertions(+), 99 deletions(-)

diff --git a/MAC/APL/APLCommon/src/Makefile.am b/MAC/APL/APLCommon/src/Makefile.am
index ea02ef6f7bf..c100ffa688a 100644
--- a/MAC/APL/APLCommon/src/Makefile.am
+++ b/MAC/APL/APLCommon/src/Makefile.am
@@ -7,6 +7,9 @@ DOCHDRS	=	$(include_HEADERS) \
       
 noinst_LTLIBRARIES 	= libaplcommon.la
 
+libaplcommon_la__CPPFLAGS= \
+  -Wno-deprecated 
+
 libaplcommon_la_SOURCES= $(DOCHDRS) \
 	APLInterTaskPort.cc \
 	suite.cpp \
diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTDefines.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTDefines.h
index 5565190a2cb..c83aaf146fd 100644
--- a/MAC/APL/PAC/_VirtualTelescope/src/AVTDefines.h
+++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTDefines.h
@@ -24,6 +24,7 @@
 #define AVTDefines_H
 
 #define PREPARE_TIME 5   
+#define AVT_N_BEAMLETS 128
 
 #define LD_COMMAND_SCHEDULE           "SCHEDULE"
 #define LD_COMMAND_CANCEL             "CANCEL"
diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc
index 4eea838f882..71312a5551d 100644
--- a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc
+++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc
@@ -456,21 +456,25 @@ GCFEvent::TResult AVTLogicalDeviceScheduler::initial_state(GCFEvent& event, GCFP
 
       // create receptor groups
       vector<shared_ptr<AVTStationReceptor> > receptorsSRG1;
+      vector<shared_ptr<AVTStationReceptor> > receptorsSRG2;
+      vector<shared_ptr<AVTStationReceptor> > receptorsSRG3;
+      vector<shared_ptr<AVTStationReceptor> > receptorsSRG4;
+      
       receptorsSRG1.push_back(receptors[0]);
       receptorsSRG1.push_back(receptors[1]);
-      receptorsSRG1.push_back(receptors[2]);
-      receptorsSRG1.push_back(receptors[3]);
-      receptorsSRG1.push_back(receptors[4]);
-      receptorsSRG1.push_back(receptors[5]);
-      receptorsSRG1.push_back(receptors[6]);
-      receptorsSRG1.push_back(receptors[7]);
-      vector<shared_ptr<AVTStationReceptor> > receptorsSRG2(receptors.begin(),receptors.begin()+4);
-      vector<shared_ptr<AVTStationReceptor> > receptorsSRG3;
-      vector<shared_ptr<AVTStationReceptor> > receptorsSRG4(receptors.begin()+5,receptors.begin()+8);
-      receptorsSRG3.push_back(receptors[1]);
-      receptorsSRG3.push_back(receptors[3]);
+      
+      receptorsSRG2.push_back(receptors[2]);
+      receptorsSRG2.push_back(receptors[3]);
+      
+      receptorsSRG3.push_back(receptors[4]);
       receptorsSRG3.push_back(receptors[5]);
-      receptorsSRG3.push_back(receptors[7]);
+      
+      receptorsSRG4.push_back(receptors[0]);
+      receptorsSRG4.push_back(receptors[1]);
+      receptorsSRG4.push_back(receptors[2]);
+      receptorsSRG4.push_back(receptors[3]);
+      receptorsSRG4.push_back(receptors[4]);
+      receptorsSRG4.push_back(receptors[5]);
 
       addReceptorGroup(string("SRG1"),propertySetSRG1,receptorsSRG1);
       addReceptorGroup(string("SRG2"),propertySetSRG2,receptorsSRG2);
@@ -994,7 +998,6 @@ void AVTLogicalDeviceScheduler::sendWGsettings()
   ABSWgsettingsEvent wgSettingsEvent;
   wgSettingsEvent.frequency = m_WGfrequency;
   wgSettingsEvent.amplitude = static_cast<unsigned char>(m_WGamplitude);
-  wgSettingsEvent.sample_period = static_cast<unsigned char>(m_WGsamplePeriod);
   
 // m_beamServer.send(wgSettingsEvent);
   if(m_pBeamServer!=0)
diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc
index 9a5c6743f12..5ecdedb2c09 100644
--- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc
+++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc
@@ -539,14 +539,14 @@ void AVTStationBeamformer::concretePrepare(GCFPortInterface& /*port*/,string& pa
   m_beamID=0; // TODO
   int spectral_window(0);
   int n_subbands(subbandsVector.size());
-  int subbandsArray[ABS::N_BEAMLETS];
+  int subbandsArray[AVT_N_BEAMLETS];
   char tempLogStr[1000];
   tempLogStr[0]=0;
   
-  memset(subbandsArray,0,sizeof(subbandsArray[0])*ABS::N_BEAMLETS);
+  memset(subbandsArray,0,sizeof(subbandsArray[0])*AVT_N_BEAMLETS);
   vectorIterator=subbandsVector.begin();
   int arrayIndex(0);
-  while(arrayIndex<ABS::N_BEAMLETS && vectorIterator!=subbandsVector.end())
+  while(arrayIndex<AVT_N_BEAMLETS && vectorIterator!=subbandsVector.end())
   {
     subbandsArray[arrayIndex++]=*vectorIterator;
     char tempStr[10];
@@ -559,7 +559,7 @@ void AVTStationBeamformer::concretePrepare(GCFPortInterface& /*port*/,string& pa
   LOFAR_LOG_TRACE(VT_STDOUT_LOGGER,("AVTStationBeamformer(%s)::allocate %d subbands: %s",getName().c_str(),n_subbands,tempLogStr));
   ABSBeamallocEvent beamAllocEvent;
   beamAllocEvent.spectral_window = spectral_window;
-  memcpy(beamAllocEvent.subbands,subbandsArray,sizeof(int)*ABS::N_BEAMLETS);
+  memcpy(beamAllocEvent.subbands,subbandsArray,sizeof(int)*AVT_N_BEAMLETS);
   m_beamServer.send(beamAllocEvent);
 }
 
diff --git a/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am b/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am
index 6ba01e98bbb..70ac4400cf6 100644
--- a/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am
+++ b/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am
@@ -1,18 +1,20 @@
-noinst_PROGRAMS 		= AVTLogicalDeviceServer
+bin_PROGRAMS 		= LogicalDeviceServer
 
 AUTOGEN = autogen
 SUFFIXES = .ph
 %.ph: %.prot
-	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen -L $(top_builddir)/PAC/BeamServer/src $<
+	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen $<
+%.cc: %.prot
+	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen $<
 
-AVTLogicalDeviceServer_CPPFLAGS= \
+LogicalDeviceServer_CPPFLAGS= \
 	-I$(top_srcdir)/APLCommon/src \
-	-I$(top_srcdir)/PAC/BeamServer/src \
 	-DBOOST_DISABLE_THREADS \
+  -Wno-deprecated \
 	-fmessage-length=0 \
 	-fdiagnostics-show-location=once
 
-AVTLogicalDeviceServer_SOURCES 		= \
+LogicalDeviceServer_SOURCES 		= \
 	AVTUtilities.cc \
 	AVTAPCAnswer.cc \
 	AVTLogicalDevice.cc \
@@ -24,29 +26,31 @@ AVTLogicalDeviceServer_SOURCES 		= \
 	AVTStationReceptor.cc \
 	AVTStationReceptorGroup.cc \
 	AVTLogicalDeviceServerMain.cc \
-	LogicalDevice_Protocol.cc \
-	ABS_Protocol.cc
+	LogicalDevice_Protocol.cc
 	
-AVTLogicalDeviceServer_LDADD		= \
+LogicalDeviceServer_LDADD		= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la \
+	-labs \
 	-lboost_date_time-gcc-1_31
 	
-AVTLogicalDeviceServer_DEPENDENCIES	= \
+LogicalDeviceServer_DEPENDENCIES	= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la
 
 BUILT_SOURCES = \
-	$(top_builddir)/PAC/BeamServer/src/ABS_Protocol.ph \
 	LogicalDevice_Protocol.ph \
 	avt.ns \
 	avt.top \
 	log4cplus.properties	
 
 EXTRA_DIST = \
-  $(top_builddir)/PAC/BeamServer/src/ABS_Protocol.ph \
   LogicalDevice_Protocol.ph \
 	avt.ns \
 	avt.top \
 	log4cplus.properties
+
+sysconf_DATA = \
+	avt.ns \
+	avt.top
 	
 %.properties: %.properties.in
 	cp $< $@
diff --git a/MAC/APL/PAC/_VirtualTelescope/src/avt.top.in b/MAC/APL/PAC/_VirtualTelescope/src/avt.top.in
index c84440b896c..7baa09446cc 100644
--- a/MAC/APL/PAC/_VirtualTelescope/src/avt.top.in
+++ b/MAC/APL/PAC/_VirtualTelescope/src/avt.top.in
@@ -57,8 +57,8 @@ RCU6_server=RCU6:RCU6_server
 RCU7_server=RCU7:RCU7_server
 RCU8_server=RCU8:RCU8_server
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [VT1]
 BF1_server=BF1:BF1_server
@@ -118,43 +118,43 @@ SRG4_server=SRG4:SRG4_server
 
 [BF1]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF2]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF3]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF4]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF5]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF6]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF7]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [BF8]
 # use BeamServer=AVTTest:BeamServer if you want to use the AVTTest beamserver
-#BeamServer=ABS:client
-BeamServer=AVTTest:BeamServer
+BeamServer=ABS:client
+#BeamServer=AVTTest:BeamServer
 
 [SRG1]
 RCU1_server=RCU1:RCU1_server
diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc
index bda83f00fac..166d356e660 100644
--- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc
+++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc
@@ -34,7 +34,7 @@
 #undef VERSION
 #define DECLARE_SIGNAL_NAMES
 #include "../src/LogicalDevice_Protocol.ph"
-#include "../src/ABS_Protocol.ph"
+#include <ABS_Protocol.ph>
 
 #include <stdio.h>
 
@@ -675,7 +675,7 @@ GCFEvent::TResult AVTTestTask::handleBeamServerEvents(GCFEvent& event, GCFPortIn
       LOFAR_LOG_TRACE(VT_STDOUT_LOGGER,("AVTTestTask(%s)::handleBeamServerEvents (ABS_BEAMALLOC)",getName().c_str(),event.signal));
       ABSBeamallocAckEvent ack;
       ack.handle=0;
-      ack.status=SUCCESS;
+      ack.status=ABS_Protocol::SUCCESS;
       p.send(ack);
       m_BEAMALLOC_received=true;
       break;
@@ -686,7 +686,7 @@ GCFEvent::TResult AVTTestTask::handleBeamServerEvents(GCFEvent& event, GCFPortIn
       LOFAR_LOG_TRACE(VT_STDOUT_LOGGER,("AVTTestTask(%s)::handleBeamServerEvents (ABS_BEAMFREE)",getName().c_str(),event.signal));
       ABSBeamfreeAckEvent ack;
       ack.handle=0;
-      ack.status=SUCCESS;
+      ack.status=ABS_Protocol::SUCCESS;
       p.send(ack);
       m_BEAMFREE_received=true;
       break;
@@ -710,7 +710,7 @@ GCFEvent::TResult AVTTestTask::handleBeamServerEvents(GCFEvent& event, GCFPortIn
     {
       LOFAR_LOG_TRACE(VT_STDOUT_LOGGER,("AVTTestTask(%s)::handleBeamServerEvents (ABS_WGSETTINGS)",getName().c_str(),event.signal));
       ABSWgsettingsAckEvent ack;
-      ack.status=SUCCESS;
+      ack.status=ABS_Protocol::SUCCESS;
       p.send(ack);
       m_WGSETTINGS_received=true;
       break;
diff --git a/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am b/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am
index 60350fe5944..fe9208ab101 100644
--- a/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am
+++ b/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am
@@ -5,33 +5,33 @@ TESTS			= #avttest
 AUTOGEN = autogen
 SUFFIXES = .ph
 %.ph: %.prot
-	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen -L $(top_builddir)/PAC/BeamServer/src $<
+	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen $<
 
 avttest_CPPFLAGS= \
 	-I$(top_srcdir)/../GCF/GCFCommon/src \
-	-I$(top_srcdir)/PAC/BeamServer/src \
-	-fmessage-length=0
+  -Wno-deprecated \
+	-fmessage-length=0 \
+	-fdiagnostics-show-location=once
 
 avttest_SOURCES 		= \
 	AVTTestAnswer.cc \
 	AVTTestTask.cc \
 	AVTTestMAC2Task.cc \
 	AVTTestMain.cc \
-	../src/LogicalDevice_Protocol.cc \
-	ABS_Protocol.cc
+	../src/LogicalDevice_Protocol.cc
 	
 avttest_LDADD		= \
-	$(top_builddir)/APLCommon/src/libaplcommon.la
+	$(top_builddir)/APLCommon/src/libaplcommon.la \
+	-labs
+	
 avttest_DEPENDENCIES	= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la
 
 BUILT_SOURCES = \
-    $(top_builddir)/PAC/BeamServer/src/ABS_Protocol.ph \
     $(top_builddir)/PAC/VirtualTelescope/src/LogicalDevice_Protocol.ph \
 	log4cplus.properties	
 
 EXTRA_DIST = \
-    $(top_builddir)/PAC/BeamServer/src/ABS_Protocol.ph \
     $(top_builddir)/PAC/VirtualTelescope/src/LogicalDevice_Protocol.ph \
 	log4cplus.properties
 	
diff --git a/MAC/APL/PIC/_RegisterAccess/src/ARAConstants.h b/MAC/APL/PIC/_RegisterAccess/src/ARAConstants.h
index d87e9833977..a236f1eb089 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/ARAConstants.h
+++ b/MAC/APL/PIC/_RegisterAccess/src/ARAConstants.h
@@ -26,7 +26,8 @@
 
 namespace ARA
 {
-  
+  const int STATUS_UPDATE_INTERVAL = 2;
+  const int STATISTICS_UPDATE_INTERVAL = 2;
 };
      
 #endif /* ARACONSTANTS_H_ */
diff --git a/MAC/APL/PIC/_RegisterAccess/src/ARAPropertyDefines.h b/MAC/APL/PIC/_RegisterAccess/src/ARAPropertyDefines.h
index 9b00eb50daa..56fafb36746 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/ARAPropertyDefines.h
+++ b/MAC/APL/PIC/_RegisterAccess/src/ARAPropertyDefines.h
@@ -29,7 +29,7 @@
 const int N_RACKS               = 1; // 6
 const int N_SUBRACKS_PER_RACK   = 1; // 4
 const int N_BOARDS_PER_SUBRACK  = 1;
-const int N_APS_PER_BOARD       = 4;
+const int N_APS_PER_BOARD       = 1;
 const int N_RCUS_PER_AP         = 2;
 const int N_RCUS                = N_RCUS_PER_AP*
                                   N_APS_PER_BOARD*
@@ -94,20 +94,24 @@ const char SCOPE_PIC_RackN_SubRackN_BoardN_Alert[] =                  "PIC_Rack%
 #define PROPNAME_OVERFLOW        "overflow"
 #define PROPNAME_FROMTIME        "fromTime"
 #define PROPNAME_TOTIME          "toTime"
-#define PROPNAME_STATISTICSMEAN  "statisticsMean"
-#define PROPNAME_STATISTICSPOWER "statisticsPower"
+#define PROPNAME_STATISTICSSUBBANDMEAN  "statisticsSubbandMean"
+#define PROPNAME_STATISTICSSUBBANDPOWER "statisticsSubbandPower"
+#define PROPNAME_STATISTICSBEAMLETMEAN  "statisticsBeamletMean"
+#define PROPNAME_STATISTICSBEAMLETPOWER "statisticsBeamletPower"
 
 
 const TProperty PROPS_Station[] =
 {
   {PROPNAME_STATUS, GCFPValue::LPT_UNSIGNED, GCF_READABLE_PROP | GCF_WRITABLE_PROP, "0"},
-  {PROPNAME_STATISTICSMEAN, GCFPValue::LPT_DYNUNSIGNED, GCF_READABLE_PROP | GCF_WRITABLE_PROP, ""},
-  {PROPNAME_STATISTICSPOWER, GCFPValue::LPT_DYNUNSIGNED, GCF_READABLE_PROP | GCF_WRITABLE_PROP, ""},
+  {PROPNAME_STATISTICSSUBBANDMEAN, GCFPValue::LPT_DYNDOUBLE, GCF_READABLE_PROP | GCF_WRITABLE_PROP, ""},
+  {PROPNAME_STATISTICSSUBBANDPOWER, GCFPValue::LPT_DYNDOUBLE, GCF_READABLE_PROP | GCF_WRITABLE_PROP, ""},
+  {PROPNAME_STATISTICSBEAMLETMEAN, GCFPValue::LPT_DYNDOUBLE, GCF_READABLE_PROP | GCF_WRITABLE_PROP, ""},
+  {PROPNAME_STATISTICSBEAMLETPOWER, GCFPValue::LPT_DYNDOUBLE, GCF_READABLE_PROP | GCF_WRITABLE_PROP, ""},
 };
 
 const TPropertySet PROPSET_PIC = 
 {
-  3, "PIC", PROPS_Station
+  5, "PIC", PROPS_Station
 };
 
 const TProperty PROPS_Rack[] =
diff --git a/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.cc b/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.cc
index b8e87dcac69..6300c0f98fb 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.cc
+++ b/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.cc
@@ -468,7 +468,7 @@ GCFEvent::TResult RegisterAccessTask::connected(GCFEvent& e, GCFPortInterface& p
       RSPSubstatusEvent substatus;
       substatus.timestamp.setNow();
       substatus.rcumask = std::bitset<MAX_N_RCUS>((1<<N_RCUS)-1);
-      substatus.period = 4;
+      substatus.period = STATUS_UPDATE_INTERVAL;
       m_RSPclient.send(substatus);
       
       break;
@@ -531,7 +531,7 @@ GCFEvent::TResult RegisterAccessTask::subscribingStatsSubbandPower(GCFEvent& e,
       RSPSubstatsEvent substats;
       substats.timestamp.setNow();
       substats.rcumask = std::bitset<MAX_N_RCUS>((1<<N_RCUS)-1);
-      substats.period = 10;
+      substats.period = STATISTICS_UPDATE_INTERVAL;
       substats.type = RSP_Protocol::Statistics::SUBBAND_POWER;
       substats.reduction = RSP_Protocol::REPLACE;
       m_RSPclient.send(substats);
@@ -595,7 +595,7 @@ GCFEvent::TResult RegisterAccessTask::subscribingStatsSubbandMean(GCFEvent& e, G
       RSPSubstatsEvent substats;
       substats.timestamp.setNow();
       substats.rcumask = std::bitset<MAX_N_RCUS>((1<<N_RCUS)-1);
-      substats.period = 10;
+      substats.period = STATISTICS_UPDATE_INTERVAL;
       substats.type = RSP_Protocol::Statistics::SUBBAND_MEAN;
       substats.reduction = RSP_Protocol::REPLACE;
       m_RSPclient.send(substats);
@@ -659,7 +659,7 @@ GCFEvent::TResult RegisterAccessTask::subscribingStatsBeamletPower(GCFEvent& e,
       RSPSubstatsEvent substats;
       substats.timestamp.setNow();
       substats.rcumask = std::bitset<MAX_N_RCUS>((1<<N_RCUS)-1);
-      substats.period = 10;
+      substats.period = STATISTICS_UPDATE_INTERVAL;
       substats.type = RSP_Protocol::Statistics::BEAMLET_POWER;
       substats.reduction = RSP_Protocol::REPLACE;
       m_RSPclient.send(substats);
@@ -723,7 +723,7 @@ GCFEvent::TResult RegisterAccessTask::subscribingStatsBeamletMean(GCFEvent& e, G
       RSPSubstatsEvent substats;
       substats.timestamp.setNow();
       substats.rcumask = std::bitset<MAX_N_RCUS>((1<<N_RCUS)-1);
-      substats.period = 10;
+      substats.period = STATISTICS_UPDATE_INTERVAL;
       substats.type = RSP_Protocol::Statistics::BEAMLET_MEAN;
       substats.reduction = RSP_Protocol::REPLACE;
       m_RSPclient.send(substats);
diff --git a/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.h b/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.h
index 1d3b9a4ea84..42167dd1209 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.h
+++ b/MAC/APL/PIC/_RegisterAccess/src/ARARegisterAccessTask.h
@@ -79,6 +79,18 @@ namespace ARA
        * commands.
        */
       GCFEvent::TResult connected(GCFEvent& e, GCFPortInterface &p);
+      /**
+       * The subscribing states. In each state a SubStats message is sent
+       */
+      GCFEvent::TResult subscribingStatsSubbandPower(GCFEvent& e, GCFPortInterface &p);
+      GCFEvent::TResult subscribingStatsSubbandMean(GCFEvent& e, GCFPortInterface &p);
+      GCFEvent::TResult subscribingStatsBeamletPower(GCFEvent& e, GCFPortInterface &p);
+      GCFEvent::TResult subscribingStatsBeamletMean(GCFEvent& e, GCFPortInterface &p);
+      /**
+       * The operational state. In this state the task can receives
+       * status and statistics updates from the rsp driver
+       */
+      GCFEvent::TResult operational(GCFEvent& e, GCFPortInterface &p);
     
     private:
       // action methods
@@ -160,7 +172,10 @@ namespace ARA
       
       // subscriptions
       uint32            m_subStatusHandle;
-      uint32            m_subStatsHandle;
+      uint32            m_subStatsHandleSubbandPower;
+      uint32            m_subStatsHandleSubbandMean;
+      uint32            m_subStatsHandleBeamletPower;
+      uint32            m_subStatsHandleBeamletMean;
 
   };
 
diff --git a/MAC/APL/PIC/_RegisterAccess/src/Makefile.am b/MAC/APL/PIC/_RegisterAccess/src/Makefile.am
index 1c23acc723c..e3c433f33a8 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/Makefile.am
+++ b/MAC/APL/PIC/_RegisterAccess/src/Makefile.am
@@ -1,28 +1,30 @@
-noinst_PROGRAMS 		= ARARegisterAccess
+bin_PROGRAMS 		= RegisterAccess
 
 AUTOGEN = autogen
 SUFFIXES = .ph
 %.ph: %.prot
 	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen  $<
+%.cc: %.prot
+	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen $<
 
-ARARegisterAccess_CPPFLAGS= \
-	-I$(top_srcdir)/PAC/RSPDriver/src \
+RegisterAccess_CPPFLAGS= \
 	-I$(top_srcdir)/APLCommon/src \
+  -Wno-deprecated \
 	-fmessage-length=0 \
 	-fdiagnostics-show-location=once
 
-ARARegisterAccess_SOURCES 		= \
+RegisterAccess_SOURCES 		= \
 	ARAMain.cc \
 	ARAAnswer.cc \
 	ARAPhysicalModel.cc \
 	ARARegisterAccessTask.cc
 	
-ARARegisterAccess_LDADD		= \
+RegisterAccess_LDADD		= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la \
-	$(top_srcdir)/PAC/RSPDriver/build/gnu_debug/src/librsp.la \
+	-lrsp \
 	-lgcfcommon
 	
-ARARegisterAccess_DEPENDENCIES	= \
+RegisterAccess_DEPENDENCIES	= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la
 
 BUILT_SOURCES = \
@@ -34,6 +36,10 @@ EXTRA_DIST = \
     ara.ns \
     ara.top \
     log4cplus.properties
+
+sysconf_DATA = \
+	ara.ns \
+	ara.top
 	
 %.properties: %.properties.in
 	cp $< $@
diff --git a/MAC/APL/PIC/_RegisterAccess/src/ara.ns.in b/MAC/APL/PIC/_RegisterAccess/src/ara.ns.in
index 5efec6ba29f..f55ac8992bb 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/ara.ns.in
+++ b/MAC/APL/PIC/_RegisterAccess/src/ara.ns.in
@@ -1,7 +1,6 @@
 [ARA]
 host=localhost
 ARAtestRSPserver.type=TCP
-ARAtestRSPserver.port=22040
 
 [ARATest]
 host=localhost
@@ -28,3 +27,9 @@ host=localhost
 server.port=20040 # MSPP
 server.type=TCP
 
+[RSP]
+cmd=../src/RSPDriver
+host=localhost
+spid.port=0
+acceptor.type=TCP
+acceptor.port=30230
diff --git a/MAC/APL/PIC/_RegisterAccess/src/ara.top.in b/MAC/APL/PIC/_RegisterAccess/src/ara.top.in
index 58a522f0d8e..106ecc67373 100644
--- a/MAC/APL/PIC/_RegisterAccess/src/ara.top.in
+++ b/MAC/APL/PIC/_RegisterAccess/src/ara.top.in
@@ -1,6 +1,6 @@
 [ARA]
-ARAtestRSPserver=ARATest:ARAtestRSPserver
-#ARAtestRSPserver=ARATestDriver:ARAtestRSPserver
+#ARAtestRSPserver=ARATest:ARAtestRSPserver
+ARAtestRSPserver=RSP:acceptor
 
 [ARATest]
 #intentionally left empty: no SAP's
diff --git a/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.cc b/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.cc
index d4acacb5fdd..449a784a487 100644
--- a/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.cc
+++ b/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.cc
@@ -60,7 +60,11 @@ ARATestDriverTask::ARATestDriverTask() :
   m_substatusPeriod(0.0),
   m_substatsPeriod(0.0),
   m_updStatusTimerId(0),
-  m_updStatsTimerId(0)
+  m_updStatsTimerId(0),
+  m_updStatsHandleSP(0),
+  m_updStatsHandleSM(0),
+  m_updStatsHandleBP(0),
+  m_updStatsHandleBM(0)
 {
   registerProtocol(RSP_PROTOCOL, RSP_PROTOCOL_signalnames);
   m_answer.setTask(this);
@@ -68,13 +72,13 @@ ARATestDriverTask::ARATestDriverTask() :
   m_systemStatus.board().resize(N_BOARDS_PER_SUBRACK);
   m_systemStatus.rcu().resize(N_RCUS);
   
-  m_stats().resize(RSP_Protocol::Statistics::N_STAT_TYPES,N_RCUS,RSP_Protocol::MAX_N_BEAMLETS);
+  m_stats().resize(RSP_Protocol::Statistics::N_STAT_TYPES,N_RCUS,RSP_Protocol::MAX_N_BLPS);
   int i,j,k;
   for(i=0;i<RSP_Protocol::Statistics::N_STAT_TYPES;i++)
   {
     for(j=0;j<N_RCUS;j++)
     {
-      for(k=0;k<RSP_Protocol::MAX_N_BEAMLETS;k++)
+      for(k=0;k<RSP_Protocol::MAX_N_BLPS;k++)
       {
         m_stats()(i,j,k) = 0;
       }
@@ -575,10 +579,10 @@ void ARATestDriverTask::updateStats()
   {
     for(j=0;j<N_RCUS;j++)
     {
-      for(k=0;k<RSP_Protocol::MAX_N_BEAMLETS;k++)
+      for(k=0;k<RSP_Protocol::MAX_N_BLPS;k++)
       {
 //        m_stats()(i,j,k) = statVal*(j+1)*sin(k*2*3.1415926/60) * 1000;
-        m_stats()(i,j,k) = k+j*k+i*j*k;
+        m_stats()(i,j,k) = 100;//k+j*k+i*j*k;
       }
     }
   }
@@ -588,10 +592,28 @@ void ARATestDriverTask::updateStats()
   RSPUpdstatsEvent updStatsEvent;
   updStatsEvent.timestamp.setNow();
   updStatsEvent.status=SUCCESS;
-  updStatsEvent.handle=1; // ignore
   updStatsEvent.stats().reference(m_stats().copy());
   
-  m_RSPserver.send(updStatsEvent);
+  if(m_updStatsHandleSP != 0)
+  {
+    updStatsEvent.handle=m_updStatsHandleSP; 
+    m_RSPserver.send(updStatsEvent);
+  }
+  if(m_updStatsHandleSM != 0)
+  {
+    updStatsEvent.handle=m_updStatsHandleSM; 
+    m_RSPserver.send(updStatsEvent);
+  }
+  if(m_updStatsHandleBP != 0)
+  {
+    updStatsEvent.handle=m_updStatsHandleBP; 
+    m_RSPserver.send(updStatsEvent);
+  }
+  if(m_updStatsHandleBM != 0)
+  {
+    updStatsEvent.handle=m_updStatsHandleBM;
+    m_RSPserver.send(updStatsEvent);
+  }
 }
 
 bool ARATestDriverTask::isEnabled()
@@ -735,13 +757,37 @@ GCFEvent::TResult ARATestDriverTask::enabled(GCFEvent& event, GCFPortInterface&
       LOG_INFO("RSP_SUBSTATS received");
       RSPSubstatsEvent substats(event);
       
-      m_substatsPeriod = (double)substats.period;
-      m_updStatsTimerId = port.setTimer(m_substatsPeriod);
-
       RSPSubstatsackEvent ack;
       ack.timestamp.setNow();
       ack.status = SUCCESS;
-      ack.handle = (int)&ack;
+      if(substats.type == RSP_Protocol::Statistics::SUBBAND_POWER)
+      {
+        m_updStatsHandleSP = 11;
+        ack.handle = m_updStatsHandleSP;
+      }
+      else if(substats.type == RSP_Protocol::Statistics::SUBBAND_MEAN)
+      {
+        m_updStatsHandleSM = 12;
+        ack.handle = m_updStatsHandleSM;
+      }
+      else if(substats.type == RSP_Protocol::Statistics::BEAMLET_POWER)
+      {
+        m_updStatsHandleBP = 21;
+        ack.handle = m_updStatsHandleBP;
+      }
+      else if(substats.type == RSP_Protocol::Statistics::BEAMLET_MEAN)
+      {
+        m_updStatsHandleBM = 22;
+        ack.handle = m_updStatsHandleBM;
+      }
+      else
+      {
+        ack.status = FAILURE;
+        ack.handle = 0;
+      }      
+      m_substatsPeriod = (double)substats.period;
+      m_updStatsTimerId = port.setTimer(m_substatsPeriod);
+
       port.send(ack);
       break;
     }
diff --git a/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.h b/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.h
index b0fa48e1a9e..44945a0ad18 100644
--- a/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.h
+++ b/MAC/APL/PIC/_RegisterAccess/test/ARATestDriverTask.h
@@ -86,6 +86,10 @@ namespace ARA
       double          m_substatsPeriod;
       long            m_updStatusTimerId;
       long            m_updStatsTimerId;
+      uint32          m_updStatsHandleSP;
+      uint32          m_updStatsHandleSM;
+      uint32          m_updStatsHandleBP;
+      uint32          m_updStatsHandleBM;
   };  
 };
 
diff --git a/MAC/APL/PIC/_RegisterAccess/test/Makefile.am b/MAC/APL/PIC/_RegisterAccess/test/Makefile.am
index e2273e36958..11525638738 100644
--- a/MAC/APL/PIC/_RegisterAccess/test/Makefile.am
+++ b/MAC/APL/PIC/_RegisterAccess/test/Makefile.am
@@ -5,13 +5,14 @@ TESTS			= #aratest
 AUTOGEN = autogen
 SUFFIXES = .ph
 %.ph: %.prot
-	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen -L $(top_builddir)/PAC/RSPDriver/src $<
+	$(AUTOGEN) --writable -L $(top_srcdir)/../MACCommon/autogen $<
 
 aratest_CPPFLAGS= \
-	-I$(top_srcdir)/PAC/RSPDriver/src \
 	-I$(top_srcdir)/../GCF/GCFCommon/src \
 	-I$(top_srcdir)/PIC/RegisterAccess/src \
-	-fmessage-length=0
+  -Wno-deprecated \
+	-fmessage-length=0 \
+	-fdiagnostics-show-location=once
 
 aratest_SOURCES 		= \
 	ARATestAnswer.cc \
@@ -22,18 +23,16 @@ aratest_SOURCES 		= \
 	
 aratest_LDADD		= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la \
-	$(top_srcdir)/PAC/RSPDriver/build/gnu_debug/src/librsp.la \
-	-lgcf -lpml -lgcfcommon -lpa -lsal -ltm
+	-lrsp \
+	-lgcf 
 	
 aratest_DEPENDENCIES	= \
 	$(top_builddir)/APLCommon/src/libaplcommon.la
 
 BUILT_SOURCES = \
-  $(top_builddir)/PAC/RSPDriver/src/RSP_Protocol.ph \
 	log4cplus.properties	
 
 EXTRA_DIST = \
-  $(top_builddir)/PAC/RSPDriver/src/RSP_Protocol.ph \
 	log4cplus.properties
 	
 %.properties: ../src/%.properties.in
diff --git a/MAC/APL/configure.in b/MAC/APL/configure.in
index 0857a19c9a5..4cb5d5305c2 100644
--- a/MAC/APL/configure.in
+++ b/MAC/APL/configure.in
@@ -62,6 +62,8 @@ lofar_EXTERNAL(xercesc,1,xercesc/sax2/SAX2XMLReader.hpp,xerces-c,)
 lofar_EXTERNAL(log4cplus,1,log4cplus/logger.h,,)
 lofar_EXTERNAL(boost,1,boost/shared_ptr.hpp,"")
 lofar_EXTERNAL(BLITZ,1,blitz/blitz.h,,,,'gnu3:-Wno-unused gnu3:-ftemplate-depth-30',,-lm)
+lofar_EXTERNAL(rsp,1,RSP_Protocol.ph,,)
+lofar_EXTERNAL(abs,1,ABS_Protocol.ph,,)
 lofar_EXTERNAL(gcf,1,GCF/GCF_Task.h,,)
 
 dnl
-- 
GitLab