Commit 97f4780f authored by Carlo Migoni's avatar Carlo Migoni
Browse files

new Roach component

parent f89e15df
Loading
Loading
Loading
Loading
+134 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
	- $Id: TotalPower.xsd,v 1.3 2011-05-12 14:14:31 a.orlati Exp $
	- Author: Andrea Orlati
	-
	- History:
	-   18-09-2008  Created
-->

<xs:schema
	targetNamespace="urn:schemas-cosylab-com:TotalPower:1.0"
	xmlns="urn:schemas-cosylab-com:TotalPower:1.0"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
	xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
	xmlns:mng="urn:schemas-cosylab-com:Managment:1.0"
	xmlns:bcknd="urn:schemas-cosylab-com:GenericBackend:1.0"
	elementFormDefault="qualified"
	attributeFormDefault="unqualified">
	<xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd"/>
	<xs:import namespace="urn:schemas-cosylab-com:BACI:1.0" schemaLocation="BACI.xsd"/>
	<xs:import namespace="urn:schemas-cosylab-com:GenericBackend:1.0" schemaLocation="GenericBackend.xsd"/>
	<xs:import namespace="urn:schemas-cosylab-com:Managment:1.0" schemaLocation="Managment.xsd"/>
	
<!--
	<xs:simpleType name="TBkndConfiguration">
		<xs:annotation><xs:documentation>
			Enlist all possible configuration for the backend. many parameters can change for example the number of inputs,
			the input type (BWG,Gregorian....) the used devices and so on. All the configuration are hard coded in the component,
			so in order to add a configuration a piece of code in the component shoud reflect the addition.
		</xs:documentation></xs:annotation>
		<xs:restriction base="xs:string">
	    	<xs:enumeration value="KKC">
				<xs:annotation><xs:documentation>
					the backend is connected to the 14 inputs of the secondary focus 22GHz 7 feeds receiver 
				</xs:documentation></xs:annotation>	
	      	</xs:enumeration>
	    	<xs:enumeration value="CCC">
				<xs:annotation><xs:documentation>
					the backend is connected to the 2 inputs of the secondary focus 5GHz receiver, LCP and RCP are reported respectively 
				</xs:documentation></xs:annotation>	
	      	</xs:enumeration>
	    	<xs:enumeration value="XXP">
				<xs:annotation><xs:documentation>
					the backend is connected to the 2 inputs of the primary focus 8GHz receiver, RCP and LCP are reported respectively 
				</xs:documentation></xs:annotation>	
	      	</xs:enumeration>
		<xs:enumeration value="CCB">
			<xs:annotation><xs:documentation>
					the backend is connected to the 2 inputs of the 7GHz receiver of SRT, RCP and LCP are reported respectively 
				</xs:documentation></xs:annotation>	
		</xs:enumeration>

		</xs:restriction>
	</xs:simpleType>
