fastsim 2.0.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. fastsim-2.0.10/LICENSE +14 -0
  2. fastsim-2.0.10/LICENSE.md +14 -0
  3. fastsim-2.0.10/MANIFEST.in +7 -0
  4. fastsim-2.0.10/PKG-INFO +18 -0
  5. fastsim-2.0.10/README.md +1 -0
  6. fastsim-2.0.10/fastsim/__init__.py +62 -0
  7. fastsim-2.0.10/fastsim/auxiliaries.py +232 -0
  8. fastsim-2.0.10/fastsim/calibration.py +374 -0
  9. fastsim-2.0.10/fastsim/cycle.py +1034 -0
  10. fastsim-2.0.10/fastsim/docs/.gitignore +3 -0
  11. fastsim-2.0.10/fastsim/docs/2017_Ford_F150_thermal_val.py +271 -0
  12. fastsim-2.0.10/fastsim/docs/README.md +168 -0
  13. fastsim-2.0.10/fastsim/docs/__init__.py +0 -0
  14. fastsim-2.0.10/fastsim/docs/accel_demo.py +53 -0
  15. fastsim-2.0.10/fastsim/docs/cav_demo.py +246 -0
  16. fastsim-2.0.10/fastsim/docs/cav_sweep.py +375 -0
  17. fastsim-2.0.10/fastsim/docs/demo.py +827 -0
  18. fastsim-2.0.10/fastsim/docs/demo_abc_drag_coef_conv.py +24 -0
  19. fastsim-2.0.10/fastsim/docs/demo_eu_vehicle_wltp.py +149 -0
  20. fastsim-2.0.10/fastsim/docs/fastsim-icon-web-131x172.jpg +0 -0
  21. fastsim-2.0.10/fastsim/docs/fusion_thermal_cal.py +258 -0
  22. fastsim-2.0.10/fastsim/docs/fusion_thermal_cal_post.py +154 -0
  23. fastsim-2.0.10/fastsim/docs/fusion_thermal_demo.py +200 -0
  24. fastsim-2.0.10/fastsim/docs/mp_parallel_demo.py +49 -0
  25. fastsim-2.0.10/fastsim/docs/stop_start_demo.py +115 -0
  26. fastsim-2.0.10/fastsim/docs/time_dilation_demo.py +199 -0
  27. fastsim-2.0.10/fastsim/docs/wltc_calibration.py +451 -0
  28. fastsim-2.0.10/fastsim/inspect_utils.py +30 -0
  29. fastsim-2.0.10/fastsim/parameters.py +165 -0
  30. fastsim-2.0.10/fastsim/resample.py +56 -0
  31. fastsim-2.0.10/fastsim/resources/FASTSim_py_veh_db.csv +27 -0
  32. fastsim-2.0.10/fastsim/resources/cycles/HHDDTCruiseSmooth.csv +2225 -0
  33. fastsim-2.0.10/fastsim/resources/cycles/NREL13.csv +866 -0
  34. fastsim-2.0.10/fastsim/resources/cycles/README.md +1 -0
  35. fastsim-2.0.10/fastsim/resources/cycles/TSDC_tripno_42648_cycle.csv +302 -0
  36. fastsim-2.0.10/fastsim/resources/cycles/accel.csv +202 -0
  37. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_1/2007-08-25.csv +77 -0
  38. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_1/trips.csv +2 -0
  39. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_3/2007-08-20.csv +2687 -0
  40. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_3/2007-08-21.csv +4213 -0
  41. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_3/2007-08-22.csv +5630 -0
  42. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_3/2007-08-23.csv +1208 -0
  43. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4033363_3/trips.csv +16 -0
  44. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4105836_2/2007-05-31.csv +3195 -0
  45. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4105836_2/trips.csv +7 -0
  46. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-21.csv +2552 -0
  47. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-22.csv +4428 -0
  48. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-23.csv +6223 -0
  49. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-24.csv +4547 -0
  50. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-25.csv +10331 -0
  51. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-26.csv +2738 -0
  52. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/2007-05-27.csv +1144 -0
  53. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4107032_1/trips.csv +47 -0
  54. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_1/2007-06-22.csv +24149 -0
  55. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_1/2007-06-23.csv +7863 -0
  56. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_1/2007-06-24.csv +5516 -0
  57. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_1/2007-06-25.csv +23706 -0
  58. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_1/2007-06-26.csv +880 -0
  59. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_1/trips.csv +34 -0
  60. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_2/2007-06-21.csv +8093 -0
  61. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_2/2007-06-22.csv +3162 -0
  62. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_2/2007-06-27.csv +8523 -0
  63. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4108468_2/trips.csv +14 -0
  64. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/2007-05-17.csv +1530 -0
  65. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/2007-05-18.csv +2146 -0
  66. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/2007-05-19.csv +1881 -0
  67. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/2007-05-21.csv +2523 -0
  68. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/2007-05-22.csv +2633 -0
  69. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/2007-05-23.csv +1547 -0
  70. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4109114_1/trips.csv +32 -0
  71. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4111928_1/2007-05-19.csv +1651 -0
  72. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4111928_1/2007-05-21.csv +3097 -0
  73. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4111928_1/2007-05-22.csv +932 -0
  74. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4111928_1/2007-05-23.csv +1948 -0
  75. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4111928_1/2007-05-24.csv +88 -0
  76. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4111928_1/trips.csv +15 -0
  77. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4112082_1/2007-07-03.csv +1854 -0
  78. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4112082_1/2007-07-05.csv +1987 -0
  79. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4112082_1/trips.csv +13 -0
  80. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4113492_1/2007-05-17.csv +2244 -0
  81. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4113492_1/trips.csv +3 -0
  82. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4114555_1/2007-05-31.csv +3852 -0
  83. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4114555_1/trips.csv +7 -0
  84. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115766_1/2007-03-28.csv +16256 -0
  85. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115766_1/trips.csv +7 -0
  86. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115766_2/2007-03-28.csv +3348 -0
  87. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115766_2/trips.csv +8 -0
  88. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115957_1/2007-04-09.csv +7379 -0
  89. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115957_1/trips.csv +6 -0
  90. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115985_1/2007-04-23.csv +637 -0
  91. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4115985_1/trips.csv +3 -0
  92. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116361_1/2007-03-13.csv +2314 -0
  93. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116361_1/trips.csv +5 -0
  94. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116721_2/2007-04-09.csv +5440 -0
  95. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116721_2/trips.csv +3 -0
  96. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116728_1/2007-04-05.csv +3864 -0
  97. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116728_1/trips.csv +6 -0
  98. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116813_1/2007-04-05.csv +6411 -0
  99. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116813_1/trips.csv +8 -0
  100. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116813_2/2007-04-05.csv +8211 -0
  101. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116813_2/trips.csv +11 -0
  102. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116880_1/2007-04-23.csv +1056 -0
  103. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4116880_1/trips.csv +4 -0
  104. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4118093_1/2007-08-13.csv +3482 -0
  105. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4118093_1/2007-08-14.csv +24 -0
  106. fastsim-2.0.10/fastsim/resources/cycles/cmap_subset/4118093_1/trips.csv +12 -0
  107. fastsim-2.0.10/fastsim/resources/cycles/ftpmc1b.csv +1876 -0
  108. fastsim-2.0.10/fastsim/resources/cycles/hwfet.csv +767 -0
  109. fastsim-2.0.10/fastsim/resources/cycles/longHaulDriveCycle.csv +83044 -0
  110. fastsim-2.0.10/fastsim/resources/cycles/udds.csv +1371 -0
  111. fastsim-2.0.10/fastsim/resources/cycles/us06.csv +602 -0
  112. fastsim-2.0.10/fastsim/resources/cycles/wltc_class3_extra_high3.csv +324 -0
  113. fastsim-2.0.10/fastsim/resources/cycles/wltc_class3_high3a.csv +456 -0
  114. fastsim-2.0.10/fastsim/resources/cycles/wltc_class3_high3b.csv +456 -0
  115. fastsim-2.0.10/fastsim/resources/cycles/wltc_class3_low3.csv +581 -0
  116. fastsim-2.0.10/fastsim/resources/cycles/wltc_class3_med3a.csv +434 -0
  117. fastsim-2.0.10/fastsim/resources/cycles/wltc_class3_med3b.csv +434 -0
  118. fastsim-2.0.10/fastsim/resources/cycles/wmtc_all.csv +1802 -0
  119. fastsim-2.0.10/fastsim/resources/cycles/wmtc_part1.csv +602 -0
  120. fastsim-2.0.10/fastsim/resources/cycles/wmtc_part2.csv +602 -0
  121. fastsim-2.0.10/fastsim/resources/cycles/wmtc_part3.csv +602 -0
  122. fastsim-2.0.10/fastsim/resources/longparams.json +1224 -0
  123. fastsim-2.0.10/fastsim/resources/master_benchmark_vars.csv +79 -0
  124. fastsim-2.0.10/fastsim/resources/res_excel.json +1 -0
  125. fastsim-2.0.10/fastsim/resources/vehdb/2010_Mazda_3_i-Stop.csv +77 -0
  126. fastsim-2.0.10/fastsim/resources/vehdb/2010_Mazda_3_i-Stop.yaml +168 -0
  127. fastsim-2.0.10/fastsim/resources/vehdb/2012_Ford_Focus.csv +77 -0
  128. fastsim-2.0.10/fastsim/resources/vehdb/2012_Ford_Focus.yaml +168 -0
  129. fastsim-2.0.10/fastsim/resources/vehdb/2012_Ford_Fusion.csv +77 -0
  130. fastsim-2.0.10/fastsim/resources/vehdb/2012_Ford_Fusion.yaml +168 -0
  131. fastsim-2.0.10/fastsim/resources/vehdb/2016_EU_VW_Golf_1.4TSI.csv +77 -0
  132. fastsim-2.0.10/fastsim/resources/vehdb/2016_EU_VW_Golf_1.4TSI.yaml +168 -0
  133. fastsim-2.0.10/fastsim/resources/vehdb/2016_TOYOTA_Corolla_4cyl_2WD.csv +77 -0
  134. fastsim-2.0.10/fastsim/resources/vehdb/2016_TOYOTA_Corolla_4cyl_2WD.yaml +168 -0
  135. fastsim-2.0.10/fastsim/resources/vehdb/2016_TOYOTA_Prius_Two.csv +80 -0
  136. fastsim-2.0.10/fastsim/resources/vehdb/2016_TOYOTA_Prius_Two.yaml +168 -0
  137. fastsim-2.0.10/fastsim/resources/vehdb/2017_Ford_F-150_Ecoboost.csv +77 -0
  138. fastsim-2.0.10/fastsim/resources/vehdb/2017_Ford_F-150_Ecoboost.yaml +168 -0
  139. fastsim-2.0.10/fastsim/resources/vehdb/2017_Toyota_Highlander_3.5_L.csv +77 -0
  140. fastsim-2.0.10/fastsim/resources/vehdb/2017_Toyota_Highlander_3.5_L.yaml +168 -0
  141. fastsim-2.0.10/fastsim/resources/vehdb/2020_EU_VW_Golf_1.5TSI.csv +77 -0
  142. fastsim-2.0.10/fastsim/resources/vehdb/2020_EU_VW_Golf_1.5TSI.yaml +168 -0
  143. fastsim-2.0.10/fastsim/resources/vehdb/2020_EU_VW_Golf_2.0TDI.csv +77 -0
  144. fastsim-2.0.10/fastsim/resources/vehdb/2020_EU_VW_Golf_2.0TDI.yaml +168 -0
  145. fastsim-2.0.10/fastsim/resources/vehdb/2020_Hero_Splendor+_100cc_2W.csv +77 -0
  146. fastsim-2.0.10/fastsim/resources/vehdb/2022_TOYOTA_Yaris_Hybrid_Mid.csv +80 -0
  147. fastsim-2.0.10/fastsim/resources/vehdb/2022_TOYOTA_Yaris_Hybrid_Mid.yaml +168 -0
  148. fastsim-2.0.10/fastsim/resources/vehdb/Class_4_Box_Truck.csv +77 -0
  149. fastsim-2.0.10/fastsim/resources/vehdb/Class_4_Box_Truck.yaml +168 -0
  150. fastsim-2.0.10/fastsim/resources/vehdb/Line_Haul_Conv.csv +77 -0
  151. fastsim-2.0.10/fastsim/resources/vehdb/Line_Haul_Conv.yaml +168 -0
  152. fastsim-2.0.10/fastsim/resources/vehdb/README.md +1 -0
  153. fastsim-2.0.10/fastsim/resources/vehdb/Regional_Delivery_Class_8_Truck.csv +77 -0
  154. fastsim-2.0.10/fastsim/resources/vehdb/Regional_Delivery_Class_8_Truck.yaml +168 -0
  155. fastsim-2.0.10/fastsim/resources/vehdb/fail_overrides.csv +82 -0
  156. fastsim-2.0.10/fastsim/resources/vehdb/fail_overrides.yaml +168 -0
  157. fastsim-2.0.10/fastsim/resources/vehdb/legacy_template.csv +80 -0
  158. fastsim-2.0.10/fastsim/resources/vehdb/legacy_template.yaml +168 -0
  159. fastsim-2.0.10/fastsim/resources/vehdb/template.csv +80 -0
  160. fastsim-2.0.10/fastsim/resources/vehdb/template.yaml +168 -0
  161. fastsim-2.0.10/fastsim/resources/vehdb/test_overrides.csv +82 -0
  162. fastsim-2.0.10/fastsim/resources/vehdb/test_overrides.yaml +168 -0
  163. fastsim-2.0.10/fastsim/resources/vehdb/thermal/2012_Ford_Fusion_thrml.yaml +34 -0
  164. fastsim-2.0.10/fastsim/rustext.py +20 -0
  165. fastsim-2.0.10/fastsim/simdrive.py +2581 -0
  166. fastsim-2.0.10/fastsim/simdrivelabel.py +491 -0
  167. fastsim-2.0.10/fastsim/tests/__init__.py +17 -0
  168. fastsim-2.0.10/fastsim/tests/test_auxiliaries.py +63 -0
  169. fastsim-2.0.10/fastsim/tests/test_cav_demo.py +24 -0
  170. fastsim-2.0.10/fastsim/tests/test_cav_sweep.py +110 -0
  171. fastsim-2.0.10/fastsim/tests/test_coasting.py +1272 -0
  172. fastsim-2.0.10/fastsim/tests/test_copy.py +131 -0
  173. fastsim-2.0.10/fastsim/tests/test_cycle.py +542 -0
  174. fastsim-2.0.10/fastsim/tests/test_demo.py +310 -0
  175. fastsim-2.0.10/fastsim/tests/test_eco_cruise.py +97 -0
  176. fastsim-2.0.10/fastsim/tests/test_following.py +1174 -0
  177. fastsim-2.0.10/fastsim/tests/test_logging.py +20 -0
  178. fastsim-2.0.10/fastsim/tests/test_rust.py +367 -0
  179. fastsim-2.0.10/fastsim/tests/test_simdrive.py +279 -0
  180. fastsim-2.0.10/fastsim/tests/test_simdrive_sweep.py +288 -0
  181. fastsim-2.0.10/fastsim/tests/test_soc_correction.py +154 -0
  182. fastsim-2.0.10/fastsim/tests/test_utils.py +14 -0
  183. fastsim-2.0.10/fastsim/tests/test_vehicle.py +142 -0
  184. fastsim-2.0.10/fastsim/tests/test_vs_excel.py +284 -0
  185. fastsim-2.0.10/fastsim/utilities.py +357 -0
  186. fastsim-2.0.10/fastsim/vehicle.py +878 -0
  187. fastsim-2.0.10/fastsim/vehicle_base.py +240 -0
  188. fastsim-2.0.10/fastsim.egg-info/PKG-INFO +18 -0
  189. fastsim-2.0.10/fastsim.egg-info/SOURCES.txt +223 -0
  190. fastsim-2.0.10/fastsim.egg-info/dependency_links.txt +1 -0
  191. fastsim-2.0.10/fastsim.egg-info/not-zip-safe +1 -0
  192. fastsim-2.0.10/fastsim.egg-info/requires.txt +11 -0
  193. fastsim-2.0.10/fastsim.egg-info/top_level.txt +1 -0
  194. fastsim-2.0.10/pyproject.toml +47 -0
  195. fastsim-2.0.10/rust/Cargo.toml +21 -0
  196. fastsim-2.0.10/rust/fastsim-core/Cargo.toml +25 -0
  197. fastsim-2.0.10/rust/fastsim-core/proc-macros/Cargo.toml +17 -0
  198. fastsim-2.0.10/rust/fastsim-core/proc-macros/src/add_pyo3_api.rs +281 -0
  199. fastsim-2.0.10/rust/fastsim-core/proc-macros/src/approx_eq_derive.rs +33 -0
  200. fastsim-2.0.10/rust/fastsim-core/proc-macros/src/history_vec_derive.rs +118 -0
  201. fastsim-2.0.10/rust/fastsim-core/proc-macros/src/imports.rs +6 -0
  202. fastsim-2.0.10/rust/fastsim-core/proc-macros/src/lib.rs +23 -0
  203. fastsim-2.0.10/rust/fastsim-core/proc-macros/src/utilities.rs +300 -0
  204. fastsim-2.0.10/rust/fastsim-core/src/air.rs +204 -0
  205. fastsim-2.0.10/rust/fastsim-core/src/cycle.rs +1087 -0
  206. fastsim-2.0.10/rust/fastsim-core/src/html/docs-header.html +20 -0
  207. fastsim-2.0.10/rust/fastsim-core/src/imports.rs +12 -0
  208. fastsim-2.0.10/rust/fastsim-core/src/lib.rs +51 -0
  209. fastsim-2.0.10/rust/fastsim-core/src/macros.rs +47 -0
  210. fastsim-2.0.10/rust/fastsim-core/src/params.rs +187 -0
  211. fastsim-2.0.10/rust/fastsim-core/src/pyo3imports.rs +4 -0
  212. fastsim-2.0.10/rust/fastsim-core/src/simdrive/cyc_mods.rs +1101 -0
  213. fastsim-2.0.10/rust/fastsim-core/src/simdrive/simdrive_impl.rs +1848 -0
  214. fastsim-2.0.10/rust/fastsim-core/src/simdrive.rs +581 -0
  215. fastsim-2.0.10/rust/fastsim-core/src/simdrivelabel.rs +1055 -0
  216. fastsim-2.0.10/rust/fastsim-core/src/thermal.rs +1171 -0
  217. fastsim-2.0.10/rust/fastsim-core/src/traits.rs +162 -0
  218. fastsim-2.0.10/rust/fastsim-core/src/utils.rs +357 -0
  219. fastsim-2.0.10/rust/fastsim-core/src/vehicle.rs +1433 -0
  220. fastsim-2.0.10/rust/fastsim-core/src/vehicle_thermal.rs +497 -0
  221. fastsim-2.0.10/rust/fastsim-core/src/vehicle_utils.rs +225 -0
  222. fastsim-2.0.10/rust/fastsim-py/Cargo.toml +20 -0
  223. fastsim-2.0.10/rust/fastsim-py/src/lib.rs +25 -0
  224. fastsim-2.0.10/setup.cfg +4 -0
  225. fastsim-2.0.10/setup.py +29 -0
