diff --git a/Rakefile b/Rakefile
index db965c9c32..5b6cc1935a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -33,7 +33,7 @@ namespace :test do
t.warning = false
t.verbose = true
end
-
+
desc 'Test creating measure osws'
Rake::TestTask.new('measures_osw') do |t|
t.libs << 'test'
diff --git a/measures/ScoutInputReport/measure.rb b/measures/ScoutInputReport/measure.rb
new file mode 100644
index 0000000000..db877a8353
--- /dev/null
+++ b/measures/ScoutInputReport/measure.rb
@@ -0,0 +1,116 @@
+require 'openstudio'
+if File.exists? File.absolute_path(File.join(File.dirname(__FILE__), "../../lib/resources/measures/HPXMLtoOpenStudio/resources")) # Hack to run ResStock on AWS
+ resources_path = File.absolute_path(File.join(File.dirname(__FILE__), "../../lib/resources/measures/HPXMLtoOpenStudio/resources"))
+elsif File.exists? File.absolute_path(File.join(File.dirname(__FILE__), "../../resources/measures/HPXMLtoOpenStudio/resources")) # Hack to run ResStock unit tests locally
+ resources_path = File.absolute_path(File.join(File.dirname(__FILE__), "../../resources/measures/HPXMLtoOpenStudio/resources"))
+elsif File.exists? File.join(OpenStudio::BCLMeasure::userMeasuresDir.to_s, "HPXMLtoOpenStudio/resources") # Hack to run measures in the OS App since applied measures are copied off into a temporary directory
+ resources_path = File.join(OpenStudio::BCLMeasure::userMeasuresDir.to_s, "HPXMLtoOpenStudio/resources")
+else
+ resources_path = File.absolute_path(File.join(File.dirname(__FILE__), "../HPXMLtoOpenStudio/resources"))
+end
+
+# start the measure
+class ScoutInputReport < OpenStudio::Measure::ReportingMeasure
+ # define the name that a user will see, this method may be deprecated as
+ # the display name in PAT comes from the name field in measure.xml
+ def name
+ # Measure name should be the title case of the class name.
+ return "Scout Input Report"
+ end
+
+ def description
+ return "Create Scout inputs from ResStock outputs."
+ end
+
+ # define the arguments that the user will input
+ def arguments
+ args = OpenStudio::Measure::OSArgumentVector.new
+
+ return args
+ end # end the arguments method
+
+ # return a vector of IdfObject's to request EnergyPlus objects needed by the run method
+ def energyPlusOutputRequests(runner, user_arguments)
+ super(runner, user_arguments)
+
+ results = OpenStudio::IdfObjectVector.new
+
+ # TODO
+
+ return results
+ end
+
+ def outputs
+ scout_inputs = [
+ "heating",
+ "cooling",
+ "ventilation",
+ "lighting",
+ "refrigeration",
+ "water_heating",
+ "mels",
+ "pcs"
+ ] # TODO
+
+ result = OpenStudio::Measure::OSOutputVector.new
+ scout_inputs.each do |output|
+ result << OpenStudio::Measure::OSOutput.makeDoubleOutput(output)
+ end
+ return result
+ end
+
+ # define what happens when the measure is run
+ def run(runner, user_arguments)
+ super(runner, user_arguments)
+
+ # use the built-in error checking
+ if not runner.validateUserArguments(arguments(), user_arguments)
+ return false
+ end
+
+ # get the last model and sql file
+ model = runner.lastOpenStudioModel
+ if model.empty?
+ runner.registerError("Cannot find last model.")
+ return false
+ end
+ model = model.get
+
+ sqlFile = runner.lastEnergyPlusSqlFile
+ if sqlFile.empty?
+ runner.registerError("Cannot find last sql file.")
+ return false
+ end
+ sqlFile = sqlFile.get
+ model.setSqlFile(sqlFile)
+
+ # TODO: below is for testing on buildstockbatch
+ report_sim_output(runner, "heating", 1, "GJ", "GJ")
+ report_sim_output(runner, "cooling", 2, "GJ", "GJ")
+ report_sim_output(runner, "ventilation", 3, "GJ", "GJ")
+ report_sim_output(runner, "lighting", 4, "GJ", "GJ")
+ report_sim_output(runner, "refrigeration", 5, "GJ", "GJ")
+ report_sim_output(runner, "water_heating", 6, "GJ", "GJ")
+ report_sim_output(runner, "MELS", 7, "GJ", "GJ")
+ report_sim_output(runner, "PCs", 8, "GJ", "GJ")
+
+ # close the sql file
+ sqlFile.close
+
+ return true
+ end # end the run method
+
+ def report_sim_output(runner, name, total_val, os_units, desired_units, percent_of_val = 1.0)
+ total_val = total_val * percent_of_val
+ if os_units.nil? or desired_units.nil? or os_units == desired_units
+ valInUnits = total_val
+ else
+ valInUnits = UnitConversions.convert(total_val, os_units, desired_units)
+ end
+ runner.registerValue(name, valInUnits)
+ runner.registerInfo("Registering #{valInUnits.round(2)} for #{name}.")
+ end
+end
+
+# register the measure to be used by the application
+ScoutInputReport.new.registerWithApplication
diff --git a/measures/ScoutInputReport/measure.xml b/measures/ScoutInputReport/measure.xml
new file mode 100644
index 0000000000..3c6bf18c41
--- /dev/null
+++ b/measures/ScoutInputReport/measure.xml
@@ -0,0 +1,101 @@
+
+ 3.0
+ scout_input_report
+ 8eac2843-d645-435d-89fd-e1fad6fd0520
+ 70d147af-4e4d-4739-b9f9-7b85664948b2
+ 20190724T224447Z
+ 15BF4E57
+ ScoutInputReport
+ Scout Input Report
+ Create Scout inputs from ResStock outputs.
+ TODO
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Reporting.QAQC
+
+
+
+ Measure Type
+ ReportingMeasure
+ string
+
+
+
+
+
+ OpenStudio
+ 2.8.1
+ 2.8.1
+
+ measure.rb
+ rb
+ script
+ 2DEC0AFA
+
+
+ scout_input_report.rb
+ rb
+ test
+ 7ADD31B7
+
+
+
diff --git a/measures/ScoutInputReport/tests/scout_input_report.rb b/measures/ScoutInputReport/tests/scout_input_report.rb
new file mode 100644
index 0000000000..ee6f7b4f71
--- /dev/null
+++ b/measures/ScoutInputReport/tests/scout_input_report.rb
@@ -0,0 +1,24 @@
+require_relative '../../../test/minitest_helper'
+require 'openstudio'
+require 'openstudio/ruleset/ShowRunnerOutput'
+require 'minitest/autorun'
+require_relative '../measure.rb'
+require 'fileutils'
+
+class ScoutInputReportTest < MiniTest::Test
+ def test
+ end
+
+ private
+
+ def _test_cost_multipliers(osm_file, cost_multipliers)
+ # load the test model
+ model = get_model(File.dirname(__FILE__), osm_file)
+
+ # create an instance of the measure
+ measure = SimulationOutputReport.new
+
+ # create an instance of a runner
+ runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
+ end
+end
diff --git a/resources/measures/HPXMLtoOpenStudio/measure.xml b/resources/measures/HPXMLtoOpenStudio/measure.xml
index 331ebecf73..34ef2840e3 100644
--- a/resources/measures/HPXMLtoOpenStudio/measure.xml
+++ b/resources/measures/HPXMLtoOpenStudio/measure.xml
@@ -2,8 +2,8 @@
3.0
hpxml_translator
b1543b30-9465-45ff-ba04-1d1f85e763bc
- c29662fb-a712-46d1-9e6c-8d2172375948
- 20190715T222817Z
+ 05590eeb-e8d0-4232-8fcc-c957bdb9c173
+ 20190724T224449Z
D8922A73
HPXMLTranslator
HPXML Translator
@@ -405,12 +405,6 @@
resource
303BBC7F
-
- geometry.rb
- rb
- resource
- 5E186703
-
weather.rb
rb
@@ -489,5 +483,11 @@
resource
B67B4B21
+
+ geometry.rb
+ rb
+ resource
+ 7597B2E5
+
diff --git a/test/test_measures_osw.rb b/test/test_measures_osw.rb
index 1fc7a1a512..a97f4ae41c 100644
--- a/test/test_measures_osw.rb
+++ b/test/test_measures_osw.rb
@@ -35,7 +35,7 @@ def test_measures_osw
FileUtils.rm_rf(File.join(parent_dir, "run"))
FileUtils.rm_rf(File.join(parent_dir, "reports"))
end
-
+
def run_and_check(in_osw, parent_dir, measures_osw_dir, building_id)
# Create measures.osw
cli_path = OpenStudio.getOpenStudioCLI
@@ -54,10 +54,10 @@ def run_and_check(in_osw, parent_dir, measures_osw_dir, building_id)
end
def create_buildstock_csv(project_dir, num_samples)
- outfile = File.join("..", "test", "test_measures_osw", "buildstock.csv")
+ outfile = File.join("..", "test", "test_measures_osw", "buildstock.csv")
r = RunSampling.new
r.run(project_dir, num_samples, outfile)
-
+
return outfile
end
@@ -80,12 +80,12 @@ def create_weather_folder(parent_dir, project_dir)
return des
end
-
+
def change_building_id(osw, building_id)
json = JSON.parse(File.read(osw), symbolize_names: true)
json[:steps].each do |measure|
next if measure[:measure_dir_name] != "BuildExistingModel"
-
+
measure[:arguments][:building_id] = "#{building_id}"
end
File.open(osw, "w") do |f|