Can we script a transmission technology like in this video?Is it possible?
Cheers;
John
Yeah I remember a previous Concept Competition car that had a fudged CVT (as well as the Prius). Maybe though its something that Ruud could implement, like having a selectable transmission type of manual, automatic, CVT, etc. (I can only thing of the it having to be a selectable trans in the car.ini because of the CVT's near infinite combination of ratios).In theory you can fudge that behaviour with clutch slip, but it's not ideal.
Really what you'd want to do is alter the gear ratio dynamically with speed, but I'm not sure if that is possible via Onyx right now, never mind qscript.
We really need Ruud to finish up Onyx and expose all the car.ini and system variables before we can do stuff like this properly.
Cheers
Dave
my experiences with CVT's (probably some pretty bad ones at that) has told me that it does seem to work like if you put it full throttle it will go all the way up the rev range and sit there until you let off, so just set the max rpm at the peak hp rpm, but if you're say on the freeway it will put it closer to a set rpm (like 2000 rpm). So really for max power like a CVT would do, is not so hard, we could probably do it right now, its just the rest of it that would need a lot more work to get working right.It doesn't work like that though.
It works on getting engine revs at max power when the throttle is at max. Ie, I want to go as fast as possible, ergo you need the engine at max power.
Thus the ratio you want is a function of current road speed and the shape of the power curve (roughly linear to peak power, but most diesels bulge a bit in the middle)
Doing it purely based on throttle won't work, you also need to continually adjust it based on speed too
It's a pretty easy calc really, we just need proper access to the variables (why we can't just access all car.ini variables via car.ini syntax is beyond me.
ie, this_car.gearbox.final_drive = function(wheelspeed and throttleposition)
Simples
Dave
// Continuously variable transmission: Uses gear 1 of the car.
// approximate 'idle' rpm
float $minrpm = 800
// approximate 'max acceleration' rpm
float $maxrpm = 3300
// highest ratio possible, used at low speeds
float $minrat = 16.0
// lowest ratio possible, used at high speeds
float $maxrat = 0.9
// tracking vars
float $throttle = 0
float $rpm = 0
float $tt = 0
rcar $car = get scriptowner car
// grab the string associated with this car
int $ncars = get carcount
int $i = 0
rcar $ccar = get car $i
while $car != $ccar {
$i = $i + 1
$ccar = get car $i
}
string $req = "car" + $i
// $req now contains car0, car1, whatever this car is.
// tag on the specific thing we're modifying - gear2 is 1st forward gear
string $out = $req + ".gearbox.gear2_ratio"
float $ratio = get system $out
while 1
{
// use throttle^2 to determine target rpm between min and max
// at full throttle it aims for maxrpm, at no throttle, min.
$throttle = get $car throttle
$throttle = $throttle*$throttle
$rpm = get $car rpm
$tt = ($maxrpm-$minrpm)*$throttle + $minrpm
// update transmission ratio to approach correct speed
$ratio = $ratio + 0.0001*($tt-$rpm)
// check ratio's not too high
if $ratio < $maxrat {
$ratio = $maxrat
}
// and not too low
if $ratio > $minrat {
$ratio = $minrat
}
// update system variable
set system $out to $ratio
interrupt
}
Turns out I did write a working CVT script in 0.8.38. Haven't tested it much so I can't say which this'll work for. Should be fine in anything more recent since it's pretty basic QScript but I don't remember when the system parameter it needs became available so it may not work in earlier versions. It does have code to handle multiplayer but that's untested.
goes in cars\f100\scripts\physics\cvt.rsx, or equivalent.
The 4 numbers at the top are pretty much all you want to tweak - this is set up for a truck so the idle and max-horsepower RPMs are both fairly low, as is the minimum gear. The ratios would be read off the CVT's info. Similar to the range from 1st to final gear in a normal car would make sense.Code:... script
Script plays out about the way this thread suggests it. It just compares throttle to current rpm and adjusts the ratio.
car.ini should be set for only one forward gear, this is tweaking 1st gear with a fixed final diff. ratio.
Try an earlier version RC6 is real buggy.