openstudio-analysis 1.3.2 → 1.3.3
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/CHANGELOG.md +20 -3
- data/lib/openstudio/analysis/formulation.rb +42 -18
- data/lib/openstudio/analysis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b57a1b469c94255be338f754cd6b450e3c059210ec05897d9b0d6825904e6f7
|
4
|
+
data.tar.gz: a663a6646924dde02c9b45ce6d9761d5b5aed59ef2f3067ceab4d6786c09259d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20acbefdd350cb6706814d39e513f92abee35dc32538e61aabc209b2c17b3059ecfe2c5ce1dd5489e15d5dd20d5c5af686c74228f54038e187b1956830de3012
|
7
|
+
data.tar.gz: c37631b399d554ba2115d1946280a20d40766a26e1521c0e301ed79722c5e77d05974140691823119e93d7b29d0a04765251ffb8089300e6444037b9ee4d1074
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,34 @@
|
|
1
1
|
OpenStudio Analysis Gem Change Log
|
2
2
|
==================================
|
3
3
|
|
4
|
+
Version 1.3.3
|
5
|
+
-------------
|
6
|
+
* Add arguments to .save_osa_zip() to add all files in weather and/or seed directories to zip file. defaults to false.
|
7
|
+
|
4
8
|
Version 1.3.2
|
5
9
|
-------------
|
6
|
-
* Add
|
10
|
+
* Add array of search paths to .convert_osw() to find measures in various directories.
|
11
|
+
* warn if :weather_file and :seed_model are not defined.
|
12
|
+
* use :file_paths in the OSW to search for :seed_model and :weather_file.
|
13
|
+
* add .stat and .ddy files to analysis.zip if in same directory as .epw defined in :weather_file.
|
14
|
+
* use :measure_paths in OSW to search for measures.
|
7
15
|
|
8
16
|
Version 1.3.1
|
9
17
|
-------------
|
10
|
-
* Add method to delete a Variable
|
18
|
+
* Add method to delete a Variable: **analysis.remove_variable()**
|
19
|
+
* fix bug related to multiple calls to analysis.to_hash deleting variables
|
20
|
+
* Add PSO and Optim to allowed algorithms
|
11
21
|
|
12
22
|
Version 1.3.0
|
13
23
|
-------------
|
14
|
-
* Create an OSA from an OSW
|
24
|
+
* Create an OSA from an OSW: **analysis.convert_osw()**
|
25
|
+
* Add output variables and objective functions: **analysis.add_output()**
|
26
|
+
* Add server initialization and finalization scripts: **analysis.server_scripts.add()**
|
27
|
+
* Set algorithm attributes: **analysis.algorithm.set_attribute()**
|
28
|
+
* Set algorithm type: **analysis.analysis_type()**
|
29
|
+
* Add additional library/data files: **analysis.libraries.add()**
|
30
|
+
* create analysis.json: **File.write('analysis.json',JSON.pretty_generate(analysis.to_hash))**
|
31
|
+
* create analysis.zip: **analysis.save_osa_zip('analysis.zip')**
|
15
32
|
|
16
33
|
Version 1.2.0
|
17
34
|
-------------
|
@@ -351,12 +351,12 @@ module OpenStudio
|
|
351
351
|
end
|
352
352
|
|
353
353
|
|
354
|
-
def save_osa_zip(filename)
|
354
|
+
def save_osa_zip(filename, all_weather_files = false, all_seed_files = false)
|
355
355
|
filename += '.zip' if File.extname(filename) == ''
|
356
356
|
|
357
357
|
FileUtils.mkdir_p File.dirname(filename) unless Dir.exist? File.dirname(filename)
|
358
358
|
|
359
|
-
save_analysis_zip_osa(filename)
|
359
|
+
save_analysis_zip_osa(filename, all_weather_files, all_seed_files)
|
360
360
|
end
|
361
361
|
|
362
362
|
# convert an OSW to an OSA
|
@@ -487,12 +487,11 @@ module OpenStudio
|
|
487
487
|
# New format for OSAs. Package up the seed, weather files, and measures
|
488
488
|
# filename is the name of the file to be saved. ex: analysis.zip
|
489
489
|
# it will parse the OSA and zip up all the files defined in the workflow
|
490
|
-
def save_analysis_zip_osa(filename)
|
490
|
+
def save_analysis_zip_osa(filename, all_weather_files = false, all_seed_files = false)
|
491
491
|
def add_directory_to_zip_osa(zipfile, local_directory, relative_zip_directory)
|
492
492
|
puts "Add Directory #{local_directory}"
|
493
493
|
Dir[File.join(local_directory.to_s, '**', '**')].each do |file|
|
494
494
|
puts "Adding File #{file}"
|
495
|
-
|
496
495
|
zipfile.add(file.sub(local_directory, relative_zip_directory), file)
|
497
496
|
end
|
498
497
|
zipfile
|
@@ -503,27 +502,30 @@ module OpenStudio
|
|
503
502
|
puts "osw_path: #{@osw_path}"
|
504
503
|
osw_full_path = File.dirname(File.expand_path(@osw_path))
|
505
504
|
puts "osw_full_path: #{osw_full_path}"
|
506
|
-
|
505
|
+
|
507
506
|
Zip::File.open(filename, create: true) do |zf|
|
508
|
-
|
507
|
+
## Weather files
|
509
508
|
puts 'Adding Support Files: Weather'
|
510
|
-
#check if weather file exists. use abs path. remove leading ./ from @weather_file path if there.
|
511
|
-
#check if path is already absolute
|
509
|
+
# check if weather file exists. use abs path. remove leading ./ from @weather_file path if there.
|
510
|
+
# check if path is already absolute
|
512
511
|
if @weather_file[:file]
|
513
512
|
if File.exists?(@weather_file[:file])
|
514
513
|
puts " Adding #{@weather_file[:file]}"
|
515
514
|
#zf.add("weather/#{File.basename(@weather_file[:file])}", @weather_file[:file])
|
516
515
|
base_name = File.basename(@weather_file[:file], ".*")
|
517
516
|
puts "base_name: #{base_name}"
|
518
|
-
#convert backslash on windows to forward slash so Dir.glob will work (in case user uses \)
|
517
|
+
# convert backslash on windows to forward slash so Dir.glob will work (in case user uses \)
|
519
518
|
weather_dirname = File.dirname(@weather_file[:file]).gsub("\\", "/")
|
520
519
|
puts "weather_dirname: #{weather_dirname}"
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
520
|
+
# If all_weather_files is true, add all files in the directory to the zip.
|
521
|
+
# Otherwise, add only files that match the base name.
|
522
|
+
file_pattern = all_weather_files ? "*" : "#{base_name}.*"
|
523
|
+
Dir.glob(File.join(weather_dirname, file_pattern)) do |file_path|
|
524
|
+
puts "file_path: #{file_path}"
|
525
|
+
puts "zip path: weather/#{File.basename(file_path)}"
|
526
|
+
zf.add("weather/#{File.basename(file_path)}", file_path)
|
527
|
+
end
|
528
|
+
# make absolute path and check for file
|
527
529
|
elsif File.exists?(File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, '')))
|
528
530
|
puts " Adding: #{File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, ''))}"
|
529
531
|
#zf.add("weather/#{File.basename(@weather_file[:file])}", File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, '')))
|
@@ -531,7 +533,8 @@ module OpenStudio
|
|
531
533
|
puts "base_name2: #{base_name}"
|
532
534
|
weather_dirname = File.dirname(File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, ''))).gsub("\\", "/")
|
533
535
|
puts "weather_dirname: #{weather_dirname}"
|
534
|
-
|
536
|
+
file_pattern = all_weather_files ? "*" : "#{base_name}.*"
|
537
|
+
Dir.glob(File.join(weather_dirname, file_pattern)) do |file_path|
|
535
538
|
puts "file_path2: #{file_path}"
|
536
539
|
puts "zip path2: weather/#{File.basename(file_path)}"
|
537
540
|
zf.add("weather/#{File.basename(file_path)}", file_path)
|
@@ -541,7 +544,7 @@ module OpenStudio
|
|
541
544
|
end
|
542
545
|
else
|
543
546
|
warn "weather_file[:file] is not defined"
|
544
|
-
end
|
547
|
+
end
|
545
548
|
|
546
549
|
## Seed files
|
547
550
|
puts 'Adding Support Files: Seed Models'
|
@@ -551,16 +554,37 @@ module OpenStudio
|
|
551
554
|
if File.exists?(@seed_model[:file])
|
552
555
|
puts " Adding #{@seed_model[:file]}"
|
553
556
|
zf.add("seeds/#{File.basename(@seed_model[:file])}", @seed_model[:file])
|
557
|
+
if all_seed_files
|
558
|
+
seed_dirname = File.dirname(@seed_model[:file]).gsub("\\", "/")
|
559
|
+
puts "seed_dirname: #{seed_dirname}"
|
560
|
+
Dir.glob(File.join(seed_dirname, '*')) do |file_path|
|
561
|
+
next if file_path == @seed_model[:file] # Skip if the file is the same as @seed_model[:file] so not added twice
|
562
|
+
puts "file_path: #{file_path}"
|
563
|
+
puts "zip path: seeds/#{File.basename(file_path)}"
|
564
|
+
zf.add("seeds/#{File.basename(file_path)}", file_path)
|
565
|
+
end
|
566
|
+
end
|
554
567
|
#make absolute path and check for file
|
555
568
|
elsif File.exists?(File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, '')))
|
556
569
|
puts " Adding #{File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, ''))}"
|
557
570
|
zf.add("seeds/#{File.basename(@seed_model[:file])}", File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, '')))
|
571
|
+
if all_seed_files
|
572
|
+
seed_dirname = File.dirname(File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, ''))).gsub("\\", "/")
|
573
|
+
puts "seed_dirname: #{seed_dirname}"
|
574
|
+
Dir.glob(File.join(seed_dirname, '*')) do |file_path|
|
575
|
+
next if file_path == File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, '')) # Skip if the file is the same as @seed_model[:file] so not added twice
|
576
|
+
puts "file_path: #{file_path}"
|
577
|
+
puts "zip path: seeds/#{File.basename(file_path)}"
|
578
|
+
zf.add("seeds/#{File.basename(file_path)}", file_path)
|
579
|
+
end
|
580
|
+
end
|
558
581
|
else
|
559
582
|
raise "seed_file[:file] does not exist at: #{File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, ''))}"
|
560
583
|
end
|
561
584
|
else
|
562
585
|
warn "seed_file[:file] is not defined"
|
563
|
-
end
|
586
|
+
end
|
587
|
+
|
564
588
|
puts 'Adding Support Files: Libraries'
|
565
589
|
@libraries.each do |lib|
|
566
590
|
raise "Libraries must specify their 'library_name' as metadata which becomes the directory upon zip" unless lib[:metadata][:library_name]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstudio-analysis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Long
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcl
|