openstudio-analysis 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b214aa6493bf1187a2d2130e0a56696d556c56dd
4
- data.tar.gz: 7d04f958a36a0b5865f03552c1cdce58042316d5
3
+ metadata.gz: 20d2c5efe5a2babc4dadf20a9cef02117c77d4d3
4
+ data.tar.gz: 5510ce7b02e54ea13dc08f6a10b020b1b4b48b0d
5
5
  SHA512:
6
- metadata.gz: 063661d822e81a646777b9ddb2af3c09e8b2329541a1aa5963abaec781131da0f35a44ff54e20ff4ec2d7930584edb837ca179d12e36e3586e6d9953bf656e8d
7
- data.tar.gz: 0914e8713a6e68e77c08daf7399bb3e7bb2a2c6666615aeb8d242eff6b60177e8fe34af81ecc14f81cab577b95ebfbbd66635c429ce61a5a9d6dad330cb2f5b4
6
+ metadata.gz: 296be88cb795fa532c9b3a095339d85e65829bd227e390027e9b5172ef4a90fbd65a2cac548f5487b1c3e5acaa64dbe8c6be45f793e6ec91ab04296aeba86d18
7
+ data.tar.gz: 9e25cbcd1e5c370050bff6a51b00cdf5bbf659f71243b523b0d4b6f4b05444cdb0c82b530d3ed7217da6045c81f87567698f61944d9ea55b53873d5c47bc3540
@@ -12,3 +12,8 @@ Version 0.1.1
12
12
 
13
13
  ### Resolved Issues
14
14
 
15
+ * Added check for when weather file is a zip or an epw
16
+
17
+ * Convert argument values to the right variable types
18
+
19
+ * Add measure type parsing by reading the inherited class
@@ -87,7 +87,7 @@ module OpenStudio
87
87
  def get_binding
88
88
  binding
89
89
  end
90
-
90
+
91
91
  # TODO: move this into a new class that helps construct this file
92
92
  def translate_to_analysis_json
93
93
  # Load in the templates for constructing the JSON file
@@ -125,12 +125,31 @@ module OpenStudio
125
125
  if @variable['variable_type'] == 'argument'
126
126
  ag = nil
127
127
  if @variable['method'] == 'static'
128
+ if !@variable['distribution']['static_value']
129
+ raise "can not have an argument that is not a static value defined in which to set the argument"
130
+ end
131
+
128
132
  # add this as an argument
133
+ case @variable['type']
134
+ when "Double"
135
+ @static_value = @variable['distribution']['static_value'].to_f
136
+ when "Integer"
137
+ @static_value = @variable['distribution']['static_value'].to_i
138
+ when "String", "Choice"
139
+ @static_value = @variable['distribution']['static_value'].inspect
140
+ when "Bool"
141
+ if @variable['distribution']['static_value'].downcase == "true"
142
+ @static_value = true
143
+ else
144
+ @static_value = false
145
+ end
146
+ else
147
+ raise "Unknown variable type of #{@variable['type']}"
148
+ end
129
149
  ag = JSON.parse(argument_template.result(get_binding))
130
- elsif raise "can not have an argument without having a static value defined in which to set the argument"
131
150
  end
132
151
  wf['arguments'] << ag
133
- else
152
+ else # must be a vriable
134
153
  vr = nil
135
154
  if @variable['method'] == 'static'
136
155
  # add this as an argument
@@ -195,8 +214,13 @@ module OpenStudio
195
214
 
196
215
  # Set the weather file as the first in the list -- this is optional
197
216
  # TODO: check if epw or if zip file
217
+
198
218
  analysis_json['analysis']['weather_file']['file_type'] = 'EPW'
199
- analysis_json['analysis']['weather_file']['path'] = "./weather/#{File.basename(@weather_files.first, '.zip')}.epw"
219
+ if File.extname(@weather_files.first) =~ /.zip/i
220
+ analysis_json['analysis']['weather_file']['path'] = "./weather/#{File.basename(@weather_files.first, '.zip')}.epw"
221
+ else
222
+ analysis_json['analysis']['weather_file']['path'] = "./weather/#{File.basename(@weather_files.first)}"
223
+ end
200
224
 
201
225
  json_file_name = "#{@export_path}/#{model[:name]}.json"
202
226
  FileUtils.rm_f(json_file_name) if File.exists?(json_file_name)
@@ -348,6 +372,8 @@ module OpenStudio
348
372
  data['data'][measure_index]['enabled'] = row[0] == "TRUE" ? true : false
349
373
  data['data'][measure_index]['measure_file_name'] = row[2]
350
374
  data['data'][measure_index]['measure_file_name_directory'] = row[2].underscore
375
+ data['data'][measure_index]['measure_type'] = row[3]
376
+
351
377
  data['data'][measure_index]['version'] = @version_id
352
378
 
353
379
  data['data'][measure_index]['variables'] = []
@@ -1,6 +1,6 @@
1
1
  module OpenStudio
2
2
  module Analysis
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  OPENSTUDIO_VERSION = "1.1.2"
5
5
  end
6
6
  end
@@ -2,7 +2,7 @@
2
2
  "display_name": "<%= @variable['display_name'] %>",
3
3
  "machine_name": "<%= @variable['machine_name'] %>",
4
4
  "name": "<%= @variable['name'] %>",
5
- "value": "<%= @variable['distribution']['static_value'] %>",
5
+ "value": <%= @static_value %>,
6
6
  "uuid_DELETEME": "<%= UUID.new.generate %>",
7
7
  "uuid": "<%= UUID.new.generate %>",
8
8
  "version_uuid_DELETEME": "<%= UUID.new.generate %>",
@@ -8,7 +8,7 @@
8
8
  "measure_definition_uuid_CHANGE_TO_ME": "<%= UUID.new.generate %>",
9
9
  "bcl_measure_version_uuid": "<%= UUID.new.generate %>",
10
10
  "measure_definition_version_uuid_CHANGE_TO_ME": "<%= UUID.new.generate %>",
11
- "measure_type": "XmlMeasure",
11
+ "measure_type": "<%= @measure['measure_type'] %> ",
12
12
  "name": "<%= @measure['name'] %>",
13
13
  "display_name": "<%= @measure['display_name'] %>",
14
14
  "uuid": "<%= UUID.new.generate %>",
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: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Long
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2013-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json