46045-syslab/syslab/get_flexhouse.py

28 lines
1.2 KiB
Python

def get_flexhouse(simulated=False, physical=False, simulate_on_dumpload_ID="", simulate_on_battery=False):
"""
Return an instantiated object which operates as a flexhouse.
input:
simulated (bool): Whether the flexhouse should be simulated
physical (bool): Whether the flexhouse should be the real flexhouse
simulate_on_dumpload_ID (string): The ID of the dumpload on which to simulate the flexhouse
simulate_on_battery (bool): Whether to simulate on battery
return:
flexhouse: A flexhouse object
"""
if simulated:
if simulate_on_battery:
from .virtual.FlexHouse_sim_batt import FlexHouse_sim_batt
return FlexHouse_sim_batt('batt1')
else:
from .virtual.FlexHouse_sim import FlexHouse_sim
assert simulate_on_dumpload_ID != "", "Must supply an ID string for the dumpload used in Flexhouse simulation if not simulating on battery"
return FlexHouse_sim(simulate_on_dumpload_ID)
elif physical:
from .physical.FlexHouse_real import FlexHouse_real
return FlexHouse_real()
else:
raise Exception('Must define if FlexHouse instance is real or simulated')