openstudio-calibration 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +29 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +20 -0
- data/Jenkinsfile +6 -0
- data/LICENSE.md +27 -0
- data/README.md +33 -0
- data/Rakefile +50 -0
- data/doc_templates/LICENSE.md +27 -0
- data/doc_templates/README.md.erb +42 -0
- data/doc_templates/copyright_erb.txt +36 -0
- data/doc_templates/copyright_js.txt +4 -0
- data/doc_templates/copyright_ruby.txt +34 -0
- data/lib/files/.gitkeep +0 -0
- data/lib/measures/AddMonthlyJSONUtilityData/LICENSE.md +27 -0
- data/lib/measures/AddMonthlyJSONUtilityData/README.md +96 -0
- data/lib/measures/AddMonthlyJSONUtilityData/README.md.erb +42 -0
- data/lib/measures/AddMonthlyJSONUtilityData/measure.rb +280 -0
- data/lib/measures/AddMonthlyJSONUtilityData/measure.xml +163 -0
- data/lib/measures/AddMonthlyUtilityData/LICENSE.md +27 -0
- data/lib/measures/AddMonthlyUtilityData/README.md +64 -0
- data/lib/measures/AddMonthlyUtilityData/README.md.erb +42 -0
- data/lib/measures/AddMonthlyUtilityData/measure.rb +312 -0
- data/lib/measures/AddMonthlyUtilityData/measure.xml +115 -0
- data/lib/measures/AddMonthlyUtilityData/tests/AddMonthlyUtilityData_Test.rb +88 -0
- data/lib/measures/AddMonthlyUtilityData/tests/electric_billed_usages.json +198 -0
- data/lib/measures/AddMonthlyUtilityData/tests/gas_billed_usages.json +198 -0
- data/lib/measures/CalibrationReports/LICENSE.md +27 -0
- data/lib/measures/CalibrationReports/README.md +26 -0
- data/lib/measures/CalibrationReports/README.md.erb +42 -0
- data/lib/measures/CalibrationReports/measure.rb +511 -0
- data/lib/measures/CalibrationReports/measure.xml +98 -0
- data/lib/measures/CalibrationReports/resources/report.html.in +379 -0
- data/lib/measures/CalibrationReports/tests/CalibrationReports_Test.rb +523 -0
- data/lib/measures/CalibrationReports/tests/ExampleModel.osm +10497 -0
- data/lib/measures/CalibrationReports/tests/ExampleModelNoDemandInput.osm +10560 -0
- data/lib/measures/CalibrationReports/tests/ExampleModelNoGasInput.osm +10456 -0
- data/lib/measures/CalibrationReports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
- data/lib/measures/CalibrationReportsEnhanced/LICENSE.md +27 -0
- data/lib/measures/CalibrationReportsEnhanced/README.md +143 -0
- data/lib/measures/CalibrationReportsEnhanced/README.md.erb +42 -0
- data/lib/measures/CalibrationReportsEnhanced/measure.rb +798 -0
- data/lib/measures/CalibrationReportsEnhanced/measure.xml +372 -0
- data/lib/measures/CalibrationReportsEnhanced/resources/report.html.in +380 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/CalibrationReportsEnhanced_Test.rb +734 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel.osm +10497 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel_FuelOil.osm +12740 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
- data/lib/measures/CalibrationReportsEnhanced21/LICENSE.md +27 -0
- data/lib/measures/CalibrationReportsEnhanced21/README.md +109 -0
- data/lib/measures/CalibrationReportsEnhanced21/README.md.erb +42 -0
- data/lib/measures/CalibrationReportsEnhanced21/measure.rb +690 -0
- data/lib/measures/CalibrationReportsEnhanced21/measure.xml +269 -0
- data/lib/measures/CalibrationReportsEnhanced21/resources/report.html.in +380 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/README.md +48 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.rb +237 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.xml +93 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/README.md +48 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.rb +228 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.xml +93 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/README.md +64 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.rb +280 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.xml +111 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/README.md +64 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.rb +270 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.xml +111 -0
- data/lib/measures/CoilCoolingWaterMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingWaterMultiplier/README.md +80 -0
- data/lib/measures/CoilCoolingWaterMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilCoolingWaterMultiplier/measure.rb +324 -0
- data/lib/measures/CoilCoolingWaterMultiplier/measure.xml +129 -0
- data/lib/measures/CoilCoolingWaterPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingWaterPercentChange/README.md +80 -0
- data/lib/measures/CoilCoolingWaterPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilCoolingWaterPercentChange/measure.rb +311 -0
- data/lib/measures/CoilCoolingWaterPercentChange/measure.xml +129 -0
- data/lib/measures/CoilHeatingElectricMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingElectricMultiplier/README.md +48 -0
- data/lib/measures/CoilHeatingElectricMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilHeatingElectricMultiplier/measure.rb +240 -0
- data/lib/measures/CoilHeatingElectricMultiplier/measure.xml +93 -0
- data/lib/measures/CoilHeatingElectricPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingElectricPercentChange/README.md +48 -0
- data/lib/measures/CoilHeatingElectricPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilHeatingElectricPercentChange/measure.rb +231 -0
- data/lib/measures/CoilHeatingElectricPercentChange/measure.xml +93 -0
- data/lib/measures/CoilHeatingGasMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingGasMultiplier/README.md +64 -0
- data/lib/measures/CoilHeatingGasMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilHeatingGasMultiplier/measure.rb +282 -0
- data/lib/measures/CoilHeatingGasMultiplier/measure.xml +111 -0
- data/lib/measures/CoilHeatingGasPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingGasPercentChange/README.md +64 -0
- data/lib/measures/CoilHeatingGasPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilHeatingGasPercentChange/measure.rb +271 -0
- data/lib/measures/CoilHeatingGasPercentChange/measure.xml +111 -0
- data/lib/measures/CoilHeatingWaterMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingWaterMultiplier/README.md +48 -0
- data/lib/measures/CoilHeatingWaterMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilHeatingWaterMultiplier/measure.rb +235 -0
- data/lib/measures/CoilHeatingWaterMultiplier/measure.xml +93 -0
- data/lib/measures/CoilHeatingWaterPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingWaterPercentChange/README.md +48 -0
- data/lib/measures/CoilHeatingWaterPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilHeatingWaterPercentChange/measure.rb +226 -0
- data/lib/measures/CoilHeatingWaterPercentChange/measure.xml +93 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/LICENSE.md +27 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/README.md +88 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/README.md.erb +42 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.rb +221 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.xml +194 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/LICENSE.md +27 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/README.md +40 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/README.md.erb +42 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.rb +102 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.xml +78 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/LICENSE.md +27 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/README.md +48 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/README.md.erb +42 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.rb +263 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.xml +97 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/LICENSE.md +27 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/README.md +48 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/README.md.erb +42 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.rb +253 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.xml +97 -0
- data/lib/measures/FansMultiplier/LICENSE.md +27 -0
- data/lib/measures/FansMultiplier/README.md +64 -0
- data/lib/measures/FansMultiplier/README.md.erb +42 -0
- data/lib/measures/FansMultiplier/measure.rb +297 -0
- data/lib/measures/FansMultiplier/measure.xml +166 -0
- data/lib/measures/FansPercentChange/LICENSE.md +27 -0
- data/lib/measures/FansPercentChange/README.md +64 -0
- data/lib/measures/FansPercentChange/README.md.erb +42 -0
- data/lib/measures/FansPercentChange/measure.rb +286 -0
- data/lib/measures/FansPercentChange/measure.xml +166 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/LICENSE.md +27 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/README.md +112 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/README.md.erb +42 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.rb +639 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.xml +229 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/LICENSE.md +27 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/README.md +112 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/README.md.erb +42 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.rb +756 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.xml +229 -0
- data/lib/measures/HardSizeHvac/LICENSE.md +27 -0
- data/lib/measures/HardSizeHvac/README.md +26 -0
- data/lib/measures/HardSizeHvac/README.md.erb +42 -0
- data/lib/measures/HardSizeHvac/measure.rb +88 -0
- data/lib/measures/HardSizeHvac/measure.xml +81 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/LICENSE.md +27 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md +104 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md.erb +42 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.rb +304 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.xml +216 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/LICENSE.md +27 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/README.md +40 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/README.md.erb +42 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.rb +196 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.xml +132 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/LICENSE.md +27 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/README.md +40 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/README.md.erb +42 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.rb +189 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.xml +132 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/LICENSE.md +27 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/README.md +48 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/README.md.erb +42 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.rb +263 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.xml +97 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/LICENSE.md +27 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/README.md +48 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/README.md.erb +42 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.rb +253 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.xml +97 -0
- data/lib/measures/TimeseriesObjectiveFunction/LICENSE.md +27 -0
- data/lib/measures/TimeseriesObjectiveFunction/README.md +207 -0
- data/lib/measures/TimeseriesObjectiveFunction/README.md.erb +42 -0
- data/lib/measures/TimeseriesObjectiveFunction/measure.rb +748 -0
- data/lib/measures/TimeseriesObjectiveFunction/measure.xml +435 -0
- data/lib/measures/TimeseriesObjectiveFunction/resources/report.html.erb +288 -0
- data/lib/measures/TimeseriesPlot/LICENSE.md +27 -0
- data/lib/measures/TimeseriesPlot/README.md +56 -0
- data/lib/measures/TimeseriesPlot/README.md.erb +42 -0
- data/lib/measures/TimeseriesPlot/measure.rb +302 -0
- data/lib/measures/TimeseriesPlot/measure.xml +137 -0
- data/lib/measures/TimeseriesPlot/resources/report.html.erb +270 -0
- data/lib/measures/WaterHeaterMixedMultiplier/LICENSE.md +27 -0
- data/lib/measures/WaterHeaterMixedMultiplier/README.md +64 -0
- data/lib/measures/WaterHeaterMixedMultiplier/README.md.erb +42 -0
- data/lib/measures/WaterHeaterMixedMultiplier/measure.rb +255 -0
- data/lib/measures/WaterHeaterMixedMultiplier/measure.xml +180 -0
- data/lib/measures/WaterHeaterMixedPercentChange/LICENSE.md +27 -0
- data/lib/measures/WaterHeaterMixedPercentChange/README.md +64 -0
- data/lib/measures/WaterHeaterMixedPercentChange/README.md.erb +42 -0
- data/lib/measures/WaterHeaterMixedPercentChange/measure.rb +245 -0
- data/lib/measures/WaterHeaterMixedPercentChange/measure.xml +180 -0
- data/lib/measures/zone_report/LICENSE.md +27 -0
- data/lib/measures/zone_report/README.md +26 -0
- data/lib/measures/zone_report/README.md.erb +42 -0
- data/lib/measures/zone_report/measure.rb +706 -0
- data/lib/measures/zone_report/measure.xml +67 -0
- data/lib/measures/zone_report/resources/report.html.in +342 -0
- data/lib/openstudio-calibration-measures.rb +36 -0
- data/lib/openstudio/calibration_measures.rb +37 -0
- data/lib/openstudio/calibration_measures/extension.rb +49 -0
- data/lib/openstudio/calibration_measures/version.rb +40 -0
- data/openstudio-calibration.gemspec +30 -0
- metadata +331 -0
@@ -0,0 +1,435 @@
|
|
1
|
+
<measure>
|
2
|
+
<schema_version>3.0</schema_version>
|
3
|
+
<name>timeseries_objective_function</name>
|
4
|
+
<uid>6804217d-4737-45f3-82df-b81393c29ce3</uid>
|
5
|
+
<version_id>cd719981-451c-476a-b4d9-bec827cb0b9b</version_id>
|
6
|
+
<version_modified>20200331T151749Z</version_modified>
|
7
|
+
<xml_checksum>FFE04372</xml_checksum>
|
8
|
+
<class_name>TimeseriesObjectiveFunction</class_name>
|
9
|
+
<display_name>TimeSeries Objective Function</display_name>
|
10
|
+
<description>Creates Objective Function from Timeseries Data</description>
|
11
|
+
<modeler_description>Creates Objective Function from Timeseries Data. The measure applies a Norm at each timestep between the difference of CSV metered data and SQL model data. A timeseries plot can also be created. Possible outputs are 'cvrmse', 'nmbe', 'simdata' = sum of the simulated data, 'csvdata' = sum of metered data, 'diff' = P Norm between the metered and simulated data if Norm is 1 or 2, else its just the Difference.</modeler_description>
|
12
|
+
<arguments>
|
13
|
+
<argument>
|
14
|
+
<name>csv_name</name>
|
15
|
+
<display_name>Path to CSV file for the metered data</display_name>
|
16
|
+
<description>Path to CSV file including file name.</description>
|
17
|
+
<type>String</type>
|
18
|
+
<required>true</required>
|
19
|
+
<model_dependent>false</model_dependent>
|
20
|
+
<default_value>../../../lib/resources/mtr.csv</default_value>
|
21
|
+
</argument>
|
22
|
+
<argument>
|
23
|
+
<name>csv_time_header</name>
|
24
|
+
<display_name>CSV Time Header</display_name>
|
25
|
+
<description>CSV Time Header Value. Used to determine the timestamp column in the CSV file</description>
|
26
|
+
<type>String</type>
|
27
|
+
<required>true</required>
|
28
|
+
<model_dependent>false</model_dependent>
|
29
|
+
<default_value>Date/Time</default_value>
|
30
|
+
</argument>
|
31
|
+
<argument>
|
32
|
+
<name>csv_var</name>
|
33
|
+
<display_name>CSV variable name</display_name>
|
34
|
+
<description>CSV variable name. Used to determine the variable column in the CSV file</description>
|
35
|
+
<type>String</type>
|
36
|
+
<required>true</required>
|
37
|
+
<model_dependent>false</model_dependent>
|
38
|
+
<default_value>Whole Building:Facility Total Electric Demand Power [W](TimeStep)</default_value>
|
39
|
+
</argument>
|
40
|
+
<argument>
|
41
|
+
<name>convert_data</name>
|
42
|
+
<display_name>Convert Units</display_name>
|
43
|
+
<description>Convert Units in Metered Data</description>
|
44
|
+
<type>Choice</type>
|
45
|
+
<required>true</required>
|
46
|
+
<model_dependent>false</model_dependent>
|
47
|
+
<default_value>None</default_value>
|
48
|
+
<choices>
|
49
|
+
<choice>
|
50
|
+
<value>F to C</value>
|
51
|
+
<display_name>F to C</display_name>
|
52
|
+
</choice>
|
53
|
+
<choice>
|
54
|
+
<value>WH to J</value>
|
55
|
+
<display_name>WH to J</display_name>
|
56
|
+
</choice>
|
57
|
+
<choice>
|
58
|
+
<value>CFM to m3/s</value>
|
59
|
+
<display_name>CFM to m3/s</display_name>
|
60
|
+
</choice>
|
61
|
+
<choice>
|
62
|
+
<value>PSI to Pa</value>
|
63
|
+
<display_name>PSI to Pa</display_name>
|
64
|
+
</choice>
|
65
|
+
<choice>
|
66
|
+
<value>None</value>
|
67
|
+
<display_name>None</display_name>
|
68
|
+
</choice>
|
69
|
+
</choices>
|
70
|
+
</argument>
|
71
|
+
<argument>
|
72
|
+
<name>csv_var_dn</name>
|
73
|
+
<display_name>CSV variable display name</display_name>
|
74
|
+
<description>CSV variable display name. Not yet Implemented</description>
|
75
|
+
<type>String</type>
|
76
|
+
<required>true</required>
|
77
|
+
<model_dependent>false</model_dependent>
|
78
|
+
<default_value></default_value>
|
79
|
+
</argument>
|
80
|
+
<argument>
|
81
|
+
<name>year</name>
|
82
|
+
<display_name>Year in csv data timestamp</display_name>
|
83
|
+
<description>Is the Year in the csv data timestamp => mm:dd:yy or mm:dd (true/false)</description>
|
84
|
+
<type>Boolean</type>
|
85
|
+
<required>true</required>
|
86
|
+
<model_dependent>false</model_dependent>
|
87
|
+
<default_value>true</default_value>
|
88
|
+
<choices>
|
89
|
+
<choice>
|
90
|
+
<value>true</value>
|
91
|
+
<display_name>true</display_name>
|
92
|
+
</choice>
|
93
|
+
<choice>
|
94
|
+
<value>false</value>
|
95
|
+
<display_name>false</display_name>
|
96
|
+
</choice>
|
97
|
+
</choices>
|
98
|
+
</argument>
|
99
|
+
<argument>
|
100
|
+
<name>seconds</name>
|
101
|
+
<display_name>Seconds in csv data timestamp</display_name>
|
102
|
+
<description>Is the Seconds in the csv data timestamp => hh:mm:ss or hh:mm (true/false)</description>
|
103
|
+
<type>Boolean</type>
|
104
|
+
<required>true</required>
|
105
|
+
<model_dependent>false</model_dependent>
|
106
|
+
<default_value>true</default_value>
|
107
|
+
<choices>
|
108
|
+
<choice>
|
109
|
+
<value>true</value>
|
110
|
+
<display_name>true</display_name>
|
111
|
+
</choice>
|
112
|
+
<choice>
|
113
|
+
<value>false</value>
|
114
|
+
<display_name>false</display_name>
|
115
|
+
</choice>
|
116
|
+
</choices>
|
117
|
+
</argument>
|
118
|
+
<argument>
|
119
|
+
<name>key_value</name>
|
120
|
+
<display_name>SQL key value</display_name>
|
121
|
+
<description>SQL key value for the SQL query to find the variable in the SQL file</description>
|
122
|
+
<type>String</type>
|
123
|
+
<required>true</required>
|
124
|
+
<model_dependent>false</model_dependent>
|
125
|
+
<default_value></default_value>
|
126
|
+
</argument>
|
127
|
+
<argument>
|
128
|
+
<name>timeseries_name</name>
|
129
|
+
<display_name>TimeSeries Name</display_name>
|
130
|
+
<description>TimeSeries Name for the SQL query to find the variable in the SQL file</description>
|
131
|
+
<type>String</type>
|
132
|
+
<required>true</required>
|
133
|
+
<model_dependent>false</model_dependent>
|
134
|
+
<default_value>Facility Total Electric Demand Power</default_value>
|
135
|
+
</argument>
|
136
|
+
<argument>
|
137
|
+
<name>reporting_frequency</name>
|
138
|
+
<display_name>Reporting Frequency</display_name>
|
139
|
+
<description>Reporting Frequency for SQL Query</description>
|
140
|
+
<type>Choice</type>
|
141
|
+
<required>true</required>
|
142
|
+
<model_dependent>false</model_dependent>
|
143
|
+
<choices>
|
144
|
+
<choice>
|
145
|
+
<value>Detailed</value>
|
146
|
+
<display_name>Detailed</display_name>
|
147
|
+
</choice>
|
148
|
+
<choice>
|
149
|
+
<value>Timestep</value>
|
150
|
+
<display_name>Timestep</display_name>
|
151
|
+
</choice>
|
152
|
+
<choice>
|
153
|
+
<value>Hourly</value>
|
154
|
+
<display_name>Hourly</display_name>
|
155
|
+
</choice>
|
156
|
+
<choice>
|
157
|
+
<value>Daily</value>
|
158
|
+
<display_name>Daily</display_name>
|
159
|
+
</choice>
|
160
|
+
<choice>
|
161
|
+
<value>Monthly</value>
|
162
|
+
<display_name>Monthly</display_name>
|
163
|
+
</choice>
|
164
|
+
<choice>
|
165
|
+
<value>RunPeriod</value>
|
166
|
+
<display_name>RunPeriod</display_name>
|
167
|
+
</choice>
|
168
|
+
</choices>
|
169
|
+
</argument>
|
170
|
+
<argument>
|
171
|
+
<name>environment_period</name>
|
172
|
+
<display_name>Environment Period</display_name>
|
173
|
+
<description>Environment Period for SQL query</description>
|
174
|
+
<type>String</type>
|
175
|
+
<required>true</required>
|
176
|
+
<model_dependent>false</model_dependent>
|
177
|
+
<default_value>RUN PERIOD 1</default_value>
|
178
|
+
</argument>
|
179
|
+
<argument>
|
180
|
+
<name>norm</name>
|
181
|
+
<display_name>Norm of the difference of csv and sql</display_name>
|
182
|
+
<description>Norm of the difference of csv and sql. 1 is absolute value. 2 is euclidean distance. 3 is raw difference.</description>
|
183
|
+
<type>Double</type>
|
184
|
+
<required>true</required>
|
185
|
+
<model_dependent>false</model_dependent>
|
186
|
+
<default_value>1</default_value>
|
187
|
+
</argument>
|
188
|
+
<argument>
|
189
|
+
<name>scale</name>
|
190
|
+
<display_name>Scale factor to apply to the difference</display_name>
|
191
|
+
<description>Scale factor to apply to the difference (1 is no scale)</description>
|
192
|
+
<type>Double</type>
|
193
|
+
<required>true</required>
|
194
|
+
<model_dependent>false</model_dependent>
|
195
|
+
<default_value>1</default_value>
|
196
|
+
</argument>
|
197
|
+
<argument>
|
198
|
+
<name>find_avail</name>
|
199
|
+
<display_name>Find Available data in the SQL file</display_name>
|
200
|
+
<description>Will RegisterInfo all the 'EnvPeriod', 'ReportingFrequencies', 'VariableNames', 'KeyValues' in the SQL file. Useful for debugging SQL issues.</description>
|
201
|
+
<type>Boolean</type>
|
202
|
+
<required>true</required>
|
203
|
+
<model_dependent>false</model_dependent>
|
204
|
+
<default_value>true</default_value>
|
205
|
+
<choices>
|
206
|
+
<choice>
|
207
|
+
<value>true</value>
|
208
|
+
<display_name>true</display_name>
|
209
|
+
</choice>
|
210
|
+
<choice>
|
211
|
+
<value>false</value>
|
212
|
+
<display_name>false</display_name>
|
213
|
+
</choice>
|
214
|
+
</choices>
|
215
|
+
</argument>
|
216
|
+
<argument>
|
217
|
+
<name>algorithm_download</name>
|
218
|
+
<display_name>algorithm_download</display_name>
|
219
|
+
<description>Make JSON data available for algorithm_download (true/false)</description>
|
220
|
+
<type>Boolean</type>
|
221
|
+
<required>true</required>
|
222
|
+
<model_dependent>false</model_dependent>
|
223
|
+
<default_value>false</default_value>
|
224
|
+
<choices>
|
225
|
+
<choice>
|
226
|
+
<value>true</value>
|
227
|
+
<display_name>true</display_name>
|
228
|
+
</choice>
|
229
|
+
<choice>
|
230
|
+
<value>false</value>
|
231
|
+
<display_name>false</display_name>
|
232
|
+
</choice>
|
233
|
+
</choices>
|
234
|
+
</argument>
|
235
|
+
<argument>
|
236
|
+
<name>plot_flag</name>
|
237
|
+
<display_name>plot_flag timeseries data</display_name>
|
238
|
+
<description>Create plot of timeseries data (true/false)</description>
|
239
|
+
<type>Boolean</type>
|
240
|
+
<required>true</required>
|
241
|
+
<model_dependent>false</model_dependent>
|
242
|
+
<default_value>true</default_value>
|
243
|
+
<choices>
|
244
|
+
<choice>
|
245
|
+
<value>true</value>
|
246
|
+
<display_name>true</display_name>
|
247
|
+
</choice>
|
248
|
+
<choice>
|
249
|
+
<value>false</value>
|
250
|
+
<display_name>false</display_name>
|
251
|
+
</choice>
|
252
|
+
</choices>
|
253
|
+
</argument>
|
254
|
+
<argument>
|
255
|
+
<name>plot_name</name>
|
256
|
+
<display_name>Plot name</display_name>
|
257
|
+
<description>Name to include in reporting file name.</description>
|
258
|
+
<type>String</type>
|
259
|
+
<required>true</required>
|
260
|
+
<model_dependent>false</model_dependent>
|
261
|
+
<default_value></default_value>
|
262
|
+
</argument>
|
263
|
+
<argument>
|
264
|
+
<name>verbose_messages</name>
|
265
|
+
<display_name>verbose_messages</display_name>
|
266
|
+
<description>verbose messages. Useful for debugging but MAJOR Performance Hit.</description>
|
267
|
+
<type>Boolean</type>
|
268
|
+
<required>true</required>
|
269
|
+
<model_dependent>false</model_dependent>
|
270
|
+
<default_value>false</default_value>
|
271
|
+
<choices>
|
272
|
+
<choice>
|
273
|
+
<value>true</value>
|
274
|
+
<display_name>true</display_name>
|
275
|
+
</choice>
|
276
|
+
<choice>
|
277
|
+
<value>false</value>
|
278
|
+
<display_name>false</display_name>
|
279
|
+
</choice>
|
280
|
+
</choices>
|
281
|
+
</argument>
|
282
|
+
<argument>
|
283
|
+
<name>warning_messages</name>
|
284
|
+
<display_name>warning_messages</display_name>
|
285
|
+
<description>Warn on missing data.</description>
|
286
|
+
<type>Boolean</type>
|
287
|
+
<required>true</required>
|
288
|
+
<model_dependent>false</model_dependent>
|
289
|
+
<default_value>true</default_value>
|
290
|
+
<choices>
|
291
|
+
<choice>
|
292
|
+
<value>true</value>
|
293
|
+
<display_name>true</display_name>
|
294
|
+
</choice>
|
295
|
+
<choice>
|
296
|
+
<value>false</value>
|
297
|
+
<display_name>false</display_name>
|
298
|
+
</choice>
|
299
|
+
</choices>
|
300
|
+
</argument>
|
301
|
+
<argument>
|
302
|
+
<name>add_first_zero_for_plots</name>
|
303
|
+
<display_name>add_first_zero_for_plots</display_name>
|
304
|
+
<description>Add a point of zero value to the plot at the beginning of the runperiod.</description>
|
305
|
+
<type>Boolean</type>
|
306
|
+
<required>true</required>
|
307
|
+
<model_dependent>false</model_dependent>
|
308
|
+
<default_value>false</default_value>
|
309
|
+
<choices>
|
310
|
+
<choice>
|
311
|
+
<value>true</value>
|
312
|
+
<display_name>true</display_name>
|
313
|
+
</choice>
|
314
|
+
<choice>
|
315
|
+
<value>false</value>
|
316
|
+
<display_name>false</display_name>
|
317
|
+
</choice>
|
318
|
+
</choices>
|
319
|
+
</argument>
|
320
|
+
<argument>
|
321
|
+
<name>add_last_zero_for_plots</name>
|
322
|
+
<display_name>add_last_zero_for_plots</display_name>
|
323
|
+
<description>Add a point of zero value to the plot at the end of the runperiod.</description>
|
324
|
+
<type>Boolean</type>
|
325
|
+
<required>true</required>
|
326
|
+
<model_dependent>false</model_dependent>
|
327
|
+
<default_value>false</default_value>
|
328
|
+
<choices>
|
329
|
+
<choice>
|
330
|
+
<value>true</value>
|
331
|
+
<display_name>true</display_name>
|
332
|
+
</choice>
|
333
|
+
<choice>
|
334
|
+
<value>false</value>
|
335
|
+
<display_name>false</display_name>
|
336
|
+
</choice>
|
337
|
+
</choices>
|
338
|
+
</argument>
|
339
|
+
</arguments>
|
340
|
+
<outputs>
|
341
|
+
<output>
|
342
|
+
<name>diff</name>
|
343
|
+
<display_name>diff</display_name>
|
344
|
+
<short_name>diff</short_name>
|
345
|
+
<type>Double</type>
|
346
|
+
<model_dependent>false</model_dependent>
|
347
|
+
</output>
|
348
|
+
<output>
|
349
|
+
<name>simdata</name>
|
350
|
+
<display_name>simdata</display_name>
|
351
|
+
<short_name>simdata</short_name>
|
352
|
+
<type>Double</type>
|
353
|
+
<model_dependent>false</model_dependent>
|
354
|
+
</output>
|
355
|
+
<output>
|
356
|
+
<name>csvdata</name>
|
357
|
+
<display_name>csvdata</display_name>
|
358
|
+
<short_name>csvdata</short_name>
|
359
|
+
<type>Double</type>
|
360
|
+
<model_dependent>false</model_dependent>
|
361
|
+
</output>
|
362
|
+
<output>
|
363
|
+
<name>cvrmse</name>
|
364
|
+
<display_name>cvrmse</display_name>
|
365
|
+
<short_name>cvrmse</short_name>
|
366
|
+
<type>Double</type>
|
367
|
+
<model_dependent>false</model_dependent>
|
368
|
+
</output>
|
369
|
+
<output>
|
370
|
+
<name>nmbe</name>
|
371
|
+
<display_name>nmbe</display_name>
|
372
|
+
<short_name>nmbe</short_name>
|
373
|
+
<type>Double</type>
|
374
|
+
<model_dependent>false</model_dependent>
|
375
|
+
</output>
|
376
|
+
</outputs>
|
377
|
+
<provenances/>
|
378
|
+
<tags>
|
379
|
+
<tag>Reporting.QAQC</tag>
|
380
|
+
</tags>
|
381
|
+
<attributes>
|
382
|
+
<attribute>
|
383
|
+
<name>Intended Software Tool</name>
|
384
|
+
<value>OpenStudio Application</value>
|
385
|
+
<datatype>string</datatype>
|
386
|
+
</attribute>
|
387
|
+
<attribute>
|
388
|
+
<name>Intended Software Tool</name>
|
389
|
+
<value>Parametric Analysis Tool</value>
|
390
|
+
<datatype>string</datatype>
|
391
|
+
</attribute>
|
392
|
+
<attribute>
|
393
|
+
<name>Measure Type</name>
|
394
|
+
<value>ReportingMeasure</value>
|
395
|
+
<datatype>string</datatype>
|
396
|
+
</attribute>
|
397
|
+
</attributes>
|
398
|
+
<files>
|
399
|
+
<file>
|
400
|
+
<filename>README.md.erb</filename>
|
401
|
+
<filetype>erb</filetype>
|
402
|
+
<usage_type>readmeerb</usage_type>
|
403
|
+
<checksum>703C9964</checksum>
|
404
|
+
</file>
|
405
|
+
<file>
|
406
|
+
<filename>README.md</filename>
|
407
|
+
<filetype>md</filetype>
|
408
|
+
<usage_type>readme</usage_type>
|
409
|
+
<checksum>3F176FE0</checksum>
|
410
|
+
</file>
|
411
|
+
<file>
|
412
|
+
<filename>LICENSE.md</filename>
|
413
|
+
<filetype>md</filetype>
|
414
|
+
<usage_type>license</usage_type>
|
415
|
+
<checksum>E0468DD6</checksum>
|
416
|
+
</file>
|
417
|
+
<file>
|
418
|
+
<version>
|
419
|
+
<software_program>OpenStudio</software_program>
|
420
|
+
<identifier>2.1.0</identifier>
|
421
|
+
<min_compatible>2.1.0</min_compatible>
|
422
|
+
</version>
|
423
|
+
<filename>measure.rb</filename>
|
424
|
+
<filetype>rb</filetype>
|
425
|
+
<usage_type>script</usage_type>
|
426
|
+
<checksum>5DF37720</checksum>
|
427
|
+
</file>
|
428
|
+
<file>
|
429
|
+
<filename>report.html.erb</filename>
|
430
|
+
<filetype>erb</filetype>
|
431
|
+
<usage_type>resource</usage_type>
|
432
|
+
<checksum>0BA3EB44</checksum>
|
433
|
+
</file>
|
434
|
+
</files>
|
435
|
+
</measure>
|
@@ -0,0 +1,288 @@
|
|
1
|
+
<%
|
2
|
+
# *******************************************************************************
|
3
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
4
|
+
# All rights reserved.
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
16
|
+
# may be used to endorse or promote products derived from this software without
|
17
|
+
# specific prior written permission from the respective party.
|
18
|
+
#
|
19
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
20
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
21
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
22
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
23
|
+
#
|
24
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
25
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
26
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
27
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
28
|
+
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
29
|
+
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
30
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
31
|
+
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
32
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
33
|
+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
34
|
+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35
|
+
# *******************************************************************************
|
36
|
+
%>
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
<!DOCTYPE html>
|
41
|
+
<meta charset="utf-8">
|
42
|
+
<style>
|
43
|
+
|
44
|
+
svg {
|
45
|
+
font: 10px sans-serif;
|
46
|
+
}
|
47
|
+
|
48
|
+
.axis path,
|
49
|
+
.axis line {
|
50
|
+
fill: none;
|
51
|
+
stroke: #000;
|
52
|
+
shape-rendering: crispEdges;
|
53
|
+
}
|
54
|
+
|
55
|
+
.brush .extent {
|
56
|
+
stroke: #fff;
|
57
|
+
fill-opacity: .125;
|
58
|
+
shape-rendering: crispEdges;
|
59
|
+
}
|
60
|
+
|
61
|
+
.xline {
|
62
|
+
stroke-width: 1;
|
63
|
+
fill: none;
|
64
|
+
clip-path: url(#clip);
|
65
|
+
}
|
66
|
+
|
67
|
+
</style>
|
68
|
+
<title><%=@name%></title>
|
69
|
+
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet">
|
70
|
+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
71
|
+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.9/d3.min.js"></script>
|
72
|
+
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
|
73
|
+
</head>
|
74
|
+
<body>
|
75
|
+
<div id="timeseriesplot" class="container">
|
76
|
+
<h1 id="plottitle">Timeseries Plot</h1>
|
77
|
+
</div>
|
78
|
+
<script>
|
79
|
+
|
80
|
+
var allSeries = <%= all_series %>;
|
81
|
+
|
82
|
+
// Set the overall plot heading
|
83
|
+
if (allSeries[0].displayname != "") $("#plottitle").text(allSeries[0].displayname);
|
84
|
+
else $("#plottitle").text(allSeries[0].type);
|
85
|
+
|
86
|
+
// Define size and margins of chart
|
87
|
+
var margin = {top: 10, right: 350, bottom: 100, left: 100},
|
88
|
+
margin2 = {top: 430, right: 350, bottom: 20, left: 100},
|
89
|
+
width = 1500 - margin.left - margin.right,
|
90
|
+
height = 500 - margin.top - margin.bottom,
|
91
|
+
height2 = 500 - margin2.top - margin2.bottom;
|
92
|
+
|
93
|
+
var parseDate = d3.time.format("%b %Y").parse;
|
94
|
+
|
95
|
+
// Determine the bounds of the chart
|
96
|
+
var x_min = new Date('January 1, 3000 00:00:00');
|
97
|
+
var x_max = new Date('January 1, 1900 00:00:00');
|
98
|
+
var y_min = Number.POSITIVE_INFINITY;
|
99
|
+
var y_max = Number.NEGATIVE_INFINITY;
|
100
|
+
$.each(allSeries, function(index, all_series) {
|
101
|
+
var series = allSeries[index];
|
102
|
+
|
103
|
+
this_x_min = d3.min(series.data.map(function(d) { return new Date(d.time); }))
|
104
|
+
this_x_max = d3.max(series.data.map(function(d) { return new Date(d.time); }))
|
105
|
+
this_y_min = d3.min(series.data.map(function(d) { return d.y; }))
|
106
|
+
this_y_max = d3.max(series.data.map(function(d) { return d.y; }))
|
107
|
+
|
108
|
+
if (this_x_min < x_min) x_min = this_x_min;
|
109
|
+
if (this_x_max > x_max) x_max = this_x_max;
|
110
|
+
if (this_y_min < y_min) y_min = this_y_min;
|
111
|
+
if (this_y_max > y_max) y_max = this_y_max;
|
112
|
+
|
113
|
+
});
|
114
|
+
// Log the bounds for debugging
|
115
|
+
console.log("x_min = " + x_min)
|
116
|
+
console.log("x_max = " + x_max)
|
117
|
+
console.log("y_min = " + y_min)
|
118
|
+
console.log("y_max = " + y_max)
|
119
|
+
|
120
|
+
// Increase the y max by a little for readability
|
121
|
+
y_max = y_max + ((y_max - y_min) * 0.25);
|
122
|
+
|
123
|
+
// Horizontal axis scale
|
124
|
+
var x_extent = [this.x_min, this.x_max];
|
125
|
+
|
126
|
+
// Vertical axis scale
|
127
|
+
var y_extent = [this.y_min, this.y_max];
|
128
|
+
|
129
|
+
// Create the x and y scales (width on page) for both chart areas
|
130
|
+
var x = d3.time.scale().range([0, width]),
|
131
|
+
x2 = d3.time.scale().range([0, width]),
|
132
|
+
y = d3.scale.linear().range([height, 0]),
|
133
|
+
y2 = d3.scale.linear().range([height2, 0]);
|
134
|
+
|
135
|
+
// Create the x and y domains (extent of the data) for both chart areas
|
136
|
+
x.domain(x_extent);
|
137
|
+
y.domain(y_extent);
|
138
|
+
x2.domain(x.domain());
|
139
|
+
y2.domain(y.domain());
|
140
|
+
|
141
|
+
// Create and position axes
|
142
|
+
var xAxis = d3.svg.axis().scale(x).orient("bottom"),
|
143
|
+
xAxis2 = d3.svg.axis().scale(x2).orient("bottom"),
|
144
|
+
yAxis = d3.svg.axis().scale(y).tickFormat(d3.format(".2e")).orient("left"),
|
145
|
+
yAxis2 = d3.svg.axis().scale(y2).orient("left");
|
146
|
+
|
147
|
+
// Create the selector
|
148
|
+
var brush = d3.svg.brush()
|
149
|
+
.x(x2)
|
150
|
+
.on("brush", brushed);
|
151
|
+
|
152
|
+
// Function to create lines in the focus area
|
153
|
+
var line = d3.svg.line()
|
154
|
+
.x(function(d) { return x(new Date(d.time)); })
|
155
|
+
.y(function(d) { return y(d.y); });
|
156
|
+
|
157
|
+
// Function to create lines in the context area
|
158
|
+
var line2 = d3.svg.line()
|
159
|
+
.x(function(d) { return x2(new Date(d.time)); })
|
160
|
+
.y(function(d) { return y2(d.y); });
|
161
|
+
|
162
|
+
// Create the overall SVG
|
163
|
+
var svg = d3.select("#timeseriesplot").append("svg")
|
164
|
+
.attr("width", width + margin.left + margin.right)
|
165
|
+
.attr("height", height + margin.top + margin.bottom);
|
166
|
+
|
167
|
+
svg.append("defs").append("clipPath")
|
168
|
+
.attr("id", "clip")
|
169
|
+
.append("rect")
|
170
|
+
.attr("width", width)
|
171
|
+
.attr("height", height);
|
172
|
+
|
173
|
+
// Draw the focus section (main plot)
|
174
|
+
var focus = svg.append("g")
|
175
|
+
.attr("class", "focus")
|
176
|
+
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
177
|
+
|
178
|
+
// Draw the focus x and y axes
|
179
|
+
focusaxis = focus.append("g")
|
180
|
+
.attr("class", "x axis")
|
181
|
+
.attr("transform", "translate(0," + height + ")")
|
182
|
+
.call(xAxis);
|
183
|
+
|
184
|
+
focusaxis.append("text")
|
185
|
+
.text(allSeries[0].type + " [" + allSeries[0].units + "]")
|
186
|
+
.attr("transform", "rotate (-90, 0, 0) translate(" + (height / 5) + "," + (-1*(margin.left / 2 + 20)) + ")"); // TODO dynamically account for width of axis label to center
|
187
|
+
|
188
|
+
focus.append("g")
|
189
|
+
.attr("class", "y axis")
|
190
|
+
.call(yAxis);
|
191
|
+
|
192
|
+
// Draw the context section (selector)
|
193
|
+
var context = svg.append("g")
|
194
|
+
.attr("class", "context")
|
195
|
+
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");
|
196
|
+
|
197
|
+
// Draw the context x axis
|
198
|
+
context.append("g")
|
199
|
+
.attr("class", "x axis")
|
200
|
+
.attr("transform", "translate(0," + height2 + ")")
|
201
|
+
.call(xAxis2);
|
202
|
+
|
203
|
+
// Draw the brush selector for the context
|
204
|
+
context.append("g")
|
205
|
+
.attr("class", "x brush")
|
206
|
+
.call(brush)
|
207
|
+
.selectAll("rect")
|
208
|
+
.attr("y", -6)
|
209
|
+
.attr("height", height2 + 7);
|
210
|
+
|
211
|
+
// set default extent for brush selected (custom code for FRP)
|
212
|
+
brush.extent([new Date("January 15 2009 00:00:00"), new Date("January 16 2009 24:00:00")])
|
213
|
+
context.select('.brush').call(brush);
|
214
|
+
brushed();
|
215
|
+
|
216
|
+
// Setup the spacing for the legends
|
217
|
+
var legendSpacing = 25;
|
218
|
+
|
219
|
+
// Create a legend for the data series
|
220
|
+
var primlegend = focus.append("g")
|
221
|
+
.attr("class", "w axis")
|
222
|
+
.attr("transform", "translate(" + (width + 10) + ",0)");
|
223
|
+
|
224
|
+
// TODO make series toggle-able
|
225
|
+
primlegend.append("text").text("Series Names")
|
226
|
+
//.style("cursor", " pointer")
|
227
|
+
.attr("y", legendSpacing * 1)
|
228
|
+
.attr("class", "noselect");
|
229
|
+
|
230
|
+
// Define the color scale
|
231
|
+
var c20 = d3.scale.category20();
|
232
|
+
c20.domain([1, allSeries.length]);
|
233
|
+
|
234
|
+
// Plot each series
|
235
|
+
var i = 1;
|
236
|
+
$.each(allSeries, function(index, all_series) {
|
237
|
+
var series = allSeries[index];
|
238
|
+
|
239
|
+
// Generate a color
|
240
|
+
var lineColor = series.color
|
241
|
+
|
242
|
+
// Plot on the focus
|
243
|
+
focus.append("path")
|
244
|
+
.datum(series.data)
|
245
|
+
.attr("class", "xline")
|
246
|
+
.attr("d", line)
|
247
|
+
.style("stroke", lineColor);
|
248
|
+
|
249
|
+
// Plot on the context
|
250
|
+
// Note that line2 uses the x2 and y2 scales
|
251
|
+
context.append("path")
|
252
|
+
.datum(series.data)
|
253
|
+
.attr("class", "xline")
|
254
|
+
.attr("d", line2)
|
255
|
+
.style("stroke", lineColor);
|
256
|
+
|
257
|
+
// Add the series name to the legend
|
258
|
+
primlegend.append("text").text(series.name + " [" + series.units + "]")
|
259
|
+
.style("cursor", " pointer")
|
260
|
+
.attr("y", legendSpacing * (i + 1))
|
261
|
+
.attr("class", "noselect")
|
262
|
+
.style("fill", lineColor);
|
263
|
+
|
264
|
+
i += 1;
|
265
|
+
|
266
|
+
});
|
267
|
+
|
268
|
+
// Add the series cvrmse to the legend
|
269
|
+
primlegend.append("text").text("CVRMSE:" + allSeries[0].cvrmse)
|
270
|
+
.attr("y", legendSpacing * (i + 1))
|
271
|
+
.attr("class", "noselect");
|
272
|
+
i += 1;
|
273
|
+
|
274
|
+
// Add the series nmbe to the legend
|
275
|
+
primlegend.append("text").text("NMBE:" + allSeries[0].nmbe)
|
276
|
+
.attr("y", legendSpacing * (i + 1))
|
277
|
+
.attr("class", "noselect");
|
278
|
+
i += 1;
|
279
|
+
|
280
|
+
// Define what to do when the selector is moved around
|
281
|
+
function brushed() {
|
282
|
+
console.log("Brushed")
|
283
|
+
x.domain(brush.empty() ? x2.domain() : brush.extent());
|
284
|
+
focus.selectAll(".xline").attr("d", line);
|
285
|
+
focus.selectAll(".x.axis").call(xAxis);
|
286
|
+
}
|
287
|
+
|
288
|
+
</script>
|