openstudio-calibration 0.1.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +40 -8
- data/Gemfile +6 -3
- data/Jenkinsfile +7 -2
- data/LICENSE.md +1 -1
- data/README.md +15 -4
- data/Rakefile +6 -6
- data/doc_templates/LICENSE.md +1 -1
- data/doc_templates/copyright_erb.txt +1 -1
- data/doc_templates/copyright_js.txt +1 -1
- data/doc_templates/copyright_ruby.txt +1 -1
- data/lib/measures/AddMonthlyJSONUtilityData/LICENSE.md +1 -1
- data/lib/measures/AddMonthlyJSONUtilityData/measure.rb +1 -1
- data/lib/measures/AddMonthlyJSONUtilityData/measure.xml +12 -11
- data/lib/measures/AddMonthlyUtilityData/LICENSE.md +1 -1
- data/lib/measures/AddMonthlyUtilityData/measure.rb +1 -1
- data/lib/measures/AddMonthlyUtilityData/measure.xml +13 -12
- data/lib/measures/CalibrationReports/LICENSE.md +1 -1
- data/lib/measures/CalibrationReports/README.md +2 -2
- data/lib/measures/CalibrationReports/measure.rb +1 -1
- data/lib/measures/CalibrationReports/measure.xml +11 -11
- data/lib/measures/CalibrationReportsEnhanced/LICENSE.md +1 -1
- data/lib/measures/CalibrationReportsEnhanced/measure.rb +2 -2
- data/lib/measures/CalibrationReportsEnhanced/measure.xml +18 -17
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.xml +14 -13
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.xml +14 -13
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.xml +14 -13
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.xml +14 -13
- data/lib/measures/CoilCoolingWaterMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingWaterMultiplier/measure.rb +1 -1
- data/lib/measures/CoilCoolingWaterMultiplier/measure.xml +14 -13
- data/lib/measures/CoilCoolingWaterPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingWaterPercentChange/measure.rb +1 -1
- data/lib/measures/CoilCoolingWaterPercentChange/measure.xml +14 -13
- data/lib/measures/CoilHeatingElectricMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingElectricMultiplier/measure.rb +1 -1
- data/lib/measures/CoilHeatingElectricMultiplier/measure.xml +14 -13
- data/lib/measures/CoilHeatingElectricPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingElectricPercentChange/measure.rb +1 -1
- data/lib/measures/CoilHeatingElectricPercentChange/measure.xml +14 -13
- data/lib/measures/CoilHeatingGasMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingGasMultiplier/measure.rb +1 -1
- data/lib/measures/CoilHeatingGasMultiplier/measure.xml +14 -13
- data/lib/measures/CoilHeatingGasPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingGasPercentChange/measure.rb +1 -1
- data/lib/measures/CoilHeatingGasPercentChange/measure.xml +14 -13
- data/lib/measures/CoilHeatingWaterMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingWaterMultiplier/measure.rb +1 -1
- data/lib/measures/CoilHeatingWaterMultiplier/measure.xml +14 -13
- data/lib/measures/CoilHeatingWaterPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingWaterPercentChange/measure.rb +1 -1
- data/lib/measures/CoilHeatingWaterPercentChange/measure.xml +14 -13
- data/lib/measures/ConstructionLayerZeroMaterialProperties/LICENSE.md +1 -1
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.rb +1 -1
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.xml +12 -11
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/LICENSE.md +1 -1
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.rb +1 -1
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.xml +12 -11
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/LICENSE.md +1 -1
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.rb +3 -3
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.xml +24 -11
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/LICENSE.md +1 -1
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.rb +3 -3
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.xml +24 -11
- data/lib/measures/FansMultiplier/LICENSE.md +1 -1
- data/lib/measures/FansMultiplier/measure.rb +1 -1
- data/lib/measures/FansMultiplier/measure.xml +14 -13
- data/lib/measures/FansPercentChange/LICENSE.md +1 -1
- data/lib/measures/FansPercentChange/measure.rb +1 -1
- data/lib/measures/FansPercentChange/measure.xml +14 -13
- data/lib/measures/GeneralCalibrationMeasureMultiplier/LICENSE.md +1 -1
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.rb +1 -1
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.xml +16 -15
- data/lib/measures/GeneralCalibrationMeasurePercentChange/LICENSE.md +1 -1
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.rb +1 -1
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.xml +16 -15
- data/lib/measures/HardSizeHvac/LICENSE.md +1 -1
- data/lib/measures/HardSizeHvac/measure.rb +1 -1
- data/lib/measures/HardSizeHvac/measure.xml +13 -12
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/LICENSE.md +1 -1
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.rb +1 -1
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.xml +12 -11
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/LICENSE.md +1 -1
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.rb +1 -1
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.xml +12 -11
- data/lib/measures/RoofThermalPropertiesMultiplier/LICENSE.md +1 -1
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.rb +3 -3
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.xml +24 -11
- data/lib/measures/RoofThermalPropertiesPercentChange/LICENSE.md +1 -1
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.rb +3 -3
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.xml +24 -11
- data/lib/measures/TimeseriesObjectiveFunction/LICENSE.md +1 -1
- data/lib/measures/TimeseriesObjectiveFunction/README.md +5 -171
- data/lib/measures/TimeseriesObjectiveFunction/measure.rb +3 -7
- data/lib/measures/TimeseriesObjectiveFunction/measure.xml +84 -9
- data/lib/measures/TimeseriesObjectiveFunction/resources/report.html.erb +6 -1
- data/lib/measures/TimeseriesPlot/LICENSE.md +1 -1
- data/lib/measures/TimeseriesPlot/README.md +5 -35
- data/lib/measures/TimeseriesPlot/measure.rb +1 -1
- data/lib/measures/TimeseriesPlot/measure.xml +28 -13
- data/lib/measures/TimeseriesPlot/resources/report.html.erb +6 -1
- data/lib/measures/WaterHeaterMixedMultiplier/LICENSE.md +1 -1
- data/lib/measures/WaterHeaterMixedMultiplier/measure.rb +1 -1
- data/lib/measures/WaterHeaterMixedMultiplier/measure.xml +14 -13
- data/lib/measures/WaterHeaterMixedPercentChange/LICENSE.md +1 -1
- data/lib/measures/WaterHeaterMixedPercentChange/measure.rb +1 -1
- data/lib/measures/WaterHeaterMixedPercentChange/measure.xml +14 -13
- data/lib/measures/{CalibrationReportsEnhanced21 → inspect_and_edit_parametric_schedules}/LICENSE.md +1 -1
- data/lib/measures/inspect_and_edit_parametric_schedules/README.md +41 -0
- data/lib/measures/{zone_report → inspect_and_edit_parametric_schedules}/README.md.erb +12 -1
- data/lib/measures/inspect_and_edit_parametric_schedules/docs/.gitkeep +0 -0
- data/lib/measures/inspect_and_edit_parametric_schedules/docs/apply_measures_now.png +0 -0
- data/lib/measures/inspect_and_edit_parametric_schedules/measure.rb +224 -0
- data/lib/measures/inspect_and_edit_parametric_schedules/measure.xml +125 -0
- data/lib/measures/{zone_report → shift_hours_of_operation}/LICENSE.md +1 -1
- data/lib/measures/shift_hours_of_operation/README.md +147 -0
- data/lib/measures/{MaalkaMonthlyJSONUtilityData → shift_hours_of_operation}/README.md.erb +5 -0
- data/lib/measures/shift_hours_of_operation/docs/.gitkeep +0 -0
- data/lib/measures/shift_hours_of_operation/measure.rb +525 -0
- data/lib/measures/shift_hours_of_operation/measure.xml +280 -0
- data/lib/openstudio/{calibration_measures → calibration}/extension.rb +2 -2
- data/lib/openstudio/{calibration_measures → calibration}/version.rb +3 -3
- data/lib/openstudio/{calibration_measures.rb → calibration.rb} +3 -3
- data/lib/{openstudio-calibration-measures.rb → openstudio-calibration.rb} +2 -2
- data/openstudio-calibration.gemspec +38 -0
- metadata +50 -61
- data/lib/measures/AddMonthlyUtilityData/tests/AddMonthlyUtilityData_Test.rb +0 -88
- data/lib/measures/AddMonthlyUtilityData/tests/electric_billed_usages.json +0 -198
- data/lib/measures/AddMonthlyUtilityData/tests/gas_billed_usages.json +0 -198
- data/lib/measures/CalibrationReports/tests/CalibrationReports_Test.rb +0 -523
- data/lib/measures/CalibrationReports/tests/ExampleModel.osm +0 -10497
- data/lib/measures/CalibrationReports/tests/ExampleModelNoDemandInput.osm +0 -10560
- data/lib/measures/CalibrationReports/tests/ExampleModelNoGasInput.osm +0 -10456
- data/lib/measures/CalibrationReports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +0 -8768
- data/lib/measures/CalibrationReportsEnhanced/tests/CalibrationReportsEnhanced_Test.rb +0 -734
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel.osm +0 -10497
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel_FuelOil.osm +0 -12740
- data/lib/measures/CalibrationReportsEnhanced/tests/USA_CO_Golden-NREL.724666_TMY3.epw +0 -8768
- data/lib/measures/CalibrationReportsEnhanced21/README.md +0 -109
- data/lib/measures/CalibrationReportsEnhanced21/README.md.erb +0 -42
- data/lib/measures/CalibrationReportsEnhanced21/measure.rb +0 -690
- data/lib/measures/CalibrationReportsEnhanced21/measure.xml +0 -269
- data/lib/measures/CalibrationReportsEnhanced21/resources/report.html.in +0 -380
- data/lib/measures/MaalkaMonthlyJSONUtilityData/LICENSE.md +0 -27
- data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md +0 -104
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.rb +0 -304
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.xml +0 -216
- data/lib/measures/zone_report/README.md +0 -26
- data/lib/measures/zone_report/measure.rb +0 -706
- data/lib/measures/zone_report/measure.xml +0 -67
- data/lib/measures/zone_report/resources/report.html.in +0 -342
- data/openstudio-calibration-measures.gemspec +0 -30
@@ -1,104 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
###### (Automatically generated documentation)
|
4
|
-
|
5
|
-
# Maalka Formatted Monthly JSON Utility Data
|
6
|
-
|
7
|
-
## Description
|
8
|
-
Maalka Formatted Monthly JSON Utility Data
|
9
|
-
|
10
|
-
## Modeler Description
|
11
|
-
Add Maalka Formatted Monthly JSON Utility Data to OSM as a UtilityBill Object
|
12
|
-
|
13
|
-
## Measure Type
|
14
|
-
ModelMeasure
|
15
|
-
|
16
|
-
## Taxonomy
|
17
|
-
|
18
|
-
|
19
|
-
## Arguments
|
20
|
-
|
21
|
-
|
22
|
-
### Path to JSON Data.
|
23
|
-
Path to JSON Data. resources is default directory name of uploaded files in the server.
|
24
|
-
**Name:** json,
|
25
|
-
**Type:** String,
|
26
|
-
**Units:** ,
|
27
|
-
**Required:** true,
|
28
|
-
**Model Dependent:** false
|
29
|
-
|
30
|
-
### Variable name
|
31
|
-
Name of the Utility Bill Object. For Calibration Report use Electric Bill or Gas Bill
|
32
|
-
**Name:** variable_name,
|
33
|
-
**Type:** String,
|
34
|
-
**Units:** ,
|
35
|
-
**Required:** true,
|
36
|
-
**Model Dependent:** false
|
37
|
-
|
38
|
-
### Maalka Fuel Type in JSON
|
39
|
-
Maalka Fuel Type in JSON
|
40
|
-
**Name:** maalka_fuel_type,
|
41
|
-
**Type:** Choice,
|
42
|
-
**Units:** ,
|
43
|
-
**Required:** true,
|
44
|
-
**Model Dependent:** false
|
45
|
-
|
46
|
-
### OpenStudio Fuel Type
|
47
|
-
OpenStudio Fuel Type
|
48
|
-
**Name:** fuel_type,
|
49
|
-
**Type:** Choice,
|
50
|
-
**Units:** ,
|
51
|
-
**Required:** true,
|
52
|
-
**Model Dependent:** false
|
53
|
-
|
54
|
-
### OpenStudio Consumption Unit
|
55
|
-
OpenStudio Consumption Unit (usually kWh or therms)
|
56
|
-
**Name:** consumption_unit,
|
57
|
-
**Type:** Choice,
|
58
|
-
**Units:** ,
|
59
|
-
**Required:** true,
|
60
|
-
**Model Dependent:** false
|
61
|
-
|
62
|
-
### Maalka data key name in JSON
|
63
|
-
Maalka data key name in JSON (tot_kwh or tot_therms)
|
64
|
-
**Name:** data_key_name,
|
65
|
-
**Type:** Choice,
|
66
|
-
**Units:** ,
|
67
|
-
**Required:** true,
|
68
|
-
**Model Dependent:** false
|
69
|
-
|
70
|
-
### Start date
|
71
|
-
Start date format %Y%m%dT%H%M%S with Hour Min Sec optional
|
72
|
-
**Name:** start_date,
|
73
|
-
**Type:** String,
|
74
|
-
**Units:** ,
|
75
|
-
**Required:** true,
|
76
|
-
**Model Dependent:** false
|
77
|
-
|
78
|
-
### End date
|
79
|
-
End date format %Y%m%dT%H%M%S with Hour Min Sec optional
|
80
|
-
**Name:** end_date,
|
81
|
-
**Type:** String,
|
82
|
-
**Units:** ,
|
83
|
-
**Required:** true,
|
84
|
-
**Model Dependent:** false
|
85
|
-
|
86
|
-
### remove all existing Utility Bill data objects from model
|
87
|
-
remove all existing Utility Bill data objects from model
|
88
|
-
**Name:** remove_existing_data,
|
89
|
-
**Type:** Boolean,
|
90
|
-
**Units:** ,
|
91
|
-
**Required:** true,
|
92
|
-
**Model Dependent:** false
|
93
|
-
|
94
|
-
### Set RunPeriod Object in model to use start and end dates
|
95
|
-
Set RunPeriod Object in model to use start and end dates. Only needed once if multiple copies of measure being used.
|
96
|
-
**Name:** set_runperiod,
|
97
|
-
**Type:** Boolean,
|
98
|
-
**Units:** ,
|
99
|
-
**Required:** true,
|
100
|
-
**Model Dependent:** false
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
@@ -1,304 +0,0 @@
|
|
1
|
-
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
-
# All rights reserved.
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
24
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
25
|
-
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
27
|
-
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
28
|
-
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
29
|
-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
30
|
-
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
32
|
-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
33
|
-
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
-
# *******************************************************************************
|
35
|
-
|
36
|
-
# see the URL below for information on how to write OpenStudio measures
|
37
|
-
# http://openstudio.nrel.gov/openstudio-measure-writing-guide
|
38
|
-
|
39
|
-
# see the URL below for information on using life cycle cost objects in OpenStudio
|
40
|
-
# http://openstudio.nrel.gov/openstudio-life-cycle-examples
|
41
|
-
|
42
|
-
# see the URL below for access to C++ documentation on model objects (click on "model" in the main window to view model objects)
|
43
|
-
# http://openstudio.nrel.gov/sites/openstudio.nrel.gov/files/nv_data/cpp_documentation_it/model/html/namespaces.html
|
44
|
-
|
45
|
-
require 'json'
|
46
|
-
require 'time'
|
47
|
-
|
48
|
-
# start the measure
|
49
|
-
class MaalkaMonthlyJSONUtilityData < OpenStudio::Measure::ModelMeasure
|
50
|
-
# define the name that a user will see, this method may be deprecated as
|
51
|
-
# the display name in PAT comes from the name field in measure.xml
|
52
|
-
def name
|
53
|
-
'Maalka Formatted Monthly JSON Utility Data'
|
54
|
-
end
|
55
|
-
|
56
|
-
# human readable description
|
57
|
-
def description
|
58
|
-
'Maalka Formatted Monthly JSON Utility Data'
|
59
|
-
end
|
60
|
-
|
61
|
-
# human readable description of modeling approach
|
62
|
-
def modeler_description
|
63
|
-
'Add Maalka Formatted Monthly JSON Utility Data to OSM as a UtilityBill Object'
|
64
|
-
end
|
65
|
-
|
66
|
-
def year_month_day(str)
|
67
|
-
result = nil
|
68
|
-
if match_data = /(\d+)(\D)(\d+)(\D)(\d+)/.match(str)
|
69
|
-
if match_data[1].size == 4 # yyyy-mm-dd
|
70
|
-
year = match_data[1].to_i
|
71
|
-
month = match_data[3].to_i
|
72
|
-
day = match_data[5].to_i
|
73
|
-
result = [year, month, day]
|
74
|
-
elsif match_data[5].size == 4 # mm-dd-yyyy
|
75
|
-
year = match_data[5].to_i
|
76
|
-
month = match_data[1].to_i
|
77
|
-
day = match_data[3].to_i
|
78
|
-
result = [year, month, day]
|
79
|
-
end
|
80
|
-
else
|
81
|
-
puts "no match for '#{str}'"
|
82
|
-
end
|
83
|
-
result
|
84
|
-
end
|
85
|
-
|
86
|
-
# define the arguments that the user will input
|
87
|
-
def arguments(_model)
|
88
|
-
args = OpenStudio::Measure::OSArgumentVector.new
|
89
|
-
|
90
|
-
# set path to json
|
91
|
-
json = OpenStudio::Measure::OSArgument.makeStringArgument('json', true)
|
92
|
-
json.setDisplayName('Path to JSON Data.')
|
93
|
-
json.setDescription('Path to JSON Data. resources is default directory name of uploaded files in the server.')
|
94
|
-
json.setDefaultValue('../../../lib/resources/sample_json.json')
|
95
|
-
args << json
|
96
|
-
|
97
|
-
# set variable name
|
98
|
-
variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)
|
99
|
-
variable_name.setDisplayName('Variable name')
|
100
|
-
variable_name.setDescription('Name of the Utility Bill Object. For Calibration Report use Electric Bill or Gas Bill')
|
101
|
-
variable_name.setDefaultValue('Electric Bill')
|
102
|
-
args << variable_name
|
103
|
-
|
104
|
-
# make a choice argument for Maalka fuel type
|
105
|
-
mft = OpenStudio::StringVector.new
|
106
|
-
mft << 'electric'
|
107
|
-
mft << 'naturalGas'
|
108
|
-
|
109
|
-
maalka_fuel_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('maalka_fuel_type', mft, mft)
|
110
|
-
maalka_fuel_type.setDisplayName('Maalka Fuel Type in JSON')
|
111
|
-
maalka_fuel_type.setDescription('Maalka Fuel Type in JSON')
|
112
|
-
maalka_fuel_type.setDefaultValue('electric')
|
113
|
-
args << maalka_fuel_type
|
114
|
-
|
115
|
-
# make a choice argument for openstudio fuel type
|
116
|
-
ft = OpenStudio::StringVector.new
|
117
|
-
ft << 'NaturalGas'
|
118
|
-
ft << 'Electricity'
|
119
|
-
ft << 'PropaneGas'
|
120
|
-
|
121
|
-
fuel_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('fuel_type', ft, ft)
|
122
|
-
fuel_type.setDisplayName('OpenStudio Fuel Type')
|
123
|
-
fuel_type.setDescription('OpenStudio Fuel Type')
|
124
|
-
fuel_type.setDefaultValue('Electricity')
|
125
|
-
args << fuel_type
|
126
|
-
|
127
|
-
# make a choice argument for OpenStudio ConsumptionUnit
|
128
|
-
unit = OpenStudio::StringVector.new
|
129
|
-
unit << 'kWh'
|
130
|
-
unit << 'therms'
|
131
|
-
consumption_unit = OpenStudio::Measure::OSArgument.makeChoiceArgument('consumption_unit', unit, unit)
|
132
|
-
consumption_unit.setDisplayName('OpenStudio Consumption Unit')
|
133
|
-
consumption_unit.setDescription('OpenStudio Consumption Unit (usually kWh or therms)')
|
134
|
-
consumption_unit.setDefaultValue('kWh')
|
135
|
-
args << consumption_unit
|
136
|
-
|
137
|
-
# make a choice argument for Maalka data key
|
138
|
-
munit = OpenStudio::StringVector.new
|
139
|
-
munit << 'tot_kwh'
|
140
|
-
munit << 'tot_therms'
|
141
|
-
data_key_name = OpenStudio::Measure::OSArgument.makeChoiceArgument('data_key_name', munit, munit)
|
142
|
-
data_key_name.setDisplayName('Maalka data key name in JSON')
|
143
|
-
data_key_name.setDescription('Maalka data key name in JSON (tot_kwh or tot_therms)')
|
144
|
-
data_key_name.setDefaultValue('tot_kwh')
|
145
|
-
args << data_key_name
|
146
|
-
|
147
|
-
# make a start date argument
|
148
|
-
start_date = OpenStudio::Measure::OSArgument.makeStringArgument('start_date', true)
|
149
|
-
start_date.setDisplayName('Start date')
|
150
|
-
start_date.setDescription('Start date format %Y%m%dT%H%M%S with Hour Min Sec optional')
|
151
|
-
start_date.setDefaultValue('2013-01-1')
|
152
|
-
args << start_date
|
153
|
-
|
154
|
-
# make an end date argument
|
155
|
-
end_date = OpenStudio::Measure::OSArgument.makeStringArgument('end_date', true)
|
156
|
-
end_date.setDisplayName('End date')
|
157
|
-
end_date.setDescription('End date format %Y%m%dT%H%M%S with Hour Min Sec optional')
|
158
|
-
end_date.setDefaultValue('2013-12-31')
|
159
|
-
args << end_date
|
160
|
-
|
161
|
-
# make an end date argument
|
162
|
-
remove_utility_bill_data = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_existing_data', true)
|
163
|
-
remove_utility_bill_data.setDisplayName('remove all existing Utility Bill data objects from model')
|
164
|
-
remove_utility_bill_data.setDescription('remove all existing Utility Bill data objects from model')
|
165
|
-
remove_utility_bill_data.setDefaultValue(false)
|
166
|
-
args << remove_utility_bill_data
|
167
|
-
|
168
|
-
# make an end date argument
|
169
|
-
set_runperiod = OpenStudio::Measure::OSArgument.makeBoolArgument('set_runperiod', true)
|
170
|
-
set_runperiod.setDisplayName('Set RunPeriod Object in model to use start and end dates')
|
171
|
-
set_runperiod.setDescription('Set RunPeriod Object in model to use start and end dates. Only needed once if multiple copies of measure being used.')
|
172
|
-
set_runperiod.setDefaultValue(false)
|
173
|
-
args << set_runperiod
|
174
|
-
|
175
|
-
args
|
176
|
-
end # end the arguments method
|
177
|
-
|
178
|
-
# define what happens when the measure is run
|
179
|
-
def run(model, runner, user_arguments)
|
180
|
-
super(model, runner, user_arguments)
|
181
|
-
|
182
|
-
# use the built-in error checking
|
183
|
-
unless runner.validateUserArguments(arguments(model), user_arguments)
|
184
|
-
return false
|
185
|
-
end
|
186
|
-
|
187
|
-
# assign the user inputs to variables
|
188
|
-
json = runner.getStringArgumentValue('json', user_arguments)
|
189
|
-
variable_name = runner.getStringArgumentValue('variable_name', user_arguments)
|
190
|
-
fuel_type = runner.getStringArgumentValue('fuel_type', user_arguments)
|
191
|
-
maalka_fuel_type = runner.getStringArgumentValue('maalka_fuel_type', user_arguments)
|
192
|
-
consumption_unit = runner.getStringArgumentValue('consumption_unit', user_arguments)
|
193
|
-
data_key_name = runner.getStringArgumentValue('data_key_name', user_arguments)
|
194
|
-
start_date = runner.getStringArgumentValue('start_date', user_arguments)
|
195
|
-
end_date = runner.getStringArgumentValue('end_date', user_arguments)
|
196
|
-
remove_utility_bill_data = runner.getBoolArgumentValue('remove_existing_data', user_arguments)
|
197
|
-
set_runperiod = runner.getBoolArgumentValue('set_runperiod', user_arguments)
|
198
|
-
|
199
|
-
# set start date
|
200
|
-
if date = year_month_day(start_date)
|
201
|
-
start_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(date[1]), date[2], date[0])
|
202
|
-
# actual year of start date
|
203
|
-
yearDescription = model.getYearDescription
|
204
|
-
yearDescription.setCalendarYear(date[0])
|
205
|
-
if set_runperiod
|
206
|
-
runPeriod = model.getRunPeriod
|
207
|
-
runPeriod.setBeginMonth(date[1])
|
208
|
-
runPeriod.setBeginDayOfMonth(date[2])
|
209
|
-
runner.registerInfo("RunPeriod start date set to #{start_date}")
|
210
|
-
end
|
211
|
-
else
|
212
|
-
runner.registerError("Unknown start date '#{start_date}'")
|
213
|
-
raise "Unknown start date '#{start_date}'"
|
214
|
-
return false
|
215
|
-
end
|
216
|
-
|
217
|
-
# set end date
|
218
|
-
if date = year_month_day(end_date)
|
219
|
-
end_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(date[1]), date[2], date[0])
|
220
|
-
if set_runperiod
|
221
|
-
runPeriod = model.getRunPeriod
|
222
|
-
runPeriod.setEndMonth(date[1])
|
223
|
-
runPeriod.setEndDayOfMonth(date[2])
|
224
|
-
runner.registerInfo("RunPeriod end date set to #{end_date}")
|
225
|
-
end
|
226
|
-
else
|
227
|
-
runner.registerError("Unknown end date '#{end_date}'")
|
228
|
-
raise "Unknown end date '#{end_date}'"
|
229
|
-
return false
|
230
|
-
end
|
231
|
-
|
232
|
-
# remove all utility bills
|
233
|
-
model.getUtilityBills.each(&:remove) if remove_utility_bill_data
|
234
|
-
|
235
|
-
runner.registerInfo("json is #{json}")
|
236
|
-
json_path = File.expand_path(json.to_s, __FILE__)
|
237
|
-
runner.registerInfo("json_path is #{json_path}")
|
238
|
-
temp = File.read(json_path)
|
239
|
-
json_data = JSON.parse(temp)
|
240
|
-
unless json_data.nil?
|
241
|
-
runner.registerInfo("fuel_type is #{fuel_type}")
|
242
|
-
utilityBill = OpenStudio::Model::UtilityBill.new(fuel_type.to_s.to_FuelType, model)
|
243
|
-
utilityBill.setName(variable_name.to_s)
|
244
|
-
utilityBill.setConsumptionUnit(consumption_unit.to_s)
|
245
|
-
# TODO: trap nil
|
246
|
-
runner.registerInfo("maalka_fuel_type is #{maalka_fuel_type}")
|
247
|
-
json_data['data']['maalka_input'][maalka_fuel_type.to_s]['data'].each do |period|
|
248
|
-
begin
|
249
|
-
from_date = period['from'] ? Time.iso8601(period['from']).strftime('%Y%m%dT%H%M%S') : nil
|
250
|
-
to_date = period['to'] ? Time.iso8601(period['to']).strftime('%Y%m%dT%H%M%S') : nil
|
251
|
-
rescue ArgumentError => e
|
252
|
-
runner.registerError("Unknown date format in period '#{period}'")
|
253
|
-
end
|
254
|
-
if from_date.nil? || to_date.nil?
|
255
|
-
runner.registerError("Unknown date format in period '#{period}'")
|
256
|
-
raise "Unknown date format in period '#{period}'"
|
257
|
-
return false
|
258
|
-
end
|
259
|
-
# runner.registerInfo("GC.start")
|
260
|
-
# GC.start
|
261
|
-
period_start_date = OpenStudio::DateTime.fromISO8601(from_date).get.date
|
262
|
-
# period_start_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(from_date[1]), from_date[2], from_date[0])
|
263
|
-
# period_end_date = OpenStudio::DateTime.fromISO8601(to_date).get.date - OpenStudio::Time.new(1.0)
|
264
|
-
period_end_date = OpenStudio::DateTime.fromISO8601(to_date).get.date
|
265
|
-
# period_end_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(to_date[1]), to_date[2], to_date[0])
|
266
|
-
|
267
|
-
if (period_start_date < start_date) || (period_end_date > end_date)
|
268
|
-
runner.registerInfo("skipping period #{period_start_date} to #{period_end_date}")
|
269
|
-
next
|
270
|
-
end
|
271
|
-
|
272
|
-
if period[data_key_name.to_s].nil?
|
273
|
-
runner.registerError("Billing period missing key:#{data_key_name} in: '#{period}'")
|
274
|
-
return false
|
275
|
-
end
|
276
|
-
data_key_value = period[data_key_name.to_s].to_f
|
277
|
-
|
278
|
-
# peak_kw = nil
|
279
|
-
# if not period['peak_kw'].nil?
|
280
|
-
# peak_kw = period['peak_kw'].to_f
|
281
|
-
# end
|
282
|
-
|
283
|
-
runner.registerInfo("period #{period}")
|
284
|
-
runner.registerInfo("period_start_date: #{period_start_date}, period_end_date: #{period_end_date}, #{data_key_name}: #{data_key_value}")
|
285
|
-
|
286
|
-
bp = utilityBill.addBillingPeriod
|
287
|
-
bp.setStartDate(period_start_date)
|
288
|
-
bp.setEndDate(period_end_date)
|
289
|
-
bp.setConsumption(data_key_value)
|
290
|
-
# if peak_kw
|
291
|
-
# bp.setPeakDemand(peak_kw)
|
292
|
-
# end
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
# reporting final condition of model
|
297
|
-
runner.registerFinalCondition('Utility bill data has been added to the model.')
|
298
|
-
|
299
|
-
true
|
300
|
-
end # end the run method
|
301
|
-
end # end the measure
|
302
|
-
|
303
|
-
# this allows the measure to be use by the application
|
304
|
-
MaalkaMonthlyJSONUtilityData.new.registerWithApplication
|
@@ -1,216 +0,0 @@
|
|
1
|
-
<measure>
|
2
|
-
<schema_version>3.0</schema_version>
|
3
|
-
<name>maalka_monthly_json_utility_data</name>
|
4
|
-
<uid>afe82cf5-3e3a-43ea-b31e-8289ff268bed</uid>
|
5
|
-
<version_id>16d24197-d1f1-4fbf-ad4d-3aa2ede1c90f</version_id>
|
6
|
-
<version_modified>20200325T030944Z</version_modified>
|
7
|
-
<xml_checksum>057E8D9D</xml_checksum>
|
8
|
-
<class_name>MaalkaMonthlyJSONUtilityData</class_name>
|
9
|
-
<display_name>Maalka Formatted Monthly JSON Utility Data</display_name>
|
10
|
-
<description>Maalka Formatted Monthly JSON Utility Data</description>
|
11
|
-
<modeler_description>Add Maalka Formatted Monthly JSON Utility Data to OSM as a UtilityBill Object</modeler_description>
|
12
|
-
<arguments>
|
13
|
-
<argument>
|
14
|
-
<name>json</name>
|
15
|
-
<display_name>Path to JSON Data.</display_name>
|
16
|
-
<description>Path to JSON Data. resources is default directory name of uploaded files in the server.</description>
|
17
|
-
<type>String</type>
|
18
|
-
<required>true</required>
|
19
|
-
<model_dependent>false</model_dependent>
|
20
|
-
<default_value>../../../lib/resources/sample_json.json</default_value>
|
21
|
-
</argument>
|
22
|
-
<argument>
|
23
|
-
<name>variable_name</name>
|
24
|
-
<display_name>Variable name</display_name>
|
25
|
-
<description>Name of the Utility Bill Object. For Calibration Report use Electric Bill or Gas Bill</description>
|
26
|
-
<type>String</type>
|
27
|
-
<required>true</required>
|
28
|
-
<model_dependent>false</model_dependent>
|
29
|
-
<default_value>Electric Bill</default_value>
|
30
|
-
</argument>
|
31
|
-
<argument>
|
32
|
-
<name>maalka_fuel_type</name>
|
33
|
-
<display_name>Maalka Fuel Type in JSON</display_name>
|
34
|
-
<description>Maalka Fuel Type in JSON</description>
|
35
|
-
<type>Choice</type>
|
36
|
-
<required>true</required>
|
37
|
-
<model_dependent>false</model_dependent>
|
38
|
-
<default_value>electric</default_value>
|
39
|
-
<choices>
|
40
|
-
<choice>
|
41
|
-
<value>electric</value>
|
42
|
-
<display_name>electric</display_name>
|
43
|
-
</choice>
|
44
|
-
<choice>
|
45
|
-
<value>naturalGas</value>
|
46
|
-
<display_name>naturalGas</display_name>
|
47
|
-
</choice>
|
48
|
-
</choices>
|
49
|
-
</argument>
|
50
|
-
<argument>
|
51
|
-
<name>fuel_type</name>
|
52
|
-
<display_name>OpenStudio Fuel Type</display_name>
|
53
|
-
<description>OpenStudio Fuel Type</description>
|
54
|
-
<type>Choice</type>
|
55
|
-
<required>true</required>
|
56
|
-
<model_dependent>false</model_dependent>
|
57
|
-
<default_value>Electricity</default_value>
|
58
|
-
<choices>
|
59
|
-
<choice>
|
60
|
-
<value>NaturalGas</value>
|
61
|
-
<display_name>NaturalGas</display_name>
|
62
|
-
</choice>
|
63
|
-
<choice>
|
64
|
-
<value>Electricity</value>
|
65
|
-
<display_name>Electricity</display_name>
|
66
|
-
</choice>
|
67
|
-
<choice>
|
68
|
-
<value>PropaneGas</value>
|
69
|
-
<display_name>PropaneGas</display_name>
|
70
|
-
</choice>
|
71
|
-
</choices>
|
72
|
-
</argument>
|
73
|
-
<argument>
|
74
|
-
<name>consumption_unit</name>
|
75
|
-
<display_name>OpenStudio Consumption Unit</display_name>
|
76
|
-
<description>OpenStudio Consumption Unit (usually kWh or therms)</description>
|
77
|
-
<type>Choice</type>
|
78
|
-
<required>true</required>
|
79
|
-
<model_dependent>false</model_dependent>
|
80
|
-
<default_value>kWh</default_value>
|
81
|
-
<choices>
|
82
|
-
<choice>
|
83
|
-
<value>kWh</value>
|
84
|
-
<display_name>kWh</display_name>
|
85
|
-
</choice>
|
86
|
-
<choice>
|
87
|
-
<value>therms</value>
|
88
|
-
<display_name>therms</display_name>
|
89
|
-
</choice>
|
90
|
-
</choices>
|
91
|
-
</argument>
|
92
|
-
<argument>
|
93
|
-
<name>data_key_name</name>
|
94
|
-
<display_name>Maalka data key name in JSON</display_name>
|
95
|
-
<description>Maalka data key name in JSON (tot_kwh or tot_therms)</description>
|
96
|
-
<type>Choice</type>
|
97
|
-
<required>true</required>
|
98
|
-
<model_dependent>false</model_dependent>
|
99
|
-
<default_value>tot_kwh</default_value>
|
100
|
-
<choices>
|
101
|
-
<choice>
|
102
|
-
<value>tot_kwh</value>
|
103
|
-
<display_name>tot_kwh</display_name>
|
104
|
-
</choice>
|
105
|
-
<choice>
|
106
|
-
<value>tot_therms</value>
|
107
|
-
<display_name>tot_therms</display_name>
|
108
|
-
</choice>
|
109
|
-
</choices>
|
110
|
-
</argument>
|
111
|
-
<argument>
|
112
|
-
<name>start_date</name>
|
113
|
-
<display_name>Start date</display_name>
|
114
|
-
<description>Start date format %Y%m%dT%H%M%S with Hour Min Sec optional</description>
|
115
|
-
<type>String</type>
|
116
|
-
<required>true</required>
|
117
|
-
<model_dependent>false</model_dependent>
|
118
|
-
<default_value>2013-01-1</default_value>
|
119
|
-
</argument>
|
120
|
-
<argument>
|
121
|
-
<name>end_date</name>
|
122
|
-
<display_name>End date</display_name>
|
123
|
-
<description>End date format %Y%m%dT%H%M%S with Hour Min Sec optional</description>
|
124
|
-
<type>String</type>
|
125
|
-
<required>true</required>
|
126
|
-
<model_dependent>false</model_dependent>
|
127
|
-
<default_value>2013-12-31</default_value>
|
128
|
-
</argument>
|
129
|
-
<argument>
|
130
|
-
<name>remove_existing_data</name>
|
131
|
-
<display_name>remove all existing Utility Bill data objects from model</display_name>
|
132
|
-
<description>remove all existing Utility Bill data objects from model</description>
|
133
|
-
<type>Boolean</type>
|
134
|
-
<required>true</required>
|
135
|
-
<model_dependent>false</model_dependent>
|
136
|
-
<default_value>false</default_value>
|
137
|
-
<choices>
|
138
|
-
<choice>
|
139
|
-
<value>true</value>
|
140
|
-
<display_name>true</display_name>
|
141
|
-
</choice>
|
142
|
-
<choice>
|
143
|
-
<value>false</value>
|
144
|
-
<display_name>false</display_name>
|
145
|
-
</choice>
|
146
|
-
</choices>
|
147
|
-
</argument>
|
148
|
-
<argument>
|
149
|
-
<name>set_runperiod</name>
|
150
|
-
<display_name>Set RunPeriod Object in model to use start and end dates</display_name>
|
151
|
-
<description>Set RunPeriod Object in model to use start and end dates. Only needed once if multiple copies of measure being used.</description>
|
152
|
-
<type>Boolean</type>
|
153
|
-
<required>true</required>
|
154
|
-
<model_dependent>false</model_dependent>
|
155
|
-
<default_value>false</default_value>
|
156
|
-
<choices>
|
157
|
-
<choice>
|
158
|
-
<value>true</value>
|
159
|
-
<display_name>true</display_name>
|
160
|
-
</choice>
|
161
|
-
<choice>
|
162
|
-
<value>false</value>
|
163
|
-
<display_name>false</display_name>
|
164
|
-
</choice>
|
165
|
-
</choices>
|
166
|
-
</argument>
|
167
|
-
</arguments>
|
168
|
-
<outputs/>
|
169
|
-
<provenances/>
|
170
|
-
<tags>
|
171
|
-
<tag>Whole Building.Space Types</tag>
|
172
|
-
</tags>
|
173
|
-
<attributes>
|
174
|
-
<attribute>
|
175
|
-
<name>Measure Type</name>
|
176
|
-
<value>ModelMeasure</value>
|
177
|
-
<datatype>string</datatype>
|
178
|
-
</attribute>
|
179
|
-
<attribute>
|
180
|
-
<name>Uses SketchUp API</name>
|
181
|
-
<value>false</value>
|
182
|
-
<datatype>boolean</datatype>
|
183
|
-
</attribute>
|
184
|
-
</attributes>
|
185
|
-
<files>
|
186
|
-
<file>
|
187
|
-
<filename>LICENSE.md</filename>
|
188
|
-
<filetype>md</filetype>
|
189
|
-
<usage_type>license</usage_type>
|
190
|
-
<checksum>E0468DD6</checksum>
|
191
|
-
</file>
|
192
|
-
<file>
|
193
|
-
<filename>README.md.erb</filename>
|
194
|
-
<filetype>erb</filetype>
|
195
|
-
<usage_type>readmeerb</usage_type>
|
196
|
-
<checksum>703C9964</checksum>
|
197
|
-
</file>
|
198
|
-
<file>
|
199
|
-
<filename>README.md</filename>
|
200
|
-
<filetype>md</filetype>
|
201
|
-
<usage_type>readme</usage_type>
|
202
|
-
<checksum>6B54533E</checksum>
|
203
|
-
</file>
|
204
|
-
<file>
|
205
|
-
<version>
|
206
|
-
<software_program>OpenStudio</software_program>
|
207
|
-
<identifier>2.1.0</identifier>
|
208
|
-
<min_compatible>2.1.0</min_compatible>
|
209
|
-
</version>
|
210
|
-
<filename>measure.rb</filename>
|
211
|
-
<filetype>rb</filetype>
|
212
|
-
<usage_type>script</usage_type>
|
213
|
-
<checksum>9D8320DF</checksum>
|
214
|
-
</file>
|
215
|
-
</files>
|
216
|
-
</measure>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
###### (Automatically generated documentation)
|
4
|
-
|
5
|
-
# Zone Report
|
6
|
-
|
7
|
-
## Description
|
8
|
-
|
9
|
-
|
10
|
-
## Modeler Description
|
11
|
-
|
12
|
-
|
13
|
-
## Measure Type
|
14
|
-
ReportingMeasure
|
15
|
-
|
16
|
-
## Taxonomy
|
17
|
-
|
18
|
-
|
19
|
-
## Arguments
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
This measure does not have any user arguments
|
25
|
-
|
26
|
-
|