Skip to content

Commit

Permalink
Merge pull request #308 from project8/feature/truthWriting
Browse files Browse the repository at this point in the history
record event properties and run parameters
  • Loading branch information
pslocum authored Feb 28, 2024
2 parents a7e7036 + c1fb83b commit 748efbf
Show file tree
Hide file tree
Showing 17 changed files with 284 additions and 104 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required( VERSION 3.1 )

# Define the project
cmake_policy( SET CMP0048 NEW ) # version in project()
project( locust_mc VERSION 2.6.2)
project( locust_mc VERSION 2.7.0)


list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake )
Expand Down
126 changes: 86 additions & 40 deletions Source/Generators/LMCArraySignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,140 +48,154 @@ namespace locust
fKassNeverStarted( false ),
fSkippedSamples( false ),
fAllowFastSampling( false ),
fInterface( new KassLocustInterface() )
fInterface( nullptr ) // Initialize fInterface to (nullptr) instead of to (new KassLocustInterface())
{
fRequiredSignalState = Signal::kTime;

KLInterfaceBootstrapper::get_instance()->SetInterface( fInterface );
}

ArraySignalGenerator::~ArraySignalGenerator()
{
}

bool ArraySignalGenerator::Configure( const scarab::param_node& aParam )
void ArraySignalGenerator::SetParameters( const scarab::param_node& aParam )
{
fParam = &aParam;
}


if (aParam.has( "power-combining-feed" ))
const scarab::param_node* ArraySignalGenerator::GetParameters()
{
return fParam;
}

bool ArraySignalGenerator::ConfigureInterface( Signal* aSignal )
{

if ( fInterface == nullptr ) fInterface.reset( new KassLocustInterface() );
KLInterfaceBootstrapper::get_instance()->SetInterface( fInterface );

const scarab::param_node& tParam = *GetParameters();

if (tParam.has( "power-combining-feed" ))
{
int npowercombiners = 0;

if(aParam["power-combining-feed"]().as_string() == "voltage-divider")
if(tParam["power-combining-feed"]().as_string() == "voltage-divider")
{
npowercombiners += 1;
fPowerCombiner = new VoltageDivider;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring voltage divider.");
exit(-1);
}
fAntennaElementPositioner = new AntennaElementPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring antenna element positioner.");
exit(-1);
}
}

if(aParam["power-combining-feed"]().as_string() == "slotted-waveguide")
if(tParam["power-combining-feed"]().as_string() == "slotted-waveguide")
{
npowercombiners += 1;
fPowerCombiner = new SlottedWaveguide;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring slotted waveguide.");
exit(-1);
}
fAntennaElementPositioner = new AntennaElementPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring antenna element positioner.");
exit(-1);
}
}

if(aParam["power-combining-feed"]().as_string() == "single-patch")
if(tParam["power-combining-feed"]().as_string() == "single-patch")
{
npowercombiners += 1;
fPowerCombiner = new SinglePatch;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring single patch.");
exit(-1);
}
fAntennaElementPositioner = new SinglePatchPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring single patch positioner.");
exit(-1);
}
}

if(aParam["power-combining-feed"]().as_string() == "corporate")
if(tParam["power-combining-feed"]().as_string() == "corporate")
{
npowercombiners += 1;
fPowerCombiner = new CorporateFeed;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring corporate feed.");
exit(-1);
}
fAntennaElementPositioner = new AntennaElementPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring antenna element positioner.");
exit(-1);
}
}

if(aParam["power-combining-feed"]().as_string() == "s-matrix")
if(tParam["power-combining-feed"]().as_string() == "s-matrix")
{
npowercombiners += 1;
fPowerCombiner = new SMatrix;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring s matrix.");
exit(-1);
}
fAntennaElementPositioner = new AntennaElementPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring antenna element positioner.");
exit(-1);
}
}


if((aParam["power-combining-feed"]().as_string() == "unit-cell-one-quarter")||
(aParam["power-combining-feed"]().as_string() == "unit-cell-seven-eighths")||
(aParam["power-combining-feed"]().as_string() == "unit-cell-nine-sixteenths"))
if((tParam["power-combining-feed"]().as_string() == "unit-cell-one-quarter")||
(tParam["power-combining-feed"]().as_string() == "unit-cell-seven-eighths")||
(tParam["power-combining-feed"]().as_string() == "unit-cell-nine-sixteenths"))
{
npowercombiners += 1;
fPowerCombiner = new UnitCell;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring unit cell.");
exit(-1);
}
fAntennaElementPositioner = new AntennaElementPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring antenna element positioner.");
exit(-1);
}
}


if(aParam["power-combining-feed"]().as_string() == "series-feed")
if(tParam["power-combining-feed"]().as_string() == "series-feed")
{
npowercombiners += 1;
fPowerCombiner = new SeriesFeed;
if(!fPowerCombiner->Configure(aParam))
if(!fPowerCombiner->Configure(tParam))
{
LERROR(lmclog,"Error configuring series feed.");
}
fAntennaElementPositioner = new AntennaElementPositioner;
if(!fAntennaElementPositioner->Configure(aParam))
if(!fAntennaElementPositioner->Configure(tParam))
{
LERROR(lmclog,"Error configuring antenna element positioner.");
exit(-1);
Expand All @@ -203,15 +217,15 @@ namespace locust
}


if( aParam.has( "transmitter" ))
if( tParam.has( "transmitter" ))
{
int ntransmitters = 0;

if(aParam["transmitter"]().as_string() == "antenna")
if(tParam["transmitter"]().as_string() == "antenna")
{
ntransmitters += 1;
fTransmitter = new AntennaSignalTransmitter;
if(!fTransmitter->Configure(aParam))
if(!fTransmitter->Configure(tParam))
{
LERROR(lmclog,"Error Configuring antenna signal transmitter class");
}
Expand All @@ -221,22 +235,22 @@ namespace locust
}
}

if(aParam["transmitter"]().as_string() == "planewave")
if(tParam["transmitter"]().as_string() == "planewave")
{
ntransmitters += 1;
fTransmitter = new PlaneWaveTransmitter;
if(!fTransmitter->Configure(aParam))
if(!fTransmitter->Configure(tParam))
{
LERROR(lmclog,"Error Configuring planewave transmitter class");
}

}

if(aParam["transmitter"]().as_string() == "kassiopeia")
if(tParam["transmitter"]().as_string() == "kassiopeia")
{
ntransmitters += 1;
fTransmitter = new KassTransmitter;
if(!fTransmitter->Configure(aParam))
if(!fTransmitter->Configure(tParam))
{
LERROR(lmclog,"Error Configuring kassiopeia transmitter class");
}
Expand All @@ -256,22 +270,40 @@ namespace locust
}


if(!fTFReceiverHandler.Configure(aParam))
if(!fTFReceiverHandler.Configure(tParam))
{
LERROR(lmclog,"Error configuring receiver FIRHandler class");
}

if( aParam.has( "buffer-size" ) )
if( tParam.has( "buffer-size" ) )
{
fFieldBufferSize = aParam["buffer-size"]().as_int();
fHilbertTransform.SetBufferSize(aParam["buffer-size"]().as_int());
fFieldBufferSize = tParam["buffer-size"]().as_int();
fHilbertTransform.SetBufferSize(tParam["buffer-size"]().as_int());
}

if(!fHilbertTransform.Configure(aParam))
if(!fHilbertTransform.Configure(tParam))
{
LERROR(lmclog,"Error configuring buffer sizes in receiver HilbertTransform class");
}




fInterface->fConfigureKass = new ConfigureKass();
fInterface->fConfigureKass->SetParameters( tParam );

return true;
}




bool ArraySignalGenerator::Configure( const scarab::param_node& aParam )
{

SetParameters( aParam );


if( aParam.has( "lo-frequency" ) )
{
fLO_Frequency = aParam["lo-frequency"]().as_double();
Expand Down Expand Up @@ -328,6 +360,17 @@ namespace locust
return true;
}

bool ArraySignalGenerator::RecordRunParameters( Signal* aSignal )
{
fInterface->aRunParameter = new RunParameters();
fInterface->aRunParameter->fSamplingRateMHz = fAcquisitionRate;
fInterface->aRunParameter->fDecimationFactor = aSignal->DecimationFactor();
fInterface->aRunParameter->fLOfrequency = fLO_Frequency;

return true;
}


void ArraySignalGenerator::Accept( GeneratorVisitor* aVisitor ) const
{
aVisitor->Visit( this );
Expand Down Expand Up @@ -620,6 +663,9 @@ namespace locust
bool ArraySignalGenerator::DoGenerate( Signal* aSignal )
{

ConfigureInterface( aSignal );
RecordRunParameters( aSignal );

if(!InitializeElementArray())
{
LERROR(lmclog,"Error configuring Element array");
Expand Down
7 changes: 7 additions & 0 deletions Source/Generators/LMCArraySignalGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ namespace locust
virtual ~ArraySignalGenerator();

bool Configure( const scarab::param_node& aNode );
bool ConfigureInterface(Signal* aSignal);
bool RecordRunParameters(Signal* aSignal);
const scarab::param_node* GetParameters();
void SetParameters( const scarab::param_node& aNode );


void Accept( GeneratorVisitor* aVisitor ) const;

Expand Down Expand Up @@ -124,6 +129,8 @@ namespace locust
HilbertTransform fHilbertTransform;

kl_interface_ptr_t fInterface;
const scarab::param_node* fParam;



};
Expand Down
15 changes: 15 additions & 0 deletions Source/Generators/LMCCavitySignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ namespace locust
}
else
{
// Delay SetSeed to allow time stamp to advance between randomized tracks.
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
SetSeed (time(NULL) );
}
}
Expand Down Expand Up @@ -298,6 +300,18 @@ namespace locust
return true;
}

bool CavitySignalGenerator::RecordRunParameters( Signal* aSignal )
{
fInterface->aRunParameter = new RunParameters();
fInterface->aRunParameter->fSamplingRateMHz = fAcquisitionRate;
fInterface->aRunParameter->fDecimationFactor = aSignal->DecimationFactor();
fInterface->aRunParameter->fLOfrequency = fLO_Frequency;

return true;
}



bool CavitySignalGenerator::SetSeed(int aSeed)
{
LPROG(lmclog,"Setting random seed for track delay to " << aSeed);
Expand Down Expand Up @@ -564,6 +578,7 @@ namespace locust
bool CavitySignalGenerator::DoGenerateTime( Signal* aSignal )
{
ConfigureInterface( aSignal );
RecordRunParameters( aSignal );

if (fRandomPreEventSamples) RandomizeStartDelay();

Expand Down
1 change: 1 addition & 0 deletions Source/Generators/LMCCavitySignalGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace locust

bool Configure( const scarab::param_node& aNode );
bool ConfigureInterface(Signal* aSignal);
bool RecordRunParameters(Signal* aSignal);
bool CrossCheckCavityConfig();
bool CrossCheckAliasing(Signal* aSignal, double dopplerFrequency );

Expand Down
Loading

0 comments on commit 748efbf

Please sign in to comment.