def process_input(config_filename): # load the config file with open('./params/batcher_config/' + config_filename) as data: conf = fancyyaml.load(data) tracks = [(track_segmentation.dxf_to_segments(x.dxf, x.segment_distance), x.steady_state, x.dxf) for x in conf.tracks] model = sims.Simulation(conf.model) out = (conf.filename, conf.data_percentage) return (conf.tests, conf.vehicle, tracks, model, out)
def process_input(config_filename): # load the config file with open('./params/batcher_config/' + config_filename) as data: conf = fancyyaml.load(data, True) tracks = [process_track(x, "./params/tracks/") for x in conf.tracks] model = sims.Simulation(conf.model) out = (conf.filename, conf.data_percentage) return (conf.tests, conf.vehicle, tracks, model, out)
def process_web_input(conf): vehicle_stream = io.StringIO(conf.vehicle) conf.vehicle = vehicle.Vehicle(fancyyaml.load(vehicle_stream, False)) vehicle_stream.close() for x in conf.tracks: x.name = x.file x.file = x.path tracks = [process_track(x) for x in conf.tracks] model = sims.Simulation(conf.model) out = (conf.filename, conf.data_percentage) return (conf.tests, conf.vehicle, tracks, model, out)
# times[-1].append(output[-1,sims.O_TIME]) # print(st) # print("Total Times", times) # plottools.plt.show(); # import sims # import input_processing.vehicle as ipvehicle # import input_processing.fancyyaml as yaml # import input_processing.track_segmentation as trackseg # import plottools sn = 'ss_four_tires' wb = 0.5 for cgh in [0.2, 0.8, 1.4]: sim = sims.Simulation(sn) vehicle = ipvehicle.Vehicle( yaml.load(open('params/vehicles/VEHICLE_START_HERE.yaml', 'r'), True)) vehicle.weight_bias = wb vehicle.cg_height = cgh vehicle.prep() segments = trackseg.file_to_segments( 'params/tracks/mi_2018_autox.DXF', 0.4, sectors_only=True) #AutoX_3_31_2018_ant.LOG # exit() # print(vehicle.f_long_remain_pair([200,250], 500)) # exit() output = sim.steady_solve(vehicle, segments, dl=0.4) # print(output)
mpld3_id = get_id(element) ids.append(mpld3_id) if isinstance(element, matplotlib.lines.Line2D): mpld3_id = get_id(element, 'pts') ids.append(mpld3_id) else: ids.append(get_id(entry)) if isinstance(entry, matplotlib.lines.Line2D): mpld3_id = get_id(entry, 'pts') ids.append(mpld3_id) mpld3_element_ids.append(ids) return mpld3_element_ids sim = sims.Simulation("point_mass") vehicle = vehicle.Vehicle( yaml.load(open('params/vehicles/rgp007.yaml', 'r'), True)) vehicle.prep() segments = trackseg.file_to_segments('params/DXFs/ne_2017_endurance.svg', 2.0) xys = np.array([[s.x, s.y] for s in segments]) output = sim.solve(vehicle, segments[:len(segments) / 1]) fig, ax = plt.subplots(figsize=(16, 9)) line_collections = [] x = xys[:, 0] y = xys[:, 1] # df = pd.DataFrame(index=range(len(x))) # for i in range(sims.O_MATRIX_COLS): z = output[:, sims.O_VELOCITY]