-->
	
	<xs:complexType name="BackendStatusType">
		<xs:complexContent>
			<xs:restriction base="baci:ROpattern">
				<xs:attribute name="resolution" type="xs:unsignedLong" use="optional" default="64"/>
            	<xs:attribute name="bitDescription" type="xs:string" use="optional" default=
                	"Time_Sync,Busy,Suspended,Sampling,CmdLine,DataLine"/>
				<xs:attribute name="whenSet" type="xs:string" use="optional" default=
                	"0, 1, 1, 1, 0, 0"/>
            	<xs:attribute name="whenCleared" type="xs:string" use="optional" default=
            		"2, 3, 3, 3, 2, 2"/>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>	
	
	<xs:complexType name="TotalPowerType">
		<xs:complexContent>
			<xs:extension base="bcknd:GenericBackendType">
				<xs:sequence>
					<xs:element name="time" type="baci:ROuLongLong" />
					<xs:element name="backendName" type="baci:ROstring" />
					<xs:element name="bandWidth" type="baci:ROdoubleSeq" />
					<xs:element name="frequency" type="baci:ROdoubleSeq" />
					<xs:element name="sampleRate" type="baci:ROdoubleSeq" />
					<xs:element name="attenuation" type="baci:ROdoubleSeq" />
					<xs:element name="polarization" type="baci:ROlongSeq" />
					<xs:element name="bins" type="baci:ROlongSeq" />
					<xs:element name="feed" type="baci:ROlongSeq" />
					<xs:element name="systemTemperature" type="baci:ROdoubleSeq" />
					<xs:element name="inputSection" type="baci:ROlongSeq" />
					<xs:element name="inputsNumber" type="baci:ROlong" />
					<xs:element name="sectionsNumber" type="baci:ROlong" />
					<xs:element name="integration" type="baci:ROlong" />
					<xs:element name="status" type="BackendStatusType" />
					<xs:element name="busy" type="mng:BooleanType" />
				</xs:sequence>
				<xs:attribute name="IPAddress" type="xs:string" use="required" />
				<xs:attribute name="Port" type="xs:unsignedShort" use="required" />
				<!-- timeout (microseconds) applied when trying to connect to the backend -->
				<xs:attribute name="ConnectTimeout" type="xs:unsignedLong" use="required" />
				<!-- timeout (microseconds) applied when trying to receive data from the to the backend -->
				<xs:attribute name="CommandLineTimeout" type="xs:unsignedLong" use="required" />
				<!-- this time (microseconds) is considered validity period of the properties. When this period is elapsed the component will equery
				         again the hardware -->
				<xs:attribute name="PropertyRefreshTime" type="xs:unsignedLong" use="required"/>	
				<!-- indicates the default configuration of the backend -->
				<xs:attribute name="Configuration" type="xs:string" use="required" />
				<!-- Tollerance used when dealing with time synchronization and checks, in particular to deal with jitter beween backend and host computer and with network latencies -->
				<xs:attribute name="TimeTollerance" type="xs:unsignedLong" use="required" />				
				<!-- the cache time (microseconds) for logging repetition filter -->
				<xs:attribute name="RepetitionCacheTime" type="xs:unsignedLong" use="required" />
				<!-- the expire time (microseconds) for logging repetition filter -->
				<xs:attribute name="RepetitionExpireTime" type="xs:unsignedLong" use="required" />
				<!-- data line tcp port -->
				<xs:attribute name="DataPort" type="xs:unsignedShort" use="required" />
				<!-- data line tcp address -->
				<xs:attribute name="DataIPAddress" type="xs:string" use="required" />
				<!-- data line latency (microseconds) -->
				<xs:attribute name="DataLatency" type="xs:unsignedLong" use="required" />
				<!-- Sender thread sleep time (microseconds), sender duty cycle-->
				<xs:attribute name="SenderSleepTime" type="xs:unsignedLong" use="required" />
				<!-- Sender thread response time (microseconds), hart beat time -->
				<xs:attribute name="SenderResponseTime" type="xs:unsignedLong" use="required" />
				<!-- Control thread sleep time (microseconds), that's its duty cycle-->
				<xs:attribute name="ControlSleepTime" type="xs:unsignedLong" use="required" />
				<!-- Control thread response time (microseconds), hart beat time -->
				<xs:attribute name="ControlResponseTime" type="xs:unsignedLong" use="required" />
				<!-- Total number of installed boards-->
				<xs:attribute name="BoardsNumber" type="xs:unsignedLong" use="required" />
				<!-- The size of the data buffer (bytes) -->
				<xs:attribute name="DataBufferSize" type="xs:unsignedLong" use="required" />
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<xs:element name="TotalPower" type="TotalPowerType"/>
	
</xs:schema>
+136 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
	- $Id: TotalPowerSetup.xsd,v 1.1 2011-03-14 14:15:07 a.orlati Exp $
	- Author: Andrea Orlati
	-
	- History:
	-   17-01-2011  Created 
-->

