vcu

vcu torque table generation

introduction

For real vcu, values in the table will be the requrested torque Current throttlel (0,1) should be a coefficient of multplicative factor like between +/- 20% or empirically give safety bounds. action space will be then within the bounds TODO ask for safety bounds and real vcu to be integrated. TODO generate a mask according to WLTC to reduce parameter optimization space.


source

generate_torque_table

 generate_torque_table (pedal_scale:tuple, speed_scale:tuple)

*Generate VCU calibration parameters for a given truck. simple piecewise linear surface, close to default calibration table Input is npd 17, nvl 21; output vcu_param_list as float32 pedal is x(column), velocity is y(row) )

Parameters:

pedal_scale: tuple
    pedal range (0,1)
speed_scale: tuple
    speed range (0,120)

Return: pandas dataframe*

Type Details
pedal_scale tuple
speed_scale tuple pedal range (0,1) # speed range (0,120)

source

generate_vcu_calibration

 generate_vcu_calibration (npd:int, pedal_range:tuple, nvl:int,
                           velocity_range:tuple, shortcut:int,
                           data_root:pathlib.Path)

*Generate VCU calibration parameters for a given truck.

pedal is x(column), velocity is y(row) input : npd 17, nvl 21; output vcu_param_list as float32

Parameters:

npd: int
    number of pedal steps
pedal_range: tuple
    pedal range (0,1)
nvl: int
    number of velocity steps
velocity_range: tuple
    speed range (0,120)
shortcut: int
    1: use segment-wise linear eco calibration table
    2: use init table
    3: use latest pedal map that was used
data_root: str
    path to data folder

Return: pandas dataframe*

Type Details
npd int number of pedal steps
pedal_range tuple pedal range (0,1)
nvl int number of velocity steps
velocity_range tuple speed range (0,120)
shortcut int 1: use default eco calibration table
data_root Path path to data folder
# fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
# # Plot the surface.
# surf = ax.plot_surface(pdv, vlv, v, cmap=cm.coolwarm,
#                        linewidth=0, antialiased=False)
# # Customize the z axis.
# ax.set_zlim(-0.01, 1.01)
# ax.zaxis.set_major_locator(LinearLocator(10))
# # A StrMethodFormatter is used automatically
# ax.zaxis.set_major_formatter('{x:.02f}')
# 
# # Add a color bar which maps values to colors.
# fig.colorbar(surf, shrink=0.5, aspect=5)
# plt.show()
# return np.float32(v)

source

generate_lookup_table

 generate_lookup_table (pedal_range:tuple, velocity_range:tuple,
                        calib_table:pandas.core.frame.DataFrame)

*Generate VCU calibration parameters for a given truck.

pedal in x(col), velocity in y(row) input : npd 17, nvl 21; output vcu_param_list as float32

Parameters:

pedal_range: tuple
    pedal range (0,1)
velocity_range: tuple
    speed range (0,120)
calib_table: pandas dataframe
    calibration table

Return:

numpy array*

testing


source

test_generate_vcu_calibration

 test_generate_vcu_calibration ()

source

test_generate_lookup_table

 test_generate_lookup_table ()
