If working with floats... is division still slower than multiplication?

I guess the best way to minimize divisions is to refactor your code to minimize them...

Such as 1/10+2/10+3/10 would be the same as (1+2+3)/10... However.. lets say it's (1.0+2.0+3.0)/10.0.. would you gain much by getting rid of the division, and writing (1.0+2.0+3.0)*0.1 ?

Oh, I forgot to mention.. I found my terrible slowdown... it's amazing how much you can optimize your code and still have it run slow when you forgot about a delay(100) in it!!

Meanwhile, I've made a very preliminary VGT logic, which doesn't do braking yet..

`//the following values are all wild guesses.. There's a CERTAINTY that some will need to be negative, and some may be zero`

//for example with the EGPV we aren't concerned about what the actual number is, but rather to maximize it, in which case

//the slope and rate of change of slope may be of greater interest... at least in theory

float MAPsensitivity = .1;

float MAPslopeSensitivity = .1;

//float MAPdeltaSlopeSensitivity = .1; //I don't think I'll need this here

float DPRsensitivity = .1;

float DPRslopeSensitivity = .1;

float DPRdeltaSlopeSensitivity = .1;

float EGPVsensitivity = .1;

float EGPVslopeSensitivity = .1;

float EGPVdeltaSlopeSensitivity = .1;

float TSSoverRevSensitivity = 10;

float TSSunderRevSensitivity = 10;

float TSSoverRevSlopeSensitivity = 10;

float TSSunderRevSlopeSensitivity = 10;

float TSSmaxShaftSpeed = 150000;

float TSSminShaftSpeed = 60000;

int GetNewVGTposition() {

//This is the main component controlling the VGT, thus the largest values ought to be for this

float BoostCompensation = (MAP.Value() - DesiredBoost.Value() * 4) * MAPsensitivity + (MAP.Slope - DesiredBoost.Slope * 4) * MAPslopeSensitivity;

//Seems as though Drive pressure ratio is a big deal, and should be kept around 1.0, so I'd expect moderate values

float DPRcompensation = (1 - DPR.Value()) * DPRsensitivity + DPR.Slope * DPRslopeSensitivity + DPR.DeltaSlope * DPRdeltaSlopeSensitivity;

//Exhaust gas pressure*volume/nozzle size... the hope here is to maximize it thus maximizing acceleration of the turbine

float EGPVcompensation = EGPV.Value() * EGPVsensitivity + EGPV.Slope * EGPVslopeSensitivity + EGPV.DeltaSlope * EGPVdeltaSlopeSensitivity;

float TSScompensation;

//A little more complicated is the turbine shaft speed limits

if (TSS.Value() > (TSSmaxShaftSpeed -10000)) {

TSScompensation = mapf(TSS.Value(), TSS.MaxValue-10000, TSS.MaxValue, 0, TSSoverRevSensitivity);

TSScompensation += TSS.Slope*TSSoverRevSlopeSensitivity;

}else if (TSS.Value() < TSSminShaftSpeed){

TSScompensation = mapf(TSS.Value(), TSSminShaftSpeed, TSSminShaftSpeed/2, 0, TSSunderRevSensitivity);

TSScompensation += TSS.Slope*TSSunderRevSlopeSensitivity;

}

int NewVGT = VGT.Value() + BoostCompensation + DPRcompensation + EGPVcompensation + TSScompensation;

VGT.UpdateValue(NewVGT);

}

float GetNozzleSize(int VGTposition) {

//returns the nozzle size in Cm^2

//so a VGT position of 458 will return 15

return mapf(VGTposition, 40, 960, 25, 3);

}

And on the bright side, I'm starting to be able to write more than one line of code at a time without screwing up the syntax... though to go as far as to say "C++ is growing on me" would be a stretch.