Module: RSMP::TLC::Proxy::Plans
- Included in:
- SupervisorInterface
- 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
-
#order_signal_start(component_id, within:) ⇒ Object
M0010 - Order signal start for a signal group component.
-
#order_signal_stop(component_id, within:) ⇒ Object
M0011 - Order signal stop for a signal group component.
-
#set_cycle_time(plan:, cycle_time:, within:) ⇒ Object
M0018 - Set cycle time for a signal plan.
-
#set_day_table(status, within:) ⇒ Object
M0017 - Set day table (mapping time periods to signal plans).
-
#set_dynamic_bands(plan:, status:, within:) ⇒ Object
M0014 - Set dynamic bands for a signal plan.
-
#set_dynamic_bands_timeout(status, within:) ⇒ Object
M0023 - Set timeout for dynamic bands.
-
#set_offset(plan:, offset:, within:) ⇒ Object
M0015 - Set offset for a signal plan.
-
#set_timeplan(plan_nr, within:) ⇒ Object
Set the timeplan (signal plan) on the remote TLC.
-
#set_week_table(status, within:) ⇒ Object
M0016 - Set week table (mapping week days to traffic situations).
Instance Method Details
#order_signal_start(component_id, within:) ⇒ Object
M0010 - Order signal start for a signal group component.
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 192 def order_signal_start(component_id, within:) readiness = validate_ready 'order signal start' return readiness if readiness.failure? security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0010', 'cO' => 'setStart', 'n' => 'status', 'v' => command_value('M0010', 'status', true) }, { 'cCI' => 'M0010', 'cO' => 'setStart', 'n' => 'securityCode', 'v' => security_code.to_s }] send_command_and_collect(command_list, component: component_id, within:) end |
#order_signal_stop(component_id, within:) ⇒ Object
M0011 - Order signal stop for a signal group component.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 213 def order_signal_stop(component_id, within:) readiness = validate_ready 'order signal stop' return readiness if readiness.failure? security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0011', 'cO' => 'setStop', 'n' => 'status', 'v' => command_value('M0011', 'status', true) }, { 'cCI' => 'M0011', 'cO' => 'setStop', 'n' => 'securityCode', 'v' => security_code.to_s }] send_command_and_collect(command_list, component: component_id, within:) end |
#set_cycle_time(plan:, cycle_time:, within:) ⇒ Object
M0018 - Set cycle time for a signal plan.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 164 def set_cycle_time(plan:, cycle_time:, within:) readiness = validate_ready 'set cycle time' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0018', 'cO' => 'setCycleTime', 'n' => 'status', 'v' => command_value('M0018', 'status', cycle_time) }, { 'cCI' => 'M0018', 'cO' => 'setCycleTime', 'n' => 'securityCode', 'v' => security_code.to_s }, { 'cCI' => 'M0018', 'cO' => 'setCycleTime', 'n' => 'plan', 'v' => command_value('M0018', 'plan', plan) }] send_command_and_collect(command_list, within:) end |
#set_day_table(status, within:) ⇒ Object
M0017 - Set day table (mapping time periods to signal plans).
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 141 def set_day_table(status, within:) readiness = validate_ready 'set day table' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0017', 'cO' => 'setTimeTable', 'n' => 'status', 'v' => command_value('M0017', 'status', status) }, { 'cCI' => 'M0017', 'cO' => 'setTimeTable', 'n' => 'securityCode', 'v' => security_code.to_s }] send_command_and_collect(command_list, within:) 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 32 33 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 8 def set_dynamic_bands(plan:, status:, within:) readiness = validate_ready 'set dynamic bands' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0014', 'cO' => 'setCommands', 'n' => 'status', 'v' => command_value('M0014', 'status', status) }, { 'cCI' => 'M0014', 'cO' => 'setCommands', 'n' => 'securityCode', 'v' => security_code.to_s }, { 'cCI' => 'M0014', 'cO' => 'setCommands', 'n' => 'plan', 'v' => command_value('M0014', 'plan', plan) }] send_command_and_collect(command_list, within: within) end |
#set_dynamic_bands_timeout(status, within:) ⇒ Object
M0023 - Set timeout for dynamic bands.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 36 def set_dynamic_bands_timeout(status, within:) readiness = validate_ready 'set dynamic bands timeout' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0023', 'cO' => 'setTimeout', 'n' => 'status', 'v' => command_value('M0023', 'status', status) }, { 'cCI' => 'M0023', 'cO' => 'setTimeout', 'n' => 'securityCode', 'v' => security_code.to_s }] send_command_and_collect(command_list, within: within) end |
#set_offset(plan:, offset:, within:) ⇒ Object
M0015 - Set offset for a signal plan.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 59 def set_offset(plan:, offset:, within:) readiness = validate_ready 'set offset' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0015', 'cO' => 'setOffset', 'n' => 'status', 'v' => command_value('M0015', 'status', offset) }, { 'cCI' => 'M0015', 'cO' => 'setOffset', 'n' => 'securityCode', 'v' => security_code.to_s }, { 'cCI' => 'M0015', 'cO' => 'setOffset', 'n' => 'plan', 'v' => command_value('M0015', 'plan', plan) }] send_command_and_collect(command_list, within: within) end |
#set_timeplan(plan_nr, within:) ⇒ Object
Set the timeplan (signal plan) on the remote TLC.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 87 def set_timeplan(plan_nr, within:) readiness = validate_ready 'set timeplan' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0002', 'cO' => 'setPlan', 'n' => 'status', 'v' => command_value('M0002', 'status', true) }, { 'cCI' => 'M0002', 'cO' => 'setPlan', 'n' => 'securityCode', 'v' => security_code.to_s }, { 'cCI' => 'M0002', 'cO' => 'setPlan', 'n' => 'timeplan', 'v' => command_value('M0002', 'timeplan', plan_nr) }] confirm_status = [{ 'sCI' => 'S0014', 'n' => 'status', 's' => integer_value(plan_nr) }] send_command_and_collect(command_list, within: within).and_then do |exchange| wait_for_status("timeplan #{plan_nr}", confirm_status, timeout: within).map { exchange } end end |
#set_week_table(status, within:) ⇒ Object
M0016 - Set week table (mapping week days to traffic situations).
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/rsmp/tlc/proxy/plans.rb', line 118 def set_week_table(status, within:) readiness = validate_ready 'set week table' return readiness if readiness.failure? raise 'TLC main component not found' unless main security_code = security_code_for(2) command_list = [{ 'cCI' => 'M0016', 'cO' => 'setWeekTable', 'n' => 'status', 'v' => command_value('M0016', 'status', status) }, { 'cCI' => 'M0016', 'cO' => 'setWeekTable', 'n' => 'securityCode', 'v' => security_code.to_s }] send_command_and_collect(command_list, within:) end |