<xs:schema
  targetNamespace="urn:schemas-cosylab-com:TotalPowerSetup:1.0"
  xmlns="urn:schemas-cosylab-com:TotalPowerSetup:1.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
  xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified">
	<xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd"/>
	<xs:import namespace="urn:schemas-cosylab-com:BACI:1.0" schemaLocation="BACI.xsd"/>

	<xs:simpleType name="EnabledType">
		<xs:restriction base="xs:string">
	    	<xs:enumeration value="TRUE">
				<xs:annotation><xs:documentation>
					boolean true value
				</xs:documentation></xs:annotation>	
	      	</xs:enumeration>
	    	<xs:enumeration value="FALSE">
	    		<xs:annotation><xs:documentation>
	    			boolean flase value
	    		</xs:documentation></xs:annotation>
	    	</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	
	<xs:simpleType name="SelectedPortType">
		<xs:annotation><xs:documentation>
			selects which port has to be selected for the present confuguration
		</xs:documentation></xs:annotation>
		<xs:restriction base="xs:string">
	    	<xs:enumeration value="PRIMARY">
				<xs:annotation><xs:documentation>
					the backend will selects input from primary focus
				</xs:documentation></xs:annotation>	
	      	</xs:enumeration>
	    	<xs:enumeration value="BWG">
	    		<xs:annotation><xs:documentation>
	    			the backend will selects input from Beam Wave Guide focus
	    		</xs:documentation></xs:annotation>
	    	</xs:enumeration>
	    	<xs:enumeration value="GREGORIAN">
	    		<xs:annotation><xs:documentation>
	    			the backend will selects input from Gregorian focus
	    		</xs:documentation></xs:annotation>
	    	</xs:enumeration>	    	
		</xs:restriction>
	</xs:simpleType>
	
	<xs:element name="inputPort">
		<xs:simpleType>
			<xs:list itemType="SelectedPortType" />
		</xs:simpleType>
	</xs:element>
	
	<xs:complexType name="TTableHeader">
 		<xs:sequence>
 		  <xs:element name="configurationID" type="xs:string">
 		  	<xs:annotation><xs:documentation>
 		  		identifier of the configuration 
 		  	</xs:documentation></xs:annotation>
 		  </xs:element> 		  	
 		  <xs:element name="sections" type="xs:long">
 		  	<xs:annotation><xs:documentation>
 		  		The number of sections exported for the present configuration
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		  <xs:element name="calSwitchingEnabled" type="EnabledType">
 		  	<xs:annotation><xs:documentation>
 		  		true if the calibration mark switching could be used
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		  <xs:element ref="inputPort" minOccurs="1" maxOccurs="unbounded">
 		  	<xs:annotation><xs:documentation>
 		  		selects from which port the RF inputs has to be taken for the present configuration, if more than one value is provided the inputs
 		  		are configured on sinble board basis. The numbero of enties shoudl be less than the numebr of installed boards. The board not directly
 		  		involved in the configuration (i.e stated on the section_boards section) will be configured with 0 attenuation andd full bandwidth
 		  	</xs:documentation></xs:annotation>
 		  </xs:element> 		  
 		  <xs:element name="beams" type="xs:long">
 		  	<xs:annotation><xs:documentation>
 		  		number of beams of the receiver attached to the backend
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		  <xs:element name="bandWidth" type="xs:double">
 		  	<xs:annotation><xs:documentation>
 		  		this set the default bandwidth of the RF input  
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		  <xs:element name="attenuation" type="xs:double">
 		  	<xs:annotation><xs:documentation>
 		  		this sets the default attenuation of all the RF input  
 		  	</xs:documentation></xs:annotation>
 		  </xs:element> 		  	   		  
 		  <xs:element name="section_boards" type="xs:string">
 		  	<xs:annotation><xs:documentation>
 		  		blank separated lists of boards implementing the section  
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		  <xs:element name="polarizations" type="xs:string">
 		  	<xs:annotation><xs:documentation>
 		  		for each section indicates which polarizations the section is processing, blank separated list  
 		  	</xs:documentation></xs:annotation>
 		  </xs:element> 		  
 		  <xs:element name="feed" type="xs:string">
 		  	<xs:annotation><xs:documentation>
 		  		for each sections indicates which is the linked feed  
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		  <xs:element name="IF" type="xs:string">
 		  	<xs:annotation><xs:documentation>
 		  		for each section, given the feed, indicates which is the linked IF  
 		  	</xs:documentation></xs:annotation>
 		  </xs:element>
 		</xs:sequence>
 	</xs:complexType>
  
 	<xs:complexType name="TTotalPowerSetup">
		<xs:sequence>
			<xs:element name="Configuration" type="TTableHeader" 
			  minOccurs="1" maxOccurs="unbounded" />
		</xs:sequence>
 	</xs:complexType>
  
	<xs:element name="TotalPowerSetup" type="TTotalPowerSetup"/>
  	
</xs:schema>
+709 −0

File added.

Preview size limit exceeded, changes collapsed.

+44 −0
Original line number Diff line number Diff line
#ifndef _COMMON_H_
#define _COMMON_H_

