How to continuously use transmission ratios in a gear shift simulation

12 ビュー (過去 30 日間)
Steffen Müller
Steffen Müller 2018 年 8 月 3 日
回答済み: Steve Miller 2022 年 12 月 20 日
I would like to implement a routine for an automotive gear shifting simulation. My given values/arrays are:
v=xlsread("Example.xls"); % Velocity vector
i=[4,3,2,1]; % Transmission ratios
n=(v.*60*i)/(2*pi*r); %RPM
p=(P./n)*((1200/1000)/(V_H)); %Mean pressure in cylinder
%P is a previously calculated array and V_H is a given number
For these calculations the rotational speed should lie inbetween 1500<n<3000 rpm. Therefore the calculation for the rotational speed should switch the transmission ratio "i" everytime "n" falls below 1500 (switch to previous transmission ratio) or exceeds 3000 rpm (switch to next gear ratio). At the end I would like the result to be a vector for "n" as well as "p".
At first try I replaced every every value of "n" that exceeded 3000 rpm through:
n = (v.*60*i(1))/(2*pi*r);
p1 = (P./n)*((1200/1000)/(V_H))
toreplace = n>3000;
n(toreplace) = v(toreplace).*60*i(2) / 2*pi*r;
p2 = (P./n)*((1200/1000)/(V_H))
toreplace2 = n>3000;
n(toreplace2) = v(toreplace2).*60*i(3) / 2*pi*r;
p3 = (P./n)*((1200/1000)/(V_H))
toreplace3 = n>3000;
n(toreplace3) = v(toreplace3).*60*i(4) / 2*pi*r;
p4 = (P./n)*((1200/1000)/(V_H))
But it only replaces the entries that are greater than 3000. However, changing the transmission ratio affects other entries too. So my goal is to find a loop or something similar that calculates the "n" to a given value (e.g. 3000 or below 1500) and then changes "i" to calculate the next set of values up to 3000 or below 1500 and write the results continuously into the same "n" vector.

回答 (1 件)

Steve Miller
Steve Miller 2022 年 12 月 20 日
I think your algorithm needs the concept of a "state", where you are calculating the current transmission output shaft speed based on the current state of the vehicle (its speed). If you set up your code as a function to accept speed as an input and select the proper n as an output, based on the selected gear, it will work.
You could also use a state machine to handle this behavior.
See this example:
--Steve

カテゴリ

Help Center および File ExchangeSimscape Driveline についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by