Imported CSS files
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,298 @@
|
||||
/**
|
||||
* @file allows to configure ISTTOK and upload configuration file to MARTe
|
||||
*/
|
||||
#ifndef CFG_UPLOADER_H
|
||||
#define CFG_UPLOADER_H
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
#include "Level3.h"
|
||||
|
||||
#include "System.h"
|
||||
#include "HttpStream.h"
|
||||
#include "HttpInterface.h"
|
||||
#include "HtmlStream.h"
|
||||
#include "FString.h"
|
||||
#include "GCReferenceContainer.h"
|
||||
#include "CDBExtended.h"
|
||||
#include "GlobalObjectDataBase.h"
|
||||
#include "MessageHandler.h"
|
||||
|
||||
#include "SVGGraphicSupport.h"
|
||||
|
||||
#include <dirent.h> //to load files located on the atca
|
||||
#include <string.h> // to compare strings
|
||||
|
||||
|
||||
OBJECT_DLL(AdvancedConfigurator)
|
||||
class AdvancedConfigurator: public GCReferenceContainer, public HttpInterface, public MessageHandler{
|
||||
OBJECT_DLL_STUFF(AdvancedConfigurator)
|
||||
|
||||
private:
|
||||
/** The id of the configuration file entry as received from the http request*/
|
||||
FString configFileID;
|
||||
|
||||
/** The location of MARTe*/
|
||||
FString marteLocation;
|
||||
FString cdbString; //string to be uploaded
|
||||
|
||||
int graphic_select;
|
||||
FString save_filename;
|
||||
bool save_as_bool;
|
||||
bool delete_selected_points_bool;
|
||||
|
||||
int vector_dim_temp;
|
||||
float *temp_vector_x;
|
||||
float *temp_vector_y;
|
||||
float temp_max_value;
|
||||
float temp_min_value;
|
||||
|
||||
bool already_started;
|
||||
|
||||
bool focus_on_t_form_bool;
|
||||
bool focus_on_y_form_bool;
|
||||
|
||||
float box_display_point_x;
|
||||
|
||||
bool edit_main;
|
||||
bool edit_control;
|
||||
bool edit_general;
|
||||
bool end_discharge_after_unsuccess_bool;
|
||||
|
||||
FString Description;
|
||||
|
||||
FString header_colour;
|
||||
FString colour1;
|
||||
FString colour2;
|
||||
FString colour3;
|
||||
FString colour4;
|
||||
FString colour5;
|
||||
FString footer_colour;
|
||||
|
||||
FString selected_load_directory;
|
||||
FString selected_load_file;
|
||||
|
||||
FString selected_save_directory;
|
||||
FString selected_save_file;
|
||||
|
||||
FString dummy_fstring;
|
||||
|
||||
FString default_config_file_path;
|
||||
FString config_files_directory;
|
||||
|
||||
//MARTe configuration
|
||||
int thread_priority;
|
||||
int run_on_cpu;
|
||||
|
||||
//Main
|
||||
int usec_pre_pulse_time;
|
||||
int maximum_inversion_usectime;
|
||||
FString tomography_file_to_load;
|
||||
int tomography_n_channels;
|
||||
int *tomography_online_channels;
|
||||
float iron_core_saturation_value;
|
||||
float iron_core_dangerous_value;
|
||||
int time_between_online_and_discharge;
|
||||
|
||||
|
||||
float puffing_duration_in_puffing_feedback_in_ms;
|
||||
float maximum_idle_time_in_puffing_feedback_in_ms;
|
||||
float minimum_idle_time_in_puffing_feedback_in_ms;
|
||||
float puffing_feedback_usec_change_percentage_by_cycle;
|
||||
int puffing_feedback_mode;
|
||||
|
||||
|
||||
|
||||
// +control settings
|
||||
// PID_horizontal
|
||||
float horizontalPS_P;
|
||||
float horizontalPS_I;
|
||||
float horizontalPS_D;
|
||||
// PID_vertical =
|
||||
float verticalPS_P;
|
||||
float verticalPS_I;
|
||||
float verticalPS_D;
|
||||
// PID_primary
|
||||
float primaryPS_P;
|
||||
float primaryPS_I;
|
||||
float primaryPS_D;
|
||||
FString control_file_to_load;
|
||||
int puffing_mode; //0-> 0ff 1->time-windows, percentage output, 2->time windows with feedback, 3-> absolute time, out percentage, 4-> open loop up to time windows (use absolute timing waveform until the end of breakdown), then feedback
|
||||
|
||||
|
||||
// +waveform_primary
|
||||
// waveform_mode_1_positive
|
||||
int primary_breakdown_vector_size;
|
||||
float *primary_breakdown_index_vector;
|
||||
float *primary_breakdown_data_vector;
|
||||
// waveform_mode_1_negative
|
||||
int primary_breakdown_negative_vector_size;
|
||||
float *primary_breakdown_negative_index_vector;
|
||||
float *primary_breakdown_negative_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int primary_inversion_positive_vector_size;
|
||||
float *primary_inversion_positive_index_vector;
|
||||
float *primary_inversion_positive_data_vector;
|
||||
// waveform_mode_2_negative
|
||||
int primary_inversion_negative_vector_size;
|
||||
float *primary_inversion_negative_index_vector;
|
||||
float *primary_inversion_negative_data_vector;
|
||||
|
||||
// +waveform_vertical
|
||||
// waveform_mode_1_positive
|
||||
int vertical_breakdown_vector_size;
|
||||
float *vertical_breakdown_index_vector;
|
||||
float *vertical_breakdown_data_vector;
|
||||
// waveform_mode_1_negative
|
||||
int vertical_breakdown_negative_vector_size;
|
||||
float *vertical_breakdown_negative_index_vector;
|
||||
float *vertical_breakdown_negative_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int vertical_inversion_positive_vector_size;
|
||||
float *vertical_inversion_positive_index_vector;
|
||||
float *vertical_inversion_positive_data_vector;
|
||||
// waveform_mode_2_negative
|
||||
int vertical_inversion_negative_vector_size;
|
||||
float *vertical_inversion_negative_index_vector;
|
||||
float *vertical_inversion_negative_data_vector;
|
||||
|
||||
// +waveform_horizontal
|
||||
// waveform_mode_1_positive
|
||||
int horizontal_breakdown_vector_size;
|
||||
float *horizontal_breakdown_index_vector;
|
||||
float *horizontal_breakdown_data_vector;
|
||||
// waveform_mode_1_negative
|
||||
int horizontal_breakdown_negative_vector_size;
|
||||
float *horizontal_breakdown_negative_index_vector;
|
||||
float *horizontal_breakdown_negative_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int horizontal_inversion_positive_vector_size;
|
||||
float *horizontal_inversion_positive_index_vector;
|
||||
float *horizontal_inversion_positive_data_vector;
|
||||
// waveform_mode_2_negative
|
||||
int horizontal_inversion_negative_vector_size;
|
||||
float *horizontal_inversion_negative_index_vector;
|
||||
float *horizontal_inversion_negative_data_vector;
|
||||
|
||||
// +waveform_toroidal
|
||||
// waveform_mode_1_positive
|
||||
int toroidal_1_p_vector_size;
|
||||
float *toroidal_1_p_index_vector;
|
||||
float *toroidal_1_p_data_vector;
|
||||
|
||||
// +waveform_puffing
|
||||
// waveform_mode_1_positive
|
||||
int puffing_1_p_vector_size;
|
||||
float *puffing_1_p_index_vector;
|
||||
float *puffing_1_p_data_vector;
|
||||
// waveform_mode_1_negative
|
||||
int puffing_1_n_vector_size;
|
||||
float *puffing_1_n_index_vector;
|
||||
float *puffing_1_n_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int puffing_2_p_vector_size;
|
||||
float *puffing_2_p_index_vector;
|
||||
float *puffing_2_p_data_vector;
|
||||
// waveform_mode_2_negative
|
||||
int puffing_2_n_vector_size;
|
||||
float *puffing_2_n_index_vector;
|
||||
float *puffing_2_n_data_vector;
|
||||
// waveform_mode_2_negative
|
||||
int puffing_absolute_time_vector_size;
|
||||
float *puffing_absolute_time_index_vector;
|
||||
float *puffing_absolute_time_data_vector;
|
||||
|
||||
// maximum and minimum waveform values
|
||||
float primary_1_p_max_value;
|
||||
float primary_1_p_min_value;
|
||||
float primary_2_p_max_value;
|
||||
float primary_2_p_min_value;
|
||||
float vertical_1_p_max_value;
|
||||
float vertical_1_p_min_value;
|
||||
float vertical_2_p_max_value;
|
||||
float vertical_2_p_min_value;
|
||||
float horizontal_1_p_max_value;
|
||||
float horizontal_1_p_min_value;
|
||||
float horizontal_2_p_max_value;
|
||||
float horizontal_2_p_min_value;
|
||||
float toroidal_1_p_max_value;
|
||||
float toroidal_1_p_min_value;
|
||||
float puffing_1_p_max_value;
|
||||
float puffing_1_p_min_value;
|
||||
float puffing_2_p_max_value;
|
||||
float puffing_2_p_min_value;
|
||||
|
||||
// +FACommunicator_vertical
|
||||
FString verticalPS_UARTPortAddress;
|
||||
float verticalPS_PointOfZeroCurrent;
|
||||
float verticalPS_CurrentStep;
|
||||
|
||||
// +FACommunicator_horizontal
|
||||
FString horizontalPS_UARTPortAddress;
|
||||
float horizontalPS_PointOfZeroCurrent;
|
||||
float horizontalPS_CurrentStep;
|
||||
|
||||
// +FACommunicator_primary
|
||||
FString primaryPS_UARTPortAddress;
|
||||
float primaryPS_PointOfZeroCurrent;
|
||||
float primaryPS_CurrentStep;
|
||||
|
||||
|
||||
|
||||
|
||||
SVGGraphicSupport *graphics_support;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** the main entry point for HttpInterface */
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
/** the default constructor */
|
||||
AdvancedConfigurator(){
|
||||
}
|
||||
|
||||
~AdvancedConfigurator(){
|
||||
}
|
||||
|
||||
virtual bool ObjectLoadSetup(ConfigurationDataBase & info, StreamInterface * err);
|
||||
|
||||
/** save an object content into a set of configs */
|
||||
virtual bool ObjectSaveSetup( ConfigurationDataBase & info, StreamInterface * err){
|
||||
|
||||
GCReferenceContainer::ObjectSaveSetup(info,err);
|
||||
return HttpInterface::ObjectSaveSetup(info,err);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/**Utility method to print the form*/
|
||||
bool Initialise();
|
||||
|
||||
bool PrintHTTPForm(HtmlStream &hmStream); // prints the html steam
|
||||
|
||||
bool WriteConfigurationFileWithChanges(char BaseFileFilePath[], char TargetFilePath[]); // writes a config file from the stored variables
|
||||
|
||||
bool ReadConfigurationFile(char FilePath[]); // reads a configuration file and saves the data to the correspondent variables
|
||||
|
||||
bool DualVectorSort(int vector_dim, float * vector_x, float * vector_y); // sorts 2 vectors based on the vector_x values
|
||||
|
||||
virtual bool RemoveRepeatedValues(int * vector_dim, float * vector_x, float * vector_y); // remove repeated values of generic vectors
|
||||
|
||||
virtual bool RemoveRepeatedValues(int option); // remove repeated values of a certain waveform (option dependant)
|
||||
|
||||
bool MoveToTemp(int option); // used with remove point
|
||||
|
||||
bool MoveToTempWithLimits(int option); // used with add point
|
||||
|
||||
bool RetrieveFromTemp(int option); // used with remove/add point
|
||||
|
||||
bool RemovePoint(int option, int index_to_remove); // remove a point for a certain waveform
|
||||
|
||||
bool DisplayPoint(int option, int index_to_display);
|
||||
|
||||
bool AddPoint(int option, float point_to_add_x, float point_to_add_y); // add a point to a certain waveform
|
||||
|
||||
};
|
||||
#endif
|
||||
1132
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/ControllerGAM.cpp
Normal file
1132
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/ControllerGAM.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,169 @@
|
||||
#ifndef _CONTROLLERGAM_H
|
||||
#define _CONTROLLERGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "File.h"
|
||||
#include "Matrix.h"
|
||||
#include "HtmlStream.h"
|
||||
#include "IPID.h"
|
||||
#include "IWaveform.h"
|
||||
|
||||
OBJECT_DLL(ControllerGAM)
|
||||
|
||||
|
||||
class ControllerGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float PrimaryCurrent;
|
||||
float HorizontalCurrent;
|
||||
float VerticalCurrent;
|
||||
float PrimaryOutputWaveform;
|
||||
float HorizontalOutputWaveform;
|
||||
float VerticalOutputWaveform;
|
||||
float PuffingOutputWaveform;
|
||||
float ToroidalOutputWaveform;
|
||||
float PlasmaCurrent;
|
||||
float PositionR;
|
||||
float PositionZ;
|
||||
float Density;
|
||||
float HAlpha;
|
||||
float InterferometryR;
|
||||
int32 PrimaryWaveformMode;
|
||||
int32 HorizontalWaveformMode;
|
||||
int32 VerticalWaveformMode;
|
||||
int32 usecTime;
|
||||
int32 DischargeStatus;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float SendToHorizontalValue;
|
||||
float SendToVerticalValue;
|
||||
float SendToPrimaryValue;
|
||||
float SendToPuffing;
|
||||
float SendToToroidal;
|
||||
};
|
||||
|
||||
int old_PrimaryWaveformMode;
|
||||
int old_HorizontalWaveformMode;
|
||||
int old_VerticalWaveformMode;
|
||||
|
||||
float temp_current;
|
||||
float temp_requested_output;
|
||||
|
||||
IPID *horizontal_position_PID;
|
||||
IPID *vertical_position_PID;
|
||||
IPID *primary_plasma_current_PID;
|
||||
|
||||
int horizontal_lookuptable_size;
|
||||
int vertical_lookuptable_size;
|
||||
int primary_lookuptable_size;
|
||||
|
||||
float maximum_horizontal_position; //in mm
|
||||
float minimum_horizontal_position;
|
||||
float maximum_vertical_position;
|
||||
float minimum_vertical_position;
|
||||
float maximum_plasma_current; //in A
|
||||
float minimum_plasma_current;
|
||||
float maximum_horizontal_current;
|
||||
float minimum_horizontal_current;
|
||||
float maximum_vertical_current;
|
||||
float minimum_vertical_current;
|
||||
float maximum_primary_current;
|
||||
float minimum_primary_current;
|
||||
float maximum_toroidal_current;
|
||||
float minimum_toroidal_current;
|
||||
float maximum_puffing_output; // in percentage
|
||||
float minimum_puffing_output;
|
||||
float maximum_density_halpha_scenario; //density x10 ^ 18 //Halpha was multiplied by 100
|
||||
float minimum_density_halpha_scenario;
|
||||
|
||||
float puffing_duration_in_puffing_feedback_in_ms;
|
||||
float maximum_idle_time_in_puffing_feedback_in_ms;
|
||||
float minimum_idle_time_in_puffing_feedback_in_ms;
|
||||
float puffing_feedback_usec_change_percentage_by_cycle;
|
||||
int puffing_feedback_last_usectime;
|
||||
int puffing_feedback_usectime_to_change;
|
||||
bool puffing_feedback_currently_off; //0 -> puffing feedback on, waiting to turn off, 1 -> puffing feedback off, waiting to turn on
|
||||
int puffing_feedback_mode; //1 -> puffing feedback in Density, 2 -> puffing feedback in HAlpha
|
||||
int puffing_feedback_usec_change_per_cycle;
|
||||
int puffing_duration_in_puffing_feedback_in_us;
|
||||
int maximum_idle_time_in_puffing_feedback_in_us;
|
||||
int minimum_idle_time_in_puffing_feedback_in_us;
|
||||
int old_DischargeStatus;
|
||||
|
||||
MatrixT<float> A_matrix;
|
||||
MatrixT<float> B_matrix;
|
||||
MatrixT<float> C_matrix;
|
||||
MatrixT<float> D_matrix;
|
||||
|
||||
int A_matrix_dims[2];
|
||||
int B_matrix_dims[2];
|
||||
int C_matrix_dims[2];
|
||||
int D_matrix_dims[2];
|
||||
int temp_max_dim;
|
||||
|
||||
int usecthread_cycle_time;
|
||||
float PID_time_constant;
|
||||
bool interferometry_radial_control_bool;
|
||||
float PID_horizontal_proportional_soft;
|
||||
float PID_horizontal_proportional_normal;
|
||||
float PID_horizontal_proportional_hard;
|
||||
float PID_horizontal_integral_soft;
|
||||
float PID_horizontal_integral_normal;
|
||||
float PID_horizontal_integral_hard;
|
||||
float PID_horizontal_derivative_soft;
|
||||
float PID_horizontal_derivative_normal;
|
||||
float PID_horizontal_derivative_hard;
|
||||
float PID_vertical_proportional_soft;
|
||||
float PID_vertical_proportional_normal;
|
||||
float PID_vertical_proportional_hard;
|
||||
float PID_vertical_integral_soft;
|
||||
float PID_vertical_integral_normal;
|
||||
float PID_vertical_integral_hard;
|
||||
float PID_vertical_derivative_soft;
|
||||
float PID_vertical_derivative_normal;
|
||||
float PID_vertical_derivative_hard;
|
||||
float PID_primary_proportional_soft;
|
||||
float PID_primary_proportional_normal;
|
||||
float PID_primary_proportional_hard;
|
||||
float PID_primary_integral_soft;
|
||||
float PID_primary_integral_normal;
|
||||
float PID_primary_integral_hard;
|
||||
float PID_primary_derivative_soft;
|
||||
float PID_primary_derivative_normal;
|
||||
float PID_primary_derivative_hard;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
int puffing_mode;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
ControllerGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~ControllerGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(ControllerGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
|
||||
#include "CosineProbeGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(CosineProbeGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
CosineProbeGAM::CosineProbeGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
CosineProbeGAM::~CosineProbeGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool CosineProbeGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"CosineProbeGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
if(!cdb.ReadInt32(i, "cosine_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s cosine_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
cosine_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"CosineProbeGAM::Initialise: cosine_radial_bool = %d",cosine_radial_bool);
|
||||
}
|
||||
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "CosineProbeGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "CosineProbeGAM::Initialise: %s failed to add the CosineProbeGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "CosineProbeGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "CosineProbeGAM::Initialise: %s failed to add the CosineProbeGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 2;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("input_cosine_signals");
|
||||
CDB_move_to[1].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"CosineProbeGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("cosine_probe_r");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"CosineProbeGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->n_samples = 0;
|
||||
this->accumulator = 0;
|
||||
this->remove_offset = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool CosineProbeGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"CosineProbeGAM:: %s inputstruct = %f ",this->Name(), inputstruct[0].ADC_cosine_probe);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
|
||||
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
// Determine the ADC offset
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
|
||||
this->accumulator += (float) inputstruct[0].ADC_cosine_probe;
|
||||
this->remove_offset = this->accumulator / (float) this->n_samples;
|
||||
outputstruct[0].CosineProbeR = 0;
|
||||
}
|
||||
else{
|
||||
//send offset corrections to logger once
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
AssertErrorCondition(Information,"CosineProbeGAM::Execute: %s OFFSET = %f, number of samples = %d", this->Name(), this->remove_offset, n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
|
||||
outputstruct[0].CosineProbeR = inputstruct[0].ADC_cosine_probe - remove_offset;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->n_samples = 0;
|
||||
this->accumulator = 0;
|
||||
this->remove_offset = 0;
|
||||
outputstruct[0].CosineProbeR = 0;
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
return True;
|
||||
}
|
||||
bool CosineProbeGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>cosine_radial_bool = %d\n\
|
||||
<br><br",cosine_radial_bool);
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef _COSINEPROBEGAM_H
|
||||
#define _COSINEPROBEGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(CosineProbeGAM)
|
||||
|
||||
|
||||
class CosineProbeGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_cosine_probe;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float CosineProbeR;
|
||||
};
|
||||
|
||||
bool cosine_radial_bool;
|
||||
int n_samples;
|
||||
float accumulator;
|
||||
float remove_offset;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
CosineProbeGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~CosineProbeGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(CosineProbeGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
|
||||
#include "ElectricProbesGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(ElectricProbesGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
ElectricProbesGAM::ElectricProbesGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
ElectricProbesGAM::~ElectricProbesGAM()
|
||||
{
|
||||
//if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
//if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool ElectricProbesGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadInt32(electric_radial_bool, "electric_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s electric_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "ElectricProbesGAM::Initialise: electric_radial_bool = %d",electric_radial_bool);
|
||||
|
||||
if(!cdb.ReadInt32(electric_vertical_bool, "electric_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s electric_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"ElectricProbesGAM::Initialise: electric_vertical_bool = %d",electric_vertical_bool);
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"CosineProbeGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
|
||||
// sleep(1); test proposes
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "ElectricProbesGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ElectricProbesGAM::Initialise: %s failed to add the ElectricProbesGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "ElectricProbesGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ElectricProbesGAM::Initialise: %s failed to add the ElectricProbesGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 5;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
for(i=0;i<number_of_signals_to_read-1;i++) CDB_move_to[i].Printf("Channel_%d",i);
|
||||
CDB_move_to[number_of_signals_to_read-1].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"ElectricProbesGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 2;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("electric_probes_r");
|
||||
CDB_move_to[1].Printf("electric_probes_z");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"ElectricProbesGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectricProbesGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->n_samples = 0;
|
||||
this->accumulator_1 = 0;
|
||||
this->accumulator_2 = 0;
|
||||
this->accumulator_3 = 0;
|
||||
this->accumulator_4 = 0;
|
||||
this->remove_offset_1 = 0;
|
||||
this->remove_offset_2 = 0;
|
||||
this->remove_offset_3 = 0;
|
||||
this->remove_offset_4 = 0;
|
||||
|
||||
// 2*distance_from_center_to_near in mm
|
||||
this->distance = 0.08;
|
||||
|
||||
this->out_of_bounds_limit = 0.085;
|
||||
|
||||
//constants for converting volt difference to mm;
|
||||
//ADJUST THIS!!!!!!!!
|
||||
this->RadialConstant = 0.001;
|
||||
this->VerticalConstant = 0.001;
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool ElectricProbesGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
// AssertErrorCondition(InitialisationError,"MainConfigurator::WriteConfigurationFile: discharge_time = %f",discharge_time);
|
||||
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"ElectricProbesGAM:: %s inputstruct = %f %f %f %f %f %f %f %f",this->Name(), inputstruct[0].ADC_electric_top_far , inputstruct[0].ADC_electric_top_near , inputstruct[0].ADC_electric_inner_far , inputstruct[0].ADC_electric_inner_near , inputstruct[0].ADC_electric_outer_far , inputstruct[0].ADC_electric_outer_near , inputstruct[0].ADC_electric_bottom_far , inputstruct[0].ADC_electric_bottom_near );
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
/* old code with far and near electric probes
|
||||
auxiliary_calculation[0] = constants[0]*(float)inputstruct[0].ADC_electric_inner_near - constants[1]*(float)inputstruct[0].ADC_electric_inner_far - constants[0]*(float)inputstruct[0].ADC_electric_outer_near + constants[1]*(float)inputstruct[0].ADC_electric_outer_far;
|
||||
auxiliary_calculation[1] = (float)inputstruct[0].ADC_electric_inner_far + (float)inputstruct[0].ADC_electric_outer_far - (float)inputstruct[0].ADC_electric_inner_near - (float)inputstruct[0].ADC_electric_outer_near ;
|
||||
auxiliary_calculation[2] = constants[0]*(float)inputstruct[0].ADC_electric_bottom_near - constants[1]*(float)inputstruct[0].ADC_electric_bottom_far - constants[0]*(float)inputstruct[0].ADC_electric_top_near + constants[1]*(float)inputstruct[0].ADC_electric_top_far;
|
||||
auxiliary_calculation[3] = (float)inputstruct[0].ADC_electric_bottom_far + (float)inputstruct[0].ADC_electric_top_far - (float)inputstruct[0].ADC_electric_bottom_near - (float)inputstruct[0].ADC_electric_top_near ;
|
||||
|
||||
if (auxiliary_calculation[1] != 0 && electric_radial_bool) {
|
||||
outputstruct[0].ElectricProbesR = auxiliary_calculation[0] / auxiliary_calculation[1];
|
||||
if (outputstruct[0].ElectricProbesR > out_of_bounds_limit)outputstruct[0].ElectricProbesR = out_of_bounds_limit;
|
||||
if (outputstruct[0].ElectricProbesR < -out_of_bounds_limit)outputstruct[0].ElectricProbesR = -out_of_bounds_limit;
|
||||
|
||||
}
|
||||
else outputstruct[0].ElectricProbesR = 0;
|
||||
|
||||
if (auxiliary_calculation[1] != 0 && electric_vertical_bool) {
|
||||
outputstruct[0].ElectricProbesZ = auxiliary_calculation[2] / auxiliary_calculation[3];
|
||||
if (outputstruct[0].ElectricProbesZ > out_of_bounds_limit)outputstruct[0].ElectricProbesZ = out_of_bounds_limit;
|
||||
if (outputstruct[0].ElectricProbesZ < -out_of_bounds_limit)outputstruct[0].ElectricProbesZ = -out_of_bounds_limit;
|
||||
|
||||
}
|
||||
else outputstruct[0].ElectricProbesZ = 0;
|
||||
*/
|
||||
// new code with just 4 electric probes
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
// Determine the ADC offset
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
|
||||
this->accumulator_1 += (float) inputstruct[0].ADC_electric_top_near;
|
||||
this->accumulator_2 += (float) inputstruct[0].ADC_electric_inner_near;
|
||||
this->accumulator_3 += (float) inputstruct[0].ADC_electric_outer_near;
|
||||
this->accumulator_4 += (float) inputstruct[0].ADC_electric_bottom_near;
|
||||
this->remove_offset_1 = this->accumulator_1 / (float) this->n_samples;
|
||||
this->remove_offset_2 = this->accumulator_2 / (float) this->n_samples;
|
||||
this->remove_offset_3 = this->accumulator_3 / (float) this->n_samples;
|
||||
this->remove_offset_4 = this->accumulator_4 / (float) this->n_samples;
|
||||
outputstruct[0].ElectricProbesR = 0;
|
||||
outputstruct[0].ElectricProbesZ = 0;
|
||||
}
|
||||
else{
|
||||
//send offset corrections to logger once
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
AssertErrorCondition(Information,"ElectricProbesGAM::Execute: %s OFFSETS = %f,%f,%f,%f, number of samples = %d", this->Name(), this->remove_offset_1, this->remove_offset_2, this->remove_offset_3, this->remove_offset_4, n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
|
||||
if (electric_radial_bool) {
|
||||
outputstruct[0].ElectricProbesR = RadialConstant * ( (inputstruct[0].ADC_electric_inner_near - this->remove_offset_2) - (inputstruct[0].ADC_electric_outer_near - this->remove_offset_3));
|
||||
if (outputstruct[0].ElectricProbesR > out_of_bounds_limit)outputstruct[0].ElectricProbesR = out_of_bounds_limit;
|
||||
if (outputstruct[0].ElectricProbesR < -out_of_bounds_limit)outputstruct[0].ElectricProbesR = -out_of_bounds_limit;
|
||||
|
||||
}
|
||||
else outputstruct[0].ElectricProbesR = 0;
|
||||
|
||||
if (electric_vertical_bool) {
|
||||
outputstruct[0].ElectricProbesZ = VerticalConstant * ((inputstruct[0].ADC_electric_bottom_near - this->remove_offset_4) - (inputstruct[0].ADC_electric_top_near - this->remove_offset_1));
|
||||
if (outputstruct[0].ElectricProbesZ > out_of_bounds_limit)outputstruct[0].ElectricProbesZ = out_of_bounds_limit;
|
||||
if (outputstruct[0].ElectricProbesZ < -out_of_bounds_limit)outputstruct[0].ElectricProbesZ = -out_of_bounds_limit;
|
||||
|
||||
}
|
||||
else outputstruct[0].ElectricProbesZ = 0;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->n_samples = 0;
|
||||
this->accumulator_1 = 0;
|
||||
this->accumulator_2 = 0;
|
||||
this->accumulator_3 = 0;
|
||||
this->accumulator_4 = 0;
|
||||
this->remove_offset_1 = 0;
|
||||
this->remove_offset_2 = 0;
|
||||
this->remove_offset_3 = 0;
|
||||
this->remove_offset_4 = 0;
|
||||
outputstruct[0].ElectricProbesR = 0;
|
||||
outputstruct[0].ElectricProbesZ = 0;
|
||||
}
|
||||
|
||||
// AssertErrorCondition(InitialisationError,"ElectricProbesGAM:: %s outputstruct = %f %f",this->Name(), outputstruct[0].ElectricProbesR , outputstruct[0].ElectricProbesZ );
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool ElectricProbesGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>electric_radial_bool = %d\n\
|
||||
<br>electric_vertical_bool = %d\n\
|
||||
<br><br",electric_radial_bool, electric_vertical_bool);
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef _ELECTRICPROBESGAM_H
|
||||
#define _ELECTRICPROBESGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(ElectricProbesGAM)
|
||||
|
||||
|
||||
class ElectricProbesGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_electric_top_near;
|
||||
float ADC_electric_inner_near;
|
||||
float ADC_electric_outer_near;
|
||||
float ADC_electric_bottom_near;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float ElectricProbesR;
|
||||
float ElectricProbesZ;
|
||||
};
|
||||
|
||||
int electric_radial_bool;
|
||||
int electric_vertical_bool;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
|
||||
int n_samples;
|
||||
float accumulator_1;
|
||||
float accumulator_2;
|
||||
float accumulator_3;
|
||||
float accumulator_4;
|
||||
float remove_offset_1;
|
||||
float remove_offset_2;
|
||||
float remove_offset_3;
|
||||
float remove_offset_4;
|
||||
|
||||
float out_of_bounds_limit;
|
||||
float distance;
|
||||
float RadialConstant;
|
||||
float VerticalConstant;
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
ElectricProbesGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~ElectricProbesGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(ElectricProbesGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* File: ElectrodeBiasingGAM.cpp (based on HeavyIonBeamGAM.cpp)
|
||||
* Author: Rafael Henriques
|
||||
* Date: 7th May 2016
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ElectrodeBiasingGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(ElectrodeBiasingGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
ElectrodeBiasingGAM::ElectrodeBiasingGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
ElectrodeBiasingGAM::~ElectrodeBiasingGAM()
|
||||
{
|
||||
//if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
//if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool ElectrodeBiasingGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
//Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "ElectrodeBiasingGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ElectrodeBiasingGAM::Initialise: %s failed to add the ElectrodeBiasingGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "ElectrodeBiasingGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ElectrodeBiasingGAM::Initialise: %s failed to add the ElectrodeBiasingGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
//INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectrodeBiasingGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_read = 1;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[number_of_signals_to_read-1].Printf("discharge_status");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ElectrodeBiasingGAM::Initialise: %s Could not move to \"%s\"", this->Name(), CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"ElectrodeBiasingGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectrodeBiasingGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
//OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectrodeBiasingGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_write = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_write];
|
||||
SignalType = new FString[number_of_signals_to_write];
|
||||
CDB_move_to[0].Printf("eb_trigger");
|
||||
for (i=0;i<number_of_signals_to_write;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectrodeBiasingGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"ElectrodeBiasingGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ElectrodeBiasingGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
//Initialization
|
||||
dischargestatus_old = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ****************************************************************
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool ElectrodeBiasingGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
int dischargestatus;
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
dischargestatus = inputstruct[0].DischargeStatus;
|
||||
|
||||
if(dischargestatus_old == 0 && dischargestatus == 1) outputstruct[0].ElectrodeBiasingTrigger = 1.0;
|
||||
if(dischargestatus_old == 0 && dischargestatus != 1) outputstruct[0].ElectrodeBiasingTrigger = 0.0;
|
||||
if(dischargestatus_old == 1 && dischargestatus == 1) outputstruct[0].ElectrodeBiasingTrigger = 1.0;
|
||||
if(dischargestatus_old == 1 && dischargestatus != 1 && dischargestatus != 2) outputstruct[0].ElectrodeBiasingTrigger = 0;
|
||||
if(dischargestatus_old == 1 && dischargestatus == 2) outputstruct[0].ElectrodeBiasingTrigger = 0.0;
|
||||
if(dischargestatus_old == 2 && dischargestatus == 1) outputstruct[0].ElectrodeBiasingTrigger = 1.0;
|
||||
if(dischargestatus_old == 2 && dischargestatus != 1) outputstruct[0].ElectrodeBiasingTrigger = 0.0;
|
||||
|
||||
dischargestatus_old = dischargestatus;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
outputstruct[0].ElectrodeBiasingTrigger = 0.0;
|
||||
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef _ELECTRODEBIASINGGAM_H
|
||||
#define _ELECTRODEBIASINGGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
// #include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(ElectrodeBiasingGAM)
|
||||
|
||||
|
||||
class ElectrodeBiasingGAM : public GAM {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
int DischargeStatus;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float ElectrodeBiasingTrigger;
|
||||
};
|
||||
|
||||
//internal use
|
||||
int dischargestatus_old; //save previous value of DischargeStatus
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
ElectrodeBiasingGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~ElectrodeBiasingGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
OBJECT_DLL_STUFF(ElectrodeBiasingGAM)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* File: FireSignalDischargeStatusGAM.cpp
|
||||
* Author: ivoc
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FireSignalDischargeStatusGAM.h"
|
||||
|
||||
|
||||
OBJECTLOADREGISTER(FireSignalDischargeStatusGAM, "$Id: $")
|
||||
|
||||
|
||||
//
|
||||
// Default constructor
|
||||
//
|
||||
FireSignalDischargeStatusGAM::FireSignalDischargeStatusGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
|
||||
this->plasmaEnded = False;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Destructor
|
||||
//
|
||||
FireSignalDischargeStatusGAM::~FireSignalDischargeStatusGAM(){
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Initialise the module
|
||||
//
|
||||
bool FireSignalDischargeStatusGAM::Initialise(ConfigurationDataBase& cdbData)
|
||||
{
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "FireSignalDischargeStatusGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "FireSignalDischargeStatusGAM::Initialise: %s failed to add the FireSignalDischargeStatusGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"FireSignalDischargeStatusGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 2;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("discharge_status");
|
||||
CDB_move_to[1].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"FireSignalDischargeStatusGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"FireSignalDischargeStatusGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"FireSignalDischargeStatusGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->plasmaEnded = False;
|
||||
this->PlasmaStarted = False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Execute the module functionalities
|
||||
//
|
||||
bool FireSignalDischargeStatusGAM::Execute(GAM_FunctionNumbers functionNumber)
|
||||
{
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
|
||||
//
|
||||
// Reset plasma ended trigger
|
||||
//
|
||||
|
||||
if(functionNumber == GAMOffline)
|
||||
{
|
||||
this->plasmaEnded = False;
|
||||
this->plasmaEndedTimeMarked = False;
|
||||
this->PlasmaStarted = False;
|
||||
}
|
||||
|
||||
if(functionNumber == GAMPrepulse)
|
||||
{
|
||||
this->plasmaEnded = False;
|
||||
this->plasmaEndedTimeMarked = False;
|
||||
this->PlasmaStarted = False;
|
||||
}
|
||||
|
||||
if(inputstruct[0].DischargeStatus >= 0) this->PlasmaStarted = True;
|
||||
|
||||
|
||||
// if (inputstruct[0].DischargeStatus >= 0) AssertErrorCondition(InitialisationError,"FireSignalDischargeStatusGAM::Execute: DischargeStatus = %d !!!",inputstruct[0].DischargeStatus );
|
||||
if((inputstruct[0].DischargeStatus < 0) && (!this->plasmaEnded) && (this->PlasmaStarted)){
|
||||
|
||||
this->plasmaEnded = True;
|
||||
this->PlasmaStarted = False;
|
||||
AssertErrorCondition(InitialisationError,"FireSignalDischargeStatusGAM::Execute: PLASMA ENDED at %d !!!", inputstruct[0].usecTime);
|
||||
|
||||
if(!this->plasmaEndedTimeMarked){
|
||||
|
||||
this->plasmaEndedTime = inputstruct[0].usecTime;
|
||||
this->plasmaEndedTimeMarked = True;
|
||||
}
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Builds the HTTP page with information about the CODAC
|
||||
//
|
||||
bool FireSignalDischargeStatusGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html");
|
||||
hStream.keepAlive = False;
|
||||
//copy to the client
|
||||
hStream.WriteReplyHeader(False);
|
||||
|
||||
hStream.Printf("<html><head><title>CODAC GAM</title></head><body>");
|
||||
hStream.Printf("<h1>Information:</h1><br />");
|
||||
|
||||
//
|
||||
// Plasma ended flag
|
||||
//
|
||||
if(this->plasmaEnded)
|
||||
hStream.Printf("<p>Plasma ended: True</p>");
|
||||
else
|
||||
hStream.Printf("<p>Plasma ended: False</p>");
|
||||
hStream.Printf("<p>Plasma ended time: %d</p>", this->plasmaEndedTime);
|
||||
|
||||
hStream.Printf("</body></html>");
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* File: FireSignalDischargeStatusGAM.h
|
||||
* Author: ivoc
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __FIRESIGNALDISCHARGESTATUSGAM_H__
|
||||
#define __FIRESIGNALDISCHARGESTATUSGAM_H__
|
||||
|
||||
#include "GAM.h"
|
||||
#include "DDBInputInterface.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(FireSignalDischargeStatusGAM)
|
||||
|
||||
|
||||
class FireSignalDischargeStatusGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
int DischargeStatus;
|
||||
int usecTime;
|
||||
};
|
||||
|
||||
|
||||
bool plasmaEnded;
|
||||
bool plasmaEndedTimeMarked;
|
||||
bool PlasmaStarted;
|
||||
uint32 plasmaEndedTime;
|
||||
int i;
|
||||
|
||||
public:
|
||||
|
||||
//
|
||||
// Default constructor
|
||||
//
|
||||
FireSignalDischargeStatusGAM();
|
||||
|
||||
//
|
||||
// Destructor
|
||||
//
|
||||
virtual ~FireSignalDischargeStatusGAM();
|
||||
|
||||
//
|
||||
// Initialise the module
|
||||
//
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
//
|
||||
// Execute the module functionalities
|
||||
//
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
//
|
||||
// Builds the HTTP page with information about the CODAC for FireSignal to catch (used this way for compatibility with the previous version)
|
||||
//
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(FireSignalDischargeStatusGAM)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
236
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/HAlphaGAM.cpp
Normal file
236
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/HAlphaGAM.cpp
Normal file
@@ -0,0 +1,236 @@
|
||||
|
||||
#include "HAlphaGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(HAlphaGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
HAlphaGAM::HAlphaGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
HAlphaGAM::~HAlphaGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool HAlphaGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"HAlphaGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "HAlphaGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HAlphaGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "HAlphaGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HAlphaGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 2;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("h_alfa_raw");
|
||||
CDB_move_to[1].Printf("time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"HAlphaGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("h_alfa_output");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"HAlphaGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HAlphaGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->n_samples = 0;
|
||||
this->accumulator = 0;
|
||||
this->remove_offset = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool HAlphaGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"HAlphaGAM:: %s inputstruct = %f ",this->Name(), inputstruct[0].ADC_H_alpha);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
// Determine the ADC offset
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
|
||||
this->accumulator += (float) inputstruct[0].ADC_H_alpha;
|
||||
this->remove_offset = this->accumulator / (float) this->n_samples;
|
||||
outputstruct[0].HAlfaOutput = 0;
|
||||
}
|
||||
else{
|
||||
//send offset corrections to logger once
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
AssertErrorCondition(Information,"HAlphaGAM::Execute: %s OFFSET = %f, number of samples = %d", this->Name(), this->remove_offset, n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
|
||||
outputstruct[0].HAlfaOutput = 100 * (inputstruct[0].ADC_H_alpha - remove_offset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->n_samples = 0;
|
||||
this->accumulator = 0;
|
||||
this->remove_offset = 0;
|
||||
outputstruct[0].HAlfaOutput = 0;
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
return True;
|
||||
|
||||
}
|
||||
bool HAlphaGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#ifndef _HALPHAGAM_H
|
||||
#define _HALPHAGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(HAlphaGAM)
|
||||
|
||||
|
||||
class HAlphaGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_H_alpha;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float HAlfaOutput;
|
||||
};
|
||||
|
||||
int n_samples;
|
||||
float accumulator;
|
||||
float remove_offset;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
HAlphaGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~HAlphaGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(HAlphaGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,553 @@
|
||||
/*
|
||||
* File: HeavyIonBeamGAM.cpp (based on MagneticsGAM.cpp)
|
||||
* Author: Rafael Henriques
|
||||
* Date: 6th April 2016
|
||||
*
|
||||
*/
|
||||
|
||||
#include "HeavyIonBeamGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(HeavyIonBeamGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
HeavyIonBeamGAM::HeavyIonBeamGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
HeavyIonBeamGAM::~HeavyIonBeamGAM()
|
||||
{
|
||||
//if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
//if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool HeavyIonBeamGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
//read MARTe config file section: hibd
|
||||
//booleans
|
||||
if(!cdb.ReadInt32(hibd_radial_bool, "hibd_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_radial_bool", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_radial_bool = %d", hibd_radial_bool);
|
||||
if(!cdb.ReadInt32(hibd_vertical_bool, "hibd_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_vertical_bool = %d", hibd_vertical_bool);
|
||||
if(!cdb.ReadInt32(hibd_pos_from_isec_bool, "hibd_pos_from_isec_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_pos_from_isec_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_pos_from_isec_bool = %d", hibd_pos_from_isec_bool);
|
||||
if(!cdb.ReadInt32(hibd_pos_from_nesigmasimple_bool, "hibd_pos_from_nesigmasimple_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_pos_from_nesigmasimple_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_pos_from_nesigmasimple_bool = %d", hibd_pos_from_nesigmasimple_bool);
|
||||
//number of summed samples from the FPGA
|
||||
if(!cdb.ReadInt32(hibd_nav, "hibd_nav"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_nav", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_nav = %d", hibd_nav);
|
||||
if(hibd_nav < 1){
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_nav lower than 1",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
//HIBD detector description
|
||||
if(!cdb->Move("hibd_detector_description"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+hibd.hibd_detector_description\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(no_of_sec_hibd_chs, "no_of_sec_hibd_chs"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s no_of_sec_hibd_chs",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"HeavyIonBeamGAM::Initialise: no_of_sec_hibd_chs = %d",no_of_sec_hibd_chs);
|
||||
|
||||
if (no_of_sec_hibd_chs > 0){
|
||||
hibd_sec_chs_Zs = new float[no_of_sec_hibd_chs];
|
||||
hibd_sec_chs_dls = new float[no_of_sec_hibd_chs];
|
||||
|
||||
if(!cdb.ReadFloatArray(hibd_sec_chs_Zs, (int *)(&no_of_sec_hibd_chs), 1, "positions"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM: Could not read hibd_sec_chs_Zs");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<no_of_sec_hibd_chs;i++) AssertErrorCondition(Information,"HeavyIonBeamGAM::Initialise: hibd_sec_chs_Zs[%d] = %f",i, hibd_sec_chs_Zs[i]);
|
||||
if(!cdb.ReadFloatArray(hibd_sec_chs_dls, (int *)(&no_of_sec_hibd_chs), 1, "dls"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM: Could not read hibd_sec_chs_dls");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<no_of_sec_hibd_chs;i++) AssertErrorCondition(Information,"HeavyIonBeamGAM::Initialise: hibd_sec_chs_dls[%d] = %f",i, hibd_sec_chs_dls[i]);
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s no_of_sec_hibd_chs lower than 1",this->Name());
|
||||
return False;
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
//HIB primary current characteristics
|
||||
if(!cdb.ReadFloat(hibd_iprim_i, "hibd_iprim_i"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_iprim_i", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_iprim_i = %f", hibd_iprim_i);
|
||||
if(hibd_iprim_i <= 0){
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_iprim_i lower than or equal to 0",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadFloat(hibd_iprim_f, "hibd_iprim_f"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_iprim_f", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_iprim_f = %f", hibd_iprim_f);
|
||||
if(hibd_iprim_f <= 0){
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_iprim_f lower than or equal to 0",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadFloat(hibd_iprim_dt, "hibd_iprim_dt"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_iprim_dt", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_iprim_dt = %f", hibd_iprim_dt);
|
||||
if(hibd_iprim_dt <= 0){
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_iprim_dt lower than or equal to 0",this->Name());
|
||||
return False;
|
||||
}
|
||||
//Calibration values
|
||||
if(!cdb.ReadFloat(hibd_radial_constant, "hibd_radial_constant"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_radial_constant", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_radial_constant = %f", hibd_radial_constant);
|
||||
if(!cdb.ReadFloat(hibd_radial_offset, "hibd_radial_offset"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_radial_offset", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_radial_offset = %f", hibd_radial_offset);
|
||||
if(!cdb.ReadFloat(hibd_vertical_constant, "hibd_vertical_constant"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_vertical_constant", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_vertical_constant = %f", hibd_vertical_constant);
|
||||
if(!cdb.ReadFloat(hibd_vertical_offset, "hibd_vertical_offset"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_vertical_offset", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_vertical_offset = %f", hibd_vertical_offset);
|
||||
//Thresold values
|
||||
if(!cdb.ReadFloat(hibd_isec_total_threshold, "hibd_isec_total_threshold"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_isec_total_threshold", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_isec_total_threshold = %f", hibd_isec_total_threshold);
|
||||
if(hibd_isec_total_threshold < 0){
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_isec_total_threshold lower than 0",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadFloat(hibd_nesigmasimple_total_threshold, "hibd_nesigmasimple_total_threshold"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s hibd_nesigmasimple_total_threshold", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "HeavyIonBeamGAM::Initialise: hibd_nesigmasimple_total_threshold = %f", hibd_nesigmasimple_total_threshold);
|
||||
if(hibd_nesigmasimple_total_threshold < 0){
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s hibd_nesigmasimple_total_threshold lower than 0",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
//Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "HeavyIonBeamGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s failed to add the HeavyIonBeamGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "HeavyIonBeamGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s failed to add the HeavyIonBeamGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
//INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_read = 13;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
for(i=0;i<number_of_signals_to_read-1;i++) CDB_move_to[i].Printf("Channel_%d",i);
|
||||
CDB_move_to[number_of_signals_to_read-1].Printf("time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "HeavyIonBeamGAM::Initialise: %s Could not move to \"%s\"", this->Name(), CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"HeavyIonBeamGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
//OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_write = 9;
|
||||
CDB_move_to = new FString[number_of_signals_to_write];
|
||||
SignalType = new FString[number_of_signals_to_write];
|
||||
CDB_move_to[0].Printf("hibd_r");
|
||||
CDB_move_to[1].Printf("hibd_z");
|
||||
CDB_move_to[2].Printf("hibd_isec_total");
|
||||
CDB_move_to[3].Printf("hibd_r_isec");
|
||||
CDB_move_to[4].Printf("hibd_z_isec");
|
||||
CDB_move_to[5].Printf("hibd_iprim_0");
|
||||
CDB_move_to[6].Printf("hibd_nesigmasimple_total");
|
||||
CDB_move_to[7].Printf("hibd_r_nesigmasimple");
|
||||
CDB_move_to[8].Printf("hibd_z_nesigmasimple");
|
||||
for (i=0;i<number_of_signals_to_write;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"HeavyIonBeamGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
//creating array to store the HIBD sec. currents
|
||||
currents = new float [no_of_sec_hibd_chs];
|
||||
|
||||
//convert values from the FPGA to currents in nA
|
||||
// 50 (1e9 / 20e+6) convert V to nA
|
||||
// 10 because ADC goes from -5V to 5V
|
||||
// 1/hibd_nav makes the average of the summed samples
|
||||
// 2^18=262144 because it is a 18bit ADC
|
||||
this->conv_to_nA = (50.0 * 10.0) / (hibd_nav * 262144.0);
|
||||
|
||||
//HIB primary current
|
||||
this->iprim_a = (hibd_iprim_f - hibd_iprim_i) / (hibd_iprim_dt * 1.0e6);
|
||||
this->iprim_b = hibd_iprim_i;
|
||||
iprim_j = new float [no_of_sec_hibd_chs];
|
||||
|
||||
//NeSigmaSimple array
|
||||
ne_sigma_simple = new float [no_of_sec_hibd_chs];
|
||||
|
||||
//limiter (mm)
|
||||
this->out_of_bounds_limit = 85.0;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ****************************************************************
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool HeavyIonBeamGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM:: %s inputstruct = %f %f %f %f %f %f %f %f",this->Name(), inputstruct[0].ADC_electric_top_far , inputstruct[0].ADC_electric_top_near , inputstruct[0].ADC_electric_inner_far , inputstruct[0].ADC_electric_inner_near , inputstruct[0].ADC_electric_outer_far , inputstruct[0].ADC_electric_outer_near , inputstruct[0].ADC_electric_bottom_far , inputstruct[0].ADC_electric_bottom_near );
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
int i; //For iteration
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
currents[0] = (float) inputstruct[0].HIBD_Sec_01 * this->conv_to_nA;
|
||||
currents[1] = (float) inputstruct[0].HIBD_Sec_02 * this->conv_to_nA;
|
||||
currents[2] = (float) inputstruct[0].HIBD_Sec_03 * this->conv_to_nA;
|
||||
currents[3] = (float) inputstruct[0].HIBD_Sec_04 * this->conv_to_nA;
|
||||
currents[4] = (float) inputstruct[0].HIBD_Sec_05 * this->conv_to_nA;
|
||||
currents[5] = (float) inputstruct[0].HIBD_Sec_06 * this->conv_to_nA;
|
||||
currents[6] = (float) inputstruct[0].HIBD_Sec_07 * this->conv_to_nA;
|
||||
currents[7] = (float) inputstruct[0].HIBD_Sec_08 * this->conv_to_nA;
|
||||
currents[8] = (float) inputstruct[0].HIBD_Sec_09 * this->conv_to_nA;
|
||||
currents[9] = (float) inputstruct[0].HIBD_Sec_10 * this->conv_to_nA;
|
||||
currents[10] = (float) inputstruct[0].HIBD_Sec_11 * this->conv_to_nA;
|
||||
currents[11] = (float) inputstruct[0].HIBD_Sec_12 * this->conv_to_nA;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Radial position (currently not implemented) //
|
||||
/////////////////////////////////////////////////
|
||||
if(hibd_radial_bool){
|
||||
|
||||
outputstruct[0].HeavyIonBeamRISec = 0.0;
|
||||
outputstruct[0].HeavyIonBeamRNeSigmaSimple = 0.0;
|
||||
|
||||
/* convert from mm to m */
|
||||
outputstruct[0].HeavyIonBeamRISec = outputstruct[0].HeavyIonBeamRISec*0.001;
|
||||
outputstruct[0].HeavyIonBeamRNeSigmaSimple = outputstruct[0].HeavyIonBeamRNeSigmaSimple*0.001;
|
||||
|
||||
// Output //
|
||||
/*select which algorithm is used to feedback the controller*/
|
||||
if(hibd_pos_from_isec_bool) outputstruct[0].HeavyIonBeamR = outputstruct[0].HeavyIonBeamRISec;
|
||||
if(hibd_pos_from_nesigmasimple_bool) outputstruct[0].HeavyIonBeamR = outputstruct[0].HeavyIonBeamRNeSigmaSimple;
|
||||
/*linear calibration*/
|
||||
outputstruct[0].HeavyIonBeamR = hibd_radial_constant*outputstruct[0].HeavyIonBeamR + hibd_radial_offset;
|
||||
/*limit the output*/
|
||||
if(outputstruct[0].HeavyIonBeamR > this->out_of_bounds_limit) outputstruct[0].HeavyIonBeamR = this->out_of_bounds_limit;
|
||||
if(outputstruct[0].HeavyIonBeamR < -this->out_of_bounds_limit) outputstruct[0].HeavyIonBeamR = -this->out_of_bounds_limit;
|
||||
/* equal the position output to 0 when the calculated position cannot be trusted */
|
||||
// if(hibd_pos_from_isec_bool){
|
||||
// if(outputstruct[0].HeavyIonBeamISecTotal < hibd_isec_total_threshold) outputstruct[0].HeavyIonBeamR = 0.0;
|
||||
// }
|
||||
// if(hibd_pos_from_nesigmasimple_bool){
|
||||
// if(outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal < hibd_nesigmasimple_total_threshold) outputstruct[0].HeavyIonBeamR = 0.0;
|
||||
// }
|
||||
}
|
||||
else{
|
||||
outputstruct[0].HeavyIonBeamRISec = 0.0;
|
||||
outputstruct[0].HeavyIonBeamRNeSigmaSimple = 0.0;
|
||||
outputstruct[0].HeavyIonBeamR = 0.0;
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
// Vertical position //
|
||||
///////////////////////
|
||||
if(hibd_vertical_bool){
|
||||
|
||||
// ISec //
|
||||
/* calculate the centre of mass */
|
||||
outputstruct[0].HeavyIonBeamISecTotal = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZISec = 0.0;
|
||||
for(i=0; i < this->no_of_sec_hibd_chs; i++){
|
||||
outputstruct[0].HeavyIonBeamISecTotal += currents[i];
|
||||
outputstruct[0].HeavyIonBeamZISec += currents[i]*hibd_sec_chs_Zs[i];
|
||||
}
|
||||
/* avoid negative currents and division by zero */
|
||||
if(outputstruct[0].HeavyIonBeamISecTotal <= 0) outputstruct[0].HeavyIonBeamISecTotal = 0.001;
|
||||
outputstruct[0].HeavyIonBeamZISec = outputstruct[0].HeavyIonBeamZISec / outputstruct[0].HeavyIonBeamISecTotal;
|
||||
/* truncate the position to the out of bounds limits */
|
||||
if(outputstruct[0].HeavyIonBeamZISec > this->out_of_bounds_limit) outputstruct[0].HeavyIonBeamZISec = this->out_of_bounds_limit;
|
||||
if(outputstruct[0].HeavyIonBeamZISec < -this->out_of_bounds_limit) outputstruct[0].HeavyIonBeamZISec = -this->out_of_bounds_limit;
|
||||
/* convert from mm to m */
|
||||
outputstruct[0].HeavyIonBeamZISec = outputstruct[0].HeavyIonBeamZISec*0.001;
|
||||
|
||||
// NeSigmaSimple //
|
||||
/* calculate the injected primary beam current (it should be always constant, but it is not during the beginning of the shot)*/
|
||||
if(inputstruct[0].usectime <= hibd_iprim_dt*1.0e6)
|
||||
outputstruct[0].HeavyIonBeamIprim0 = this->iprim_a * (float) inputstruct[0].usectime + this->iprim_b;
|
||||
else
|
||||
outputstruct[0].HeavyIonBeamIprim0 = hibd_iprim_f;
|
||||
/* calculate the ne_sigma_simple */
|
||||
iprim_j[0] = outputstruct[0].HeavyIonBeamIprim0;
|
||||
ne_sigma_simple[0] = currents[0] / (2.0*iprim_j[0]*hibd_sec_chs_dls[0]*0.001); //*0.001 convert from 1/mm to 1/m
|
||||
for(i=1; i < this->no_of_sec_hibd_chs; i++){
|
||||
iprim_j[i] = iprim_j[i-1] - currents[i-1]/2.0;
|
||||
ne_sigma_simple[i] = currents[i] / (2.0*iprim_j[i]*hibd_sec_chs_dls[i]*0.001); //*0.001 convert from 1/mm to 1/m
|
||||
}
|
||||
/* calculate the centre of mass */
|
||||
outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZNeSigmaSimple = 0.0;
|
||||
for(i=0; i < this->no_of_sec_hibd_chs; i++){
|
||||
outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal += ne_sigma_simple[i];
|
||||
outputstruct[0].HeavyIonBeamZNeSigmaSimple += ne_sigma_simple[i]*hibd_sec_chs_Zs[i];
|
||||
}
|
||||
/* avoid negative ne_sigma_simple and division by zero */
|
||||
if(outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal <= 0) outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal = 0.0001;
|
||||
outputstruct[0].HeavyIonBeamZNeSigmaSimple = outputstruct[0].HeavyIonBeamZNeSigmaSimple / outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal;
|
||||
/*truncate the position to the out of bounds limits*/
|
||||
if(outputstruct[0].HeavyIonBeamZNeSigmaSimple > this->out_of_bounds_limit) outputstruct[0].HeavyIonBeamZNeSigmaSimple = this->out_of_bounds_limit;
|
||||
if(outputstruct[0].HeavyIonBeamZNeSigmaSimple < -this->out_of_bounds_limit) outputstruct[0].HeavyIonBeamZNeSigmaSimple = -this->out_of_bounds_limit;
|
||||
/* convert from mm to m */
|
||||
outputstruct[0].HeavyIonBeamZNeSigmaSimple = outputstruct[0].HeavyIonBeamZNeSigmaSimple*0.001;
|
||||
|
||||
// Output //
|
||||
/* select which algorithm is used to feedback the controller */
|
||||
if(hibd_pos_from_isec_bool) outputstruct[0].HeavyIonBeamZ = outputstruct[0].HeavyIonBeamZISec;
|
||||
if(hibd_pos_from_nesigmasimple_bool) outputstruct[0].HeavyIonBeamZ = outputstruct[0].HeavyIonBeamZNeSigmaSimple;
|
||||
/* linear calibration */
|
||||
outputstruct[0].HeavyIonBeamZ = hibd_vertical_constant*outputstruct[0].HeavyIonBeamZ + hibd_vertical_offset;
|
||||
/* equal the position output to 0 when the calculated position cannot be trusted */
|
||||
if(hibd_pos_from_isec_bool){
|
||||
if(outputstruct[0].HeavyIonBeamISecTotal < hibd_isec_total_threshold) outputstruct[0].HeavyIonBeamZ = 0.0;
|
||||
}
|
||||
if(hibd_pos_from_nesigmasimple_bool){
|
||||
if(outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal < hibd_nesigmasimple_total_threshold) outputstruct[0].HeavyIonBeamZ = 0.0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
outputstruct[0].HeavyIonBeamISecTotal = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZISec = 0.0;
|
||||
outputstruct[0].HeavyIonBeamIprim0 = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZNeSigmaSimple = 0.0;
|
||||
outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZ = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
for(i=0; i<this->no_of_sec_hibd_chs; i++){
|
||||
currents[i] = 0.0;
|
||||
iprim_j[i] = 0.0;
|
||||
ne_sigma_simple[i] = 0.0;
|
||||
}
|
||||
outputstruct[0].HeavyIonBeamRISec = 0.0;
|
||||
outputstruct[0].HeavyIonBeamRNeSigmaSimple = 0.0;
|
||||
outputstruct[0].HeavyIonBeamR = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZISec = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZNeSigmaSimple = 0.0;
|
||||
outputstruct[0].HeavyIonBeamZ = 0.0;
|
||||
outputstruct[0].HeavyIonBeamISecTotal = 0.0;
|
||||
outputstruct[0].HeavyIonBeamNeSigmaSimpleTotal = 0.0;
|
||||
outputstruct[0].HeavyIonBeamIprim0 = 0.0;
|
||||
|
||||
}
|
||||
|
||||
// AssertErrorCondition(InitialisationError,"HeavyIonBeamGAM:: %s outputstruct = %f %f",this->Name(), outputstruct[0].HeavyIonBeamR , outputstruct[0].HeavyIonBeamZ );
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool HeavyIonBeamGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>hibd_radial_bool = %d\n\
|
||||
<br>hibd_vertical_bool = %d\n\
|
||||
<br>hibd_pos_from_isec_bool = %d\n\
|
||||
<br>hibd_pos_from_nesigmasimple_bool = %d\n\
|
||||
<br>hibd_nav = %d\n\
|
||||
<br><br",hibd_radial_bool, hibd_vertical_bool, hibd_pos_from_isec_bool, hibd_pos_from_nesigmasimple_bool, hibd_nav);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>no_of_sec_hibd_chs = %d<br><br",no_of_sec_hibd_chs);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>positions</td");
|
||||
for (i=0;i<no_of_sec_hibd_chs;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",hibd_sec_chs_Zs[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>dls</td");
|
||||
for (i=0;i<no_of_sec_hibd_chs;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",hibd_sec_chs_dls[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table>\n<br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>hibd_iprim_i = %f\n\
|
||||
<br>hibd_iprim_f = %f\n\
|
||||
<br>hibd_iprim_dt = %f\n\
|
||||
<br><br",hibd_iprim_i, hibd_iprim_f, hibd_iprim_dt);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>hibd_radial_constant = %f\n\
|
||||
<br>hibd_radial_offset = %f\n\
|
||||
<br>hibd_vertical_constant = %f\n\
|
||||
<br>hibd_vertical_offset = %f\n\
|
||||
<br><br",hibd_radial_constant, hibd_radial_offset, hibd_vertical_constant, hibd_vertical_offset);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>hibd_isec_total_threshold = %f\n\
|
||||
<br>hibd_nesigmasimple_total_threshold = %f\
|
||||
<br><br",hibd_isec_total_threshold, hibd_nesigmasimple_total_threshold);
|
||||
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
#ifndef _HEAVYIONBEAMGAM_H
|
||||
#define _HEAVYIONBEAMGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(HeavyIonBeamGAM)
|
||||
|
||||
|
||||
class HeavyIonBeamGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
int HIBD_Sec_01;
|
||||
int HIBD_Sec_02;
|
||||
int HIBD_Sec_03;
|
||||
int HIBD_Sec_04;
|
||||
int HIBD_Sec_05;
|
||||
int HIBD_Sec_06;
|
||||
int HIBD_Sec_07;
|
||||
int HIBD_Sec_08;
|
||||
int HIBD_Sec_09;
|
||||
int HIBD_Sec_10;
|
||||
int HIBD_Sec_11;
|
||||
int HIBD_Sec_12;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float HeavyIonBeamR;
|
||||
float HeavyIonBeamZ;
|
||||
float HeavyIonBeamISecTotal;
|
||||
float HeavyIonBeamRISec;
|
||||
float HeavyIonBeamZISec;
|
||||
float HeavyIonBeamIprim0;
|
||||
float HeavyIonBeamNeSigmaSimpleTotal;
|
||||
float HeavyIonBeamRNeSigmaSimple;
|
||||
float HeavyIonBeamZNeSigmaSimple;
|
||||
};
|
||||
|
||||
//inputs from the MARTe configuration file
|
||||
//booleans
|
||||
int hibd_radial_bool;
|
||||
int hibd_vertical_bool;
|
||||
int hibd_pos_from_isec_bool;
|
||||
int hibd_pos_from_nesigmasimple_bool;
|
||||
//number of summed samples in the current returned from the FPGA
|
||||
int hibd_nav;
|
||||
//HIBD detector description
|
||||
int no_of_sec_hibd_chs; //number of secondary HIBD channels
|
||||
float *hibd_sec_chs_Zs;
|
||||
float *hibd_sec_chs_dls;
|
||||
//HIBD primary current description
|
||||
float hibd_iprim_i; //initial injected HIB primary current (nA)
|
||||
float hibd_iprim_f; //final injected HIB primary current after hibd_dt ms (nA)
|
||||
float hibd_iprim_dt; //time interval between hibd_iprim_i & hibd_iprim_f (ms)
|
||||
//For calibration
|
||||
float hibd_radial_constant;
|
||||
float hibd_radial_offset;
|
||||
float hibd_vertical_constant;
|
||||
float hibd_vertical_offset;
|
||||
//For threshold
|
||||
float hibd_isec_total_threshold;
|
||||
float hibd_nesigmasimple_total_threshold;
|
||||
|
||||
//internal use
|
||||
float *currents; //array to store the values obtained from the FPGA converted to currents
|
||||
float conv_to_nA;
|
||||
float iprim_a; //HeavyIonBeamIprim0 = iprim_a*time + iprim_b
|
||||
float iprim_b; //HeavyIonBeamIprim0 = iprim_a*time + iprim_b
|
||||
float *iprim_j; //array to store the values of Ij+
|
||||
float *ne_sigma_simple; //array to store the NeSigmaSimple values
|
||||
float out_of_bounds_limit; //limiter (mm)
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
HeavyIonBeamGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~HeavyIonBeamGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(HeavyIonBeamGAM)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
170
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IPID.cpp
Normal file
170
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IPID.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IPID.cpp - differential PID equation
|
||||
// Ivo Carvalho 29/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
|
||||
#include "IPID.h"
|
||||
|
||||
//OBJECTLOADREGISTER(IPID,"$Id: IPID.cpp,v 1.0 29/4/2011 14:22:36 ivoc Exp $")
|
||||
// if cycle time is supplied
|
||||
IPID::IPID(float set_Kp_constant, float set_Ki_constant, float set_Kd_constant, float set_T_constant, float set_upper_limit, float set_lower_limit){
|
||||
|
||||
this->Kp_constant = set_Kp_constant;
|
||||
this->Ki_constant = set_Ki_constant;
|
||||
this->Kd_constant = set_Kd_constant;
|
||||
this->T_constant = set_T_constant;
|
||||
this->P_realtime_constant = this->Kp_constant;
|
||||
this->I_realtime_constant = this->Ki_constant * this->T_constant;
|
||||
this->D_realtime_constant = this->Kd_constant / this->T_constant;
|
||||
this->upper_limit = set_upper_limit;
|
||||
this->lower_limit = set_lower_limit;
|
||||
this->old_output = 0;
|
||||
this->old_PV = 0;
|
||||
this->old_old_PV = 0;
|
||||
this->old_error = 0;
|
||||
this->old_old_error = 0;
|
||||
}
|
||||
// create without cycle time, just with the constants used in realtime
|
||||
IPID::IPID(float set_P_realtime_constant, float set_I_realtime_constant, float set_D_realtime_constant, float set_upper_limit, float set_lower_limit){
|
||||
|
||||
this->P_realtime_constant = set_P_realtime_constant;
|
||||
this->I_realtime_constant = set_I_realtime_constant;
|
||||
this->D_realtime_constant = set_D_realtime_constant;
|
||||
this->T_constant = 0; //undefined
|
||||
this->Kp_constant = 0;
|
||||
this->Ki_constant = 0;
|
||||
this->Kd_constant = 0;
|
||||
this->upper_limit = set_upper_limit;
|
||||
this->lower_limit = set_lower_limit;
|
||||
this->old_output = 0;
|
||||
this->old_PV = 0;
|
||||
this->old_old_PV = 0;
|
||||
this->old_error = 0;
|
||||
this->old_old_error = 0;
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
IPID::~IPID(){
|
||||
|
||||
}
|
||||
|
||||
bool IPID::LoadOldOutputWithinLimits(float old_output_to_load){
|
||||
|
||||
if (old_output_to_load > upper_limit) old_output_to_load = upper_limit;
|
||||
if (old_output_to_load < lower_limit) old_output_to_load = lower_limit;
|
||||
this->old_output = old_output_to_load;
|
||||
this->old_PV = 0;
|
||||
this->old_old_PV = 0;
|
||||
this->old_error = 0;
|
||||
this->old_old_error = 0;
|
||||
return True;
|
||||
}
|
||||
|
||||
bool IPID::SetPIDConstants(float set_Kp_constant, float set_Ki_constant, float set_Kd_constant, float set_T_constant){
|
||||
|
||||
this->Kp_constant = set_Kp_constant;
|
||||
this->Ki_constant = set_Ki_constant;
|
||||
this->Kd_constant = set_Kd_constant;
|
||||
this->T_constant = set_T_constant;
|
||||
this->P_realtime_constant = this->Kp_constant;
|
||||
this->I_realtime_constant = this->Ki_constant * this->T_constant;
|
||||
this->D_realtime_constant = this->Kd_constant / this->T_constant;
|
||||
return True;
|
||||
}
|
||||
|
||||
bool IPID::SetRealtimePIDConstants(float set_P_realtime_constant, float set_I_realtime_constant, float set_D_realtime_constant){
|
||||
|
||||
this->P_realtime_constant = set_P_realtime_constant;
|
||||
this->I_realtime_constant = set_I_realtime_constant;
|
||||
this->D_realtime_constant = set_D_realtime_constant;
|
||||
if (this->T_constant > 0){
|
||||
this->Kp_constant = this->P_realtime_constant;
|
||||
this->Ki_constant = this->I_realtime_constant / this->T_constant;
|
||||
this->Kd_constant = this->D_realtime_constant * this->T_constant;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
bool IPID::SetLimits(float set_upper_limit, float set_lower_limit){
|
||||
|
||||
this->upper_limit = set_upper_limit;
|
||||
this->lower_limit = set_lower_limit;
|
||||
return True;
|
||||
}
|
||||
|
||||
float IPID::CalculatePID(float process_variable, float setpoint){
|
||||
this->error = setpoint - process_variable;
|
||||
|
||||
this->old_output = this->old_output - this->P_realtime_constant * (process_variable - this->old_PV) + this->I_realtime_constant * this->error - this->D_realtime_constant * (process_variable - 2 * this->old_PV + process_variable - this->old_old_PV);
|
||||
|
||||
this->old_old_PV = this->old_PV;
|
||||
this->old_PV = process_variable;
|
||||
|
||||
if(this->old_output > this->upper_limit) this->old_output = this->upper_limit;
|
||||
if(this->old_output < this->lower_limit) this->old_output = this->lower_limit;
|
||||
|
||||
return this->old_output;
|
||||
}
|
||||
|
||||
float IPID::CalculatePI(float process_variable, float setpoint){
|
||||
this->error = setpoint - process_variable;
|
||||
|
||||
this->old_output = this->old_output - this->P_realtime_constant * (process_variable - this->old_PV) + this->I_realtime_constant * this->error;
|
||||
|
||||
this->old_old_PV = this->old_PV;
|
||||
this->old_PV = process_variable;
|
||||
|
||||
if(this->old_output > this->upper_limit) this->old_output = this->upper_limit;
|
||||
if(this->old_output < this->lower_limit) this->old_output = this->lower_limit;
|
||||
|
||||
return this->old_output;
|
||||
}
|
||||
|
||||
float IPID::CalculateP(float process_variable, float setpoint){
|
||||
this->error = setpoint - process_variable;
|
||||
|
||||
this->old_output = this->old_output - this->P_realtime_constant * (process_variable - this->old_PV);
|
||||
|
||||
this->old_old_PV = this->old_PV;
|
||||
this->old_PV = process_variable;
|
||||
|
||||
if(this->old_output > this->upper_limit) this->old_output = this->upper_limit;
|
||||
if(this->old_output < this->lower_limit) this->old_output = this->lower_limit;
|
||||
|
||||
return this->old_output;
|
||||
}
|
||||
|
||||
float IPID::CalculatePID_types(float process_variable, float setpoint, float type){
|
||||
this->error = setpoint - process_variable;
|
||||
|
||||
if(type==1)//Type A
|
||||
this->old_output = this->old_output + this->Kp_constant*1000 * (this->error - this->old_error) + this->Ki_constant*1000 * this->error + this->Kd_constant*1000 * (this->error - 2 * this->old_error + this->old_old_error);
|
||||
if(type==2)//Type B
|
||||
this->old_output = this->old_output + this->Kp_constant*1000 * (this->error - this->old_error) + this->Ki_constant*1000 * this->error - this->Kd_constant*1000 * (process_variable - 2 * this->old_PV + this->old_old_PV);
|
||||
if(type==3)//Type C
|
||||
this->old_output = this->old_output - this->Kp_constant*1000 * (process_variable - this->old_PV) + this->Ki_constant*1000 * this->error - this->Kd_constant*1000 * (process_variable - 2 * this->old_PV + this->old_old_PV);
|
||||
|
||||
this->old_old_PV = this->old_PV;
|
||||
this->old_PV = process_variable;
|
||||
this->old_old_error = this->old_error;
|
||||
this->old_error = this->error;
|
||||
|
||||
//if(this->old_output > this->upper_limit) this->old_output = this->upper_limit;
|
||||
//if(this->old_output < this->lower_limit) this->old_output = this->lower_limit;
|
||||
|
||||
if(this->old_output > this->upper_limit) return this->upper_limit;
|
||||
if(this->old_output < this->lower_limit) return this->lower_limit;
|
||||
|
||||
return this->old_output;
|
||||
}
|
||||
|
||||
float IPID::ReturnErrorInPercentage(float process_variable, float setpoint){
|
||||
this->error = setpoint - process_variable;
|
||||
|
||||
if (this->error < 0) this->error = 0 - this->error;
|
||||
|
||||
return ((100 * error)/(this->upper_limit - this->lower_limit)) ;
|
||||
}
|
||||
148
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IPID.h
Normal file
148
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IPID.h
Normal file
@@ -0,0 +1,148 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IPID.cpp - differential PID equation - type C - out(n) = out(n-1) - Kp[PV(n)-PV(n-1)] + Ki*T*e(n) - (Kd/T)*[PV(n) - 2PV(n-1) + PV(n-2)]
|
||||
// Ivo Carvalho 29/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#if !defined (IPID_H)
|
||||
#define IPID_H
|
||||
|
||||
/** @file
|
||||
differential PID equation */
|
||||
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
//OBJECT_DLL(IPID)
|
||||
|
||||
/** differential PID equation */
|
||||
class IPID {
|
||||
|
||||
//OBJECT_DLL_STUFF(IPID)
|
||||
private:
|
||||
|
||||
float error;
|
||||
float old_error;
|
||||
float old_old_error;
|
||||
float Kp_constant;
|
||||
float Ki_constant;
|
||||
float Kd_constant;
|
||||
float T_constant;
|
||||
float P_realtime_constant;
|
||||
float I_realtime_constant;
|
||||
float D_realtime_constant;
|
||||
float upper_limit;
|
||||
float lower_limit;
|
||||
float old_output;
|
||||
float old_PV;
|
||||
float old_old_PV;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
bool LoadOldOutputWithinLimits(float old_output_to_load);
|
||||
|
||||
float GetUpperLimit(){
|
||||
return (this->upper_limit);
|
||||
}
|
||||
|
||||
float GetLowerLimit(){
|
||||
return (this->lower_limit);
|
||||
}
|
||||
|
||||
float GetOldOutput(){
|
||||
return (this->old_output);
|
||||
}
|
||||
|
||||
float GetRealtimeConstantP(){
|
||||
return (this->P_realtime_constant);
|
||||
}
|
||||
|
||||
float GetRealtimeConstantI(){
|
||||
return (this->I_realtime_constant);
|
||||
}
|
||||
|
||||
float GetRealtimeConstantD(){
|
||||
return (this->D_realtime_constant);
|
||||
}
|
||||
|
||||
float GetConstantKp(){
|
||||
return (this->Kp_constant);
|
||||
}
|
||||
|
||||
float GetConstantKi(){
|
||||
return (this->Ki_constant);
|
||||
}
|
||||
|
||||
float GetConstantKd(){
|
||||
return (this->Kd_constant);
|
||||
}
|
||||
|
||||
float GetConstantT(){
|
||||
return (this->T_constant);
|
||||
}
|
||||
|
||||
float GetError(){
|
||||
return (this->error);
|
||||
}
|
||||
|
||||
float GetOldProcessVariable(){
|
||||
return this->old_PV;
|
||||
}
|
||||
|
||||
float GetOldOldProcessVariable(){
|
||||
return this->old_old_PV;
|
||||
}
|
||||
|
||||
float GetOldError(){
|
||||
return (this->old_error);
|
||||
}
|
||||
|
||||
float GetOldOldError(){
|
||||
return (this->old_old_error);
|
||||
}
|
||||
|
||||
IPID (float set_Kp_constant, float set_Ki_constant, float set_Kd_constant, float set_T_constant, float set_upper_limit, float set_lower_limit);
|
||||
|
||||
IPID (float set_P_realtime_constant, float set_I_realtime_constant, float set_D_realtime_constant, float set_upper_limit, float set_lower_limit);
|
||||
|
||||
bool SetPIDConstants(float set_Kp_constant, float set_Ki_constant, float set_Kd_constant, float set_T_constant);
|
||||
|
||||
bool SetRealtimePIDConstants(float set_P_realtime_constant, float set_I_realtime_constant, float set_D_realtime_constant);
|
||||
|
||||
bool SetLimits(float set_upper_limit, float set_lower_limit);
|
||||
|
||||
float CalculatePID(float process_variable, float setpoint);
|
||||
|
||||
float CalculatePI(float process_variable, float setpoint);
|
||||
|
||||
float CalculateP(float process_variable, float setpoint);
|
||||
|
||||
float CalculatePID_types(float process_variable, float setpoint, float type);
|
||||
|
||||
float ReturnErrorInPercentage(float process_variable, float setpoint);
|
||||
|
||||
~IPID();
|
||||
|
||||
private:
|
||||
|
||||
bool SortWaveform();
|
||||
bool RemoveRepeatedValues();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
148
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IPID_hibd.h
Normal file
148
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IPID_hibd.h
Normal file
@@ -0,0 +1,148 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IPID.cpp - differential PID equation - type C - out(n) = out(n-1) - Kp[PV(n)-PV(n-1)] + Ki*T*e(n) - (Kd/T)*[PV(n) - 2PV(n-1) + PV(n-2)]
|
||||
// Ivo Carvalho 29/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#if !defined (IPID_H)
|
||||
#define IPID_H
|
||||
|
||||
/** @file
|
||||
differential PID equation */
|
||||
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
//OBJECT_DLL(IPID)
|
||||
|
||||
/** differential PID equation */
|
||||
class IPID {
|
||||
|
||||
//OBJECT_DLL_STUFF(IPID)
|
||||
private:
|
||||
|
||||
float error;
|
||||
float old_error;
|
||||
float old_old_error;
|
||||
float Kp_constant;
|
||||
float Ki_constant;
|
||||
float Kd_constant;
|
||||
float T_constant;
|
||||
float P_realtime_constant;
|
||||
float I_realtime_constant;
|
||||
float D_realtime_constant;
|
||||
float upper_limit;
|
||||
float lower_limit;
|
||||
float old_output;
|
||||
float old_PV;
|
||||
float old_old_PV;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
bool LoadOldOutputWithinLimits(float old_output_to_load);
|
||||
|
||||
float GetUpperLimit(){
|
||||
return (this->upper_limit);
|
||||
}
|
||||
|
||||
float GetLowerLimit(){
|
||||
return (this->lower_limit);
|
||||
}
|
||||
|
||||
float GetOldOutput(){
|
||||
return (this->old_output);
|
||||
}
|
||||
|
||||
float GetRealtimeConstantP(){
|
||||
return (this->P_realtime_constant);
|
||||
}
|
||||
|
||||
float GetRealtimeConstantI(){
|
||||
return (this->I_realtime_constant);
|
||||
}
|
||||
|
||||
float GetRealtimeConstantD(){
|
||||
return (this->D_realtime_constant);
|
||||
}
|
||||
|
||||
float GetConstantKp(){
|
||||
return (this->Kp_constant);
|
||||
}
|
||||
|
||||
float GetConstantKi(){
|
||||
return (this->Ki_constant);
|
||||
}
|
||||
|
||||
float GetConstantKd(){
|
||||
return (this->Kd_constant);
|
||||
}
|
||||
|
||||
float GetConstantT(){
|
||||
return (this->T_constant);
|
||||
}
|
||||
|
||||
float GetError(){
|
||||
return (this->error);
|
||||
}
|
||||
|
||||
float GetOldProcessVariable(){
|
||||
return this->old_PV;
|
||||
}
|
||||
|
||||
float GetOldOldProcessVariable(){
|
||||
return this->old_old_PV;
|
||||
}
|
||||
|
||||
float GetOldError(){
|
||||
return (this->old_error);
|
||||
}
|
||||
|
||||
float GetOldOldError(){
|
||||
return (this->old_old_error);
|
||||
}
|
||||
|
||||
IPID (float set_Kp_constant, float set_Ki_constant, float set_Kd_constant, float set_T_constant, float set_upper_limit, float set_lower_limit);
|
||||
|
||||
IPID (float set_P_realtime_constant, float set_I_realtime_constant, float set_D_realtime_constant, float set_upper_limit, float set_lower_limit);
|
||||
|
||||
bool SetPIDConstants(float set_Kp_constant, float set_Ki_constant, float set_Kd_constant, float set_T_constant);
|
||||
|
||||
bool SetRealtimePIDConstants(float set_P_realtime_constant, float set_I_realtime_constant, float set_D_realtime_constant);
|
||||
|
||||
bool SetLimits(float set_upper_limit, float set_lower_limit);
|
||||
|
||||
float CalculatePID(float process_variable, float setpoint);
|
||||
|
||||
float CalculatePI(float process_variable, float setpoint);
|
||||
|
||||
float CalculateP(float process_variable, float setpoint);
|
||||
|
||||
float CalculatePID_types(float process_variable, float setpoint, float type);
|
||||
|
||||
float ReturnErrorInPercentage(float process_variable, float setpoint);
|
||||
|
||||
~IPID();
|
||||
|
||||
private:
|
||||
|
||||
bool SortWaveform();
|
||||
bool RemoveRepeatedValues();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
172
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IWaveform.cpp
Normal file
172
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/IWaveform.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IWaveform.cpp - waveform container able to perform basic waveform operations
|
||||
// Ivo Carvalho 27/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
|
||||
#include "IWaveform.h"
|
||||
|
||||
//OBJECTLOADREGISTER(IWaveform,"$Id: IWaveform.cpp,v 1.0 27/4/2011 14:22:36 ivoc Exp $")
|
||||
|
||||
IWaveform::IWaveform(float * received_index_vector,float * received_data_vector, int NumberOfPoints){
|
||||
|
||||
if( NumberOfPoints >1) {
|
||||
number_of_points = NumberOfPoints;
|
||||
index_vector = new float[NumberOfPoints];
|
||||
data_vector = new float[NumberOfPoints];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < NumberOfPoints ; i++ ){
|
||||
index_vector[i] = *(received_index_vector+i);
|
||||
data_vector[i] = *(received_data_vector+i);
|
||||
}
|
||||
this->SortWaveform();
|
||||
this->RemoveRepeatedValues();
|
||||
}
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
IWaveform::~IWaveform(){
|
||||
|
||||
if(this->index_vector != NULL) delete this->index_vector;
|
||||
if(this->data_vector != NULL) delete this->data_vector;
|
||||
}
|
||||
|
||||
float IWaveform::GetWaveformValue(float index_to_search){
|
||||
|
||||
if (this->number_of_points == 0) return 0.;
|
||||
if (this->number_of_points == 1 && index_to_search == this->index_vector[0]) return this->data_vector[0];
|
||||
//if out of bounds
|
||||
if (this->index_vector[0] > index_to_search || this->index_vector[this->number_of_points-1] < index_to_search) return this->OutsideValueDefaultOutput;
|
||||
// search algorithm based on a regular SAR ADC model - bisection routine - numerical receips in C chapter 3.4
|
||||
this->jl = 0;
|
||||
this->ju = this->number_of_points-1;
|
||||
while (ju-jl > 1){
|
||||
this->jm = (this->ju+this->jl) >> 1; //(shift 1 bit to the left same as divide by 2 and then cast to int)
|
||||
if (index_to_search >= this->index_vector[jm]) this->jl = this->jm;
|
||||
else this->ju = this->jm;
|
||||
}// return linear interpolation between the upper and the lower point
|
||||
return (this->data_vector[jl] + (this->data_vector[jl+1] - this->data_vector[jl])*(index_to_search - this->index_vector[jl])/(this->index_vector[jl+1] - this->index_vector[jl]));
|
||||
}
|
||||
|
||||
bool IWaveform::SaveWaveform(float * received_index_vector,float * received_data_vector, int NumberOfPoints){
|
||||
|
||||
if (NumberOfPoints != number_of_points) {
|
||||
|
||||
index_vector = new float[NumberOfPoints];
|
||||
data_vector = new float[NumberOfPoints];
|
||||
number_of_points = NumberOfPoints;
|
||||
}
|
||||
if (NumberOfPoints < 2) return False;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < NumberOfPoints ; i++ ){
|
||||
index_vector[i] = *(received_index_vector+i);
|
||||
data_vector[i] = *(received_data_vector+i);
|
||||
}
|
||||
|
||||
if(this->SortWaveform()) return (this->RemoveRepeatedValues());
|
||||
}
|
||||
|
||||
float IWaveform::GetFirstIndex(){
|
||||
|
||||
if (this->number_of_points > 0){
|
||||
return index_vector[0];
|
||||
}
|
||||
else return (float)NULL;
|
||||
}
|
||||
|
||||
float IWaveform::GetLastIndex(){
|
||||
|
||||
if (this->number_of_points > 0){
|
||||
return index_vector[number_of_points-1];
|
||||
}
|
||||
else return (float)NULL;
|
||||
}
|
||||
|
||||
/* not done yet
|
||||
bool WaveformGAM::AddPoint(float point_index, float point_data){
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool WaveformGAM::RemovePoint(int index_to_remove){
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool WaveformGAM::GetIndexVector(float &recived_index_vector){
|
||||
|
||||
}
|
||||
|
||||
bool WaveformGAM::GetDataVector(float &received_data_vector){
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
bool IWaveform::DefineOutsideValueDefaultValue(float outside_value_default_output){
|
||||
|
||||
this->OutsideValueDefaultOutput = outside_value_default_output;
|
||||
}
|
||||
|
||||
bool IWaveform::RemoveRepeatedValues(){
|
||||
|
||||
if (this->number_of_points < 1) return False;
|
||||
if (this->number_of_points == 1) return True;
|
||||
|
||||
int i = 0;
|
||||
int alfa;
|
||||
|
||||
for (alfa = 0; alfa < this->number_of_points-1; alfa++){
|
||||
|
||||
if ( this->index_vector[alfa] == this->index_vector[alfa+1]){
|
||||
|
||||
for (i = alfa; i < this->number_of_points-2; i++){
|
||||
this->index_vector[i+1] = this->index_vector[i+2];
|
||||
this->data_vector[i+1] = this->data_vector[i+2];
|
||||
}
|
||||
alfa--;
|
||||
this->number_of_points--;
|
||||
}
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool IWaveform::SortWaveform(){
|
||||
|
||||
if (this->number_of_points < 1) return False;
|
||||
if (this->number_of_points == 1) return True;
|
||||
|
||||
int i;
|
||||
int alfa;
|
||||
float temp;
|
||||
float min = this->index_vector[0];
|
||||
int pos;
|
||||
|
||||
for(alfa = 0; alfa < this->number_of_points-1; alfa++){
|
||||
pos = alfa;
|
||||
min = this->index_vector[alfa];
|
||||
|
||||
for (i = alfa;i < this->number_of_points; i++){
|
||||
if ( this->index_vector[i] <= min){
|
||||
pos = i;
|
||||
min = this->index_vector[i];
|
||||
}
|
||||
}
|
||||
|
||||
temp = this->index_vector[alfa];
|
||||
this->index_vector[alfa] = this->index_vector[pos];
|
||||
this->index_vector[pos] = temp;
|
||||
temp = this->data_vector[alfa];
|
||||
this->data_vector[alfa] = this->data_vector[pos];
|
||||
this->data_vector[pos] = temp;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IWaveform.cpp - waveform container able to perform basic waveform operations
|
||||
// Ivo Carvalho 27/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#if !defined (IWAVEFORM_H)
|
||||
#define IWAVEFORM_H
|
||||
|
||||
/** @file
|
||||
waveform container able to perform basic waveform operations */
|
||||
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
//OBJECT_DLL(IWaveform)
|
||||
|
||||
/** waveform container able to perform basic waveform operations */
|
||||
class IWaveform {
|
||||
|
||||
//OBJECT_DLL_STUFF(IWaveform)
|
||||
private:
|
||||
|
||||
int number_of_points;
|
||||
float *index_vector;
|
||||
float *data_vector;
|
||||
float OutsideValueDefaultOutput;
|
||||
int jl;
|
||||
int ju;
|
||||
int jm;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
float GetWaveformValue(float index_to_search);
|
||||
|
||||
bool SaveWaveform(float * received_index_vector,float * received_data_vector, int NumberOfPoints);
|
||||
|
||||
// bool AddPoint(float point_index, float point_data);
|
||||
|
||||
// bool RemovePoint(int index_to_remove);
|
||||
|
||||
// bool GetIndexVector(float &recived_index_vector);
|
||||
|
||||
// bool GetDataVector(float &received_data_vector);
|
||||
|
||||
int GetSize(){
|
||||
return number_of_points;
|
||||
}
|
||||
|
||||
float GetFirstIndex();
|
||||
|
||||
float GetLastIndex();
|
||||
|
||||
bool DefineOutsideValueDefaultValue(float outside_value_default_output);
|
||||
|
||||
IWaveform (float * received_index_vector,float * received_data_vector, int NumberOfPoints);
|
||||
|
||||
~IWaveform();
|
||||
|
||||
private:
|
||||
|
||||
bool SortWaveform();
|
||||
bool RemoveRepeatedValues();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IntegerSequentialControl.cpp - waveform container able to perform basic waveform operations
|
||||
// Ivo Carvalho 27/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
|
||||
#include "IntegerSequentialControl.h"
|
||||
|
||||
//OBJECTLOADREGISTER(IntegerSequentialControl,"$Id: IntegerSequentialControl.cpp,v 1.0 27/4/2011 14:22:36 ivoc Exp $")
|
||||
|
||||
IntegerSequentialControl::IntegerSequentialControl(int * received_index_vector,int * received_data_vector, int NumberOfPoints){
|
||||
|
||||
if( NumberOfPoints >=1) {
|
||||
number_of_points = NumberOfPoints;
|
||||
index_vector = new int[NumberOfPoints];
|
||||
data_vector = new int[NumberOfPoints];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < NumberOfPoints ; i++ ){
|
||||
index_vector[i] = *(received_index_vector+i);
|
||||
data_vector[i] = *(received_data_vector+i);
|
||||
}
|
||||
this->SortWaveform();
|
||||
this->RemoveRepeatedValues();
|
||||
}
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
IntegerSequentialControl::~IntegerSequentialControl(){
|
||||
|
||||
// if(this->index_vector != NULL) delete this->index_vector;
|
||||
// if(this->data_vector != NULL) delete this->data_vector;
|
||||
}
|
||||
|
||||
int IntegerSequentialControl::GetWaveformValue(int index_to_search){
|
||||
|
||||
if (this->number_of_points == 0) return 0;
|
||||
if (this->number_of_points == 1 && index_to_search >= this->index_vector[0]) return this->data_vector[0];
|
||||
//if out of bounds
|
||||
if (this->index_vector[0] > index_to_search ) return this->OutsideValueDefaultOutput;
|
||||
if( this->index_vector[this->number_of_points-1] <= index_to_search) return this->data_vector[this->number_of_points-1];
|
||||
// search algorithm based on a regular SAR ADC model - bisection routine - numerical receips in C chapter 3.4
|
||||
this->jl = 0;
|
||||
this->ju = this->number_of_points-1;
|
||||
while (ju-jl > 1){
|
||||
this->jm = (this->ju+this->jl) >> 1; //(shift 1 bit to the left same as divide by 2 and then cast to int)
|
||||
if (index_to_search >= this->index_vector[jm]) this->jl = this->jm;
|
||||
else this->ju = this->jm;
|
||||
}// return linear interpolation between the upper and the lower point
|
||||
|
||||
// CStaticAssertErrorCondition(InitialisationError,"jl = %d",jl);
|
||||
return (this->data_vector[jl]);
|
||||
}
|
||||
|
||||
bool IntegerSequentialControl::SaveWaveform(int * received_index_vector,int * received_data_vector, int NumberOfPoints){
|
||||
|
||||
if (NumberOfPoints != number_of_points) {
|
||||
|
||||
index_vector = new int[NumberOfPoints];
|
||||
data_vector = new int[NumberOfPoints];
|
||||
number_of_points = NumberOfPoints;
|
||||
}
|
||||
if (NumberOfPoints < 1) return False;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < NumberOfPoints ; i++ ){
|
||||
index_vector[i] = *(received_index_vector+i);
|
||||
data_vector[i] = *(received_data_vector+i);
|
||||
}
|
||||
|
||||
if(this->SortWaveform()) return (this->RemoveRepeatedValues());
|
||||
}
|
||||
|
||||
int IntegerSequentialControl::GetFirstIndex(){
|
||||
|
||||
if (this->number_of_points > 0){
|
||||
return index_vector[0];
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
int IntegerSequentialControl::GetLastIndex(){
|
||||
|
||||
if (this->number_of_points > 0){
|
||||
return index_vector[number_of_points-1];
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/* not done yet
|
||||
bool WaveformGAM::AddPoint(float point_index, float point_data){
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool WaveformGAM::RemovePoint(int index_to_remove){
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool WaveformGAM::GetDataVector(float &received_data_vector){
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
bool IntegerSequentialControl::DefineDefaultValue(int outside_value_default_output){
|
||||
|
||||
this->OutsideValueDefaultOutput = outside_value_default_output;
|
||||
}
|
||||
|
||||
bool IntegerSequentialControl::RemoveRepeatedValues(){
|
||||
|
||||
if (this->number_of_points < 1) return False;
|
||||
if (this->number_of_points == 1) return True;
|
||||
|
||||
int i = 0;
|
||||
int alfa;
|
||||
|
||||
for (alfa = 0; alfa < this->number_of_points-1; alfa++){
|
||||
|
||||
if ( this->index_vector[alfa] == this->index_vector[alfa+1]){
|
||||
|
||||
for (i = alfa; i < this->number_of_points-2; i++){
|
||||
this->index_vector[i+1] = this->index_vector[i+2];
|
||||
this->data_vector[i+1] = this->data_vector[i+2];
|
||||
}
|
||||
alfa--;
|
||||
this->number_of_points--;
|
||||
}
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
bool IntegerSequentialControl::SortWaveform(){
|
||||
|
||||
if (this->number_of_points < 1) return False;
|
||||
if (this->number_of_points == 1) return True;
|
||||
|
||||
int i;
|
||||
int alfa;
|
||||
int temp;
|
||||
int min = this->index_vector[0];
|
||||
int pos;
|
||||
|
||||
for(alfa = 0; alfa < this->number_of_points-1; alfa++){
|
||||
pos = alfa;
|
||||
min = this->index_vector[alfa];
|
||||
|
||||
for (i = alfa;i < this->number_of_points; i++){
|
||||
if ( this->index_vector[i] <= min){
|
||||
pos = i;
|
||||
min = this->index_vector[i];
|
||||
}
|
||||
}
|
||||
|
||||
temp = this->index_vector[alfa];
|
||||
this->index_vector[alfa] = this->index_vector[pos];
|
||||
this->index_vector[pos] = temp;
|
||||
temp = this->data_vector[alfa];
|
||||
this->data_vector[alfa] = this->data_vector[pos];
|
||||
this->data_vector[pos] = temp;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
//******************************************************************************
|
||||
//
|
||||
// IntegerSequentialControl.cpp - waveform container able to perform basic waveform operations
|
||||
// Ivo Carvalho 27/4/2011
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#if !defined (INTEGERSEQUENTIALCONTROL_H)
|
||||
#define INTEGERSEQUENTIALCONTROL_H
|
||||
|
||||
/** @file
|
||||
waveform container able to perform basic waveform operations */
|
||||
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
//OBJECT_DLL(IntegerSequentialControl)
|
||||
|
||||
/** waveform container able to perform basic waveform operations */
|
||||
class IntegerSequentialControl {
|
||||
|
||||
//OBJECT_DLL_STUFF(IntegerSequentialControl)
|
||||
private:
|
||||
|
||||
int number_of_points;
|
||||
int *index_vector;
|
||||
int *data_vector;
|
||||
int OutsideValueDefaultOutput;
|
||||
|
||||
int ju;
|
||||
int jl;
|
||||
int jm;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
int GetWaveformValue(int index_to_search);
|
||||
|
||||
bool SaveWaveform(int * received_index_vector,int * received_data_vector, int NumberOfPoints);
|
||||
|
||||
// bool AddPoint(float point_index, float point_data);
|
||||
|
||||
// bool RemovePoint(int index_to_remove);
|
||||
|
||||
int GetSize(){
|
||||
return number_of_points;
|
||||
}
|
||||
|
||||
int GetFirstIndex();
|
||||
|
||||
int GetLastIndex();
|
||||
|
||||
bool DefineDefaultValue(int outside_value_default_output);
|
||||
|
||||
IntegerSequentialControl (int * received_index_vector,int * received_data_vector, int NumberOfPoints);
|
||||
|
||||
~IntegerSequentialControl();
|
||||
|
||||
private:
|
||||
|
||||
bool SortWaveform();
|
||||
bool RemoveRepeatedValues();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
#include "InterferometryGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(InterferometryGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
InterferometryGAM::InterferometryGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
InterferometryGAM::~InterferometryGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool InterferometryGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadInt32(i, "interferometry_radial_control_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainConfigurator::ReadConfigurationFile: %s interferometry_radial_control_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
interferometry_radial_control_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"MainConfigurator::ReadConfigurationFile: interferometry_radial_control_bool = %d",interferometry_radial_control_bool);
|
||||
}
|
||||
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "SineProbeGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "InterferometryGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "SineProbeGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "InterferometryGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"InterferometryGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_read = 4;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("interferometry_sine_signal");
|
||||
CDB_move_to[1].Printf("interferometry_cosine_signal");
|
||||
CDB_move_to[2].Printf("H_alpha");
|
||||
CDB_move_to[3].Printf("discharge_status");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"InterferometryGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"InterferometryGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"InterferometryGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"InterferometryGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 2;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("density");
|
||||
CDB_move_to[1].Printf("radial_position");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"InterferometryGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"InterferometryGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"InterferometryGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
constant_PI = 2*acos(0.);
|
||||
constant_phase_to_density = -8e17;
|
||||
minimum_density_for_centred_plasma = 2e18;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool InterferometryGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"InterferometryGAM:: %s inputstruct = %f %f %d",this->Name(), inputstruct[0].ADC_interferometry_sine, inputstruct[0].ADC_interferometry_cosine, inputstruct[0].DischargeStatus);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
float interf;
|
||||
float delta;
|
||||
float ha;
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
if(inputstruct[0].DischargeStatus == -2){
|
||||
outputstruct[0].InterferometryDensity = 0;
|
||||
outputstruct[0].InterferometryR = 0;
|
||||
i=0;
|
||||
old_phase = 0;
|
||||
}
|
||||
if(inputstruct[0].DischargeStatus == -1){
|
||||
i++;
|
||||
offset_sine = (offset_sine * (i-1)/(i) + ((float) inputstruct[0].ADC_interferometry_sine)/(i) );
|
||||
offset_cosine = (offset_cosine * (i-1)/(i) + ((float) inputstruct[0].ADC_interferometry_cosine)/(i) );
|
||||
old_phase = 0;
|
||||
}
|
||||
if(inputstruct[0].DischargeStatus >= 0){
|
||||
sine = (float) inputstruct[0].ADC_interferometry_sine;
|
||||
cosine = (float) inputstruct[0].ADC_interferometry_cosine;
|
||||
InterferencePhase = atan2(sine,cosine);
|
||||
InterferenceAmplitude=sqrt(cosine*cosine+sine*sine);
|
||||
HAmplitude=(float)inputstruct[0].HAlpha;
|
||||
PhaseShift=2*acos(InterferenceAmplitude/(2*HAmplitude));
|
||||
outputstruct[0].InterferometryDensity = InterferencePhase-PhaseShift;
|
||||
}
|
||||
|
||||
if (interferometry_radial_control_bool){
|
||||
if (outputstruct[0].InterferometryDensity > minimum_density_for_centred_plasma) outputstruct[0].InterferometryR = outputstruct[0].InterferometryDensity;
|
||||
else outputstruct[0].InterferometryR = 0;
|
||||
}
|
||||
else outputstruct[0].InterferometryR = 0;
|
||||
|
||||
}
|
||||
|
||||
// outputstruct[0].InterferometryDensity = (float) inputstruct[0].ADC_interferometry_sine;
|
||||
// AssertErrorCondition(InitialisationError,"InterferometryGAM:: %s outputstruct = %f %f",this->Name(), outputstruct[0].InterferometryDensity, outputstruct[0].InterferometryR);
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool InterferometryGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>interferometry_radial_control_bool = %d\n\
|
||||
<br><br", interferometry_radial_control_bool);
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
#ifndef _INTERFEROMETRYGAM_H
|
||||
#define _INTERFEROMETRYGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
#include <math.h>
|
||||
|
||||
OBJECT_DLL(InterferometryGAM)
|
||||
|
||||
|
||||
class InterferometryGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_interferometry_sine;
|
||||
float ADC_interferometry_cosine;
|
||||
float HAlpha;
|
||||
int32 DischargeStatus;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float InterferometryDensity;
|
||||
float InterferometryR;
|
||||
};
|
||||
|
||||
float offset_sine;
|
||||
float offset_cosine;
|
||||
float old_offset_sine;
|
||||
float old_offset_cosine;
|
||||
float corrected_sine;
|
||||
float corrected_cosine;
|
||||
float old_phase;
|
||||
float minimum_density_for_centred_plasma;
|
||||
float constant_phase_to_density;
|
||||
float constant_PI;
|
||||
|
||||
float phase;
|
||||
|
||||
bool interferometry_radial_control_bool;
|
||||
|
||||
|
||||
float sine;
|
||||
float cosine;
|
||||
float InterferencePhase;
|
||||
float InterferenceAmplitude;
|
||||
float HAmplitude;
|
||||
float PhaseShift;
|
||||
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
InterferometryGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~InterferometryGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(InterferometryGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,276 @@
|
||||
|
||||
#include "MachineProtectionGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(MachineProtectionGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
MachineProtectionGAM::MachineProtectionGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
MachineProtectionGAM::~MachineProtectionGAM()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool MachineProtectionGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadFloat(iron_core_saturation_value, "iron_core_saturation_value"))
|
||||
{
|
||||
CStaticAssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s iron_core_saturation_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else CStaticAssertErrorCondition(Information,"MachineProtectionGAM::Initialise: iron_core_saturation_value = %f",iron_core_saturation_value);
|
||||
if(!cdb.ReadFloat(iron_core_dangerous_value, "iron_core_dangerous_value"))
|
||||
{
|
||||
CStaticAssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s iron_core_dangerous_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else CStaticAssertErrorCondition(Information,"MachineProtectionGAM::Initialise: iron_core_dangerous_value = %f",iron_core_dangerous_value);
|
||||
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "MachineProtectionGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MachineProtectionGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "MachineProtectionGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MachineProtectionGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 12;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("plasma_current");
|
||||
CDB_move_to[1].Printf("horizontal_current");
|
||||
CDB_move_to[2].Printf("vertical_current");
|
||||
CDB_move_to[3].Printf("primary_current");
|
||||
CDB_move_to[4].Printf("iron_core_saturation");
|
||||
CDB_move_to[5].Printf("v_loop");
|
||||
CDB_move_to[6].Printf("density");
|
||||
CDB_move_to[7].Printf("h_alpha");
|
||||
CDB_move_to[8].Printf("time");
|
||||
CDB_move_to[9].Printf("soft_stop_primary");
|
||||
CDB_move_to[10].Printf("soft_stop_vertical");
|
||||
CDB_move_to[11].Printf("soft_stop_horizontal");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"MachineProtectionGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 3;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("saturated_bool");
|
||||
CDB_move_to[1].Printf("slow_stop");
|
||||
CDB_move_to[2].Printf("hard_stop");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"MachineProtectionGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
calculated_saturation_value = 0;
|
||||
assert_number_of_samples_in_saturation_1 = 0;
|
||||
assert_number_of_samples_in_saturation_2 = 0;
|
||||
|
||||
// number os samples necessary to assert InSaturation
|
||||
assert_saturation_limit1 = 6;
|
||||
assert_saturation_limit2 = 6;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool MachineProtectionGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"MachineProtectionGAM:: %s inputstruct = %d %d %d %d %d %f %f %f %f %f %f %f %f ",this->Name(), inputstruct[0].usecTime, inputstruct[0].SoftStopPrimaryPS, inputstruct[0].SoftStopVerticalPS, inputstruct[0].SoftStopHorizontalPS, inputstruct[0].SoftStopPuffing, inputstruct[0].PlasmaCurrent, inputstruct[0].HorizontalCurrent, inputstruct[0].VerticalCurrent, inputstruct[0].PrimaryCurrent, inputstruct[0].IronCoreSaturation, inputstruct[0].VLoop, inputstruct[0].Density, inputstruct[0].HAlfa);
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
//place to insert additional protections
|
||||
inputstruct[0].PlasmaCurrent;
|
||||
inputstruct[0].PrimaryCurrent;
|
||||
inputstruct[0].IronCoreSaturation;
|
||||
|
||||
//if |Iprim| > 25
|
||||
if (inputstruct[0].PrimaryCurrent * inputstruct[0].PrimaryCurrent > 625){
|
||||
// second methode for iron core saturation predictor, calculated_saturation_value = 28 * 28 * (Iprim * Iprim) / (Ip * Ip + 280 * 280), good threshold = 1.25
|
||||
calculated_saturation_value = 784 * inputstruct[0].PrimaryCurrent * inputstruct[0].PrimaryCurrent / (inputstruct[0].PlasmaCurrent * inputstruct[0].PlasmaCurrent + 280 * 280);
|
||||
}
|
||||
else calculated_saturation_value = 0;
|
||||
|
||||
if ( inputstruct[0].IronCoreSaturation > iron_core_dangerous_value) {
|
||||
assert_number_of_samples_in_saturation_1++ ; // HALVES
|
||||
// AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Execute: Consecutive Saturated1 cycles %d/6",assert_number_of_samples_in_saturation_1);
|
||||
}
|
||||
else assert_number_of_samples_in_saturation_1 = 0;
|
||||
|
||||
if ( calculated_saturation_value > iron_core_saturation_value) {
|
||||
assert_number_of_samples_in_saturation_2++;
|
||||
// AssertErrorCondition(InitialisationError,"MachineProtectionGAM::Execute: Consecutive Saturated2 cycles %d/6",assert_number_of_samples_in_saturation_2);
|
||||
}
|
||||
else assert_number_of_samples_in_saturation_2 = 0;
|
||||
|
||||
if ( assert_number_of_samples_in_saturation_1 > assert_saturation_limit1 || assert_number_of_samples_in_saturation_2 > assert_saturation_limit2) outputstruct[0].InSaturation = 1;
|
||||
else outputstruct[0].InSaturation = 0;
|
||||
|
||||
outputstruct[0].HardStopBool = False;
|
||||
outputstruct[0].SlowStopBool = False;
|
||||
|
||||
}
|
||||
else {
|
||||
outputstruct[0].InSaturation = 0;
|
||||
outputstruct[0].HardStopBool = False;
|
||||
outputstruct[0].SlowStopBool = False;
|
||||
}
|
||||
|
||||
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool MachineProtectionGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br>iron_core_saturation_value = %.2f\n\
|
||||
<br>iron_core_dangerous_value = %.2f\n\
|
||||
<br><br",iron_core_saturation_value,iron_core_dangerous_value);
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* File: LookupTable.h
|
||||
* Author: ivoc, ipfn
|
||||
*
|
||||
* Created on August 26, 2010
|
||||
* last modified on August 26, 2010
|
||||
* version: 0.1
|
||||
*/
|
||||
|
||||
#ifndef _MACHINEPROTECTIONGAM_H
|
||||
#define _MACHINEPROTECTIONGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(MachineProtectionGAM)
|
||||
|
||||
|
||||
class MachineProtectionGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float PlasmaCurrent;
|
||||
float HorizontalCurrent;
|
||||
float VerticalCurrent;
|
||||
float PrimaryCurrent;
|
||||
float IronCoreSaturation;
|
||||
float VLoop;
|
||||
float Density;
|
||||
float HAlfa;
|
||||
int32 usecTime;
|
||||
int32 SoftStopPrimaryPS;
|
||||
int32 SoftStopVerticalPS;
|
||||
int32 SoftStopHorizontalPS;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
int32 InSaturation;
|
||||
int32 SlowStopBool;
|
||||
int32 HardStopBool;
|
||||
};
|
||||
|
||||
float calculated_saturation_value;
|
||||
float iron_core_saturation_value;
|
||||
float iron_core_dangerous_value;
|
||||
|
||||
float integration_accumulator;
|
||||
|
||||
int assert_saturation_limit1;
|
||||
int assert_saturation_limit2;
|
||||
int assert_number_of_samples_in_saturation_1;
|
||||
int assert_number_of_samples_in_saturation_2;
|
||||
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
MachineProtectionGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~MachineProtectionGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(MachineProtectionGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _LOOKUPTABLE_H */
|
||||
|
||||
@@ -0,0 +1,748 @@
|
||||
|
||||
#include "MagneticsGAM.h"
|
||||
#include "math.h"
|
||||
|
||||
OBJECTLOADREGISTER(MagneticsGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
MagneticsGAM::MagneticsGAM() {
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
MagneticsGAM::~MagneticsGAM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool MagneticsGAM::Initialise(ConfigurationDataBase& cdbData) {
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i,j;
|
||||
|
||||
// read config file section: magnetic_probes
|
||||
if (!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s usectime_to_wait_for_starting_operation", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "MagneticsGAM::Initialise: usectime_to_wait_for_starting_operation = %d", usectime_to_wait_for_starting_operation);
|
||||
if (!cdb.ReadInt32(i, "magnetic_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s magnetic_radial_bool", this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
magnetic_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information, "MagneticsGAM::Initialise: magnetic_radial_bool = %d", magnetic_radial_bool);
|
||||
}
|
||||
if (!cdb.ReadInt32(i, "magnetic_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s magnetic_vertical_bool", this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
magnetic_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information, "MagneticsGAM::Initialise: magnetic_vertical_bool = %d", magnetic_vertical_bool);
|
||||
}
|
||||
if (!cdb.ReadInt32(i, "magnetic_module_correction_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s magnetic_module_correction_bool", this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
magnetic_module_correction_bool = (bool)i;
|
||||
AssertErrorCondition(Information, "MagneticsGAM::Initialise: = %d", magnetic_module_correction_bool);
|
||||
}
|
||||
|
||||
|
||||
if (!cdb->Move("MirnovArrayDescription"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+magnetic_probes.MirnovArrayDescription\"", this->Name());
|
||||
return False;
|
||||
}
|
||||
if (!cdb.ReadInt32(NumberOfProbes, "NumberOfProbes"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfProbes", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "MagneticsGAM::Initialise: NumberOfProbes = %d", NumberOfProbes);
|
||||
|
||||
if (NumberOfProbes > 0) {
|
||||
magnetic_Angles = new float[NumberOfProbes];
|
||||
magnetic_Calibration = new float[NumberOfProbes];
|
||||
|
||||
if (!cdb.ReadFloatArray(magnetic_Angles, (int *)(&NumberOfProbes), 1, "Angles"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ReadWaveformFiles: Could not read magnetic_Angles");
|
||||
return False;
|
||||
}
|
||||
else for (i = 0; i<NumberOfProbes; i++) AssertErrorCondition(Information, "MagneticsGAM::Initialise: magnetic_Angles[%d] = %f", i, magnetic_Angles[i]);
|
||||
if (!cdb.ReadFloatArray(magnetic_Calibration, (int *)(&NumberOfProbes), 1, "Calibration"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ReadWaveformFiles: Could not read magnetic_Calibration");
|
||||
return False;
|
||||
}
|
||||
else for (i = 0; i<NumberOfProbes; i++) AssertErrorCondition(Information, "MagneticsGAM::Initialise: magnetic_Calibration[%d] = %f", i, magnetic_Calibration[i]);
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfProbes lower than 1", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if (!cdb->Move("Measurements"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+magnetic_probes.Measurements\"", this->Name());
|
||||
return False;
|
||||
}
|
||||
if (!cdb.ReadInt32(NumberOfMeasurements, "NumberOfMeasurements"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfMeasurements", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "MagneticsGAM::Initialise: NumberOfMeasurements = %d", NumberOfMeasurements);
|
||||
|
||||
if (NumberOfMeasurements > 0) {
|
||||
ProbeNumbers = new int[NumberOfMeasurements];
|
||||
|
||||
if (!cdb.ReadInt32Array(ProbeNumbers, (int *)(&NumberOfMeasurements), 1, "ProbeNumbers"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ReadWaveformFiles: Could not read ProbeNumbers");
|
||||
return False;
|
||||
}
|
||||
else for (i = 0; i<NumberOfMeasurements; i++) AssertErrorCondition(Information, "MagneticsGAM::Initialise: ProbeNumbers[%d] = %d", i, ProbeNumbers[i]);
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfMeasurements lower than 1", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
//Added for module offset correction
|
||||
if (!cdb->Move("ModuleOffsetCorrectionLSBusec"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+magnetic_probes.ModuleOffsetCorrectionLSBusec\"", this->Name());
|
||||
return False;
|
||||
}
|
||||
if (!cdb.ReadInt32(NumberOfModules, "NumberOfModules"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfModules", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "MagneticsGAM::Initialise: NumberOfModules = %d", NumberOfMeasurements);
|
||||
|
||||
if (NumberOfModules > 0) {
|
||||
magnetic_Offset_slope = new float[NumberOfModules];
|
||||
|
||||
if (!cdb.ReadFloatArray(magnetic_Offset_slope, (int *)(&NumberOfModules), 1, "OffsetCalibration"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ReadWaveformFiles: Could not OffsetCalibration");
|
||||
return False;
|
||||
}
|
||||
else for (i = 0; i<NumberOfModules; i++) AssertErrorCondition(Information, "MagneticsGAM::Initialise: magnetic_Offset_slope[%d] = %f", i, magnetic_Offset_slope[i]);
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfModules lower than 1", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
if (NumberOfModules > 0) {
|
||||
magnetic_Polarity_calibration = new float[NumberOfModules];
|
||||
|
||||
if (!cdb.ReadFloatArray(magnetic_Polarity_calibration, (int *)(&NumberOfModules), 1, "PolarityCalibration"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "ReadWaveformFiles: Could not read PolarityCalibration");
|
||||
return False;
|
||||
}
|
||||
else for (i = 0; i<NumberOfModules; i++) AssertErrorCondition(Information, "MagneticsGAM::Initialise: magnetic_Polarity_calibration[%d] = %f", i, magnetic_Polarity_calibration[i]);
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s NumberOfModules lower than 1", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// Create the signal interfaces
|
||||
if (!AddInputInterface(this->SignalsInputInterface, "MagneticsGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s failed to add the MagneticsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if (!AddOutputInterface(this->SignalsOutputInterface, "MagneticsGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s failed to add the MagneticsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if (!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"input_signals\"", this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 16;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
for (i = 0; i<number_of_signals_to_read - 1; i++) CDB_move_to[i].Printf("Channel_%d", i);
|
||||
CDB_move_to[number_of_signals_to_read - 1].Printf("time");
|
||||
for (i = 0; i<number_of_signals_to_read; i++) {
|
||||
|
||||
if (!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"%s\"", this->Name(), CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
if (cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if (cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information, "MagneticsGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if (!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if (!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"output_signals\"", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 3;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("magnetic_probes_r");
|
||||
CDB_move_to[1].Printf("magnetic_probes_z");
|
||||
CDB_move_to[2].Printf("magnetic_probes_plasma_current");
|
||||
for (i = 0; i<number_of_signals_to_read; i++) {
|
||||
|
||||
if (!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s Could not move to \"%s\"", this->Name(), CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if (cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if (cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information, "MagneticsGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if (!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MagneticsGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// Initialise the accumulators
|
||||
this->allmirnv_prim = new float[this->NumberOfProbes];
|
||||
this->allmirnv_hor = new float[this->NumberOfProbes];
|
||||
this->allmirnv_vert = new float[this->NumberOfProbes];
|
||||
this->ADC_values = new float[this->NumberOfProbes];
|
||||
this->corrected_probes = new float[this->NumberOfMeasurements];
|
||||
this->magnetic_Offset_zero = new float[this->NumberOfModules];
|
||||
for (i = 0; i < this->NumberOfProbes; i++) {
|
||||
this->ADC_values[i] = 0.0;
|
||||
this->corrected_probes[i] = 0.0;
|
||||
this->magnetic_Offset_zero[i] = 0.0;
|
||||
this->allmirnv_prim[i]=0.0;
|
||||
this->allmirnv_vert[i] = 0.0;
|
||||
this->allmirnv_hor[i] = 0.0;
|
||||
}
|
||||
magnetic_field_sum = 0.0;
|
||||
|
||||
//ACHTUNG ACHTUNG!!! 0.1 if 100us and 0.01 if 1000us
|
||||
// Correct Offsets factor - values Bits/ms -> bits/100us
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
this->magnetic_Offset_slope[i] = this->magnetic_Offset_slope[i] * 1;
|
||||
}
|
||||
|
||||
// Initialise the auxiliary probe position values [m]
|
||||
this->n_samples = 0;
|
||||
this->major_radius = 0.46;
|
||||
this->probe_radius = 0.0935;
|
||||
this->clip_limit = 0.085; // -clip_limit < output r and z position < +clip_limit
|
||||
|
||||
//Some constantants
|
||||
this->Area = 2.5e-5; //[m^2]
|
||||
this->Nvoltas = 50; //
|
||||
this->MAgPerm = 4*3.16159e-7; //[V*s/A*m]
|
||||
this->ADCconst = 10/((2^17)*2e6);
|
||||
this->Ncoils = 12;
|
||||
|
||||
//Inicilaizacao das bases de dados pra substrair fluxo magnetico que vem do vertical,horizontal e primario
|
||||
float primarydata[10] = { -200,-160,-120,-80,-40,0,40,80,120,160 };//[A]
|
||||
float horizontaldata[10] = { -70,-56,-42,-28,-14,0,14,28,42,56 };
|
||||
float verticaldata[10] = { -300,-240,-180,-120,-60,0,60,120,180,240 };
|
||||
// this ->primarydata= (float[10]) { -200,-160,-120,-80,-40,0,40,80,120,160 };//[A]
|
||||
// this ->horizontaldata =(float [10]) { -70,-56,-42,-28,-14,0,14,28,42,56 };
|
||||
// this ->verticaldata=(float[10]) { -300,-240,-180,-120,-60,0,60,120,180,240 };
|
||||
|
||||
this ->primarydata = new float [10];
|
||||
for(i=0; i<10;i++){
|
||||
this->primarydata[i] = primarydata[i];
|
||||
}
|
||||
|
||||
this ->horizontaldata = new float [10];
|
||||
for(i=0; i<10;i++){
|
||||
this->horizontaldata[i] = horizontaldata[i];
|
||||
}
|
||||
|
||||
this ->verticaldata = new float [10];
|
||||
for(i=0; i<10;i++){
|
||||
this->verticaldata[i] = verticaldata[i];
|
||||
}
|
||||
|
||||
this ->mirnprim= new float*[12];
|
||||
for(i=0; i<12;i++){
|
||||
this ->mirnprim[i]=new float[10];
|
||||
}
|
||||
|
||||
|
||||
this ->mirnhor= new float*[12];
|
||||
for(i=0; i<12;i++){
|
||||
this ->mirnhor[i]=new float[10];
|
||||
}
|
||||
|
||||
this ->mirnvert= new float*[12];
|
||||
for(i=0; i<12;i++){
|
||||
this ->mirnvert[i]=new float[10];
|
||||
}
|
||||
|
||||
|
||||
float mirnprim_buff[12][10]={
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 }};
|
||||
|
||||
|
||||
|
||||
float mirnhor_buff[12][10] ={
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 }};
|
||||
|
||||
float mirnvert_buff[12][10] ={
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0 }};
|
||||
|
||||
|
||||
|
||||
|
||||
for(i=0;i<12;i++){
|
||||
for(j=0;j<10;j++){
|
||||
|
||||
mirnprim[i][j]=mirnprim_buff[i][j];
|
||||
}}
|
||||
|
||||
for(i=0;i<12;i++){
|
||||
for(j=0;j<10;j++){
|
||||
|
||||
mirnhor[i][j]=mirnhor_buff[i][j];
|
||||
}}
|
||||
|
||||
for(i=0;i<12;i++){
|
||||
for(j=0;j<10;j++){
|
||||
|
||||
mirnvert[i][j]=mirnvert_buff[i][j];
|
||||
}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this->radial_coeficients = new float[this->NumberOfProbes];
|
||||
this->vertical_coeficients = new float[this->NumberOfProbes];
|
||||
for (i = 0; i < this->NumberOfProbes; i++) {
|
||||
|
||||
this->radial_coeficients[i] = this->probe_radius * cos(this->magnetic_Angles[i] * M_PI / 180);
|
||||
this->vertical_coeficients[i] = this->probe_radius * sin(this->magnetic_Angles[i] * M_PI / 180);
|
||||
}
|
||||
|
||||
if (NumberOfMeasurements == NumberOfProbes) {
|
||||
|
||||
this->points_x = new float[NumberOfProbes / 4];
|
||||
this->points_y = new float[NumberOfProbes / 4];
|
||||
this->m_x = new float[NumberOfProbes];
|
||||
this->m_y = new float[NumberOfProbes];
|
||||
|
||||
for (i = 0; i < this->NumberOfProbes; i++) {
|
||||
m_x[i] = this->radial_coeficients[i] / this->probe_radius;
|
||||
m_y[i] = this->vertical_coeficients[i] / this->probe_radius;
|
||||
}
|
||||
}
|
||||
|
||||
//this->plasma_current_convertion_factor = 4300 * 2.0 * M_PI * this->probe_radius / this->NumberOfMeasurements;
|
||||
this->plasma_current_convertion_factor = this->ADCconst*(2.0 * M_PI * this->probe_radius / this->Ncoils)*(1/(this->MAgPerm*this->Nvoltas*this->Area));
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool MagneticsGAM::Execute(GAM_FunctionNumbers functionNumber) {
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
int i,j;
|
||||
float prim_meas=0.0;
|
||||
float hor_meas=0.0;
|
||||
float vert_meas=0.0;
|
||||
|
||||
ADC_values[0] = (float)inputstruct[0].ADC_magnetic_chopper_fp_0;
|
||||
ADC_values[1] = (float)inputstruct[0].ADC_magnetic_chopper_fp_1;
|
||||
ADC_values[2] = (float)inputstruct[0].ADC_magnetic_chopper_fp_2;
|
||||
ADC_values[3] = (float)inputstruct[0].ADC_magnetic_chopper_fp_3;
|
||||
ADC_values[4] = (float)inputstruct[0].ADC_magnetic_chopper_fp_4;
|
||||
ADC_values[5] = (float)inputstruct[0].ADC_magnetic_chopper_fp_5;
|
||||
ADC_values[6] = (float)inputstruct[0].ADC_magnetic_chopper_fp_6;
|
||||
ADC_values[7] = (float)inputstruct[0].ADC_magnetic_chopper_fp_7;
|
||||
ADC_values[8] = (float)inputstruct[0].ADC_magnetic_chopper_fp_8;
|
||||
ADC_values[9] = (float)inputstruct[0].ADC_magnetic_chopper_fp_9;
|
||||
ADC_values[10] = (float)inputstruct[0].ADC_magnetic_chopper_fp_10;
|
||||
ADC_values[11] = (float)inputstruct[0].ADC_magnetic_chopper_fp_11;
|
||||
|
||||
// Measured horizontal, Vertical & Primary currents
|
||||
prim_meas= inputstruct[0].PrimaryCurrent;
|
||||
hor_meas= inputstruct[0].HorizontalCurrent;
|
||||
vert_meas=inputstruct[0].VerticalCurrent;
|
||||
|
||||
//Apply coil polarity factor - OK
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
ADC_values[i] = ADC_values[i] * magnetic_Polarity_calibration[i];
|
||||
}
|
||||
|
||||
if (functionNumber == GAMOnline) {
|
||||
// Determine the ADC Module offset "b" as "y(n)=a*n+b"
|
||||
|
||||
if (inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation) {
|
||||
|
||||
//For now we do not use this step (under optimization)
|
||||
|
||||
//Determine "b" by knowing "a" and "y(-100us)"
|
||||
//if(inputstruct[0].usectime==900){
|
||||
// for(i = 0 ; i < this->NumberOfMeasurements ; i++){
|
||||
// this->magnetic_Offset_zero[i] = ADC_values[i] + this->magnetic_Offset_slope[i]; // b = y(-100us) - a*(-100us) = y(10) + a*(1)
|
||||
// }
|
||||
//}
|
||||
|
||||
outputstruct[0].MagneticProbesR = 0.;
|
||||
outputstruct[0].MagneticProbesZ = 0.;
|
||||
outputstruct[0].MagneticProbesPlasmaCurrent = 0.;
|
||||
}
|
||||
else {
|
||||
|
||||
//Take offset at t=0
|
||||
if (inputstruct[0].usectime == usectime_to_wait_for_starting_operation) {
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
this->magnetic_Offset_zero[i] = ADC_values[i];
|
||||
magnetic_field_sum = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
//Correct using corrected= ADC[n]-(m*x+b), tirei o 1/100
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
corrected_probes[i] = ADC_values[i] - (this->magnetic_Offset_slope[i] * ((inputstruct[0].usectime - usectime_to_wait_for_starting_operation) ) + this->magnetic_Offset_zero[i]);
|
||||
}
|
||||
|
||||
|
||||
//Search in database of currents the closest value compared with the one measured in primary,vertical and horizontal coils
|
||||
// and then..... Search in database magneticflux of each mirnov coil due to primary,horizontal & vertical coils
|
||||
for (j = 0; j < 10; j++) {
|
||||
//primary
|
||||
if(this ->primarydata[j]==prim_meas)
|
||||
{
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
allmirnv_prim[i] = this->mirnprim[i][j];
|
||||
}
|
||||
j = 10;
|
||||
}
|
||||
|
||||
if (this->primarydata[j] > prim_meas)
|
||||
{
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
allmirnv_prim[i] = this->mirnprim[i][j - 1];
|
||||
}
|
||||
|
||||
j = 10;
|
||||
}
|
||||
// horizzontal
|
||||
|
||||
if (this->horizontaldata[j] == hor_meas)
|
||||
{
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
allmirnv_hor[i] = this->mirnhor[i][j];
|
||||
}
|
||||
j = 10;
|
||||
}
|
||||
|
||||
if (this->horizontaldata[j] > hor_meas)
|
||||
{
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
allmirnv_hor[i] = this->mirnhor[i][j - 1];
|
||||
}
|
||||
|
||||
j = 10;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vertical
|
||||
|
||||
if (this->verticaldata[j] == vert_meas)
|
||||
{
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
allmirnv_vert[i] = this->mirnvert[i][j];
|
||||
}
|
||||
j = 10;
|
||||
}
|
||||
|
||||
if (this->verticaldata[j] > vert_meas)
|
||||
{
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
allmirnv_vert[i] = this->mirnvert[i][j - 1];
|
||||
}
|
||||
|
||||
j = 10;
|
||||
}
|
||||
|
||||
}
|
||||
///////////////////////end of selection from the database
|
||||
|
||||
|
||||
|
||||
//Substract from corrected_probes magnetic flu values due to the Vertical, Horizontal and Primary coils
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
corrected_probes[i] = corrected_probes[i]-allmirnv_vert[i]-allmirnv_hor[i]-allmirnv_prim[i];
|
||||
}
|
||||
|
||||
// Calculate Ip
|
||||
magnetic_field_sum = 0.0; //this->NumberOfMeasurements
|
||||
for (i = 0; i < this->NumberOfMeasurements; i++) {
|
||||
magnetic_field_sum = corrected_probes[i]+ magnetic_field_sum;
|
||||
}
|
||||
|
||||
outputstruct[0].MagneticProbesPlasmaCurrent = magnetic_field_sum*this->plasma_current_convertion_factor;//corrected_probes[11];
|
||||
|
||||
|
||||
// Estimate radial_position and vertical_position
|
||||
radial_position = 0.0;
|
||||
vertical_position = 0.0;
|
||||
/* This was done when the integrators were analogic
|
||||
if(NumberOfMeasurements == NumberOfProbes){
|
||||
// WARNING: this code divides by zero fairly often. Many IGBTs died to bring us this information
|
||||
for (i = 0 ; i < this->NumberOfProbes/4 ; i++){
|
||||
r_a = this->probe_radius * 2 * corrected_probes[int(i+NumberOfProbes/2)] / (corrected_probes[int(i+NumberOfProbes/2)] + corrected_probes[i]);
|
||||
r_b = this->probe_radius * 2 * corrected_probes[int(i+NumberOfProbes/2+NumberOfProbes/4)] / (corrected_probes[int(i+NumberOfProbes/2+NumberOfProbes/4)] + corrected_probes[int(i+NumberOfProbes/4)]);
|
||||
x_a = this->radial_coeficients[this->ProbeNumbers[i]] - m_x[i] * r_a;
|
||||
x_b = this->radial_coeficients[this->ProbeNumbers[int(i+this->NumberOfProbes/4)]] - m_x[int(i+this->NumberOfProbes/4)] * r_b;
|
||||
y_a = this->vertical_coeficients[this->ProbeNumbers[i]] - m_y[i] * r_a;
|
||||
y_b = this->vertical_coeficients[this->ProbeNumbers[int(i+this->NumberOfProbes/4)]] - m_y[int(i+this->NumberOfProbes/4)] * r_b;
|
||||
// if (m_x[i] != 0 && m_x[int(i+NumberOfProbes/4)] != 0) {
|
||||
m_b = m_y[i]/m_x[i];
|
||||
m_a = m_y[int(i+this->NumberOfProbes/4)]/m_x[int(i+this->NumberOfProbes/4)];
|
||||
points_x[i] = (m_b*x_b-y_b-m_a*x_a+y_a) / (m_b-m_a);
|
||||
points_y[i] = m_a*(points_x[i]-x_a)+y_a;
|
||||
// }
|
||||
radial_position += points_x[i];
|
||||
vertical_position += points_y[i];
|
||||
}
|
||||
|
||||
}
|
||||
else {}*/
|
||||
|
||||
|
||||
for(i = 0 ; i < this->NumberOfMeasurements ; i++){
|
||||
|
||||
radial_position += corrected_probes[i] * this->radial_coeficients[this->ProbeNumbers[i]];
|
||||
vertical_position += corrected_probes[i] * this->vertical_coeficients[this->ProbeNumbers[i]];
|
||||
}
|
||||
|
||||
if (magnetic_field_sum !=0) {
|
||||
radial_position = radial_position / magnetic_field_sum;
|
||||
vertical_position = vertical_position / magnetic_field_sum;
|
||||
}
|
||||
else {
|
||||
radial_position = 0;
|
||||
vertical_position = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Hard clip position (limits for the output signal)
|
||||
if(radial_position < -this->clip_limit) radial_position = -this->clip_limit;
|
||||
if(radial_position > this->clip_limit) radial_position = this->clip_limit;
|
||||
|
||||
if(vertical_position < -this->clip_limit) vertical_position = -this->clip_limit;
|
||||
if(vertical_position > this->clip_limit) vertical_position = this->clip_limit;
|
||||
|
||||
|
||||
|
||||
outputstruct[0].MagneticProbesR = radial_position;
|
||||
outputstruct[0].MagneticProbesZ = vertical_position;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
//this->n_samples = 0;
|
||||
//for(i = 0 ; i < (this->NumberOfMeasurements) ; i++){
|
||||
// this->magnetic_Offset_zero[i] = 0;
|
||||
//}
|
||||
outputstruct[0].MagneticProbesPlasmaCurrent = 0;
|
||||
outputstruct[0].MagneticProbesR = 0;
|
||||
outputstruct[0].MagneticProbesZ = 0;
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
bool MagneticsGAM::ProcessHttpMessage(HttpStream &hStream) {
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name(), 0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")) {
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if (submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")) {
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if (submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if (!view_input_variables) {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>magnetic_radial_bool = %d\n\
|
||||
<br>magnetic_vertical_bool = %d\n\
|
||||
<br>magnetic_module_correction_bool = %d\n\
|
||||
<br>NumberOfProbes = %d\n\
|
||||
<br>NumberOfMeasurements = %d\n\
|
||||
<br>NumberOfModules = %d\n\
|
||||
<br><br", magnetic_radial_bool, magnetic_vertical_bool, magnetic_module_correction_bool, NumberOfProbes, NumberOfMeasurements, NumberOfModules);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>magnetic_Angles</td");
|
||||
for (i = 0; i<NumberOfProbes; i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td", magnetic_Angles[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>magnetic_Calibration</td");
|
||||
for (i = 0; i<NumberOfProbes; i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td", magnetic_Calibration[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>ProbeNumbers</td");
|
||||
for (i = 0; i<NumberOfMeasurements; i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td", ProbeNumbers[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>magnetic_Offset_slope</td");
|
||||
for (i = 0; i<NumberOfModules; i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td", magnetic_Offset_slope[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>magnetic_Polarity_calibration</td");
|
||||
for (i = 0; i<NumberOfModules; i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td", magnetic_Polarity_calibration[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type", "text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
133
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/MagneticsGAM.h
Normal file
133
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/MagneticsGAM.h
Normal file
@@ -0,0 +1,133 @@
|
||||
#ifndef _MAGNETICSGAM_H
|
||||
#define _MAGNETICSGAM_H
|
||||
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(MagneticsGAM)
|
||||
|
||||
|
||||
class MagneticsGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
int ADC_magnetic_chopper_fp_0;
|
||||
int ADC_magnetic_chopper_fp_1;
|
||||
int ADC_magnetic_chopper_fp_2;
|
||||
int ADC_magnetic_chopper_fp_3;
|
||||
int ADC_magnetic_chopper_fp_4;
|
||||
int ADC_magnetic_chopper_fp_5;
|
||||
int ADC_magnetic_chopper_fp_6;
|
||||
int ADC_magnetic_chopper_fp_7;
|
||||
int ADC_magnetic_chopper_fp_8;
|
||||
int ADC_magnetic_chopper_fp_9;
|
||||
int ADC_magnetic_chopper_fp_10;
|
||||
int ADC_magnetic_chopper_fp_11;
|
||||
//Add signals from primary,vertical and horizontal currents channels 91,92,93
|
||||
float HorizontalCurrent;
|
||||
float VerticalCurrent;
|
||||
float PrimaryCurrent;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float MagneticProbesR;
|
||||
float MagneticProbesZ;
|
||||
float MagneticProbesPlasmaCurrent;
|
||||
};
|
||||
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
bool magnetic_radial_bool;
|
||||
bool magnetic_vertical_bool;
|
||||
bool magnetic_module_correction_bool;
|
||||
int NumberOfProbes;
|
||||
float *magnetic_Angles;
|
||||
float *magnetic_Calibration;
|
||||
int NumberOfMeasurements;
|
||||
int *ProbeNumbers;
|
||||
int NumberOfModules;
|
||||
float *magnetic_Offset_slope;
|
||||
float *magnetic_Polarity_calibration;
|
||||
|
||||
float *radial_coeficients;
|
||||
float *vertical_coeficients;
|
||||
float *magnetic_Offset_zero;
|
||||
float *ADC_values;
|
||||
float *corrected_probes;
|
||||
// Picked values of magneticflux in databases for substraction
|
||||
float *allmirnv_prim;
|
||||
float *allmirnv_hor;
|
||||
float *allmirnv_vert;
|
||||
|
||||
|
||||
// Arrays with mirnov magneticflux from primary, vertical and horizontal currents (database)
|
||||
float *primarydata; //[A]
|
||||
float *horizontaldata;
|
||||
float *verticaldata;
|
||||
|
||||
float **mirnprim;
|
||||
|
||||
float **mirnhor;
|
||||
|
||||
float **mirnvert;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
float adc18bit_conversion;
|
||||
|
||||
float *points_x;
|
||||
float *points_y;
|
||||
float *m_x;
|
||||
float *m_y;
|
||||
float y_a;
|
||||
float y_b;
|
||||
float x_a;
|
||||
float x_b;
|
||||
float r_a;
|
||||
float r_b;
|
||||
float m_a;
|
||||
float m_b;
|
||||
float plasma_current_convertion_factor;
|
||||
|
||||
int n_samples;
|
||||
float probe_radius, major_radius, clip_limit;
|
||||
float Area, Nvoltas, MAgPerm, ADCconst, Ncoils;
|
||||
float radial_position, vertical_position;
|
||||
// float rOffset, zOffset;
|
||||
float magnetic_field_sum;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
MagneticsGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~MagneticsGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
|
||||
|
||||
OBJECT_DLL_STUFF(MagneticsGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,383 @@
|
||||
/**
|
||||
* @file allows to configure ISTTOK and upload configuration file to MARTe
|
||||
*/
|
||||
#ifndef CFG_UPLOADER_H
|
||||
#define CFG_UPLOADER_H
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
#include "Level3.h"
|
||||
|
||||
#include "System.h"
|
||||
#include "HttpStream.h"
|
||||
#include "HttpInterface.h"
|
||||
#include "HtmlStream.h"
|
||||
#include "FString.h"
|
||||
#include "GCReferenceContainer.h"
|
||||
#include "CDBExtended.h"
|
||||
#include "GlobalObjectDataBase.h"
|
||||
#include "MessageHandler.h"
|
||||
|
||||
#include "SVGGraphicSupport.h"
|
||||
//#include "WaveformFiles.h"
|
||||
//#include "VectorSupport.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#include <dirent.h> //to load files located on the atca
|
||||
#include <string.h> // to compare strings
|
||||
|
||||
|
||||
|
||||
OBJECT_DLL(MainConfigurator)
|
||||
class MainConfigurator: public GCReferenceContainer, public HttpInterface, public MessageHandler{
|
||||
OBJECT_DLL_STUFF(MainConfigurator)
|
||||
|
||||
private:
|
||||
/** The id of the configuration file entry as received from the http request*/
|
||||
FString configFileID;
|
||||
|
||||
/** The location of MARTe*/
|
||||
FString marteLocation;
|
||||
FString cdbString; //string to be uploaded
|
||||
|
||||
float Ip_max_threshold_value;
|
||||
float max_value;
|
||||
|
||||
bool *magnetic_probes_bool_vector;
|
||||
int *timewindows_dropdown_vector;
|
||||
float *timewindows_time;
|
||||
bool *timewindows_bool_vector;
|
||||
int graphic_select;
|
||||
FString save_filename;
|
||||
bool save_as_bool;
|
||||
bool delete_selected_points_bool;
|
||||
|
||||
int vector_dim_temp;
|
||||
float *temp_vector_x;
|
||||
float *temp_vector_y;
|
||||
float temp_max_value;
|
||||
float temp_min_value;
|
||||
|
||||
bool already_started;
|
||||
|
||||
bool edit_weights;
|
||||
bool edit_control;
|
||||
bool edit_timewindows;
|
||||
|
||||
bool focus_on_t_form_bool;
|
||||
bool focus_on_y_form_bool;
|
||||
|
||||
float box_display_point_x;
|
||||
float box_display_point_y;
|
||||
FString temp_box_string;
|
||||
|
||||
FString Description;
|
||||
int screen_resolution_x;
|
||||
int screen_resolution_y;
|
||||
|
||||
FString header_colour;
|
||||
FString diagnostics_parameters_colour;
|
||||
FString control_parameters_colour;
|
||||
FString time_windows_colour;
|
||||
FString edit_colour;
|
||||
FString footer_colour;
|
||||
|
||||
FString default_config_file_path;
|
||||
FString config_files_directory;
|
||||
|
||||
FString selected_load_directory;
|
||||
FString selected_load_file;
|
||||
|
||||
FString selected_save_directory;
|
||||
FString selected_save_file;
|
||||
|
||||
FString dummy_fstring;
|
||||
|
||||
// MARTe advanced settings
|
||||
int marte_usec_cycle_time;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
int datacollection_n_of_samples;
|
||||
|
||||
// +waveform_primary
|
||||
// waveform_mode_1_positive
|
||||
int primary_1_p_vector_size;
|
||||
float *primary_1_p_index_vector;
|
||||
float *primary_1_p_data_vector;
|
||||
float primary_1_p_max_value;
|
||||
float primary_1_p_min_value;
|
||||
// waveform_mode_1_negative
|
||||
int primary_1_n_vector_size;
|
||||
float *primary_1_n_index_vector;
|
||||
float *primary_1_n_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int primary_2_p_vector_size;
|
||||
float *primary_2_p_index_vector;
|
||||
float *primary_2_p_data_vector;
|
||||
float primary_2_p_max_value;
|
||||
float primary_2_p_min_value;
|
||||
// waveform_mode_2_negative
|
||||
int primary_2_n_vector_size;
|
||||
float *primary_2_n_index_vector;
|
||||
float *primary_2_n_data_vector;
|
||||
// waveform_mode_3_positive
|
||||
int primary_breakdown_vector_size;
|
||||
float *primary_breakdown_index_vector;
|
||||
float *primary_breakdown_data_vector;
|
||||
// waveform_mode_3_negative
|
||||
int primary_inversion_vector_size;
|
||||
float *primary_inversion_index_vector;
|
||||
float *primary_inversion_data_vector;
|
||||
|
||||
// +waveform_vertical
|
||||
// waveform_mode_1_positive
|
||||
int vertical_1_p_vector_size;
|
||||
float *vertical_1_p_index_vector;
|
||||
float *vertical_1_p_data_vector;
|
||||
float vertical_1_p_max_value;
|
||||
float vertical_1_p_min_value;
|
||||
// waveform_mode_1_negative
|
||||
int vertical_1_n_vector_size;
|
||||
float *vertical_1_n_index_vector;
|
||||
float *vertical_1_n_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int vertical_2_p_vector_size;
|
||||
float *vertical_2_p_index_vector;
|
||||
float *vertical_2_p_data_vector;
|
||||
float vertical_2_p_max_value;
|
||||
float vertical_2_p_min_value;
|
||||
// waveform_mode_2_negative
|
||||
int vertical_2_n_vector_size;
|
||||
float *vertical_2_n_index_vector;
|
||||
float *vertical_2_n_data_vector;
|
||||
// waveform_mode_3_positive
|
||||
int vertical_breakdown_vector_size;
|
||||
float *vertical_breakdown_index_vector;
|
||||
float *vertical_breakdown_data_vector;
|
||||
// waveform_mode_3_negative
|
||||
int vertical_inversion_vector_size;
|
||||
float *vertical_inversion_index_vector;
|
||||
float *vertical_inversion_data_vector;
|
||||
|
||||
// +waveform_horizontal
|
||||
// waveform_mode_1_positive
|
||||
int horizontal_1_p_vector_size;
|
||||
float *horizontal_1_p_index_vector;
|
||||
float *horizontal_1_p_data_vector;
|
||||
float horizontal_1_p_max_value;
|
||||
float horizontal_1_p_min_value;
|
||||
// waveform_mode_1_negative
|
||||
int horizontal_1_n_vector_size;
|
||||
float *horizontal_1_n_index_vector;
|
||||
float *horizontal_1_n_data_vector;
|
||||
// waveform_mode_2_positive
|
||||
int horizontal_2_p_vector_size;
|
||||
float *horizontal_2_p_index_vector;
|
||||
float *horizontal_2_p_data_vector;
|
||||
float horizontal_2_p_max_value;
|
||||
float horizontal_2_p_min_value;
|
||||
// waveform_mode_2_negative
|
||||
int horizontal_2_n_vector_size;
|
||||
float *horizontal_2_n_index_vector;
|
||||
float *horizontal_2_n_data_vector;
|
||||
// waveform_mode_3_positive
|
||||
int horizontal_breakdown_vector_size;
|
||||
float *horizontal_breakdown_index_vector;
|
||||
float *horizontal_breakdown_data_vector;
|
||||
// waveform_mode_3_negative
|
||||
int horizontal_inversion_vector_size;
|
||||
float *horizontal_inversion_index_vector;
|
||||
float *horizontal_inversion_data_vector;
|
||||
|
||||
// +time_windows
|
||||
float discharge_time;
|
||||
int number_of_cycles;
|
||||
bool first_cycle_positive_bool;
|
||||
bool auto_breakdown;
|
||||
// positive_time_windows
|
||||
int positive_number_of_time_windows;
|
||||
float *positive_time_windows_values;
|
||||
int *positive_primary_mode;
|
||||
int *positive_horizontal_mode;
|
||||
int *positive_vertical_mode;
|
||||
// negative_time_windows
|
||||
int negative_number_of_time_windows;
|
||||
float *negative_time_windows_values;
|
||||
int *negative_primary_mode;
|
||||
int *negative_horizontal_mode;
|
||||
int *negative_vertical_mode;
|
||||
|
||||
// +tomography
|
||||
bool tomography_radial_bool;
|
||||
bool tomography_vertical_bool;
|
||||
|
||||
// +electric_probes
|
||||
bool electric_radial_bool;
|
||||
bool electric_vertical_bool;
|
||||
|
||||
// +magnetic_probes
|
||||
bool magnetic_radial_bool;
|
||||
bool magnetic_vertical_bool;
|
||||
// MirnovArrayDescription
|
||||
int NumberOfProbes;
|
||||
float *magnetic_Angles;
|
||||
float *magnetic_Calibration;
|
||||
// Measurements
|
||||
int NumberOfMeasurements;
|
||||
int *ProbeNumbers;
|
||||
|
||||
// +sine_probe =
|
||||
bool sine_vertical_bool;
|
||||
|
||||
// +coseno_probe =
|
||||
bool cosine_radial_bool;
|
||||
|
||||
// +hibd =
|
||||
bool hibd_radial_bool;
|
||||
bool hibd_vertical_bool;
|
||||
|
||||
// +interferometry
|
||||
bool interferometry_radial_control_bool;
|
||||
|
||||
// +machine_protection
|
||||
float iron_core_saturation_value;
|
||||
float iron_core_dangerous_value;
|
||||
|
||||
// +plasma_parameters
|
||||
float high_current_threshold_value;
|
||||
// tomography
|
||||
float tomography_radial_high_current_weight;
|
||||
float tomography_radial_low_current_weight;
|
||||
float tomography_vertical_high_current_weight;
|
||||
float tomography_vertical_low_current_weight;
|
||||
// electric_probes
|
||||
float electric_radial_high_current_weight;
|
||||
float electric_radial_low_current_weight;
|
||||
float electric_vertical_high_current_weight;
|
||||
float electric_vertical_low_current_weight;
|
||||
// magnetic_probes
|
||||
float magnetic_radial_high_current_weight;
|
||||
float magnetic_radial_low_current_weight;
|
||||
float magnetic_vertical_high_current_weight;
|
||||
float magnetic_vertical_low_current_weight;
|
||||
// sine_probe
|
||||
float sine_vertical_high_current_weight;
|
||||
float sine_vertical_low_current_weight;
|
||||
// cosine_probe
|
||||
float cosine_radial_high_current_weight;
|
||||
float cosine_radial_low_current_weight;
|
||||
// hibd
|
||||
float hibd_radial_high_current_weight;
|
||||
float hibd_radial_low_current_weight;
|
||||
float hibd_vertical_high_current_weight;
|
||||
float hibd_vertical_low_current_weight;
|
||||
|
||||
// +controller
|
||||
// PID_horizontal
|
||||
float PID_horizontal_proportional_soft;
|
||||
float PID_horizontal_proportional_normal;
|
||||
float PID_horizontal_proportional_hard;
|
||||
float PID_horizontal_integral_soft;
|
||||
float PID_horizontal_integral_normal;
|
||||
float PID_horizontal_integral_hard;
|
||||
float PID_horizontal_derivative_soft;
|
||||
float PID_horizontal_derivative_normal;
|
||||
float PID_horizontal_derivative_hard;
|
||||
// PID_vertical =
|
||||
float PID_vertical_proportional_soft;
|
||||
float PID_vertical_proportional_normal;
|
||||
float PID_vertical_proportional_hard;
|
||||
float PID_vertical_integral_soft;
|
||||
float PID_vertical_integral_normal;
|
||||
float PID_vertical_integral_hard;
|
||||
float PID_vertical_derivative_soft;
|
||||
float PID_vertical_derivative_normal;
|
||||
float PID_vertical_derivative_hard;
|
||||
// PID_primary
|
||||
float PID_primary_proportional_soft;
|
||||
float PID_primary_proportional_normal;
|
||||
float PID_primary_proportional_hard;
|
||||
float PID_primary_integral_soft;
|
||||
float PID_primary_integral_normal;
|
||||
float PID_primary_integral_hard;
|
||||
float PID_primary_derivative_soft;
|
||||
float PID_primary_derivative_normal;
|
||||
float PID_primary_derivative_hard;
|
||||
|
||||
// +FACommunicator_vertical
|
||||
FString verticalPS_UARTPortAddress;
|
||||
int verticalPS_SimulationTestNumber;
|
||||
float verticalPS_PointOfZeroCurrent;
|
||||
float verticalPS_CurrentStep;
|
||||
|
||||
// +FACommunicator_horizontal
|
||||
FString horizontalPS_UARTPortAddress;
|
||||
int horizontalPS_SimulationTestNumber;
|
||||
float horizontalPS_PointOfZeroCurrent;
|
||||
float horizontalPS_CurrentStep;
|
||||
|
||||
// +FACommunicator_primary
|
||||
FString primaryPS_UARTPortAddress;
|
||||
int primaryPS_SimulationTestNumber;
|
||||
float primaryPS_PointOfZeroCurrent;
|
||||
float primaryPS_CurrentStep;
|
||||
|
||||
SVGGraphicSupport *graphics_support;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** the main entry point for HttpInterface */
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
/** the default constructor */
|
||||
MainConfigurator(){
|
||||
}
|
||||
|
||||
~MainConfigurator(){
|
||||
}
|
||||
|
||||
virtual bool ObjectLoadSetup(ConfigurationDataBase & info, StreamInterface * err);
|
||||
|
||||
/** save an object content into a set of configs */
|
||||
virtual bool ObjectSaveSetup( ConfigurationDataBase & info, StreamInterface * err){
|
||||
|
||||
GCReferenceContainer::ObjectSaveSetup(info,err);
|
||||
return HttpInterface::ObjectSaveSetup(info,err);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/**Utility method to print the form*/
|
||||
bool Initialise();
|
||||
|
||||
bool PrintHTTPForm(HtmlStream &hmStream); // prints the html steam
|
||||
|
||||
bool WriteConfigurationFileWithChanges(char BaseFileFilePath[], char TargetFilePath[]); // writes a config file from the stored variables
|
||||
|
||||
bool ReadConfigurationFile(char FilePath[]); // reads a configuration file and saves the data to the correspondent variables
|
||||
|
||||
bool DualVectorSort(int vector_dim, float * vector_x, float * vector_y); // sorts 2 vectors based on the vector_x values
|
||||
|
||||
virtual bool RemoveRepeatedValues(int * vector_dim, float * vector_x, float * vector_y); // remove repeated values of generic vectors
|
||||
|
||||
virtual bool RemoveRepeatedValues(int option); // remove repeated values of a certain waveform (option dependant)
|
||||
|
||||
bool MoveToTemp(int option); // used with remove point
|
||||
|
||||
bool MoveToTempWithLimits(int option); // used with add point
|
||||
|
||||
bool RetrieveFromTemp(int option); // used with remove/add point
|
||||
|
||||
bool RemovePoint(int option, int index_to_remove); // remove a point for a certain waveform
|
||||
|
||||
bool DisplayPoint(int option, int index_to_display);
|
||||
|
||||
bool AddPoint(int option, float point_to_add_x, float point_to_add_y); // add a point to a certain waveform
|
||||
|
||||
bool SortTimeWindows(); // sort and remove repeated submited timewindows
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,216 @@
|
||||
|
||||
#include "MainRogowskiGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(MainRogowskiGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
MainRogowskiGAM::MainRogowskiGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
MainRogowskiGAM::~MainRogowskiGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool MainRogowskiGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
int i;
|
||||
|
||||
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"MainRogowskiGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "MainRogowskiGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MainRogowskiGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "MainRogowskiGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "MainRogowskiGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 2;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("main_rogowski_input");
|
||||
CDB_move_to[1].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"MainRogowskiGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("rogowski_plasma_current");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"MainRogowskiGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"MainRogowskiGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->n_samples = 0;
|
||||
this->remove_offset = 0;
|
||||
this->accumulator = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool MainRogowskiGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"MainRogowskiGAM:: %s inputstruct = %f ",this->Name(), inputstruct[0].ADC_main_rogowski);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
|
||||
//use this gam to correct the main rogowski diagnostic (plasma current measure)
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
// Determine the ADC offset
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
this->accumulator += (float) inputstruct[0].ADC_main_rogowski;
|
||||
this->remove_offset = this->accumulator / (float) this->n_samples;
|
||||
outputstruct[0].RogowskiPlasmaCurrent = 0;
|
||||
//AssertErrorCondition(InitialisationError,"MainRogowskiGAM:: %s n_samples = %d, accumulator = %f, remove_offset = %f",this->Name(), n_samples, accumulator, remove_offset);
|
||||
}
|
||||
else{
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
AssertErrorCondition(Information,"MainRogowskiGAM::Execute: %s OFFSET = %f, number of samples = %d", this->Name(), this->remove_offset, n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
outputstruct[0].RogowskiPlasmaCurrent = (float ) inputstruct[0].ADC_main_rogowski - this->remove_offset;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->n_samples = 0;
|
||||
this->remove_offset = 0;
|
||||
this->accumulator = 0;
|
||||
outputstruct[0].RogowskiPlasmaCurrent = 0;
|
||||
}
|
||||
|
||||
// outputstruct[0].RogowskiPlasmaCurrent = (float) inputstruct[0].ADC_main_rogowski;
|
||||
// AssertErrorCondition(InitialisationError,"MainRogowskiGAM:: %s outputstruct = %f",this->Name(), outputstruct[0].RogowskiPlasmaCurrent);
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
bool MainRogowskiGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text", (char *) this->Name());
|
||||
|
||||
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef _MAINROGOWSKIGAM_H
|
||||
#define _MAINROGOWSKIGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(MainRogowskiGAM)
|
||||
|
||||
|
||||
class MainRogowskiGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_main_rogowski;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float RogowskiPlasmaCurrent;
|
||||
};
|
||||
|
||||
int n_samples;
|
||||
float remove_offset;
|
||||
float accumulator;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
MainRogowskiGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~MainRogowskiGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(MainRogowskiGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
62
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/Makefile
Normal file
62
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/Makefile
Normal file
@@ -0,0 +1,62 @@
|
||||
target=linux
|
||||
BASEDIR=/opt/MARTe
|
||||
|
||||
OBJS =
|
||||
OBJS += $(target)/AdvancedConfigurator.o
|
||||
OBJS += $(target)/ControllerGAM.o
|
||||
OBJS += $(target)/CosineProbeGAM.o
|
||||
OBJS += $(target)/ElectricProbesGAM.o
|
||||
OBJS += $(target)/ElectrodeBiasingGAM.o
|
||||
OBJS += $(target)/FireSignalDischargeStatusGAM.o
|
||||
OBJS += $(target)/HAlphaGAM.o
|
||||
OBJS += $(target)/HeavyIonBeamGAM.o
|
||||
OBJS += $(target)/IntegerSequentialControl.o
|
||||
OBJS += $(target)/InterferometryGAM.o
|
||||
OBJS += $(target)/IPID.o
|
||||
OBJS += $(target)/IWaveform.o
|
||||
OBJS += $(target)/MachineProtectionGAM.o
|
||||
OBJS += $(target)/MagneticsGAM.o
|
||||
OBJS += $(target)/MainConfigurator.o
|
||||
OBJS += $(target)/MainRogowskiGAM.o
|
||||
OBJS += $(target)/PlasmaStatusGAM.o
|
||||
OBJS += $(target)/PowerSupplyCommunicatorGAM.o
|
||||
OBJS += $(target)/SineProbeGAM.o
|
||||
OBJS += $(target)/SpectroscopyTriggerGAM.o
|
||||
OBJS += $(target)/SVGGraphicSupport.o
|
||||
OBJS += $(target)/TechnicalSignalsGAM.o
|
||||
OBJS += $(target)/TimeWindowsGAM.o
|
||||
OBJS += $(target)/TomographyGAM.o
|
||||
OBJS += $(target)/UFSerialUART.o
|
||||
OBJS += $(target)/WaveformGAM.o
|
||||
|
||||
#CFLAGS = -m32
|
||||
CFLAGS = -fPIC
|
||||
CFLAGS += -I.
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level0
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level1
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level2
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level3
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level4
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level5
|
||||
CFLAGS += -I$(BASEDIR)/BaseLib2/Level6
|
||||
|
||||
LIBRARY_PATH += -L$(BASEDIR)/BaseLib2/linux
|
||||
LIBRARIES = -lBaseLib2
|
||||
|
||||
CFLAGSPEC= -D_LINUX -DUSE_PTHREAD -pthread
|
||||
|
||||
all : $(OBJS)
|
||||
gcc -O3 $(CFLAGS) $(LIBRARY_PATH) -shared -fPIC $(OBJS) $(LIBRARIES) -o $(target)/isttokbiblio.so
|
||||
touch $(target)/libisttokbiblio.so
|
||||
rm $(target)/libisttokbiblio.so
|
||||
ln -fns isttokbiblio.so $(target)/libisttokbiblio.so
|
||||
|
||||
linux/%.o : %.cpp
|
||||
gcc -O3 -c $(CFLAGS) $(CFLAGSPEC) $(LIBRARY_PATH) $(LIBRARIES) $*.cpp -o $(target)/$*.o
|
||||
|
||||
clean:
|
||||
rm -f $(target)/depends*
|
||||
rm -f $(target)/*.o
|
||||
rm -f $(target)/*.a
|
||||
rm -f $(target)/*.so
|
||||
rm -f $(target)/*.ex
|
||||
@@ -0,0 +1,649 @@
|
||||
|
||||
#include "PlasmaStatusGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(PlasmaStatusGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
PlasmaStatusGAM::PlasmaStatusGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
PlasmaStatusGAM::~PlasmaStatusGAM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool PlasmaStatusGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadFloat(high_current_threshold_value, "high_current_threshold_value"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s high_current_threshold_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: high_current_threshold_value = %f",high_current_threshold_value);
|
||||
|
||||
if(!cdb->Move("tomography"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+plasma_parameters.tomography\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "tomography_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s tomography_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
tomography_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: tomography_radial_bool = %d",tomography_radial_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "tomography_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s tomography_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
tomography_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: tomography_vertical_bool = %d",tomography_vertical_bool);
|
||||
}
|
||||
|
||||
if(!cdb.ReadFloat(tomography_radial_high_current_weight, "radial_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s tomography_radial_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: tomography_radial_high_current_weight = %f",tomography_radial_high_current_weight);
|
||||
if(!cdb.ReadFloat(tomography_radial_low_current_weight, "radial_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s tomography_radial_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: tomography_radial_low_current_weight = %f",tomography_radial_low_current_weight);
|
||||
if(!cdb.ReadFloat(tomography_vertical_high_current_weight, "vertical_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s tomography_vertical_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: tomography_vertical_high_current_weight = %f",tomography_vertical_high_current_weight);
|
||||
if(!cdb.ReadFloat(tomography_vertical_low_current_weight, "vertical_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s tomography_vertical_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: tomography_vertical_low_current_weight = %f",tomography_vertical_low_current_weight);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("electric_probes"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+plasma_parameters.electric_probes\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "electric_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s electric_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
electric_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: electric_radial_bool = %d",electric_radial_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "electric_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s electric_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
electric_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: electric_vertical_bool = %d",electric_vertical_bool);
|
||||
}
|
||||
if(!cdb.ReadFloat(electric_radial_high_current_weight, "radial_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s electric_radial_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: electric_radial_high_current_weight = %f",electric_radial_high_current_weight);
|
||||
if(!cdb.ReadFloat(electric_radial_low_current_weight, "radial_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s electric_radial_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: electric_radial_low_current_weight = %f",electric_radial_low_current_weight);
|
||||
if(!cdb.ReadFloat(electric_vertical_high_current_weight, "vertical_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s electric_vertical_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: electric_vertical_high_current_weight = %f",electric_vertical_high_current_weight);
|
||||
if(!cdb.ReadFloat(electric_vertical_low_current_weight, "vertical_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s electric_vertical_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: electric_vertical_low_current_weight = %f",electric_vertical_low_current_weight);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("magnetic_probes"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+plasma_parameters.magnetic_probes\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "magnetic_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s magnetic_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
magnetic_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: magnetic_radial_bool = %d",magnetic_radial_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "magnetic_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s magnetic_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
magnetic_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: magnetic_vertical_bool = %d",magnetic_vertical_bool);
|
||||
}
|
||||
if(!cdb.ReadFloat(magnetic_radial_high_current_weight, "radial_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s magnetic_radial_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: magnetic_radial_high_current_weight = %f",magnetic_radial_high_current_weight);
|
||||
if(!cdb.ReadFloat(magnetic_radial_low_current_weight, "radial_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s magnetic_radial_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: magnetic_radial_low_current_weight = %f",magnetic_radial_low_current_weight);
|
||||
if(!cdb.ReadFloat(magnetic_vertical_high_current_weight, "vertical_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s magnetic_vertical_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: magnetic_vertical_high_current_weight = %f",magnetic_vertical_high_current_weight);
|
||||
if(!cdb.ReadFloat(magnetic_vertical_low_current_weight, "vertical_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s magnetic_vertical_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: magnetic_vertical_low_current_weight = %f",magnetic_vertical_low_current_weight);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("sine_probe"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+plasma_parameters.sine_probe\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "sine_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s sine_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
sine_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: sine_vertical_bool = %d",sine_vertical_bool);
|
||||
}
|
||||
if(!cdb.ReadFloat(sine_vertical_high_current_weight, "vertical_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s sine_vertical_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: sine_vertical_high_current_weight = %f",sine_vertical_high_current_weight);
|
||||
if(!cdb.ReadFloat(sine_vertical_low_current_weight, "vertical_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s sine_vertical_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: sine_vertical_low_current_weight = %f",sine_vertical_low_current_weight);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("cosine_probe"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+plasma_parameters.cosine_probe\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "cosine_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s cosine_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
cosine_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: cosine_radial_bool = %d",cosine_radial_bool);
|
||||
}
|
||||
if(!cdb.ReadFloat(cosine_radial_high_current_weight, "radial_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s cosine_radial_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: cosine_radial_high_current_weight = %f",cosine_radial_high_current_weight);
|
||||
if(!cdb.ReadFloat(cosine_radial_low_current_weight, "radial_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s cosine_radial_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: cosine_radial_low_current_weight = %f",cosine_radial_low_current_weight);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("hibd"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+plasma_parameters.hibd\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "hibd_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s hibd_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
hibd_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: hibd_radial_bool = %d",hibd_radial_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "hibd_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s hibd_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
hibd_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: hibd_vertical_bool = %d",hibd_vertical_bool);
|
||||
}
|
||||
if(!cdb.ReadFloat(hibd_radial_high_current_weight, "radial_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s hibd_radial_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: hibd_radial_high_current_weight = %f",hibd_radial_high_current_weight);
|
||||
if(!cdb.ReadFloat(hibd_radial_low_current_weight, "radial_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s hibd_radial_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: hibd_radial_low_current_weight = %f",hibd_radial_low_current_weight);
|
||||
if(!cdb.ReadFloat(hibd_vertical_high_current_weight, "vertical_high_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s hibd_vertical_high_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: hibd_vertical_high_current_weight = %f",hibd_vertical_high_current_weight);
|
||||
if(!cdb.ReadFloat(hibd_vertical_low_current_weight, "vertical_low_current_weight"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s hibd_vertical_low_current_weight",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: hibd_vertical_low_current_weight = %f",hibd_vertical_low_current_weight);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "PlasmaStatusGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "PlasmaStatusGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "PlasmaStatusGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "PlasmaStatusGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 14;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("rogowski_coil");
|
||||
CDB_move_to[1].Printf("density");
|
||||
CDB_move_to[2].Printf("hibd_r");
|
||||
CDB_move_to[3].Printf("hibd_z");
|
||||
CDB_move_to[4].Printf("sine_probe_z");
|
||||
CDB_move_to[5].Printf("cosine_probe_r");
|
||||
CDB_move_to[6].Printf("magnetic_probes_r");
|
||||
CDB_move_to[7].Printf("magnetic_probes_z");
|
||||
CDB_move_to[8].Printf("magnetic_probes_plasma_current");
|
||||
CDB_move_to[9].Printf("electric_probes_r");
|
||||
CDB_move_to[10].Printf("electric_probes_z");
|
||||
CDB_move_to[11].Printf("tomography_r");
|
||||
CDB_move_to[12].Printf("tomography_z");
|
||||
CDB_move_to[13].Printf("time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 4;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("plasma_current");
|
||||
CDB_move_to[1].Printf("position_r");
|
||||
CDB_move_to[2].Printf("position_z");
|
||||
CDB_move_to[3].Printf("density");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"PlasmaStatusGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PlasmaStatusGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool PlasmaStatusGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
float positionRnume =0.0;
|
||||
float positionRdeno =0.0;
|
||||
float positionZnume =0.0;
|
||||
float positionZdeno =0.0;
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"PlasmaStatusGAM:: %s inputstruct = %f %f %f %f %f %f %f %f %f %f %f ",this->Name(), inputstruct[0].RogowskiPlasmaCurrent, inputstruct[0].InterferometryDensity, inputstruct[0].SineProbeZ, inputstruct[0].CosineProbeR, inputstruct[0].MagneticProbesR, inputstruct[0].MagneticProbesZ, inputstruct[0].MagneticProbesPlasmaCurrent, inputstruct[0].ElectricProbesR, inputstruct[0].ElectricProbesZ, inputstruct[0].TomographyR, inputstruct[0].TomographyZ);
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
this->currentTime = inputstruct[0].usectime;
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
if (inputstruct[0].RogowskiPlasmaCurrent < high_current_threshold_value && inputstruct[0].RogowskiPlasmaCurrent > -high_current_threshold_value){
|
||||
positionRnume=0.0;
|
||||
positionRdeno=0.0;
|
||||
|
||||
if(tomography_radial_bool != 0) {
|
||||
positionRnume += tomography_radial_low_current_weight*inputstruct[0].TomographyR;
|
||||
positionRdeno += tomography_radial_low_current_weight;
|
||||
}
|
||||
if(electric_radial_bool != 0) {
|
||||
positionRnume += electric_radial_low_current_weight*inputstruct[0].ElectricProbesR;
|
||||
positionRdeno += electric_radial_low_current_weight;
|
||||
}
|
||||
if(magnetic_radial_bool != 0) {
|
||||
positionRnume += magnetic_radial_low_current_weight*inputstruct[0].MagneticProbesR;
|
||||
positionRdeno += magnetic_radial_low_current_weight;
|
||||
}
|
||||
if(cosine_radial_bool != 0) {
|
||||
positionRnume += cosine_radial_low_current_weight*inputstruct[0].CosineProbeR;
|
||||
positionRdeno += cosine_radial_low_current_weight;
|
||||
}
|
||||
if(hibd_radial_bool != 0) {
|
||||
positionRnume += hibd_radial_low_current_weight*inputstruct[0].HeavyIonBeamR;
|
||||
positionRdeno += hibd_radial_low_current_weight;
|
||||
}
|
||||
|
||||
if (positionRdeno != 0) outputstruct[0].PositionR = positionRnume/positionRdeno;
|
||||
else outputstruct[0].PositionR = 0;
|
||||
|
||||
positionZnume=0.0;
|
||||
positionZdeno=0.0;
|
||||
|
||||
if(tomography_vertical_bool != 0) {
|
||||
positionZnume += tomography_vertical_low_current_weight*inputstruct[0].TomographyZ;
|
||||
positionZdeno += tomography_vertical_low_current_weight;
|
||||
}
|
||||
if(electric_vertical_bool != 0) {
|
||||
positionZnume += electric_vertical_low_current_weight*inputstruct[0].ElectricProbesZ;
|
||||
positionZdeno += electric_vertical_low_current_weight;
|
||||
}
|
||||
if(magnetic_vertical_bool != 0) {
|
||||
positionZnume += magnetic_vertical_low_current_weight*inputstruct[0].MagneticProbesZ;
|
||||
positionZdeno += magnetic_vertical_low_current_weight;
|
||||
}
|
||||
if(sine_vertical_bool != 0) {
|
||||
positionZnume += sine_vertical_low_current_weight*inputstruct[0].SineProbeZ;
|
||||
positionZdeno += sine_vertical_low_current_weight;
|
||||
}
|
||||
if(hibd_vertical_bool != 0) {
|
||||
positionZnume += hibd_vertical_low_current_weight*inputstruct[0].HeavyIonBeamZ;
|
||||
positionZdeno += hibd_vertical_low_current_weight;
|
||||
}
|
||||
|
||||
if (positionZdeno != 0) outputstruct[0].PositionZ = positionZnume/positionZdeno;
|
||||
else outputstruct[0].PositionZ = 0;
|
||||
}
|
||||
|
||||
else {
|
||||
positionRnume=0.0;
|
||||
positionRdeno=0.0;
|
||||
|
||||
if(tomography_radial_bool != 0) {
|
||||
positionRnume += tomography_radial_high_current_weight*inputstruct[0].TomographyR;
|
||||
positionRdeno += tomography_radial_high_current_weight;
|
||||
}
|
||||
if(electric_radial_bool != 0) {
|
||||
positionRnume += electric_radial_high_current_weight*inputstruct[0].ElectricProbesR;
|
||||
positionRdeno += electric_radial_high_current_weight;
|
||||
}
|
||||
if(magnetic_radial_bool != 0) {
|
||||
positionRnume += magnetic_radial_high_current_weight*inputstruct[0].MagneticProbesR;
|
||||
positionRdeno += magnetic_radial_high_current_weight;
|
||||
}
|
||||
if(cosine_radial_bool != 0) {
|
||||
positionRnume += cosine_radial_high_current_weight*inputstruct[0].CosineProbeR;
|
||||
positionRdeno += cosine_radial_high_current_weight;
|
||||
}
|
||||
if(hibd_radial_bool != 0) {
|
||||
positionRnume += hibd_radial_high_current_weight*inputstruct[0].HeavyIonBeamR;
|
||||
positionRdeno += hibd_radial_high_current_weight;
|
||||
}
|
||||
|
||||
if (positionRdeno != 0) outputstruct[0].PositionR = positionRnume/positionRdeno;
|
||||
else outputstruct[0].PositionR = 0;
|
||||
|
||||
positionZnume=0.0;
|
||||
positionZdeno=0.0;
|
||||
|
||||
if(tomography_vertical_bool != 0) {
|
||||
positionZnume += tomography_vertical_high_current_weight*inputstruct[0].TomographyZ;
|
||||
positionZdeno += tomography_vertical_high_current_weight;
|
||||
}
|
||||
if(electric_vertical_bool != 0) {
|
||||
positionZnume += electric_vertical_high_current_weight*inputstruct[0].ElectricProbesZ;
|
||||
positionZdeno += electric_vertical_high_current_weight;
|
||||
}
|
||||
if(magnetic_vertical_bool != 0) {
|
||||
positionZnume += magnetic_vertical_high_current_weight*inputstruct[0].MagneticProbesZ;
|
||||
positionZdeno += magnetic_vertical_high_current_weight;
|
||||
}
|
||||
if(sine_vertical_bool != 0) {
|
||||
positionZnume += sine_vertical_high_current_weight*inputstruct[0].SineProbeZ;
|
||||
positionZdeno += sine_vertical_high_current_weight;
|
||||
}
|
||||
if(hibd_vertical_bool != 0) {
|
||||
positionZnume += hibd_vertical_high_current_weight*inputstruct[0].HeavyIonBeamZ;
|
||||
positionZdeno += hibd_vertical_high_current_weight;
|
||||
}
|
||||
|
||||
if (positionZdeno != 0) outputstruct[0].PositionZ = positionZnume/positionZdeno;
|
||||
else outputstruct[0].PositionZ = 0;
|
||||
}
|
||||
|
||||
outputstruct[0].Density = inputstruct[0].InterferometryDensity;
|
||||
// not used for now: inputstruct[0].MagneticProbesPlasmaCurrent
|
||||
outputstruct[0].PlasmaCurrent = inputstruct[0].RogowskiPlasmaCurrent;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PlasmaCurrent = 0;
|
||||
outputstruct[0].PositionR = 0;
|
||||
outputstruct[0].PositionZ = 0;
|
||||
outputstruct[0].Density = 0;
|
||||
}
|
||||
|
||||
// AssertErrorCondition(InitialisationError,"PlasmaStatusGAM:: %s outputstruct = %f %f %f %f",this->Name(), outputstruct[0].PlasmaCurrent, outputstruct[0].PositionR, outputstruct[0].PositionZ, outputstruct[0].Density);
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool PlasmaStatusGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>high_current_threshold_value = %.2f\n\
|
||||
<br>tomography_radial_bool = %d\n\
|
||||
<br>tomography_vertical_bool = %d\n\
|
||||
<br>tomography_radial_high_current_weight = %.2f\n\
|
||||
<br>tomography_radial_low_current_weight = %.2f\n\
|
||||
<br>tomography_vertical_high_current_weight = %.2f\n\
|
||||
<br>tomography_vertical_low_current_weight = %.2f\n\
|
||||
<br>electric_radial_bool = %d\n\
|
||||
<br>electric_vertical_bool = %d\n\
|
||||
<br>electric_radial_high_current_weight = %.2f\n\
|
||||
<br>electric_radial_low_current_weight = %.2f\n\
|
||||
<br>electric_vertical_high_current_weight = %.2f\n\
|
||||
<br>electric_vertical_low_current_weight = %.2f\n\
|
||||
<br>magnetic_radial_bool = %d\n\
|
||||
<br>magnetic_vertical_bool = %d\n\
|
||||
<br>magnetic_radial_high_current_weight = %.2f\n\
|
||||
<br>magnetic_radial_low_current_weight = %.2f\n\
|
||||
<br>magnetic_vertical_high_current_weight = %.2f\n\
|
||||
<br>magnetic_vertical_low_current_weight = %.2f\n\
|
||||
<br>sine_vertical_bool = %d\n\
|
||||
<br>cosine_radial_low_current_weight = %.2f\n\
|
||||
<br>hibd_radial_bool = %d\n\
|
||||
<br>hibd_vertical_bool = %d\n\
|
||||
<br>hibd_radial_high_current_weight = %.2f\n\
|
||||
<br>hibd_radial_low_current_weight = %.2f\n\
|
||||
<br>hibd_vertical_high_current_weight = %.2f\n\
|
||||
<br>hibd_vertical_low_current_weight = %.2f\n\
|
||||
<br><br",high_current_threshold_value,tomography_radial_bool,tomography_vertical_bool,tomography_radial_high_current_weight,tomography_radial_low_current_weight,tomography_vertical_high_current_weight,tomography_vertical_low_current_weight,electric_radial_bool,electric_vertical_bool,electric_radial_high_current_weight,electric_radial_low_current_weight,electric_vertical_high_current_weight,electric_vertical_low_current_weight,magnetic_radial_bool,magnetic_vertical_bool,magnetic_radial_high_current_weight,magnetic_radial_low_current_weight,magnetic_vertical_high_current_weight,magnetic_vertical_low_current_weight,sine_vertical_bool,cosine_radial_low_current_weight, hibd_radial_bool, hibd_vertical_bool, hibd_radial_high_current_weight, hibd_radial_low_current_weight, hibd_vertical_high_current_weight, hibd_vertical_low_current_weight);
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* File: LookupTable.h
|
||||
* Author: ivoc, ipfn
|
||||
*
|
||||
* Created on August 26, 2010
|
||||
* last modified on August 26, 2010
|
||||
* version: 0.1
|
||||
*/
|
||||
|
||||
#ifndef _PLASMASTATUSGAM_H
|
||||
#define _PLASMASTATUSGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(PlasmaStatusGAM)
|
||||
|
||||
|
||||
class PlasmaStatusGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float RogowskiPlasmaCurrent;
|
||||
float InterferometryDensity;
|
||||
float HeavyIonBeamR;
|
||||
float HeavyIonBeamZ;
|
||||
float SineProbeZ;
|
||||
float CosineProbeR;
|
||||
float MagneticProbesR;
|
||||
float MagneticProbesZ;
|
||||
float MagneticProbesPlasmaCurrent;
|
||||
float ElectricProbesR;
|
||||
float ElectricProbesZ;
|
||||
float TomographyR;
|
||||
float TomographyZ;
|
||||
int32 usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float PlasmaCurrent;
|
||||
float PositionR;
|
||||
float PositionZ;
|
||||
float Density;
|
||||
};
|
||||
|
||||
int32 currentTime;
|
||||
|
||||
float high_current_threshold_value;
|
||||
bool tomography_radial_bool;
|
||||
bool tomography_vertical_bool;
|
||||
float tomography_radial_high_current_weight;
|
||||
float tomography_radial_low_current_weight;
|
||||
float tomography_vertical_high_current_weight;
|
||||
float tomography_vertical_low_current_weight;
|
||||
bool electric_radial_bool;
|
||||
bool electric_vertical_bool;
|
||||
float electric_radial_high_current_weight;
|
||||
float electric_radial_low_current_weight;
|
||||
float electric_vertical_high_current_weight;
|
||||
float electric_vertical_low_current_weight;
|
||||
bool magnetic_radial_bool;
|
||||
bool magnetic_vertical_bool;
|
||||
float magnetic_radial_high_current_weight;
|
||||
float magnetic_radial_low_current_weight;
|
||||
float magnetic_vertical_high_current_weight;
|
||||
float magnetic_vertical_low_current_weight;
|
||||
bool sine_vertical_bool;
|
||||
float sine_vertical_high_current_weight;
|
||||
float sine_vertical_low_current_weight;
|
||||
bool cosine_radial_bool;
|
||||
float cosine_radial_high_current_weight;
|
||||
float cosine_radial_low_current_weight;
|
||||
bool hibd_radial_bool;
|
||||
bool hibd_vertical_bool;
|
||||
float hibd_radial_high_current_weight;
|
||||
float hibd_radial_low_current_weight;
|
||||
float hibd_vertical_high_current_weight;
|
||||
float hibd_vertical_low_current_weight;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
PlasmaStatusGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~PlasmaStatusGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(PlasmaStatusGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _LOOKUPTABLE_H */
|
||||
|
||||
@@ -0,0 +1,889 @@
|
||||
/***************************************************************************************************
|
||||
*
|
||||
* PowerSupplyCommunicatorGAM - ivoc - 6/5/2011, based on danielv FAPowerSupplyCommunicatorGAM + communicationscore
|
||||
*
|
||||
****************************************************************************************************/
|
||||
|
||||
|
||||
#include "PowerSupplyCommunicatorGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(PowerSupplyCommunicatorGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
PowerSupplyCommunicatorGAM::PowerSupplyCommunicatorGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
|
||||
this->FaUART = NULL;
|
||||
this->receivedStartingPacket = False;
|
||||
this->numMessagePackets = 0;
|
||||
|
||||
this->statisticsReceivedPackets = 0;
|
||||
this->statisticsSentPackets = 0;
|
||||
|
||||
this->statisticsReceivedMessages = 0;
|
||||
this->statisticsSentMessages = 0;
|
||||
this->statisticsIncompleteMessages = 0;
|
||||
|
||||
this->statisticsWrongMessagesReceived = 0;
|
||||
|
||||
this->CurrentStep = 0.0;
|
||||
this->PointOfZeroCurrent = 0.0;
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
PowerSupplyCommunicatorGAM::~PowerSupplyCommunicatorGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool PowerSupplyCommunicatorGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadInt32(UARTPortAddress, "UARTPortAddress"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s Could not UARTPortAddress",this->Name());
|
||||
return False;
|
||||
}
|
||||
else {
|
||||
this->FaUART = new UFSerialUART(UARTPortAddress);
|
||||
AssertErrorCondition(Information,"PowerSupplyCommunicatorGAM::Initialise: UARTPortAddress = %X",this->UARTPortAddress);
|
||||
}
|
||||
// Check port initialisation
|
||||
if(this->FaUART->IsUARTInitialised())
|
||||
AssertErrorCondition(Information, "PowerSupplyCommunicatorGAM::Initialise: %s, Using UART port address %d.",this->Name(), this->FaUART->GetUARTPortAddress());
|
||||
else
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "PowerSupplyCommunicatorGAM::Initialise: %s failed get permission to use the UART at address %d.", this->Name(),this->FaUART->GetUARTPortAddress());
|
||||
return False;
|
||||
}
|
||||
// Configure the UART
|
||||
if(!this->ConfigureUART())
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "PowerSupplyCommunicatorGAM::Initialise: %s failed to configure the UART.", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadFloat(PointOfZeroCurrent, "PointOfZeroCurrent"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s PointOfZeroCurrent",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PowerSupplyCommunicatorGAM::Initialise: PointOfZeroCurrent = %f",PointOfZeroCurrent);
|
||||
if(!cdb.ReadFloat(CurrentStep, "CurrentStep"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s CurrentStep",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PowerSupplyCommunicatorGAM::Initialise: CurrentStep = %f",CurrentStep);
|
||||
if(!cdb.ReadInt32(usecGlobalPeriod, "usecGlobalPeriod"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s usecGlobalPeriod",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"PowerSupplyCommunicatorGAM::Initialise: usecGlobalPeriod = %d",usecGlobalPeriod);
|
||||
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "PowerSupplyCommunicatorGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "PowerSupplyCommunicatorGAM::Initialise: %s failed to add the PowerSupplyCommunicatorGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "PowerSupplyCommunicatorGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "PowerSupplyCommunicatorGAM::Initialise: %s failed to add the PowerSupplyCommunicatorGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_read = 3;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("CurrentSignal");
|
||||
CDB_move_to[1].Printf("GlobalTime");
|
||||
CDB_move_to[2].Printf("discharge_status");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"PowerSupplyCommunicatorGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"owerSupplyCommunicatorGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 2;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("soft_stop");
|
||||
CDB_move_to[1].Printf("ReceiveValue");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"owerSupplyCommunicatorGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"owerSupplyCommunicatorGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"owerSupplyCommunicatorGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
this->isCharged = False;
|
||||
this->isStarted = False;
|
||||
this->IsTriggered = False;
|
||||
this->temperatureFailure = False;
|
||||
this->voltageFailure = False;
|
||||
this->stopFailure = False;
|
||||
this->logReceivedPointer=0;
|
||||
this->logSentPointer=0;
|
||||
this->communicationFailure = False;
|
||||
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_IDLE;
|
||||
|
||||
this->logReceivedPointer = -1;
|
||||
|
||||
this->communicatorOnlineStartOperationAttempts = 0;
|
||||
this->communicatorOnlineStopOperationAttempts = 0;
|
||||
this->communicatorOnlineIdleCount=0;
|
||||
this->communicatorOnlineWaitTriggerCount=0;
|
||||
this->communicatorOnlineDischargeCount=0;
|
||||
this->communicatorOnlineStopCount=0;
|
||||
this->communicatorOnlineErrorCount=0;
|
||||
this->statisticsCurrentValue=0;
|
||||
this->statisticsTemperatureFault=0;
|
||||
this->statisticsCharged=0;
|
||||
this->statisticsNotCharged=0;
|
||||
this->statisticsVoltageFault=0;
|
||||
this->statisticsStartOk=0;
|
||||
this->statisticsStopped=0;
|
||||
this->statisticsStopFault=0;
|
||||
this->statisticsCommunicationFault=0;
|
||||
this->statisticsReceivedPackets=0;
|
||||
this->statisticsSentPackets=0;
|
||||
this->statisticsReceivedMessages=0;
|
||||
this->statisticsSentMessages=0;
|
||||
this->statisticsIncompleteMessages=0;
|
||||
this->statisticsWrongMessagesReceived=0;
|
||||
|
||||
for (i=0;i<NLOGMESSAGES;i++){
|
||||
logReceivedMessages[i] = 0;
|
||||
logSentMessages[i] = 0;
|
||||
logReceivedCurrents[i] = 0;
|
||||
logSentCurrents[i] = 0;
|
||||
logTimeReceivedMessages[i] = 0;
|
||||
logTimeSentMessages[i] = 0;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool PowerSupplyCommunicatorGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"PowerSupplyCommunicatorGAM:: %s inputstruct = %f %d %d ",this->Name(), inputstruct[0].SendValue, inputstruct[0].usecTime, inputstruct[0].DischargeStatus);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
|
||||
usectimecopy = inputstruct[0].usecTime;
|
||||
CurrentToSendCopy = (float) inputstruct[0].SendValue;
|
||||
|
||||
// PlasmaEnded -> alterar esta variavel
|
||||
// IsTriggered -> alterar tambem
|
||||
|
||||
|
||||
|
||||
|
||||
if (inputstruct[0].DischargeStatus >=0 ){
|
||||
this->GetMessages();
|
||||
this->IsTriggered = True;
|
||||
this->PlasmaEnded = False;
|
||||
outputstruct[0].ReceiveValue = this->logReceivedCurrents[this->logReceivedPointer];
|
||||
}
|
||||
else if (IsTriggered){
|
||||
this->GetMessages();
|
||||
this->PlasmaEnded = True;
|
||||
}
|
||||
|
||||
|
||||
switch(functionNumber){
|
||||
// Called once to verify if the parameter configuration is acceptable
|
||||
|
||||
// Called once before going online
|
||||
case GAMPrepulse:
|
||||
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_WAIT_CODAC_TRIGGER;
|
||||
|
||||
this->communicatorOnlineIdleCount = 0;
|
||||
this->communicatorOnlineWaitTriggerCount = 0;
|
||||
this->communicatorOnlineDischargeCount = 0;
|
||||
this->communicatorOnlineStopCount = 0;
|
||||
this->communicatorOnlineErrorCount = 0;
|
||||
this->communicatorOnlineStopOperationAttempts = 0;
|
||||
this->communicatorOnlineStartOperationAttempts = 0;
|
||||
|
||||
PlasmaEnded = False;
|
||||
break; // GAMPrepulse
|
||||
|
||||
// Called continuously when online after data has been read
|
||||
case GAMOnline:
|
||||
|
||||
if(!this->CommunicatorOnline())
|
||||
return False;
|
||||
|
||||
break; // GAMOnline
|
||||
|
||||
// Called once before going offline
|
||||
case GAMPostpulse:
|
||||
outputstruct[0].SoftStop = 0;
|
||||
// this->ResetTrigger();
|
||||
|
||||
break; // GAMPostpulse
|
||||
|
||||
// Called continuously while offline
|
||||
case GAMOffline:
|
||||
outputstruct[0].SoftStop = 0;
|
||||
if(!this->CommunicatorOffline())
|
||||
return False;
|
||||
|
||||
break; // GAMOffline
|
||||
|
||||
// Called continuously after a fault has been detected
|
||||
case GAMSafety:
|
||||
break; // GAMSafety
|
||||
|
||||
// None of the above
|
||||
default:
|
||||
break; // default
|
||||
}
|
||||
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
// Behaviour for the communicator
|
||||
bool PowerSupplyCommunicatorGAM::CommunicatorOffline(){
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
bool PowerSupplyCommunicatorGAM::CommunicatorOnline(){
|
||||
|
||||
unsigned char packet1, packet2;
|
||||
|
||||
// Iterate the online stages of the communicator state machine
|
||||
switch(this->communicatorOnlineStage)
|
||||
{
|
||||
case FA_COMMUNICATOR_ONLINE_IDLE:
|
||||
// Log the entry on this stage
|
||||
if(this->communicatorOnlineIdleCount++ == 0) AssertErrorCondition(Information, "[FACom] COMMUNICATOR_ONLINE_IDLE");
|
||||
break;
|
||||
|
||||
// Wait for the CODAC trigger
|
||||
case FA_COMMUNICATOR_ONLINE_WAIT_CODAC_TRIGGER:
|
||||
|
||||
// Log the entry on this stage
|
||||
if(this->communicatorOnlineWaitTriggerCount++ == 0) AssertErrorCondition(Information, "[FACom] COMMUNICATOR_ONLINE_WAIT_CODAC_TRIGGER");
|
||||
|
||||
if(IsTriggered)
|
||||
{
|
||||
// Send Start Operation message
|
||||
this->SendMessage(FA_STARTOP_MESSAGE_1, FA_STARTOP_MESSAGE_2);
|
||||
|
||||
// Increase attempts counter
|
||||
this->communicatorOnlineStartOperationAttempts++;
|
||||
|
||||
// Change online state
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_DISCHARGE;
|
||||
this->communicatorOnlineWaitTriggerCount = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FA_COMMUNICATOR_ONLINE_DISCHARGE:
|
||||
|
||||
// Log the entry on this stage
|
||||
//this->communicatorOnlineDischargeCount++;
|
||||
if(this->communicatorOnlineDischargeCount++ == 0)
|
||||
AssertErrorCondition(Information, "[FACom] COMMUNICATOR_ONLINE_DISCHARGE");
|
||||
|
||||
if(!this->isStarted)
|
||||
{
|
||||
// DEBUG
|
||||
//AssertErrorCondition(Information,
|
||||
// "[FACom] COMMUNICATOR_ONLINE_DISCHARGE: is NOT started");
|
||||
|
||||
// Check how many attemps were made
|
||||
if(this->communicatorOnlineStartOperationAttempts >= FA_COMMUNICATOR_MAXIMUM_ATTEMPTS)
|
||||
{
|
||||
AssertErrorCondition(Timeout, "[FACom] Start Operation Timeout: %d attemps were made", this->communicatorOnlineStartOperationAttempts);
|
||||
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_ERROR;
|
||||
this->communicatorOnlineDischargeCount = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
// Send Start Operation message
|
||||
this->SendMessage(FA_STARTOP_MESSAGE_1, FA_STARTOP_MESSAGE_2);
|
||||
|
||||
// Increase attempts counter
|
||||
this->communicatorOnlineStartOperationAttempts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// DEBUG
|
||||
//AssertErrorCondition(Information,"[FACom] COMMUNICATOR_ONLINE_DISCHARGE: is started");
|
||||
|
||||
if(PlasmaEnded)
|
||||
{
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_STOP_OPERATION;
|
||||
this->communicatorOnlineDischargeCount = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// Generate packets
|
||||
this->CreateCurrentPackets(CurrentToSendCopy, packet1, packet2);
|
||||
|
||||
// Send packets
|
||||
this->SendMessage(packet1, packet2);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FA_COMMUNICATOR_ONLINE_STOP_OPERATION:
|
||||
|
||||
// Log the entry on this stage
|
||||
if(this->communicatorOnlineStopCount++ == 0)
|
||||
AssertErrorCondition(Information, "[FACom] COMMUNICATOR_ONLINE_STOP_OPERATION");
|
||||
|
||||
if(this->isStarted)
|
||||
{
|
||||
// Check how many attemps were made
|
||||
if(this->communicatorOnlineStopOperationAttempts >= FA_COMMUNICATOR_MAXIMUM_ATTEMPTS)
|
||||
{
|
||||
AssertErrorCondition(Timeout, "[FACom] Stop Operation Timeout: %d attemps were made", this->communicatorOnlineStopOperationAttempts);
|
||||
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_ERROR;
|
||||
this->communicatorOnlineStopCount = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
// Send Stop Operation message
|
||||
this->SendMessage(FA_STOPOP_MESSAGE_1, FA_STOPOP_MESSAGE_2);
|
||||
|
||||
// Increase attempts counter
|
||||
this->communicatorOnlineStopOperationAttempts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Trigger Plasma Ended flag
|
||||
// plasmaEndedTriggerOutput = (int *) this->PlasmaEndOutputInterface->Buffer();
|
||||
// *plasmaEndedTriggerOutput = 1;
|
||||
// this->PlasmaEndOutputInterface->Write();
|
||||
|
||||
this->communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_IDLE;
|
||||
this->communicatorOnlineStopCount = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FA_COMMUNICATOR_ONLINE_ERROR:
|
||||
|
||||
AssertErrorCondition(InitialisationError, "[FACom]::%s Power supplies timeout: after %d attemps, FA_COMMUNICATOR_ONLINE_ERROR, RETURN FALSE", this->Name(), this->communicatorOnlineStopOperationAttempts);
|
||||
|
||||
return False;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
// Configure the FA UART
|
||||
bool PowerSupplyCommunicatorGAM::ConfigureUART(){
|
||||
|
||||
this->FaUART->Select950Mode();
|
||||
this->FaUART->Disable9BitMode();
|
||||
this->FaUART->SetFrequencyDivider(0x0001);
|
||||
this->FaUART->SetEightBitsLength();
|
||||
this->FaUART->SetOddParity();
|
||||
this->FaUART->SelectTwoStopBits();
|
||||
this->FaUART->EnableFifos();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
// Send a message to the power supplies
|
||||
void PowerSupplyCommunicatorGAM::SendMessage(unsigned char packet1, unsigned char packet2){
|
||||
// Send message packets
|
||||
this->FaUART->SendValue(packet1);
|
||||
this->FaUART->SendValue(packet2);
|
||||
|
||||
// Update sent counters
|
||||
this->statisticsSentPackets += 2;
|
||||
this->statisticsSentMessages++;
|
||||
}
|
||||
// Create/Decode current packets
|
||||
bool PowerSupplyCommunicatorGAM::CreateCurrentPackets(float current, unsigned char &packet1, unsigned char &packet2){
|
||||
|
||||
// Calculate the point in the scale of the current
|
||||
short pointOfCurrent = (short)(this->PointOfZeroCurrent + current / this->CurrentStep);
|
||||
|
||||
// Saturate current
|
||||
if(pointOfCurrent < FA_SCALE_MIN)
|
||||
pointOfCurrent = FA_SCALE_MIN;
|
||||
if(pointOfCurrent > FA_SCALE_MAX)
|
||||
pointOfCurrent = FA_SCALE_MAX;
|
||||
|
||||
// Build packets
|
||||
unsigned short pc = (unsigned short) pointOfCurrent;
|
||||
unsigned short nc = ~pc;
|
||||
packet1 = (unsigned char)(0x0000 |
|
||||
((nc & 0x03C0) >> 5) |
|
||||
((pc & 0x0007) << 5));
|
||||
packet2 = (unsigned char)(0x0001 |
|
||||
((pc & 0x03F8) >> 2));
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
// Get messages in the buffer
|
||||
void PowerSupplyCommunicatorGAM::GetMessages(){
|
||||
|
||||
unsigned int packetCounter = 0;
|
||||
unsigned short packet;
|
||||
|
||||
while(this->FaUART->IsDataAvailable())
|
||||
{
|
||||
// Increment packet counter and check if maximum allowed packets were attained
|
||||
if(++packetCounter > FA_COMMUNICATION_MAX_PACKETS)
|
||||
break;
|
||||
|
||||
// Get the next packet
|
||||
this->FaUART->ReadValue(packet);
|
||||
|
||||
// Increment total packet counter
|
||||
this->statisticsReceivedPackets++;
|
||||
|
||||
// DEBUG
|
||||
//AssertErrorCondition(InitialisationError,
|
||||
// "Packet received (%d): 0x%02x %d", packetCounter, packet, packet);
|
||||
|
||||
|
||||
// Received a starting packet, clear the packet buffer
|
||||
if((packet & FA_FRAMING_BIT_MASK) == 0)
|
||||
{
|
||||
// Update count if no complete message is received
|
||||
if(this->numMessagePackets != 0)
|
||||
this->statisticsIncompleteMessages++;
|
||||
|
||||
this->numMessagePackets = 0;
|
||||
this->receivedStartingPacket = True;
|
||||
}
|
||||
|
||||
// Add packet to the buffer and increment packet counter
|
||||
this->messagePackets[this->numMessagePackets] = packet;
|
||||
this->numMessagePackets++;
|
||||
|
||||
// Message complete, process message
|
||||
if(this->numMessagePackets == 2)
|
||||
{
|
||||
// Guarantee that a starting packet was received
|
||||
if(this->receivedStartingPacket)
|
||||
{
|
||||
// Interpret message
|
||||
this->InterpretMessage((unsigned char) messagePackets[0], (unsigned char) messagePackets[1]);
|
||||
}
|
||||
|
||||
this->statisticsReceivedMessages++;
|
||||
|
||||
// Clear packet counter and flags
|
||||
this->numMessagePackets = 0;
|
||||
this->receivedStartingPacket = False;
|
||||
}
|
||||
} // while(this->FaUART->IsDataAvailable())
|
||||
}
|
||||
|
||||
bool PowerSupplyCommunicatorGAM::DecodeCurrentPackets(float ¤t, unsigned char packet1, unsigned char packet2){
|
||||
// Validate packets
|
||||
unsigned char validation = (packet2 & 0xF0) ^ ((packet1 & 0x1E) << 3);
|
||||
if(validation != 0xF0)
|
||||
{
|
||||
this->statisticsWrongMessagesReceived++;
|
||||
return False;
|
||||
}
|
||||
else this->statisticsWrongMessagesReceived=0;
|
||||
|
||||
// Decode packets
|
||||
short pointOfCurrent = (short)( (((unsigned short) packet1 & 0x00E0) >> 5) | (((unsigned short) packet2 & 0x00FE) << 2));
|
||||
|
||||
// Calculate the current
|
||||
current = ((float) pointOfCurrent - this->PointOfZeroCurrent) * this->CurrentStep;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
// Implement message interpretation functionalities
|
||||
void PowerSupplyCommunicatorGAM::InterpretMessage(unsigned char packet1, unsigned char packet2){
|
||||
|
||||
// Increment log pointer
|
||||
this->logReceivedPointer++;
|
||||
if(this->logReceivedPointer >= NLOGMESSAGES)
|
||||
this->logReceivedPointer = 0;
|
||||
|
||||
this->logTimeReceivedMessages[this->logReceivedPointer] = this->usectimecopy;
|
||||
|
||||
// Operation Started message
|
||||
if((packet1 == FA_STARTED_MESSAGE_1) && (packet2 == FA_STARTED_MESSAGE_2))
|
||||
{
|
||||
|
||||
this->isStarted = True;
|
||||
this->statisticsStartOk++;
|
||||
this->logReceivedMessages[this->logReceivedPointer] = LOG_STARTED;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Operation Stopped message
|
||||
if((packet1 == FA_STOPPED_MESSAGE_1) && (packet2 == FA_STOPPED_MESSAGE_2)){
|
||||
|
||||
this->isStarted = False;
|
||||
this->statisticsStopped++;
|
||||
this->logReceivedMessages[this->logReceivedPointer] = LOG_STOPPED;
|
||||
this->IsTriggered = False;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop Error message
|
||||
if((packet1 == FA_STOP_ERROR_MESSAGE_1) && (packet2 == FA_STOP_ERROR_MESSAGE_2)){
|
||||
|
||||
this->stopFailure = True;
|
||||
this->statisticsStopFault++;
|
||||
this->logReceivedMessages[this->logReceivedPointer] = LOG_STOP_FAULT;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Communication Error message
|
||||
if((packet1 == FA_COMM_ERROR_MESSAGE_1) && (packet2 == FA_COMM_ERROR_MESSAGE_2)) {
|
||||
|
||||
this->communicationFailure = True;
|
||||
this->statisticsCommunicationFault++;
|
||||
this->logReceivedMessages[this->logReceivedPointer] = LOG_COMMUNICATION_FAULT;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Current Value
|
||||
this->logReceivedMessages[this->logReceivedPointer] = LOG_CURRENT_VALUE;
|
||||
float current;
|
||||
if(this->DecodeCurrentPackets(current, packet1, packet2))
|
||||
this->logReceivedCurrents[this->logReceivedPointer] = current;
|
||||
else
|
||||
this->logReceivedCurrents[this->logReceivedPointer] = 0.0;
|
||||
|
||||
// Other messages
|
||||
}
|
||||
|
||||
bool PowerSupplyCommunicatorGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>UARTPortAddress = %X\n\
|
||||
<br>PointOfZeroCurrent = %.2f\n\
|
||||
<br>CurrentStep = %.2f\n\
|
||||
<br>usecGlobalPeriod = %d\n\
|
||||
<br><br",this->UARTPortAddress,this->PointOfZeroCurrent,this->CurrentStep,this->usecGlobalPeriod);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "h1");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "center");
|
||||
hmStream.Printf("Fast Amplifier Communicator");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/center");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/h1");
|
||||
|
||||
|
||||
// ******************************************************
|
||||
// FA status
|
||||
// ******************************************************
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "h2");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "center");
|
||||
hmStream.Printf("Fast Amplifier Status");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/center");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/h2");
|
||||
|
||||
hStream.Printf("<TABLE BORDER=\"2\" BORDERCOLOR=\"#336699\" CELLPADDING=\"2\" CELLSPACING=\"2\" WIDTH=\"100%%\">\n");
|
||||
hStream.Printf("<TR><TH>Parameter</TH><TH>Value</TH></TR>\n");
|
||||
if(this->isCharged)
|
||||
hStream.Printf("<TR><TD>Charged</TD><TD><FONT COLOR=\"#00FF00\">Yes!</FONT></TD></TR>\n");
|
||||
else
|
||||
hStream.Printf("<TR><TD>Charged</TD><TD><FONT COLOR=\"#FF0000\">No!</FONT></TD></TR>\n");
|
||||
if(this->isStarted)
|
||||
hStream.Printf("<TR><TD>Operation Started</TD><TD><FONT COLOR=\"#00FF00\">Yes!</FONT></TD></TR>\n");
|
||||
else
|
||||
hStream.Printf("<TR><TD>Operation Started</TD><TD><FONT COLOR=\"#FF0000\">No!</FONT></TD></TR>\n");
|
||||
if(!this->temperatureFailure)
|
||||
hStream.Printf("<TR><TD>Temperature</TD><TD><FONT COLOR=\"#00FF00\">OK!</FONT></TD></TR>\n");
|
||||
else
|
||||
hStream.Printf("<TR><TD>Temperature</TD><TD><FONT COLOR=\"#FF0000\">Failure!</FONT></TD></TR>\n");
|
||||
if(!this->voltageFailure)
|
||||
hStream.Printf("<TR><TD>Voltage</TD><TD><FONT COLOR=\"#00FF00\">OK!</FONT></TD></TR>\n");
|
||||
else
|
||||
hStream.Printf("<TR><TD>Voltage</TD><TD><FONT COLOR=\"#FF0000\">Failure!</FONT></TD></TR>\n");
|
||||
if(!this->stopFailure)
|
||||
hStream.Printf("<TR><TD>Stopped</TD><TD><FONT COLOR=\"#00FF00\">OK!</FONT></TD></TR>\n");
|
||||
else
|
||||
hStream.Printf("<TR><TD>Stopped</TD><TD><FONT COLOR=\"#FF0000\">Failure!</FONT></TD></TR>\n");
|
||||
hStream.Printf("</TABLE>\n");
|
||||
|
||||
// ******************************************************
|
||||
// FA calibration
|
||||
// ******************************************************
|
||||
|
||||
// ******************************************************
|
||||
// Communication statistics
|
||||
// ******************************************************
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "h2");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "center");
|
||||
hmStream.Printf("Communication Statistics");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/center");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/h2");
|
||||
|
||||
hStream.Printf("<TABLE BORDER=\"2\" BORDERCOLOR=\"#336699\" CELLPADDING=\"2\" CELLSPACING=\"2\" WIDTH=\"100%%\">\n");
|
||||
hStream.Printf("<TR><TD></TD><TD>Number of Occurrences</TD></TR>\n");
|
||||
hStream.Printf("<TR><TD>Packets Sent</TD><TD>%d</TD></TR>\n", this->statisticsSentPackets);
|
||||
hStream.Printf("<TR><TD>Packets Received</TD><TD>%d</TD></TR>\n", this->statisticsReceivedPackets);
|
||||
hStream.Printf("<TR><TD>Messages Sent</TD><TD>%d</TD></TR>\n", this->statisticsSentMessages);
|
||||
hStream.Printf("<TR><TD>Messages Received</TD><TD>%d</TD></TR>\n", this->statisticsReceivedMessages);
|
||||
hStream.Printf("<TR><TD>Incomplete Messages</TD><TD>%d</TD></TR>\n", this->statisticsIncompleteMessages);
|
||||
hStream.Printf("<TR><TD>Wrong Messages</TD><TD>%d</TD></TR>\n", this->statisticsWrongMessagesReceived);
|
||||
hStream.Printf("</TABLE>\n");
|
||||
|
||||
hStream.Printf("<TABLE BORDER=\"2\" BORDERCOLOR=\"#336699\" CELLPADDING=\"2\" CELLSPACING=\"2\" WIDTH=\"100%%\">\n");
|
||||
hStream.Printf("<TR><TD>Received Messages</TD><TD>Number of Occurrences</TD></TR>\n");
|
||||
hStream.Printf("<TR><TD>Current Value</TD><TD>%d</TD></TR>\n", this->statisticsCurrentValue);
|
||||
hStream.Printf("<TR><TD>Charged</TD><TD>%d</TD></TR>\n", this->statisticsCharged);
|
||||
hStream.Printf("<TR><TD>Not Charged</TD><TD>%d</TD></TR>\n", this->statisticsNotCharged);
|
||||
hStream.Printf("<TR><TD>Start OK</TD><TD>%d</TD></TR>\n", this->statisticsStartOk);
|
||||
hStream.Printf("<TR><TD>Stopped</TD><TD>%d</TD></TR>\n", this->statisticsStopped);
|
||||
hStream.Printf("<TR><TD>Stop Fault</TD><TD>%d</TD></TR>\n", this->statisticsStopFault);
|
||||
hStream.Printf("<TR><TD>Temperature Fault</TD><TD>%d</TD></TR>\n", this->statisticsTemperatureFault);
|
||||
hStream.Printf("<TR><TD>Voltage Fault</TD><TD>%d</TD></TR>\n", this->statisticsVoltageFault);
|
||||
hStream.Printf("<TR><TD>Communication Fault</TD><TD>%d</TD></TR>\n", this->statisticsCommunicationFault);
|
||||
hStream.Printf("</TABLE>\n");
|
||||
|
||||
// ******************************************************
|
||||
// Message Logs
|
||||
// ******************************************************
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "h2");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "center");
|
||||
hmStream.Printf("Message Logs");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/center");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/h2");
|
||||
|
||||
hmStream.Printf("N Log = %d", this->logReceivedPointer);
|
||||
|
||||
/*
|
||||
hStream.Printf("<TABLE BORDER=\"2\" BORDERCOLOR=\"#336699\" CELLPADDING=\"2\" CELLSPACING=\"2\" WIDTH=\"100%%\">\n");
|
||||
hStream.Printf("<TR><TD>Time</TD><TD>Sent Message</TD></TR>\n");
|
||||
for(int i = 0 ; i < this->logSentPointer ; i++)
|
||||
hStream.Printf("<TR><TD>?</TD><TD>%d</TD></TR>\n", this->logTimeSentMessages[i], this->logSentMessages[i]);
|
||||
for(int i = this->logSentPointer ; i < NLOGMESSAGES ; i++)
|
||||
hStream.Printf("<TR><TD>?</TD><TD>%d</TD></TR>\n", this->logTimeSentMessages[i], this->logSentMessages[i]);
|
||||
hStream.Printf("</TABLE>\n");
|
||||
*/
|
||||
hStream.Printf("<TABLE BORDER=\"2\" BORDERCOLOR=\"#336699\" CELLPADDING=\"2\" CELLSPACING=\"2\" WIDTH=\"100%%\">\n");
|
||||
hStream.Printf("<TR><TD>Time</TD><TD>Received Message</TD></TR>\n");
|
||||
int index = this->logReceivedPointer + 1;
|
||||
while(1)
|
||||
{
|
||||
FString msgText;
|
||||
switch(this->logReceivedMessages[index])
|
||||
{
|
||||
case LOG_TEMPERATURE_FAULT:
|
||||
msgText.Printf("Temperature Fault");
|
||||
break;
|
||||
|
||||
case LOG_24V_FAULT:
|
||||
msgText.Printf("24V Fault");
|
||||
break;
|
||||
|
||||
case LOG_COMMUNICATION_FAULT:
|
||||
msgText.Printf("Communication Fault");
|
||||
break;
|
||||
|
||||
case LOG_CHARGED:
|
||||
msgText.Printf("Charged");
|
||||
break;
|
||||
|
||||
case LOG_NOT_CHARGED:
|
||||
msgText.Printf("Not Charged");
|
||||
break;
|
||||
|
||||
case LOG_STARTED:
|
||||
msgText.Printf("Started");
|
||||
break;
|
||||
|
||||
case LOG_STOPPED:
|
||||
msgText.Printf("Stopped");
|
||||
break;
|
||||
|
||||
case LOG_STOP_FAULT:
|
||||
msgText.Printf("Stop Fault");
|
||||
break;
|
||||
|
||||
case LOG_CURRENT_VALUE:
|
||||
msgText.Printf("Current Value");
|
||||
break;
|
||||
|
||||
default:
|
||||
msgText.Printf("None");
|
||||
break;
|
||||
}
|
||||
|
||||
if(this->logReceivedMessages[index] != LOG_CURRENT_VALUE)
|
||||
hStream.Printf("<TR><TD>%d</TD><TD>%s</TD></TR>\n",
|
||||
this->logTimeReceivedMessages[index],
|
||||
msgText.Buffer());
|
||||
else
|
||||
hStream.Printf("<TR><TD>%d</TD><TD>%s (%f A)</TD></TR>\n",
|
||||
this->logTimeReceivedMessages[index],
|
||||
msgText.Buffer(),
|
||||
this->logReceivedCurrents[index]);
|
||||
|
||||
if(++index >= NLOGMESSAGES)
|
||||
index = 0;
|
||||
if(index == this->logReceivedPointer + 1)
|
||||
break;
|
||||
}
|
||||
hStream.Printf("</TABLE>\n");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
#ifndef _POWERSUPPLYCOMMUNICATORGAM_H
|
||||
#define _POWERSUPPLYCOMMUNICATORGAM_H
|
||||
|
||||
|
||||
//#define __FA_COM_LOG_RECEIVED_MESSAGES
|
||||
//#define ___FA_COM_LOG_SENT_MESSAGES
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
#include "UFSerialUART.h"
|
||||
|
||||
|
||||
#define FA_CHARGE_MESSAGE_1 0x6C
|
||||
#define FA_CHARGE_MESSAGE_2 0x6D
|
||||
#define FA_SHUTDOWN_MESSAGE_1 0x92
|
||||
#define FA_SHUTDOWN_MESSAGE_2 0x93
|
||||
#define FA_STARTOP_MESSAGE_1 0xFE
|
||||
#define FA_STARTOP_MESSAGE_2 0xFF
|
||||
#define FA_STOPOP_MESSAGE_1 0x00
|
||||
#define FA_STOPOP_MESSAGE_2 0x01
|
||||
|
||||
#define FA_STARTED_MESSAGE_1 0xFE
|
||||
#define FA_STARTED_MESSAGE_2 0xFF
|
||||
#define FA_STOPPED_MESSAGE_1 0x00
|
||||
#define FA_STOPPED_MESSAGE_2 0x01
|
||||
#define FA_STOP_ERROR_MESSAGE_1 0x24
|
||||
#define FA_STOP_ERROR_MESSAGE_2 0x25
|
||||
#define FA_COMM_ERROR_MESSAGE_1 0xDA
|
||||
#define FA_COMM_ERROR_MESSAGE_2 0xDB
|
||||
|
||||
#define FA_COMMUNICATION_MAX_PACKETS 4
|
||||
#define FA_FRAMING_BIT_MASK 0x01
|
||||
|
||||
#define FA_SCALE_MIN 0
|
||||
#define FA_SCALE_MAX 1023
|
||||
|
||||
|
||||
#define LOG_CHARGE 1
|
||||
#define LOG_SHUTDOWN 2
|
||||
#define LOG_STARTOP 3
|
||||
#define LOG_STOPOP 4
|
||||
#define LOG_TEMPERATURE_FAULT 5
|
||||
#define LOG_24V_FAULT 6
|
||||
#define LOG_CHARGED 7
|
||||
#define LOG_NOT_CHARGED 8
|
||||
#define LOG_STARTED 9
|
||||
#define LOG_STOPPED 10
|
||||
#define LOG_STOP_FAULT 11
|
||||
#define LOG_COMMUNICATION_FAULT 12
|
||||
#define LOG_CURRENT_VALUE 13
|
||||
|
||||
// Logging #defines
|
||||
//#define __FA_COM_LOG_RECEIVED_MESSAGES
|
||||
//#define ___FA_COM_LOG_SENT_MESSAGES
|
||||
#define __FA_COM_LOG_LEVEL InitialisationError
|
||||
|
||||
|
||||
// Communicator Online Stages
|
||||
#define FA_COMMUNICATOR_ONLINE_IDLE 0
|
||||
#define FA_COMMUNICATOR_ONLINE_WAIT_CODAC_TRIGGER 1
|
||||
#define FA_COMMUNICATOR_ONLINE_DISCHARGE 2
|
||||
#define FA_COMMUNICATOR_ONLINE_STOP_OPERATION 3
|
||||
#define FA_COMMUNICATOR_ONLINE_ERROR 4
|
||||
|
||||
#define FA_COMMUNICATOR_MAXIMUM_ATTEMPTS 5
|
||||
|
||||
|
||||
OBJECT_DLL(PowerSupplyCommunicatorGAM)
|
||||
|
||||
|
||||
class PowerSupplyCommunicatorGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float SendValue;
|
||||
int32 usecTime;
|
||||
int32 DischargeStatus;
|
||||
};
|
||||
|
||||
struct OutputInterfaceStruct {
|
||||
int32 SoftStop;
|
||||
float ReceiveValue;
|
||||
};
|
||||
|
||||
|
||||
int32 usectimecopy;
|
||||
float CurrentToSendCopy;
|
||||
|
||||
int32 UARTPortAddress;
|
||||
float PointOfZeroCurrent;
|
||||
float CurrentStep;
|
||||
int usecGlobalPeriod;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
// Status
|
||||
bool temperatureFailure;
|
||||
bool voltageFailure;
|
||||
bool communicationFailure;
|
||||
bool stopFailure;
|
||||
bool isCharged;
|
||||
bool isStarted;
|
||||
|
||||
bool PlasmaEnded;
|
||||
bool IsTriggered;
|
||||
|
||||
// Communicator online behaviour
|
||||
int communicatorOnlineStage;
|
||||
int communicatorOnlineStartOperationAttempts;
|
||||
int communicatorOnlineStopOperationAttempts;
|
||||
|
||||
int communicatorOnlineIdleCount;
|
||||
int communicatorOnlineWaitTriggerCount;
|
||||
int communicatorOnlineDischargeCount;
|
||||
int communicatorOnlineStopCount;
|
||||
int communicatorOnlineErrorCount;
|
||||
|
||||
|
||||
// Communication Statistics
|
||||
uint64 statisticsCurrentValue;
|
||||
uint64 statisticsTemperatureFault;
|
||||
uint64 statisticsCharged;
|
||||
uint64 statisticsNotCharged;
|
||||
uint64 statisticsVoltageFault;
|
||||
uint64 statisticsStartOk;
|
||||
uint64 statisticsStopped;
|
||||
uint64 statisticsStopFault;
|
||||
uint64 statisticsCommunicationFault;
|
||||
|
||||
// Logging
|
||||
#define NLOGMESSAGES 1000
|
||||
uint16 logReceivedMessages[NLOGMESSAGES];
|
||||
uint16 logSentMessages[NLOGMESSAGES];
|
||||
float logReceivedCurrents[NLOGMESSAGES];
|
||||
float logSentCurrents[NLOGMESSAGES];
|
||||
uint16 logTimeReceivedMessages[NLOGMESSAGES];
|
||||
uint16 logTimeSentMessages[NLOGMESSAGES];
|
||||
int logReceivedPointer;
|
||||
int logSentPointer;
|
||||
|
||||
// Structures
|
||||
struct CurrentSignals
|
||||
{
|
||||
uint32 TimingSignal;
|
||||
float CurrentSignal;
|
||||
};
|
||||
|
||||
// Serial UART
|
||||
UFSerialUART *FaUART;
|
||||
|
||||
// FA message packets
|
||||
bool receivedStartingPacket;
|
||||
int numMessagePackets;
|
||||
unsigned short messagePackets[2];
|
||||
|
||||
// Communication statistics
|
||||
uint64 statisticsReceivedPackets;
|
||||
uint64 statisticsSentPackets;
|
||||
uint64 statisticsReceivedMessages;
|
||||
uint64 statisticsSentMessages;
|
||||
uint64 statisticsIncompleteMessages;
|
||||
uint64 statisticsWrongMessagesReceived;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Default constructor
|
||||
PowerSupplyCommunicatorGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~PowerSupplyCommunicatorGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
// Builds the HTTP page with information about the power supplies
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
// Implement message interpretation functionalities
|
||||
void InterpretMessage(unsigned char packet1, unsigned char packet2);
|
||||
|
||||
// Behaviour for the communicator
|
||||
bool CommunicatorOnline();
|
||||
bool CommunicatorOffline();
|
||||
|
||||
// Configure the FA UART
|
||||
bool ConfigureUART();
|
||||
|
||||
// Send a message to the FA
|
||||
void SendMessage(unsigned char packet1, unsigned char packet2);
|
||||
|
||||
// Get messages in the buffer
|
||||
void GetMessages();
|
||||
|
||||
// Create current packets
|
||||
bool CreateCurrentPackets(float current, unsigned char &packet1, unsigned char &packet2);
|
||||
|
||||
// Decode current packets
|
||||
bool DecodeCurrentPackets(float ¤t, unsigned char packet1, unsigned char packet2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
OBJECT_DLL_STUFF(PowerSupplyCommunicatorGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,602 @@
|
||||
/*
|
||||
ivoc - ivoc@ipfn.ist.utl.pt
|
||||
|
||||
Description: this set of functions can be used in sequence (or in separate) to draw an automatic SVG Graphic given any x/y set of point in two separate vectors
|
||||
first use DualVectorSort to sort the values, then use RemoveRepeatedValues to remove the repeated points.
|
||||
After this use OptimalDisplayFromVectors for obtaining the optimal zoom parameters for GetGraphSVG, wich writes a FString containing SVG code for the grafic
|
||||
reminder: there is no < and > at the begining and by the end on the code becaus it is intended to be used in a ::ProcessHttpMessage(HttpStream &hStream) with hmStream.SSPrintf(HtmlTagStreamMode, temp_string_1.Buffer()); that contains the <> tags
|
||||
*/
|
||||
#include "SVGGraphicSupport.h"
|
||||
|
||||
// SVG graph properties
|
||||
#define MAJOR_TICK_LIMIT_NUMBER 20
|
||||
#define MINOR_TICK_LIMIT_NUMBER 10
|
||||
#define MINIMUM_WIDTH 100
|
||||
#define MINIMUM_HEIGHT 100
|
||||
#define MINIMUM_VECTOR_DIM 2
|
||||
|
||||
SVGGraphicSupport::SVGGraphicSupport(){
|
||||
|
||||
}
|
||||
SVGGraphicSupport::~SVGGraphicSupport(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool SVGGraphicSupport::GetGraphSVG(FString * SVG_FString,char instance_name[],int vector_dim,float * vector_x,float * vector_y, int width,int height,float x_min,float y_min,float x_max,float y_max,float major_tick_x,float major_tick_y,int number_of_sub_ticks_x,int number_of_sub_ticks_y,bool legend_on_major_tick_x,bool legend_on_major_tick_y) {
|
||||
|
||||
|
||||
if(vector_dim < MINIMUM_VECTOR_DIM) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> vector_dim < MINIMUM_VECTOR_DIM, vector_dim =%d",instance_name,vector_dim);
|
||||
return False;
|
||||
}
|
||||
if(x_min >= x_max) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> x_min >= x_max",instance_name);
|
||||
return False;
|
||||
}
|
||||
if(y_min >= y_max) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> y_min >= y_max",instance_name);
|
||||
return False;
|
||||
}
|
||||
|
||||
float number_of_major_ticks_x = (x_max - x_min)/major_tick_x;
|
||||
float number_of_major_ticks_y = (y_max - y_min)/major_tick_y;
|
||||
|
||||
if(number_of_major_ticks_x > MAJOR_TICK_LIMIT_NUMBER) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> major_tick_x > MAJOR_TICK_LIMIT_NUMBER, number_of_major_ticks_x = %f",instance_name,number_of_major_ticks_x);
|
||||
return False;
|
||||
}
|
||||
if(number_of_major_ticks_y > MAJOR_TICK_LIMIT_NUMBER) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> major_tick_y > MAJOR_TICK_LIMIT_NUMBER,number_of_major_ticks_y = %f",instance_name,number_of_major_ticks_y);
|
||||
return False;
|
||||
}
|
||||
if(number_of_sub_ticks_x > MINOR_TICK_LIMIT_NUMBER) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> number_of_sub_ticks_x > MINOR_TICK_LIMIT_NUMBER, number_of_sub_ticks_x = %d",instance_name,number_of_sub_ticks_x);
|
||||
return False;
|
||||
}
|
||||
if(number_of_sub_ticks_y > MINOR_TICK_LIMIT_NUMBER) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> number_of_sub_ticks_y > MINOR_TICK_LIMIT_NUMBER, number_of_sub_ticks_y = %d",instance_name,number_of_sub_ticks_y);
|
||||
return False;
|
||||
}
|
||||
if(width < MINIMUM_WIDTH && width != -1) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> width < MINIMUM_WIDTH || width != -1, width = %d",instance_name, width);
|
||||
return False;
|
||||
}
|
||||
if(height < MINIMUM_HEIGHT) {
|
||||
CStaticAssertErrorCondition(InitialisationError,"SVGGraphicSupport.h:: %s !!! GetGraphSVG -> height < MINIMUM_HEIGHT, height = %d",instance_name,height);
|
||||
return False;
|
||||
}
|
||||
|
||||
FString temp_string_2;
|
||||
FString buffer_fstring;
|
||||
|
||||
float temp_cursor;
|
||||
float small_tick;
|
||||
float position;
|
||||
int j;
|
||||
int k;
|
||||
|
||||
float pos_x;
|
||||
float pos_xx;
|
||||
float pos_y;
|
||||
float pos_yy;
|
||||
|
||||
if (width == -1) {
|
||||
// width = 100% -> html code for % is %
|
||||
|
||||
|
||||
temp_string_2.Printf("svg width=\"100%\" height=\"%d\">\n", height);
|
||||
|
||||
// if not x_min <= 0 <= x_max
|
||||
if( x_min*x_max > 0) {
|
||||
|
||||
temp_cursor = x_min; //first grey line to be drawn
|
||||
small_tick = major_tick_x / (number_of_sub_ticks_x+1);
|
||||
while (temp_cursor < x_max) {
|
||||
|
||||
position = 2+((temp_cursor-x_min)*((100-2)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
// text with the major ticks legend
|
||||
if(legend_on_major_tick_x) {
|
||||
buffer_fstring.Printf("<text x=\"%f%\" y=\"%d\" style=\"font-family:Arial;font-size:10\">%.2f</text>\n",position, (height-1),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = 2+((temp_cursor+(k+1)*small_tick-x_min)*((100-2)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
}
|
||||
temp_cursor += major_tick_x;
|
||||
}
|
||||
} else {
|
||||
|
||||
temp_cursor = 0; //first grey line to be drawn
|
||||
small_tick = major_tick_x / (number_of_sub_ticks_x+1);
|
||||
while (temp_cursor < x_max) {
|
||||
|
||||
position = 2+((temp_cursor-x_min)*((100-2)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
// text with the major ticks legend
|
||||
if(legend_on_major_tick_x) {
|
||||
buffer_fstring.Printf("<text x=\"%f%\" y=\"%d\" style=\"font-family:Arial;font-size:10\">%.2f</text>\n",position, (height-1),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = 2+((temp_cursor+(k+1)*small_tick-x_min)*((100-2)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
}
|
||||
temp_cursor += major_tick_x;
|
||||
}
|
||||
temp_cursor = 0;
|
||||
while (temp_cursor > x_min) {
|
||||
|
||||
position = 2+((temp_cursor-x_min)*((100-2)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
// text with the major ticks legend
|
||||
if(legend_on_major_tick_x) {
|
||||
buffer_fstring.Printf("<text x=\"%f%\" y=\"%d\" style=\"font-family:Arial;font-size:10\">%.2f</text>\n",position, (height-1),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = 2+((temp_cursor-(k+1)*small_tick-x_min)*((100-2)/(x_max-x_min)));
|
||||
if ((temp_cursor-(k+1)*small_tick) > x_min) {
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
}
|
||||
}
|
||||
temp_cursor -= major_tick_x;
|
||||
}
|
||||
//dark xx axes
|
||||
temp_cursor = 0;
|
||||
position = 2+((temp_cursor-x_min)*((100-2)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"0\" x2=\"%f%\" y2=\"%d\" style=\"stroke:rgb(0,0,100);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if not y_min <= 0 <= y_max
|
||||
if( y_min*y_max > 0) {
|
||||
|
||||
temp_cursor = y_min; //first grey line to be drawn
|
||||
small_tick = major_tick_y / (number_of_sub_ticks_y+1);
|
||||
while (temp_cursor < y_max) {
|
||||
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position);
|
||||
|
||||
if(legend_on_major_tick_y) {
|
||||
// text with the major ticks legend
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"0\" transform=\"rotate(90 0,0)\" style=\"font-family:Arial;font-size:10\">%.1f</text>\n",(position-4),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = (y_max-temp_cursor-(k+1)*small_tick)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position);
|
||||
}
|
||||
temp_cursor += major_tick_y;
|
||||
}
|
||||
} else {
|
||||
temp_cursor = 0; //first grey line to be drawn
|
||||
small_tick = major_tick_y / (number_of_sub_ticks_y+1);
|
||||
while (temp_cursor < y_max) {
|
||||
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position);
|
||||
|
||||
if(legend_on_major_tick_y) {
|
||||
// text with the major ticks legend
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"0\" transform=\"rotate(90 0,0)\" style=\"font-family:Arial;font-size:10\">%.1f</text>\n",(position-4),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = (y_max-temp_cursor-(k+1)*small_tick)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position);
|
||||
}
|
||||
temp_cursor += major_tick_y;
|
||||
}
|
||||
|
||||
temp_cursor = 0;
|
||||
while (temp_cursor > y_min) {
|
||||
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position);
|
||||
|
||||
if(legend_on_major_tick_y) {
|
||||
// text with the major ticks legend
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"0\" transform=\"rotate(90 0,0)\" style=\"font-family:Arial;font-size:10\">%.1f</text>\n",(position-4),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = (y_max-temp_cursor+(k+1)*small_tick)*((height-10)/(y_max-y_min));
|
||||
if((temp_cursor-(k+1)*small_tick) > y_min) {
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position);
|
||||
}
|
||||
}
|
||||
temp_cursor -= major_tick_y;
|
||||
}
|
||||
// dark yy axes
|
||||
temp_cursor = 0;
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"%f\" x2=\"100%\" y2=\"%f\" style=\"stroke:rgb(0,0,100);stroke-width:1\"/>\n", position, position);
|
||||
}
|
||||
|
||||
pos_x = 2+(((*(vector_x))-x_min)*((100-2)/(x_max-x_min)));
|
||||
pos_y = (y_max-(*(vector_y)))*((height-10)/(y_max-y_min));
|
||||
|
||||
// Now draw the waveform
|
||||
for (j=1; j < (vector_dim); j++) {
|
||||
|
||||
pos_xx = 2+(((*(vector_x + j))-x_min)*((100-2)/(x_max-x_min)));
|
||||
pos_yy = (y_max-(*(vector_y + j)))*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"%f%\" y1=\"%f\" x2=\"%f%\" y2=\"%f\" style=\"stroke:rgb(255,0,0);stroke-width:2\"/>\n",pos_x,pos_y,pos_xx,pos_yy);
|
||||
pos_x = pos_xx;
|
||||
pos_y = pos_yy;
|
||||
}
|
||||
// Draw the outter part of the graph
|
||||
buffer_fstring.Printf("<line x1=\"2%\" y1=\"1\" x2=\"100%\" y2=\"1\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n\
|
||||
<line x1=\"2%\" y1=\"%d\" x2=\"100%\" y2=\"%d\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n\
|
||||
<line x1=\"2%\" y1=\"0\" x2=\"2%\" y2=\"%d\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n\
|
||||
<line x1=\"100%\" y1=\"0;\" x2=\"100%\" y2=\"%d\" style=\"stroke:rgb(0,0,0);stroke-width:3\"/>",(height-10),(height-10),(height-10),(height-10));
|
||||
temp_string_2 += buffer_fstring.Buffer();
|
||||
|
||||
temp_string_2 += "</svg";
|
||||
}
|
||||
else {
|
||||
|
||||
temp_string_2.Printf("svg width=\"%d\" height=\"%d\">\n",width, height);
|
||||
|
||||
// if not x_min <= 0 <= x_max
|
||||
if( x_min*x_max > 0) {
|
||||
|
||||
temp_cursor = x_min; //first grey line to be drawn
|
||||
small_tick = major_tick_x / (number_of_sub_ticks_x+1);
|
||||
while (temp_cursor < x_max) {
|
||||
|
||||
position = 10+((temp_cursor-x_min)*((width-10)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
// text with the major ticks legend
|
||||
if(legend_on_major_tick_x) {
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"%d\" style=\"font-family:Arial;font-size:10\">%.2f</text>\n",position, (height-1),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = 10+((temp_cursor+(k+1)*small_tick-x_min)*((width-10)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
}
|
||||
temp_cursor += major_tick_x;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
temp_cursor = 0; //first grey line to be drawn
|
||||
small_tick = major_tick_x / (number_of_sub_ticks_x+1);
|
||||
while (temp_cursor < x_max) {
|
||||
|
||||
position = 10+((temp_cursor-x_min)*((width-10)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
// text with the major ticks legend
|
||||
if(legend_on_major_tick_x) {
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"%d\" style=\"font-family:Arial;font-size:10\">%.2f</text>\n",position, (height-1),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = 10+((temp_cursor+(k+1)*small_tick-x_min)*((width-10)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
}
|
||||
temp_cursor += major_tick_x;
|
||||
}
|
||||
temp_cursor = 0;
|
||||
while (temp_cursor > x_min) {
|
||||
|
||||
position = 10+((temp_cursor-x_min)*((width-10)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
// text with the major ticks legend
|
||||
if(legend_on_major_tick_x) {
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"%d\" style=\"font-family:Arial;font-size:10\">%.2f</text>\n",position, (height-1),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = 10+((temp_cursor-(k+1)*small_tick-x_min)*((width-10)/(x_max-x_min)));
|
||||
if ((temp_cursor-(k+1)*small_tick) > x_min) {
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
}
|
||||
}
|
||||
temp_cursor -= major_tick_x;
|
||||
}
|
||||
//dark xx axes
|
||||
temp_cursor = 0;
|
||||
position = 10+((temp_cursor-x_min)*((width-10)/(x_max-x_min)));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"0\" x2=\"%f\" y2=\"%d\" style=\"stroke:rgb(0,0,100);stroke-width:1\"/>\n", position, position, (height-10));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if not y_min <= 0 <= y_max
|
||||
if( y_min*y_max > 0) {
|
||||
|
||||
temp_cursor = y_min; //first grey line to be drawn
|
||||
small_tick = major_tick_y / (number_of_sub_ticks_y+1);
|
||||
while (temp_cursor < y_max) {
|
||||
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, width, position);
|
||||
|
||||
if(legend_on_major_tick_y) {
|
||||
// text with the major ticks legend
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"0\" transform=\"rotate(90 0,0)\" style=\"font-family:Arial;font-size:10\">%.1f</text>\n",(position-4),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = (y_max-temp_cursor-(k+1)*small_tick)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, width, position);
|
||||
}
|
||||
temp_cursor += major_tick_y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
temp_cursor = 0; //first grey line to be drawn
|
||||
small_tick = major_tick_y / (number_of_sub_ticks_y+1);
|
||||
while (temp_cursor < y_max) {
|
||||
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, width, position);
|
||||
|
||||
if(legend_on_major_tick_y) {
|
||||
// text with the major ticks legend
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"0\" transform=\"rotate(90 0,0)\" style=\"font-family:Arial;font-size:10\">%.1f</text>\n",(position-4),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = (y_max-temp_cursor-(k+1)*small_tick)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, width, position);
|
||||
}
|
||||
temp_cursor += major_tick_y;
|
||||
}
|
||||
|
||||
temp_cursor = 0;
|
||||
while (temp_cursor > y_min) {
|
||||
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(150,150,150);stroke-width:1\"/>\n", position, width, position);
|
||||
|
||||
if(legend_on_major_tick_y) {
|
||||
// text with the major ticks legend
|
||||
buffer_fstring.Printf("<text x=\"%f\" y=\"0\" transform=\"rotate(90 0,0)\" style=\"font-family:Arial;font-size:10\">%.1f</text>\n",(position-4),temp_cursor);
|
||||
}
|
||||
for (k=0; k < number_of_sub_ticks_x; k++) {
|
||||
position = (y_max-temp_cursor+(k+1)*small_tick)*((height-10)/(y_max-y_min));
|
||||
if((temp_cursor-(k+1)*small_tick) > y_min) {
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(220,220,220);stroke-width:1\"/>\n", position, width, position);
|
||||
}
|
||||
}
|
||||
temp_cursor -= major_tick_y;
|
||||
}
|
||||
// dark yy axes
|
||||
temp_cursor = 0;
|
||||
position = (y_max-temp_cursor)*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"%f\" x2=\"%d\" y2=\"%f\" style=\"stroke:rgb(0,0,100);stroke-width:1\"/>\n", position, width, position);
|
||||
}
|
||||
|
||||
pos_x = 10+(((*(vector_x))-x_min)*((width-10)/(x_max-x_min)));
|
||||
pos_y = (y_max-(*(vector_y)))*((height-10)/(y_max-y_min));
|
||||
|
||||
// Now draw the waveform
|
||||
for (j=1; j < (vector_dim); j++) {
|
||||
|
||||
pos_xx = 10+(((*(vector_x + j))-x_min)*((width-10)/(x_max-x_min)));
|
||||
pos_yy = (y_max-(*(vector_y + j)))*((height-10)/(y_max-y_min));
|
||||
buffer_fstring.Printf("<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" style=\"stroke:rgb(255,0,0);stroke-width:2\"/>\n",pos_x,pos_y,pos_xx,pos_yy);
|
||||
pos_x = pos_xx;
|
||||
pos_y = pos_yy;
|
||||
}
|
||||
// Draw the outter part of the graph
|
||||
buffer_fstring.Printf("<line x1=\"10\" y1=\"1\" x2=\"%d\" y2=\"1\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n\
|
||||
<line x1=\"10\" y1=\"%d\" x2=\"%d\" y2=\"%d\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n\
|
||||
<line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"%d\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n\
|
||||
<line x1=\"%d\" y1=\"0;\" x2=\"%d\" y2=\"%d\" style=\"stroke:rgb(0,0,0);stroke-width:3\"/>", width, (height-10), width,(height-10),(height-10), width, width,(height-10));
|
||||
temp_string_2 += buffer_fstring.Buffer();
|
||||
|
||||
temp_string_2 += "</svg";
|
||||
|
||||
}
|
||||
|
||||
|
||||
*SVG_FString = temp_string_2.Buffer();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
// provides an html header including the SVG top image
|
||||
bool SVGGraphicSupport::HeaderSVG(FString * HeaderFString,char title[], int SVG_height,int image_x,int image_y,int image_width,int image_height,char image_link[],int text_x, int text_y, char text[], char bg_colour[]) {
|
||||
|
||||
FString temp_string_3;
|
||||
|
||||
temp_string_3.Printf("html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"%d\" style=\"background-color: %s;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
<text x=\"%d\" y=\"%d\" style=\"font-family:Arial;font-size:46\">%s</text>\n\
|
||||
</svg", title, SVG_height, bg_colour ,image_x, image_y, image_width, image_height, image_link, text_x, text_y, text);
|
||||
|
||||
*HeaderFString = temp_string_3.Buffer();
|
||||
return True;
|
||||
}
|
||||
|
||||
// provides an html footer including the SVG bottom image
|
||||
bool SVGGraphicSupport::FooterSVG(FString * FooterFString,int SVG_height,int image_x,int image_y,int image_width,int image_height,char image_link[],int n_images,int text_x1,int text_x2,char gam_name[],char version[],char lastdate[],char author[],char description[]) {
|
||||
|
||||
FString footer_str;
|
||||
float text_y[5];
|
||||
int footer_i;
|
||||
|
||||
for (footer_i = 0; footer_i < 5; footer_i++) {
|
||||
text_y[footer_i] = (SVG_height/7)*(footer_i+2);
|
||||
}
|
||||
|
||||
footer_str.Printf("svg width=\"100%\" height=\"%d\">\n", SVG_height);
|
||||
|
||||
for (footer_i = 0; footer_i < n_images; footer_i++) {
|
||||
footer_str.Printf("<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n",(image_x+image_width*footer_i), image_y,image_width, image_height, image_link);
|
||||
}
|
||||
footer_str.Printf("<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">Name:</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">Version:</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">Date:</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">Author:</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">Description:</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">%s</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">%s</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">%s</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">%s</text>\n\
|
||||
<text x=\"%d\" y=\"%f\" style=\"font-family:Arial;font-size:14\">%s</text>\n\
|
||||
</svg>\n", text_x1, text_y[0],text_x1, text_y[1],text_x1, text_y[2],text_x1, text_y[3],text_x1, text_y[4], text_x2, text_y[0],gam_name,text_x2, text_y[1],version,text_x2, text_y[2],lastdate,text_x2, text_y[3],author,text_x2, text_y[4], description);
|
||||
|
||||
footer_str.Printf("</body>\n\
|
||||
</html");
|
||||
|
||||
*FooterFString = footer_str.Buffer();
|
||||
return True;
|
||||
}
|
||||
|
||||
// saves: x_min x, x_max, y_min, y_max, major_tick_x, major_tick_y for calling GetGraphSVG
|
||||
bool SVGGraphicSupport::OptimalDisplayFromVectors(int vector_dim, float * vector_x, float * vector_y,float * x_min,float * y_min,float * x_max,float * y_max,float * major_tick_x,float * major_tick_y ,int * number_of_sub_ticks_x,int * number_of_sub_ticks_y){
|
||||
|
||||
float xmin = *vector_x;
|
||||
float xmax = *vector_x;
|
||||
float ymin = *vector_y;
|
||||
float ymax = *vector_y;
|
||||
float diff;
|
||||
float majortickx = 1;
|
||||
float majorticky = 1;
|
||||
int i;
|
||||
|
||||
for (i=0; i < vector_dim; i++){
|
||||
|
||||
if (*(vector_x+i)>xmax) xmax = *(vector_x+i);
|
||||
if (*(vector_x+i)<xmin) xmin = *(vector_x+i);
|
||||
if (*(vector_y+i)>ymax) ymax = *(vector_y+i);
|
||||
if (*(vector_y+i)<ymin) ymin = *(vector_y+i);
|
||||
}
|
||||
|
||||
if (xmax==xmin){
|
||||
xmax +=1;
|
||||
xmin -=1;
|
||||
}
|
||||
if (ymax==ymin){
|
||||
ymax += 1;
|
||||
ymin -= 1;
|
||||
}
|
||||
|
||||
diff = xmax-xmin;
|
||||
while (diff > 12 || diff < 6){
|
||||
|
||||
if (diff>12){
|
||||
if ((diff/10) < 6 ){
|
||||
diff = diff / 2;
|
||||
majortickx = majortickx * 2;
|
||||
}
|
||||
else {
|
||||
diff = diff / 10;
|
||||
majortickx = majortickx * 10;
|
||||
}
|
||||
}
|
||||
else if(diff < 6){
|
||||
if ((diff*10) > 12){
|
||||
diff = diff * 2;
|
||||
majortickx = majortickx / 2;
|
||||
}
|
||||
else {
|
||||
diff = diff * 10;
|
||||
majortickx = majortickx / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
*number_of_sub_ticks_x = 4;
|
||||
// if (diff < 7) *number_of_sub_ticks_x = 9;
|
||||
|
||||
diff = ymax-ymin;
|
||||
while (diff > 12 || diff < 6){
|
||||
|
||||
if (diff>12){
|
||||
if ((diff/10) < 6 ){
|
||||
diff = diff / 2;
|
||||
majorticky = majorticky * 2;
|
||||
}
|
||||
else {
|
||||
diff = diff / 10;
|
||||
majorticky = majorticky * 10;
|
||||
}
|
||||
}
|
||||
else if(diff < 6){
|
||||
if ((diff*10) > 12){
|
||||
diff = diff * 2;
|
||||
majorticky = majorticky / 2;
|
||||
}
|
||||
else {
|
||||
diff = diff * 10;
|
||||
majorticky = majorticky / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*number_of_sub_ticks_y = 4;
|
||||
// if (diff < 7) *number_of_sub_ticks_y = 9;
|
||||
|
||||
|
||||
*x_min = xmin - 0.01*(xmax-xmin);
|
||||
*x_max = xmax + 0.01*(xmax-xmin);
|
||||
*y_min = ymin - 0.01*(ymax-ymin);
|
||||
*y_max = ymax + 0.01*(ymax-ymin);
|
||||
|
||||
|
||||
if((*x_min) * (*x_max) > 0 ){
|
||||
if (x_min > 0){
|
||||
*x_min = (float) (majortickx * ((int) (*x_min/majortickx)));
|
||||
}
|
||||
else {
|
||||
*x_min = (float) ((majortickx * ((int) (*x_min/majortickx)))-majortickx);
|
||||
}
|
||||
}
|
||||
|
||||
if((*y_min) * (*y_max) >0 ){
|
||||
if (y_min > 0){
|
||||
*y_min = (float) (majorticky * ((int) (*y_min/majorticky)));
|
||||
}
|
||||
else {
|
||||
*y_min = (float) ((majorticky * ((int) (*y_min/majorticky)))-majorticky);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*major_tick_x = majortickx;
|
||||
*major_tick_y = majorticky;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SVGGraphicSupport::HorizontalBarSVG ( FString * SVGFString){
|
||||
|
||||
FString temp_str;
|
||||
|
||||
temp_str.Printf("svg width=\"100%\" height=\"15\">\n\
|
||||
<rect x=\"0\" y=\"3\" rx=\"5\" ry=\"5\" width=\"100%\" height=\"10\" style=\"fill:navy;opacity:1\"/>\n\
|
||||
</svg");
|
||||
|
||||
|
||||
*SVGFString = temp_str.Buffer();
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
bool SVGGraphicSupport::TrianglePlusBarSVG(FString * SVGFString, float triangle_position){
|
||||
|
||||
FString temp_str;
|
||||
|
||||
temp_str.Printf("svg width=\"100%\" height=\"25\">\n\
|
||||
<polygon points=\"%f,0 %f,10 %f,10\" style=\"fill:navy;\"/>\n\
|
||||
<rect x=\"0\" y=\"10\" rx=\"5\" ry=\"5\" width=\"100%\" height=\"10\" style=\"fill:navy;opacity:1\"/>\n\
|
||||
</svg", triangle_position, (triangle_position-10),(triangle_position+10));
|
||||
|
||||
|
||||
*SVGFString = temp_str.Buffer();
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
ivoc - ivoc@ipfn.ist.utl.pt
|
||||
|
||||
Description: this set of functions can be used in sequence (or in separate) to draw an automatic SVG Graphic given any x/y set of point in two separate vectors
|
||||
first use DualVectorSort to sort the values, then use RemoveRepeatedValues to remove the repeated points.
|
||||
After this use OptimalDisplayFromVectors for obtaining the optimal zoom parameters for GetGraphSVG, wich writes a FString containing SVG code for the grafic
|
||||
reminder: there is no < and > at the begining and by the end on the code becaus it is intended to be used in a ::ProcessHttpMessage(HttpStream &hStream) with hmStream.SSPrintf(HtmlTagStreamMode, temp_string_1.Buffer()); that contains the <> tags
|
||||
*/
|
||||
|
||||
#if !defined (SVGGRAPHICSUPPORT_H)
|
||||
#define SVGGRAPHICSUPPORT_H
|
||||
|
||||
#include "Level0.h"
|
||||
#include "Level1.h"
|
||||
#include "Level2.h"
|
||||
//#include "FString.h"
|
||||
|
||||
class SVGGraphicSupport {
|
||||
|
||||
public:
|
||||
|
||||
SVGGraphicSupport();
|
||||
|
||||
~SVGGraphicSupport();
|
||||
|
||||
bool GetGraphSVG(FString * SVG_FString,char instance_name[],int vector_dim,float * vector_x,float * vector_y, int width,int height,float x_min,float y_min,float x_max,float y_max,float major_tick_x,float major_tick_y,int number_of_sub_ticks_x,int number_of_sub_ticks_y,bool legend_on_major_tick_x,bool legend_on_major_tick_y);
|
||||
|
||||
bool HeaderSVG(FString * HeaderFString,char title[], int SVG_height,int image_x,int image_y,int image_width,int image_height,char image_link[],int text_x, int text_y, char text[], char bg_colour[]);
|
||||
|
||||
bool FooterSVG(FString * FooterFString,int SVG_height,int image_x,int image_y,int image_width,int image_height,char image_link[],int n_images,int text_x1,int text_x2,char gam_name[],char version[],char lastdate[],char author[],char description[]);
|
||||
|
||||
bool OptimalDisplayFromVectors(int vector_dim, float * vector_x, float * vector_y,float * x_min,float * y_min,float * x_max,float * y_max,float * major_tick_x,float * major_tick_y ,int * number_of_sub_ticks_x,int * number_of_sub_ticks_y);
|
||||
|
||||
bool HorizontalBarSVG ( FString * SVGFString);
|
||||
|
||||
bool TrianglePlusBarSVG(FString * SVGFString, float triangle_position);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,249 @@
|
||||
|
||||
#include "SineProbeGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(SineProbeGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
SineProbeGAM::SineProbeGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
SineProbeGAM::~SineProbeGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool SineProbeGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"SineProbeGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
if(!cdb.ReadInt32(i, "sine_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s sine_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
sine_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"SineProbeGAM::Initialise: sine_vertical_bool = %d",sine_vertical_bool);
|
||||
}
|
||||
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "SineProbeGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "SineProbeGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "SineProbeGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "SineProbeGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 2;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("input_sine_signals");
|
||||
CDB_move_to[1].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"SineProbeGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("sine_probe_z");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"SineProbeGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SineProbeGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->n_samples = 0;
|
||||
this->accumulator = 0;
|
||||
this->remove_offset = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool SineProbeGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"SineProbeGAM:: %s inputstruct = %f ",this->Name(), inputstruct[0].ADC_sine_probe);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
// Determine the ADC offset
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
|
||||
this->accumulator += (float) inputstruct[0].ADC_sine_probe;
|
||||
this->remove_offset = this->accumulator / (float) this->n_samples;
|
||||
outputstruct[0].SineProbeZ = 0;
|
||||
}
|
||||
else{
|
||||
//send offset corrections to logger once
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
AssertErrorCondition(Information,"SineProbeGAM::Execute: %s OFFSETS = %f, number of samples = %d", this->Name(), this->remove_offset, n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
|
||||
outputstruct[0].SineProbeZ = inputstruct[0].ADC_sine_probe - remove_offset;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->n_samples = 0;
|
||||
this->accumulator = 0;
|
||||
this->remove_offset = 0;
|
||||
outputstruct[0].SineProbeZ = 0;
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool SineProbeGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>sine_vertical_bool = %d\n\
|
||||
<br><br",sine_vertical_bool);
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef _SINEPROBEGAM_H
|
||||
#define _SINEPROBEGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(SineProbeGAM)
|
||||
|
||||
|
||||
class SineProbeGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_sine_probe;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float SineProbeZ;
|
||||
};
|
||||
|
||||
bool sine_vertical_bool;
|
||||
int n_samples;
|
||||
float accumulator;
|
||||
float remove_offset;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
SineProbeGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~SineProbeGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(SineProbeGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* File: SpectroscopyTriggerGAM.cpp (based on SpectroscopyTriggerGAM.cpp)
|
||||
* Author: Hugo Alves
|
||||
* Date: 20th Feb 2017
|
||||
*
|
||||
*/
|
||||
|
||||
#include "SpectroscopyTriggerGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(SpectroscopyTriggerGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
SpectroscopyTriggerGAM::SpectroscopyTriggerGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
SpectroscopyTriggerGAM::~SpectroscopyTriggerGAM()
|
||||
{
|
||||
//if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
//if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool SpectroscopyTriggerGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
//Read config
|
||||
//if(!cdb->Move("trigger_config"))
|
||||
//{
|
||||
// AssertErrorCondition(InitialisationError,"SpectroscopyTriggerGAM::Initialise: %s Could not move to \"trigger_config\"",this->Name());
|
||||
// return False;
|
||||
//}
|
||||
|
||||
if(!cdb.ReadInt32(min_time_between_triggers_usec, "min_time_between_triggers_usec"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "SpectroscopyTriggerGAM::Initialise: %s min_time_between_triggers_usec", this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information, "SpectroscopyTriggerGAM::Initialise: min_time_between_triggers_usec = %d", min_time_between_triggers_usec);
|
||||
//Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "SpectroscopyTriggerGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "SpectroscopyTriggerGAM::Initialise: %s failed to add the SpectroscopyTriggerGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "SpectroscopyTriggerGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "SpectroscopyTriggerGAM::Initialise: %s failed to add the SpectroscopyTriggerGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
//INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SpectroscopyTriggerGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_read = 3;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("DischargeStatus");
|
||||
CDB_move_to[1].Printf("usecDischargeTime");
|
||||
CDB_move_to[2].Printf("usecTime");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "SpectroscopyTriggerGAM::Initialise: %s Could not move to \"%s\"", this->Name(), CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"SpectroscopyTriggerGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SpectroscopyTriggerGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
//OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SpectroscopyTriggerGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int number_of_signals_to_write = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_write];
|
||||
SignalType = new FString[number_of_signals_to_write];
|
||||
CDB_move_to[0].Printf("spectr_trigger");
|
||||
for (i=0;i<number_of_signals_to_write;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SpectroscopyTriggerGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"SpectroscopyTriggerGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"SpectroscopyTriggerGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
// Initialization
|
||||
old_elapsedtime = -100000; // Do not skip first semicycle
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ****************************************************************
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool SpectroscopyTriggerGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
int dischargestatus; // 0 : breakdown, 1 : normal, 2 : inversion
|
||||
int disch_usec; // usec since last change in dischargestatus
|
||||
int usec; // total usec since plasma beginning
|
||||
int usec_since_last_trigger; // usec since last trigger (no, really.)
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
dischargestatus = inputstruct[0].DischargeStatus;
|
||||
disch_usec = inputstruct[0].usecDischargeTime;
|
||||
usec = inputstruct[0].usecTime;
|
||||
usec_since_last_trigger = usec - old_elapsedtime;
|
||||
|
||||
// falling edge
|
||||
if(dischargestatus == 1 && usec_since_last_trigger > 2000) outputstruct[0].SpectroscopyTrigger = 0.0;
|
||||
|
||||
// send a trigger in the beginning of a semicycle if it's not too early
|
||||
if(dischargestatus == 1 && disch_usec < 2000 && usec_since_last_trigger > this->min_time_between_triggers_usec ){
|
||||
outputstruct[0].SpectroscopyTrigger = 100.0;
|
||||
old_elapsedtime = usec;
|
||||
}
|
||||
if(dischargestatus != 1) outputstruct[0].SpectroscopyTrigger = 0.0;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
outputstruct[0].SpectroscopyTrigger = 0.0;
|
||||
old_elapsedtime = -100000;
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef _SPECTROSCOPYTRIGGERGAM_H
|
||||
#define _SPECTROSCOPYTRIGGERGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
// #include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(SpectroscopyTriggerGAM)
|
||||
|
||||
|
||||
class SpectroscopyTriggerGAM : public GAM {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
int DischargeStatus;
|
||||
int usecDischargeTime;
|
||||
int usecTime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float SpectroscopyTrigger;
|
||||
};
|
||||
int old_elapsedtime;
|
||||
int min_time_between_triggers_usec;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
SpectroscopyTriggerGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~SpectroscopyTriggerGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
OBJECT_DLL_STUFF(SpectroscopyTriggerGAM)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
|
||||
#include "TechnicalSignalsGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(TechnicalSignalsGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
TechnicalSignalsGAM::TechnicalSignalsGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
TechnicalSignalsGAM::~TechnicalSignalsGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool TechnicalSignalsGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"CosineProbeGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"CosineProbeGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
|
||||
// sleep(3);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "TechnicalSignalsGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "TechnicalSignalsGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "TechnicalSignalsGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "TechnicalSignalsGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 6;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("horizontal_current_transducer");
|
||||
CDB_move_to[1].Printf("vertical_current_transducer");
|
||||
CDB_move_to[2].Printf("primary_current_transducer");
|
||||
CDB_move_to[3].Printf("v_loop");
|
||||
CDB_move_to[4].Printf("h_alfa_output");
|
||||
CDB_move_to[5].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"TechnicalSignalsGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 6;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("horizontal_current");
|
||||
CDB_move_to[1].Printf("vertical_current");
|
||||
CDB_move_to[2].Printf("primary_current");
|
||||
CDB_move_to[3].Printf("iron_core_saturation");
|
||||
CDB_move_to[4].Printf("v_loop");
|
||||
CDB_move_to[5].Printf("h_alpha");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"TechnicalSignalsGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
this->n_samples = 0;
|
||||
this->accumulator_1 = 0;
|
||||
this->accumulator_2 = 0;
|
||||
this->accumulator_3 = 0;
|
||||
this->accumulator_4 = 0;
|
||||
this->remove_offset_1 = 0;
|
||||
this->remove_offset_2 = 0;
|
||||
this->remove_offset_3 = 0;
|
||||
this->remove_offset_4 = 0;
|
||||
|
||||
number_of_points_for_average = 8;
|
||||
|
||||
this->old_v_loop_value_storage = new float[number_of_points_for_average];
|
||||
for (i=0;i<number_of_points_for_average;i++){
|
||||
old_v_loop_value_storage[i] = 0;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool TechnicalSignalsGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"TechnicalSignalsGAM:: %s inputstruct = %f %f %f %f %f ",this->Name(), inputstruct[0].ADC_horizontal_current, inputstruct[0].ADC_vertical_current, inputstruct[0].ADC_primary_current, inputstruct[0].ADC_vloop, inputstruct[0].HAlfaOutput);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
// Determine the ADC offset
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
|
||||
this->accumulator_1 += (float) inputstruct[0].ADC_horizontal_current;
|
||||
this->accumulator_2 += (float) inputstruct[0].ADC_vertical_current;
|
||||
this->accumulator_3 += (float) inputstruct[0].ADC_primary_current;
|
||||
this->accumulator_4 += (float) inputstruct[0].ADC_vloop;
|
||||
this->remove_offset_1 = this->accumulator_1 / (float) this->n_samples;
|
||||
this->remove_offset_2 = this->accumulator_2 / (float) this->n_samples;
|
||||
this->remove_offset_3 = this->accumulator_3 / (float) this->n_samples;
|
||||
this->remove_offset_4 = this->accumulator_4 / (float) this->n_samples;
|
||||
outputstruct[0].HorizontalCurrent = 0;
|
||||
outputstruct[0].VerticalCurrent = 0;
|
||||
outputstruct[0].PrimaryCurrent = 0;
|
||||
outputstruct[0].VLoop = 0;
|
||||
outputstruct[0].HAlfa = 0;
|
||||
outputstruct[0].IronCoreSaturation = 0;
|
||||
}
|
||||
else{
|
||||
//send offset corrections to logger once
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
AssertErrorCondition(Information,"TechnicalSignalsGAM::Execute: %s OFFSETS = %f,%f,%f,%f, number of samples = %d", this->Name(), this->remove_offset_1, this->remove_offset_2, this->remove_offset_3, this->remove_offset_4, n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
|
||||
old_v_loop_value_storage[0] = inputstruct[0].ADC_vloop - this->remove_offset_4;
|
||||
filtered_v_loop = old_v_loop_value_storage[0];
|
||||
|
||||
for (i=1;i<number_of_points_for_average;i++){
|
||||
filtered_v_loop += old_v_loop_value_storage[i];
|
||||
old_v_loop_value_storage[i] = old_v_loop_value_storage[i-1];
|
||||
}
|
||||
filtered_v_loop = filtered_v_loop / number_of_points_for_average;
|
||||
|
||||
outputstruct[0].VLoop = filtered_v_loop;
|
||||
|
||||
outputstruct[0].HorizontalCurrent = inputstruct[0].ADC_horizontal_current - this->remove_offset_1;
|
||||
outputstruct[0].VerticalCurrent = inputstruct[0].ADC_vertical_current - this->remove_offset_2;
|
||||
outputstruct[0].PrimaryCurrent = inputstruct[0].ADC_primary_current - this->remove_offset_3;
|
||||
if (inputstruct[0].HAlfaOutput > 0) outputstruct[0].HAlfa = inputstruct[0].HAlfaOutput;
|
||||
else outputstruct[0].HAlfa = 0;
|
||||
|
||||
|
||||
//try to preview iron core saturation by this formula Iprim ^ 2 / (Vloop ^ 2 + 0.1)
|
||||
outputstruct[0].IronCoreSaturation = ( outputstruct[0].PrimaryCurrent * outputstruct[0].PrimaryCurrent / ( outputstruct[0].VLoop * outputstruct[0].VLoop + 0.1 ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->n_samples = 0;
|
||||
this->accumulator_1 = 0;
|
||||
this->accumulator_2 = 0;
|
||||
this->accumulator_3 = 0;
|
||||
this->accumulator_4 = 0;
|
||||
this->remove_offset_1 = 0;
|
||||
this->remove_offset_2 = 0;
|
||||
this->remove_offset_3 = 0;
|
||||
this->remove_offset_4 = 0;
|
||||
outputstruct[0].HorizontalCurrent = 0;
|
||||
outputstruct[0].VerticalCurrent = 0;
|
||||
outputstruct[0].PrimaryCurrent = 0;
|
||||
outputstruct[0].VLoop = 0;
|
||||
outputstruct[0].HAlfa = 0;
|
||||
outputstruct[0].IronCoreSaturation = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool TechnicalSignalsGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#ifndef _TECHNICALSIGNALSGAM_H
|
||||
#define _TECHNICALSIGNALSGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(TechnicalSignalsGAM)
|
||||
|
||||
|
||||
class TechnicalSignalsGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_horizontal_current;
|
||||
float ADC_vertical_current;
|
||||
float ADC_primary_current;
|
||||
float ADC_vloop;
|
||||
float HAlfaOutput;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float HorizontalCurrent;
|
||||
float VerticalCurrent;
|
||||
float PrimaryCurrent;
|
||||
float IronCoreSaturation;
|
||||
float VLoop;
|
||||
float HAlfa;
|
||||
};
|
||||
|
||||
bool calculate_h_alpha_bool;
|
||||
int n_samples;
|
||||
float accumulator_1;
|
||||
float accumulator_2;
|
||||
float accumulator_3;
|
||||
float accumulator_4;
|
||||
float remove_offset_1;
|
||||
float remove_offset_2;
|
||||
float remove_offset_3;
|
||||
float remove_offset_4;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
|
||||
float *old_v_loop_value_storage;
|
||||
float filtered_v_loop;
|
||||
int number_of_points_for_average;
|
||||
|
||||
int i;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
TechnicalSignalsGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~TechnicalSignalsGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(TechnicalSignalsGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,900 @@
|
||||
|
||||
#include "TimeWindowsGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(TimeWindowsGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
TimeWindowsGAM::TimeWindowsGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
TimeWindowsGAM::~TimeWindowsGAM()
|
||||
{
|
||||
// delete the interfaces
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
|
||||
}
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool TimeWindowsGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
if(!cdb.ReadFloat(discharge_time, "discharge_time"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s discharge_time",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: discharge_time = %f",discharge_time);
|
||||
if(!cdb.ReadInt32(number_of_cycles, "number_of_cycles"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s number_of_cycles",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: number_of_cycles = %d",number_of_cycles);
|
||||
if(!cdb.ReadInt32(i, "first_cycle_positive_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s first_cycle_positive_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_cycle_positive_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: first_cycle_positive_bool = %d",first_cycle_positive_bool);
|
||||
}
|
||||
|
||||
if(!cdb.ReadInt32(i, "auto_breakdown"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s auto_breakdown",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto_breakdown = (bool)i;
|
||||
AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: auto_breakdown = %d",auto_breakdown);
|
||||
}
|
||||
if(!cdb.ReadInt32(usecthread_cycle_time, "usecthread_cycle_time"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s usecthread_cycle_time",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: usecthread_cycle_time = %d",usecthread_cycle_time);
|
||||
if(!cdb.ReadInt32(usec_pre_pulse_time, "usec_pre_pulse_time"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s usec_pre_pulse_time",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: usec_pre_pulse_time = %d",usec_pre_pulse_time);
|
||||
if(!cdb.ReadInt32(maximum_inversion_usectime, "maximum_inversion_usectime"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s maximum_inversion_usectime",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: maximum_inversion_usectime = %d",maximum_inversion_usectime);
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
if(!cdb.ReadInt32(puffing_mode, "puffing_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s puffing_mode",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: puffing_mode = %d",puffing_mode);
|
||||
if(!cdb.ReadInt32(i, "end_discharge_after_unsuccess_bool"))
|
||||
{
|
||||
CStaticAssertErrorCondition(InitialisationError,"TimeWindowsGAM::ReadConfigurationFile: %s end_discharge_after_unsuccess_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
end_discharge_after_unsuccess_bool = (bool)i;
|
||||
CStaticAssertErrorCondition(Information,"TimeWindowsGAM::ReadConfigurationFile: end_discharge_after_unsuccess_bool = %d",end_discharge_after_unsuccess_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(time_between_online_and_discharge, "time_between_online_and_discharge"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s time_between_online_and_discharge",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: time_between_online_and_discharge = %d",time_between_online_and_discharge);
|
||||
|
||||
if(!cdb->Move("positive_time_windows"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+time_windows.positive_time_windows\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(positive_number_of_time_windows, "number_of_time_windows"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s positive_number_of_time_windows",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: positive_number_of_time_windows = %d",positive_number_of_time_windows);
|
||||
if (positive_number_of_time_windows > 0){
|
||||
positive_time_windows_values =new float[positive_number_of_time_windows];
|
||||
positive_primary_mode =new int[positive_number_of_time_windows];
|
||||
positive_horizontal_mode =new int[positive_number_of_time_windows];
|
||||
positive_vertical_mode =new int[positive_number_of_time_windows];
|
||||
|
||||
if(!cdb.ReadFloatArray(positive_time_windows_values, (int *)(&positive_number_of_time_windows), 1, "time_windows_values"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not read positive_time_windows_values");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<positive_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: positive_time_windows_values[%d] = %d",i, positive_time_windows_values[i]);
|
||||
if(!cdb.ReadInt32Array(positive_primary_mode, (int *)(&positive_number_of_time_windows), 1, "primary_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not positive_primary_mode");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<positive_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: positive_primary_mode[%d] = %d",i, positive_primary_mode[i]);
|
||||
if(!cdb.ReadInt32Array(positive_horizontal_mode, (int *)(&positive_number_of_time_windows), 1, "horizontal_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not read positive_horizontal_mode");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<positive_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: positive_horizontal_mode[%d] = %d",i, positive_horizontal_mode[i]);
|
||||
if(!cdb.ReadInt32Array(positive_vertical_mode, (int *)(&positive_number_of_time_windows), 1, "vertical_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not read positive_vertical_mode");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<positive_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: positive_vertical_mode[%d] = %d",i, positive_vertical_mode[i]);
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
if(!cdb->Move("negative_time_windows"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+time_windows.negative_time_windows\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(negative_number_of_time_windows, "number_of_time_windows"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s negative_number_of_time_windows",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: negative_number_of_time_windows = %d",negative_number_of_time_windows);
|
||||
|
||||
if (positive_number_of_time_windows + negative_number_of_time_windows < 1){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: TIMEWINDOWS WERE NOT DEFINED!!! positive_number_of_time_windows + negative_number_of_time_windows < 1");
|
||||
return False;
|
||||
}
|
||||
|
||||
if (negative_number_of_time_windows > 0){
|
||||
|
||||
negative_time_windows_values =new float[negative_number_of_time_windows];
|
||||
negative_primary_mode =new int[negative_number_of_time_windows];
|
||||
negative_horizontal_mode =new int[negative_number_of_time_windows];
|
||||
negative_vertical_mode =new int[negative_number_of_time_windows];
|
||||
|
||||
if(!cdb.ReadFloatArray(negative_time_windows_values, (int *)(&negative_number_of_time_windows), 1, "time_windows_values"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not read negative_time_windows_values");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<negative_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: negative_time_windows_values[%d] = %d",i, negative_time_windows_values[i]);
|
||||
if(!cdb.ReadInt32Array(negative_primary_mode, (int *)(&negative_number_of_time_windows), 1, "primary_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not negative_primary_mode");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<negative_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: negative_primary_mode[%d] = %d",i, negative_primary_mode[i]);
|
||||
if(!cdb.ReadInt32Array(negative_horizontal_mode, (int *)(&negative_number_of_time_windows), 1, "horizontal_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not read negative_horizontal_mode");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<negative_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: negative_horizontal_mode[%d] = %d",i, negative_horizontal_mode[i]);
|
||||
if(!cdb.ReadInt32Array(negative_vertical_mode, (int *)(&negative_number_of_time_windows), 1, "vertical_mode"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: Could not read negative_vertical_mode");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<negative_number_of_time_windows;i++) AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: negative_vertical_mode[%d] = %d",i, negative_vertical_mode[i]);
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
|
||||
// sleep(5);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "TimewindowsGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "TimeWindowsGAM::Initialise: %s failed to add the TimewindowsGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "TimewindowsGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "TimeWindowsGAM::Initialise: %s failed to add the TimewindowsGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 5;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("plasma_current");
|
||||
CDB_move_to[1].Printf("system_time");
|
||||
CDB_move_to[2].Printf("is_saturated_bool");
|
||||
CDB_move_to[3].Printf("slow_stop");
|
||||
CDB_move_to[4].Printf("hard_stop");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 10;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("primary_mode");
|
||||
CDB_move_to[1].Printf("horizontal_mode");
|
||||
CDB_move_to[2].Printf("vertical_mode");
|
||||
CDB_move_to[3].Printf("time_to_waveforms");
|
||||
CDB_move_to[4].Printf("discharge_direction");
|
||||
CDB_move_to[5].Printf("discharge_status");
|
||||
CDB_move_to[6].Printf("toroidal_mode");
|
||||
CDB_move_to[7].Printf("toroidal_status");
|
||||
CDB_move_to[8].Printf("puffing_mode");
|
||||
CDB_move_to[9].Printf("puffing_status");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"TimeWindowsGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
discharge_time = discharge_time * 1000; //ms to us conversion
|
||||
saved_usec_time = 10000000;
|
||||
|
||||
//additional validations
|
||||
if (number_of_cycles < 1 ){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: ERROR on the number semi-cycles on a discharge!!! number_of_cycles < 1");
|
||||
return False;
|
||||
}
|
||||
if (positive_number_of_time_windows < 1 && (first_cycle_positive_bool || number_of_cycles > 1)){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: ERROR on the number of positive timewindows!!! positive_number_of_time_windows < 1 && (first_cycle_positive_bool || number_of_cycles > 1)");
|
||||
return False;
|
||||
}
|
||||
if (negative_number_of_time_windows < 1 && (!first_cycle_positive_bool || number_of_cycles > 1)){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM: ERROR on the number of negative timewindows!!! negative_number_of_time_windows < 1 && (!first_cycle_positive_bool || number_of_cycles > 1)");
|
||||
return False;
|
||||
}
|
||||
|
||||
// transform the waveform ms in us (x1000)
|
||||
corrected_positive_time_windows_values = new int[positive_number_of_time_windows];
|
||||
corrected_negative_time_windows_values = new int[negative_number_of_time_windows];
|
||||
for (i=0;i<positive_number_of_time_windows;i++) corrected_positive_time_windows_values[i] = int (positive_time_windows_values[i] * 1000);
|
||||
for (i=0;i<negative_number_of_time_windows;i++) corrected_negative_time_windows_values[i] = int (negative_time_windows_values[i] * 1000);
|
||||
|
||||
this->vertical_positive_timewindows = new IntegerSequentialControl(&corrected_positive_time_windows_values[0], &positive_vertical_mode[0], positive_number_of_time_windows);
|
||||
this->horizontal_positive_timewindows = new IntegerSequentialControl(&corrected_positive_time_windows_values[0], &positive_horizontal_mode[0], positive_number_of_time_windows);
|
||||
this->primary_positive_timewindows = new IntegerSequentialControl(&corrected_positive_time_windows_values[0], &positive_primary_mode[0], positive_number_of_time_windows);
|
||||
this->vertical_negative_timewindows = new IntegerSequentialControl(&corrected_negative_time_windows_values[0], &negative_vertical_mode[0], negative_number_of_time_windows);
|
||||
this->horizontal_negative_timewindows = new IntegerSequentialControl(&corrected_negative_time_windows_values[0], &negative_horizontal_mode[0], negative_number_of_time_windows);
|
||||
this->primary_negative_timewindows = new IntegerSequentialControl(&corrected_negative_time_windows_values[0], &negative_primary_mode[0], negative_number_of_time_windows);
|
||||
|
||||
this->vertical_positive_timewindows->DefineDefaultValue(0);
|
||||
this->horizontal_positive_timewindows->DefineDefaultValue(0);
|
||||
this->primary_positive_timewindows->DefineDefaultValue(0);
|
||||
this->vertical_negative_timewindows->DefineDefaultValue(0);
|
||||
this->horizontal_negative_timewindows->DefineDefaultValue(0);
|
||||
this->primary_negative_timewindows->DefineDefaultValue(0);
|
||||
|
||||
if (puffing_mode == 3) puffing_in_timewindows_mode = False;
|
||||
else puffing_in_timewindows_mode = True;
|
||||
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool TimeWindowsGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
|
||||
// AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: discharge_time = %f",discharge_time);
|
||||
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"TimeWindowsGAM:: %s inputstruct = %f %d %d %d %d",this->Name(), inputstruct[0].PlasmaCurrent, inputstruct[0].usecTime, inputstruct[0].InSaturation, inputstruct[0].SlowStopBool, inputstruct[0].HardStopBool);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
/*
|
||||
*** Operation modes ***
|
||||
0 -> off
|
||||
1 -> current control
|
||||
2 -> position / plasma current control - soft PID
|
||||
3 -> position / plasma current control - medium PID
|
||||
4 -> position / plasma current control - hard PID
|
||||
5 -> position / plasma current control - Auto PID (with adaptative gain)
|
||||
6 -> *integrated control (scenario)
|
||||
7 -> *Invert (scenario)
|
||||
*/
|
||||
/*
|
||||
*** Discharge Status ***
|
||||
-3 -> error
|
||||
-2 -> offline
|
||||
0 -> breakdown
|
||||
1 -> normal operation
|
||||
2 -> inverting
|
||||
*/
|
||||
/*
|
||||
*** puffing_mode ***
|
||||
0 -> off
|
||||
1 -> time-windows, out percentage
|
||||
2 -> time windows density feedback
|
||||
3 -> absolute time, out percentage
|
||||
4 -> preprogrammed on breakdown, feedback on time-windows
|
||||
*/
|
||||
|
||||
// !!!!! falta usar time_between_online_and_discharge e initial_online_time... para pre-puffing e pre-campo toroidal
|
||||
|
||||
if (functionNumber == GAMOffline){
|
||||
|
||||
inputstruct[0].SlowStopBool = False;
|
||||
inputstruct[0].HardStopBool = False;
|
||||
|
||||
saved_usec_time = 10000000;
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].usecDischargeTime = -20000;
|
||||
outputstruct[0].DischargeStatus = -2;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].ToroidalStatus = -2;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].PuffingStatus = -2;
|
||||
last_dischage_status = -2;
|
||||
n_cycles_temp = number_of_cycles;
|
||||
power_supplies_started = False;
|
||||
|
||||
if( first_cycle_positive_bool ){
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
last_plasma_direction = 1;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
last_plasma_direction = 0;
|
||||
}
|
||||
in_positive_breakdown_scenario = False;
|
||||
in_negative_breakdown_scenario = False;
|
||||
in_inversion_from_positive_to_negative_scenario = False;
|
||||
in_inversion_from_negative_to_positive_scenario = False;
|
||||
}
|
||||
if (functionNumber == GAMPrepulse){
|
||||
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].usecDischargeTime = -20000;
|
||||
outputstruct[0].DischargeStatus = -1;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].ToroidalStatus = -1;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].PuffingStatus = -1;
|
||||
last_dischage_status = -1;
|
||||
n_cycles_temp = number_of_cycles;
|
||||
power_supplies_started = False;
|
||||
if( first_cycle_positive_bool ){
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
last_plasma_direction = 1;
|
||||
//check if breakdown scenario is going to be used mode = 7
|
||||
if (auto_breakdown){
|
||||
in_positive_breakdown_scenario = True;
|
||||
in_negative_breakdown_scenario = False;
|
||||
in_inversion_from_positive_to_negative_scenario = False;
|
||||
in_inversion_from_negative_to_positive_scenario = False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//check if breakdown scenario is going to be used
|
||||
if (auto_breakdown){
|
||||
in_negative_breakdown_scenario = True;
|
||||
in_positive_breakdown_scenario = False;
|
||||
in_inversion_from_positive_to_negative_scenario = False;
|
||||
in_inversion_from_negative_to_positive_scenario = False;
|
||||
}
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
last_plasma_direction = 0;
|
||||
}
|
||||
|
||||
initial_online_time = inputstruct[0].usecTime; //saved time
|
||||
|
||||
}
|
||||
if (functionNumber == GAMOnline){
|
||||
|
||||
if (inputstruct[0].SlowStopBool && last_dischage_status != -3){
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM:: %s SLOW STOP WAS ASSIGNED!!!",this->Name());
|
||||
last_dischage_status = -3;
|
||||
}
|
||||
else if (inputstruct[0].HardStopBool && last_dischage_status != -3){
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM:: %s HARD STOP WAS ASSIGNED!!!",this->Name());
|
||||
last_dischage_status = -3;
|
||||
}
|
||||
else if (last_dischage_status == -3){
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
}
|
||||
else { // if no stops are issued
|
||||
|
||||
if(inputstruct[0].usecTime >= usectime_to_wait_for_starting_operation && inputstruct[0].usecTime <= (usectime_to_wait_for_starting_operation + discharge_time) && n_cycles_temp > 0){
|
||||
if (!power_supplies_started){
|
||||
power_supplies_started = True;
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM:: %s power_supplies_started at %d us",this->Name(),inputstruct[0].usecTime);
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
|
||||
}
|
||||
if (in_positive_breakdown_scenario){
|
||||
|
||||
|
||||
if (puffing_in_timewindows_mode && puffing_mode != 4) outputstruct[0].PuffingStatus = -2;
|
||||
|
||||
|
||||
if (usec_pre_pulse_time > inputstruct[0].usecTime - usectime_to_wait_for_starting_operation){
|
||||
if (inputstruct[0].PlasmaCurrent > 750){
|
||||
in_positive_breakdown_scenario = False; // breakdown successful
|
||||
if (puffing_mode == 4 ) outputstruct[0].PuffingMode = 2; //end of breakdown -> if puffing mode == 4 -> change to puffing feedback in time windows
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 0;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PrimaryWaveformMode = 1;
|
||||
outputstruct[0].HorizontalWaveformMode = 1;
|
||||
outputstruct[0].VerticalWaveformMode = 1;
|
||||
outputstruct[0].usecDischargeTime = inputstruct[0].usecTime - usectime_to_wait_for_starting_operation;
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
outputstruct[0].DischargeStatus = 0;
|
||||
}
|
||||
}
|
||||
else if (end_discharge_after_unsuccess_bool){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: Breakdown to positive Ip not successful at %d us - ending dishcarge!!!", inputstruct[0].usecTime);
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].DischargeStatus = -3;
|
||||
last_dischage_status = -3;
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: Breakdown to positive Ip not successful at %d us- skip phase !!!", inputstruct[0].usecTime);
|
||||
in_positive_breakdown_scenario = False;
|
||||
if (puffing_mode == 4 ) outputstruct[0].PuffingMode = 2; //end of breakdown -> if puffing mode == 4 -> change to puffing feedback in time windows
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 0;
|
||||
}
|
||||
}
|
||||
if (in_negative_breakdown_scenario){
|
||||
|
||||
if (puffing_in_timewindows_mode && puffing_mode != 4) outputstruct[0].PuffingStatus = -2;
|
||||
|
||||
|
||||
if (usec_pre_pulse_time > inputstruct[0].usecTime - usectime_to_wait_for_starting_operation){
|
||||
if (inputstruct[0].PlasmaCurrent < -750){
|
||||
in_negative_breakdown_scenario = False;
|
||||
if (puffing_mode == 4 ) outputstruct[0].PuffingMode = 2; //end of breakdown -> if puffing mode == 4 -> change to puffing feedback in time windows
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 0;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PrimaryWaveformMode = 1;
|
||||
outputstruct[0].HorizontalWaveformMode = 1;
|
||||
outputstruct[0].VerticalWaveformMode = 1;
|
||||
outputstruct[0].usecDischargeTime = inputstruct[0].usecTime - usectime_to_wait_for_starting_operation;
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
outputstruct[0].DischargeStatus = 0;
|
||||
}
|
||||
}
|
||||
else if (end_discharge_after_unsuccess_bool){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: Breakdown to negative Ip not successful at %d us - ending dishcarge!!!", inputstruct[0].usecTime);
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].DischargeStatus = -3;
|
||||
last_dischage_status = -3;
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: Breakdown to negative Ip not successful at %d us - skip phase !!!", inputstruct[0].usecTime);
|
||||
in_negative_breakdown_scenario = False;
|
||||
if (puffing_mode == 4 ) outputstruct[0].PuffingMode = 2; //end of breakdown -> if puffing mode == 4 -> change to puffing feedback in time windows
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 0;
|
||||
}
|
||||
}
|
||||
if (in_inversion_from_positive_to_negative_scenario){
|
||||
|
||||
|
||||
if (puffing_in_timewindows_mode) outputstruct[0].PuffingStatus = -2;
|
||||
|
||||
|
||||
if (maximum_inversion_usectime > inputstruct[0].usecTime - saved_usec_time){
|
||||
if (inputstruct[0].PlasmaCurrent < -750){
|
||||
in_inversion_from_positive_to_negative_scenario = False;
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 2;
|
||||
n_cycles_temp--;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PrimaryWaveformMode = 1;
|
||||
outputstruct[0].HorizontalWaveformMode = 1;
|
||||
outputstruct[0].VerticalWaveformMode = 1;
|
||||
outputstruct[0].usecDischargeTime = inputstruct[0].usecTime - saved_usec_time;
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
outputstruct[0].DischargeStatus = 2;
|
||||
last_dischage_status = 2;
|
||||
}
|
||||
}
|
||||
else if (end_discharge_after_unsuccess_bool){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: inversion_from_positive_to_negative not successful at %d us - ending dishcarge!!!", inputstruct[0].usecTime);
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].DischargeStatus = -3;
|
||||
last_dischage_status = -3;
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: inversion_from_positive_to_negative not successful at %d us - skip phase !!!",inputstruct[0].usecTime);
|
||||
in_inversion_from_positive_to_negative_scenario = False;
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 2;
|
||||
n_cycles_temp--;
|
||||
}
|
||||
}
|
||||
if (in_inversion_from_negative_to_positive_scenario){
|
||||
|
||||
|
||||
if (puffing_in_timewindows_mode) outputstruct[0].PuffingStatus = -2;
|
||||
|
||||
|
||||
if (maximum_inversion_usectime > inputstruct[0].usecTime - saved_usec_time){
|
||||
if (inputstruct[0].PlasmaCurrent > 750){
|
||||
in_inversion_from_negative_to_positive_scenario = False;
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 2;
|
||||
n_cycles_temp--;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PrimaryWaveformMode = 1;
|
||||
outputstruct[0].HorizontalWaveformMode = 1;
|
||||
outputstruct[0].VerticalWaveformMode = 1;
|
||||
outputstruct[0].usecDischargeTime = inputstruct[0].usecTime - saved_usec_time;
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
outputstruct[0].DischargeStatus = 2;
|
||||
last_dischage_status = 2;
|
||||
}
|
||||
}
|
||||
else if (end_discharge_after_unsuccess_bool){
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: inversion_from_negative_to_positive not successful at %d us - ending dishcarge!!!", inputstruct[0].usecTime);
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].DischargeStatus = -3;
|
||||
last_dischage_status = -3;
|
||||
}
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: inversion_from_negative_to_positive not successful at %d us - skip phase !!!",inputstruct[0].usecTime);
|
||||
in_inversion_from_negative_to_positive_scenario = False;
|
||||
outputstruct[0].usecDischargeTime = 0;
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
last_dischage_status = 2;
|
||||
n_cycles_temp--;
|
||||
}
|
||||
}
|
||||
if (!in_positive_breakdown_scenario && !in_negative_breakdown_scenario && !in_inversion_from_positive_to_negative_scenario && !in_inversion_from_negative_to_positive_scenario && inputstruct[0].InSaturation == 1){
|
||||
if (n_cycles_temp == 1) n_cycles_temp = 0; // end dischage
|
||||
else{
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
if (outputstruct[0].PlasmaDirection == 0) in_inversion_from_negative_to_positive_scenario = True;
|
||||
else if (outputstruct[0].PlasmaDirection == 1) in_inversion_from_positive_to_negative_scenario = True;
|
||||
} //save usec_time for starting inversion waveform at 0s;
|
||||
AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: IRON CORE SATURATION ACHIVED at %d us !!!",inputstruct[0].usecTime );
|
||||
|
||||
}
|
||||
if ( !in_positive_breakdown_scenario && !in_negative_breakdown_scenario && !in_inversion_from_positive_to_negative_scenario && !in_inversion_from_negative_to_positive_scenario && inputstruct[0].InSaturation == 0 ){
|
||||
//normal timewindows sequence starting at 0
|
||||
outputstruct[0].ToroidalStatus = 1;
|
||||
|
||||
if (puffing_in_timewindows_mode) outputstruct[0].PuffingStatus = 1;
|
||||
else outputstruct[0].PuffingStatus = 0;
|
||||
|
||||
outputstruct[0].usecDischargeTime = (inputstruct[0].usecTime - saved_usec_time);
|
||||
if (outputstruct[0].PlasmaDirection == 1){
|
||||
outputstruct[0].PrimaryWaveformMode = this->primary_positive_timewindows->GetWaveformValue(outputstruct[0].usecDischargeTime);
|
||||
outputstruct[0].HorizontalWaveformMode = this->horizontal_positive_timewindows->GetWaveformValue(outputstruct[0].usecDischargeTime);
|
||||
outputstruct[0].VerticalWaveformMode = this->vertical_positive_timewindows->GetWaveformValue(outputstruct[0].usecDischargeTime);
|
||||
|
||||
if (outputstruct[0].PrimaryWaveformMode >2 && outputstruct[0].PrimaryWaveformMode <7) outputstruct[0].PrimaryWaveformMode = 2;
|
||||
if (outputstruct[0].HorizontalWaveformMode >2 && outputstruct[0].HorizontalWaveformMode <7) outputstruct[0].HorizontalWaveformMode = 2;
|
||||
if (outputstruct[0].VerticalWaveformMode >2 && outputstruct[0].VerticalWaveformMode <7) outputstruct[0].VerticalWaveformMode = 2;
|
||||
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
outputstruct[0].PlasmaDirection = 1;
|
||||
if (outputstruct[0].PrimaryWaveformMode == 7 && outputstruct[0].HorizontalWaveformMode == 7 && outputstruct[0].VerticalWaveformMode == 7){
|
||||
if (n_cycles_temp == 1) n_cycles_temp = 0; // end dischage
|
||||
else{
|
||||
saved_usec_time = inputstruct[0].usecTime;
|
||||
in_inversion_from_positive_to_negative_scenario = True; // invert
|
||||
} //save usec_time for starting inversion waveform at 0s;
|
||||
}
|
||||
last_dischage_status = 1;
|
||||
}
|
||||
if (outputstruct[0].PlasmaDirection == 0){
|
||||
outputstruct[0].PrimaryWaveformMode = this->primary_negative_timewindows->GetWaveformValue(outputstruct[0].usecDischargeTime);
|
||||
outputstruct[0].HorizontalWaveformMode = this->horizontal_negative_timewindows->GetWaveformValue(outputstruct[0].usecDischargeTime);
|
||||
outputstruct[0].VerticalWaveformMode = this->vertical_negative_timewindows->GetWaveformValue(outputstruct[0].usecDischargeTime);
|
||||
outputstruct[0].DischargeStatus = 1;
|
||||
outputstruct[0].PlasmaDirection = 0;
|
||||
if (outputstruct[0].PrimaryWaveformMode == 7 && outputstruct[0].HorizontalWaveformMode == 7 && outputstruct[0].VerticalWaveformMode == 7){
|
||||
if (n_cycles_temp == 1) n_cycles_temp =0; // end dischage
|
||||
else {
|
||||
saved_usec_time = inputstruct[0].usecTime; //save usec_time for starting inversion waveform at 0s;
|
||||
in_inversion_from_negative_to_positive_scenario = True;// invert
|
||||
}
|
||||
}
|
||||
last_dischage_status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* //apagar depois - testar tempo entre pre e shot
|
||||
if (inputstruct[0].usecTime < 0 || inputstruct[0].usecTime > 10000000) {
|
||||
apagar_depois_time_between_pre_and_shot = inputstruct[0].usecTime - initial_online_time;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
//trial - prepuffing and toroidal before 0 seconds (trigger)
|
||||
if (inputstruct[0].usecTime < 0 || inputstruct[0].usecTime > 10000000){
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (inputstruct[0].usecTime < usectime_to_wait_for_starting_operation) {
|
||||
// use this to previously start operation of slow systems ex.: toroidal field, pre-puffing (special overide place left blank for now)
|
||||
|
||||
if (puffing_in_timewindows_mode && puffing_mode != 4){
|
||||
outputstruct[0].PuffingMode = puffing_mode;
|
||||
outputstruct[0].PuffingStatus = -2;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].PuffingMode = 1;
|
||||
outputstruct[0].PuffingStatus = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if (inputstruct[0].usecTime > usectime_to_wait_for_starting_operation + discharge_time || n_cycles_temp <= 0){
|
||||
// discharge ended
|
||||
// AssertErrorCondition(InitialisationError,"TimeWindowsGAM::Execute: discharge ended at %d us !!!",inputstruct[0].usecTime );
|
||||
|
||||
saved_usec_time = 10000000;
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].DischargeStatus = -2;
|
||||
outputstruct[0].ToroidalStatus = -2;
|
||||
outputstruct[0].PuffingStatus = -2;
|
||||
last_dischage_status = -2;
|
||||
outputstruct[0].usecDischargeTime = -20000;
|
||||
}
|
||||
else {
|
||||
outputstruct[0].ToroidalMode = 1; // toroidal in absolute time always active between gamonline and end of discharge time
|
||||
//if (!puffing_in_timewindows_mode) outputstruct[0].PuffingMode = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (functionNumber == GAMPostpulse){
|
||||
|
||||
saved_usec_time = 10000000;
|
||||
outputstruct[0].PrimaryWaveformMode = 0;
|
||||
outputstruct[0].HorizontalWaveformMode = 0;
|
||||
outputstruct[0].VerticalWaveformMode = 0;
|
||||
outputstruct[0].PuffingMode = 0;
|
||||
outputstruct[0].ToroidalMode = 0;
|
||||
outputstruct[0].usecDischargeTime = -20000;
|
||||
outputstruct[0].DischargeStatus = -2;
|
||||
last_dischage_status = -2;
|
||||
}
|
||||
// AssertErrorCondition(InitialisationError,"TimeWindowsGAM:: %s OUTPUTSTRUCT = %d %d %d %d %d %d",this->Name(), outputstruct[0].PrimaryWaveformMode , outputstruct[0].HorizontalWaveformMode , outputstruct[0].VerticalWaveformMode , outputstruct[0].usecDischargeTime , outputstruct[0].PlasmaDirection , outputstruct[0].DischargeStatus );
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool TimeWindowsGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>discharge_time = %.1f us\n\
|
||||
<br>number_of_cycles = %d\n\
|
||||
<br>first_cycle_positive_bool = %d\n\
|
||||
<br>auto_breakdown = %d\n\
|
||||
<br>usecthread_cycle_time = %d\n\
|
||||
<br>usec_pre_pulse_time = %d\n\
|
||||
<br>maximum_inversion_usectime = %d\n\
|
||||
<br>usectime_to_wait_for_starting_operation = %d\n\
|
||||
<br><br", discharge_time,number_of_cycles,first_cycle_positive_bool,auto_breakdown,usecthread_cycle_time,usec_pre_pulse_time,maximum_inversion_usectime,usectime_to_wait_for_starting_operation);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\">\n<tr>\n<th>positive_number_of_time_windows</th>\n<th>%d</th>\n</tr>\n<tr>\n<td>positive_time_windows_values</td", positive_number_of_time_windows);
|
||||
for (i=0;i<positive_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.1f</td",positive_time_windows_values[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><td>positive_primary_mode</td");
|
||||
for (i=0;i<positive_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",positive_primary_mode[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><td>positive_horizontal_mode</td");
|
||||
for (i=0;i<positive_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",positive_horizontal_mode[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><td>positive_vertical_mode</td");
|
||||
for (i=0;i<positive_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",positive_vertical_mode[i]);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\">\n<tr>\n<th>negative_number_of_time_windows</th>\n<th>%d</th>\n</tr>\n<tr>\n<td>negative_time_windows_values</td", negative_number_of_time_windows);
|
||||
for (i=0;i<negative_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.1f</td",negative_time_windows_values[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><td>negative_primary_mode</td");
|
||||
for (i=0;i<negative_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",negative_primary_mode[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><td>negative_horizontal_mode</td");
|
||||
for (i=0;i<negative_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",negative_horizontal_mode[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><td>negative_vertical_mode</td");
|
||||
for (i=0;i<negative_number_of_time_windows;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",negative_vertical_mode[i]);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br><br");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* File: LookupTable.h
|
||||
* Author: ivoc, ipfn
|
||||
*
|
||||
* Created on August 26, 2010
|
||||
* last modified on August 26, 2010
|
||||
* version: 0.1
|
||||
*/
|
||||
|
||||
#ifndef _TIMEWINDOWSGAM_H
|
||||
#define _TIMEWINDOWSGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "HtmlStream.h"
|
||||
#include "GAM.h"
|
||||
#include "IntegerSequentialControl.h"
|
||||
|
||||
OBJECT_DLL(TimeWindowsGAM)
|
||||
|
||||
|
||||
class TimeWindowsGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float PlasmaCurrent;
|
||||
int usecTime;
|
||||
int InSaturation;
|
||||
int SlowStopBool;
|
||||
int HardStopBool;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
int PrimaryWaveformMode;
|
||||
int HorizontalWaveformMode;
|
||||
int VerticalWaveformMode;
|
||||
int usecDischargeTime;
|
||||
int PlasmaDirection;
|
||||
int DischargeStatus;
|
||||
int ToroidalMode;
|
||||
int ToroidalStatus;
|
||||
int PuffingMode;
|
||||
int PuffingStatus;
|
||||
};
|
||||
|
||||
IntegerSequentialControl *vertical_positive_timewindows;
|
||||
IntegerSequentialControl *horizontal_positive_timewindows;
|
||||
IntegerSequentialControl *primary_positive_timewindows;
|
||||
IntegerSequentialControl *vertical_negative_timewindows;
|
||||
IntegerSequentialControl *horizontal_negative_timewindows;
|
||||
IntegerSequentialControl *primary_negative_timewindows;
|
||||
|
||||
int usec_pre_pulse_time;
|
||||
int last_dischage_status;
|
||||
int last_plasma_direction;
|
||||
int maximum_inversion_usectime;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
int time_between_online_and_discharge;
|
||||
int saved_usec_time;
|
||||
int n_cycles_temp;
|
||||
int initial_online_time;
|
||||
|
||||
|
||||
int apagar_depois_time_between_pre_and_shot;
|
||||
|
||||
|
||||
bool in_positive_breakdown_scenario;
|
||||
bool in_negative_breakdown_scenario;
|
||||
bool in_inversion_from_positive_to_negative_scenario;
|
||||
bool in_inversion_from_negative_to_positive_scenario;
|
||||
bool power_supplies_started;
|
||||
bool end_discharge_after_unsuccess_bool;
|
||||
|
||||
bool auto_breakdown;
|
||||
|
||||
int usecthread_cycle_time;
|
||||
|
||||
// FString Directory;
|
||||
float discharge_time;
|
||||
int number_of_cycles;
|
||||
bool first_cycle_positive_bool;
|
||||
// positive_time_windows
|
||||
int positive_number_of_time_windows;
|
||||
float *positive_time_windows_values;
|
||||
int *corrected_positive_time_windows_values;
|
||||
int *positive_primary_mode;
|
||||
int *positive_horizontal_mode;
|
||||
int *positive_vertical_mode;
|
||||
// negative_time_windows
|
||||
int negative_number_of_time_windows;
|
||||
float *negative_time_windows_values;
|
||||
int *corrected_negative_time_windows_values;
|
||||
int *negative_primary_mode;
|
||||
int *negative_horizontal_mode;
|
||||
int *negative_vertical_mode;
|
||||
|
||||
int puffing_mode;
|
||||
bool puffing_in_timewindows_mode;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
TimeWindowsGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~TimeWindowsGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
|
||||
OBJECT_DLL_STUFF(TimeWindowsGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,970 @@
|
||||
|
||||
#include "TomographyGAM.h"
|
||||
|
||||
|
||||
OBJECTLOADREGISTER(TomographyGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
TomographyGAM::TomographyGAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
TomographyGAM::~TomographyGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ********* Initialise the module ********************************
|
||||
bool TomographyGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
int i;
|
||||
|
||||
|
||||
if(!cdb.ReadInt32(nch, "nch"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s nch",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: nch = %d",nch);
|
||||
|
||||
onlineChannels = new int[nch];
|
||||
|
||||
if(!cdb.ReadInt32Array(onlineChannels, (int *)(&nch), 1, "onlineChannels"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not onlineChannels");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<nch;i++) AssertErrorCondition(Information,"TomographyGAM::Initialise: onlineChannels[%d] = %d",i, onlineChannels[i]);
|
||||
|
||||
|
||||
if(!cdb.ReadInt32(i, "tomography_radial_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s tomography_radial_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
tomography_radial_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"TomographyGAM::Initialise: tomography_radial_bool = %d",tomography_radial_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(i, "tomography_vertical_bool"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s tomography_vertical_bool",this->Name());
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
tomography_vertical_bool = (bool)i;
|
||||
AssertErrorCondition(Information,"TomographyGAM::Initialise: tomography_vertical_bool = %d",tomography_vertical_bool);
|
||||
}
|
||||
if(!cdb.ReadInt32(usectime_to_wait_for_starting_operation, "usectime_to_wait_for_starting_operation"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s usectime_to_wait_for_starting_operation",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: usectime_to_wait_for_starting_operation = %d",usectime_to_wait_for_starting_operation);
|
||||
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "TomographyGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "TomographyGAM::Initialise: %s failed to add the TomographyGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "TomographyGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "TomographyGAM::Initialise: %s failed to add the TomographyGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 25;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
for(i=0;i<(number_of_signals_to_read-1);i++) CDB_move_to[i].Printf("Channel_%d",i);
|
||||
CDB_move_to[number_of_signals_to_read-1].Printf("system_time");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"TomographyGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 3;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("tomography_r");
|
||||
CDB_move_to[1].Printf("tomography_z");
|
||||
CDB_move_to[2].Printf("tomography_intensity");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"TomographyGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
// READ tomography file
|
||||
File temp_file;
|
||||
FString file_to_read;
|
||||
ConfigurationDataBase file_cdb;
|
||||
|
||||
if(!cdb.ReadFString(file_to_read, "file_to_load"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s Could not get file_to_load",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: file_to_load = %s",file_to_read.Buffer());
|
||||
|
||||
if(!temp_file.OpenRead(file_to_read.Buffer())){
|
||||
AssertErrorCondition(InitialisationError, "TomographyGAM::Initialise: Failed opening File %s", file_to_read.Buffer() );
|
||||
// temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
|
||||
file_cdb->ReadFromStream(temp_file);
|
||||
CDBExtended cdbe(file_cdb);
|
||||
|
||||
if(!cdbe.ReadInt32(nchd, "nchd"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s nchd",this->Name());
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: nchd = %d",nchd);
|
||||
if(!cdbe.ReadInt32(nbf, "nbf"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: %s nbf",this->Name());
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: nbf = %d",nbf);
|
||||
i=2;
|
||||
if(!cdbe.ReadInt32Array(griddim, (int *) &i, 1, "griddim"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not read griddim");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<2;i++) AssertErrorCondition(Information,"TomographyGAM::Initialise: griddim[%d] = %d",i, griddim[i]);
|
||||
|
||||
xx = new float[griddim[1]];
|
||||
yy = new float[griddim[1]];
|
||||
svsolW = new float[nbf];
|
||||
|
||||
if(!cdbe.ReadFloatArray(xx, (int *)(&griddim[1]), 1, "xx"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not read xx");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<nbf;i++) AssertErrorCondition(Information,"TomographyGAM::Initialise: xx[%d] = %f",i, xx[i]);
|
||||
if(!cdbe.ReadFloatArray(yy, (int *)(&griddim[1]), 1, "yy"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not read yy");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<nbf;i++) AssertErrorCondition(Information,"TomographyGAM::Initialise: yy[%d] = %f",i, yy[i]);
|
||||
if(!cdbe.ReadFloatArray(svsolW, (int *)(&nbf), 1, "yy"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not read svsolW");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<nbf;i++) AssertErrorCondition(Information,"TomographyGAM::Initialise: svsolW[%d] = %f",i, svsolW[i]);
|
||||
|
||||
temp_max_dim = 2;
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"gmask",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get gmask dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: gmask dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
gmask.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadInt32Array((int *)gmask.data,temp_dims,2,"gmask")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read gmask matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded gmask matrix");
|
||||
gmask = ~gmask; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"svsolV",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get svsolV dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: svsolV dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
svsolV.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)svsolV.data,temp_dims,2,"svsolV")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read svsolV matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded svsolV matrix");
|
||||
svsolV = ~svsolV; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"svsolU",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get svsolU dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: svsolU dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
svsolU.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)svsolU.data,temp_dims,2,"svsolU")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read svsolU matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded svsolU matrix");
|
||||
svsolU = ~svsolU; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl00c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl00c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl00c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl00c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl00c.data,temp_dims,2,"grnl00c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl00c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl00c matrix");
|
||||
grnl00c = ~grnl00c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl01c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl01c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl01c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl01c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl01c.data,temp_dims,2,"grnl01c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl01c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl01c matrix");
|
||||
grnl01c = ~grnl01c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl02c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl02c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl02c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl02c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl02c.data,temp_dims,2,"grnl02c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl02c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl02c matrix");
|
||||
grnl02c = ~grnl02c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl10c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl10c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl10c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl10c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl10c.data,temp_dims,2,"grnl10c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl10c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl10c matrix");
|
||||
grnl10c = ~grnl10c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl11c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl11c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl11c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl11c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl11c.data,temp_dims,2,"grnl11c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl11c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl11c matrix");
|
||||
grnl11c = ~grnl11c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl12c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl12c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl12c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl12c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl12c.data,temp_dims,2,"grnl12c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl12c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl12c matrix");
|
||||
grnl12c = ~grnl12c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl20c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl20c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl20c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl20c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl20c.data,temp_dims,2,"grnl20c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl20c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl20c matrix");
|
||||
grnl20c = ~grnl20c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl21c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl21c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl21c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl21c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl21c.data,temp_dims,2,"grnl21c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl21c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl21c matrix");
|
||||
grnl21c = ~grnl21c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl22c",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl22c dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl22c dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl22c.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl22c.data,temp_dims,2,"grnl22c")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl22c matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl22c matrix");
|
||||
grnl22c = ~grnl22c; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl10s",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl10s dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl10s dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl10s.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl10s.data,temp_dims,2,"grnl10s")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl10s matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl10s matrix");
|
||||
grnl10s = ~grnl10s; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl11s",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl11s dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl11s dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl11s.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl11s.data,temp_dims,2,"grnl11s")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl11s matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl11s matrix");
|
||||
grnl11s = ~grnl11s; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl12s",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl12s dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl12s dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl12s.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl12s.data,temp_dims,2,"grnl12s")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl12s matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl12s matrix");
|
||||
grnl12s = ~grnl12s; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl20s",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl20s dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl20s dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl20s.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl20s.data,temp_dims,2,"grnl20s")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl20s matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl20s matrix");
|
||||
grnl20s = ~grnl20s; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl21s",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl21s dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl21s dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl21s.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl21s.data,temp_dims,2,"grnl21s")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl21s matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl21s matrix");
|
||||
grnl21s = ~grnl21s; //transpose
|
||||
|
||||
if (!cdbe->GetArrayDims(temp_dims,temp_max_dim,"grnl22s",CDBAIM_Strict)){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: Could not get grnl22s dimension");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
if (temp_max_dim != 2 || temp_dims[0] == 0 || temp_dims[1] == 0){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: grnl22s dimension != 2");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
grnl22s.ReSize(temp_dims[0],temp_dims[1]);
|
||||
if (!cdbe.ReadFloatArray((float *)grnl22s.data,temp_dims,2,"grnl22s")){
|
||||
AssertErrorCondition(InitialisationError,"TomographyGAM::Initialise: could not read grnl22s matrix");
|
||||
temp_file.Close();
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"TomographyGAM::Initialise: successfully loaded grnl22s matrix");
|
||||
grnl22s = ~grnl22s; //transpose
|
||||
|
||||
|
||||
reconstruction.ReSize(griddim[0],griddim[1]);
|
||||
int nchOn = 0;
|
||||
for (i=0; i<this->nch; i++) if (this->onlineChannels[i]) nchOn++;
|
||||
|
||||
usedSignals = new float[nch];
|
||||
remove_offset = new float[nch];
|
||||
accumulator = new float[nch];
|
||||
tempArrayN = new float[nbf];
|
||||
aFit = new float[nbf];
|
||||
|
||||
temp_file.Close();
|
||||
|
||||
return True;
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
|
||||
// ********* Execute the module functionalities *******************
|
||||
bool TomographyGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"TomographyGAM:: %s inputstruct = %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %d",this->Name(),inputstruct[0].ADC_tomography_top_0,inputstruct[0].ADC_tomography_top_1,inputstruct[0].ADC_tomography_top_2,inputstruct[0].ADC_tomography_top_3,inputstruct[0].ADC_tomography_top_4,inputstruct[0].ADC_tomography_top_5,inputstruct[0].ADC_tomography_top_6,inputstruct[0].ADC_tomography_top_7,inputstruct[0].ADC_tomography_outer_0,inputstruct[0].ADC_tomography_outer_1,inputstruct[0].ADC_tomography_outer_2,inputstruct[0].ADC_tomography_outer_3,inputstruct[0].ADC_tomography_outer_4,inputstruct[0].ADC_tomography_outer_5,inputstruct[0].ADC_tomography_outer_6,inputstruct[0].ADC_tomography_outer_7,inputstruct[0].ADC_tomography_bottom_0,inputstruct[0].ADC_tomography_bottom_1,inputstruct[0].ADC_tomography_bottom_2,inputstruct[0].ADC_tomography_bottom_3,inputstruct[0].ADC_tomography_bottom_4,inputstruct[0].ADC_tomography_bottom_5,inputstruct[0].ADC_tomography_bottom_6,inputstruct[0].ADC_tomography_bottom_7, inputstruct[0].usectime);
|
||||
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
if(inputstruct[0].usectime > 0 && inputstruct[0].usectime < usectime_to_wait_for_starting_operation){
|
||||
n_samples++;
|
||||
|
||||
accumulator[0] += (float)inputstruct[0].ADC_tomography_top_0;
|
||||
accumulator[1] += (float)inputstruct[0].ADC_tomography_top_1;
|
||||
accumulator[2] += (float)inputstruct[0].ADC_tomography_top_2;
|
||||
accumulator[3] += (float)inputstruct[0].ADC_tomography_top_3;
|
||||
accumulator[4] += (float)inputstruct[0].ADC_tomography_top_4;
|
||||
accumulator[5] += (float)inputstruct[0].ADC_tomography_top_5;
|
||||
accumulator[6] += (float)inputstruct[0].ADC_tomography_top_6;
|
||||
accumulator[7] += (float)inputstruct[0].ADC_tomography_top_7;
|
||||
accumulator[8] += (float)inputstruct[0].ADC_tomography_outer_0;
|
||||
accumulator[9] += (float)inputstruct[0].ADC_tomography_outer_1;
|
||||
accumulator[10] += (float)inputstruct[0].ADC_tomography_outer_2;
|
||||
accumulator[11] += (float)inputstruct[0].ADC_tomography_outer_3;
|
||||
accumulator[12] += (float)inputstruct[0].ADC_tomography_outer_4;
|
||||
accumulator[13] += (float)inputstruct[0].ADC_tomography_outer_5;
|
||||
accumulator[14] += (float)inputstruct[0].ADC_tomography_outer_6;
|
||||
accumulator[15] += (float)inputstruct[0].ADC_tomography_outer_7;
|
||||
accumulator[16] += (float)inputstruct[0].ADC_tomography_bottom_0;
|
||||
accumulator[17] += (float)inputstruct[0].ADC_tomography_bottom_1;
|
||||
accumulator[18] += (float)inputstruct[0].ADC_tomography_bottom_2;
|
||||
accumulator[19] += (float)inputstruct[0].ADC_tomography_bottom_3;
|
||||
accumulator[20] += (float)inputstruct[0].ADC_tomography_bottom_4;
|
||||
accumulator[21] += (float)inputstruct[0].ADC_tomography_bottom_5;
|
||||
accumulator[22] += (float)inputstruct[0].ADC_tomography_bottom_6;
|
||||
accumulator[23] += (float)inputstruct[0].ADC_tomography_bottom_7;
|
||||
|
||||
outputstruct[0].TomographyR = 0;
|
||||
outputstruct[0].TomographyZ = 0;
|
||||
outputstruct[0].TomographyIntensity = 0;
|
||||
|
||||
for(i=0;i<nch;i++) remove_offset[i] = accumulator[i] / n_samples;
|
||||
}
|
||||
else{
|
||||
if (this->n_samples >0 ){
|
||||
|
||||
for(i = 0 ; i < this->nch ; i++) AssertErrorCondition(Information,"MagneticsGAM::Execute: %s OFFSETS %d = %f, number of samples = %d", this->Name(), i, this->remove_offset[i], n_samples);
|
||||
n_samples = 0;
|
||||
}
|
||||
|
||||
usedSignals[0] = (float) inputstruct[0].ADC_tomography_top_0 - remove_offset[0];
|
||||
usedSignals[1] = (float) inputstruct[0].ADC_tomography_top_1 - remove_offset[1];
|
||||
usedSignals[2] = (float) inputstruct[0].ADC_tomography_top_2 - remove_offset[2];
|
||||
usedSignals[3] = (float) inputstruct[0].ADC_tomography_top_3 - remove_offset[3];
|
||||
usedSignals[4] = (float) inputstruct[0].ADC_tomography_top_4 - remove_offset[4];
|
||||
usedSignals[5] = (float) inputstruct[0].ADC_tomography_top_5 - remove_offset[5];
|
||||
usedSignals[6] = (float) inputstruct[0].ADC_tomography_top_6 - remove_offset[6];
|
||||
usedSignals[7] = (float) inputstruct[0].ADC_tomography_top_7 - remove_offset[7];
|
||||
usedSignals[8] = (float) inputstruct[0].ADC_tomography_outer_0 - remove_offset[8];
|
||||
usedSignals[9] = (float) inputstruct[0].ADC_tomography_outer_1 - remove_offset[9];
|
||||
usedSignals[10] = (float) inputstruct[0].ADC_tomography_outer_2 - remove_offset[10];
|
||||
usedSignals[11] = (float) inputstruct[0].ADC_tomography_outer_3 - remove_offset[11];
|
||||
usedSignals[12] = (float) inputstruct[0].ADC_tomography_outer_4 - remove_offset[12];
|
||||
usedSignals[13] = (float) inputstruct[0].ADC_tomography_outer_5 - remove_offset[13];
|
||||
usedSignals[14] = (float) inputstruct[0].ADC_tomography_outer_6 - remove_offset[14];
|
||||
usedSignals[15] = (float) inputstruct[0].ADC_tomography_outer_7 - remove_offset[15];
|
||||
usedSignals[16] = (float) inputstruct[0].ADC_tomography_bottom_0 - remove_offset[16];
|
||||
usedSignals[17] = (float) inputstruct[0].ADC_tomography_bottom_1 - remove_offset[17];
|
||||
usedSignals[18] = (float) inputstruct[0].ADC_tomography_bottom_2 - remove_offset[18];
|
||||
usedSignals[19] = (float) inputstruct[0].ADC_tomography_bottom_3 - remove_offset[19];
|
||||
usedSignals[20] = (float) inputstruct[0].ADC_tomography_bottom_4 - remove_offset[20];
|
||||
usedSignals[21] = (float) inputstruct[0].ADC_tomography_bottom_5 - remove_offset[21];
|
||||
usedSignals[22] = (float) inputstruct[0].ADC_tomography_bottom_6 - remove_offset[22];
|
||||
usedSignals[23] = (float) inputstruct[0].ADC_tomography_bottom_7 - remove_offset[23];
|
||||
|
||||
//Algorithm described in Numerical Recipes in C, ch15.4
|
||||
for (j=0; j<nbf; j++){
|
||||
s=0;
|
||||
for( i=0; i<nch;i++){ //360 cycles
|
||||
|
||||
if (onlineChannels[i]) s += svsolU[j][i]*usedSignals[i];
|
||||
}
|
||||
s *= svsolW[j];
|
||||
tempArrayN[j]=s;
|
||||
}
|
||||
for (i=0; i<nbf; i++){
|
||||
|
||||
s = 0.;
|
||||
for (j=0; j<nbf; j++){ //225 cycles
|
||||
|
||||
s += (svsolV[j][i] * tempArrayN[j]);
|
||||
}
|
||||
aFit[i] = s;
|
||||
}
|
||||
//drawing of the reconstruction by multiplying the fitted parameters in 'aFit' by the basis functions previously calculated and stored in the configuration file
|
||||
mass = 0.;
|
||||
x = 0.;
|
||||
y = 0.;
|
||||
for (i=0; i<griddim[0]; i++){
|
||||
for (j=0; j<griddim[1]; j++){
|
||||
|
||||
if (gmask[i][j]){ //149 cycles
|
||||
|
||||
reconstruction[i][j]= aFit[0]*grnl00c[i][j] + aFit[1]*grnl01c[i][j] + aFit[2]*grnl02c[i][j] + aFit[3]*grnl10c[i][j] + aFit[4]*grnl11c[i][j] + aFit[5]*grnl12c[i][j] + aFit[6]*grnl20c[i][j] + aFit[7]*grnl21c[i][j] + aFit[8]*grnl22c[i][j] + aFit[9]*grnl10s[i][j] + aFit[10]*grnl11s[i][j] + aFit[11]*grnl12s[i][j] + aFit[12]*grnl20s[i][j] + aFit[13]*grnl21s[i][j] + aFit[14]*grnl22s[i][j];
|
||||
mass += reconstruction[i][j];
|
||||
x += xx[i] * reconstruction[i][j];
|
||||
y += yy[j] * reconstruction[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mass != 0.){
|
||||
outputstruct[0].TomographyR = x / (mass);
|
||||
outputstruct[0].TomographyZ = y / (mass);
|
||||
}
|
||||
else {
|
||||
outputstruct[0].TomographyR = 0.;
|
||||
outputstruct[0].TomographyZ = 0.;
|
||||
}
|
||||
|
||||
outputstruct[0].TomographyIntensity = 0.;
|
||||
for( i=0; i<nch;i++) if (onlineChannels[i]) outputstruct[0].TomographyIntensity += usedSignals[i];
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
outputstruct[0].TomographyR = 0;
|
||||
outputstruct[0].TomographyZ = 0;
|
||||
outputstruct[0].TomographyIntensity = 0;
|
||||
n_samples = 0;
|
||||
for (i=0;i<this->nch;i++){
|
||||
remove_offset[i] = 0;
|
||||
accumulator[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool TomographyGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>tomography_radial_bool = %d\n\
|
||||
<br>tomography_vertical_bool = %d\n\
|
||||
<br>nch = %d\n\
|
||||
<br>nchd = %d\n\
|
||||
<br>nbf = %d\n\
|
||||
<br>griddim[0] = %d, griddim[1] = %d\n\
|
||||
<br><br", tomography_radial_bool,tomography_vertical_bool,nch,nchd,nbf,griddim[0],griddim[1]);
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>onlineChannels</td");
|
||||
for (i=0;i<nch;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%d</td",onlineChannels[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>xx</td");
|
||||
for (i=0;i<nbf;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.4f</td",xx[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>yy</td");
|
||||
for (i=0;i<nbf;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.4f</td",yy[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>svsolW</td");
|
||||
for (i=0;i<nbf;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.4f</td",svsolW[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
|
||||
|
||||
int j;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>gmask</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %d </td",gmask[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>svsolV</b>\n<table border=\"1\"");
|
||||
for (j=0;j<nbf;j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<nbf;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",svsolV[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>svsolU</b>\n<table border=\"1\"");
|
||||
for (j=0;j<nch;j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<nbf;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",svsolU[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl00c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl00c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl01c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl01c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl02c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl02c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl10c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl10c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl11c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl11c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl12c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl12c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl20c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl20c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl21c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl21c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl22c</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl22c[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl10s</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl10s[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl11s</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl11s[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl12s</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl12s[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl20s</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl20s[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl21s</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl21s[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><b>grnl22s</b>\n<table border=\"1\"");
|
||||
for (j=0;j<griddim[0];j++){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "tr");
|
||||
for (i=0;i<griddim[1];i++)hmStream.SSPrintf(HtmlTagStreamMode, "td> %.4f </td",grnl22s[i][j]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/table><br");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* File: LookupTable.h
|
||||
* Author: ivoc, ipfn
|
||||
*
|
||||
* Created on August 26, 2010
|
||||
* last modified on August 26, 2010
|
||||
* version: 0.1
|
||||
*/
|
||||
|
||||
#ifndef _TOMOGRAPHYGAM_H
|
||||
#define _TOMOGRAPHYGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "File.h"
|
||||
#include "Matrix.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(TomographyGAM)
|
||||
|
||||
|
||||
class TomographyGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
float ADC_tomography_top_0;
|
||||
float ADC_tomography_top_1;
|
||||
float ADC_tomography_top_2;
|
||||
float ADC_tomography_top_3;
|
||||
float ADC_tomography_top_4;
|
||||
float ADC_tomography_top_5;
|
||||
float ADC_tomography_top_6;
|
||||
float ADC_tomography_top_7;
|
||||
float ADC_tomography_outer_0;
|
||||
float ADC_tomography_outer_1;
|
||||
float ADC_tomography_outer_2;
|
||||
float ADC_tomography_outer_3;
|
||||
float ADC_tomography_outer_4;
|
||||
float ADC_tomography_outer_5;
|
||||
float ADC_tomography_outer_6;
|
||||
float ADC_tomography_outer_7;
|
||||
float ADC_tomography_bottom_0;
|
||||
float ADC_tomography_bottom_1;
|
||||
float ADC_tomography_bottom_2;
|
||||
float ADC_tomography_bottom_3;
|
||||
float ADC_tomography_bottom_4;
|
||||
float ADC_tomography_bottom_5;
|
||||
float ADC_tomography_bottom_6;
|
||||
float ADC_tomography_bottom_7;
|
||||
int usectime;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float TomographyR;
|
||||
float TomographyZ;
|
||||
float TomographyIntensity;
|
||||
};
|
||||
|
||||
// float *signals;
|
||||
|
||||
bool tomography_radial_bool;
|
||||
bool tomography_vertical_bool;
|
||||
int usectime_to_wait_for_starting_operation;
|
||||
int nch;
|
||||
int *onlineChannels;
|
||||
|
||||
int nchd;
|
||||
int nbf;
|
||||
int n_samples;
|
||||
int griddim[2];
|
||||
float *xx;
|
||||
float *yy;
|
||||
float *svsolW;
|
||||
float *usedSignals;
|
||||
float *remove_offset;
|
||||
float *accumulator;
|
||||
float *tempArrayN;
|
||||
float *aFit;
|
||||
|
||||
MatrixT<int> gmask;
|
||||
MatrixT<float> svsolV;
|
||||
MatrixT<float> svsolU;
|
||||
MatrixT<float> grnl00c;
|
||||
MatrixT<float> grnl01c;
|
||||
MatrixT<float> grnl02c;
|
||||
MatrixT<float> grnl10c;
|
||||
MatrixT<float> grnl11c;
|
||||
MatrixT<float> grnl12c;
|
||||
MatrixT<float> grnl20c;
|
||||
MatrixT<float> grnl21c;
|
||||
MatrixT<float> grnl22c;
|
||||
MatrixT<float> grnl10s;
|
||||
MatrixT<float> grnl11s;
|
||||
MatrixT<float> grnl12s;
|
||||
MatrixT<float> grnl20s;
|
||||
MatrixT<float> grnl21s;
|
||||
MatrixT<float> grnl22s;
|
||||
MatrixT<float> reconstruction;
|
||||
|
||||
int temp_dims[2];
|
||||
int temp_max_dim;
|
||||
|
||||
float x;
|
||||
float y;
|
||||
|
||||
float mass;
|
||||
|
||||
int i;
|
||||
int j;
|
||||
float s;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
TomographyGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~TomographyGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(TomographyGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _LOOKUPTABLE_H */
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
#include "UFSerialUART.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Default constructor/destructor
|
||||
// ******************************************************************
|
||||
UFSerialUART::UFSerialUART(unsigned int address)
|
||||
{
|
||||
this->UARTPortAddress = address;
|
||||
this->NineBitMode = false;
|
||||
|
||||
//
|
||||
// Get permission from the kernel to access the UART ports
|
||||
//
|
||||
#if !defined(_RTAI)
|
||||
if(ioperm(this->UARTPortAddress, 8, 1))
|
||||
this->KernelPermission = false;
|
||||
else
|
||||
this->KernelPermission = true;
|
||||
#else
|
||||
this->KernelPermission = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
UFSerialUART::~UFSerialUART()
|
||||
{
|
||||
//
|
||||
// Release permission from the kernel to access the UART ports
|
||||
//
|
||||
#if !defined(_RTAI)
|
||||
ioperm(this->UARTPortAddress, 8, 0);
|
||||
#endif
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Get UART initialisation status
|
||||
// ******************************************************************
|
||||
bool UFSerialUART::IsUARTInitialised()
|
||||
{
|
||||
return this->KernelPermission;
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Set/Get UART port address
|
||||
// ******************************************************************
|
||||
void UFSerialUART::SetUARTPortAddress(unsigned int address)
|
||||
{
|
||||
this->UARTPortAddress = address;
|
||||
}
|
||||
|
||||
|
||||
unsigned int UFSerialUART::GetUARTPortAddress()
|
||||
{
|
||||
return this->UARTPortAddress;
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// DLAB Set/Clear
|
||||
// ******************************************************************
|
||||
void UFSerialUART::SetDLAB()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
outb(LcrValue | 0x80, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::ClearDLAB()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
outb(LcrValue & 0x7F, LCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Set Frequency Divider
|
||||
// IMPORTANT: only call when DLAB = 0
|
||||
// ******************************************************************
|
||||
void UFSerialUART::SetFrequencyDivider(unsigned short newDivider)
|
||||
{
|
||||
unsigned char Low = (unsigned char)(newDivider & 0x00FF);
|
||||
unsigned char High = (unsigned char)((newDivider & 0xFF00) >> 8);
|
||||
|
||||
SetDLAB();
|
||||
outb(Low, DLL);
|
||||
outb(High, DLM);
|
||||
ClearDLAB();
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Configure LCR: 8-bits, 1 stop bit, keep the rest of the byte
|
||||
// TODO: erase this method
|
||||
// ******************************************************************
|
||||
void UFSerialUART::ConfigureLCR()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue |= 0x03;
|
||||
LcrValue &= 0xFB;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Select operation mode
|
||||
// ******************************************************************
|
||||
void UFSerialUART::Select950Mode()
|
||||
{
|
||||
unsigned char FcrValue = inb(FCR);
|
||||
FcrValue |= 0x01;
|
||||
outb(FcrValue, FCR);
|
||||
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
outb(0xBF, LCR);
|
||||
unsigned char EfrValue = inb(EFR);
|
||||
EfrValue |= 0x10;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Enable/Disable 9-bit mode
|
||||
// ******************************************************************
|
||||
void UFSerialUART::Enable9BitMode()
|
||||
{
|
||||
outb(0x0D, SPR);
|
||||
outb(0x01, ICR);
|
||||
|
||||
this->NineBitMode = true;
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::Disable9BitMode()
|
||||
{
|
||||
outb(0x0D, SPR);
|
||||
outb(0x00, ICR);
|
||||
|
||||
this->NineBitMode = false;
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Set Low/High Parity
|
||||
// ******************************************************************
|
||||
void UFSerialUART::DisableParity()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
outb(LcrValue & 0xF7, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetLowParity()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
outb(LcrValue | 0x38, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetHighParity()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue |= 0x28;
|
||||
LcrValue &= 0xEF;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetEvenParity()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue |= 0x18;
|
||||
LcrValue &= 0xDF;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetOddParity()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue |= 0x08;
|
||||
LcrValue &= 0xCF;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Set Data Length
|
||||
// ******************************************************************
|
||||
void UFSerialUART::SetFiveBitsLength()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue &= 0xFC;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetSixBitsLength()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue &= 0xFD;
|
||||
LcrValue |= 0x01;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetSevenBitsLength()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue &= 0xFE;
|
||||
LcrValue |= 0x02;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SetEightBitsLength()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue |= 0x03;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Enable/disable usage of FIFOs
|
||||
// ******************************************************************
|
||||
void UFSerialUART::EnableFifos()
|
||||
{
|
||||
outb(0xF7, FCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::DisableFifos()
|
||||
{
|
||||
outb(0xF6, FCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Select number of stop bits
|
||||
// ******************************************************************
|
||||
void UFSerialUART::SelectOneStopBit()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue &= 0xFB;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::SelectTwoStopBits()
|
||||
{
|
||||
unsigned char LcrValue = inb(LCR);
|
||||
LcrValue |= 0x04;
|
||||
outb(LcrValue, LCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Clear FIFOs
|
||||
// Note: I don't know if these methods work with the 950 UARTs
|
||||
// ******************************************************************
|
||||
void UFSerialUART::ClearTxFifo()
|
||||
{
|
||||
unsigned char FcrValue = inb(FCR);
|
||||
outb(FcrValue | 0x04, FCR);
|
||||
}
|
||||
|
||||
|
||||
void UFSerialUART::ClearRxFifo()
|
||||
{
|
||||
unsigned char FcrValue = inb(FCR);
|
||||
outb(FcrValue | 0x02, FCR);
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Check if there is data waiting to be read
|
||||
// ******************************************************************
|
||||
bool UFSerialUART::IsDataAvailable()
|
||||
{
|
||||
if((inb(LSR) & 0x01) == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// Send/receive value
|
||||
// ******************************************************************
|
||||
bool UFSerialUART::SendValue(unsigned short value)
|
||||
{
|
||||
// TODO: delete these comments
|
||||
//unsigned char result = inb(LSR);
|
||||
//if((result & 0x20))
|
||||
// outb(value, THR);
|
||||
//else
|
||||
// return -1;
|
||||
|
||||
// Place the 9th bit
|
||||
if(this->NineBitMode)
|
||||
{
|
||||
if(value & 0x0100)
|
||||
outb(0x01, SPR);
|
||||
else
|
||||
outb(0x00, SPR);
|
||||
}
|
||||
outb((unsigned char)(value & 0x00FF), THR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// TODO:
|
||||
bool UFSerialUART::ReadValue(unsigned short &value)
|
||||
{
|
||||
bool Is9BitAsserted = false;
|
||||
|
||||
//
|
||||
// Get the 9th bit
|
||||
//
|
||||
if(this->NineBitMode)
|
||||
{
|
||||
if(inb(LSR) & 0x04)
|
||||
Is9BitAsserted = true;
|
||||
else
|
||||
Is9BitAsserted = false;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the remainder of the value
|
||||
//
|
||||
value = (unsigned short) inb(RHR);
|
||||
value &= 0x00FF;
|
||||
|
||||
//
|
||||
// Mix the 9 bits
|
||||
//
|
||||
if(Is9BitAsserted)
|
||||
value |= 0x0100;
|
||||
|
||||
return true;
|
||||
}
|
||||
// ******************************************************************
|
||||
116
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/UFSerialUART.h
Normal file
116
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/UFSerialUART.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* File: UFSerialUart.h
|
||||
* Author: danielv
|
||||
* Note: this class only works with the 950 UARTs
|
||||
*
|
||||
* Created on March 5, 2009, 9:30 AM
|
||||
*/
|
||||
|
||||
#ifndef __UFSERIALUART_H__
|
||||
#define __UFSERIALUART_H__
|
||||
|
||||
#include <sys/io.h>
|
||||
|
||||
|
||||
//
|
||||
// UART registers
|
||||
// Note: don't use outside this the UFSerialUART class
|
||||
//
|
||||
#define THR (this->UARTPortAddress) // Write
|
||||
#define RHR (this->UARTPortAddress) // Read
|
||||
|
||||
#define IER (this->UARTPortAddress + 1)
|
||||
|
||||
#define ISR (this->UARTPortAddress + 2) // Read
|
||||
#define FCR (this->UARTPortAddress + 2) // Write
|
||||
|
||||
#define LCR (this->UARTPortAddress + 3)
|
||||
#define MCR (this->UARTPortAddress + 4)
|
||||
#define LSR (this->UARTPortAddress + 5)
|
||||
#define MSR (this->UARTPortAddress + 6)
|
||||
#define SPR (this->UARTPortAddress + 7)
|
||||
|
||||
#define DLL (this->UARTPortAddress) // DLAB = 1 (LCR[7])
|
||||
#define DLM (this->UARTPortAddress + 1) // DLAB = 1
|
||||
|
||||
#define EFR (this->UARTPortAddress + 2)
|
||||
#define ICR (this->UARTPortAddress + 5)
|
||||
|
||||
|
||||
class UFSerialUART
|
||||
{
|
||||
private:
|
||||
unsigned int UARTPortAddress;
|
||||
bool NineBitMode;
|
||||
bool KernelPermission;
|
||||
|
||||
private:
|
||||
|
||||
// DLAB Set/Clear
|
||||
inline void SetDLAB();
|
||||
inline void ClearDLAB();
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor/destructor
|
||||
UFSerialUART(unsigned int address);
|
||||
virtual ~UFSerialUART();
|
||||
|
||||
// Get UART initialisation status
|
||||
bool IsUARTInitialised();
|
||||
|
||||
// Set/Get UART port address
|
||||
void SetUARTPortAddress(unsigned int address);
|
||||
unsigned int GetUARTPortAddress();
|
||||
|
||||
// Clear FIFOs
|
||||
void ClearTxFifo();
|
||||
void ClearRxFifo();
|
||||
|
||||
// Set Frequency Divider
|
||||
void SetFrequencyDivider(unsigned short newDivider);
|
||||
|
||||
// Set Parity
|
||||
void DisableParity();
|
||||
void SetLowParity();
|
||||
void SetHighParity();
|
||||
void SetEvenParity();
|
||||
void SetOddParity();
|
||||
|
||||
// Set Data Length
|
||||
void SetFiveBitsLength();
|
||||
void SetSixBitsLength();
|
||||
void SetSevenBitsLength();
|
||||
void SetEightBitsLength();
|
||||
|
||||
// Enable/disable usage of FIFOs
|
||||
void EnableFifos();
|
||||
void DisableFifos();
|
||||
|
||||
// Select number of stop bits
|
||||
void SelectOneStopBit();
|
||||
void SelectTwoStopBits();
|
||||
|
||||
// Select operation mode
|
||||
void Select950Mode();
|
||||
|
||||
// Enable/Disable 9-bit mode
|
||||
void Enable9BitMode();
|
||||
void Disable9BitMode();
|
||||
|
||||
// Configure LCR: 8-bits, 1 stop bit, keep the rest of the byte
|
||||
// TODO: delete this method, it is not needed anymore
|
||||
void ConfigureLCR();
|
||||
|
||||
// Check if there is data waiting to be read
|
||||
bool IsDataAvailable();
|
||||
|
||||
// Send/receive value
|
||||
bool SendValue(unsigned short value);
|
||||
bool ReadValue(unsigned short &value);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* __UFSERIALUART_H__ */
|
||||
|
||||
@@ -0,0 +1,748 @@
|
||||
|
||||
#include "WaveformGAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(WaveformGAM, "$Id: $")
|
||||
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
WaveformGAM::WaveformGAM(){
|
||||
this->SignalsOutputInterface = NULL;
|
||||
this->SignalsInputInterface = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
WaveformGAM::~WaveformGAM()
|
||||
{
|
||||
// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool WaveformGAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
|
||||
CDBExtended cdb(cdbData);
|
||||
int i;
|
||||
|
||||
if(!cdb->Move("waveform_mode_1_positive"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"waveform_mode_1_positive\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_1_p_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_1_p_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_p_vector_size = %d", this->Name(),waveform_1_p_vector_size);
|
||||
if (waveform_1_p_vector_size > 1){
|
||||
waveform_1_p_available = True;
|
||||
waveform_1_p_index_vector =new float[waveform_1_p_vector_size];
|
||||
waveform_1_p_data_vector =new float[waveform_1_p_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_1_p_index_vector, (int *)(&waveform_1_p_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_1_p_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_1_p_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_p_index_vector[%d] = %f", this->Name(),i, waveform_1_p_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_1_p_data_vector, (int *)(&waveform_1_p_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: Could not read waveform_1_p_data_vector");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_1_p_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_p_data_vector[%d] = %f", this->Name(),i, waveform_1_p_data_vector[i]);
|
||||
}
|
||||
else waveform_1_p_available = False;
|
||||
if(!cdb.ReadFloat(waveform_1_p_max_value, "max_value"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_1_p_max_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_p_max_value = %f", this->Name(),waveform_1_p_max_value);
|
||||
if(!cdb.ReadFloat(waveform_1_p_min_value, "min_value"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_1_p_min_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_p_min_value = %f", this->Name(),waveform_1_p_min_value);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("waveform_mode_1_negative"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_mode_1_negative\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_1_n_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_1_n_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_n_vector_size = %d", this->Name(),waveform_1_n_vector_size);
|
||||
if (waveform_1_n_vector_size > 1){
|
||||
waveform_1_n_available = True;
|
||||
waveform_1_n_index_vector =new float[waveform_1_n_vector_size];
|
||||
waveform_1_n_data_vector =new float[waveform_1_n_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_1_n_index_vector, (int *)(&waveform_1_n_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_1_n_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_1_n_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_n_index_vector[%d] = %f", this->Name(),i, waveform_1_n_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_1_n_data_vector, (int *)(&waveform_1_n_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: Could not read waveform_1_n_data_vector");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_1_n_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_1_n_data_vector[%d] = %f", this->Name(),i, waveform_1_n_data_vector[i]);
|
||||
}
|
||||
else waveform_1_n_available = False;
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("waveform_mode_2_positive"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_mode_2_positive\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_2_p_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_2_p_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_p_vector_size = %d", this->Name(),waveform_2_p_vector_size);
|
||||
if (waveform_2_p_vector_size > 1){
|
||||
waveform_2_p_available = True;
|
||||
waveform_2_p_index_vector =new float[waveform_2_p_vector_size];
|
||||
waveform_2_p_data_vector =new float[waveform_2_p_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_2_p_index_vector, (int *)(&waveform_2_p_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_2_p_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_2_p_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_p_index_vector[%d] = %f", this->Name(),i, waveform_2_p_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_2_p_data_vector, (int *)(&waveform_2_p_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: Could not read waveform_1_p_data_vector");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_2_p_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_p_data_vector[%d] = %f", this->Name(),i, waveform_2_p_data_vector[i]);
|
||||
}
|
||||
else waveform_2_p_available = False;
|
||||
if(!cdb.ReadFloat(waveform_2_p_max_value, "max_value"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_2_p_max_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_p_max_value = %f", this->Name(),waveform_2_p_max_value);
|
||||
if(!cdb.ReadFloat(waveform_2_p_min_value, "min_value"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_2_p_min_value",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_p_min_value = %f", this->Name(),waveform_2_p_min_value);
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("waveform_mode_2_negative"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_mode_2_negative\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_2_n_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_2_n_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_n_vector_size = %d", this->Name(),waveform_2_n_vector_size);
|
||||
|
||||
if (waveform_2_n_vector_size > 1){
|
||||
waveform_2_n_available = True;
|
||||
waveform_2_n_index_vector =new float[waveform_2_n_vector_size];
|
||||
waveform_2_n_data_vector =new float[waveform_2_n_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_2_n_index_vector, (int *)(&waveform_2_n_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_2_n_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_2_n_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_n_index_vector[%d] = %f", this->Name(),i, waveform_1_n_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_2_n_data_vector, (int *)(&waveform_2_n_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: Could not read waveform_2_n_data_vector");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_2_n_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_2_n_data_vector[%d] = %f", this->Name(),i, waveform_2_n_data_vector[i]);
|
||||
}
|
||||
else waveform_2_n_available = False;
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("waveform_breakdown"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_mode_3_positive\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_breakdown_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_breakdown_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_breakdown_vector_size = %d", this->Name(),waveform_breakdown_vector_size);
|
||||
|
||||
if (waveform_breakdown_vector_size > 1){
|
||||
waveform_breakdown_available = True;
|
||||
waveform_breakdown_index_vector =new float[waveform_breakdown_vector_size];
|
||||
waveform_breakdown_data_vector =new float[waveform_breakdown_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_breakdown_index_vector, (int *)(&waveform_breakdown_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_breakdown_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_breakdown_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %swaveform_breakdown_index_vector[%d] = %f", this->Name(),i, waveform_breakdown_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_breakdown_data_vector, (int *)(&waveform_breakdown_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_breakdown_data_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_breakdown_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_breakdown_data_vector[%d] = %f", this->Name(),i, waveform_breakdown_data_vector[i]);
|
||||
}
|
||||
else waveform_breakdown_available = False;
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("waveform_breakdown_negative"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_breakdown_negative\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_breakdown_negative_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_breakdown_negative_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_breakdown_negative_vector_size = %d", this->Name(),waveform_breakdown_negative_vector_size);
|
||||
|
||||
if (waveform_breakdown_negative_vector_size > 1){
|
||||
waveform_breakdown_negative_available = True;
|
||||
waveform_breakdown_negative_index_vector =new float[waveform_breakdown_negative_vector_size];
|
||||
waveform_breakdown_negative_data_vector =new float[waveform_breakdown_negative_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_breakdown_negative_index_vector, (int *)(&waveform_breakdown_negative_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_breakdown_negative_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_breakdown_negative_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %swaveform_breakdown_negative_index_vector[%d] = %f", this->Name(),i, waveform_breakdown_negative_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_breakdown_negative_data_vector, (int *)(&waveform_breakdown_negative_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_breakdown_negative_data_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_breakdown_negative_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_breakdown_negative_data_vector[%d] = %f", this->Name(),i, waveform_breakdown_negative_data_vector[i]);
|
||||
}
|
||||
else waveform_breakdown_negative_available = False;
|
||||
cdb->MoveToFather();
|
||||
|
||||
if(!cdb->Move("waveform_inversion_positive_to_negative"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_inversion_positive_to_negative\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_inversion_positive_to_negative_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_inversion_positive_to_negative_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_inversion_positive_to_negative_vector_size = %d", this->Name(),waveform_inversion_positive_to_negative_vector_size);
|
||||
|
||||
if (waveform_inversion_positive_to_negative_vector_size > 1){
|
||||
waveform_inversion_positive_to_negative_available = True;
|
||||
waveform_inversion_positive_to_negative_index_vector = new float[waveform_inversion_positive_to_negative_vector_size];
|
||||
waveform_inversion_positive_to_negative_data_vector = new float[waveform_inversion_positive_to_negative_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_inversion_positive_to_negative_index_vector, (int *)(&waveform_inversion_positive_to_negative_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_inversion_positive_to_negative_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_inversion_positive_to_negative_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_inversion_positive_to_negative_index_vector[%d] = %f", this->Name(),i, waveform_inversion_positive_to_negative_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_inversion_positive_to_negative_data_vector, (int *)(&waveform_inversion_positive_to_negative_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: Could not read waveform_inversion_positive_to_negative_data_vector");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_inversion_positive_to_negative_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_inversion_positive_to_negative_data_vector[%d] = %f", this->Name(),i, waveform_inversion_positive_to_negative_data_vector[i]);
|
||||
}
|
||||
else waveform_inversion_positive_to_negative_available = False;
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
if(!cdb->Move("waveform_inversion_negative_to_positive"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"+MARTe.+ISTTOK_RTTh.+waveform_waveform.waveform_inversion_negative_to_positive\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!cdb.ReadInt32(waveform_inversion_negative_to_positive_vector_size, "vector_size"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s waveform_inversion_negative_to_positive_vector_size",this->Name());
|
||||
return False;
|
||||
}
|
||||
else AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_inversion_negative_to_positive_vector_size = %d", this->Name(),waveform_inversion_negative_to_positive_vector_size);
|
||||
|
||||
if (waveform_inversion_negative_to_positive_vector_size > 1){
|
||||
waveform_inversion_negative_to_positive_available = True;
|
||||
waveform_inversion_negative_to_positive_index_vector =new float[waveform_inversion_negative_to_positive_vector_size];
|
||||
waveform_inversion_negative_to_positive_data_vector =new float[waveform_inversion_negative_to_positive_vector_size];
|
||||
|
||||
if(!cdb.ReadFloatArray(waveform_inversion_negative_to_positive_index_vector, (int *)(&waveform_inversion_negative_to_positive_vector_size), 1, "index_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: %s Could not read waveform_inversion_negative_to_positive_index_vector", this->Name());
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_inversion_negative_to_positive_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_inversion_index_negative_to_positive_vector[%d] = %f", this->Name(),i, waveform_inversion_negative_to_positive_index_vector[i]);
|
||||
if(!cdb.ReadFloatArray(waveform_inversion_negative_to_positive_data_vector, (int *)(&waveform_inversion_negative_to_positive_vector_size), 1, "data_vector"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"ReadWaveformFiles: Could not read waveform_inversion_negative_to_positive_data_vector");
|
||||
return False;
|
||||
}
|
||||
else for(i=0;i<waveform_inversion_negative_to_positive_vector_size;i++) AssertErrorCondition(Information,"WaveformGAM::Initialise: %s waveform_inversion_negative_to_positive_data_vector[%d] = %f", this->Name(),i, waveform_inversion_negative_to_positive_data_vector[i]);
|
||||
}
|
||||
else waveform_inversion_negative_to_positive_available = False;
|
||||
cdb->MoveToFather();
|
||||
|
||||
// sleep(1);
|
||||
// Create the signal interfaces
|
||||
if(!AddInputInterface(this->SignalsInputInterface, "WaveformGAMInputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "WaveformGAM::Initialise: %s failed to add the WaveformGAMInputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
if(!AddOutputInterface(this->SignalsOutputInterface, "WaveformGAMOutputInterface"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError, "WaveformGAM::Initialise: %s failed to add the WaveformGAMOutputInterface", this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
// INPUT SIGNALS (interface)
|
||||
if(!cdb->Move("input_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"input_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
int number_of_signals_to_read = 4;
|
||||
FString *CDB_move_to;
|
||||
FString *SignalType;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("input_time");
|
||||
CDB_move_to[1].Printf("input_mode");
|
||||
CDB_move_to[2].Printf("input_AC_cycle");
|
||||
CDB_move_to[3].Printf("discharge_status");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"WaveformGAM::Initialise:%s Added signal = %s", this->Name(), SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsInputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// OUTPUT SIGNALS (interface)
|
||||
if(!cdb->Move("output_signals"))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"output_signals\"",this->Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
number_of_signals_to_read = 1;
|
||||
CDB_move_to = new FString[number_of_signals_to_read];
|
||||
SignalType = new FString[number_of_signals_to_read];
|
||||
CDB_move_to[0].Printf("output_waveform");
|
||||
for (i=0;i<number_of_signals_to_read;i++){
|
||||
|
||||
if(!cdb->Move(CDB_move_to[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s Could not move to \"%s\"",this->Name(),CDB_move_to[i].Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cdb->Exists("SignalType"))
|
||||
{
|
||||
FString signalName;
|
||||
cdb.ReadFString(SignalType[i], "SignalType");
|
||||
}
|
||||
if(cdb->Exists("SignalName"))
|
||||
{
|
||||
FString SignalName;
|
||||
cdb.ReadFString(SignalName, "SignalName");
|
||||
AssertErrorCondition(Information,"WaveformGAM::Initialise: Added signal = %s", SignalName.Buffer());
|
||||
|
||||
if(!this->SignalsOutputInterface->AddSignal(SignalName.Buffer(), SignalType[i].Buffer()))
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM::Initialise: %s failed to add signal", this->Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
|
||||
// keep waveforms within the limits and transform time in ms to time in us
|
||||
if (waveform_1_p_available) {
|
||||
for (i = 0; i < waveform_1_p_vector_size; i++){
|
||||
if (waveform_1_p_data_vector[i] > waveform_1_p_max_value) waveform_1_p_data_vector[i] = waveform_1_p_max_value;
|
||||
if (waveform_1_p_data_vector[i] < waveform_1_p_min_value) waveform_1_p_data_vector[i] = waveform_1_p_min_value;
|
||||
waveform_1_p_index_vector[i] = waveform_1_p_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_2_p_available) {
|
||||
for (i = 0; i < waveform_2_p_vector_size; i++){
|
||||
if (waveform_2_p_data_vector[i] > waveform_1_p_max_value) waveform_2_p_data_vector[i] = waveform_2_p_max_value;
|
||||
if (waveform_2_p_data_vector[i] < waveform_1_p_min_value) waveform_2_p_data_vector[i] = waveform_2_p_min_value;
|
||||
waveform_2_p_index_vector[i] = waveform_2_p_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_1_n_available) {
|
||||
for (i = 0; i < waveform_1_n_vector_size; i++){
|
||||
if (waveform_1_n_data_vector[i] > waveform_1_p_max_value) waveform_1_n_data_vector[i] = waveform_1_p_max_value;
|
||||
if (waveform_1_n_data_vector[i] < waveform_1_p_min_value) waveform_1_n_data_vector[i] = waveform_1_p_min_value;
|
||||
waveform_1_n_index_vector[i] = waveform_1_n_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_2_n_available) {
|
||||
for (i = 0; i < waveform_2_n_vector_size; i++){
|
||||
if (waveform_2_n_data_vector[i] > waveform_2_p_max_value) waveform_2_n_data_vector[i] = waveform_2_p_max_value;
|
||||
if (waveform_2_n_data_vector[i] < waveform_2_p_min_value) waveform_2_n_data_vector[i] = waveform_2_p_min_value;
|
||||
waveform_2_n_index_vector[i] = waveform_2_n_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_breakdown_available) {
|
||||
for (i = 0; i < waveform_breakdown_vector_size; i++){
|
||||
waveform_breakdown_index_vector[i] = waveform_breakdown_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_breakdown_negative_available) {
|
||||
for (i = 0; i < waveform_breakdown_negative_vector_size; i++){
|
||||
waveform_breakdown_negative_index_vector[i] = waveform_breakdown_negative_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_inversion_positive_to_negative_available) {
|
||||
for (i = 0; i < waveform_inversion_positive_to_negative_vector_size; i++){
|
||||
waveform_inversion_positive_to_negative_index_vector[i] = waveform_inversion_positive_to_negative_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
if (waveform_inversion_negative_to_positive_available) {
|
||||
for (i = 0; i < waveform_inversion_negative_to_positive_vector_size; i++){
|
||||
waveform_inversion_negative_to_positive_index_vector[i] = waveform_inversion_negative_to_positive_index_vector[i] * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// waveforms
|
||||
if (waveform_1_p_available) this->waveform_1_p = new IWaveform(&waveform_1_p_index_vector[0], &waveform_1_p_data_vector[0], waveform_1_p_vector_size);
|
||||
if (waveform_1_p_available) this->waveform_1_p->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_2_p_available) this->waveform_2_p = new IWaveform(&waveform_2_p_index_vector[0], &waveform_2_p_data_vector[0], waveform_2_p_vector_size );
|
||||
if (waveform_2_p_available) this->waveform_2_p->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_breakdown_available) this->waveform_breakdown = new IWaveform(&waveform_breakdown_index_vector[0], &waveform_breakdown_data_vector[0], waveform_breakdown_vector_size );
|
||||
if (waveform_breakdown_available) this->waveform_breakdown->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_breakdown_negative_available) this->waveform_breakdown_negative = new IWaveform(&waveform_breakdown_negative_index_vector[0], &waveform_breakdown_negative_data_vector[0], waveform_breakdown_negative_vector_size );
|
||||
if (waveform_breakdown_negative_available) this->waveform_breakdown_negative->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_1_n_available) this->waveform_1_n = new IWaveform(&waveform_1_n_index_vector[0], &waveform_1_n_data_vector[0], waveform_1_n_vector_size );
|
||||
if (waveform_1_n_available)this->waveform_1_n->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_2_n_available) this->waveform_2_n = new IWaveform(&waveform_2_n_index_vector[0], &waveform_2_n_data_vector[0], waveform_2_n_vector_size );
|
||||
if (waveform_2_n_available) this->waveform_2_n->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_inversion_positive_to_negative_available) this->waveform_inversion_positive_to_negative = new IWaveform(&waveform_inversion_positive_to_negative_index_vector[0], &waveform_inversion_positive_to_negative_data_vector[0], waveform_inversion_positive_to_negative_vector_size );
|
||||
if (waveform_inversion_positive_to_negative_available) this->waveform_inversion_positive_to_negative->DefineOutsideValueDefaultValue(0);
|
||||
if (waveform_inversion_negative_to_positive_available) this->waveform_inversion_negative_to_positive = new IWaveform(&waveform_inversion_negative_to_positive_index_vector[0], &waveform_inversion_negative_to_positive_data_vector[0], waveform_inversion_negative_to_positive_vector_size );
|
||||
if (waveform_inversion_negative_to_positive_available) this->waveform_inversion_negative_to_positive->DefineOutsideValueDefaultValue(0);
|
||||
|
||||
//delete unnecessary vectors (if deleted the web page will not have the correct values)
|
||||
/* if (waveform_1_p_available) delete waveform_1_p_index_vector;
|
||||
if (waveform_1_p_available) delete waveform_1_p_data_vector;
|
||||
if (waveform_1_n_available) delete waveform_1_n_index_vector;
|
||||
if (waveform_1_n_available) delete waveform_1_n_data_vector;
|
||||
if (waveform_2_p_available) delete waveform_2_p_index_vector;
|
||||
if (waveform_2_p_available) delete waveform_2_p_data_vector;
|
||||
if (waveform_2_n_available) delete waveform_2_n_index_vector;
|
||||
if (waveform_2_n_available) delete waveform_2_n_data_vector;
|
||||
if (waveform_breakdown_available) delete waveform_breakdown_index_vector;
|
||||
if (waveform_breakdown_available) delete waveform_breakdown_data_vector;
|
||||
if (waveform_breakdown_negative_available) delete waveform_breakdown_negative_index_vector;
|
||||
if (waveform_breakdown_negative_available) delete waveform_breakdown_negative_data_vector;
|
||||
if (waveform_inversion_positive_to_negative_available) delete waveform_inversion_positive_to_negative_index_vector;
|
||||
if (waveform_inversion_positive_to_negative_available) delete waveform_inversion_positive_to_negative_data_vector;
|
||||
if (waveform_inversion_negative_to_positive_available) delete waveform_inversion_negative_to_positive_index_vector;
|
||||
if (waveform_inversion_negative_to_positive_available) delete waveform_inversion_negative_to_positive_data_vector;
|
||||
*/
|
||||
return True;
|
||||
}
|
||||
//} ******************************************************************
|
||||
|
||||
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool WaveformGAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
|
||||
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
// AssertErrorCondition(InitialisationError,"WaveformGAM:: %s inputstruct = %d %d %d %d",this->Name(), inputstruct[0].usecDischargeTime, inputstruct[0].WaveformMode, inputstruct[0].PlasmaDirection, inputstruct[0].DischargeStatus);
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
|
||||
/*
|
||||
*** Discharge Status ***
|
||||
-3 -> error
|
||||
-2 -> offline
|
||||
0 -> breakdown
|
||||
1 -> normal operation
|
||||
2 -> inverting
|
||||
*/
|
||||
/*
|
||||
*** WaveformMode ***
|
||||
1 -> direct
|
||||
2 -> scenario (position, plasma current etc..)
|
||||
*/
|
||||
/*
|
||||
*** Plasma Direction ***
|
||||
0-> negative direction.
|
||||
1-> positive and normal direction.
|
||||
*/
|
||||
if(functionNumber == GAMOnline){
|
||||
|
||||
if (inputstruct[0].WaveformMode == 1 && inputstruct[0].PlasmaDirection == 1 && inputstruct[0].DischargeStatus == 1){
|
||||
if (waveform_1_p_available) outputstruct[0].WaveformOutput = this->waveform_1_p->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_1_p was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 2 && inputstruct[0].PlasmaDirection == 1 && inputstruct[0].DischargeStatus == 1){
|
||||
if (waveform_2_p_available) outputstruct[0].WaveformOutput = this->waveform_2_p->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_2_p was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 1 && inputstruct[0].PlasmaDirection == 1 && inputstruct[0].DischargeStatus == 0){
|
||||
if (waveform_breakdown_available) outputstruct[0].WaveformOutput = this->waveform_breakdown->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_breakdown was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 1 && inputstruct[0].PlasmaDirection == 1 && inputstruct[0].DischargeStatus == 2){
|
||||
if (waveform_inversion_positive_to_negative_available) outputstruct[0].WaveformOutput = this->waveform_inversion_positive_to_negative->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_inversion_positive_to_negative was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 1 && inputstruct[0].PlasmaDirection == 0 && inputstruct[0].DischargeStatus == 1){
|
||||
if (waveform_1_n_available) outputstruct[0].WaveformOutput = this->waveform_1_n->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_1_n was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 2 && inputstruct[0].PlasmaDirection == 0 && inputstruct[0].DischargeStatus == 1){
|
||||
if (waveform_2_n_available) outputstruct[0].WaveformOutput = this->waveform_2_n->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_2_n was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 1 && inputstruct[0].PlasmaDirection == 0 && inputstruct[0].DischargeStatus == 0){
|
||||
if (waveform_breakdown_negative_available) outputstruct[0].WaveformOutput = this->waveform_breakdown_negative->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_breakdown_negative was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else if (inputstruct[0].WaveformMode == 1 && inputstruct[0].PlasmaDirection == 0 && inputstruct[0].DischargeStatus == 2){
|
||||
if (waveform_inversion_negative_to_positive_available) outputstruct[0].WaveformOutput = this->waveform_inversion_negative_to_positive->GetWaveformValue(inputstruct[0].usecDischargeTime);
|
||||
else {
|
||||
AssertErrorCondition(InitialisationError,"WaveformGAM:: %s ERROR waveform_inversion_negative_to_positive was requested and is not available",this->Name());
|
||||
outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
}
|
||||
else outputstruct[0].WaveformOutput = 0;
|
||||
}
|
||||
else outputstruct[0].WaveformOutput = 0;
|
||||
|
||||
|
||||
// outputstruct[0].WaveformOutput = inputstruct[0].usecDischargeTime;
|
||||
// AssertErrorCondition(InitialisationError,"WaveformGAM:: %s inputstruct = %f",this->Name(), outputstruct[0].WaveformOutput );
|
||||
this->SignalsOutputInterface->Write();
|
||||
|
||||
return True;
|
||||
}
|
||||
bool WaveformGAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width=\"100%\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
|
||||
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
|
||||
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
|
||||
}
|
||||
else {
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_hide\" value=\"Hide input variables\"");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br>waveform_1_p_vector_size = %d\n\
|
||||
<br>waveform_1_p_max_value = %.2f\n\
|
||||
<br>waveform_1_p_min_value = %.2f\n\
|
||||
<br>waveform_1_n_vector_size = %d\n\
|
||||
<br>waveform_2_p_vector_size = %d\n\
|
||||
<br>waveform_2_p_max_value = %.2f\n\
|
||||
<br>waveform_2_p_min_value = %.2f\n\
|
||||
<br>waveform_2_n_vector_size = %d\n\
|
||||
<br>waveform_breakdown_vector_size = %d\n\
|
||||
<br>waveform_breakdown_negative_vector_size = %d\n\
|
||||
<br>waveform_inversion_positive_to_negative_vector_size = %d\n\
|
||||
<br>waveform_inversion_negative_to_positive_vector_size = %d\n\
|
||||
<br><br",waveform_1_p_vector_size,waveform_1_p_max_value,waveform_1_p_min_value,waveform_1_n_vector_size,waveform_2_p_vector_size,waveform_2_p_max_value,waveform_2_p_min_value,waveform_2_n_vector_size,waveform_breakdown_vector_size,waveform_breakdown_negative_vector_size,waveform_inversion_positive_to_negative_vector_size,waveform_inversion_negative_to_positive_vector_size);
|
||||
|
||||
if (waveform_1_p_available){
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_1_p_index_vector</td");
|
||||
for (i=0;i<waveform_1_p_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_1_p_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_1_p_data_vector</td");
|
||||
for (i=0;i<waveform_1_p_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_1_p_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_1_p not available<br");
|
||||
|
||||
if (waveform_1_n_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_1_n_index_vector</td");
|
||||
for (i=0;i<waveform_1_n_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_1_n_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_1_n_data_vector</td");
|
||||
for (i=0;i<waveform_1_n_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_1_n_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_1_n not available<br");
|
||||
|
||||
if (waveform_2_p_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_2_p_index_vector</td");
|
||||
for (i=0;i<waveform_2_p_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_2_p_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_2_p_data_vector</td");
|
||||
for (i=0;i<waveform_2_p_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_2_p_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_2_p not available<br");
|
||||
|
||||
if (waveform_2_n_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_2_n_index_vector</td");
|
||||
for (i=0;i<waveform_2_n_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_2_n_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_2_n_data_vector</td");
|
||||
for (i=0;i<waveform_2_n_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_2_n_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_2_n not available<br");
|
||||
|
||||
if (waveform_breakdown_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_breakdown_index_vector</td");
|
||||
for (i=0;i<waveform_breakdown_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_breakdown_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_breakdown_data_vector</td");
|
||||
for (i=0;i<waveform_breakdown_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_breakdown_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_breakdown not available<br");
|
||||
|
||||
if (waveform_breakdown_negative_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_breakdown_negative_index_vector</td");
|
||||
for (i=0;i<waveform_breakdown_negative_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_breakdown_negative_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_breakdown_negative_data_vector</td");
|
||||
for (i=0;i<waveform_breakdown_negative_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_breakdown_negative_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_breakdown_negative not available<br");
|
||||
|
||||
if (waveform_inversion_positive_to_negative_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_inversion_positive_to_negative_index_vector</td");
|
||||
for (i=0;i<waveform_inversion_positive_to_negative_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_inversion_positive_to_negative_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_inversion_positive_to_negative_data_vector</td");
|
||||
for (i=0;i<waveform_inversion_positive_to_negative_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_inversion_positive_to_negative_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_inveersion_positive_to_negative not available<br");
|
||||
|
||||
if (waveform_inversion_negative_to_positive_available){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "table border=\"1\"><tr><td>waveform_inversion_negative_to_positive_index_vector</td");
|
||||
for (i=0;i<waveform_inversion_negative_to_positive_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_inversion_negative_to_positive_index_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr><tr><td>waveform_inversion_negative_to_positive_data_vector</td");
|
||||
for (i=0;i<waveform_inversion_negative_to_positive_vector_size;i++)hmStream.SSPrintf(HtmlTagStreamMode, "td>%.2f</td",waveform_inversion_negative_to_positive_data_vector[i]);
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/tr></table><br");
|
||||
}
|
||||
else hmStream.SSPrintf(HtmlTagStreamMode, "/br>waveform_inveersion_negative_to_positive not available<br");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
|
||||
|
||||
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
106
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/WaveformGAM.h
Normal file
106
epics/css/sys-mng-opi/CSS/MARTe/GAMs/isttokbiblio/WaveformGAM.h
Normal file
@@ -0,0 +1,106 @@
|
||||
#ifndef _WAVEFORMGAM_H
|
||||
#define _WAVEFORMGAM_H
|
||||
|
||||
//#include <dirent.h>
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "HtmlStream.h"
|
||||
#include "IWaveform.h"
|
||||
|
||||
OBJECT_DLL(WaveformGAM)
|
||||
|
||||
|
||||
class WaveformGAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
int32 usecDischargeTime;
|
||||
int32 WaveformMode;
|
||||
int32 PlasmaDirection;
|
||||
int32 DischargeStatus;
|
||||
};
|
||||
struct OutputInterfaceStruct {
|
||||
float WaveformOutput;
|
||||
};
|
||||
|
||||
IWaveform *waveform_1_p;
|
||||
IWaveform *waveform_2_p;
|
||||
IWaveform *waveform_breakdown;
|
||||
IWaveform *waveform_breakdown_negative;
|
||||
IWaveform *waveform_1_n;
|
||||
IWaveform *waveform_2_n;
|
||||
IWaveform *waveform_inversion_positive_to_negative;
|
||||
IWaveform *waveform_inversion_negative_to_positive;
|
||||
|
||||
int waveform_1_p_vector_size;
|
||||
float *waveform_1_p_index_vector;
|
||||
float *waveform_1_p_data_vector;
|
||||
float waveform_1_p_max_value;
|
||||
float waveform_1_p_min_value;
|
||||
bool waveform_1_p_available;
|
||||
// waveform_mode_1_negative
|
||||
int waveform_1_n_vector_size;
|
||||
float *waveform_1_n_index_vector;
|
||||
float *waveform_1_n_data_vector;
|
||||
bool waveform_1_n_available;
|
||||
// waveform_mode_2_positive
|
||||
int waveform_2_p_vector_size;
|
||||
float *waveform_2_p_index_vector;
|
||||
float *waveform_2_p_data_vector;
|
||||
float waveform_2_p_max_value;
|
||||
float waveform_2_p_min_value;
|
||||
bool waveform_2_p_available;
|
||||
// waveform_mode_2_negative
|
||||
int waveform_2_n_vector_size;
|
||||
float *waveform_2_n_index_vector;
|
||||
float *waveform_2_n_data_vector;
|
||||
bool waveform_2_n_available;
|
||||
// waveform_breakdown
|
||||
int waveform_breakdown_vector_size;
|
||||
float *waveform_breakdown_index_vector;
|
||||
float *waveform_breakdown_data_vector;
|
||||
bool waveform_breakdown_available;
|
||||
// waveform_breakdown_negative
|
||||
int waveform_breakdown_negative_vector_size;
|
||||
float *waveform_breakdown_negative_index_vector;
|
||||
float *waveform_breakdown_negative_data_vector;
|
||||
bool waveform_breakdown_negative_available;
|
||||
// waveform_inversion_positive_to_negative
|
||||
int waveform_inversion_positive_to_negative_vector_size;
|
||||
float *waveform_inversion_positive_to_negative_index_vector;
|
||||
float *waveform_inversion_positive_to_negative_data_vector;
|
||||
bool waveform_inversion_positive_to_negative_available;
|
||||
// waveform_inversion_negative_to_positive
|
||||
int waveform_inversion_negative_to_positive_vector_size;
|
||||
float *waveform_inversion_negative_to_positive_index_vector;
|
||||
float *waveform_inversion_negative_to_positive_data_vector;
|
||||
bool waveform_inversion_negative_to_positive_available;
|
||||
|
||||
bool view_input_variables;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
WaveformGAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~WaveformGAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(WaveformGAM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
942
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/ATCAadcDrv.cpp
Normal file
942
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/ATCAadcDrv.cpp
Normal file
@@ -0,0 +1,942 @@
|
||||
//******************************************************************************
|
||||
// MARTe Library
|
||||
// $Log: ATCAadcDrv.cpp,v $
|
||||
// Revision 1.48 2010/02/09 14:50:59 ppcc_dev
|
||||
// Significantly increased the PollSleepTimeWakeBeforeUs in order to disallow any
|
||||
// sleeping in online...
|
||||
//
|
||||
// Revision 1.47 2010/01/22 09:29:07 aneto
|
||||
// pollSleepTimeWakeBeforeUs was only being converted to us if not specified
|
||||
//
|
||||
// Revision 1.46 2009/12/15 12:16:51 aneto
|
||||
// Code cleaning
|
||||
//
|
||||
// Revision 1.45 2009/12/03 14:52:13 ppcc_dev
|
||||
// Sleeps, if time is available, before start busy polling.
|
||||
// The time to sleep is given by the remaining time until the start of
|
||||
// the next pulse minus the worst jitter from a sleep and minus the
|
||||
// desired time, before the beginning of the next pulse, that we want to start
|
||||
// busy polling.
|
||||
// The worst jitter decays to zero in order to try to maintain a good performance
|
||||
//
|
||||
// Revision 1.44 2009/09/23 12:21:20 aneto
|
||||
// Cast the header to unsigned int 32 in order to avoid rollover problems
|
||||
// when it changes the bit sign
|
||||
//
|
||||
// Revision 1.43 2009/08/07 09:31:47 aneto
|
||||
// Allow the autoSoftwareTrigger to work even if the softwareTrigger flag
|
||||
// is set to false
|
||||
//
|
||||
// Revision 1.42 2009/06/23 13:44:19 aneto
|
||||
// In Linux wait sometime between header synchronisation
|
||||
//
|
||||
// Revision 1.41 2009/06/09 09:55:28 ppcc_dev
|
||||
// Time is read directly from the board header
|
||||
//
|
||||
// Revision 1.40 2009/05/21 15:18:34 ppcc_dev
|
||||
// DigIO does not have outputMap
|
||||
//
|
||||
// Revision 1.39 2009/04/21 08:48:42 aneto
|
||||
// Channel statistics variable weren't being initialised
|
||||
//
|
||||
// Revision 1.38 2009/04/14 09:06:10 aneto
|
||||
// Allow the system to auto-trigger after a specified amount of time
|
||||
//
|
||||
// Revision 1.37 2009/04/03 10:02:03 aneto
|
||||
// lastCycleUsecTime now is true 64 bits.
|
||||
// This uses the information from the headers to increment an internal counter
|
||||
//
|
||||
// Revision 1.36 2009/04/01 15:10:36 aneto
|
||||
// Bug in the way the modulus was being calculated for the usec time. The bug was in converting from 64 to 32 bits of lastCycleUsecTime
|
||||
//
|
||||
// Revision 1.35 2009/03/31 08:11:37 aneto
|
||||
// Support for multiple input
|
||||
//
|
||||
// Revision 1.34 2009/03/26 15:13:21 aneto
|
||||
// Automatic offset compensation
|
||||
//
|
||||
// Revision 1.33 2009/03/16 11:42:16 aneto
|
||||
// Corrected the polling mode in order to allow different acquisition frequencies
|
||||
//
|
||||
// Revision 1.32 2009/03/11 12:31:54 aneto
|
||||
// Support an html output with information about the driver
|
||||
//
|
||||
// Revision 1.31 2009/01/26 17:26:20 ppcc_dev
|
||||
// Small bugs solved
|
||||
//
|
||||
// Revision 1.30 2009/01/26 09:23:51 aneto
|
||||
// Removed printfs
|
||||
//
|
||||
// Revision 1.29 2009/01/26 09:20:38 aneto
|
||||
// linux support
|
||||
//
|
||||
// Revision 1.28 2009/01/22 13:59:18 aneto
|
||||
// Miror clean up
|
||||
//
|
||||
// Revision 1.27 2008/11/28 12:03:13 aneto
|
||||
// Added bufferNumber
|
||||
//
|
||||
// Revision 1.26 2008/11/21 14:16:42 ppcc_dev
|
||||
// This version works with the new firmware: jet clock+trigger
|
||||
//
|
||||
// Revision 1.24 2008/09/30 11:24:49 rvitelli
|
||||
// Added non-synchronous operating mode.
|
||||
//
|
||||
// Revision 1.23 2008/09/30 10:36:03 ppcc_dev
|
||||
// Minor modifications to both driver and low level module
|
||||
//
|
||||
// Revision 1.22 2008/09/16 13:06:57 fpiccolo
|
||||
// Modified SleepMsec to SleepNoMore to remove jitter on cycle time
|
||||
//
|
||||
// Revision 1.21 2008/09/15 16:51:45 ppcc_dev
|
||||
// Solved few bugs
|
||||
//
|
||||
// Revision 1.20 2008/09/09 11:10:36 fpiccolo
|
||||
// Patch to make it work only with two modules and old firmware
|
||||
//
|
||||
// Revision 1.19 2008/09/09 09:29:15 fpiccolo
|
||||
// Modified driver structure.
|
||||
// Added SingleATCAModule class
|
||||
// Added Writing facilities
|
||||
//
|
||||
// Revision 1.18 2008/09/04 11:48:52 ppcc_dev
|
||||
// Minor modifications to the GETData function.
|
||||
// Removed DisableAcquisition call from the ObjectLoadSetup function
|
||||
// since was causing a crash.
|
||||
//
|
||||
// Revision 1.17 2008/08/19 12:43:29 ppcc_dev
|
||||
// Corrected memory addresses in memcpy, added simulation code for SoftTrigger
|
||||
//
|
||||
// Revision 1.16 2008/08/15 10:41:35 fpiccolo
|
||||
// Minor stylish modifications.
|
||||
// Added TimeModule Interface
|
||||
//
|
||||
// Revision 1.15 2008/08/01 14:09:26 rvitelli
|
||||
// First working version
|
||||
//
|
||||
// Revision 1.14 2008/07/28 13:50:05 aneto
|
||||
// Added support for multiple boards.
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#include "ATCAadcDrv.h"
|
||||
#include "ConfigurationDataBase.h"
|
||||
#include "CDBExtended.h"
|
||||
#include "HRT.h"
|
||||
#include "Sleep.h"
|
||||
#include "Console.h"
|
||||
|
||||
int32 SingleATCAModule::currentDMABufferIndex = 0;
|
||||
int32 SingleATCAModule::currentMasterHeader = 0;
|
||||
|
||||
#ifdef _LINUX
|
||||
int32 ATCAadcDrv::pageSize = 0;
|
||||
int32 ATCAadcDrv::fileDescriptor = 0;
|
||||
#endif
|
||||
|
||||
SingleATCAModule::SingleATCAModule(){
|
||||
moduleIdentifier = 0;
|
||||
numberOfAnalogueInputChannels = 0;
|
||||
numberOfDigitalInputChannels = 0;
|
||||
numberOfAnalogueOutputChannels = 0;
|
||||
numberOfDigitalOutputChannels = 0;
|
||||
int i = 0;
|
||||
for(i = 0; i < 8; i++)outputMap[i] = 0;
|
||||
|
||||
// Input Section //
|
||||
isMaster = False;
|
||||
for(i = 0; i < 4; i++)dmaBuffers[i] = NULL;
|
||||
nextExpectedAcquisitionCPUTicks = 0;
|
||||
boardInternalCycleTicks = 0;
|
||||
datagramArrivalFastMonitorSecSleep = 0.0;
|
||||
boardInternalCycleTime = 0;
|
||||
|
||||
lastCycleUsecTime = 0;
|
||||
packetCounter = 0;
|
||||
synchronizing = False;
|
||||
channelStatistics = NULL;
|
||||
|
||||
allowPollSleeping = True;
|
||||
worstPollSleepJitter = 0;
|
||||
worstPollSleepJitterDecayRate = (1 - 5e-6);
|
||||
pollSleepTime = 0;
|
||||
pollSleepTimeWakeBeforeUs = 20;
|
||||
}
|
||||
|
||||
|
||||
bool SingleATCAModule::ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err){
|
||||
|
||||
CDBExtended cdb(info);
|
||||
FString moduleName;
|
||||
cdb->NodeName(moduleName);
|
||||
if(!cdb.ReadInt32(moduleIdentifier, "ModuleIdentifier")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: ModuleIdentifier has not been specified.");
|
||||
return False;
|
||||
}
|
||||
|
||||
int32 master = 0;
|
||||
cdb.ReadInt32(master, "IsMaster",0);
|
||||
isMaster = (master != 0);
|
||||
if(isMaster){
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::ObjectLoadSetup: Module with identifier %d has been specified as master.", moduleIdentifier);
|
||||
}
|
||||
|
||||
synchronizing = False;
|
||||
if (isMaster) {
|
||||
FString syncMethod;
|
||||
if(!cdb.ReadFString(syncMethod, "SynchronizationMethod")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: SynchronizationMethod has not been specified.");
|
||||
return False;
|
||||
}
|
||||
if (syncMethod == "GetLatest") {
|
||||
synchronizing = False;
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::ObjectLoadSetup: synchronization method: GetLatest");
|
||||
} else {
|
||||
synchronizing = True;
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::ObjectLoadSetup: synchronization method: Synchronous on input");
|
||||
}
|
||||
}
|
||||
|
||||
if(!cdb.ReadInt32(numberOfAnalogueInputChannels, "NumberOfAnalogueInput")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfAnalogueInput has not been specified.");
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!cdb.ReadInt32(numberOfDigitalInputChannels, "NumberOfDigitalInput")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfDigitalInput has not been specified.");
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!cdb.ReadInt32(numberOfAnalogueOutputChannels, "NumberOfAnalogueOutput")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfAnalogueOutput has not been specified.");
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!cdb.ReadInt32(numberOfDigitalOutputChannels, "NumberOfDigitalOutput")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfDigitalOutput has not been specified.");
|
||||
return False;
|
||||
}
|
||||
|
||||
int32 detectedNumberOfInputAnalogChannels = 0;
|
||||
#ifdef _RTAI
|
||||
detectedNumberOfInputAnalogChannels = GetNumberOfInputAnalogChannels(moduleIdentifier);
|
||||
#elif defined(_LINUX)
|
||||
int32 temp = moduleIdentifier;
|
||||
int32 ret = ioctl(ATCAadcDrv::fileDescriptor, PCIE_ATCA_ADC_IOCT_N_IN_ANA_CHANNELS, &temp);
|
||||
if(ret != 0){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not query number of analog input channels. ioctl returned : %d", ret);
|
||||
return False;
|
||||
}
|
||||
detectedNumberOfInputAnalogChannels = temp;
|
||||
#endif
|
||||
if(numberOfAnalogueInputChannels > detectedNumberOfInputAnalogChannels){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfAnalogueInputs is at most %d. Specified %d.", detectedNumberOfInputAnalogChannels, numberOfAnalogueInputChannels);
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
int32 detectedNumberOfInputDigitalChannels = 0;
|
||||
#ifdef _RTAI
|
||||
detectedNumberOfInputDigitalChannels = GetNumberOfInputDigitalChannels(moduleIdentifier);
|
||||
#elif defined(_LINUX)
|
||||
temp = moduleIdentifier;
|
||||
ret = ioctl(ATCAadcDrv::fileDescriptor, PCIE_ATCA_ADC_IOCT_N_IN_DIG_CHANNELS, &temp);
|
||||
if(ret != 0){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not query number of digital input channels. ioctl returned : %d", ret);
|
||||
return False;
|
||||
}
|
||||
detectedNumberOfInputDigitalChannels = temp;
|
||||
#endif
|
||||
if(numberOfDigitalInputChannels > detectedNumberOfInputDigitalChannels){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfDigitalInputs is at most %d. Specified %d.", detectedNumberOfInputDigitalChannels, numberOfDigitalInputChannels);
|
||||
return False;
|
||||
}
|
||||
|
||||
int32 detectedNumberOfOutputAnalogChannels = 0;
|
||||
#ifdef _RTAI
|
||||
detectedNumberOfOutputAnalogChannels = GetNumberOfAnalogueOutputChannels(moduleIdentifier);
|
||||
#elif defined(_LINUX)
|
||||
temp = moduleIdentifier;
|
||||
ret = ioctl(ATCAadcDrv::fileDescriptor, PCIE_ATCA_ADC_IOCT_N_OUT_ANA_CHANNELS, &temp);
|
||||
if(ret != 0){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not query number of analog output channels. ioctl returned : %d", ret);
|
||||
return False;
|
||||
}
|
||||
detectedNumberOfOutputAnalogChannels = temp;
|
||||
#endif
|
||||
if(numberOfAnalogueOutputChannels > detectedNumberOfOutputAnalogChannels){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfAnalogueOutputs is at most %d. Specified %d.", detectedNumberOfOutputAnalogChannels, numberOfAnalogueOutputChannels);
|
||||
return False;
|
||||
}
|
||||
|
||||
int32 detectedNumberOfDigitalOutputChannels = 0;
|
||||
#ifdef _RTAI
|
||||
detectedNumberOfDigitalOutputChannels = GetNumberOfDigitalOutputChannels(moduleIdentifier);
|
||||
#elif defined(_LINUX)
|
||||
temp = moduleIdentifier;
|
||||
ret = ioctl(ATCAadcDrv::fileDescriptor, PCIE_ATCA_ADC_IOCT_N_OUT_DIG_CHANNELS, &temp);
|
||||
if(ret != 0){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not query number of digital output channels. ioctl returned : %d", ret);
|
||||
return False;
|
||||
}
|
||||
detectedNumberOfDigitalOutputChannels = temp;
|
||||
#endif
|
||||
if(numberOfDigitalOutputChannels > detectedNumberOfDigitalOutputChannels){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: NumberOfAnalogueOutputs is at most %d. Specified %d.", detectedNumberOfDigitalOutputChannels, numberOfAnalogueOutputChannels);
|
||||
return False;
|
||||
}
|
||||
|
||||
if(numberOfAnalogueOutputChannels > 0){
|
||||
bool hasRTM = False;
|
||||
#ifdef _RTAI
|
||||
hasRTM = IsRTMPresent(moduleIdentifier);
|
||||
#elif defined(_LINUX)
|
||||
int rtm = moduleIdentifier;
|
||||
ret = ioctl(ATCAadcDrv::fileDescriptor, PCIE_ATCA_ADC_IOCT_IS_RTM_PRESENT, &rtm);
|
||||
if(ret != 0){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not query IsRTMPresent. ioctl returned : %d", ret);
|
||||
return False;
|
||||
}
|
||||
hasRTM = (rtm == 1);
|
||||
#endif
|
||||
if(!hasRTM){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: Module %d specifies %d outputs but does not have RTM module", moduleIdentifier, numberOfAnalogueOutputChannels);
|
||||
return False;
|
||||
}
|
||||
int dims = 1;
|
||||
int size[2] = {numberOfAnalogueOutputChannels,1};
|
||||
if(!cdb.ReadInt32Array(outputMap, size, dims, "OutputMap")){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: OutputMap not specified. Assuming sequential order.");
|
||||
for(int i = 0; i < numberOfAnalogueOutputChannels; i++)
|
||||
outputMap[i] = i+1;
|
||||
}
|
||||
|
||||
// output order starts from 0 for convenience.
|
||||
for(int i = 0; i < numberOfAnalogueOutputChannels; i++) outputMap[i]--;
|
||||
}
|
||||
|
||||
if(channelStatistics != NULL){
|
||||
delete[] channelStatistics;
|
||||
channelStatistics = NULL;
|
||||
}
|
||||
|
||||
channelStatistics = new StatSignalInfo[NumberOfInputChannels()];
|
||||
if(channelStatistics == NULL){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not create ChannelStatistics for %d channels", NumberOfInputChannels());
|
||||
return False;
|
||||
}
|
||||
|
||||
for(int i=0; i<NumberOfInputChannels(); i++){
|
||||
channelStatistics[i].Init();
|
||||
channelStatistics[i].decayRate = 0.999;
|
||||
}
|
||||
|
||||
if(isMaster){
|
||||
if(!cdb.ReadInt32(boardInternalCycleTime, "BoardInternalCycleTime",50)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: BoardInternalCycleTime has not been specified. Assuming %d usec triggering period", boardInternalCycleTime);
|
||||
}
|
||||
boardInternalCycleTicks = (int64)(boardInternalCycleTime * 1e-6 * HRT::HRTFrequency());
|
||||
|
||||
int32 temp = 0;
|
||||
if(!cdb.ReadInt32(temp, "DatagramMonitoringFastSleep",2)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: DataArrivalUsecSleep has not been specified. Assuming %d usec sleeping time.", temp);
|
||||
}
|
||||
datagramArrivalFastMonitorSecSleep = temp*1e-6;
|
||||
if(!cdb.ReadInt32(temp, "DataAcquisitionUsecTimeOut",1000)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: DataAcquisitionUsecTimeOut has not been specified. Assuming %d usec of timeout.", temp);
|
||||
}
|
||||
|
||||
double deltaT = temp*1e-6;
|
||||
dataAcquisitionUsecTimeOut = (int64)(deltaT*HRT::HRTFrequency());
|
||||
|
||||
if(!cdb.ReadInt32(temp, "AllowPollSleeping", 1)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: AllowPollSleeping has not been specified. Assuming %d ", allowPollSleeping);
|
||||
}
|
||||
allowPollSleeping = (temp == 1);
|
||||
|
||||
if(!cdb.ReadFloat(worstPollSleepJitterDecayRate, "WorstPollSleepJitterDecayRate", 5e-6)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: WorstPollSleepJitterDecayRate has not been specified. Assuming %f ", worstPollSleepJitterDecayRate);
|
||||
}
|
||||
worstPollSleepJitterDecayRate = 1 - worstPollSleepJitterDecayRate;
|
||||
if(!cdb.ReadFloat(pollSleepTimeWakeBeforeUs, "PollSleepTimeWakeBeforeUs", 20)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: PollSleepTimeWakeBeforeUs has not been specified. Assuming %f ", pollSleepTimeWakeBeforeUs);
|
||||
}
|
||||
pollSleepTimeWakeBeforeUs *= 1e-6;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
/** Copies the pointers to the DMA Buffers */
|
||||
#ifdef _LINUX
|
||||
bool SingleATCAModule::InstallDMABuffers(int32 *mappedDmaMemoryLocation){
|
||||
int32 boardSlotNums[12];
|
||||
int32 boardIdx = 0;
|
||||
int ret = ioctl(ATCAadcDrv::fileDescriptor, PCIE_ATCA_ADC_IOCT_GET_BOARD_SLOT_NS, boardSlotNums);
|
||||
if(ret != 0){
|
||||
CStaticAssertErrorCondition(InitialisationError,"SingleATCAModule::ObjectLoadSetup: Could not query the number of boards. ioctl returned : %d",ret);
|
||||
return False;
|
||||
}
|
||||
|
||||
for(boardIdx = 0; boardIdx < 12; boardIdx++){
|
||||
if(boardSlotNums[boardIdx] == moduleIdentifier){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int32 pageInc = ATCAadcDrv::pageSize / sizeof(int32);
|
||||
for(int32 i = 0; i < DMA_BUFFS; i++){
|
||||
dmaBuffers[i] = mappedDmaMemoryLocation + pageInc * (DMA_BUFFS * boardIdx + i);
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::InstallDMABuffers: DMABuffer[%d] %p ",i, dmaBuffers[i]);
|
||||
}
|
||||
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::InstallDMABuffers: dmaBuffers: %p %p %p %p", dmaBuffers[0], dmaBuffers[1], dmaBuffers[2], dmaBuffers[3]);
|
||||
return True;
|
||||
}
|
||||
#else
|
||||
/** Copies the pointers to the DMA Buffers */
|
||||
bool SingleATCAModule::InstallDMABuffers(){
|
||||
int *boardDMABufferPointers = GetBoardBufferAddress(moduleIdentifier);
|
||||
if(boardDMABufferPointers == NULL) return False;
|
||||
for(int32 i = 0; i < DMA_BUFFS; i++){
|
||||
dmaBuffers[i] = (int32 *)boardDMABufferPointers[i];
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::InstallDMABuffers: DMABuffer[%d] %p ",i, dmaBuffers[i]);
|
||||
}
|
||||
|
||||
CStaticAssertErrorCondition(Information,"SingleATCAModule::InstallDMABuffers: dmaBuffers: %p %p %p %p", dmaBuffers[0], dmaBuffers[1], dmaBuffers[2], dmaBuffers[3]);
|
||||
return True;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32 SingleATCAModule::GetLatestBufferIndex(){
|
||||
|
||||
uint32 *latestBufferHeader = (uint32 *)dmaBuffers[0];
|
||||
uint32 latestBufferIndex = 0;
|
||||
|
||||
// check which one is the oldest buffer
|
||||
for (int dmaIndex = 1; dmaIndex < DMA_BUFFS; dmaIndex++) {
|
||||
// Pointer to the header
|
||||
uint32 *header = (uint32 *)dmaBuffers[dmaIndex];
|
||||
//uint32 *footer = header + NumberOfInputChannels() + HEADER_LENGTH;
|
||||
|
||||
if ((*header > *latestBufferHeader)) {
|
||||
latestBufferHeader = header;
|
||||
latestBufferIndex = dmaIndex;
|
||||
}
|
||||
}
|
||||
return latestBufferIndex;
|
||||
}
|
||||
|
||||
|
||||
int32 SingleATCAModule::CurrentBufferIndex(){
|
||||
|
||||
uint32 *oldestBufferHeader = (uint32 *)dmaBuffers[0];
|
||||
uint32 oldestBufferIndex = 0;
|
||||
|
||||
int64 stopAcquisition = HRT::HRTCounter() + dataAcquisitionUsecTimeOut;
|
||||
|
||||
// check which one is the oldest buffer
|
||||
int dmaIndex = 0;
|
||||
for (dmaIndex = 1; dmaIndex < DMA_BUFFS; dmaIndex++) {
|
||||
// Pointer to the header
|
||||
uint32 *header = (uint32 *)dmaBuffers[dmaIndex];
|
||||
if (*header < *oldestBufferHeader) {
|
||||
oldestBufferHeader = header;
|
||||
oldestBufferIndex = dmaIndex;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 *oldestBufferFooter = oldestBufferHeader + NumberOfInputChannels() + HEADER_LENGTH;
|
||||
uint32 oldestTimeMark = *oldestBufferFooter;
|
||||
|
||||
// If the data transfer is not in progress it means that the new data will
|
||||
// be stored in the oldest buffer.
|
||||
int64 actualTime = HRT::HRTCounter();
|
||||
while (oldestTimeMark == *oldestBufferFooter) {
|
||||
if(actualTime > stopAcquisition) {
|
||||
return -1;
|
||||
}
|
||||
actualTime = HRT::HRTCounter();
|
||||
}
|
||||
|
||||
if(*oldestBufferHeader == *oldestBufferFooter) return oldestBufferIndex;
|
||||
return -2;
|
||||
}
|
||||
|
||||
bool SingleATCAModule::WriteData(const int32 *&buffer){
|
||||
for(int i = 0; i < numberOfAnalogueOutputChannels; i++){
|
||||
#ifdef _LINUX
|
||||
int32 toWrite[4];
|
||||
toWrite[0] = moduleIdentifier;
|
||||
toWrite[1] = outputMap[i];
|
||||
toWrite[2] = *buffer++;
|
||||
toWrite[3] = 0;
|
||||
write(ATCAadcDrv::fileDescriptor, toWrite, 4 * sizeof(int32));
|
||||
#else
|
||||
WriteToDAC(moduleIdentifier, outputMap[i], *buffer++);
|
||||
#endif
|
||||
}
|
||||
for(int i = 0; i < numberOfDigitalOutputChannels; i++){
|
||||
#ifdef _LINUX
|
||||
int32 toWrite[4];
|
||||
toWrite[0] = moduleIdentifier;
|
||||
toWrite[1] = 0;
|
||||
toWrite[2] = *buffer++;
|
||||
toWrite[3] = 1;
|
||||
if(write(ATCAadcDrv::fileDescriptor, toWrite, 4 * sizeof(int32)) < 0){
|
||||
CStaticAssertErrorCondition(FatalError,"SingleATCAModule::WriteData: Could not write the value : %d to module %d", toWrite[2], toWrite[0]);
|
||||
return False;
|
||||
}
|
||||
#else
|
||||
WriteToDIO(moduleIdentifier, 0, *buffer++);
|
||||
#endif
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool SingleATCAModule::Poll(){
|
||||
#ifdef _LINUX
|
||||
static int firstTime = 1;
|
||||
if(firstTime == 1){
|
||||
SleepSec(1e-3);
|
||||
firstTime = 0;
|
||||
}
|
||||
#endif
|
||||
if(isMaster){
|
||||
if (synchronizing) {
|
||||
if(allowPollSleeping) {
|
||||
//Allow the worstPollSleepJitter to decay -> 0
|
||||
worstPollSleepJitter *= worstPollSleepJitterDecayRate;
|
||||
int64 tStart = HRT::HRTCounter();
|
||||
pollSleepTime = (nextExpectedAcquisitionCPUTicks - tStart) * HRT::HRTPeriod() - pollSleepTimeWakeBeforeUs - worstPollSleepJitter;
|
||||
if(pollSleepTime > 0){
|
||||
SleepNoMore(pollSleepTime);
|
||||
float jitter = ((HRT::HRTCounter() - tStart) * HRT::HRTPeriod()) - pollSleepTime;
|
||||
if(jitter < 0) jitter = -jitter;
|
||||
|
||||
if(jitter > worstPollSleepJitter){
|
||||
worstPollSleepJitter = jitter;
|
||||
}
|
||||
}
|
||||
}
|
||||
int32 previousAcquisitionIndex = currentDMABufferIndex;
|
||||
int32 currentDMA = CurrentBufferIndex();
|
||||
if(currentDMA < 0){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::GetData: Returned -1");
|
||||
return False;
|
||||
}
|
||||
|
||||
currentDMABufferIndex = currentDMA;
|
||||
|
||||
// Update NextExecTime with a guess
|
||||
nextExpectedAcquisitionCPUTicks = HRT::HRTCounter() + boardInternalCycleTicks;
|
||||
int deltaBuffer = *dmaBuffers[currentDMABufferIndex] - *dmaBuffers[previousAcquisitionIndex];
|
||||
int nOfLostPackets = deltaBuffer - boardInternalCycleTime;
|
||||
|
||||
if( *dmaBuffers[currentDMABufferIndex] == 0){
|
||||
printf("dmaBuffers[currentDMABufferIndex]: %d, *dmaBuffers[previousAcquisitionIndex = %d\n", *dmaBuffers[currentDMABufferIndex], *dmaBuffers[previousAcquisitionIndex]);
|
||||
}
|
||||
|
||||
if (( nOfLostPackets > 0)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::GetData: Lost %d Packets", nOfLostPackets / boardInternalCycleTime);
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::GetData: boardInternalCycleTime %d, deltaBuffer: %d", boardInternalCycleTime, deltaBuffer);
|
||||
}
|
||||
currentMasterHeader = *(dmaBuffers[currentDMABufferIndex]);
|
||||
lastCycleUsecTime = (uint32)currentMasterHeader;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
bool SingleATCAModule::GetData(int32 *&buffer){
|
||||
|
||||
/** Perform synchronisation */
|
||||
if(isMaster){
|
||||
if (synchronizing) {
|
||||
buffer[0] = *dmaBuffers[currentDMABufferIndex];
|
||||
buffer[1] = buffer[0];
|
||||
|
||||
// Skip the packet sample number and sample time
|
||||
buffer += 2;
|
||||
currentMasterHeader = *(dmaBuffers[currentDMABufferIndex]);
|
||||
lastCycleUsecTime = (uint32)currentMasterHeader;
|
||||
} else {
|
||||
currentDMABufferIndex = GetLatestBufferIndex();
|
||||
}
|
||||
}else{
|
||||
int32 *header = dmaBuffers[currentDMABufferIndex];
|
||||
int32 *footer = header + NumberOfInputChannels() + HEADER_LENGTH;
|
||||
if(*header != currentMasterHeader){
|
||||
CStaticAssertErrorCondition(FatalError, "SingleATCAModule (slot=%d)::GetData: h (=%d) different from master h(=%d)", moduleIdentifier, *header, currentMasterHeader);
|
||||
return False;
|
||||
}
|
||||
if(*header != *footer){
|
||||
CStaticAssertErrorCondition(FatalError, "SingleATCAModule (slot=%d)::GetData: The header (=%d) is different from the footer(=%d)", moduleIdentifier, *header, *footer);
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Skip the Header in the DMA Buffer
|
||||
int32 *src = (int32 *)dmaBuffers[currentDMABufferIndex] + 1;
|
||||
int32 *dest = buffer;
|
||||
memcpy(dest, src, NumberOfInputChannels()*sizeof(int32));
|
||||
|
||||
//This is introducing a huge delay (~1.5us per board). To be solved.
|
||||
/*for(int i=0; i<NumberOfInputChannels(); i++){
|
||||
channelStatistics[i].Update((float)(buffer[i] * 1.49e-8));
|
||||
}*/
|
||||
buffer += NumberOfInputChannels();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool SingleATCAModule::ProcessHttpMessage(HttpStream &hStream) {
|
||||
hStream.Printf("<table class=\"bltable\">\n");
|
||||
hStream.Printf("<tr>\n");
|
||||
hStream.Printf("<td>Module Identifier</td><td>%d</td>\n", moduleIdentifier);
|
||||
hStream.Printf("</tr>\n");
|
||||
hStream.Printf("<tr>\n");
|
||||
hStream.Printf("<td>Master</td><td>%s</td>\n", isMaster ? "True" : "False");
|
||||
hStream.Printf("</tr>\n");
|
||||
hStream.Printf("</table>\n");
|
||||
hStream.Printf("<table class=\"bltable\">\n");
|
||||
hStream.Printf("<tr><th>Channel</th><th>Last</th><th>Mean</th><th>Variance</th><th>Abs Max</th><th>Abs Min</th><th>Rel Max</th><th>Rel Min</th></tr>\n");
|
||||
int i=0;
|
||||
for(i=0; i<NumberOfInputChannels(); i++){
|
||||
hStream.Printf("<tr><td>%d</td><td>%.3e</td><td>%.3e</td><td>%.3e</td><td>%.3e</td><td>%.3e</td><td>%.3e</td><td>%.3e</td></tr>\n", i + 1, channelStatistics[i].LastValue(), channelStatistics[i].Mean(10), channelStatistics[i].Variance(10), channelStatistics[i].AbsMax(), channelStatistics[i].AbsMin(), channelStatistics[i].RelMax(), channelStatistics[i].RelMin());
|
||||
}
|
||||
hStream.Printf("</table>");
|
||||
return True;
|
||||
}
|
||||
|
||||
bool SingleATCAModule::ResetStatistics(){
|
||||
int i=0;
|
||||
for(i=0; i<NumberOfInputChannels(); i++){
|
||||
channelStatistics[i].Init();
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
ATCAadcDrv::ATCAadcDrv(){
|
||||
numberOfBoards = 0;
|
||||
lastCycleUsecTime = 0;
|
||||
modules = NULL;
|
||||
synchronizing = False;
|
||||
softwareTrigger = 0;
|
||||
masterBoardIdx = -1;
|
||||
autoSoftwareTriggerAfterUs = -1;
|
||||
autoSoftwareTrigger = False;
|
||||
#ifdef _LINUX
|
||||
fileDescriptor = 0;
|
||||
pageSize = sysconf(_SC_PAGE_SIZE);
|
||||
#endif
|
||||
css = "table.bltable {"
|
||||
"margin: 1em 1em 1em 2em;"
|
||||
"background: whitesmoke;"
|
||||
"border-collapse: collapse;"
|
||||
"}"
|
||||
"table.bltable th, table.bltable td {"
|
||||
"border: 1px silver solid;"
|
||||
"padding: 0.2em;"
|
||||
"}"
|
||||
"table.bltable th {"
|
||||
"background: gainsboro;"
|
||||
"text-align: left;"
|
||||
"}"
|
||||
"table.bltable caption {"
|
||||
"margin-left: inherit;"
|
||||
"margin-right: inherit;"
|
||||
"}";
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::EnableAcquisition(){
|
||||
if(modules == NULL) return False;
|
||||
#ifdef _RTAI
|
||||
return (EnableATCApcieAcquisition() == 0);
|
||||
#elif defined(_LINUX)
|
||||
int ret = ioctl(fileDescriptor, PCIE_ATCA_ADC_IOCT_ACQ_ENABLE);
|
||||
if(ret != 0){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Could not enable acquisition. ioctl returned : %d",Name(), ret);
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::DisableAcquisition(){
|
||||
if(modules == NULL) return False;
|
||||
#ifdef _RTAI
|
||||
return (DisableATCApcieAcquisition() == 0);
|
||||
#elif defined(_LINUX)
|
||||
int ret = ioctl(fileDescriptor, PCIE_ATCA_ADC_IOCT_ACQ_DISABLE);
|
||||
if(ret != 0){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Could not disable acquisition. ioctl returned : %d",Name(), ret);
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err){
|
||||
#ifdef _LINUX
|
||||
fileDescriptor = open("/dev/pcieATCAAdc0", O_RDWR);
|
||||
if(fileDescriptor < 1){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Could not open device driver at: %s",Name(), "/dev/pcieATCAAdc0");
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
DisableAcquisition();
|
||||
|
||||
CDBExtended cdb(info);
|
||||
|
||||
if(!cdb.ReadInt32(softwareTrigger, "UseSoftwareTrigger",0)){
|
||||
CStaticAssertErrorCondition(Warning,"SingleATCAModule::ObjectLoadSetup: UseSoftwareTrigger has not been specified. Assuming hardware trigger");
|
||||
}
|
||||
|
||||
if(!GenericAcqModule::ObjectLoadSetup(cdb,err)){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: GenericAcqModule::ObjectLoadSetup failed",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
FString syncMethod;
|
||||
if(!cdb.ReadFString(syncMethod, "SynchronizationMethod")){
|
||||
CStaticAssertErrorCondition(InitialisationError,"ATCAAdcDrv::ObjectLoadSetup: SynchronizationMethod has not been specified.");
|
||||
return False;
|
||||
}
|
||||
if (syncMethod == "GetLatest") synchronizing = False;
|
||||
else synchronizing = True;
|
||||
|
||||
cdb.ReadInt32(autoSoftwareTriggerAfterUs, "AutoSoftwareTriggerAfterUs", -1);
|
||||
autoSoftwareTrigger = (autoSoftwareTriggerAfterUs > 0);
|
||||
if(autoSoftwareTrigger){
|
||||
CStaticAssertErrorCondition(Information, "ATCAadcDrv::ObjectLoadSetup: %s the system will be automatically triggered after %d us", Name(), autoSoftwareTriggerAfterUs);
|
||||
}
|
||||
|
||||
// Get buffer address from the driver exported function GetBufferAddress (only works in RTAI!)
|
||||
#ifdef _RTAI
|
||||
numberOfBoards = GetNumberOfBoards();
|
||||
#elif defined(_LINUX)
|
||||
int ret = ioctl(fileDescriptor, PCIE_ATCA_ADC_IOCT_NUM_BOARDS, &numberOfBoards);
|
||||
if(ret != 0){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Could not query the number of boards. ioctl returned : %d",Name(), ret);
|
||||
return False;
|
||||
}
|
||||
|
||||
mappedDmaMemorySize = numberOfBoards * DMA_BUFFS * pageSize;
|
||||
mappedDmaMemoryLocation = (int32 *)mmap(0, mappedDmaMemorySize, PROT_READ, MAP_FILE | MAP_SHARED | MAP_LOCKED | MAP_POPULATE | MAP_NONBLOCK, fileDescriptor, 0);
|
||||
if(mappedDmaMemoryLocation == MAP_FAILED) {
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: MAP_FAILED",Name());
|
||||
return False;
|
||||
}
|
||||
#else
|
||||
numberOfBoards = -1;
|
||||
#endif
|
||||
|
||||
if(!cdb->Move( "Modules")){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: No Module has been specified",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
int32 nOfATCAModules = cdb->NumberOfChildren();
|
||||
if(nOfATCAModules!= numberOfBoards){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Number of installed boards [%d] differs from the number of specified boards [%d].",Name(),numberOfBoards,nOfATCAModules);
|
||||
return False;
|
||||
}
|
||||
|
||||
if(modules != NULL) delete[] modules;
|
||||
modules = new SingleATCAModule[nOfATCAModules];
|
||||
if(modules == NULL){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Failed allocating space for %d modules.",Name(),nOfATCAModules);
|
||||
return False;
|
||||
}
|
||||
|
||||
masterBoardIdx = -1;
|
||||
for(int i = 0; i < nOfATCAModules; i++){
|
||||
cdb->MoveToChildren(i);
|
||||
cdb.WriteFString(syncMethod,"SynchronizationMethod");
|
||||
|
||||
if(!modules[i].ObjectLoadSetup(cdb,err)){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Failed initialising module %d.",Name(),i);
|
||||
delete[] modules;
|
||||
return False;
|
||||
}
|
||||
|
||||
if(modules[i].isMaster){
|
||||
if(masterBoardIdx == -1){
|
||||
masterBoardIdx = i;
|
||||
}else{
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Failed initialising module %d. A master board was already specified at index: %d",Name(),i,masterBoardIdx);
|
||||
return False;
|
||||
}
|
||||
}
|
||||
cdb->MoveToFather();
|
||||
}
|
||||
|
||||
for(int i = 0; i < nOfATCAModules; i++){
|
||||
#ifdef _LINUX
|
||||
if(!modules[i].InstallDMABuffers(mappedDmaMemoryLocation)){
|
||||
#else
|
||||
if(!modules[i].InstallDMABuffers()){
|
||||
#endif
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Board %d failed to initialise DMA buffers",Name(), i);
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
cdb->MoveToFather();
|
||||
|
||||
int32 extTriggerAndClock = 0;
|
||||
if(!cdb.ReadInt32(extTriggerAndClock, "ExtTriggerAndClock",1)){
|
||||
AssertErrorCondition(Warning,"ATCAadcDrv::ObjectLoadSetup: %s: ExtTriggerAndClock not specified, using default = %d",Name(), extTriggerAndClock);
|
||||
}
|
||||
|
||||
#ifdef _LINUX
|
||||
ret = ioctl(fileDescriptor, PCIE_ATCA_ADC_IOCT_SET_EXT_CLK_TRG, &extTriggerAndClock);
|
||||
if(ret != 0){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::ObjectLoadSetup: %s: Could not SetATCApcieExternalTriggerAndClock. ioctl returned : %d",Name(), ret);
|
||||
return False;
|
||||
}
|
||||
#else
|
||||
SetATCApcieExternalTriggerAndClock(extTriggerAndClock);
|
||||
#endif
|
||||
// Setup OK
|
||||
|
||||
AssertErrorCondition(Information,"ATCAadcDrv::ObjectLoadSetup: %s: initialized correctly ",Name());
|
||||
EnableAcquisition();
|
||||
return True;
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::ObjectDescription(StreamInterface &s,bool full,StreamInterface *err){
|
||||
|
||||
s.Printf("%s %s\n",ClassName(),Version());
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::WriteData(uint32 usecTime, const int32 *buffer){
|
||||
if(buffer == NULL) return False;
|
||||
const int32 *lBuffer = buffer;
|
||||
for(int i = 0; i < numberOfBoards; i++){
|
||||
modules[i].WriteData(lBuffer);
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
int32 ATCAadcDrv::GetData(uint32 usecTime, int32 *buffer, int32 bufferNum){
|
||||
|
||||
//Check buffer existence
|
||||
if(buffer == NULL){
|
||||
AssertErrorCondition(FatalError,"ATCAadcDrv::GetData: %s. The DDInterface buffer is NULL.",Name());
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32 *lBuffer = buffer;
|
||||
for(int i = 0; i < numberOfBoards; i++){
|
||||
if(!modules[i].GetData(lBuffer)){
|
||||
AssertErrorCondition(FatalError,"ATCAadcDrv::GetData: %s. Module %d failed acquiring data",Name(),i);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::Poll(){
|
||||
if(autoSoftwareTrigger){
|
||||
if(lastCycleUsecTime > autoSoftwareTriggerAfterUs){
|
||||
SoftwareTrigger();
|
||||
}
|
||||
}
|
||||
bool ok = modules[masterBoardIdx].Poll();
|
||||
if(!ok){
|
||||
return ok;
|
||||
}
|
||||
// If the module is the timingATMDrv call the Trigger() method of
|
||||
// the time service object
|
||||
lastCycleUsecTime = modules[masterBoardIdx].lastCycleUsecTime;
|
||||
|
||||
for(int i = 0; i < nOfTriggeringServices; i++){
|
||||
triggerService[i].Trigger();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool ATCAadcDrv::ProcessHttpMessage(HttpStream &hStream) {
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html");
|
||||
hStream.keepAlive = False;
|
||||
//copy to the client
|
||||
hStream.Printf("<html><head><title>%s</title>", Name());
|
||||
hStream.Printf( "<style type=\"text/css\">\n" );
|
||||
hStream.Printf("%s\n", css);
|
||||
hStream.Printf( "</style></head><body>\n" );
|
||||
hStream.Printf("<table class=\"bltable\">\n");
|
||||
int i=0;
|
||||
hStream.Printf("<tr>\n");
|
||||
for(i=0; i<numberOfBoards; i++){
|
||||
hStream.Printf("<td>%d</td>\n", modules[i].BoardIdentifier());
|
||||
}
|
||||
hStream.Printf("</tr>\n");
|
||||
hStream.Printf("<tr>\n");
|
||||
for(i=0; i<numberOfBoards; i++){
|
||||
hStream.Printf("<td>%s</td>\n", modules[i].isMaster ? "M" : "");
|
||||
}
|
||||
hStream.Printf("</tr>\n");
|
||||
hStream.Printf("<tr>\n");
|
||||
for(i=0; i<numberOfBoards; i++){
|
||||
hStream.Printf("<td>%s</td>\n", modules[i].NumberOfOutputChannels() > 0 ? "R" : "");
|
||||
}
|
||||
hStream.Printf("</tr>\n");
|
||||
hStream.Printf("<tr>\n");
|
||||
hStream.Printf("<form>\n");
|
||||
for(i=0; i<numberOfBoards; i++){
|
||||
hStream.Printf("<td><button type=\"submit\" name=\"boardID\" value=\"%d\">.</button></td>\n", modules[i].BoardIdentifier());
|
||||
}
|
||||
hStream.Printf("</tr>\n");
|
||||
hStream.Printf("</form>\n");
|
||||
hStream.Printf("</table>\n");
|
||||
hStream.Printf("<form>\n");
|
||||
hStream.Printf("<td><button type=\"submit\" name=\"reset\" value=\"true\">Reset statistics</button></td>\n");
|
||||
hStream.Printf("</form>\n");
|
||||
|
||||
FString reqBoardID;
|
||||
reqBoardID.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.boardID")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(reqBoardID, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
FString reqReset;
|
||||
reqReset.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.reset")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(reqReset, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(reqReset.Size() > 0){
|
||||
for(i=0; i<numberOfBoards; i++){
|
||||
modules[i].ResetStatistics();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(reqBoardID.Size() > 0){
|
||||
int32 boardID = atoi(reqBoardID.Buffer());
|
||||
for(i=0; i<numberOfBoards; i++){
|
||||
if(modules[i].BoardIdentifier() == boardID){
|
||||
modules[i].ProcessHttpMessage(hStream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hStream.Printf("<p>Worst polling jitter (us): %f\n", modules[masterBoardIdx].worstPollSleepJitter * 1e6);
|
||||
hStream.Printf("<p>Last polling sleep time (us): %f", modules[masterBoardIdx].pollSleepTime * 1e6);
|
||||
hStream.Printf("</body></html>");
|
||||
hStream.WriteReplyHeader(True);
|
||||
return True;
|
||||
}
|
||||
|
||||
OBJECTLOADREGISTER(ATCAadcDrv,"$Id: ATCAadcDrv.cpp,v 1.48 2010/02/09 14:50:59 ppcc_dev Exp $")
|
||||
408
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/ATCAadcDrv.h
Normal file
408
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/ATCAadcDrv.h
Normal file
@@ -0,0 +1,408 @@
|
||||
//******************************************************************************
|
||||
// MARTe Library
|
||||
// $Log: ATCAadcDrv.h,v $
|
||||
// Revision 1.32 2009/12/03 14:52:13 ppcc_dev
|
||||
// Sleeps, if time is available, before start busy polling.
|
||||
// The time to sleep is given by the remaining time until the start of
|
||||
// the next pulse minus the worst jitter from a sleep and minus the
|
||||
// desired time, before the beginning of the next pulse, that we want to start
|
||||
// busy polling.
|
||||
// The worst jitter decays to zero in order to try to maintain a good performance
|
||||
//
|
||||
// Revision 1.31 2009/08/07 09:31:47 aneto
|
||||
// Allow the autoSoftwareTrigger to work even if the softwareTrigger flag
|
||||
// is set to false
|
||||
//
|
||||
// Revision 1.30 2009/05/21 15:18:37 ppcc_dev
|
||||
// DigIO does not have outputMap
|
||||
//
|
||||
// Revision 1.29 2009/04/14 09:06:10 aneto
|
||||
// Allow the system to auto-trigger after a specified amount of time
|
||||
//
|
||||
// Revision 1.28 2009/04/03 10:02:03 aneto
|
||||
// lastCycleUsecTime now is true 64 bits.
|
||||
// This uses the information from the headers to increment an internal counter
|
||||
//
|
||||
// Revision 1.27 2009/04/01 15:10:36 aneto
|
||||
// Bug in the way the modulus was being calculated for the usec time. The bug was in converting from 64 to 32 bits of lastCycleUsecTime
|
||||
//
|
||||
// Revision 1.26 2009/03/16 11:42:16 aneto
|
||||
// Corrected the polling mode in order to allow different acquisition frequencies
|
||||
//
|
||||
// Revision 1.25 2009/03/11 12:31:54 aneto
|
||||
// Support an html output with information about the driver
|
||||
//
|
||||
// Revision 1.24 2009/01/26 17:26:20 ppcc_dev
|
||||
// Small bugs solved
|
||||
//
|
||||
// Revision 1.23 2009/01/26 09:20:38 aneto
|
||||
// linux support
|
||||
//
|
||||
// Revision 1.22 2008/11/28 12:03:13 aneto
|
||||
// Added bufferNumber
|
||||
//
|
||||
// Revision 1.21 2008/11/21 14:16:52 ppcc_dev
|
||||
// This version works with the new firmware: jet clock+trigger
|
||||
//
|
||||
// Revision 1.19 2008/09/30 11:24:49 rvitelli
|
||||
// Added non-synchronous operating mode.
|
||||
//
|
||||
// Revision 1.18 2008/09/22 17:20:36 fpiccolo
|
||||
// Solved minor bugs
|
||||
//
|
||||
// Revision 1.17 2008/09/15 16:51:45 ppcc_dev
|
||||
// Solved few bugs
|
||||
//
|
||||
// Revision 1.16 2008/09/09 09:29:15 fpiccolo
|
||||
// Modified driver structure.
|
||||
// Added SingleATCAModule class
|
||||
// Added Writing facilities
|
||||
//
|
||||
// Revision 1.15 2008/08/20 16:34:36 ppcc_dev
|
||||
// Added PulseStart to reset the internal counter to 0 when using the SoftTrigger option
|
||||
//
|
||||
// Revision 1.14 2008/08/15 10:41:35 fpiccolo
|
||||
// Minor stylish modifications.
|
||||
// Added TimeModule Interface
|
||||
//
|
||||
// Revision 1.13 2008/08/01 14:09:28 rvitelli
|
||||
// First working version
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef ATCAADCDRV_H_
|
||||
#define ATCAADCDRV_H_
|
||||
|
||||
#include "System.h"
|
||||
#include "GenericAcqModule.h"
|
||||
#include "FString.h"
|
||||
#include "pcieAdc.h"
|
||||
#include "pcieAdc_ioctl.h"
|
||||
#ifdef _LINUX
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include "WebStatisticGAM.h"
|
||||
|
||||
class SingleATCAModule{
|
||||
private:
|
||||
/** Module Identifier */
|
||||
int32 moduleIdentifier;
|
||||
|
||||
/** Number of Analogue Input channels for this module (Maximum 32)*/
|
||||
int32 numberOfAnalogueInputChannels;
|
||||
|
||||
/** Number of Digital Input channels for this module (1 or 0) */
|
||||
int32 numberOfDigitalInputChannels;
|
||||
|
||||
/** Number of Analogue Output channels (Maximum 8) */
|
||||
int32 numberOfAnalogueOutputChannels;
|
||||
|
||||
/** Number of Digital Output channels () */
|
||||
int32 numberOfDigitalOutputChannels;
|
||||
|
||||
/** Output Map. Used to map the output to a specific physical
|
||||
output channel. Channels are identified from 1 to 8. */
|
||||
int32 outputMap[8];
|
||||
|
||||
|
||||
////////////////////////////
|
||||
// Analogue Input Section //
|
||||
////////////////////////////
|
||||
|
||||
/** If true synchronize on data arrival, if false return latest completed buffer */
|
||||
bool synchronizing;
|
||||
|
||||
/** Pointers to the DMA memory allocated for data acquisition.
|
||||
The number of buffers is fixed to 4.
|
||||
*/
|
||||
int32 *dmaBuffers[DMA_BUFFS];
|
||||
|
||||
/** Current DMA buffer index [0-3]. */
|
||||
static int32 currentDMABufferIndex;
|
||||
|
||||
/** The current master header (must be the same in all the boards) */
|
||||
static int32 currentMasterHeader;
|
||||
|
||||
/** Estimated time of the next expected arrival in CPU Ticks of the acquired buffer.
|
||||
It is computed by adding a delay specified @param periodUsecSleep to
|
||||
the time of the previous completed acquisition. The system will sleep
|
||||
till this time elapses.
|
||||
*/
|
||||
int64 nextExpectedAcquisitionCPUTicks;
|
||||
|
||||
/** Specifies how long to sleep between acquisitions. It is specified in microseconds
|
||||
but it is internally converted in CPU ticks to avoid unecessary computations during
|
||||
realtime activities.
|
||||
*/
|
||||
int64 boardInternalCycleTicks;
|
||||
|
||||
/** Amount of time in microseconds after which the data stops waiting for data arrival
|
||||
and reports an acquisition error.
|
||||
*/
|
||||
int64 dataAcquisitionUsecTimeOut;
|
||||
|
||||
/** Length of a "Short Sleep" in seconds. It is used to monitor
|
||||
the data arrival on the master board and specifies a sleep time
|
||||
between checks of the data datagram arrival.
|
||||
*/
|
||||
float datagramArrivalFastMonitorSecSleep;
|
||||
|
||||
/** The number of micro seconds incremented by the board in each cycle. It gives the board acquisition frequency.
|
||||
*/
|
||||
int32 boardInternalCycleTime;
|
||||
|
||||
/**
|
||||
* The statistics info for these channels
|
||||
*/
|
||||
StatSignalInfo *channelStatistics;
|
||||
|
||||
/** Find the currentDMABufferIndex and synchronize on data arrival
|
||||
|
||||
*/
|
||||
int32 CurrentBufferIndex();
|
||||
|
||||
/** Find the latest completed buffer without synchronization*/
|
||||
int32 GetLatestBufferIndex();
|
||||
|
||||
public:
|
||||
|
||||
SingleATCAModule();
|
||||
|
||||
/** Initialises the SingleModule Parameter*/
|
||||
bool ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err = NULL);
|
||||
|
||||
/** Reads NumberOfInputChannels() from the DMA Buffer.
|
||||
The first module must be the master board to assure
|
||||
correct data transfer.
|
||||
*/
|
||||
bool GetData(int32 *&buffer);
|
||||
|
||||
bool WriteData(const int32 *&buffer);
|
||||
|
||||
/** Copies the pointers to the DMA Buffers */
|
||||
#ifdef _LINUX
|
||||
bool InstallDMABuffers(int32 *mappedDmaMemoryLocation);
|
||||
#else
|
||||
/** Copies the pointers to the DMA Buffers */
|
||||
bool InstallDMABuffers();
|
||||
#endif
|
||||
|
||||
/////////////////
|
||||
// Time Module //
|
||||
/////////////////
|
||||
|
||||
int64 lastCycleUsecTime;
|
||||
|
||||
int32 packetCounter;
|
||||
|
||||
/** Is Master Board */
|
||||
bool isMaster;
|
||||
|
||||
|
||||
/** Returns the sum of analogue and digital input channels */
|
||||
int32 NumberOfInputChannels(){
|
||||
return numberOfDigitalInputChannels + numberOfAnalogueInputChannels;
|
||||
}
|
||||
|
||||
/** Returns the sum of analogue and digital output channels */
|
||||
int32 NumberOfOutputChannels(){
|
||||
return numberOfDigitalOutputChannels + numberOfAnalogueOutputChannels;
|
||||
}
|
||||
|
||||
/** Returns the module Identifier */
|
||||
int32 BoardIdentifier(){return moduleIdentifier;}
|
||||
|
||||
/**
|
||||
* Output an HTML table with the current value in mV of the acquired signals for this board
|
||||
*/
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
/**
|
||||
* Resets the statistics
|
||||
*/
|
||||
bool ResetStatistics();
|
||||
/**
|
||||
* Polling method
|
||||
*/
|
||||
virtual bool Poll();
|
||||
/**
|
||||
* Allow sleeping, when enough time is available, before start polling
|
||||
*/
|
||||
bool allowPollSleeping;
|
||||
/**
|
||||
* Time to sleep before hard polling: pollSleepTime = CycleTime - time left to cycle time - pollSleepTimeWakeBeforeUs - worstPollSleepJitter;
|
||||
*/
|
||||
float pollSleepTime;
|
||||
/**
|
||||
* Actually we want to start polling some us before reaching the cycle time
|
||||
*/
|
||||
float pollSleepTimeWakeBeforeUs;
|
||||
/**
|
||||
* The worst jitter calculated in realtime of the actual time slept before polling and time meant to sleep
|
||||
*/
|
||||
float worstPollSleepJitter;
|
||||
/**
|
||||
* The worst jitter will try to be recovered with a certain rate
|
||||
*/
|
||||
float worstPollSleepJitterDecayRate;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
OBJECT_DLL(ATCAadcDrv)
|
||||
/** The high level driver for the ATCA ADC module */
|
||||
class ATCAadcDrv:public GenericAcqModule{
|
||||
private:
|
||||
|
||||
/** Number of boards in the crate. Read during Initialisation */
|
||||
int32 numberOfBoards;
|
||||
|
||||
/** Pointers to the ATCA modules */
|
||||
SingleATCAModule *modules;
|
||||
|
||||
/** Last cycle usec time */
|
||||
int64 lastCycleUsecTime;
|
||||
|
||||
/** */
|
||||
bool synchronizing;
|
||||
|
||||
/** Software triggered acquisition.
|
||||
0, which is the default value, means hardware trigger.
|
||||
*/
|
||||
int32 softwareTrigger;
|
||||
|
||||
/** The master board index
|
||||
*/
|
||||
int32 masterBoardIdx;
|
||||
|
||||
/** If set to true the a software trigger will be sent every
|
||||
* AutoSoftwareTriggerAfterUs microseconds. For this to be
|
||||
* true the value of AutoSoftwareTriggerAfterUs in the configuration file
|
||||
* must be > 1
|
||||
*/
|
||||
bool autoSoftwareTrigger;
|
||||
int32 autoSoftwareTriggerAfterUs;
|
||||
|
||||
#ifdef _LINUX
|
||||
/** Used only in Linux. The mmapped memory location.*/
|
||||
int32 *mappedDmaMemoryLocation;
|
||||
int32 mappedDmaMemorySize;
|
||||
#endif
|
||||
/** The css for this page
|
||||
*/
|
||||
const char *css;
|
||||
|
||||
public:
|
||||
|
||||
#ifdef _LINUX
|
||||
/**The page size*/
|
||||
static int32 pageSize;
|
||||
|
||||
/**The file descriptor to access the driver*/
|
||||
static int32 fileDescriptor;
|
||||
#endif
|
||||
|
||||
// (De)Constructor
|
||||
ATCAadcDrv();
|
||||
|
||||
virtual ~ATCAadcDrv(){
|
||||
if(modules != NULL) delete[] modules;
|
||||
#ifdef _LINUX
|
||||
munmap(mappedDmaMemoryLocation, mappedDmaMemorySize);
|
||||
close(fileDescriptor);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Standard GAM methods
|
||||
/* Load setup from CDB.
|
||||
This IOGAM peculiar parameters are PeriodSleep_usec and FastSleep_usec.
|
||||
@param info: CDB from which load data
|
||||
@param err: not used
|
||||
@returns true if all ok*/
|
||||
virtual bool ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err);
|
||||
|
||||
/* Print internal GAM informations
|
||||
@param s: StreamInterface in which print infos
|
||||
@param full: not used
|
||||
@param err: not used
|
||||
@returns true if all ok*/
|
||||
virtual bool ObjectDescription(StreamInterface &s,bool full = False, StreamInterface *err=NULL);
|
||||
|
||||
/* Saves the data into the DDB
|
||||
@param usecTime: not used
|
||||
@param buffer: pointer to the data buffer to be filled
|
||||
@returns 1 if all ok*/
|
||||
int32 GetData(uint32 usecTime, int32 *buffer, int32 bufferNum = 0);
|
||||
|
||||
bool WriteData(uint32 usecTime, const int32 *buffer);
|
||||
|
||||
// Set board used as input
|
||||
virtual bool SetInputBoardInUse(bool on = False){
|
||||
if(inputBoardInUse && on){
|
||||
AssertErrorCondition(InitialisationError, "ATCAadcDrv::SetInputBoardInUse: Board %s is already in use", Name());
|
||||
return False;
|
||||
}
|
||||
inputBoardInUse = on;
|
||||
return True;
|
||||
}
|
||||
|
||||
virtual bool SetOutputBoardInUse(bool on = False){
|
||||
if(outputBoardInUse && on){
|
||||
AssertErrorCondition(InitialisationError, "ATCAadcDrv::SetOutputBoardInUse: Board %s is already in use", Name());
|
||||
return False;
|
||||
}
|
||||
outputBoardInUse = on;
|
||||
return True;
|
||||
}
|
||||
|
||||
virtual bool EnableAcquisition();
|
||||
|
||||
virtual bool DisableAcquisition();
|
||||
|
||||
//////////////////////
|
||||
// From Time Module //
|
||||
//////////////////////
|
||||
|
||||
// Get the Time
|
||||
int64 GetUsecTime(){return lastCycleUsecTime;}
|
||||
|
||||
bool SoftwareTrigger(){
|
||||
if(modules == NULL)return False;
|
||||
#ifdef _RTAI
|
||||
SendSoftwareTrigger();
|
||||
#elif defined(_LINUX)
|
||||
int ret = ioctl(fileDescriptor, PCIE_ATCA_ADC_IOCT_SEND_SOFT_TRG);
|
||||
if(ret != 0){
|
||||
AssertErrorCondition(InitialisationError,"ATCAadcDrv::PulseStart: Could send software trigger. ioctl returned : %d",ret);
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
// Simulation Purpose Functions //
|
||||
//////////////////////////////////
|
||||
|
||||
bool PulseStart(){
|
||||
if(modules == NULL)return False;
|
||||
if(softwareTrigger == 1){
|
||||
return SoftwareTrigger();
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an HTML page with the current value in mV of the acquired signals
|
||||
*/
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
/**
|
||||
* Polling method
|
||||
*/
|
||||
virtual bool Poll();
|
||||
private:
|
||||
|
||||
OBJECT_DLL_STUFF(ATCAadcDrv);
|
||||
};
|
||||
#endif /*ATCAADCDRV_H_*/
|
||||
62
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/Makefile.inc
Normal file
62
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/Makefile.inc
Normal file
@@ -0,0 +1,62 @@
|
||||
#*******************************************************************************
|
||||
# $Log: Makefile.inc,v $
|
||||
# Revision 1.8 2009/03/11 12:31:54 aneto
|
||||
# Support an html output with information about the driver
|
||||
#
|
||||
# Revision 1.7 2009/03/06 10:01:17 ppcc_dev
|
||||
# Added automatic compilation
|
||||
#
|
||||
# Revision 1.6 2008/09/08 09:18:01 ppcc_dev
|
||||
# Added a break in the switch sentence of TimeInputGAM.
|
||||
# Removed the pcieATCA module from standard compilation scripts
|
||||
#
|
||||
# Revision 1.5 2008/09/05 11:08:35 ppcc_dev
|
||||
# Added module compilation
|
||||
#
|
||||
# Revision 1.4 2008/08/20 16:34:36 ppcc_dev
|
||||
# Added PulseStart to reset the internal counter to 0 when using the SoftTrigger option
|
||||
#
|
||||
# Revision 1.3 2008/08/01 14:09:56 rvitelli
|
||||
# *** empty log message ***
|
||||
#
|
||||
# Revision 1.2 2008/06/16 14:39:23 rvitelli
|
||||
# *** empty log message ***
|
||||
#
|
||||
# Revision 1.1 2008/06/05 13:18:58 rvitelli
|
||||
# Skeleton of Drv files and makefiles
|
||||
#
|
||||
#
|
||||
#*******************************************************************************/
|
||||
|
||||
OBJSX=
|
||||
SPB=
|
||||
|
||||
CODEDIR=/opt/MARTe
|
||||
DRIVERDIR=/opt/drivers/ATCA-MIMO
|
||||
MAKEDEFAULTDIR=$(CODEDIR)/MakeDefaults
|
||||
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||
|
||||
CFLAGS+= -I.
|
||||
CFLAGS+= -I$(CODEDIR)/GAMs/WebStatisticGAM
|
||||
CFLAGS+= -I$(CODEDIR)/MARTe/MARTeSupportLib
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level0
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level1
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level2
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level3
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level4
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level5
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level6
|
||||
CFLAGS+= -I$(CODEDIR)/BaseLib2/LoggerService
|
||||
CFLAGS+= -I$(DRIVERDIR)/include
|
||||
|
||||
all: $(OBJS) $(SUBPROJ) $(TARGET)/ATCAadcDrv$(GAMEXT) \
|
||||
$(TARGET)/driver_test$(EXEEXT)
|
||||
echo $(OBJS)
|
||||
|
||||
include depends.$(TARGET)
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#*******************************************************************************
|
||||
#
|
||||
# $Log: Makefile.linux,v $
|
||||
# Revision 1.1 2008/06/05 13:18:58 rvitelli
|
||||
# Skeleton of Drv files and makefiles
|
||||
#
|
||||
#
|
||||
#*******************************************************************************/
|
||||
|
||||
TARGET=linux
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L$(CODEDIR)/BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L$(CODEDIR)/MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses
|
||||
|
||||
OPTIM=
|
||||
|
||||
19
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/Makefile.msc
Normal file
19
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/Makefile.msc
Normal file
@@ -0,0 +1,19 @@
|
||||
#*******************************************************************************
|
||||
#
|
||||
# $Log: Makefile.msc,v $
|
||||
# Revision 1.3 2009/05/01 15:08:33 fisa
|
||||
# do not compile!
|
||||
#
|
||||
# Revision 1.2 2008/11/27 15:47:13 lzabeo
|
||||
# *** empty log message ***
|
||||
#
|
||||
# Revision 1.1 2008/08/27 16:32:14 fisa
|
||||
# *** empty log message ***
|
||||
#
|
||||
#*******************************************************************************/
|
||||
|
||||
TARGET=msc
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
18
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/Makefile.rtai
Normal file
18
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/Makefile.rtai
Normal file
@@ -0,0 +1,18 @@
|
||||
#*******************************************************************************
|
||||
#
|
||||
# $Log: Makefile.rtai,v $
|
||||
# Revision 1.2 2008/08/01 14:10:09 rvitelli
|
||||
# *** empty log message ***
|
||||
#
|
||||
# Revision 1.1 2008/06/05 13:18:58 rvitelli
|
||||
# Skeleton of Drv files and makefiles
|
||||
#
|
||||
#
|
||||
#*******************************************************************************/
|
||||
|
||||
TARGET=rtai
|
||||
|
||||
OBJSRTAI=ATCAadcDrv.x driver_test.x
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# CODASLib library
|
||||
# $Id: Makefile.vx5100,v 1.1 2009/01/07 13:48:11 aneto Exp $
|
||||
#
|
||||
#******************************************************************************
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
|
||||
213
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/depends.linux
Normal file
213
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/depends.linux
Normal file
@@ -0,0 +1,213 @@
|
||||
linux/ATCAadcDrv.o: ATCAadcDrv.cpp ATCAadcDrv.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc_ioctl.h \
|
||||
/opt/MARTe/GAMs/WebStatisticGAM/WebStatisticGAM.h \
|
||||
/opt/MARTe/BaseLib2/Level5/GAM.h /opt/MARTe/BaseLib2/Level3/CDB.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNodeRef.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNode.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level5/DDBDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Console.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicConsole.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageEnvelope.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level5/Message.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageCode.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MDRFlags.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MuxLock.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageHandler.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageQueue.h \
|
||||
/opt/MARTe/BaseLib2/Level2/SXMemory.h /opt/MARTe/BaseLib2/Level0/Sleep.h
|
||||
linux/driver_test.o: driver_test.cpp /opt/MARTe/BaseLib2/Level2/Console.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/HRT.h /opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicConsole.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
ATCAadcDrv.h /opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc_ioctl.h \
|
||||
/opt/MARTe/GAMs/WebStatisticGAM/WebStatisticGAM.h \
|
||||
/opt/MARTe/BaseLib2/Level5/GAM.h /opt/MARTe/BaseLib2/Level3/CDB.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNodeRef.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNode.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level5/DDBDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageEnvelope.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level5/Message.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageCode.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MDRFlags.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MuxLock.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageHandler.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageQueue.h \
|
||||
/opt/MARTe/BaseLib2/Level2/SXMemory.h \
|
||||
/opt/MARTe/BaseLib2/LoggerService/LoggerService.h \
|
||||
/opt/MARTe/BaseLib2/Level2/File.h /opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h
|
||||
213
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/dependsRaw.linux
Normal file
213
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/dependsRaw.linux
Normal file
@@ -0,0 +1,213 @@
|
||||
ATCAadcDrv.o: ATCAadcDrv.cpp ATCAadcDrv.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc_ioctl.h \
|
||||
/opt/MARTe/GAMs/WebStatisticGAM/WebStatisticGAM.h \
|
||||
/opt/MARTe/BaseLib2/Level5/GAM.h /opt/MARTe/BaseLib2/Level3/CDB.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNodeRef.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNode.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level5/DDBDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Console.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicConsole.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageEnvelope.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level5/Message.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageCode.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MDRFlags.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MuxLock.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageHandler.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageQueue.h \
|
||||
/opt/MARTe/BaseLib2/Level2/SXMemory.h /opt/MARTe/BaseLib2/Level0/Sleep.h
|
||||
driver_test.o: driver_test.cpp /opt/MARTe/BaseLib2/Level2/Console.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/HRT.h /opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicConsole.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
ATCAadcDrv.h /opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc.h \
|
||||
/opt/drivers/ATCA-MIMO/include/pcieAdc_ioctl.h \
|
||||
/opt/MARTe/GAMs/WebStatisticGAM/WebStatisticGAM.h \
|
||||
/opt/MARTe/BaseLib2/Level5/GAM.h /opt/MARTe/BaseLib2/Level3/CDB.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNodeRef.h \
|
||||
/opt/MARTe/BaseLib2/Level3/CDBNode.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level5/DDBDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageEnvelope.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level5/Message.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageCode.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MDRFlags.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MuxLock.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageHandler.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MessageQueue.h \
|
||||
/opt/MARTe/BaseLib2/Level2/SXMemory.h \
|
||||
/opt/MARTe/BaseLib2/LoggerService/LoggerService.h \
|
||||
/opt/MARTe/BaseLib2/Level2/File.h /opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level5/MenuContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h
|
||||
267
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/driver_test.cpp
Normal file
267
epics/css/sys-mng-opi/CSS/MARTe/IOGAMs/ATCAadc/driver_test.cpp
Normal file
@@ -0,0 +1,267 @@
|
||||
//******************************************************************************
|
||||
// MARTe Library
|
||||
// $Log: driver_test.cpp,v $
|
||||
// Revision 1.17 2009/03/31 08:11:37 aneto
|
||||
// Support for multiple input
|
||||
//
|
||||
// Revision 1.16 2009/01/26 09:20:38 aneto
|
||||
// linux support
|
||||
//
|
||||
// Revision 1.15 2008/08/01 16:29:13 rvitelli
|
||||
// trigger
|
||||
//
|
||||
// Revision 1.14 2008/08/01 14:09:26 rvitelli
|
||||
// First working version
|
||||
//
|
||||
// Revision 1.13 2008/06/19 10:15:46 rvitelli
|
||||
// Lowered sleep between GetData calls to allow execution of LongSleeps. Probably a problem due to execution of mod_writer and driver_test on the same processor.
|
||||
//
|
||||
// Revision 1.12 2008/06/19 07:22:49 rvitelli
|
||||
// Added std_dev
|
||||
//
|
||||
// Revision 1.11 2008/06/18 17:19:04 rvitelli
|
||||
// Optimization.
|
||||
//
|
||||
// Revision 1.10 2008/06/18 17:06:36 rvitelli
|
||||
// Added variance statistic.
|
||||
//
|
||||
// Revision 1.9 2008/06/18 16:49:21 rvitelli
|
||||
// Minor bug.
|
||||
//******************************************************************************
|
||||
|
||||
#include "Console.h"
|
||||
#include "Sleep.h"
|
||||
#include "ATCAadcDrv.h"
|
||||
#include "Threads.h"
|
||||
#include "LoggerService.h"
|
||||
#include "File.h"
|
||||
#include "SXMemory.h"
|
||||
#include "ConfigurationDataBase.h"
|
||||
#include "GCReferenceContainer.h"
|
||||
#include "GlobalObjectDataBase.h"
|
||||
#include "MenuContainer.h"
|
||||
#include "ProcessorType.h"
|
||||
|
||||
const char *cdbMap=
|
||||
"+ATCA_DRIVER={\n"
|
||||
" Class = ATCAadcDrv\n"
|
||||
" Title = \"ATCA Driver test\" \n"
|
||||
" SoftTrigger=1\n"
|
||||
" NumberOfOutputs=8\n"
|
||||
" NumberOfInputs=64\n"
|
||||
" ExtTriggerAndClock=1\n"
|
||||
"}\n"
|
||||
"+MENUS={"
|
||||
" Class = MenuContainer\n"
|
||||
" Title = \"ATCA ADC Driver Test\" \n"
|
||||
" +START_ACK_MENU={\n"
|
||||
" Class = MenuEntry\n"
|
||||
" Title = \"Start Acquisition\"\n"
|
||||
" }\n"
|
||||
" +STOP_ACK_MENU={\n"
|
||||
" Class = MenuEntry\n"
|
||||
" Title = \"Stop Acquisition\"\n"
|
||||
" }\n"
|
||||
" +SAVE_DATA_MENU={\n"
|
||||
" Class = MenuEntry\n"
|
||||
" Title = \"Save acquired data\"\n"
|
||||
" }\n"
|
||||
" +PRINT_DATA_MENU={\n"
|
||||
" Class = MenuEntry\n"
|
||||
" Title = \"Print last buffer\"\n"
|
||||
" }\n"
|
||||
"}";
|
||||
|
||||
volatile int keepAlive = 0;
|
||||
int64 max_timer = 0;
|
||||
float mean_exec_time = 0;
|
||||
float meansquare_exec_time = 0;
|
||||
float variance_exec_time = 0;
|
||||
|
||||
const int32 BUFFER_BOARD_TRF_SIZE = 33 + 2 * HEADER_LENGTH;
|
||||
const int32 MAX_SAMPLES_TO_SAVE = 100;
|
||||
|
||||
int32 buffer[70];
|
||||
uint32 outputBuffer[3];
|
||||
uint32 dataBrd1[BUFFER_BOARD_TRF_SIZE * MAX_SAMPLES_TO_SAVE];
|
||||
int32 dataBrd2[BUFFER_BOARD_TRF_SIZE * MAX_SAMPLES_TO_SAVE];
|
||||
|
||||
int32 printLastBuffer = 0;
|
||||
|
||||
GCRTemplate<GenericAcqModule> driver;
|
||||
|
||||
void __thread_decl acquisitionThread(void *ptr){
|
||||
int k = 0;
|
||||
int64 timer = 0;
|
||||
int64 timer_after = 0;
|
||||
int ret = 0;
|
||||
|
||||
max_timer = 0;
|
||||
mean_exec_time = 0;
|
||||
meansquare_exec_time = 0;
|
||||
variance_exec_time = 0;
|
||||
|
||||
driver->EnableAcquisition();
|
||||
|
||||
int triggerReceived = 0;
|
||||
memset(buffer, 0, BUFFER_BOARD_TRF_SIZE * sizeof(int32));
|
||||
memset(dataBrd1, 0, BUFFER_BOARD_TRF_SIZE * MAX_SAMPLES_TO_SAVE * sizeof(int32));
|
||||
memset(dataBrd2, 0, BUFFER_BOARD_TRF_SIZE * MAX_SAMPLES_TO_SAVE * sizeof(int32));
|
||||
//Console con;
|
||||
printf("Starting\n");
|
||||
while (keepAlive != 0){
|
||||
timer = HRT::HRTCounter();
|
||||
SleepSec(10E-6);
|
||||
ret = driver->GetData(0, buffer);
|
||||
|
||||
printf("Time: [%d], k = %d, BUFFER_BOARD_TRF_SIZE = %d!\n", dataBrd1[0], k, BUFFER_BOARD_TRF_SIZE);
|
||||
printf("Time End = %d, Status = %d\n", dataBrd1[BUFFER_BOARD_TRF_SIZE - 1], dataBrd1[BUFFER_BOARD_TRF_SIZE - 2]);
|
||||
|
||||
|
||||
if(dataBrd1[0] == 0 && k > 5){
|
||||
triggerReceived = 1;
|
||||
k = 0;
|
||||
max_timer = 0;
|
||||
mean_exec_time = 0;
|
||||
meansquare_exec_time = 0;
|
||||
variance_exec_time = 0;
|
||||
printf("Trigger received!\n");
|
||||
|
||||
}
|
||||
|
||||
if(printLastBuffer > 0){
|
||||
printf("H[%d] = %d F[%d] = %d\n", k, 0, k, dataBrd1[BUFFER_BOARD_TRF_SIZE - 1]);
|
||||
printLastBuffer = 0;
|
||||
}
|
||||
|
||||
if(triggerReceived == 1 && k < MAX_SAMPLES_TO_SAVE){
|
||||
for(int j=0; j<BUFFER_BOARD_TRF_SIZE; j++){
|
||||
dataBrd1[BUFFER_BOARD_TRF_SIZE * k + j] = buffer[j];
|
||||
dataBrd2[BUFFER_BOARD_TRF_SIZE * k + j] = buffer[BUFFER_BOARD_TRF_SIZE + j];
|
||||
}
|
||||
//dataBrd1[BUFFER_BOARD_TRF_SIZE * k] = ret * HRT::HRT::HRTPeriod() * 1000000;//buffer[0];
|
||||
}
|
||||
|
||||
outputBuffer[0] = 0;
|
||||
outputBuffer[1] = 7;
|
||||
outputBuffer[2] += 10;
|
||||
driver->WriteData(0, (int32 *)outputBuffer);
|
||||
|
||||
timer_after = HRT::HRTCounter();
|
||||
if ( (timer_after - timer) > max_timer) {
|
||||
max_timer = timer_after - timer;
|
||||
}
|
||||
mean_exec_time += (float)(timer_after - timer);
|
||||
meansquare_exec_time += (float)((timer_after - timer)*(timer_after - timer));
|
||||
k++;
|
||||
}
|
||||
driver->DisableAcquisition();
|
||||
mean_exec_time /= k;
|
||||
variance_exec_time = ( (meansquare_exec_time - max_timer*max_timer)/k - mean_exec_time*mean_exec_time);
|
||||
keepAlive = 1;
|
||||
}
|
||||
|
||||
bool StartAcquisition(StreamInterface &in,StreamInterface &out,void *userData){
|
||||
if(keepAlive != 0){
|
||||
out.Printf("Acquisition already started\n");
|
||||
return False;
|
||||
}
|
||||
keepAlive = 1;
|
||||
ProcessorType runCore(0x8);
|
||||
Threads::BeginThread(acquisitionThread, NULL, THREADS_DEFAULT_STACKSIZE, NULL, XH_NotHandled, runCore);
|
||||
return True;
|
||||
}
|
||||
|
||||
bool StopAcquisition(StreamInterface &in,StreamInterface &out,void *userData){
|
||||
if(keepAlive == 0){
|
||||
out.Printf("Acquisition already stopped\n");
|
||||
return False;
|
||||
}
|
||||
|
||||
out.Printf("Stopping acquisition\n");
|
||||
keepAlive = 0;
|
||||
while(keepAlive != 1){
|
||||
SleepSec(1.0);
|
||||
}
|
||||
keepAlive = 0;
|
||||
out.Printf("Acquisition stopped\n");
|
||||
out.Printf("\nmax_timer = %f\n", max_timer*HRT::HRTPeriod()*1000000);
|
||||
out.Printf("mean_exec_time = %f\n", mean_exec_time*HRT::HRTPeriod()*1000000);
|
||||
out.Printf("dev_std_exec_time = %f\n", sqrt(variance_exec_time)*HRT::HRTPeriod()*1000000);
|
||||
out.Printf("max_error = %f\n", (max_timer-mean_exec_time)*HRT::HRTPeriod()*1000000);
|
||||
}
|
||||
|
||||
bool SaveData(StreamInterface &in,StreamInterface &out,void *userData){
|
||||
out.Printf("Saving Data\n");
|
||||
File outputFile;
|
||||
FString dataDump;
|
||||
FString filename;
|
||||
FString dataDump2;
|
||||
dataDump.SetSize(BUFFER_BOARD_TRF_SIZE * MAX_SAMPLES_TO_SAVE);
|
||||
dataDump2.SetSize(BUFFER_BOARD_TRF_SIZE * MAX_SAMPLES_TO_SAVE);
|
||||
out.Printf("Printing in FString\n");
|
||||
for(int k=0; k<MAX_SAMPLES_TO_SAVE; k++){
|
||||
for(int j=0; j<BUFFER_BOARD_TRF_SIZE; j++){
|
||||
dataDump.Printf("%d ", dataBrd1[BUFFER_BOARD_TRF_SIZE * k + j]);
|
||||
dataDump2.Printf("%d ", dataBrd2[BUFFER_BOARD_TRF_SIZE * k + j]);
|
||||
}
|
||||
dataDump.Printf("\n");
|
||||
dataDump2.Printf("\n");
|
||||
}
|
||||
|
||||
out.Printf("Printing in File\n");
|
||||
filename.Printf("data_%d.dump", time(NULL));
|
||||
outputFile.OpenNew(filename.Buffer());
|
||||
outputFile.Printf("%s", dataDump.Buffer());
|
||||
outputFile.Close();
|
||||
out.Printf("Data for board 1 saved at %s\n", filename.Buffer());
|
||||
filename.SetSize(0);
|
||||
filename.Printf("data2_%d.dump", time(NULL));
|
||||
outputFile.OpenNew(filename.Buffer());
|
||||
outputFile.Printf("%s", dataDump2.Buffer());
|
||||
outputFile.Close();
|
||||
out.Printf("Data for board 2 saved at %s\n", filename.Buffer());
|
||||
}
|
||||
|
||||
bool PrintLastBuffer(StreamInterface &in,StreamInterface &out,void *userData){
|
||||
printLastBuffer = 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
LSSetUserAssembleErrorMessageFunction(LSAssembleErrorMessage);
|
||||
LSSetRemoteLogger("localhost",32767);
|
||||
LSStartService();
|
||||
|
||||
SXMemory config((char *)cdbMap,strlen(cdbMap));
|
||||
ConfigurationDataBase cdb;
|
||||
if (!cdb->ReadFromStream(config,NULL)){
|
||||
CStaticAssertErrorCondition(ParametersError,"Init: cdb.ReadFromStream failed");
|
||||
return -1;
|
||||
}
|
||||
GCRTemplate<GCReferenceContainer> godb = GetGlobalObjectDataBase();
|
||||
godb->ObjectLoadSetup(cdb,NULL);
|
||||
|
||||
GCRTemplate<MenuContainer> mc;
|
||||
mc = godb->Find("MENUS");
|
||||
if (!mc.IsValid()){
|
||||
CStaticAssertErrorCondition(FatalError,"cannot find MENUS MenuContainer object\n");
|
||||
return -2;
|
||||
}
|
||||
driver = godb->Find("ATCA_DRIVER");
|
||||
if (!driver.IsValid()){
|
||||
CStaticAssertErrorCondition(FatalError,"cannot find ATCA_DRIVER MenuContainer object\n");
|
||||
return -2;
|
||||
}
|
||||
Console con(PerformCharacterInput);
|
||||
con.SetPaging(True);
|
||||
|
||||
mc->SetupItem("START_ACK_MENU", StartAcquisition, NULL, NULL, NULL);
|
||||
mc->SetupItem("STOP_ACK_MENU", StopAcquisition, NULL, NULL, NULL);
|
||||
mc->SetupItem("SAVE_DATA_MENU", SaveData, NULL, NULL, NULL);
|
||||
mc->SetupItem("PRINT_LAST_BUFFER", PrintLastBuffer, NULL, NULL, NULL);
|
||||
|
||||
mc->TextMenu(con,con);
|
||||
// LSStopService();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#############################################################
|
||||
#Start-up script for the MARTe
|
||||
#!/bin/sh
|
||||
|
||||
target=`uname`
|
||||
case ${target} in
|
||||
Darwin)
|
||||
TARGET=macosx
|
||||
;;
|
||||
SunOS)
|
||||
TARGET=solaris
|
||||
;;
|
||||
*)
|
||||
TARGET=linux
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Target is $TARGET"
|
||||
|
||||
BASEDIR=/opt/MARTe
|
||||
|
||||
CODE_DIRECTORY=$BASEDIR
|
||||
LD_LIBRARY_PATH=.:$CODE_DIRECTORY/BaseLib2/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/MARTe/MARTeSupportLib/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/LinuxTimer/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/GenericTimerDriver/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/StreamingDriver/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PIDGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaterTank/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaveformGenerator2009/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WebStatisticGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/DataCollectionGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/EPICSGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PlottingGAM/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/SignalHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/MATLABHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/FlotPlot/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./${TARGET}/
|
||||
|
||||
if [ ${TARGET} == "macosx" ]; then
|
||||
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH
|
||||
echo $DYLD_LIBRARY_PATH
|
||||
else
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
echo $LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
./${TARGET}/driver_test.ex
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
*
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
will be approved by the European Commission - subsequent
|
||||
versions of the EUPL (the "Licence");
|
||||
* You may not use this work except in compliance with the
|
||||
Licence.
|
||||
* You may obtain a copy of the Licence at:
|
||||
*
|
||||
* http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* Unless required by applicable law or agreed to in
|
||||
writing, software distributed under the Licence is
|
||||
distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied.
|
||||
* See the Licence for the specific language governing
|
||||
permissions and limitations under the Licence.
|
||||
*
|
||||
* $Id: BinaryFileReader.cpp 3 2012-01-15 16:26:07Z aneto $
|
||||
*
|
||||
**/
|
||||
|
||||
#include "BinaryFileReader.h"
|
||||
#include "GlobalObjectDataBase.h"
|
||||
|
||||
bool BinaryFileReader::ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err){
|
||||
AssertErrorCondition(Information, "BinaryFileReader::ObjectLoadSetup: %s Loading signals", Name());
|
||||
|
||||
CDBExtended cdb(info);
|
||||
|
||||
if(!GenericAcqModule::ObjectLoadSetup(info,err)){
|
||||
AssertErrorCondition(InitialisationError,"BinaryFileReader::ObjectLoadSetup: %s GenericAcqModule::ObjectLoadSetup Failed",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
numberOfInputs = NumberOfInputs();
|
||||
|
||||
printf("NumberOfInputs() = %d\n", numberOfInputs);
|
||||
|
||||
|
||||
|
||||
if(!cdb.ReadUint32(dataSize, "DataSize")){
|
||||
AssertErrorCondition(InitialisationError,"%s %s::Initialise: data_size is not specified.", IOGAM_MODULE, Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
AssertErrorCondition(Information,"%s %s::Initialise: data_size: %d", IOGAM_MODULE, Name(), dataSize);
|
||||
|
||||
if(dataSize%sizeof(uint32) != 0){
|
||||
AssertErrorCondition(InitialisationError,"%s %s::Initialise: data_size is not valid. Must be a %zu multiple.", IOGAM_MODULE, Name(), sizeof(uint32));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("memory alloc (sizeof(uint32)*numberOfInputs) = %zu\n", sizeof(uint32)*numberOfInputs);
|
||||
printf("memory alloc (sizeof(char)*dataSize) = %zu\n", sizeof(char)*dataSize);
|
||||
|
||||
fileData = (char *) calloc(dataSize, sizeof(char));
|
||||
if (!fileData)
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"%s %s::Initialise: Not enough memory for file_data with size %zu", IOGAM_MODULE, Name(), dataSize);
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertErrorCondition(Information,"%s %s::Initialise: Memory allocated for file_data: %zu bytes", IOGAM_MODULE, Name(), dataSize);
|
||||
}
|
||||
|
||||
|
||||
if(!cdb.ReadFString(fileName, "FileName")){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s FilePath must be specified.",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!f.OpenRead(fileName.Buffer())){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s failed to open file: %s", Name(), fileName.Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
uint32 fileSize = f.Size();
|
||||
|
||||
if(fileSize != dataSize){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s size [%d] is diferent from configured %d", Name(), fileSize, dataSize);
|
||||
//return False;
|
||||
}
|
||||
|
||||
f.Seek(SEEK_SET);
|
||||
bool k = f.Read(fileData, fileSize);
|
||||
|
||||
if(k == 0){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s failed read data from file: %s", Name(), fileName.Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetData
|
||||
*/
|
||||
int32 BinaryFileReader::GetData(uint32 usecTime, int32 *ibuffer, int32 bufferNumber){
|
||||
int32 i = 0;
|
||||
char *buffer = (char *)ibuffer;
|
||||
int value = 1234;
|
||||
|
||||
/*
|
||||
f.Seek(SEEK_SET);
|
||||
bool k = f.Read(fileData, dataSize);
|
||||
*/
|
||||
|
||||
memcpy(buffer, fileData, numberOfInputs*sizeof(char));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
OBJECTLOADREGISTER(BinaryFileReader,"$Id: BinaryFileReader.cpp 3 2012-01-15 16:26:07Z aneto $")
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
*
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
will be approved by the European Commission - subsequent
|
||||
versions of the EUPL (the "Licence");
|
||||
* You may not use this work except in compliance with the
|
||||
Licence.
|
||||
* You may obtain a copy of the Licence at:
|
||||
*
|
||||
* http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* Unless required by applicable law or agreed to in
|
||||
writing, software distributed under the Licence is
|
||||
distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied.
|
||||
* See the Licence for the specific language governing
|
||||
permissions and limitations under the Licence.
|
||||
*
|
||||
* $Id: BinaryFileReader.h 3 2012-01-15 16:26:07Z aneto $
|
||||
*
|
||||
**/
|
||||
|
||||
#if !defined (BINARY_FILE_READER)
|
||||
#define BINARY_FILE_READER
|
||||
|
||||
#include "System.h"
|
||||
#include "GenericAcqModule.h"
|
||||
#include "File.h"
|
||||
#include "ConfigurationDataBase.h"
|
||||
#include "CDBExtended.h"
|
||||
|
||||
class DDBInputInterface;
|
||||
class DDBOutputInterface;
|
||||
|
||||
#define IOGAM_MODULE "BinaryFileReader"
|
||||
|
||||
OBJECT_DLL(BinaryFileReader)
|
||||
class BinaryFileReader: public GenericAcqModule{
|
||||
OBJECT_DLL_STUFF(BinaryFileReader)
|
||||
|
||||
private:
|
||||
|
||||
File f;
|
||||
/**
|
||||
* Cycle Number
|
||||
*/
|
||||
int64 cycleNumber;
|
||||
uint32 dataSize;
|
||||
uint32 numberOfInputs;
|
||||
|
||||
/** Output interface to write data to */
|
||||
DDBInputInterface *input;
|
||||
|
||||
/**
|
||||
* Number of signals
|
||||
*/
|
||||
uint32 numberOfSignals;
|
||||
|
||||
/**
|
||||
* Double array with signals
|
||||
*/
|
||||
char ** signals;
|
||||
/**
|
||||
* File Names. For each Channel
|
||||
*/
|
||||
FString fileName_usecTime;
|
||||
FString fileName_Ch1;
|
||||
|
||||
|
||||
public:
|
||||
BinaryFileReader(){
|
||||
cycleNumber = 0;
|
||||
}
|
||||
|
||||
virtual ~BinaryFileReader(){
|
||||
delete [] fileData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the internal counters
|
||||
*/
|
||||
bool PulseStart(){
|
||||
cycleNumber = 0;
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets Data From the Module to the DDB
|
||||
* @param usecTime Microseconds Time
|
||||
* @return -1 on Error, 1 on success
|
||||
*/
|
||||
int32 GetData(uint32 usecTime, int32 *buffer, int32 bufferNumber = 0);
|
||||
|
||||
/**
|
||||
* Load and configure object parameters
|
||||
* @param info the configuration database
|
||||
* @param err the error stream
|
||||
* @return True if no errors are found during object configuration
|
||||
*/
|
||||
bool ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err);
|
||||
|
||||
/**
|
||||
* NOOP
|
||||
*/
|
||||
bool ObjectDescription(StreamInterface &s,bool full,StreamInterface *er){
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOOP
|
||||
*/
|
||||
bool SetInputBoardInUse(bool on){
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOOP
|
||||
*/
|
||||
bool SetOutputBoardInUse(bool on){
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
*/
|
||||
bool WriteData(uint32 usecTime, const int32* buffer){
|
||||
AssertErrorCondition(FatalError, "%s: WriteData not supported", Name());
|
||||
return False;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,634 @@
|
||||
Version = "$Id: MARTe-fileread.cfg,v 1.1 2011/04/06 11:30:36 aneto Exp $"
|
||||
LoggerAddress = "localhost"
|
||||
DefaultCPUs = 8
|
||||
+WEB = {
|
||||
Class = HttpGroupResource
|
||||
+BROWSE = {
|
||||
Title = "Http Object Browser"
|
||||
Class = HttpGCRCBrowser
|
||||
AddReference = {MARTe StateMachine OBJBROWSE THRBROWSE CFGUpload MATLABSupport}
|
||||
}
|
||||
}
|
||||
+HTTPSERVER = {
|
||||
Class = HttpService
|
||||
Port = 8084
|
||||
HttpRelayURL = "ignore.me:1234"
|
||||
VerboseLevel = 10
|
||||
Root = WEB
|
||||
}
|
||||
+OBJBROWSE = {
|
||||
Class = HttpClassListResource
|
||||
}
|
||||
+THRBROWSE = {
|
||||
Class = HttpThreadListResource
|
||||
}
|
||||
+MATLABSupport = {
|
||||
Class = MATLABHandler
|
||||
}
|
||||
+CFGUpload = {
|
||||
Class = CFGUploader
|
||||
}
|
||||
+StateMachine = {
|
||||
Class = StateMachine
|
||||
VerboseLevel = 10
|
||||
+INITIAL = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x0
|
||||
+START = {
|
||||
Class = StateMachineEvent
|
||||
NextState = IDLE
|
||||
Value = START
|
||||
+STARTALL = {
|
||||
Class = MessageDeliveryRequest
|
||||
Sender = StateMachine
|
||||
Destinations = "HTTPSERVER MARTe"
|
||||
MsecTimeOut = 1000
|
||||
Flags = NoReply
|
||||
Message = {
|
||||
Class = Message
|
||||
Content = START
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+IDLE = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x500
|
||||
+PULSE_SETUP_COMPLETED = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x701
|
||||
NextState = WAITING_FOR_PRE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = MARTe
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = PREPULSECHECK
|
||||
}
|
||||
}
|
||||
+UPDATE_GAP = {
|
||||
Class = MessageEnvelope
|
||||
Destination = MATLABSupport
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = AUTODETECT
|
||||
}
|
||||
}
|
||||
}
|
||||
+INHIBIT = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x704
|
||||
NextState = INHIBIT
|
||||
}
|
||||
+ACTIVATE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x705
|
||||
NextState = SAMESTATE
|
||||
}
|
||||
+UNRECOVERABLE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x776
|
||||
NextState = UNRECOVERABLE
|
||||
}
|
||||
+CONFIG_ERROR = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x777
|
||||
NextState = CONFIG_ERROR
|
||||
}
|
||||
+CONFIG_OK = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x778
|
||||
NextState = SAMESTATE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = CODAS.SMH
|
||||
+SENDSTATE = {
|
||||
Class = Message
|
||||
Code = 0x500
|
||||
}
|
||||
}
|
||||
}
|
||||
+STOP = {
|
||||
Class = StateMachineEvent
|
||||
NextState = IDLE
|
||||
Value = STOP
|
||||
Code = 0x005
|
||||
+STOPALL = {
|
||||
Class = MessageDeliveryRequest
|
||||
Sender = StateMachine
|
||||
Destinations = "HTTPSERVER MARTe"
|
||||
MsecTimeOut = 1000
|
||||
Flags = NoReply
|
||||
Message = {
|
||||
Class = Message
|
||||
Content = STOP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+WAITING_FOR_PRE = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x504
|
||||
+PRE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x708
|
||||
NextState = PULSING
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = MARTe
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = PULSESTART
|
||||
}
|
||||
}
|
||||
}
|
||||
+ABORT = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x702
|
||||
NextState = IDLE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = MARTe
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = PULSESTOP
|
||||
}
|
||||
}
|
||||
}
|
||||
+COLLECTION_COMPLETED = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x703
|
||||
NextState = COMM_ERROR
|
||||
}
|
||||
}
|
||||
+PULSING = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x505
|
||||
+ENTER = {
|
||||
Class = MessageEnvelope
|
||||
Destination = CODAS.SMH
|
||||
+SENDSTATE = {
|
||||
Class = Message
|
||||
}
|
||||
}
|
||||
+ABORT = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x702
|
||||
NextState = IDLE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = MARTe
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = PULSESTOP
|
||||
}
|
||||
}
|
||||
}
|
||||
+EJP = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x709
|
||||
NextState = POST_PULSE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = MARTe
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = PULSESTOP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+POST_PULSE = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x507
|
||||
+ENTER = {
|
||||
Class = MessageEnvelope
|
||||
Destination = CODAS.SMH
|
||||
+SENDSTATE = {
|
||||
Class = Message
|
||||
}
|
||||
}
|
||||
+COLLECTION_COMPLETED = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x703
|
||||
NextState = IDLE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = MARTe
|
||||
+MESSAGE = {
|
||||
Class = Message
|
||||
Content = COLLECTIONCOMPLETED
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+INHIBIT = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x508
|
||||
+ACTIVATE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x705
|
||||
NextState = IDLE
|
||||
}
|
||||
}
|
||||
+ERROR = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x601
|
||||
+ACTIVATE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x705
|
||||
NextState = IDLE
|
||||
}
|
||||
+COLLECTION_COMPLETED = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x703
|
||||
NextState = IDLE
|
||||
}
|
||||
}
|
||||
+CONFIG_ERROR = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x601
|
||||
+ENTER = {
|
||||
Class = MessageEnvelope
|
||||
Destination = CODAS.SMH
|
||||
+SENDSTATE = {
|
||||
Class = Message
|
||||
}
|
||||
}
|
||||
+ACTIVATE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x705
|
||||
NextState = IDLE
|
||||
}
|
||||
+CONFIG_OK = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x778
|
||||
NextState = IDLE
|
||||
+NOTIFY = {
|
||||
Class = MessageEnvelope
|
||||
Sender = StateMachine
|
||||
Destination = CODAS.SMH
|
||||
+SENDSTATE = {
|
||||
Class = Message
|
||||
Code = 0x500
|
||||
}
|
||||
}
|
||||
}
|
||||
+CONFIG_ERROR = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x777
|
||||
NextState = CONFIG_ERROR
|
||||
}
|
||||
}
|
||||
+UNRECOVERABLE = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x601
|
||||
+DEFAULT = {
|
||||
Class = StateMachineEvent
|
||||
UserCode = 0
|
||||
NextState = UNRECOVERABLE
|
||||
}
|
||||
}
|
||||
+COMM_ERROR = {
|
||||
StateCode = 0x601
|
||||
Class = StateMachineState
|
||||
+ABORT = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x702
|
||||
NextState = SAMESTATE
|
||||
}
|
||||
}
|
||||
+DEFAULT = {
|
||||
Class = StateMachineState
|
||||
StateCode = 0x601
|
||||
+ABORT = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x702
|
||||
NextState = IDLE
|
||||
}
|
||||
+PRE = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x708
|
||||
NextState = SAMESTATE
|
||||
}
|
||||
+EJP = {
|
||||
Class = StateMachineEvent
|
||||
Code = 0x709
|
||||
NextState = SAMESTATE
|
||||
}
|
||||
}
|
||||
}
|
||||
+MARTeMenu = {
|
||||
Class = MARTeSupLib::MARTeMenu
|
||||
Title = "MARTe Menu"
|
||||
+MenuA = {
|
||||
Class = MenuContainer
|
||||
Title = "CODAS Interface"
|
||||
+ABORT = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = Abort
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x702
|
||||
Content = ABORT
|
||||
}
|
||||
}
|
||||
}
|
||||
+INHIBIT = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = Inhibit
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x704
|
||||
Content = Inhibit
|
||||
}
|
||||
}
|
||||
}
|
||||
+ACTIVATE = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = Activate
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x705
|
||||
Content = Activate
|
||||
}
|
||||
}
|
||||
}
|
||||
+PULSESETUPCOMPLETE = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = "Pulse Setup Conplete"
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x701
|
||||
Content = WAITING_FOR_PRE
|
||||
}
|
||||
}
|
||||
}
|
||||
+PRE = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = "Pulse Start"
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x708
|
||||
Content = PRE
|
||||
}
|
||||
}
|
||||
}
|
||||
+EJP = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = "Pulse End"
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x709
|
||||
Content = EJP
|
||||
}
|
||||
}
|
||||
}
|
||||
+COLLECTIONCOMPLETED = {
|
||||
Class = SendMessageMenuEntry
|
||||
Title = "Collection Completed"
|
||||
Envelope = {
|
||||
Class = MessageEnvelope
|
||||
Sender = MARTeMenu
|
||||
Destination = StateMachine
|
||||
+Message = {
|
||||
Class = Message
|
||||
Code = 0x703
|
||||
Content = POSTPULSE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AddReference = MARTe.MARTe
|
||||
}
|
||||
+MARTe = {
|
||||
Class = MARTeContainer
|
||||
StateMachineName = StateMachine
|
||||
Level1Name = LEVEL1
|
||||
MenuContainerName = MARTe
|
||||
+MARTe = {
|
||||
Class = MenuContainer
|
||||
}
|
||||
+DriverPool = {
|
||||
Class = GCReferenceContainer
|
||||
+TimerBoard = {
|
||||
Class = LinuxTimerDrv
|
||||
NumberOfInputs = 2
|
||||
NumberOfOutputs = 0
|
||||
TimerPeriodUsec = 1000
|
||||
SynchronizationMethod = Synchronizing
|
||||
RunOnCPU = 4
|
||||
}
|
||||
+FileReader = {
|
||||
Class = BinaryFileReader
|
||||
//NumberOfInputs = 47608990
|
||||
NumberOfInputs = 40000000
|
||||
DataSize = 190435960
|
||||
FileName = "../../../cplusplus/compression/data/90653/1.bin"
|
||||
}
|
||||
}
|
||||
+Messages = {
|
||||
Class = GCReferenceContainer
|
||||
+FatalErrorMessage = {
|
||||
Class = MessageDeliveryRequest
|
||||
Destinations = StateMachine
|
||||
MsecTimeOut = 1000
|
||||
Flags = NoReply
|
||||
Message = {
|
||||
Class = Message
|
||||
Code = 0x776
|
||||
Content = UNRECOVERABLE
|
||||
}
|
||||
}
|
||||
+ConfigLoadErrorMessage = {
|
||||
Class = MessageDeliveryRequest
|
||||
Destinations = StateMachine
|
||||
MsecTimeOut = 1000
|
||||
Flags = NoReply
|
||||
Message = {
|
||||
Class = Message
|
||||
Code = 0x777
|
||||
Content = CONFIG_ERROR
|
||||
}
|
||||
}
|
||||
+ConfigLoadOKMessage = {
|
||||
Class = MessageDeliveryRequest
|
||||
Destinations = StateMachine
|
||||
MsecTimeOut = 1000
|
||||
Flags = NoReply
|
||||
Message = {
|
||||
Class = Message
|
||||
Code = 0x778
|
||||
Content = CONFIG_OK
|
||||
}
|
||||
}
|
||||
+SafetyErrorMessage = {
|
||||
Class = MessageDeliveryRequest
|
||||
Destinations = MARTe
|
||||
MsecTimeOut = 1000
|
||||
Flags = NoReply
|
||||
Message = {
|
||||
Class = Message
|
||||
Content = ERROR
|
||||
}
|
||||
}
|
||||
}
|
||||
+ExternalTimeTriggeringService = {
|
||||
Class = InterruptDrivenTTS
|
||||
TsOnlineUsecPeriod = 1000000
|
||||
TsOnlineUsecPhase = 0
|
||||
TsOfflineUsecPeriod = 1000000
|
||||
TsOfflineUsecPhase = 0
|
||||
TimeModule = {
|
||||
BoardName = TimerBoard
|
||||
}
|
||||
}
|
||||
+Thread_1 = {
|
||||
Class = RealTimeThread
|
||||
ThreadPriority = 28
|
||||
RunOnCPU = 8
|
||||
RTStatusChangeMsecTimeout = 1000
|
||||
SMStatusChangeMsecTimeout = 1000
|
||||
OfflineSemaphoreTimeout = 50
|
||||
TriggeringServiceName = MARTe.ExternalTimeTriggeringService
|
||||
SafetyMsecSleep = 1
|
||||
+DDB = {
|
||||
Class = DDB
|
||||
}
|
||||
+Timer = {
|
||||
Class = IOGAMs::TimeInputGAM
|
||||
TriggeringServiceName = ExternalTimeTriggeringService
|
||||
BoardName = TimerBoard
|
||||
Signals = {
|
||||
counter = {
|
||||
SignalName = packetNumber
|
||||
SignalType = int32
|
||||
}
|
||||
time = {
|
||||
SignalName = usecTime
|
||||
SignalType = int32
|
||||
}
|
||||
}
|
||||
}
|
||||
+InputData = {
|
||||
Class = IOGAMs::InputGAM
|
||||
BoardName = FileReader
|
||||
UsecTimeSignalName = usecTime
|
||||
Signals = {
|
||||
/*+input_data = {
|
||||
SignalName = input_data[47608990]
|
||||
SignalType = uint32
|
||||
}*/
|
||||
+input_data = {
|
||||
SignalName = input_data[40000000]
|
||||
SignalType = uint32
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+Statistic = {
|
||||
Class = WebStatisticGAM
|
||||
Verbose = True
|
||||
FrequencyOfVerbose = 2000000
|
||||
Signals = {
|
||||
SignalU = {
|
||||
SignalName = usecTime
|
||||
SignalType = int32
|
||||
}
|
||||
CycleTime = {
|
||||
SignalName = CycleUsecTime
|
||||
SignalType = float
|
||||
}
|
||||
TimerRelativeTime = {
|
||||
SignalName = TimerRelativeUsecTime
|
||||
SignalType = float
|
||||
}
|
||||
InputDataRelativeTime = {
|
||||
SignalName = InputDataRelativeUsecTime
|
||||
SignalType = float
|
||||
}
|
||||
SINE1 = {
|
||||
SignalName = "input_data(0:5)"
|
||||
SignalType = uint32
|
||||
}
|
||||
}
|
||||
}
|
||||
+Collection = {
|
||||
Class = CollectionGAMs::DataCollectionGAM
|
||||
UsecTimeSignalName = usecTime
|
||||
PreTrigger = 200
|
||||
EventTrigger = {
|
||||
MaxFastAcquisitionPoints = 800
|
||||
PointsForSingleFastAcquisition = 400
|
||||
TimeWindow0 = {
|
||||
NOfSamples = 80000
|
||||
UsecPeriod = 1000
|
||||
}
|
||||
}
|
||||
NOfAcquisitionSamples = 80000
|
||||
Signals = {
|
||||
CLOCK = {
|
||||
SignalName = usecTime
|
||||
JPFName = "TIME"
|
||||
SignalType = int32
|
||||
Cal0 = 0.0
|
||||
Cal1 = 1.000000e-06
|
||||
}
|
||||
CycleTime = {
|
||||
SignalName = CycleUsecTime
|
||||
JPFName = "CycleTime"
|
||||
SignalType = float
|
||||
}
|
||||
SignalTime = {
|
||||
SignalName = TimerRelativeUsecTime
|
||||
JPFName = "TimerRelativeUsecTime"
|
||||
SignalType = float
|
||||
}
|
||||
SINE1 = {
|
||||
SignalName = "input_data(0:5)"
|
||||
JPFName = "input_data"
|
||||
SignalType = uint32
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
Online = "Timer InputData"
|
||||
Offline = "Timer InputData"
|
||||
*/
|
||||
Online = "Timer InputData Statistic Collection"
|
||||
Offline = "Timer InputData Statistic"
|
||||
|
||||
}
|
||||
}
|
||||
ReloadAll = 0
|
||||
@@ -0,0 +1,79 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#############################################################
|
||||
#Start-up script for the MARTe example
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please specify the location of the configuration file"
|
||||
exit
|
||||
else
|
||||
echo "Going to start MARTe with the configuration specified in: " $1
|
||||
fi
|
||||
|
||||
target=`uname`
|
||||
case ${target} in
|
||||
Darwin)
|
||||
TARGET=macosx
|
||||
;;
|
||||
SunOS)
|
||||
TARGET=solaris
|
||||
;;
|
||||
*)
|
||||
TARGET=linux
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Target is $TARGET"
|
||||
|
||||
CODE_DIRECTORY=/opt/MARTe
|
||||
LD_LIBRARY_PATH=.:$CODE_DIRECTORY/BaseLib2/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/MARTe/MARTeSupportLib/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/DataCollectionGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WebStatisticGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/LinuxTimer/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/GenericTimerDriver/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/SignalHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/MATLABHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/FlotPlot/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./${TARGET}/
|
||||
|
||||
|
||||
|
||||
|
||||
if [ ${TARGET} == "macosx" ]; then
|
||||
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH
|
||||
echo $DYLD_LIBRARY_PATH
|
||||
else
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
echo $LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
$CODE_DIRECTORY/MARTe/${TARGET}/MARTe.ex $1
|
||||
|
||||
#cgdb --args $CODE_DIRECTORY/MARTe/${TARGET}/MARTe.ex $1
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
|
||||
MARTEBasePath=/opt/MARTe
|
||||
|
||||
MAKEDEFAULTDIR=$(MARTEBasePath)/MakeDefaults
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||
|
||||
CFLAGS+= -I.
|
||||
CFLAGS+= -I$(MARTEBasePath)/
|
||||
CFLAGS+= -I$(MARTEBasePath)/MARTe/MARTeSupportLib
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level0
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level1
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level2
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level3
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level4
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level5
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level6
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/LoggerService
|
||||
CFLAGS+= -std=c++0x
|
||||
#CFLAGS+= -std=c++11
|
||||
CFLAGS+= -O3
|
||||
#CFLAGS+= -Ofast
|
||||
CFLAGS+= -ffast-math
|
||||
#CFLAGS+= -fpermissive
|
||||
|
||||
|
||||
all: $(OBJS) \
|
||||
$(TARGET)/BinaryFileReader$(DRVEXT)
|
||||
echo $(OBJS)
|
||||
|
||||
include depends.$(TARGET)
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||
@@ -0,0 +1,31 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.linux 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
TARGET=linux
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L$(MARTEBasePath)/BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L$(MARTEBasePath)/MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.linux 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
TARGET=solaris
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
linux/BinaryFileReader.o: BinaryFileReader.cpp BinaryFileReader.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h /opt/MARTe/BaseLib2/Level2/File.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h
|
||||
@@ -0,0 +1,83 @@
|
||||
BinaryFileReader.o: BinaryFileReader.cpp BinaryFileReader.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h /opt/MARTe/BaseLib2/Level2/File.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h
|
||||
@@ -0,0 +1,95 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#############################################################
|
||||
#Start-up script for the MARTe
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please specify the location of the configuration file"
|
||||
exit
|
||||
else
|
||||
echo "Going to start MARTe with the configuration specified in: " $1
|
||||
fi
|
||||
|
||||
target=`uname`
|
||||
case ${target} in
|
||||
Darwin)
|
||||
TARGET=macosx
|
||||
;;
|
||||
SunOS)
|
||||
TARGET=solaris
|
||||
;;
|
||||
*)
|
||||
TARGET=linux
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Target is $TARGET"
|
||||
|
||||
BASEDIR=/opt/MARTe
|
||||
|
||||
CODE_DIRECTORY=$BASEDIR
|
||||
LD_LIBRARY_PATH=.:$CODE_DIRECTORY/BaseLib2/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/MARTe/MARTeSupportLib/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/LinuxTimer/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/GenericTimerDriver/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/StreamingDriver/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/ControlAlgorithms/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PIDGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaterTank/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaveformGenerator2009/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WebStatisticGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/DataCollectionGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PlottingGAM/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/SignalHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/MATLABHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/FlotPlot/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../IOGAMs/ATCAadc/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../GAMs/isttokbiblio/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/EPICSLib/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/EPICSGAM/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/TCPMessageHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/TCPConfigurationHandler/${TARGET}/
|
||||
|
||||
if [ ${TARGET} == "macosx" ]; then
|
||||
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH
|
||||
echo $DYLD_LIBRARY_PATH
|
||||
else
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
echo $LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
#$CODE_DIRECTORY/MARTe/${TARGET}/MARTe.ex $1
|
||||
$CODE_DIRECTORY/MARTe/${TARGET}/MARTe_SysM.ex $1
|
||||
#gdb --args $CODE_DIRECTORY/MARTe/linux/MARTe.ex $1
|
||||
@@ -0,0 +1,57 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
|
||||
MARTEBasePath=/opt/MARTe
|
||||
|
||||
MAKEDEFAULTDIR=$(MARTEBasePath)/MakeDefaults
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||
|
||||
CFLAGS+= -I.
|
||||
CFLAGS+= -I$(MARTEBasePath)/
|
||||
CFLAGS+= -I$(MARTEBasePath)/MARTe/MARTeSupportLib
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level0
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level1
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level2
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level3
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level4
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level5
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level6
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/LoggerService
|
||||
CFLAGS+= -std=c++0x
|
||||
#CFLAGS+= -std=c++11
|
||||
CFLAGS+= -O3
|
||||
#CFLAGS+= -Ofast
|
||||
CFLAGS+= -ffast-math
|
||||
#CFLAGS+= -fpermissive
|
||||
|
||||
|
||||
all: $(OBJS) \
|
||||
$(TARGET)/BinaryFileReader$(DRVEXT)
|
||||
echo $(OBJS)
|
||||
|
||||
include depends.$(TARGET)
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||
@@ -0,0 +1,31 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.linux 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
TARGET=linux
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L$(MARTEBasePath)/BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L$(MARTEBasePath)/MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.linux 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
TARGET=solaris
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "NewAlgorithm38GAM.h"
|
||||
|
||||
OBJECTLOADREGISTER(NewAlgorithm38GAM, "$Id: $")
|
||||
|
||||
// ******** Default constructor ***********************************
|
||||
NewAlgorithm38GAM::NewAlgorithm38GAM(){
|
||||
this->SignalsInputInterface = NULL;
|
||||
this->SignalsOutputInterface = NULL;
|
||||
}
|
||||
|
||||
// ********* Destructor ********************************************
|
||||
NewAlgorithm38GAM::~NewAlgorithm38GAM()
|
||||
{
|
||||
if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
|
||||
if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
|
||||
}
|
||||
|
||||
//{ ********* Initialise the module ********************************
|
||||
bool NewAlgorithm38GAM::Initialise(ConfigurationDataBase& cdbData){
|
||||
CDBExtended cdb(cdbData);
|
||||
return True;
|
||||
}
|
||||
|
||||
//{ ********* Execute the module functionalities *******************
|
||||
bool NewAlgorithm38GAM::Execute(GAM_FunctionNumbers functionNumber){
|
||||
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
|
||||
this->SignalsInputInterface->Read();
|
||||
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
|
||||
this->SignalsOutputInterface->Write();
|
||||
return True;
|
||||
}
|
||||
|
||||
bool NewAlgorithm38GAM::ProcessHttpMessage(HttpStream &hStream){
|
||||
HtmlStream hmStream(hStream);
|
||||
int i;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
|
||||
<head>\n\
|
||||
<title>%s</title>\n\
|
||||
</head>\n\
|
||||
<body>\n\
|
||||
<svg width="100%" height="100" style="background-color: AliceBlue;">\n\
|
||||
<image x="%d" y="%d" width="%d" height="%d" xlink:href="%s" />\n\
|
||||
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style="font-family:Arial;font-size:46">%s</text><br", (char *) this->Name());
|
||||
FString submit_view;
|
||||
submit_view.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_view")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_view, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_view.Size() > 0) view_input_variables = True;
|
||||
FString submit_hide;
|
||||
submit_hide.SetSize(0);
|
||||
if (hStream.Switch("InputCommands.submit_hide")){
|
||||
hStream.Seek(0);
|
||||
hStream.GetToken(submit_hide, "");
|
||||
hStream.Switch((uint32)0);
|
||||
}
|
||||
if(submit_hide.Size() > 0) view_input_variables = False;
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype="multipart/form-data" method="post"");
|
||||
if(!view_input_variables){
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "input type="submit" name="submit_view" value="View input variables"");
|
||||
}
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
|
||||
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
|
||||
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
|
||||
hStream.WriteReplyHeader(True);
|
||||
return True;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef _NEWALGORITHM38_H_
|
||||
#define _NEWALGORITHM38_H_
|
||||
|
||||
#include "DDBInputInterface.h"
|
||||
#include "DDBOutputInterface.h"
|
||||
#include "GAM.h"
|
||||
#include "File.h"
|
||||
#include "Matrix.h"
|
||||
#include "HtmlStream.h"
|
||||
|
||||
OBJECT_DLL(NewAlgorithm38GAM)
|
||||
class NewAlgorithm38GAM : public GAM, public HttpInterface {
|
||||
private:
|
||||
|
||||
DDBInputInterface *SignalsInputInterface;
|
||||
DDBOutputInterface *SignalsOutputInterface;
|
||||
|
||||
struct InputInterfaceStruct {
|
||||
};
|
||||
|
||||
struct OutputInterfaceStruct {
|
||||
};
|
||||
|
||||
bool view_input_variables;
|
||||
public:
|
||||
// Default constructor
|
||||
NewAlgorithm38GAM();
|
||||
|
||||
// Destructor
|
||||
virtual ~NewAlgorithm38GAM();
|
||||
|
||||
// Initialise the module
|
||||
virtual bool Initialise(ConfigurationDataBase& cdbData);
|
||||
|
||||
// Execute the module functionalities
|
||||
virtual bool Execute(GAM_FunctionNumbers functionNumber);
|
||||
virtual bool ProcessHttpMessage(HttpStream &hStream);
|
||||
|
||||
OBJECT_DLL_STUFF(NewAlgorithm38GAM)
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
linux/BinaryFileReader.o: BinaryFileReader.cpp BinaryFileReader.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h /opt/MARTe/BaseLib2/Level2/File.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h
|
||||
@@ -0,0 +1,83 @@
|
||||
BinaryFileReader.o: BinaryFileReader.cpp BinaryFileReader.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h /opt/MARTe/BaseLib2/Level2/File.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
*
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
will be approved by the European Commission - subsequent
|
||||
versions of the EUPL (the "Licence");
|
||||
* You may not use this work except in compliance with the
|
||||
Licence.
|
||||
* You may obtain a copy of the Licence at:
|
||||
*
|
||||
* http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* Unless required by applicable law or agreed to in
|
||||
writing, software distributed under the Licence is
|
||||
distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied.
|
||||
* See the Licence for the specific language governing
|
||||
permissions and limitations under the Licence.
|
||||
*
|
||||
* $Id: FileReadDrv.cpp 3 2012-01-15 16:26:07Z aneto $
|
||||
*
|
||||
**/
|
||||
|
||||
#include "FileReadDrv.h"
|
||||
#include "GlobalObjectDataBase.h"
|
||||
|
||||
bool FileReadDrv::ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err){
|
||||
AssertErrorCondition(Information, "FileReadDrv::ObjectLoadSetup: %s Loading signals", Name());
|
||||
|
||||
printf("1\n");
|
||||
|
||||
CDBExtended cdb(info);
|
||||
if(!GenericAcqModule::ObjectLoadSetup(info,err)){
|
||||
AssertErrorCondition(InitialisationError,"FileReadDrv::ObjectLoadSetup: %s GenericAcqModule::ObjectLoadSetup Failed",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("2\n");
|
||||
if(!cdb.ReadFString(fileName, "TimeFileName")){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s TimeFileName must be specified.",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!f.OpenRead(fileName.Buffer())){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s failed to open file: %s", Name(), fileName.Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
uint32 fileSize = f.Size();
|
||||
|
||||
numberOfSignalLists = Size();
|
||||
|
||||
if(numberOfSignalLists < 1){
|
||||
AssertErrorCondition(InitialisationError,"FileReadDrv::ObjectLoadSetup: %s at least 1 FileSignalList must be specified.",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
/*
|
||||
if(numberOfSignalLists != 1){
|
||||
|
||||
if(numberOfSignalLists > 1){
|
||||
AssertErrorCondition(InitialisationError,"FileReadDrv::ObjectLoadSetup: %s only 1 FileSignalList must be specified.",Name());
|
||||
return False;
|
||||
}else{
|
||||
AssertErrorCondition(InitialisationError,"FileReadDrv::ObjectLoadSetup: %s at least 1 FileSignalList must be specified.",Name());
|
||||
return False;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
printf("Before new\n");
|
||||
|
||||
signalLists = new FileSignalList*[numberOfSignalLists];
|
||||
if(signalLists == NULL){
|
||||
AssertErrorCondition(InitialisationError,"FileReadDrv::ObjectLoadSetup: %s failed to allocate %d pointer for FileSignalList.",Name(), numberOfSignalLists);
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Before for\n");
|
||||
int32 i=0;
|
||||
for(i=0; i<numberOfSignalLists; i++){
|
||||
printf("In for\n");
|
||||
signalLists[i] = (FileSignalList *)Find(i).operator->();
|
||||
}
|
||||
|
||||
printf("After for\n");
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetData
|
||||
*/
|
||||
int32 FileReadDrv::GetData(uint32 usecTime, int32 *ibuffer, int32 bufferNumber){
|
||||
int32 i = 0;
|
||||
char *buffer = (char *)ibuffer;
|
||||
|
||||
cycleNumber++;
|
||||
|
||||
for(i=0; i<numberOfSignalLists; i++){
|
||||
//signalLists[i]->LoadData();
|
||||
void *samples = signalLists[i]->GetNextSample(usecTime, cycleNumber);
|
||||
|
||||
if(samples != NULL){
|
||||
//if (cycleNumber == 1){
|
||||
// printf("signalLists[%d]->signalType.ByteSize() = %d, NumberOfInputs() = %d,sample = %f\n", i, signalLists[i]->signalType.ByteSize(), NumberOfInputs(), *((float *) samples));
|
||||
// printf("signalLists[%d]->signalType.ByteSize() = %d, NumberOfInputs() = %d,sample = %d\n", i, signalLists[i]->signalType.ByteSize(), NumberOfInputs(), *((unsigned int *) samples));
|
||||
|
||||
//}
|
||||
memcpy(buffer, samples, signalLists[i]->signalType.ByteSize());
|
||||
// buffer += signalLists[i]->signalType.ByteSize() * signalLists[i]->numberOfSignals * NumberOfInputs();
|
||||
buffer += signalLists[i]->signalType.ByteSize() * signalLists[i]->numberOfSignals;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
OBJECTLOADREGISTER(FileReadDrv,"$Id: FileReadDrv.cpp 3 2012-01-15 16:26:07Z aneto $")
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
*
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
will be approved by the European Commission - subsequent
|
||||
versions of the EUPL (the "Licence");
|
||||
* You may not use this work except in compliance with the
|
||||
Licence.
|
||||
* You may obtain a copy of the Licence at:
|
||||
*
|
||||
* http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* Unless required by applicable law or agreed to in
|
||||
writing, software distributed under the Licence is
|
||||
distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied.
|
||||
* See the Licence for the specific language governing
|
||||
permissions and limitations under the Licence.
|
||||
*
|
||||
* $Id: FileReadDrv.h 3 2012-01-15 16:26:07Z aneto $
|
||||
*
|
||||
**/
|
||||
|
||||
#if !defined (FILE_READ_DRV)
|
||||
#define FILE_READ_DRV
|
||||
|
||||
#include "System.h"
|
||||
#include "GenericAcqModule.h"
|
||||
#include "FileSignalList.h"
|
||||
|
||||
OBJECT_DLL(FileReadDrv)
|
||||
class FileReadDrv:public GenericAcqModule{
|
||||
OBJECT_DLL_STUFF(FileReadDrv)
|
||||
|
||||
private:
|
||||
/**
|
||||
* The signal list. Each list has a time vector associated to N signal vectors
|
||||
*/
|
||||
FileSignalList **signalLists;
|
||||
/**
|
||||
* Number of signals for the list N
|
||||
*/
|
||||
int32 numberOfSignalLists;
|
||||
/**
|
||||
* Cycle Number
|
||||
*/
|
||||
int64 cycleNumber;
|
||||
|
||||
/**
|
||||
* Number of signals
|
||||
*/
|
||||
uint32 numberOfSignals;
|
||||
|
||||
/**
|
||||
* Time File Name
|
||||
*/
|
||||
FString fileName;
|
||||
|
||||
/**
|
||||
* Time File Handler
|
||||
*/
|
||||
File f;
|
||||
|
||||
public:
|
||||
FileReadDrv(){
|
||||
signalLists = NULL;
|
||||
numberOfSignalLists = 0;
|
||||
cycleNumber = 0;
|
||||
}
|
||||
|
||||
virtual ~FileReadDrv(){
|
||||
if(signalLists != NULL){
|
||||
delete []signalLists;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the internal counters
|
||||
*/
|
||||
bool PulseStart(){
|
||||
int i=0;
|
||||
for(i=0; i<numberOfSignalLists; i++){
|
||||
signalLists[i]->Reset();
|
||||
}
|
||||
|
||||
cycleNumber = 0;
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets Data From the Module to the DDB
|
||||
* @param usecTime Microseconds Time
|
||||
* @return -1 on Error, 1 on success
|
||||
*/
|
||||
int32 GetData(uint32 usecTime, int32 *buffer, int32 bufferNumber = 0);
|
||||
|
||||
/**
|
||||
* Load and configure object parameters
|
||||
* @param info the configuration database
|
||||
* @param err the error stream
|
||||
* @return True if no errors are found during object configuration
|
||||
*/
|
||||
bool ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err);
|
||||
|
||||
/**
|
||||
* NOOP
|
||||
*/
|
||||
bool ObjectDescription(StreamInterface &s,bool full,StreamInterface *er){
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOOP
|
||||
*/
|
||||
bool SetInputBoardInUse(bool on){
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOOP
|
||||
*/
|
||||
bool SetOutputBoardInUse(bool on){
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
*/
|
||||
bool WriteData(uint32 usecTime, const int32* buffer){
|
||||
AssertErrorCondition(FatalError, "%s: WriteData not supported", Name());
|
||||
return False;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
*
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
will be approved by the European Commission - subsequent
|
||||
versions of the EUPL (the "Licence");
|
||||
* You may not use this work except in compliance with the
|
||||
Licence.
|
||||
* You may obtain a copy of the Licence at:
|
||||
*
|
||||
* http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* Unless required by applicable law or agreed to in
|
||||
writing, software distributed under the Licence is
|
||||
distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied.
|
||||
* See the Licence for the specific language governing
|
||||
permissions and limitations under the Licence.
|
||||
*
|
||||
* $Id: FileSignalList.cpp 3 2012-01-15 16:26:07Z aneto $
|
||||
*
|
||||
**/
|
||||
|
||||
#include "FileSignalList.h"
|
||||
#include "File.h"
|
||||
|
||||
bool FileSignalList::LoadData(){
|
||||
//Open the file
|
||||
|
||||
/*
|
||||
float*aux = (float*)data;
|
||||
for(int i=0;i<signalArraySize;i++){
|
||||
|
||||
printf("Load data[%d]=%lf\n", i, aux[i]);
|
||||
}
|
||||
*/
|
||||
return True;
|
||||
}
|
||||
|
||||
bool FileSignalList::ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err){
|
||||
GCNamedObject::ObjectLoadSetup(info, err);
|
||||
|
||||
printf("Loading Signal\n");
|
||||
AssertErrorCondition(Information, "FileSignalList::ObjectLoadSetup: %s Loading signals", Name());
|
||||
|
||||
CDBExtended cdb(info);
|
||||
|
||||
if(!cdb.ReadFString(fileName, "FileName", "signal_vector")){
|
||||
AssertErrorCondition(InitialisationError,"FileReadDrv::ObjectLoadSetup: %s FileBaseName must be specified.",Name());
|
||||
return False;
|
||||
}
|
||||
|
||||
//Read the data type
|
||||
FString signalTypeStr;
|
||||
if(!cdb.ReadFString(signalTypeStr, "SignalType", "float")){
|
||||
AssertErrorCondition(Warning, "FileSignalList::ObjectLoadSetup: %s did not specify SignalType. Assuming %s", Name(), signalTypeStr.Buffer());
|
||||
}
|
||||
|
||||
if(!BTConvertFromString(signalType, signalTypeStr.Buffer())){
|
||||
AssertErrorCondition(InitialisationError,"FileSignalList::ObjectLoadSetup: %s failed to convert to signalType %s", Name(), signalTypeStr.Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
//Configure whatever is required to access the shared memory
|
||||
if(!cdb.ReadInt32(signalArraySize, "SignalArraySize", 100)){
|
||||
AssertErrorCondition(Warning,"DCSSignal::ObjectLoadSetup: %s SignalArraySize was not specified. using Default at 1.",Name());
|
||||
}
|
||||
|
||||
numberOfSignals = signalArraySize;
|
||||
|
||||
|
||||
if(!f.OpenRead(fileName.Buffer())){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s failed to open file: %s", Name(), fileName.Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
uint32 fileSize = f.Size();
|
||||
|
||||
if(fileSize != dataSize){
|
||||
AssertErrorCondition(Warning,"Initialise::ObjectLoadSetup: %s size [%d] is diferent from configured %d", Name(), fileSize, dataSize);
|
||||
//return False;
|
||||
}
|
||||
|
||||
dataSize = fileSize;
|
||||
|
||||
unsigned char * fileData = (unsigned char *) calloc(fileSize, sizeof(unsigned char));
|
||||
if (!fileData)
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"%s::Initialise: Not enough memory for file_data with size %zu", Name(), dataSize);
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertErrorCondition(Information,"%s::Initialise: Memory allocated for file_data: %zu bytes", Name(), dataSize);
|
||||
}
|
||||
|
||||
signalData = (unsigned char *) calloc(fileSize, sizeof(unsigned char));
|
||||
if (!signalData)
|
||||
{
|
||||
AssertErrorCondition(InitialisationError,"%s::Initialise: Not enough memory for file_data with size %zu", Name(), dataSize);
|
||||
return False;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertErrorCondition(Information,"%s::Initialise: Memory allocated for file_data: %zu bytes", Name(), dataSize);
|
||||
}
|
||||
|
||||
// printf("reading file %s\n", fileName.Buffer());
|
||||
f.Seek(SEEK_SET);
|
||||
bool k = f.Read(fileData, fileSize);
|
||||
|
||||
if(k == 0){
|
||||
AssertErrorCondition(InitialisationError,"Initialise::ObjectLoadSetup: %s failed read data from file: %s", Name(), fileName.Buffer());
|
||||
return False;
|
||||
}
|
||||
|
||||
/*
|
||||
for(int i=0; i<24; i++){
|
||||
printf("i = %d, data = %d, 0x%X\n", i, ((unsigned char *) fileData)[i], ((unsigned char *) fileData)[i]);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
unsigned int result = ((unsigned char *) fileData)[0];
|
||||
result = (result << 8) | ((unsigned char *) fileData)[1];
|
||||
result = (result << 8) | ((unsigned char *) fileData)[2];
|
||||
result = (result << 8) | ((unsigned char *) fileData)[3];
|
||||
|
||||
printf("first time = %x\n", ((unsigned int *) fileData)[0]);
|
||||
printf("first time = %d\n", ((unsigned int *) fileData)[0]);
|
||||
|
||||
printf("first time corrected = %d, 0x%X\n", result);
|
||||
|
||||
printf("sizeof(char) = %d\n", sizeof(char));
|
||||
*/
|
||||
for(int i=0; i<=fileSize - sizeof(char)*4; i=i+sizeof(char)*4){
|
||||
((unsigned char *) signalData)[i+0] = fileData[i+3];
|
||||
((unsigned char *) signalData)[i+1] = fileData[i+2];
|
||||
((unsigned char *) signalData)[i+2] = fileData[i+1];
|
||||
((unsigned char *) signalData)[i+3] = fileData[i+0];
|
||||
}
|
||||
|
||||
// printf("first value corrected = %d, 0x%X\n", ((unsigned int *) signalData)[0], ((unsigned int *) signalData)[0]);
|
||||
// printf("first value addr = 0x%X\n", ((unsigned int *) signalData));
|
||||
|
||||
if(fileData != NULL)
|
||||
free((void *&)fileData);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
void *FileSignalList::GetNextSample(uint32 usecTime, uint32 cycleNumber){
|
||||
|
||||
int index = 0;
|
||||
|
||||
if(signalData == NULL){
|
||||
AssertErrorCondition(FatalError,"FileSignalList::GetNextSample: %s Data is not ready or is NULL", Name());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//circular buffer
|
||||
index = (cycleNumber-1)%(dataSize/signalType.ByteSize());
|
||||
|
||||
//Moves the internal counter to the next sample after the specified time
|
||||
//and returns the previous sample
|
||||
/*
|
||||
while(time[sampleCounter] <= usecTime){
|
||||
sampleCounter++;
|
||||
if(sampleCounter == numberOfSamples){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sampleCounter--;
|
||||
|
||||
return (sampleCounter == -1) ? data : ((char *) data) + sampleCounter * (numberOfSignals * signalType.ByteSize());
|
||||
*/
|
||||
//return ((char *) signalData);
|
||||
|
||||
// printf("cycleNumber = %d, index = %d\n", cycleNumber, index);
|
||||
// printf("numberOfSignals = %d, signalType.ByteSize() = %d\n", numberOfSignals, signalType.ByteSize());
|
||||
|
||||
// printf("index = %d\n", index);
|
||||
|
||||
// if (index < 10){
|
||||
/*
|
||||
printf("cycleNumber = %d, index = %d, dataSize = %d\n", cycleNumber, index, dataSize);
|
||||
printf("numberOfSignals = %d, signalType.ByteSize() = %d\n", numberOfSignals, signalType.ByteSize());
|
||||
printf("sample = %d\n", ((unsigned int *) signalData)[index]);
|
||||
*/
|
||||
//}
|
||||
|
||||
/*
|
||||
if (index == 0){
|
||||
printf("cycleNumber = %d, index = %d\n", cycleNumber, index);
|
||||
printf("numberOfSignals = %d, signalType.ByteSize() = %d\n", numberOfSignals, signalType.ByteSize());
|
||||
|
||||
printf("sample = %d\n", *(((unsigned char *) signalData) + index * (numberOfSignals * signalType.ByteSize())));
|
||||
|
||||
printf("sample addr = 0x%X\n", (((unsigned char *) signalData) + index * (numberOfSignals * signalType.ByteSize())));
|
||||
}
|
||||
*/
|
||||
|
||||
return ((unsigned char *) signalData) + index * (numberOfSignals * signalType.ByteSize());
|
||||
}
|
||||
|
||||
OBJECTLOADREGISTER(FileSignalList,"$Id: FileSignalList.cpp 3 2012-01-15 16:26:07Z aneto $")
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
*
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
will be approved by the European Commission - subsequent
|
||||
versions of the EUPL (the "Licence");
|
||||
* You may not use this work except in compliance with the
|
||||
Licence.
|
||||
* You may obtain a copy of the Licence at:
|
||||
*
|
||||
* http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* Unless required by applicable law or agreed to in
|
||||
writing, software distributed under the Licence is
|
||||
distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied.
|
||||
* See the Licence for the specific language governing
|
||||
permissions and limitations under the Licence.
|
||||
*
|
||||
* $Id: FileSignalList.h 3 2012-01-15 16:26:07Z aneto $
|
||||
*
|
||||
**/
|
||||
|
||||
#if !defined (FILE_SIGNAL_LIST)
|
||||
#define FILE_SIGNAL_LIST
|
||||
|
||||
/**
|
||||
* @file Contains a signal list sharing the same time source and signal type.
|
||||
* The input files are expected to be organised in columns and separated by spaces.
|
||||
*/
|
||||
|
||||
#include "System.h"
|
||||
#include "Threads.h"
|
||||
#include "GCNamedObject.h"
|
||||
#include "BasicTypes.h"
|
||||
#include "GenericAcqModule.h"
|
||||
#include "File.h"
|
||||
#include <string>
|
||||
|
||||
OBJECT_DLL(FileSignalList)
|
||||
class FileSignalList:public GCNamedObject{
|
||||
OBJECT_DLL_STUFF(FileSignalList)
|
||||
private:
|
||||
/**
|
||||
* Time vector in microseconds
|
||||
*/
|
||||
//int64 *time;
|
||||
/**
|
||||
* Data vector
|
||||
*/
|
||||
void *signalData;
|
||||
|
||||
/**
|
||||
* Data size of usecTimefile
|
||||
*/
|
||||
uint32 dataSize;
|
||||
/**
|
||||
* The number of samples
|
||||
*/
|
||||
int32 numberOfSamples;
|
||||
/**
|
||||
* The latest sample read
|
||||
*/
|
||||
int32 sampleCounter;
|
||||
/**
|
||||
* File Name. Used to generate file names to read in each cycle: [fileBaseName]_[Cycle_Number].[fileExtension]
|
||||
*/
|
||||
FString fileName;
|
||||
/**
|
||||
* The size of the array
|
||||
*/
|
||||
int32 signalArraySize;
|
||||
|
||||
/**
|
||||
* File handler
|
||||
*/
|
||||
File f;
|
||||
public:
|
||||
/**
|
||||
* Number of signals
|
||||
*/
|
||||
int32 numberOfSignals;
|
||||
/**
|
||||
* The signals type
|
||||
*/
|
||||
BasicTypeDescriptor signalType;
|
||||
|
||||
|
||||
FileSignalList(){
|
||||
numberOfSignals = 0;
|
||||
numberOfSamples = 0;
|
||||
sampleCounter = 0;
|
||||
dataSize = 0;
|
||||
//time = NULL;
|
||||
signalData = NULL;
|
||||
|
||||
}
|
||||
|
||||
virtual ~FileSignalList(){
|
||||
/*if(time != NULL){
|
||||
delete []time;
|
||||
}*/
|
||||
if(signalData != NULL){
|
||||
free((void *&)signalData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and configure object parameters
|
||||
* @param info the configuration database
|
||||
* @param err the error stream
|
||||
* @return True if no errors are found during object configuration
|
||||
*/
|
||||
bool ObjectLoadSetup(ConfigurationDataBase &info,StreamInterface *err);
|
||||
|
||||
/**
|
||||
* Resets the sample counter
|
||||
*/
|
||||
void Reset(){
|
||||
sampleCounter = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array of samples for a given time in microseconds.
|
||||
* Assumes monotonic growing time.
|
||||
* @param usecTime the time in microseconds
|
||||
* @return the data for this particular time
|
||||
*/
|
||||
void *GetNextSample(uint32 usecTime, uint32 cycleNumber);
|
||||
|
||||
/**
|
||||
*Read the actual data from the file
|
||||
*@return True if data is successfully read
|
||||
*/
|
||||
bool LoadData();
|
||||
|
||||
|
||||
void setDataSize(int size){
|
||||
this->dataSize = size;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Checks if the line is a comment
|
||||
* @param line the line to check
|
||||
* @return True if it starts with a comment characted
|
||||
*/
|
||||
bool IsComment(FString &line){
|
||||
if(line.Size() > 1){
|
||||
char c = line.Buffer()[0];
|
||||
if((c == '#') || (c == '/') || (c == '%')){
|
||||
return True;
|
||||
}
|
||||
}
|
||||
return False;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,79 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#############################################################
|
||||
#Start-up script for the MARTe example
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please specify the location of the configuration file"
|
||||
exit
|
||||
else
|
||||
echo "Going to start MARTe with the configuration specified in: " $1
|
||||
fi
|
||||
|
||||
target=`uname`
|
||||
case ${target} in
|
||||
Darwin)
|
||||
TARGET=macosx
|
||||
;;
|
||||
SunOS)
|
||||
TARGET=solaris
|
||||
;;
|
||||
*)
|
||||
TARGET=linux
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Target is $TARGET"
|
||||
|
||||
CODE_DIRECTORY=/opt/MARTe
|
||||
LD_LIBRARY_PATH=.:$CODE_DIRECTORY/BaseLib2/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/MARTe/MARTeSupportLib/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/DataCollectionGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WebStatisticGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/LinuxTimer/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/GenericTimerDriver/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/SignalHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/MATLABHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/FlotPlot/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../GAMs/isttokbiblio/${TARGET}/
|
||||
|
||||
|
||||
|
||||
if [ ${TARGET} == "macosx" ]; then
|
||||
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH
|
||||
echo $DYLD_LIBRARY_PATH
|
||||
else
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
echo $LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
$CODE_DIRECTORY/MARTe/${TARGET}/MARTe.ex $1
|
||||
|
||||
#cgdb --args $CODE_DIRECTORY/MARTe/${TARGET}/MARTe.ex $1
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
OBJSX=FileSignalList.x
|
||||
|
||||
MARTEBasePath=/opt/MARTe
|
||||
|
||||
MAKEDEFAULTDIR=$(MARTEBasePath)/MakeDefaults
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||
|
||||
CFLAGS+= -I.
|
||||
CFLAGS+= -I$(MARTEBasePath)/
|
||||
CFLAGS+= -I$(MARTEBasePath)/MARTe/MARTeSupportLib
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level0
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level1
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level2
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level3
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level4
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level5
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/Level6
|
||||
CFLAGS+= -I$(MARTEBasePath)/BaseLib2/LoggerService
|
||||
CFLAGS+= -I$(MARTEBasePath)/CODASLib/JPFHandler/
|
||||
|
||||
all: $(OBJS) \
|
||||
$(TARGET)/FileReadDrv$(DRVEXT) \
|
||||
$(TARGET)/generate_hash$(EXEEXT)
|
||||
echo $(OBJS)
|
||||
|
||||
include depends.$(TARGET)
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||
@@ -0,0 +1,31 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.linux 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
TARGET=linux
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L$(MARTEBasePath)/BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L$(MARTEBasePath)/MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.linux 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
TARGET=solaris
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2
|
||||
LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
linux/FileReadDrv.o: FileReadDrv.cpp FileReadDrv.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h FileSignalList.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/File.h /opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h
|
||||
linux/FileSignalList.o: FileSignalList.cpp FileSignalList.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Sleep.h /opt/MARTe/BaseLib2/Level0/FastMath.h \
|
||||
/opt/MARTe/BaseLib2/Level0/HRT.h /opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h /opt/MARTe/BaseLib2/Level2/File.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicFile.h
|
||||
linux/generate_hash.o: generate_hash.cpp \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDigestRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h
|
||||
@@ -0,0 +1,221 @@
|
||||
FileReadDrv.o: FileReadDrv.cpp FileReadDrv.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h FileSignalList.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/File.h /opt/MARTe/BaseLib2/Level0/BasicFile.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GlobalObjectDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h
|
||||
FileSignalList.o: FileSignalList.cpp FileSignalList.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Sleep.h /opt/MARTe/BaseLib2/Level0/FastMath.h \
|
||||
/opt/MARTe/BaseLib2/Level0/HRT.h /opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/GenericAcqModule.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeTriggeringServiceInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReference.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCReferenceContainer.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRTemplate.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level0/MutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCRCItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNOExtender.h \
|
||||
/opt/MARTe/MARTe/MARTeSupportLib/TimeServiceActivity.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBVirtual.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBNull.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBExtended.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CDBDataTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level1/CDBTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpStream.h \
|
||||
/opt/MARTe/BaseLib2/Level3/StreamConfigurationDataBase.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h /opt/MARTe/BaseLib2/Level2/File.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BasicFile.h
|
||||
generate_hash.o: generate_hash.cpp \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDigestRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMSC.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemLinux.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5100.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemV6X5500.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemVX68k.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemRTAI.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemSolaris.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SystemMacOSX.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Memory.h /opt/MARTe/BaseLib2/Level0/System.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpRealm.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GCNamedObject.h \
|
||||
/opt/MARTe/BaseLib2/Level1/GarbageCollectable.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectRegistryItem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Iterators.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/GenDefs.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListHolder.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LinkedListable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastPollingMutexSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Atomic.h /opt/MARTe/BaseLib2/Level0/Sleep.h \
|
||||
/opt/MARTe/BaseLib2/Level0/FastMath.h /opt/MARTe/BaseLib2/Level0/HRT.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Processor.h \
|
||||
/opt/MARTe/BaseLib2/Level0/TimeoutType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/Threads.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ExceptionHandlerDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadInitialisationInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level0/EventSem.h \
|
||||
/opt/MARTe/BaseLib2/Level0/SemCore.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ProcessorType.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ThreadsDatabase.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ErrorSystemInstructionItem.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructure.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ClassStructureEntry.h \
|
||||
/opt/MARTe/BaseLib2/Level1/BasicTypes.h \
|
||||
/opt/MARTe/BaseLib2/Level0/BString.h \
|
||||
/opt/MARTe/BaseLib2/Level0/ErrorManagement.h \
|
||||
/opt/MARTe/BaseLib2/Level0/LoadableLibrary.h \
|
||||
/opt/MARTe/BaseLib2/Level0/StreamInterface.h \
|
||||
/opt/MARTe/BaseLib2/Level1/ObjectMacros.h \
|
||||
/opt/MARTe/BaseLib2/Level4/HttpDefinitions.h \
|
||||
/opt/MARTe/BaseLib2/Level2/FString.h \
|
||||
/opt/MARTe/BaseLib2/Level2/Streamable.h \
|
||||
/opt/MARTe/BaseLib2/Level0/CStream.h \
|
||||
/opt/MARTe/BaseLib2/Level2/CStreamBuffering.h \
|
||||
/opt/MARTe/BaseLib2/Level1/Object.h \
|
||||
/opt/MARTe/BaseLib2/Level1/StreamAttributes.h
|
||||
@@ -0,0 +1,78 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2011 EFDA | European Fusion Development Agreement
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#############################################################
|
||||
#Start-up script for the MARTe
|
||||
#!/bin/sh
|
||||
|
||||
target=`uname`
|
||||
case ${target} in
|
||||
Darwin)
|
||||
TARGET=macosx
|
||||
;;
|
||||
SunOS)
|
||||
TARGET=solaris
|
||||
;;
|
||||
*)
|
||||
TARGET=linux
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Target is $TARGET"
|
||||
|
||||
BASEDIR=/opt/MARTe
|
||||
|
||||
CODE_DIRECTORY=$BASEDIR
|
||||
LD_LIBRARY_PATH=.:$CODE_DIRECTORY/BaseLib2/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/MARTe/MARTeSupportLib/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/LinuxTimer/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/GenericTimerDriver/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/StreamingDriver/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PIDGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaterTank/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaveformGenerator2009/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WebStatisticGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/DataCollectionGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/EPICSGAM/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PlottingGAM/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/SignalHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/MATLABHandler/${TARGET}/
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/FlotPlot/${TARGET}/
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./${TARGET}/
|
||||
|
||||
if [ ${TARGET} == "macosx" ]; then
|
||||
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH
|
||||
echo $DYLD_LIBRARY_PATH
|
||||
else
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
echo $LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
./${TARGET}/generate_hash.ex
|
||||
@@ -0,0 +1,49 @@
|
||||
//******************************************************************************
|
||||
// MARTe Library
|
||||
// $Log: driver_test.cpp,v $
|
||||
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#include "HttpDigestRealm.h"
|
||||
#include "System.h"
|
||||
#include "FString.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
FString HA1;
|
||||
|
||||
if (argc != 4){
|
||||
printf("Invalid number of args [%d]. Usage %s <userName> <password> <realm>\n", argc, argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
GeneratePasswordDigest(argv[1], argv[2], argv[3], HA1);
|
||||
|
||||
printf("Generated hash for user = %s, password = %s, real = %s -> %s\n", argv[1], argv[2], argv[3], HA1.Buffer());
|
||||
|
||||
/*
|
||||
FString toEncode;
|
||||
toEncode = "oper";
|
||||
unsigned char buffer[16];
|
||||
|
||||
md5( (unsigned char *)toEncode.BufferReference(), toEncode.Size(),buffer);
|
||||
for ( i=0;i<16;i++){
|
||||
printf("%02x",buffer[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("Hash is %s\n", HA1.Buffer());
|
||||
|
||||
|
||||
HA1.SetSize(0);
|
||||
toEncode.Printf("%s:%s:%s","opertok","SECURITY.PASSWORD","oper");
|
||||
md5( (unsigned char *)toEncode.BufferReference(), toEncode.Size(),buffer);
|
||||
for (int i=0;i<16;i++){
|
||||
HA1.Printf("%02x",buffer[i]);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user