openstudio-analysis 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/openstudio/analysis/translator/excel.rb +55 -6
- data/lib/openstudio/analysis/version.rb +1 -1
- data/lib/openstudio-analysis.rb +1 -0
- data/spec/files/analysis/medium_office.json +220 -234
- data/spec/files/analysis/medium_office.zip +0 -0
- data/spec/files/export/analysis/Kats model v2.json +18 -19
- data/spec/files/export/analysis/Kats model v2.zip +0 -0
- data/spec/files/export/analysis/discrete_dynamic_seed.json +18 -19
- data/spec/files/export/analysis/discrete_dynamic_seed.zip +0 -0
- data/spec/files/export/analysis/discrete_seed.json +103 -109
- data/spec/files/export/analysis/discrete_seed.zip +0 -0
- data/spec/files/export/analysis/output_vars.json +95 -101
- data/spec/files/export/analysis/output_vars.zip +0 -0
- data/spec/files/export/analysis/small_seed.json +95 -101
- data/spec/files/export/analysis/small_seed.zip +0 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.68.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.68.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.68.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.26.xml +19 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.10.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.68.xml +20 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.34.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.40.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.20.xml +37 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.17.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.68.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.68.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.68.xml +24 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.68.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.17.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.2.xml +20 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.3.xml +33 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.68.xml +7 -0
- metadata +38 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d683426f53729c1e849371d14163a51de8bd3fed
|
4
|
+
data.tar.gz: 1f9d4dadb3d92791c38cd638c11e2c43964aa34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d87903bcd2c30d112ecfb625d786603c2e3f9aabf23b4a6a5a1b2cf65093768cdab3da379cad0a9a886469d6688f546abb49a86841a0601f5dc23722da934f6a
|
7
|
+
data.tar.gz: 943e938546c5f148095103912d3e7ce95a68780c21442b158bf6989d6f2e82352aa40256a4e1893d428ba7bf17fe942570896f9bd1c610fd81ab7a3ad11fd723
|
@@ -167,6 +167,8 @@ module OpenStudio
|
|
167
167
|
@template_json
|
168
168
|
end
|
169
169
|
|
170
|
+
# save_analysis will iterate over each model that is defined in the spreadsheet and save the
|
171
|
+
# zip and json file.
|
170
172
|
def save_analysis
|
171
173
|
@template_json = create_analysis_hash
|
172
174
|
|
@@ -309,6 +311,15 @@ module OpenStudio
|
|
309
311
|
binding
|
310
312
|
end
|
311
313
|
|
314
|
+
def add_directory_to_zip(zipfile, local_directory, relative_zip_directory)
|
315
|
+
# pp "Add Directory #{local_directory}"
|
316
|
+
Dir[File.join("#{local_directory}", '**', '**')].each do |file|
|
317
|
+
# pp "Adding File #{file}"
|
318
|
+
zipfile.add(file.sub(local_directory, relative_zip_directory), file)
|
319
|
+
end
|
320
|
+
zipfile
|
321
|
+
end
|
322
|
+
|
312
323
|
# Package up the seed, weather files, and measures
|
313
324
|
def save_analysis_zip(model)
|
314
325
|
zipfile_name = "#{@export_path}/#{model[:name]}.zip"
|
@@ -320,11 +331,49 @@ module OpenStudio
|
|
320
331
|
zipfile.add("./weather/#{File.basename(filename)}", filename)
|
321
332
|
end
|
322
333
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
334
|
+
# Add only the measures that are defined in the spreadsheet
|
335
|
+
added_measures = []
|
336
|
+
measure_files = Dir.glob("#{@measure_path}/**/measure.rb")
|
337
|
+
|
338
|
+
# go through each of the Variables
|
339
|
+
@variables['data'].each do |v|
|
340
|
+
measure_to_save = nil
|
341
|
+
measure_files.each do |measure|
|
342
|
+
# pp v['measure_file_name_directory']
|
343
|
+
if measure.include? "/#{v['measure_file_name_directory']}/"
|
344
|
+
measure_to_save = File.dirname(measure)
|
345
|
+
# pp "Measure to save is #{measure}"
|
346
|
+
break
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
if v['measure_file_name_directory'] =~ /baseline/i
|
351
|
+
puts ' Skipping baseline measure'
|
352
|
+
next
|
353
|
+
end
|
354
|
+
|
355
|
+
if measure_to_save && !added_measures.include?(measure_to_save)
|
356
|
+
# pp "Attempting to add measure #{measure_to_save}"
|
357
|
+
if File.exist?(measure_to_save)
|
358
|
+
# pp "Adding measure directory to zip #{measure_to_save}"
|
359
|
+
Dir[File.join(measure_to_save, '**')].each do |file|
|
360
|
+
if File.directory?(file)
|
361
|
+
if File.basename(file) == 'resources'
|
362
|
+
add_directory_to_zip(zipfile, file, "./measures/#{v['measure_file_name_directory']}/#{File.basename(file)}")
|
363
|
+
else
|
364
|
+
# pp "Skipping Directory #{File.basename(file)}"
|
365
|
+
end
|
366
|
+
else
|
367
|
+
# pp "Adding File #{file}"
|
368
|
+
# added_measures << measure_dir unless added_measures.include? measure_dir
|
369
|
+
zipfile.add(file.sub(measure_to_save, "./measures/#{v['measure_file_name_directory']}/"), file)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
added_measures << measure_to_save unless added_measures.include? measure_to_save
|
373
|
+
else
|
374
|
+
fail "Could not find measure to add to zip for #{@measure_path}/#{v['measure_file_name_directory']}"
|
375
|
+
end
|
376
|
+
end
|
328
377
|
end
|
329
378
|
|
330
379
|
# puts "Adding #{model[:path]}"
|
@@ -516,7 +565,7 @@ module OpenStudio
|
|
516
565
|
notes: 'notes',
|
517
566
|
relation_to_eui: 'typical var to eui relationship',
|
518
567
|
clean: true)
|
519
|
-
elsif @version >= '0.1.12'
|
568
|
+
elsif @version >= '0.1.12' # add delta x
|
520
569
|
rows = @xls.sheet('Variables').parse(enabled: '# variable',
|
521
570
|
measure_name_or_var_type: 'type',
|
522
571
|
measure_file_name_or_var_display_name: 'parameter display name.*',
|