urbanopt-reporting 0.3.2 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/LICENSE.md +29 -17
- data/Rakefile +16 -6
- data/doc_templates/copyright_ruby.txt +17 -7
- data/lib/measures/default_feature_reports/measure.rb +156 -95
- data/lib/measures/export_modelica_loads/LICENSE.md +27 -0
- data/lib/measures/export_modelica_loads/README.md +26 -0
- data/lib/measures/export_modelica_loads/README.md.erb +42 -0
- data/lib/measures/export_modelica_loads/docs/.gitkeep +0 -0
- data/lib/measures/export_modelica_loads/measure.rb +374 -0
- data/lib/measures/export_modelica_loads/measure.xml +92 -0
- data/lib/measures/export_modelica_loads/resources/report.html.in +13 -0
- data/lib/measures/export_time_series_modelica/LICENSE.md +1 -0
- data/lib/measures/export_time_series_modelica/README.md +59 -0
- data/lib/measures/export_time_series_modelica/README.md.erb +42 -0
- data/lib/measures/export_time_series_modelica/docs/.gitkeep +0 -0
- data/lib/measures/export_time_series_modelica/measure.rb +430 -0
- data/lib/measures/export_time_series_modelica/measure.xml +147 -0
- data/lib/measures/export_time_series_modelica/resources/os_lib_helper_methods.rb +399 -0
- data/lib/measures/export_time_series_modelica/resources/report.html.in +13 -0
- data/lib/urbanopt/reporting.rb +16 -6
- data/lib/urbanopt/reporting/default_reports.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/construction_cost.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/date.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/end_use.rb +54 -23
- data/lib/urbanopt/reporting/default_reports/end_uses.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/extension.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/feature_report.rb +68 -6
- data/lib/urbanopt/reporting/default_reports/generator.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/location.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/logger.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/power_distribution.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/program.rb +17 -7
- data/lib/urbanopt/reporting/default_reports/reporting_period.rb +30 -8
- data/lib/urbanopt/reporting/default_reports/scenario_report.rb +26 -11
- data/lib/urbanopt/reporting/default_reports/schema/scenario_csv_columns.txt +11 -10
- data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +27 -12
- data/lib/urbanopt/reporting/default_reports/solar_pv.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/storage.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +17 -7
- data/lib/urbanopt/reporting/default_reports/validator.rb +16 -6
- data/lib/urbanopt/reporting/default_reports/wind.rb +16 -6
- data/lib/urbanopt/reporting/derived_extension.rb +16 -6
- data/lib/urbanopt/reporting/version.rb +17 -7
- metadata +17 -2
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>ReportingMeasure</title>
|
6
|
+
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
|
7
|
+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
8
|
+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.9/d3.min.js"></script>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<%= output %>
|
12
|
+
</body>
|
13
|
+
</html>
|
data/lib/urbanopt/reporting.rb
CHANGED
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -38,7 +48,7 @@ module URBANopt
|
|
38
48
|
# Enduse class all enduse energy consumption results.
|
39
49
|
##
|
40
50
|
class EndUse
|
41
|
-
attr_accessor :heating, :cooling, :interior_lighting, :exterior_lighting, :interior_equipment, :exterior_equipment,
|
51
|
+
attr_accessor :heating, :cooling, :interior_lighting, :exterior_lighting, :interior_equipment, :exterior_equipment, :electric_vehicles,
|
42
52
|
:fans, :pumps, :heat_rejection, :humidification, :heat_recovery, :water_systems, :refrigeration, :generators # :nodoc:
|
43
53
|
|
44
54
|
##
|
@@ -59,6 +69,7 @@ module URBANopt
|
|
59
69
|
@exterior_lighting = hash[:exterior_lighting]
|
60
70
|
@interior_equipment = hash[:interior_equipment]
|
61
71
|
@exterior_equipment = hash[:exterior_equipment]
|
72
|
+
@electric_vehicles = hash[:electric_vehicles]
|
62
73
|
@fans = hash[:fans]
|
63
74
|
@pumps = hash[:pumps]
|
64
75
|
@heat_rejection = hash[:heat_rejection]
|
@@ -85,6 +96,7 @@ module URBANopt
|
|
85
96
|
hash[:exterior_lighting] = nil
|
86
97
|
hash[:interior_equipment] = nil
|
87
98
|
hash[:exterior_equipment] = nil
|
99
|
+
hash[:electric_vehicles] = nil
|
88
100
|
hash[:fans] = nil
|
89
101
|
hash[:pumps] = nil
|
90
102
|
hash[:heat_rejection] = nil
|
@@ -112,6 +124,7 @@ module URBANopt
|
|
112
124
|
result[:exterior_lighting] = @exterior_lighting
|
113
125
|
result[:interior_equipment] = @interior_equipment
|
114
126
|
result[:exterior_equipment] = @exterior_equipment
|
127
|
+
result[:electric_vehicles] = @electric_vehicles
|
115
128
|
result[:fans] = @fans
|
116
129
|
result[:pumps] = @pumps
|
117
130
|
result[:heat_rejection] = @heat_rejection
|
@@ -129,27 +142,45 @@ module URBANopt
|
|
129
142
|
return result
|
130
143
|
end
|
131
144
|
|
145
|
+
##
|
146
|
+
# Adds up +existing_value+ and +new_values+ if not nill.
|
147
|
+
##
|
148
|
+
# [parameter:]
|
149
|
+
# +existing_value+ - _Float_ - A value corresponding to a EndUse attribute.
|
150
|
+
##
|
151
|
+
# +new_value+ - _Float_ - A value corresponding to a EndUse attribute.
|
152
|
+
##
|
153
|
+
def add_values(existing_value, new_value)
|
154
|
+
if existing_value && new_value
|
155
|
+
existing_value += new_value
|
156
|
+
elsif new_value
|
157
|
+
existing_value = new_value
|
158
|
+
end
|
159
|
+
return existing_value
|
160
|
+
end
|
161
|
+
|
132
162
|
##
|
133
163
|
# Aggregate values of each EndUse attribute.
|
134
164
|
##
|
135
165
|
# [Parameters:]
|
136
|
-
# +
|
166
|
+
# +other+ - _EndUse_ - An object of EndUse class.
|
137
167
|
##
|
138
|
-
def merge_end_use!(
|
139
|
-
@heating
|
140
|
-
@cooling
|
141
|
-
@interior_lighting
|
142
|
-
@exterior_lighting
|
143
|
-
@interior_equipment
|
144
|
-
@exterior_equipment
|
145
|
-
@
|
146
|
-
@
|
147
|
-
@
|
148
|
-
@
|
149
|
-
@
|
150
|
-
@
|
151
|
-
@
|
152
|
-
@
|
168
|
+
def merge_end_use!(other)
|
169
|
+
@heating = add_values(@heating, other.heating)
|
170
|
+
@cooling = add_values(@cooling, other.cooling)
|
171
|
+
@interior_lighting = add_values(@interior_lighting, other.interior_lighting)
|
172
|
+
@exterior_lighting = add_values(@exterior_lighting, other.exterior_lighting)
|
173
|
+
@interior_equipment = add_values(@interior_equipment, other.interior_equipment)
|
174
|
+
@exterior_equipment = add_values(@exterior_equipment, other.exterior_equipment)
|
175
|
+
@electric_vehicles = add_values(@electric_vehicles, other.electric_vehicles)
|
176
|
+
@fans = add_values(@fans, other.fans)
|
177
|
+
@pumps = add_values(@pumps, other.pumps)
|
178
|
+
@heat_rejection = add_values(@heat_rejection, other.heat_rejection)
|
179
|
+
@humidification = add_values(@humidification, other.humidification)
|
180
|
+
@heat_recovery = add_values(@heat_recovery, other.heat_recovery)
|
181
|
+
@water_systems = add_values(@water_systems, other.water_systems)
|
182
|
+
@refrigeration = add_values(@refrigeration, other.refrigeration)
|
183
|
+
@generators = add_values(@generators, other.generators)
|
153
184
|
|
154
185
|
return self
|
155
186
|
end
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -1,21 +1,31 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
2
|
+
# URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
|
-
|
4
|
+
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
6
6
|
# are permitted provided that the following conditions are met:
|
7
|
-
|
7
|
+
|
8
8
|
# Redistributions of source code must retain the above copyright notice, this list
|
9
9
|
# of conditions and the following disclaimer.
|
10
|
-
|
10
|
+
|
11
11
|
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
12
|
# list of conditions and the following disclaimer in the documentation and/or other
|
13
13
|
# materials provided with the distribution.
|
14
|
-
|
14
|
+
|
15
15
|
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
16
|
# used to endorse or promote products derived from this software without specific
|
17
17
|
# prior written permission.
|
18
|
-
|
18
|
+
|
19
|
+
# Redistribution of this software, without modification, must refer to the software
|
20
|
+
# by the same designation. Redistribution of a modified version of this software
|
21
|
+
# (i) may not refer to the modified version by the same designation, or by any
|
22
|
+
# confusingly similar designation, and (ii) must refer to the underlying software
|
23
|
+
# originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
24
|
+
# the term “URBANopt”, or any confusingly similar designation may not be used to
|
25
|
+
# refer to any modified version of this software or any modified version of the
|
26
|
+
# underlying software originally provided by Alliance without the prior written
|
27
|
+
# consent of Alliance.
|
28
|
+
|
19
29
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
30
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
31
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
@@ -40,6 +50,7 @@ require_relative 'thermal_storage'
|
|
40
50
|
|
41
51
|
require 'json-schema'
|
42
52
|
require 'json'
|
53
|
+
require 'fileutils'
|
43
54
|
|
44
55
|
module URBANopt
|
45
56
|
module Reporting
|
@@ -223,6 +234,55 @@ module URBANopt
|
|
223
234
|
return result
|
224
235
|
end
|
225
236
|
|
237
|
+
##
|
238
|
+
# Saves the 'default_feature_report.json' and 'default_feature_report.csv' files
|
239
|
+
##
|
240
|
+
# [parameters]:
|
241
|
+
# +file_name+ - _String_ - Assign a name to the saved feature results file without an extension
|
242
|
+
def save(file_name = 'default_feature_report')
|
243
|
+
# reassign the initialize local variable @file_name to the file name input.
|
244
|
+
@file_name = file_name
|
245
|
+
|
246
|
+
# save the feature reports csv and json data
|
247
|
+
old_timeseries_path = nil
|
248
|
+
if !@timeseries_csv.path.nil?
|
249
|
+
old_timeseries_path = @timeseries_csv.path
|
250
|
+
end
|
251
|
+
|
252
|
+
# define the results_dir_path
|
253
|
+
results_dir_path = File.join(@directory_name, 'feature_reports')
|
254
|
+
# create feature reports directory
|
255
|
+
Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
|
256
|
+
|
257
|
+
@timeseries_csv.path = File.join(@directory_name, 'feature_reports', file_name + '.csv')
|
258
|
+
FileUtils.mkdir_p File.dirname(@timeseries_csv.path)
|
259
|
+
@timeseries_csv.save_data
|
260
|
+
|
261
|
+
## save json rport
|
262
|
+
# feature_hash
|
263
|
+
feature_hash = to_hash
|
264
|
+
|
265
|
+
json_name_path = File.join(results_dir_path, file_name + '.json')
|
266
|
+
|
267
|
+
File.open(json_name_path, 'w') do |f|
|
268
|
+
f.puts JSON.pretty_generate(feature_hash)
|
269
|
+
# make sure data is written to the disk one way or the other
|
270
|
+
begin
|
271
|
+
f.fsync
|
272
|
+
rescue StandardError
|
273
|
+
f.flush
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
if !old_timeseries_path.nil?
|
278
|
+
@timeseries_csv.path = old_timeseries_path
|
279
|
+
else
|
280
|
+
@timeseries_csv.path = File.join(@directory_name, file_name + '.csv')
|
281
|
+
end
|
282
|
+
|
283
|
+
return true
|
284
|
+
end
|
285
|
+
|
226
286
|
##
|
227
287
|
# Calls the individual functions to save 'default_feature_report.json' and 'default_feature_report.csv'
|
228
288
|
# For backward compatibility and ease of use
|
@@ -267,6 +327,8 @@ module URBANopt
|
|
267
327
|
|
268
328
|
##
|
269
329
|
# Saves the 'default_feature_report.csv' file to the results directory
|
330
|
+
# This method only copies the CSV feature reports from the folder generated by the reporting measure
|
331
|
+
# (<meausure number>_default_feature_reports/) to the new feature_reports/ folder
|
270
332
|
##
|
271
333
|
# [parameters]:
|
272
334
|
# +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
|