-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EUREKA! downcasting solved the problem!
- Loading branch information
Showing
6 changed files
with
37 additions
and
21 deletions.
There are no files selected for viewing
Empty file modified
0
cal_and_val/f3-vehicles/2022 MINI Cooper SE Hardtop 2 door.yaml
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import numpy as np | ||
from pathlib import Path | ||
import time | ||
import json | ||
import msgpack | ||
import os | ||
from typing import Tuple | ||
import fastsim as fsim | ||
|
||
# load 2012 Ford Fusion from file | ||
veh = fsim.Vehicle.from_resource("2022_Renault_Zoe_ZE50_R135.yaml") | ||
|
||
# Set `save_interval` at vehicle level -- cascades to all sub-components with time-varying states | ||
fsim.set_param_from_path(veh, "save_interval" , 1) | ||
|
||
# load cycle from file | ||
cyc = fsim.Cycle.from_resource("udds.csv") | ||
|
||
# instantiate SimDrive | ||
sd = fsim.SimDrive(veh, cyc) | ||
|
||
# simulation start time | ||
# run simulation | ||
sd.walk() | ||
# simulation end time | ||
|
||
# TODO: make performmance benchmarks comparing full circle (de)serialization | ||
# with different formats (e.g. message pack, json, yaml, ...) | ||
|
||
def test_msg_pack(): | ||
sd_dict = msgpack.loads(sd.to_msg_pack()) | ||
assert sd.to_msg_pack() == msgpack.packb(sd_dict) | ||
fsim.SimDrive.from_msg_pack(msgpack.packb(sd_dict)) |