Moved simulation test script into simulation module. Added test
"fixtures" file.
This commit is contained in:
parent
e5060b33c5
commit
7367c6ddc4
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
from simulation import SimulationThread
|
from simulation_thread import SimulationThread
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
periods = json.load(open("periods.json"))
|
periods = json.load(open("test-periods.json"))
|
||||||
|
|
||||||
print("Period listing:")
|
print("Period listing:")
|
||||||
for period in periods:
|
for period in periods:
|
|
@ -0,0 +1,82 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "offpeak-morning",
|
||||||
|
"verbose-name" : "Morning off-peak (until 08:00)",
|
||||||
|
"timestart" : "00:00",
|
||||||
|
"states" : [
|
||||||
|
{ "duration" : 20, "north" : "green", "south" : "green", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "green", "south" : "amber", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 10, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "green" },
|
||||||
|
{ "duration" : 5, "north" : "amber", "south" : "red", "east" : "red", "west" : "red", "north-right" : "amber" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 20, "north" : "red", "south" : "red", "east" : "green", "west" : "green", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "red", "south" : "red", "east" : "amber", "west" : "amber", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "peak-morning",
|
||||||
|
"verbose-name" : "Morning peak (08:00 to 10:00)",
|
||||||
|
"timestart" : "08:00",
|
||||||
|
"states" : [
|
||||||
|
{ "duration" : 40, "north" : "green", "south" : "green", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "green", "south" : "amber", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 10, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "green" },
|
||||||
|
{ "duration" : 5, "north" : "amber", "south" : "red", "east" : "red", "west" : "red", "north-right" : "amber" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 40, "north" : "red", "south" : "red", "east" : "green", "west" : "green", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "red", "south" : "red", "east" : "amber", "west" : "amber", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "offpeak-middle",
|
||||||
|
"verbose-name" : "Middle off-peak (10:00 to 17:00)",
|
||||||
|
"timestart" : "10:00",
|
||||||
|
"states" : [
|
||||||
|
{ "duration" : 20, "north" : "green", "south" : "green", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "green", "south" : "amber", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 10, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "green" },
|
||||||
|
{ "duration" : 5, "north" : "amber", "south" : "red", "east" : "red", "west" : "red", "north-right" : "amber" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 20, "north" : "red", "south" : "red", "east" : "green", "west" : "green", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "red", "south" : "red", "east" : "amber", "west" : "amber", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "peak-afternoon",
|
||||||
|
"verbose-name" : "Afternoon peak (17:00 to 19:00)",
|
||||||
|
"timestart" : "17:00",
|
||||||
|
"states" : [
|
||||||
|
{ "duration" : 40, "north" : "green", "south" : "green", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "green", "south" : "amber", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 10, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "green" },
|
||||||
|
{ "duration" : 5, "north" : "amber", "south" : "red", "east" : "red", "west" : "red", "north-right" : "amber" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 40, "north" : "red", "south" : "red", "east" : "green", "west" : "green", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "red", "south" : "red", "east" : "amber", "west" : "amber", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "offpeak-evening",
|
||||||
|
"verbose-name" : "Evening off-peak (after 19:00)",
|
||||||
|
"timestart" : "19:00",
|
||||||
|
"states" : [
|
||||||
|
{ "duration" : 20, "north" : "green", "south" : "green", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "green", "south" : "amber", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 10, "north" : "green", "south" : "red", "east" : "red", "west" : "red", "north-right" : "green" },
|
||||||
|
{ "duration" : 5, "north" : "amber", "south" : "red", "east" : "red", "west" : "red", "north-right" : "amber" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" },
|
||||||
|
{ "duration" : 20, "north" : "red", "south" : "red", "east" : "green", "west" : "green", "north-right" : "red" },
|
||||||
|
{ "duration" : 5, "north" : "red", "south" : "red", "east" : "amber", "west" : "amber", "north-right" : "red" },
|
||||||
|
{ "duration" : 4, "north" : "red", "south" : "red", "east" : "red", "west" : "red", "north-right" : "red" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue