Skip to content

Commit

Permalink
Solved bug with exportToFile and legacyEnergyModel flags in PyHelios
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoesmp committed Dec 21, 2023
1 parent 3d69c33 commit a99ccd6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions pyhelios/simulation_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SimulationBuilder:
fullwaveNoise -- Compute fullwave noise enabling flag
platformNoiseDisabled -- Platform noise disabling flag
exportToFile -- Export to file enabling flag
legacyEnergyModel -- Legacy energy model enabling flag
callback -- Callback function to be used when callbackFrequency is
greater than 0. It can be None, then no callbacks will occur
rotateFilters -- List of rotate filters to apply
Expand Down Expand Up @@ -94,6 +95,7 @@ def makeDefault(self):
self.setCalcEchowidth(False)
self.setFullwaveNoise(False)
self.setPlatformNoiseDisabled(True)
self.setLegacyEnergyModel(False)
self.setExportToFile(True)
self.setCallback(None)
self.rotateFilters = []
Expand All @@ -118,6 +120,7 @@ def build(self):
)
build.sim.callbackFrequency = self.callbackFrequency
build.sim.finalOutput = self.finalOutput
build.sim.legacyEnergyModel = self.legacyEnergyModel
build.sim.exportToFile = self.exportToFile
build.sim.loadSurvey(
self.legNoiseDisabled,
Expand Down Expand Up @@ -162,6 +165,9 @@ def build(self):
# --- GETTERS and SETTERS --- #
# ----------------------------- #
def setSurveyPath(self, surveyPath):
# TODO Remove ---
print(f'surveyPath: "{surveyPath}"')
# --- TODO Remove
self.validatePath(surveyPath)
self.surveyPath = surveyPath

Expand Down Expand Up @@ -254,6 +260,10 @@ def setPlatformNoiseDisabled(self, platformNoiseDisabled):
self.validateBoolean(platformNoiseDisabled)
self.platformNoiseDisabled = platformNoiseDisabled

def setLegacyEnergyModel(self, legacyEnergyModel):
self.validateBoolean(legacyEnergyModel)
self.legacyEnergyModel = legacyEnergyModel

def setExportToFile(self, exportToFile):
self.validateBoolean(exportToFile)
self.exportToFile = exportToFile
Expand Down
2 changes: 1 addition & 1 deletion src/main/helios_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const char * HELIOS_VERSION = "1.3.0";

const char * HELIOS_GIT_HASH = "69ceeafa";
const char * HELIOS_GIT_HASH = "3d69c33f";

const char * getHeliosVersion(){
return HELIOS_VERSION;
Expand Down
5 changes: 5 additions & 0 deletions src/pybinds/PyHelios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ BOOST_PYTHON_MODULE(_pyhelios){
&PyHeliosSimulation::finalOutput,
&PyHeliosSimulation::finalOutput
)
.add_property(
"legacyEnergyModel",
&PyHeliosSimulation::legacyEnergyModel,
&PyHeliosSimulation::legacyEnergyModel
)
.add_property(
"exportToFile",
&PyHeliosSimulation::exportToFile,
Expand Down
1 change: 1 addition & 0 deletions src/pybinds/PyHeliosSimulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ void PyHeliosSimulation::start (){
pulseThreadPool,
chunkSize,
fixedGpsTimeStart,
legacyEnergyModel,
exportToFile
);
playback->callback = callback;
Expand Down
1 change: 1 addition & 0 deletions src/pybinds/PyHeliosSimulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class PyHeliosSimulation{
int warehouseFactor = 1;
public:
bool finalOutput = true;
bool legacyEnergyModel = false;
bool exportToFile = true;

// *** CONSTRUCTION / DESTRUCTION *** //
Expand Down
2 changes: 1 addition & 1 deletion src/sim/core/SurveyPlayback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SurveyPlayback::SurveyPlayback(
int const chunkSize,
std::string fixedGpsTimeStart,
bool const legacyEnergyModel,
bool exportToFile
bool const exportToFile
):
Simulation(
parallelizationStrategy,
Expand Down

0 comments on commit a99ccd6

Please sign in to comment.