/* **************************************************************************************************** */
/* IRA Istituto di Radioastronomia                                                                      */
/* $Id: Common.h,v 1.1 2011-03-14 14:15:07 a.orlati Exp $																								*/
/*                                                                                                      */
/* This code is under GNU General Public Licence (GPL).                                                 */
/*                                                                                                      */
/* Who                                when           What                                              */
/* Andrea Orlati(aorlati@ira.inaf.it)     15/10/2008      Creation				*/                                 


// if define the data are not sent to the bulk data transfer but printed to the screen. For production version it must be 
// commented out
//#define BKD_DEBUG 

// some hard coded, hardware dependant constants
#define STARTFREQUENCY 50.0 // this is the start frequency of all IF inputs
#define BINSNUMBER 1
#define SAMPLETYPE float
#define SAMPLESIZE sizeof(SAMPLETYPE)  //

#define SENDBUFFERSIZE 100
#define RECBUFFERSIZE 512
#define DATABUFFERSIZE 64000
#define MAX_SECTION_NUMBER 14
#define MAX_BOARDS_NUMBER 14

#define DEFAULT_SAMPLE_RATE 0.000025   //one sample every 40 milliseconds
//#define DEFAULT_SAMPLE_RATE 0.001   //one sample every 1 milliseconds
#define DEFAULT_INTEGRATION 0  // no second of integration
#define DEFAULT_DIODE_SWITCH_PERIOD 0 // the cal diode is not switched

#define MAX_BAND_WIDTH 2350.0
#define MIN_BAND_WIDTH 300.0

#define MAX_ATTENUATION 15.0
#define MIN_ATTENUATION 0.0

#define MAX_SAMPLE_RATE 0.001 // one millisecond

#define FLOW_NUMBER 1
#endif /*COMMON_H_*/
+195 −0
Original line number Diff line number Diff line
#ifndef _CONFIGURATION_H_
#define _CONFIGURATION_H_

/* ************************************************************************************* */
/* IRA Istituto di Radioastronomia                                                                                             */
/* $Id: Configuration.h,v 1.2 2011-05-12 14:14:31 a.orlati Exp $                                                                                                                                     */
/*                                                                                                                                                */
/* This code is under GNU General Public Licence (GPL).                                                         */
/*                                                                                                                                                 */
/* Who                                                    When                 What                                                  */
/* Andrea Orlati(aorlati@ira.inaf.it)      02/10/2008         Creation                                             */

#include <IRA>
#include <maciContainerServices.h>
#include <ComponentErrors.h>
#include <TotalPowerS.h>
#include "Protocol.h"
#include "Common.h"

using namespace IRA;

/**
 * This class implements the component configurator. The data inside this class are initialized at the startup from the
 * configuration database and then are used (read) inside the component.
 * @author <a href=mailto:a.orlati@ira.cnr.it>Andrea Orlati</a>,
 * Istituto di Radioastronomia, Italia
 * <br> 
  */
class CConfiguration {
public:	
	typedef struct {
		IRA::CString setupID;
		long sections;
		bool calSwitchEnabled;
		CProtocol::TInputs inputPort[MAX_SECTION_NUMBER];
		WORD inputPorts;
		long beams;
		long section_boards[MAX_SECTION_NUMBER];
		Backends::TPolarization polarizations[MAX_SECTION_NUMBER];
		long feed[MAX_SECTION_NUMBER];
		long ifs[MAX_SECTION_NUMBER];
		double bandWidth;
		double attenuation;
	} TBackendSetup;
	
	/**
	 * Constructor 
	*/
	CConfiguration();
	
	/**
	 * Destructor
	*/
	~CConfiguration();
	/**
    * This member function is used to configure component by reading the configuration parameter from the CDB.
	 * This must be the first call before using any other function of this class.
	 * @throw CDBAccess
	 * @throw MemoryAllocation
	 * @throw IRALibraryResource
	 * @param Services pointer to the container services object
	*/
	void init(maci::ContainerServices *Services) throw (ComponentErrors::CDBAccessExImpl,ComponentErrors::MemoryAllocationExImpl,ComponentErrors::IRALibraryResourceExImpl);

	/**
	 * @return the port number
	 */
	inline const WORD& getPort() const { return m_wPort; }
	
	/**
	 * @return the TCP/IP address of the listening server
	 */
	inline const IRA::CString getAddress() const {return m_sAddress; }
	
