Class: OpenStudio::Workflow::OutputAdapter::Socket
- Inherits:
-
Local
show all
- Defined in:
- lib/openstudio/workflow/adapters/output/socket.rb
Instance Attribute Summary
#options
Instance Method Summary
collapse
Methods inherited from Local
#communicate_measure_attributes
#add_directory_to_zip, #communicate_measure_attributes
Constructor Details
#initialize(options = {}) ⇒ Socket
Returns a new instance of Socket.
28
29
30
31
32
33
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 28
def initialize(options = {})
super
raise 'The required :port option was not passed to the socket output adapter' unless options[:port]
@socket = TCPSocket.open 'localhost', options[:port]
end
|
Instance Method Details
#communicate_complete ⇒ Object
44
45
46
47
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 44
def communicate_complete
super
@socket.write("Complete\n")
end
|
#communicate_energyplus_stdout(line, options = {}) ⇒ Object
63
64
65
66
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 63
def communicate_energyplus_stdout(line, options = {})
super
@socket.write(line)
end
|
#communicate_failure ⇒ Object
49
50
51
52
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 49
def communicate_failure
super
@socket.write("Failure\n")
end
|
#communicate_measure_result(result, options = {}) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 68
def communicate_measure_result(result, options = {})
super
step_result = result.stepResult
initial_condition = result.stepInitialCondition
final_condition = result.stepFinalCondition
errors = result.stepErrors
warnings = result.stepWarnings
infos = result.stepInfo
tab = ' '
@socket.write("#{tab}Result: #{step_result.get.valueName}\n") if !step_result.empty?
@socket.write("#{tab}Initial Condition: #{initial_condition.get}\n") if !initial_condition.empty?
@socket.write("#{tab}Final Condition: #{final_condition.get}\n") if !final_condition.empty?
errors.each {|error| @socket.write("#{tab}Error: #{error}\n") }
warnings.each {|warning| @socket.write("#{tab}Warn: #{warning}\n") }
infos.each {|info| @socket.write("#{tab}Info: #{info}\n") }
end
|
#communicate_objective_function(objectives, options = {}) ⇒ Object
54
55
56
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 54
def communicate_objective_function(objectives, options = {})
super
end
|
#communicate_results(directory, results) ⇒ Object
40
41
42
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 40
def communicate_results(directory, results)
super
end
|
#communicate_started ⇒ Object
35
36
37
38
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 35
def communicate_started
super
@socket.write("Started\n")
end
|
#communicate_transition(message, type, options = {}) ⇒ Object
58
59
60
61
|
# File 'lib/openstudio/workflow/adapters/output/socket.rb', line 58
def communicate_transition(message, type, options = {})
super
@socket.write(message + "\n")
end
|