-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate variable paths #136
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0d262c4
/Users/rsteutev/Documents/GitHub/fastsim/fastsim-venv/bin/python
robinsteuteville b40c903
creating function that returns variable paths of a struct
robinsteuteville 8bdaeb9
demo testing
robinsteuteville cfd82b2
adding history_path_list function and adding doc strings
robinsteuteville d27002f
fixing problem with Cycle.grade and adding demo file for param paths
robinsteuteville f45a21f
adding unit test for param_path_list() and history_path_list()
robinsteuteville faf8fa6
updating readme formatting
robinsteuteville a476b86
getting branch up to date with main fastsim-3 branch
robinsteuteville 9a00380
cleaning up code
robinsteuteville 165244b
fixing type error
robinsteuteville 3831a18
updating based on Chad's comments
robinsteuteville 8b56e71
moving benchmark variable and history path lists to text files
robinsteuteville b062404
fixing problem with history function
robinsteuteville ae87ed9
updating formattng for demo file'
robinsteuteville a44a6b2
updating function doc strings
robinsteuteville aebc8d4
Merge branch 'fastsim-3' into generate-variable-paths
calbaker f1d2941
switched to using prius to test more components
calbaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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,27 @@ | ||
""" | ||
Script demonstrating how to use variable_path_list() and history_path_list() | ||
demos to find the paths to variables within fastsim classes. | ||
""" | ||
|
||
import fastsim as fsim | ||
|
||
# load 2012 Ford Fusion from file | ||
veh = fsim.Vehicle.from_file( | ||
str(fsim.package_root() / "../../tests/assets/2016_TOYOTA_Prius_Two.yaml") | ||
) | ||
|
||
# Set `save_interval` at vehicle level -- cascades to all sub-components with time-varying states | ||
veh.save_interval = 1 | ||
|
||
# load cycle from file | ||
cyc = fsim.Cycle.from_resource("udds.csv") | ||
|
||
# instantiate `SimDrive` simulation object | ||
sd = fsim.SimDrive(veh, cyc) | ||
|
||
# print out all subpaths for variables in SimDrive | ||
print("List of variable paths for SimDrive:\n", "\n".join(sd.variable_path_list())) | ||
print("\n") | ||
|
||
# print out all subpaths for history variables in SimDrive | ||
print("List of history variable paths for SimDrive:\n", "\n".join(sd.history_path_list())) |
13 changes: 13 additions & 0 deletions
13
python/fastsim/resources/benchmark_variable_paths/vehicle_history_paths.txt
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,13 @@ | ||
fc.history.i | ||
fc.history.pwr_prop_max_watts | ||
fc.history.pwr_tractive_watts | ||
fc.history.energy_aux_joules | ||
fc.history.pwr_fuel_watts | ||
fc.history.energy_loss_joules | ||
fc.history.fc_on | ||
fc.history.pwr_aux_watts | ||
fc.history.energy_tractive_joules | ||
fc.history.energy_fuel_joules | ||
fc.history.pwr_loss_watts | ||
fc.history.eff | ||
history |
45 changes: 45 additions & 0 deletions
45
python/fastsim/resources/benchmark_variable_paths/vehicle_variable_paths.txt
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,45 @@ | ||
fc.eff_min | ||
fc.pwr_out_frac_interp | ||
fc.pwr_ramp_lag_seconds | ||
fc.pwr_ramp_lag_hours | ||
fc.pwr_idle_fuel_watts | ||
fc.mass_kg | ||
fc.eff_range | ||
fc.state.pwr_loss_watts | ||
fc.state.pwr_tractive_watts | ||
fc.state.pwr_aux_watts | ||
fc.state.pwr_fuel_watts | ||
fc.state.energy_fuel_joules | ||
fc.state.energy_tractive_joules | ||
fc.state.eff | ||
fc.state.energy_loss_joules | ||
fc.state.energy_aux_joules | ||
fc.state.fc_on | ||
fc.state.pwr_prop_max_watts | ||
fc.state.i | ||
fc.eff_max | ||
fc.specific_pwr_kw_per_kg | ||
fc.pwr_out_max_watts | ||
fc.history.i | ||
fc.history.pwr_prop_max_watts | ||
fc.history.pwr_tractive_watts | ||
fc.history.energy_aux_joules | ||
fc.history.pwr_fuel_watts | ||
fc.history.energy_loss_joules | ||
fc.history.fc_on | ||
fc.history.pwr_aux_watts | ||
fc.history.energy_tractive_joules | ||
fc.history.energy_fuel_joules | ||
fc.history.pwr_loss_watts | ||
fc.history.eff | ||
fc.pwr_out_max_init_watts | ||
fc.eff_interp | ||
fc.save_interval | ||
pwr_aux_watts | ||
trans_eff | ||
state | ||
chassis | ||
year | ||
save_interval | ||
history | ||
name |
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,21 @@ | ||
import unittest | ||
import fastsim as fsim | ||
|
||
class TestParamPath(unittest.TestCase): | ||
def test_param_path_list(self): | ||
# load 2012 Ford Fusion from file | ||
veh = fsim.Vehicle.from_file( | ||
str(fsim.package_root() / "../../tests/assets/2012_Ford_Fusion.yaml") | ||
) | ||
with open(fsim.resources_root() / "benchmark_variable_paths/vehicle_variable_paths.txt") as file: | ||
baseline_variable_paths = [line.strip() for line in file.readlines()] | ||
|
||
with open(fsim.resources_root() / "benchmark_variable_paths/vehicle_history_paths.txt") as file: | ||
baseline_history_variable_paths = [line.strip() for line in file.readlines()] | ||
|
||
assert(sorted(baseline_variable_paths)==sorted(veh.variable_path_list())) | ||
assert(sorted(baseline_history_variable_paths)==sorted(veh.history_path_list())) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robinsteuteville , switched to the prius to see if it'll work on HEVs, and there is an error with
None
, perhaps the same as what you encountered in ALTRIOS.