Traffic Light Controller Signal Plan
Tests
- Signal plan M0018 set cycle time
- Signal plan currently active is read with S0014
- Signal plan currently active is set with M0002
- Signal plan cycle time is read with S0028
- Signal plan cycle time is set with M0018
- Signal plan day table is read with S0027
- Signal plan day table is set with M0017
- Signal plan dynamic bands are read with S0023
- Signal plan dynamic bands are set with M0014
- Signal plan dynamic bands values can be changed and read back
- Signal plan list is read with S0022
- Signal plan list size is read with S0018
- Signal plan offset is read with S0024
- Signal plan offset is set with M0015
- Signal plan timeout for dynamic bands is set with M0023
- Signal plan version is read with S0097
- Signal plan week table is read with S0026
- Signal plan week table is set with M0016
Signal plan M0018 set cycle time
- Verify connection
- Send control command to set cycle time
- Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
status = 5
plan = 0
prepare task, site
set_cycle_time status, plan
end
Signal plan currently active is read with S0014
Verify status S0014 current time plan
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' )
status_list = { S0014: [:status,:source] }
else
status_list = { S0014: [:status] }
end
request_status_and_confirm site, "current time plan", status_list
end
Signal plan currently active is set with M0002
Verify that we change time plan (signal program) We try switching all programs configured
- Given the site is connected
- Verify that there is a Validator.get_config(‘validator’) with a time plan
- Send command to switch time plan
- Wait for status “Current timeplan” = requested time plan
View Source
plans = Validator.get_config('items','plans')
skip("No time plans configured") if plans.nil? || plans.empty?
Validator::Site.connected do |task,supervisor,site|
prepare task, site
plans.each { |plan| switch_plan plan }
end
Signal plan cycle time is read with S0028
Verify status S0028 cycle time
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "cycle time",
{ S0028: [:status] }
end
Signal plan cycle time is set with M0018
- Verify connection
- Send control command to set cycle time
- Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
status = 5
plan = 0
prepare task, site
set_cycle_time status, plan
end
Signal plan day table is read with S0027
Verify status S0027 time tables
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "command table",
{ S0027: [:status] }
end
Signal plan day table is set with M0017
- Verify connection
- Send control command to set time_table
- Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
status = "12-1-12-59,1-0-23-12"
prepare task, site
set_day_table status
end
Signal plan dynamic bands are read with S0023
Verify status S0023 command table
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "command table",
{ S0023: [:status] }
end
Signal plan dynamic bands are set with M0014
- Verify connection
- Send control command to set dynamic_bands
- Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
plan = "1"
status = "1-12"
prepare task, site
set_dynamic_bands plan, status
end
Signal plan dynamic bands values can be changed and read back
- Given the site is connected
- Read dynamic band
- Set dynamic band to 2x previous value
- Read band to confirm
- Set dynamic band to previous value
- Read dynamic band to confirm
View Source
Validator::Site.connected do |task,supervisor,site|
prepare task, site
plan = 1
band = 3
value = get_dynamic_bands(plan, band) || 0
expect( value ).to be_a(Integer)
new_value = value + 1
set_dynamic_bands plan, "#{band}-#{new_value}"
expect( get_dynamic_bands(plan, band) ).to eq(new_value)
set_dynamic_bands plan, "#{band}-#{value}"
expect( get_dynamic_bands(plan, band) ).to eq(value)
end
Signal plan list is read with S0022
Verify status S0022 list of time plans
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "list of time plans",
{ S0022: [:status] }
end
Signal plan list size is read with S0018
Verify status S0018 number of time plans Deprecated from 1.2, use S0022 instead.
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "number of time plans",
{ S0018: [:number] }
end
Signal plan offset is read with S0024
Verify status S0024 offset time
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "offset time",
{ S0024: [:status] }
end
Signal plan offset is set with M0015
- Verify connection
- Send control command to set dynamic_bands
- Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
plan = 1
status = 99
prepare task, site
set_offset status, plan
end
Signal plan timeout for dynamic bands is set with M0023
Verify command M0023 timeout of dynamic bands
- Verify connection
- When we send command to set timeout
- Then we should get a confirmation
- When we send command to disable timeout
- Then we should get a confirmation
View Source
Validator::Site.connected do |task,supervisor,site|
prepare task, site
status = 10
set_timeout_for_dynamic_bands status
status = 0
set_timeout_for_dynamic_bands status
end
Signal plan version is read with S0097
Verify status S0097 version of traffic program
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "version of traffic program",
{ S0097: [:timestamp,:checksum] }
end
Signal plan week table is read with S0026
Verify status S0026 week time table
- Given the site is connected
- Request status
- Expect status response before timeout
View Source
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "week time table",
{ S0026: [:status] }
end
Signal plan week table is set with M0016
- Verify connection
- Send control command to set week_table
- Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
status = "0-1,6-2"
prepare task, site
set_week_table status
end