openstudio-analysis 1.3.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fce67306a44fa45d81b14281b40e5e9d311333b83c4741fff3dc735d05fb273d
4
- data.tar.gz: b7786960a5d47cfacfea90db7c86fa3f5d25ae66185cb004ec59edcd8449d267
3
+ metadata.gz: b307b715407bd74c16e687f0acfe025555e232cab093d493ddfec92930208928
4
+ data.tar.gz: b03f1c1c73cbd0c7ec95033e91874d9a4ec6ff267ca038877a04d18ec8772f7d
5
5
  SHA512:
6
- metadata.gz: 6324de334d0b870124f373020b54d8493ca91c3d74d441f5adf8c12dd762ec51d042bd9528fe1b5db8b52844007ba887c2a50ea373615fcf800c5bf6fc501e80
7
- data.tar.gz: dfbe7fa89ec24428a0864d55dc14d48c368665fe541e572729af1cb95b034c9555543e54da0cf4827744d8c3fd813a8905f33878a2352b4fc85f8a98506ea6ee
6
+ metadata.gz: ba82343b9d2bc7e35439d1583ee39b6938459e1fd0f83cd6993ab1e6e71dcf185f2da7fedb62d4b02267664576c42b941e22e3fcf673ac321812998ca60bd07d
7
+ data.tar.gz: 4a8aad3e2348fa63e25c6aa07e496b75a79be7b9aa2af92075c1e63524296e60150169f0c9e732c13cd962b6c701e16a16b50474e7005fb3cbf7e090981ee7df
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  OpenStudio Analysis Gem Change Log
2
2
  ==================================
3
3
 
4
+ Version 1.3.1
5
+ -------------
6
+ * Add method to delete a Variable
7
+
4
8
  Version 1.3.0
5
9
  -------------
6
10
  * Create an OSA from an OSW
@@ -50,7 +50,8 @@ module OpenStudio
50
50
  end
51
51
 
52
52
  # these are the allowed analysis types
53
- ANALYSIS_TYPES = ['spea_nrel', 'rgenoud', 'nsga_nrel', 'lhs', 'preflight', 'morris', 'sobol', 'doe', 'fast99', 'ga', 'gaisl', 'single_run', 'repeat_run', 'batch_run']
53
+ ANALYSIS_TYPES = ['diag', 'doe', 'fast99', 'ga', 'gaisl', 'lhs', 'morris', 'nsga_nrel', 'optim',
54
+ 'preflight', 'pso', 'repeat_run', 'rgenoud', 'single_run', 'sobol', 'spea_nrel']
54
55
 
55
56
  def set_attribute(attribute_name, attribute_value)
56
57
  @attributes[attribute_name] = attribute_value
@@ -37,6 +37,6 @@ module OpenStudio
37
37
  module Analysis
38
38
  # format should be ^.*\-{1}[a-z]+[0-9]+
39
39
  # for example: -rc1, -beta6, -customusecase0
40
- VERSION = '1.3.0'.freeze
40
+ VERSION = '1.3.1'.freeze
41
41
  end
42
42
  end
@@ -129,6 +129,16 @@ module OpenStudio
129
129
  v
130
130
  end
131
131
 
132
+ def remove_variable(variable_name)
133
+ v_index = @variables.find_index { |v| v[:argument][:name] == variable_name }
134
+ if v_index
135
+ @variables.delete_at(v_index)
136
+ return true
137
+ else
138
+ return false
139
+ end
140
+ end
141
+
132
142
  # Tag a measure's argument as a variable.
133
143
  #
134
144
  # @param argument_name [String] The instance_name of the measure argument that is to be tagged. This is the same name as the argument's variable in the measure.rb file.
@@ -224,12 +234,18 @@ module OpenStudio
224
234
  end
225
235
 
226
236
  # fix everything to support the legacy version
227
- hash[:variables] = @variables
237
+ # we need to make a deep copy since multiple calls to .to_hash deletes :type, :mode, etc below
238
+ # and we still want those args to be avail for future calls, but not end up in the final OSA hash.
239
+ # without this, the v.delete() below (line ~278-281) will remove :type from @variables.
240
+ # this would be okay if there was only 1 call to .to_hash. but thats not guaranteed
241
+ variables_dup = Marshal.load(Marshal.dump(@variables))
242
+ hash[:variables] = variables_dup
228
243
 
229
244
  # Clean up the variables to match the legacy format
230
245
  hash[:variables].each_with_index do |v, index|
231
246
  v[:variable_type] == 'pivot' ? v[:pivot] = true : v[:variable] = true
232
247
  v[:static_value] = v[:argument][:default_value] unless v[:static_value]
248
+ @variables[index][:static_value] = v[:static_value]
233
249
 
234
250
  v[:uncertainty_description] = {}
235
251
  # In Version 0.5 the _uncertain text will be removed from distribution
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.0
4
+ version: 1.3.1
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-02-17 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcl