openstudio-workflow 1.1.0 → 1.1.1

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: d9d68b3e07b560c00048d9804bc0b335616b4ff6
4
- data.tar.gz: 48da479660bf59a3f06297a4b80917c9ad8fb534
3
+ metadata.gz: 532be0c06d55d26e5093d3ab50408d22a959ec5e
4
+ data.tar.gz: 2d1a4981f3064bb321a26adba13b865c4cf8fa7f
5
5
  SHA512:
6
- metadata.gz: 4e2fd88631224d04ca0f347863ab5ed19817f08e3edf05c3a1109a3e54be82a71ae3d88040e3a7ff91d2507762a22adc919be436bd9c05744478127434543525
7
- data.tar.gz: a9fa849f8c5d4e0534c25a223764486356eafb1d4ef9f10e7e8525c64ad38a5ea01556180e57ad9ab9c9d70ff0e7a28e0534f06b5b1587ae529be9924e7ce22f
6
+ metadata.gz: e993c121bd067a2ed62531e7fd53d49193fac78f50cb4965eae72346b799255935a076325aacb19bbd202150ca90b7eb4eebf7eaf532588d2e651c5fdf58465f
7
+ data.tar.gz: ca03998c2563d734ed1b975538f5b7375a270bfa79128d5142380b8e4ff51e32e90b876ae23d9afd89af829606936c6d64d0396f5aff784f7bc038cbb0619d2d
@@ -56,6 +56,11 @@ module OpenStudio
56
56
  #
57
57
  def communicate_energyplus_stdout(_ = nil, _ = nil)
58
58
  end
59
+
60
+ # Do nothing on Measure result
61
+ #
62
+ def communicate_measure_result(_ = nil, _ = nil)
63
+ end
59
64
 
60
65
  # Write the measure attributes to the filesystem
61
66
  #
@@ -64,6 +64,27 @@ module OpenStudio
64
64
  super
65
65
  @socket.write(line)
66
66
  end
67
+
68
+ def communicate_measure_result(result, options = {})
69
+ super
70
+
71
+ step_result = result.stepResult
72
+ initial_condition = result.stepInitialCondition
73
+ final_condition = result.stepFinalCondition
74
+ errors = result.stepErrors
75
+ warnings = result.stepWarnings
76
+ infos = result.stepInfo
77
+
78
+ # Mirrors WorkflowStepResult::string
79
+ tab = ' '
80
+ @socket.write("#{tab}Result: #{step_result.get.valueName}\n") if !step_result.empty?
81
+ @socket.write("#{tab}Initial Condition: #{initial_condition.get}\n") if !initial_condition.empty?
82
+ @socket.write("#{tab}Final Condition: #{final_condition.get}\n") if !final_condition.empty?
83
+ errors.each {|error| @socket.write("#{tab}Error: #{error}\n") }
84
+ warnings.each {|warning| @socket.write("#{tab}Warn: #{warning}\n") }
85
+ infos.each {|info| @socket.write("#{tab}Info: #{info}\n") }
86
+ end
87
+
67
88
  end
68
89
  end
69
90
  end
@@ -56,6 +56,10 @@ module OpenStudio
56
56
  def communicate_energyplus_stdout(line, options = {})
57
57
  super
58
58
  end
59
+
60
+ def communicate_measure_result(result, options = {})
61
+ super
62
+ end
59
63
  end
60
64
  end
61
65
  end
@@ -39,6 +39,10 @@ module OpenStudio
39
39
  instance.communicate_energyplus_stdout line, options
40
40
  end
41
41
 
42
+ def communicate_measure_result(result, options = {})
43
+ instance.communicate_measure_result result, options
44
+ end
45
+
42
46
  def communicate_measure_attributes(measure_attributes, options = {})
43
47
  instance.communicate_measure_attributes measure_attributes, options
44
48
  end
@@ -414,11 +414,15 @@ module OpenStudio
414
414
  # add the error to the osw.out
415
415
  runner.registerError("#{e.message}\n\t#{e.backtrace.join("\n\t")}")
416
416
 
417
+ result = runner.result
418
+
417
419
  if !energyplus_output_requests
418
420
  # incrementStep must be called after run
419
421
  runner.incrementStep
420
422
  end
421
423
 
424
+ options[:output_adapter].communicate_measure_result(result) if options[:output_adapter]
425
+
422
426
  log_message = "Runner error #{__FILE__} failed with #{e.message}, #{e.backtrace.join("\n")}"
423
427
  raise log_message
424
428
  end
@@ -435,9 +439,11 @@ module OpenStudio
435
439
 
436
440
  # incrementStep must be called after run
437
441
  runner.incrementStep
442
+
443
+ options[:output_adapter].communicate_measure_result(result) if options[:output_adapter]
438
444
 
439
445
  errors = result.stepErrors
440
-
446
+
441
447
  fail "Measure #{measure_dir_name} reported an error with #{errors}" if errors.size != 0
442
448
  logger.debug "Running of measure '#{measure_dir_name}' completed. Post-processing measure output"
443
449
 
@@ -19,6 +19,6 @@
19
19
 
20
20
  module OpenStudio
21
21
  module Workflow
22
- VERSION = '1.1.0'.freeze # Suffixes must have periods (not dashes)
22
+ VERSION = '1.1.1'.freeze # Suffixes must have periods (not dashes)
23
23
  end
24
24
  end
@@ -54,6 +54,13 @@ unless s.respond_to?(:to_VariantType)
54
54
  end
55
55
  end
56
56
  end
57
+ unless s.respond_to?(:valueName)
58
+ class String
59
+ def valueName
60
+ self
61
+ end
62
+ end
63
+ end
57
64
 
58
65
  # WorkflowStepResultValue_Shim provides a shim interface to the WorkflowStepResultValue class in OpenStudio 2.X when running in OpenStudio 1.X
59
66
  class WorkflowStepResultValue_Shim
@@ -94,6 +101,20 @@ class WorkflowStepResult_Shim
94
101
  @result = result
95
102
  end
96
103
 
104
+ def stepInitialCondition
105
+ if @result[:initial_condition]
106
+ return Optional_Shim.new(@result[:initial_condition])
107
+ end
108
+ return Optional_Shim.new(nil)
109
+ end
110
+
111
+ def stepFinalCondition
112
+ if @result[:final_condition]
113
+ return Optional_Shim.new(@result[:final_condition])
114
+ end
115
+ return Optional_Shim.new(nil)
116
+ end
117
+
97
118
  def stepErrors
98
119
  return @result[:step_errors]
99
120
  end
@@ -121,6 +142,7 @@ class WorkflowStepResult_Shim
121
142
  def setStepResult(step_result)
122
143
  @result[:step_result] = step_result
123
144
  end
145
+
124
146
  end
125
147
 
126
148
  # WorkflowStep_Shim provides a shim interface to the WorkflowStep class in OpenStudio 2.X when running in OpenStudio 1.X
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Long
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-03 00:00:00.000000000 Z
12
+ date: 2017-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler