Skip to content

Commit

Permalink
Merged develop into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
pslocum committed Feb 6, 2021
2 parents aec0973 + 5d37c09 commit 20afe64
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 27 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.1.5)
project( locust_mc VERSION 2.1.6)

list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake )
include( PackageBuilder )
Expand Down
20 changes: 11 additions & 9 deletions Config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ configure_file( LocustTestSignal.json.in LocustTestSignal.json )
configure_file( plotfieldmap.c.in plotfieldmap.c )
configure_file( katydid.json.in katydid.json )
configure_file( ChannelAggregatorConfig.yaml.in ChannelAggregatorConfig.yaml )
configure_file( LocustBlankTemplate.json.in LocustBlankTemplate.json )


set (EXAMPLE_CONFIGFILES
Expand All @@ -23,15 +24,16 @@ set (EXAMPLE_CONFIGFILES
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_FreeSpace_Template.xml
WaveguideGeometry.xml
FreeSpaceGeometry.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustWaveguideTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustFreeSpaceTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustPlaneWaveTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustFakeTrack.json
${CMAKE_CURRENT_BINARY_DIR}/LocustMagDipoleAntennaTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustTestSignal.json
${CMAKE_CURRENT_BINARY_DIR}/katydid.json
${CMAKE_CURRENT_BINARY_DIR}/ChannelAggregatorConfig.yaml
${CMAKE_CURRENT_BINARY_DIR}/plotfieldmap.c
${CMAKE_CURRENT_BINARY_DIR}/LocustWaveguideTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustFreeSpaceTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustPlaneWaveTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustFakeTrack.json
${CMAKE_CURRENT_BINARY_DIR}/LocustMagDipoleAntennaTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustTestSignal.json
${CMAKE_CURRENT_BINARY_DIR}/katydid.json
${CMAKE_CURRENT_BINARY_DIR}/ChannelAggregatorConfig.yaml
${CMAKE_CURRENT_BINARY_DIR}/LocustBlankTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/plotfieldmap.c
)

pbuilder_install_config (${EXAMPLE_CONFIGFILES})
39 changes: 39 additions & 0 deletions Config/LocustBlankTemplate.json.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"generators":
[
"digitizer"
],

"lpf-fft":
{

},

"decimate-signal":
{

},


"simulation":
{
"egg-filename": "${CMAKE_INSTALL_PREFIX}/output/locust_mc.egg",
"n-records": 1,
"record-size": 8192,
"n-channels": 1
},

"gaussian-noise":
{
"noise-floor-psd": 2.76e-22,
"domain": "time"
},

"digitizer":
{
"v-range": 2.0e-5,
"v-offset": -1.0e-5
}

}

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM project8/p8compute_dependencies:v0.9.0 as locust_common
ARG build_type=Release
ENV LOCUST_BUILD_TYPE=$build_type

ENV LOCUST_TAG=v2.1.5
ENV LOCUST_TAG=v2.1.6
ENV LOCUST_BUILD_PREFIX=/usr/local/p8/locust/$LOCUST_TAG

RUN mkdir -p $LOCUST_BUILD_PREFIX &&\
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ After running Katydid, the processed fft spectra will have a span from 0 to the

### Tutorial

