Module: RSMP::TLC::Proxy::Plans

Included in:
TrafficControllerProxy
Defined in:
lib/rsmp/tlc/proxy/plans.rb

Overview

Command methods for signal plans. Covers time plans, week/day tables, bands, offsets, and cycle times.

Instance Method Summary collapse

Instance Method Details

#order_signal_start(component_id, within:) ⇒ Object

M0010 — Order signal start for a signal group component.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/rsmp/tlc/proxy/plans.rb', line 177

def order_signal_start(component_id, within:)
  validate_ready 'order signal start'

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0010',
    'cO' => 'setStart',
    'n' => 'status',
    'v' => 'True'
  }, {
    'cCI' => 'M0010',
    'cO' => 'setStart',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, component: component_id, within:).ok!
end

#order_signal_stop(component_id, within:) ⇒ Object

M0011 — Order signal stop for a signal group component.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/rsmp/tlc/proxy/plans.rb', line 197

def order_signal_stop(component_id, within:)
  validate_ready 'order signal stop'

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0011',
    'cO' => 'setStop',
    'n' => 'status',
    'v' => 'True'
  }, {
    'cCI' => 'M0011',
    'cO' => 'setStop',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, component: component_id, within:).ok!
end

#set_cycle_time(plan:, cycle_time:, within:) ⇒ Object

M0018 — Set cycle time for a signal plan.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/rsmp/tlc/proxy/plans.rb', line 151

def set_cycle_time(plan:, cycle_time:, within:)
  validate_ready 'set cycle time'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0018',
    'cO' => 'setCycleTime',
    'n' => 'status',
    'v' => cycle_time.to_s
  }, {
    'cCI' => 'M0018',
    'cO' => 'setCycleTime',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0018',
    'cO' => 'setCycleTime',
    'n' => 'plan',
    'v' => plan.to_s
  }]
  send_command_and_collect(command_list, within:).ok!
end

#set_day_table(status, within:) ⇒ Object

M0017 — Set day table (mapping time periods to signal plans).



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/rsmp/tlc/proxy/plans.rb', line 130

def set_day_table(status, within:)
  validate_ready 'set day table'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0017',
    'cO' => 'setTimeTable',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0017',
    'cO' => 'setTimeTable',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, within:).ok!
end

#set_dynamic_bands(plan:, status:, within:) ⇒ Object

M0014 — Set dynamic bands for a signal plan.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rsmp/tlc/proxy/plans.rb', line 8

def set_dynamic_bands(plan:, status:, within:)
  validate_ready 'set dynamic bands'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0014',
    'cO' => 'setCommands',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0014',
    'cO' => 'setCommands',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0014',
    'cO' => 'setCommands',
    'n' => 'plan',
    'v' => plan.to_s
  }]
  send_command_and_collect(command_list, within: within).ok!
end

#set_dynamic_bands_timeout(status, within:) ⇒ Object

M0023 — Set timeout for dynamic bands.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rsmp/tlc/proxy/plans.rb', line 34

def set_dynamic_bands_timeout(status, within:)
  validate_ready 'set dynamic bands timeout'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0023',
    'cO' => 'setTimeout',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0023',
    'cO' => 'setTimeout',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, within: within).ok!
end

#set_offset(plan:, offset:, within:) ⇒ Object

M0015 — Set offset for a signal plan.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/rsmp/tlc/proxy/plans.rb', line 55

def set_offset(plan:, offset:, within:)
  validate_ready 'set offset'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0015',
    'cO' => 'setOffset',
    'n' => 'status',
    'v' => offset.to_s
  }, {
    'cCI' => 'M0015',
    'cO' => 'setOffset',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0015',
    'cO' => 'setOffset',
    'n' => 'plan',
    'v' => plan.to_s
  }]
  send_command_and_collect(command_list, within: within).ok!
end

#set_timeplan(plan_nr, within:) ⇒ Object

Set the timeplan (signal plan) on the remote TLC.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/rsmp/tlc/proxy/plans.rb', line 81

def set_timeplan(plan_nr, within:)
  validate_ready 'set timeplan'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0002',
    'cO' => 'setPlan',
    'n' => 'status',
    'v' => 'True'
  }, {
    'cCI' => 'M0002',
    'cO' => 'setPlan',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0002',
    'cO' => 'setPlan',
    'n' => 'timeplan',
    'v' => plan_nr.to_s
  }]
  confirm_status = [{ 'sCI' => 'S0014', 'n' => 'status', 's' => plan_nr.to_s }]
  send_command_and_collect(command_list, within: within).ok!
  wait_for_status("timeplan #{plan_nr}", confirm_status, timeout: within)
end

#set_week_table(status, within:) ⇒ Object

M0016 — Set week table (mapping week days to traffic situations).



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/rsmp/tlc/proxy/plans.rb', line 109

def set_week_table(status, within:)
  validate_ready 'set week table'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0016',
    'cO' => 'setWeekTable',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0016',
    'cO' => 'setWeekTable',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, within:).ok!
end