fastsim-2.0.10/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Future Automotive Systems Technology Simulator (FASTSim(TM)) Copyright (c) 2020 Alliance for Sustainable Energy, LLC All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Redistribution of this software, without modification, must refer to the software by the same designation. Redistribution of a modified version of this software (i) may not refer to the modified version by the same designation, or by any confusingly similar designation, and (ii) must refer to the underlying software originally provided by Alliance as “FASTSim”. Except to comply with the foregoing, the term “FASTSim”, or any confusingly similar designation may not be used to refer to any modified version of this software or any modified version of the underlying software originally provided by Alliance without the prior written consent of Alliance.
10
+
11
+ 4. The name of the copyright holder(s), any contributors, the United States Government, the United States Department of Energy, or any of their employees may not be used to endorse or promote products derived from this software without specific prior written permission from the respective party.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+
@@ -0,0 +1,14 @@
1
+ Future Automotive Systems Technology Simulator (FASTSim(TM)) Copyright (c) 2020 Alliance for Sustainable Energy, LLC All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Redistribution of this software, without modification, must refer to the software by the same designation. Redistribution of a modified version of this software (i) may not refer to the modified version by the same designation, or by any confusingly similar designation, and (ii) must refer to the underlying software originally provided by Alliance as “FASTSim”. Except to comply with the foregoing, the term “FASTSim”, or any confusingly similar designation may not be used to refer to any modified version of this software or any modified version of the underlying software originally provided by Alliance without the prior written consent of Alliance.
10
+
11
+ 4. The name of the copyright holder(s), any contributors, the United States Government, the United States Department of Energy, or any of their employees may not be used to endorse or promote products derived from this software without specific prior written permission from the respective party.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+
@@ -0,0 +1,7 @@
1
+ include LICENSE LICENSE.md README.md setup.py
2
+ include pyproject.toml rust/Cargo.toml rust/fastsim-py/Cargo.toml rust/fastsim-core/Cargo.toml rust/fastsim-core/proc-macros/Cargo.toml
3
+ recursive-include rust/fastsim-py/src *
4
+ recursive-include rust/fastsim-core/src *
5
+ recursive-include rust/fastsim-core/proc-macros/src *
6
+ recursive-include fastsim/resources *
7
+ recursive-include fastsim/docs *
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.1
2
+ Name: fastsim
3
+ Version: 2.0.10
4
+ Summary: Tool for modeling vehicle powertrains
5
+ Author-email: MBAP Group <fastsim@nrel.gov>
6
+ Project-URL: Homepage, https://www.nrel.gov/transportation/fastsim.html
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: Other/Proprietary License
9
+ Classifier: Operating System :: POSIX
10
+ Classifier: Operating System :: MacOS :: MacOS X
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Requires-Python: <3.11,>=3.8
13
+ Description-Content-Type: text/markdown
14
+ Provides-Extra: dev
15
+ License-File: LICENSE
16
+ License-File: LICENSE.md
17
+
18
+ [docs/README.md](fastsim/docs/README.md)
@@ -0,0 +1 @@
1
+ [docs/README.md](fastsim/docs/README.md)
@@ -0,0 +1,62 @@
1
+ """Package containing modules for running FASTSim.
2
+ For example usage, see """
3
+
4
+ from pathlib import Path
5
+ import sys
6
+ import logging
7
+ import traceback
8
+
9
+ def package_root() -> Path:
10
+ """Returns the package root directory."""
11
+ return Path(__file__).parent
12
+
13
+ # Set up logging
14
+ logging.basicConfig(
15
+ format="%(asctime)s.%(msecs)03d | %(filename)s:%(lineno)s | %(levelname)s: %(message)s",
16
+ datefmt="%Y-%m-%d %H:%M:%S",
17
+ )
18
+ logger = logging.getLogger(__name__)
19
+
20
+ # Override exception handler
21
+ def _exception_handler(exc_type, exc_value, exc_traceback):
22
+ # Handle exception normally if it's a KeyboardInterrupt
23
+ if issubclass(exc_type, KeyboardInterrupt):
24
+ sys.__excepthook__(exc_type, exc_value, exc_traceback)
25
+ return
26
+ # Handle exception normally if error originates outside of FASTSim
27
+ exc_filepath = Path(traceback.extract_tb(exc_traceback)[-1].filename)
28
+ if not package_root() in exc_filepath.parents:
29
+ sys.__excepthook__(exc_type, exc_value, exc_traceback)
30
+ return
31
+ # Log error if it comes from FASTSim
32
+ logger.error("uncaught exception", exc_info=(
33
+ exc_type, exc_value, exc_traceback))
34
+ sys.excepthook = _exception_handler
35
+
36
+ from . import parameters as params
37
+ from . import utilities as utils
38
+ from . import simdrive, vehicle, cycle, calibration, tests
39
+ from . import calibration as cal
40
+ from .resample import resample
41
+ from . import auxiliaries
42
+
43
+ from pkg_resources import get_distribution
44
+
45
+ __version__ = get_distribution('fastsim').version
46
+
47
+ __doc__ += f"{Path(__file__).parent / 'docs/README.md'}"
48
+
49
+ try:
50
+ import fastsimrust as fsr
51
+ except ImportError:
52
+ logger.warn("fastsimrust not installed")
53
+ else:
54
+ # Enable np.array() on array structs
55
+ import numpy as np
56
+
57
+ def _as_numpy_array(self, *args, **kwargs):
58
+ return np.array(list(self), *args, **kwargs)
59
+ setattr(fsr.Pyo3ArrayF64, "__array__", _as_numpy_array)
60
+ setattr(fsr.Pyo3ArrayU32, "__array__", _as_numpy_array)
61
+ setattr(fsr.Pyo3ArrayBool, "__array__", _as_numpy_array)
62
+ setattr(fsr.Pyo3VecF64, "__array__", _as_numpy_array)
@@ -0,0 +1,232 @@
1
+ """Auxiliary functions that require fastsim and provide faster access FASTSim vehicle properties."""
2
+ import fastsim as fsim
3
+ from fastsim.vehicle import Vehicle
4
+ from fastsim import parameters as params
5
+ from scipy.optimize import minimize, curve_fit
6
+ import numpy as np
7
+ import matplotlib.pyplot as plt
8
+ from typing import Tuple, List
9
+
10
+ from fastsim.utilities import get_rho_air
11
+
12
+ props = params.PhysicalProperties()
13
+ R_air = 287 # J/(kg*K)
14
+
15
+
16
+ def abc_to_drag_coeffs(veh: Vehicle,
17
+ a_lbf: float, b_lbf__mph: float, c_lbf__mph2: float,
18
+ custom_rho: bool = False,
19
+ custom_rho_temp_degC: float = 20.,
20
+ custom_rho_elevation_m: float = 180.,
21
+ simdrive_optimize: bool = True,
22
+ show_plots: bool = False,
23
+ use_rust=True) -> Tuple[float, float]:
24
+ """For a given vehicle and target A, B, and C
25
+ coefficients; calculate and return drag and rolling resistance
26
+ coefficients.
27
+
28
+ Arguments:
29
+ ----------
30
+ veh: vehicle.Vehicle with all parameters correct except for drag and rolling resistance coefficients
31
+ a_lbf, b_lbf__mph, c_lbf__mph2: coastdown coefficients for road load [lbf] vs speed [mph]
32
+ custom_rho: if True, use `fastsim.utilities.get_rho_air()` to calculate the current ambient density
33
+ custom_rho_temp_degC: ambient temperature [degree C] for `get_rho_air()`;
34
+ will only be used when `custom_rho` is True
35
+ custom_rho_elevation_m: location elevation [degree C] for `get_rho_air()`;
36
+ will only be used when `custom_rho` is True; default value is elevation of Chicago, IL
37
+ simdrive_optimize: if True, use `SimDrive` to optimize the drag and rolling resistance;
38
+ otherwise, directly use target A, B, C to calculate the results
39
+ show_plots: if True, plots are shown
40
+ use_rust: if True, use rust implementation of drag coefficient calculation.
41
+ """
42
+
43
+ # TODO: allows air density read APIs for whole project; `get_rho_air()` not used for `SimDrive` yet
44
+ cur_ambient_air_density_kg__m3 = get_rho_air(
45
+ custom_rho_temp_degC, custom_rho_elevation_m) if custom_rho else props.air_density_kg_per_m3
46
+
47
+ vmax_mph = 70.0
48
+
49
+ a_newton = a_lbf * params.N_PER_LBF
50
+ b_newton__mps = b_lbf__mph * params.N_PER_LBF * params.MPH_PER_MPS
51
+ c_newton__mps2 = c_lbf__mph2 * params.N_PER_LBF * \
52
+ params.MPH_PER_MPS * params.MPH_PER_MPS
53
+
54
+ cd_len = 300
55
+
56
+ cyc = fsim.cycle.Cycle.from_dict({
57
+ 'time_s': np.arange(0, cd_len),
58
+ 'mps': np.linspace(vmax_mph / params.MPH_PER_MPS, 0, cd_len)
59
+ })
60
+
61
+ if use_rust:
62
+ cyc = cyc.to_rust()
63
+ veh = veh.to_rust()
64
+
65
+ # polynomial function for pounds vs speed
66
+ dyno_func_lb = np.poly1d([c_lbf__mph2, b_lbf__mph, a_lbf])
67
+
68
+ def get_err(x):
69
+ """fastsim-style solution for drag force on vehicle.
70
+ Arguments:
71
+ ---------
72
+ x: (speed: array of vehicle speeds [mps], dragCoef: drag coefficient [-])
73
+ wheelRrCoef: rolling resistance coefficient [-]
74
+ """
75
+ drag_coef, wheel_rr_coef = x
76
+ veh.drag_coef = drag_coef
77
+ veh.wheel_rr_coef = wheel_rr_coef
78
+
79
+ if use_rust:
80
+ sd_coast = fsim.simdrive.RustSimDrive(cyc, veh)
81
+ else:
82
+ sd_coast = fsim.simdrive.SimDrive(cyc, veh)
83
+ sd_coast.impose_coast = [True] * len(sd_coast.impose_coast)
84
+ sd_coast.sim_drive()
85
+
86
+ cutoff = np.where(np.array(sd_coast.mps_ach) < 0.1)[0][0]
87
+
88
+ err = fsim.cal.get_error_val(
89
+ (1000 * (np.array(sd_coast.drag_kw) + np.array(sd_coast.rr_kw)) /
90
+ np.array(sd_coast.mps_ach))[:cutoff],
91
+ (dyno_func_lb(sd_coast.mph_ach) * fsim.params.N_PER_LBF)[:cutoff],
92
+ np.array(cyc.time_s)[:cutoff],
93
+ )
94
+
95
+ return err
96
+
97
+ if simdrive_optimize:
98
+ res = minimize(get_err, x0=np.array([0.3, 0.01]))
99
+ (drag_coef, wheel_rr_coef) = res.x
100
+
101
+ # TODO: Surpress unnecessary excessive warnings on screen
102
+
103
+ else:
104
+ drag_coef = c_newton__mps2 / \
105
+ (0.5 * veh.frontal_area_m2 * cur_ambient_air_density_kg__m3)
106
+ wheel_rr_coef = a_newton / veh.veh_kg / props.a_grav_mps2
107
+
108
+ veh.drag_coef, veh.wheel_rr_coef = drag_coef, wheel_rr_coef
109
+
110
+ sd_coast = fsim.simdrive.RustSimDrive(
111
+ cyc, veh) if use_rust else fsim.simdrive.SimDrive(cyc, veh)
112
+ sd_coast.impose_coast = [True] * len(sd_coast.impose_coast)
113
+ sd_coast.sim_drive()
114
+
115
+ cutoff_val = np.where(np.array(sd_coast.mps_ach) < 0.1)[0][0]
116
+
117
+ if show_plots:
118
+ plt.figure()
119
+ plt.plot(
120
+ np.array(sd_coast.mph_ach)[:cutoff_val],
121
+ (1000 * (np.array(sd_coast.drag_kw) + np.array(sd_coast.rr_kw)) /
122
+ np.array(sd_coast.mps_ach) / fsim.params.N_PER_LBF)[:cutoff_val],
123
+ label='sim_drive simulated road load')
124
+ plt.plot(np.array(sd_coast.mph_ach)[:cutoff_val], (dyno_func_lb(
125
+ sd_coast.mph_ach))[:cutoff_val], label='ABCs calculated road load')
126
+ plt.legend()
127
+ plt.xlabel('Speed [mph]')
128
+ plt.ylabel('Road Load [lb]')
129
+ plt.title("Simulated vs Calculated Road Load with Speed")
130
+ plt.show()
131
+
132
+ fig, ax = plt.subplots(2, 1, sharex=True)
133
+ ax[0].plot(np.array(cyc.time_s)[:cutoff_val],
134
+ (1000 * (np.array(sd_coast.drag_kw) + np.array(sd_coast.rr_kw)
135
+ ) / np.array(sd_coast.mps_ach))[:cutoff_val]
136
+ )
137
+ ax[0].set_ylabel("Road Load [N]")
138
+
139
+ ax[-1].plot(np.array(cyc.time_s)[:cutoff_val],
140
+ np.array(sd_coast.mph_ach)[:cutoff_val])
141
+ ax[-1].set_ylabel("mph")
142
+ ax[-1].set_xlabel('Time [s]')
143
+ plt.show()
144
+ return drag_coef, wheel_rr_coef
145
+
146
+
147
+ def drag_coeffs_to_abc(veh,
148
+ custom_rho: bool = False,
149
+ custom_rho_temp_degC: float = 20.,
150
+ custom_rho_elevation_m: float = 180.,
151
+ fit_with_curve: bool = False,
152
+ show_plots: bool = False) -> Tuple[float, float, float]:
153
+ """For a given vehicle mass, frontal area, dragCoef, and wheelRrCoef,
154
+ calculate and return ABCs.
155
+
156
+ Arguments:
157
+ ----------
158
+ veh: vehicle.Vehicle with correct drag and rolling resistance
159
+ custom_rho: if True, use `fastsim.utilities.get_rho_air()` to calculate the current ambient density
160
+ custom_rho_temp_degC: ambient temperature [degree C] for `get_rho_air()`; will only be used when `custom_rho` is True
161
+ custom_rho_elevation_m: location elevation [degree C] for `get_rho_air()`; will only be used when `custom_rho` is True; default value is elevation of Chicago, IL
162
+ fit_with_curve: if True, use `scipy.curve_fit` to get A, B, Cs; otherwise, directly calculate A, B, Cs from given drag and rolling resistance
163
+ show_plots: if True, plots are shown
164
+
165
+ Returns:
166
+ a_lbf, b_lbf__mph, c_lbf__mph2: coastdown coefficients for road load [lbf] vs speed [mph]
167
+ """
168
+ # TODO: allows air density read APIs for whole project; `get_rho_air()` not used for `SimDrive` yet
169
+ cur_ambient_air_density_kg__m3 = get_rho_air(
170
+ custom_rho_temp_degC, custom_rho_elevation_m) if custom_rho else props.air_density_kg_per_m3
171
+
172
+ vmax_mph = 70.0
173
+
174
+ speed_mph = np.linspace(0, vmax_mph, 500)
175
+ veh_kg = veh.veh_kg
176
+ veh_fa_m2 = veh.frontal_area_m2
177
+ drag_coef = veh.drag_coef
178
+ wheel_rr_coef = veh.wheel_rr_coef
179
+
180
+ c_newton__mps2 = drag_coef * \
181
+ (0.5 * veh_fa_m2 * cur_ambient_air_density_kg__m3)
182
+ b_newton__mps = 0.0
183
+ a_newton = wheel_rr_coef * veh_kg * props.a_grav_mps2
184
+
185
+ def model_func_lb(speed_mps, drag_coef, wheel_rr_coef):
186
+ """fastsim-style solution for drag force on vehicle.
187
+ Arguments:
188
+ ---------
189
+ speed: array of vehicle speeds [mps]
190
+ dragCoef: drag coefficient [-]
191
+ wheelRrCoef: rolling resistance coefficient [-]
192
+ """
193
+ out = (veh_kg * props.a_grav_mps2 * wheel_rr_coef +
194
+ 0.5 * cur_ambient_air_density_kg__m3 * drag_coef * veh_fa_m2
195
+ * speed_mps ** 2) / 4.448
196
+ return out
197
+
198
+ model_lb = model_func_lb(
199
+ speed_mph / params.MPH_PER_MPS, drag_coef, wheel_rr_coef)
200
+
201
+ # polynomial function for pounds vs speed
202
+ def dyno_func_lb(speed_mph, a, b, c):
203
+ return np.poly1d([c, b, a])(speed_mph)
204
+ if fit_with_curve:
205
+ (a_lbf, b_lbf__mph, c_lbf__mph2), pcov = curve_fit(dyno_func_lb,
206
+ xdata=speed_mph,
207
+ ydata=model_lb,
208
+ p0=[10, 0.1, 0.01])
209
+ else:
210
+ a_lbf = a_newton / params.N_PER_LBF
211
+ b_lbf__mph = b_newton__mps / params.N_PER_LBF / params.MPH_PER_MPS
212
+ c_lbf__mph2 = c_newton__mps2 / params.N_PER_LBF / \
213
+ params.MPH_PER_MPS / params.MPH_PER_MPS
214
+ dyno_lb = dyno_func_lb(speed_mph, a_lbf, b_lbf__mph, c_lbf__mph2)
215
+
216
+ if show_plots:
217
+ plt.figure()
218
+ plt.plot(speed_mph, dyno_lb, label='dyno')
219
+ plt.plot(speed_mph, model_lb, label='model', linestyle='--')
220
+ plt.legend()
221
+ plt.xlabel('Speed [mph]')
222
+ plt.ylabel('Road Load [lb]')
223
+ plt.show()
224
+
225
+ return a_lbf, b_lbf__mph, c_lbf__mph2
226
+
227
+
228
+ def set_nested_values(nested_struct, **kwargs):
229
+ nested_struct.reset_orphaned()
230
+ for key, value in kwargs.items():
231
+ setattr(nested_struct, key, value)
232
+ return nested_struct