A tutorial with examples is located in the locust-tutorial repository, [here](https://github.com/project8/locust-tutorial).
Tutorials with examples are located in the locust-tutorial repository, [here](https://github.com/project8/locust-tutorial).

Issues should be posted via [GitHub](https://github.com/project8/locust_mc/issues).

Expand Down Expand Up @@ -151,7 +151,6 @@ and to mount a local directory for e.g. I/O to the container
Directory Structure
-------------------
Expand Down
21 changes: 17 additions & 4 deletions Source/Core/LMCGeneratorToolbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "factory.hh"


namespace locust
{
LOGGER( lmclog, "GeneratorToolbox" );
Expand Down Expand Up @@ -44,6 +45,13 @@ namespace locust
// TODO: this line will throw an exception if "generators" is not present or it's not an array
// TODO: this should either check that those are the case and return false if not, or
// TODO: catch the exception and then return false

if (!(aNode.has("generators")&&aNode["generators"].is_array()))
{
LERROR( lmclog, "generators array is either not present or not an array." );
return false;
}

const scarab::param_array& generatorList = aNode["generators"].as_array();


Expand All @@ -56,7 +64,7 @@ namespace locust
if( ! it->is_value() )
{
LERROR( lmclog, "Non-value-type array element found in generator-list" );
// TODO: this indicates a problem in the config and should result in locust exiting
exit(-1);
continue;
}
// else
Expand All @@ -69,7 +77,7 @@ namespace locust
if( newGenerator == nullptr )
{
LERROR( lmclog, "Unrecognized generator name: " << (*it)().as_string() );
// TODO: this should also be a fatal error
exit(-1);
continue;
}

Expand Down Expand Up @@ -98,10 +106,15 @@ namespace locust
if( ! aNode.has( nextGenerator->GetName() ) )
{
LDEBUG( lmclog, "No configuration information present" );
nextGenerator = nextGenerator->GetNextGenerator();
continue;
}
nextGenerator->Configure( aNode[ nextGenerator->GetName() ].as_node() );
nextGenerator = nextGenerator->GetNextGenerator();
else
{
nextGenerator->Configure( aNode[ nextGenerator->GetName() ].as_node() );
nextGenerator = nextGenerator->GetNextGenerator();
}

}

LINFO( lmclog, "Generator toolbox configuration complete" );
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/LMCGeneratorToolbox.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#ifndef LMCGENERATORTOOLBOX_HH_
#define LMCGENERATORTOOLBOX_HH_

#include "LMCException.hh"

namespace scarab
{
Expand Down
24 changes: 20 additions & 4 deletions Source/Generators/LMCArraySignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ namespace locust

}

if (fInterface->fPreEventInProgress)
if (fInterface->fPreEventInProgress) // Locust keeps sampling until Kass event.
{
PreEventCounter += 1;

Expand All @@ -622,13 +622,14 @@ namespace locust
fInterface->fEventInProgress = true;
LPROG( lmclog, "LMC about to WakeBeforeEvent()" );
WakeBeforeEvent(); // trigger Kass event.
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}

if ((fInterface->fEventInProgress)&&(!fInterface->fKassEventReady)) // fEventInProgress
if (fInterface->fEventInProgress) // fEventInProgress
{
std::unique_lock< std::mutex >tLock( fInterface->fMutexDigitizer, std::defer_lock );
std::unique_lock< std::mutex >tLock( fInterface->fMutexDigitizer, std::defer_lock );
if (!fInterface->fKassEventReady) // Kass confirms event is underway.
{
tLock.lock();
fInterface->fDigitizerCondition.wait( tLock );
if (fInterface->fEventInProgress)
Expand All @@ -637,6 +638,21 @@ namespace locust
PreEventCounter = 0; // reset
}
tLock.unlock();
}
else // either Kass thread fell behind, or it has stopped generating events.
{
tLock.lock();
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
if (!fInterface->fKassEventReady) // Kass event did start. Continue but skip this sample.
{
tLock.unlock();
}
else // no Kass event ever started, unlock and break out of signal loop entirely.
{
tLock.unlock();
break;
}
}
}
} // for loop

Expand Down
43 changes: 39 additions & 4 deletions Source/Generators/LMCTemplateGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace locust
MT_REGISTER_GENERATOR([name]Generator, "config-name");

[name]Generator::[name]Generator( const std::string& aName ) :
Generator( aName )
Generator( aName ),
fDoGenerateFunc( &[name]Generator::DoGenerateTime )
{
fRequiredSignalState = Signal::k[domain];
}
Expand All @@ -36,13 +37,47 @@ namespace locust
return;
}

bool [name]Generator::DoGenerate( Signal* aSignal )
Signal::State [name]Generator::GetDomain() const
{
return fRequiredSignalState;
}

void [name]Generator::SetDomain( Signal::State aDomain )
{
for( unsigned index = 0; index < aSignal->[domain]Size(); ++index )
if( aDomain == fRequiredSignalState ) return;
fRequiredSignalState = aDomain;
if( fRequiredSignalState == Signal::kTime )
{
fDoGenerateFunc = &[name]Generator::DoGenerateTime;
}
else if( fRequiredSignalState == Signal::kFreq )
{
aSignal->Signal[domain]S( index ) += ???;
fDoGenerateFunc = &[name]Generator::DoGenerateFreq;
}
else
{
LWARN( lmclog, "Unknown domain requested: " << aDomain );
}
return;
}


bool [name]Generator::DoGenerate( Signal* aSignal )
{
return (this->*fDoGenerateFunc)( aSignal );
}

bool [name]Generator::DoGenerateTime( Signal* aSignal )
{
// aSignal->SignalTimeComplex()[index][0] += [...]
// aSignal->SignalTimeComplex()[index][1] += [...]
return true;
}

bool [name]Generator::DoGenerateFreq( Signal* aSignal )
{
return true;
}


} /* namespace locust */
10 changes: 9 additions & 1 deletion Source/Generators/LMCTemplateGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ namespace locust

void Accept( GeneratorVisitor* aVisitor ) const;

Signal::State GetDomain() const;
void SetDomain( Signal::State aDomain );


private:
bool DoGenerate( Signal* aSignal ) const;
bool DoGenerate( Signal* aSignal );
bool DoGenerateTime( Signal* aSignal );
bool DoGenerateFreq( Signal* aSignal );

bool ([name]Generator::*fDoGenerateFunc)( Signal* aSignal );

};

Expand Down

0 comments on commit 20afe64

Please sign in to comment.