	/**
	 * @return the timeout when receiving from the command socket(in microseconds)
	 */
	inline const DWORD getCommandLineTimeout() const { return m_dwCommandLineTimeout; }
	
	/**
	 * @return the timeout in microseconds when trying to reconnect to the backend
	*/
	inline const DWORD getConnectTimeout() const { return m_dwConnectTimeout; }
	
	/**
	 * @return the time in microseconds that is taken between two property refreshes
	 */
	inline const DWORD getPropertyRefreshTime() const { return m_dwPropertyRefreshTime; }
	
	/**
	 * @return the name of the configuration that the backend have to implement
	 */
	inline const IRA::CString getConfiguration() const { return m_sConfig; }
	
	/**
	 * @return the number of microseconds that the log filter will cache a log message
	*/
	inline DWORD getRepetitionCacheTime() const { return m_dwRepetitionCacheTime; }
	
	/**
	 * @return the number of microseconds that the log filter will take as expiration time for a log message
	*/
	inline DWORD getRepetitionExpireTime() const { return m_dwRepetitionExpireTime; }

	/**
	 * @return the number of microseconds that the backend will take after a command issue to sent the first data
	*/
	inline DWORD getDataLatency() const { return m_dwDataLatency; }

	/**
	 * @return the port number for the data line
	 */
	inline const WORD& getDataPort() const { return m_wDataPort; }
	
	/**
	 * @return the sleep time of the sender thread in microseconds 
	 */
	inline const DWORD& getSenderSleepTime() const { return m_dwSenderSleepTime; }
	
	/**
	 * @return the response time of the sender thread in microseconds 
	 */
	inline const DWORD& getSenderResponseTime() const { return m_dwSenderResponseTime; }
	
	/**
	 * @return the sleep time of the control thread in microseconds 
	 */
	inline const DWORD& getControlSleepTime() const { return m_dwControlSleepTime; }
	
	/**
	 * @return the response time of the control thread in microseconds 
	 */
	inline const DWORD& getControlResponseTime() const { return m_dwControlResponseTime; }
	
	/**
	 * @return the time tollerance in microsenconds. 
	 */
	inline const DWORD& getTimeTollerance() const { return m_dwTimeTollerance; }
	
	/**
	 * @return the server address for the data transfer (it should be the address of the machine, running this component
	 */
	inline const IRA::CString& getDataIPAddress() const { return m_sDataAddress; }
	
	/**
	 * @return the number of boards installed ion the backend
	 */
	inline const DWORD& getBoardsNumber() const { return m_dwBoardsNumber; }
	
	/**
	 * @return the size of data packet from the backend  in bytes
	 */
	inline const DWORD getDataBufferSize() const { return m_dwDataBufferSize; }
	
	/**
	 * This function returns the setups of the backend given the setup ID.
	 * @param setupID setup identifier or mnemonic
	 * @param setup structure containing the setup parameters.
	 * @return true if the setup is present, false if not present or the configuration from the CDB is not correct
	 */  
	bool getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) throw (ComponentErrors::CDBAccessExImpl);
	
private:
	WORD m_wPort;
	IRA::CString m_sAddress;
	DWORD m_dwCommandLineTimeout;
	DWORD m_dwConnectTimeout;
	DWORD m_dwPropertyRefreshTime;
	IRA::CString m_sConfig;
	DWORD m_dwRepetitionCacheTime;
	DWORD m_dwRepetitionExpireTime;
	WORD m_wDataPort;
	IRA::CString m_sDataAddress;
	DWORD m_dwDataLatency;
	DWORD m_dwSenderSleepTime;
	DWORD m_dwSenderResponseTime;
	DWORD m_dwTimeTollerance;
	DWORD m_dwControlSleepTime;
	DWORD m_dwControlResponseTime;	
	DWORD m_dwBoardsNumber;
	DWORD m_dwDataBufferSize;
	/**
	 * This is the table used to load from the CDB the backend configurations 
	*/
	IRA::CDBTable* m_configurationTable;
	/*
	 * Parse the inputs string in order to extract and check the inputs port configuration for each board
	 * @param conf input string
	 * @param inputPort resulting port configuration
	 * @param size dimension of the inputPort array
	 */
	bool getInputPorts(const IRA::CString& conf,CProtocol::TInputs* inputPort,WORD& size);
};

#endif /*CONFIGURATION_H_*/
Loading