vcu_calib_table = test_generate_vcu_calibration()
vcu_calib_table
0.0000 0.0625 0.1250 0.1875 0.2500 0.3125 0.3750 0.4375 0.5000 0.5625 0.6250 0.6875 0.7500 0.8125 0.8750 0.9375 1.0000
0.000000 0.0 0.062500 0.125000 0.187500 0.250000 0.312500 0.375000 0.437500 0.500000 0.562500 0.625000 0.687500 0.750000 0.812500 0.875000 0.937500 1.000000
7.000000 0.0 0.026102 0.052204 0.078307 0.104409 0.130511 0.156613 0.182715 0.208818 0.234920 0.261022 0.287124 0.313227 0.339329 0.365431 0.391533 0.417635
1.052632 0.0 0.040565 0.081130 0.121695 0.162260 0.202825 0.243390 0.283955 0.324520 0.365085 0.405650 0.446215 0.486780 0.527345 0.567910 0.608475 0.649040
2.105263 0.0 0.035416 0.070833 0.106249 0.141666 0.177082 0.212498 0.247915 0.283331 0.318748 0.354164 0.389580 0.424997 0.460413 0.495830 0.531246 0.566662
3.157895 0.0 0.032273 0.064547 0.096820 0.129093 0.161366 0.193640 0.225913 0.258186 0.290460 0.322733 0.355006 0.387280 0.419553 0.451826 0.484099 0.516373
4.210526 0.0 0.030027 0.060054 0.090080 0.120107 0.150134 0.180161 0.210187 0.240214 0.270241 0.300268 0.330294 0.360321 0.390348 0.420375 0.450402 0.480428
5.263158 0.0 0.028292 0.056583 0.084875 0.113167 0.141459 0.169750 0.198042 0.226334 0.254625 0.282917 0.311209 0.339501 0.367792 0.396084 0.424376 0.452667
6.315789 0.0 0.026887 0.053774 0.080661 0.107549 0.134436 0.161323 0.188210 0.215097 0.241984 0.268871 0.295758 0.322646 0.349533 0.376420 0.403307 0.430194
7.368421 0.0 0.025713 0.051426 0.077140 0.102853 0.128566 0.154279 0.179992 0.205706 0.231419 0.257132 0.282845 0.308558 0.334272 0.359985 0.385698 0.411411
8.421053 0.0 0.024709 0.049418 0.074127 0.098836 0.123545 0.148254 0.172963 0.197672 0.222381 0.247090 0.271799 0.296509 0.321218 0.345927 0.370636 0.395345
9.473684 0.0 0.023835 0.047670 0.071504 0.095339 0.119174 0.143009 0.166844 0.190679 0.214513 0.238348 0.262183 0.286018 0.309853 0.333687 0.357522 0.381357
10.526316 0.0 0.023063 0.046126 0.069189 0.092252 0.115315 0.138378 0.161441 0.184504 0.207567 0.230630 0.253693 0.276756 0.299819 0.322883 0.345946 0.369009
11.578947 0.0 0.022374 0.044748 0.067122 0.089496 0.111870 0.134244 0.156618 0.178992 0.201366 0.223740 0.246114 0.268488 0.290862 0.313236 0.335609 0.357983
12.631579 0.0 0.021753 0.043506 0.065259 0.087012 0.108765 0.130518 0.152271 0.174024 0.195777 0.217530 0.239283 0.261036 0.282789 0.304542 0.326294 0.348047
13.684211 0.0 0.021189 0.042378 0.063567 0.084756 0.105944 0.127133 0.148322 0.169511 0.190700 0.211889 0.233078 0.254267 0.275456 0.296644 0.317833 0.339022
14.736842 0.0 0.020673 0.041346 0.062019 0.082692 0.103365 0.124038 0.144712 0.165385 0.186058 0.206731 0.227404 0.248077 0.268750 0.289423 0.310096 0.330769
15.789474 0.0 0.020199 0.040397 0.060596 0.080795 0.100993 0.121192 0.141390 0.161589 0.181788 0.201986 0.222185 0.242384 0.262582 0.282781 0.302979 0.323178
16.842105 0.0 0.019760 0.039520 0.059280 0.079040 0.098800 0.118560 0.138320 0.158080 0.177840 0.197600 0.217360 0.237120 0.256880 0.276640 0.296400 0.316160
17.894737 0.0 0.019353 0.038705 0.058058 0.077411 0.096764 0.116116 0.135469 0.154822 0.174174 0.193527 0.212880 0.232233 0.251585 0.270938 0.290291 0.309644
18.947368 0.0 0.018973 0.037946 0.056919 0.075892 0.094865 0.113838 0.132811 0.151784 0.170757 0.189730 0.208703 0.227676 0.246649 0.265622 0.284595 0.303568
20.000000 0.0 0.018618 0.037235 0.055853 0.074471 0.093088 0.111706 0.130324 0.148942 0.167559 0.186177 0.204795 0.223412 0.242030 0.260648 0.279265 0.297883
# #| output: true
# vcu_lookup_table = test_generate_lookup_table()
# vcu_calib_table