Simulation Manager
Create a python
program that manages each program instance and allows test creation
Example:
project = [ "centre_console", "bms", "motor_controller", "pedal"]
class Car:
def __init__(self, projects):
self.managers = {}
for project in projects:
self.manager[project] = start_project(project)
def start_project(self, project):
program = ....find project file
socket_num = rand() # generate random socket number
while socket_num is not available:
socket_num = rand() # keep generating until valid
process.run(program, socket_num) # Start the project with the socket number
# Maybe also redirect logs here?
return socket_num
def call(self, project, operations): # operation
socket = ....start socket connection with self.managers[project]
...or keep connection alive all the time??
for op in operations:
socket.send(op)
### Tests
def test_car_start():
car = Car(projects)
car.call("centre_console", "connect battery.....")
.....
# Will need to look at logs to see if something went wrong