Class: URBANopt::Scenario::ScenarioDefaultPostProcessor
- Inherits:
-
ScenarioPostProcessorBase
- Object
- ScenarioPostProcessorBase
- URBANopt::Scenario::ScenarioDefaultPostProcessor
- Defined in:
- lib/urbanopt/scenario/scenario_post_processor_default.rb
Instance Attribute Summary
Attributes inherited from ScenarioPostProcessorBase
Instance Method Summary collapse
-
#add_simulation_dir(simulation_dir) ⇒ Object
Add results from a simulation_dir to this result.
-
#initialize(scenario_base) ⇒ ScenarioDefaultPostProcessor
constructor
ScenarioPostProcessorBase post-processes a scenario to create scenario level results.
-
#run ⇒ Object
Run the post processor on this Scenario.This will add all the simulation_dirs.
-
#save(file_name = 'default_scenario_report') ⇒ Object
Save scenario result.
Constructor Details
#initialize(scenario_base) ⇒ ScenarioDefaultPostProcessor
ScenarioPostProcessorBase post-processes a scenario to create scenario level results
- parameters:
-
scenario_base- ScenarioBase - An object of ScenarioBase class.
47 48 49 50 51 52 53 54 |
# File 'lib/urbanopt/scenario/scenario_post_processor_default.rb', line 47 def initialize(scenario_base) super(scenario_base) initialization_hash = { directory_name: scenario_base.run_dir, name: scenario_base.name, id: scenario_base.name } @scenario_result = URBANopt::Scenario::DefaultReports::ScenarioReport.new(initialization_hash) @@logger ||= URBANopt::Scenario::DefaultReports.logger end |
Instance Method Details
#add_simulation_dir(simulation_dir) ⇒ Object
Add results from a simulation_dir to this result.
- parameters:
-
simulation_dir- SimulationDirOSW - An object on SimulationDirOSW class.
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/urbanopt/scenario/scenario_post_processor_default.rb', line 72 def add_simulation_dir(simulation_dir) feature_reports = URBANopt::Scenario::DefaultReports::FeatureReport.from_simulation_dir(simulation_dir) feature_reports.each do |feature_report| if feature_report.to_hash[:simulation_status] == 'Complete' @scenario_result.add_feature_report(feature_report) else @@logger.error("Feature #{feature_report.id} failed to run!") end end return feature_reports end |
#run ⇒ Object
Run the post processor on this Scenario.This will add all the simulation_dirs.
59 60 61 62 63 64 65 |
# File 'lib/urbanopt/scenario/scenario_post_processor_default.rb', line 59 def run # this run method adds all the simulation_dirs, you can extend it to do more custom stuff @scenario_base.simulation_dirs.each do |simulation_dir| add_simulation_dir(simulation_dir) end return @scenario_result end |
#save(file_name = 'default_scenario_report') ⇒ Object
Save scenario result
- parameters:
-
file_name- String - Assign a name to the saved scenario results file
91 92 93 94 95 |
# File 'lib/urbanopt/scenario/scenario_post_processor_default.rb', line 91 def save(file_name = 'default_scenario_report') @scenario_result.save return @scenario_result end |