Loading [MathJax]/extensions/Safe.js

Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Difference between map temperature and oil temperature at mission start  (Read 561 times)

0 Members and 1 Guest are viewing this topic.

Whiskey_Sierra_972

  • Modder
  • member
  • Offline Offline
  • Posts: 6772
  • In memory of my beloved hero: Saburo SAKAI!

Hi mates!

After a lot of years playing IL2 , this afternoon I discover a strange thing:

The oil temperature of the airctaft at the beginning of the mission is different from mission temperature....

As you can see in this screenshoot I take (BAT 423 , QMB , El Alamein map , blue side) at the start of the mission the map temperature is 30° while oil temperature is 0°....



Not that this is a great deal to couple with , expecially at mission start , but as I never noticed this condition , I think that share it could be useful....
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #1 on: October 14, 2024, 03:36:09 PM »

[ADDED IN EDIT] Skip ahead to my post #7, where a solution is shown. Unless you want to follow my laboured, sinuous path toward eventual success. Incidentally, in the next post following this one I at least now have the satisfaction of having immediately identified the correct method to alter, but stupidly bypassed in mistakenly chasing down several dead ends.  ;)


An odd one, indeed.

How about the oil temp when spawning in flight?

If there is a way to set the oil temp (toil is the usual object name in the classes) to the air temp at mission start when spawning on the ground...
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #2 on: October 14, 2024, 03:55:55 PM »

Here's method computeTemperature() in Motor.class, in which the air temperature at the height of the motor is considered on the second line (variable f2). tOilIn and tOilOut are the variables under consideration here. For the check condition, if(stage == 6), that's when the engine is running (normally). The else condition following it is for other engine conditions, which I suppose includes when stopped? This is not an area I have any real familiarity with, not having delved into it. ;)

It would require to find where a starting oil temp could be set at mission start.

Code: [Select]
private void computeTemperature(float f)
{
float f1 = Math.max(0.0F, reference.getSpeedKMH());
float f2 = Atmosphere.temperature((float)reference.Loc.z) - 273.15F;
float f3 = controlThrottle;
if(!reference.isPlayers())
f3 *= 1.1F;
float f4 = f3;
float f5 = 0.8F + 60F / (50F + f1);
float f6 = 0.45F;
if(engineBoostFactor > 1.0F)
f4 = (f3 + Math.max(f3 - 1.0F, 0.0F) * (engineBoostFactor - 1.1F) * 10F) / engineBoostFactor;
if(!controlAfterburner && engineAfterburnerBoostFactor > 1.0F && afterburnerType != 1 && afterburnerType != 9 && afterburnerType != 4)
f4 /= engineAfterburnerBoostFactor;
float f7 = f4;
if(type == 0 || type == 1 || type == 7)
f6 = 0.45F / Atmosphere.density((float)reference.Loc.z);
float f8 = coolMult * f4;
if(World.cur().diffCur.ComplexEManagement && reference.isPlayers() && ((RealFlightModel)reference).isRealMode())
f7 = w / wWEP;
if(!reference.isPlayers())
f7 = (w * 1.02F) / wWEP;
if(stage == 6)
{
float f9 = f2 + tOilOutMaxRPM * (1.0F - 0.15F * controlRadiator) * (0.65F + 0.45F / Atmosphere.density((float)reference.Loc.z)) * (1.0F + (float)reference.AS.astateOilStates[number] * 0.35F) * 1.2F * f7 * f7 * (0.7F + 0.3F * f8) * f5;
tOilOut += (f9 - tOilOut) * f * tChangeSpeed;
float f13 = tOilOut * 0.8F;
tOilIn += (f13 - tOilIn) * f * 0.5F;
if(type == 2)
f6 = 0.35F + 0.1F / Atmosphere.density((float)reference.Loc.z);
f13 = f2 + tWaterMaxRPM * (1.0F - 0.15F * controlRadiator) * (0.65F + f6) * (0.6F + 0.4F * f7) * (0.1F + 1.1F * f8) * f5 * (1.1F - 0.1F * controlMix);
tWaterOut += (f13 - tWaterOut) * f * tChangeSpeed;
} else
{
float f10 = f2;
tOilOut += (f10 - tOilOut) * f * tChangeSpeed * (0.2F + 0.2F * controlRadiator);
float f14 = tOilOut;
tOilIn += (f14 - tOilIn) * f * 0.5F;
f14 = f2;
tWaterOut += (f14 - tWaterOut) * f * tChangeSpeed * (0.2F + 0.2F * controlRadiator);
}
if(!reference.isPlayers())
return;
if(World.cur().diffCur.Engine_Overheat && (tWaterOut > tWaterCritMax || tOilOut > tOilCritMax))
{
if(heatStringID == -1)
heatStringID = HUD.makeIdLog();
if(reference.isPlayers())
HUD.log(heatStringID, "EngineOverheat");
if(tWaterOut > tWaterCritMax)
{
float f11 = tWaterOut / tWaterCritMax - 1.0F;
f11 *= f11 * f11 * f * 1000F;
float f15 = World.Rnd().nextFloat() * timeOverheat;
if(f11 > f15)
switch(type)
{
default:
int i = World.Rnd().nextInt(0, 9);
if(i < 2)
{
reference.AS.hitEngine(reference.actor, number, 3);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - smoke");
} else
{
setCyliderKnockOut(reference.actor, World.Rnd().nextInt(0, 3));
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - power loss");
}
break;

case 0: // '\0'
case 1: // '\001'
case 7: // '\007'
int k = World.Rnd().nextInt(0, 99);
if(k < 50)
{
reference.AS.setEngineCylinderKnockOut(reference.actor, number, 1);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - cylinder");
break;
}
if(k < 65)
{
reference.AS.hitOil(reference.actor, number);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - oil");
break;
}
if(k < 94)
{
reference.AS.setEngineCylinderKnockOut(reference.actor, number, 1);
int i1 = 1;
do
{
if(i1 >= 11)
break;
if(World.Rnd().nextFloat() >= 0.8F)
{
try
{
com.maddox.il2.engine.Hook hook = reference.actor.findHook("_Engine" + (number + 1) + "EF_" + (i1 < 10 ? "0" + i1 : "" + i1));
if(hook != null)
Eff3DActor.New(reference.actor, hook, null, 1.0F, "3DO/Effects/Aircraft/EngineStart" + World.Rnd().nextInt(1, 3) + ".eff", -1F);
}
catch(Exception exception) { }
break;
}
i1++;
} while(true);
reference.AS.setSootState(reference.actor, number, 1);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - cylinder&smoke");
break;
}
if(k < 95)
{
reference.AS.setEngineCylinderKnockOut(reference.actor, number, 1);
reference.AS.hitEngine(reference.actor, number, 10);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - fire");
break;
}
if(k < 97)
{
setKillCompressor(reference.actor);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - Supercharger");
break;
}
if(k < 98)
{
reference.AS.setEngineDies(reference.actor, number);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - dead");
} else
{
reference.AS.setEngineStuck(reference.actor, number);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - stuck");
}
break;
}
}
if(tOilOut > tOilCritMax)
{
float f12 = tOilOut / tOilCritMax - 1.0F;
f12 *= f12 * f12 * f * 1000F;
float f16 = World.Rnd().nextFloat() * timeOverheat;
if(f12 > f16)
switch(type)
{
default:
int j = World.Rnd().nextInt(0, 9);
if(j < 2)
{
reference.AS.hitEngine(reference.actor, number, 3);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - smoke");
} else
{
setCyliderKnockOut(reference.actor, World.Rnd().nextInt(0, 3));
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - power loss");
}
break;

case 0: // '\0'
case 1: // '\001'
case 7: // '\007'
int l = World.Rnd().nextInt(0, 99);
if(l < 10)
{
reference.AS.setEngineCylinderKnockOut(reference.actor, number, 1);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - cylinder");
break;
}
if(l < 60)
{
reference.AS.hitOil(reference.actor, number);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - oil");
break;
}
if(l < 94)
{
setReadyness(readyness * 0.95F);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - damaged bearing or something");
break;
}
if(l < 95)
{
reference.AS.hitOil(reference.actor, number);
reference.AS.hitEngine(reference.actor, number, 3);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - fire");
break;
}
if(l < 96)
{
setKillCompressor(reference.actor);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - Supercharger");
break;
}
if(l < 97)
{
reference.AS.setEngineDies(reference.actor, number);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - dead");
} else
{
reference.AS.setEngineStuck(reference.actor, number);
Aircraft.debugprintln(reference.actor, "Malfunction #" + number + " - stuck");
}
break;
}
}
}
}
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #3 on: October 14, 2024, 04:10:40 PM »

In Motor.class, method doSetEngineRunning() might provide a place to interject consideration of the air temp. The oil (and water) temps here are currently set to a midpoint between relevant critical limits for these two fluids. Perhaps we could take the air temp, and if not outside these limits then it's used to set the fluid temp.

Any validity in this idea?


Code: [Select]
    public void doSetEngineRunning()
    {
        if(stage >= 6)
            return;
        stage = 6;
        reference.CT.setMagnetoControl(3);
        setControlMagneto(3);
        if(reference.isPlayers())
            HUD.log("EngineI1");
        w = wMax * 0.75F;
        tWaterOut = 0.5F * (tWaterCritMin + tWaterMaxRPM);
        tOilOut = 0.5F * (tOilCritMin + tOilOutMaxRPM);
        tOilIn = 0.5F * (tOilCritMin + tOilInMaxRPM);
        propPhi = 0.5F * (propPhiMin + propPhiMax);
        propTarget = propPhi;
        if(isnd != null)
            isnd.onEngineState(stage);
    }
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #4 on: October 14, 2024, 04:36:53 PM »

Not tested, but here's an idea for incorporating the air temp at engine start-up, in the same method as shown in my prior post. I'm assuming the critical temperatures are in dec C, and not deg K. Naturally, the same kind of adjustment of the water temperature could be done also (but not done here).

The fact that the oil temp was set to 0C in the OP's screenie is a bit concerning, suggesting some setting of that temp occurring elsewhere...

Code: [Select]
public void doSetEngineRunning()
{
if(stage >= 6)
return;
stage = 6;
reference.CT.setMagnetoControl(3);
setControlMagneto(3);
if(reference.isPlayers())
HUD.log("EngineI1");
w = wMax * 0.75F;

float airTemp = Atmosphere.temperature((float)reference.Loc.z) - 273.15F;  //NEW; air temperature at height of motor; deg K converted to C

tWaterOut = 0.5F * (tWaterCritMin + tWaterMaxRPM);

if(airTemp > tOilCritMin && airTemp < tOilOutMaxRPM)  //NEW
tOilOut = airTemp;
else
tOilOut = 0.5F * (tOilCritMin + tOilOutMaxRPM);  //original
if(airTemp > tOilCritMin && airTemp < tOilInMaxRPM)  //NEW
tOilIn = airTemp;
else
tOilIn = 0.5F * (tOilCritMin + tOilInMaxRPM);  //original
propPhi = 0.5F * (propPhiMin + propPhiMax);
propTarget = propPhi;
if(isnd != null)
isnd.onEngineState(stage);
}
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #5 on: October 14, 2024, 06:42:13 PM »

Between Motor.class and Engines.class I've tried setting the oil temp to the air temp in a few places, but no results obtain.

Could this involve the EMD? That's an area I have no familiarity with.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #6 on: October 14, 2024, 08:32:32 PM »

Here's a real head-scratcher. In Engines.class, method update(), we have the following. On line 3 the air temp is assigned to variable f1. Farther down are checks for TOilOut, TOilIn and TWaterOut, and if any are less than the air temp they are set to equal the air temp.

Yet we have these temps all starting at 0C, even on hot days, slowly rising to the air temp--or rising more quickly once the engine is started.

I don't get it. Method update() is always active from mission start.

Code: [Select]
public void update(float f, FlightModel flightmodel)
{
float f5 = Pitot.Indicator((float)flightmodel.Loc.z, flightmodel.getSpeedKMH());
boolean flag = true;
float f1 = Atmosphere.temperature((float)flightmodel.Loc.z) - 273.15F;
if(stage == 6)
{
float f2 = 1.05F * (float)Math.sqrt(Math.sqrt(getPower() <= 0.2F ? 0.2F : getPower() + (float)flightmodel.AS.astateOilStates[0] * 0.33F)) * (float)Math.sqrt(Wx / W0 <= 0.75F ? 0.75D : Wx / W0) * tOilOutMaxRPM * (flag ? 0.9F : 1.0F) * (1.0F - f5 * 0.0002F) + 22F;
if(getPower() > 1.0F)
f2 *= getPower();
TOilOut += (f2 - TOilOut) * f * tChangeSpeed;
} else
{
float f3 = (Wx / W0) * tOilOutMaxRPM * (flag ? 0.8F : 1.0F) + f1;
TOilOut += (f3 - TOilOut) * f * tChangeSpeed * (bInline ? 0.42F : 1.07F);
}
float f4;
if(flag)
f4 = TOilOut * (0.75F - f5 * 0.0005F) + f1 * (0.25F + f5 * 0.0005F);
else
f4 = TOilOut * (0.8F - f5 * 0.0005F) + f1 * (0.2F + f5 * 0.0005F);
TOilIn += (f4 - TOilIn) * f * tChangeSpeed * 0.5F;
f4 = 1.05F * (float)Math.sqrt(getPower()) * (1.0F - f5 * 0.0002F) * tWaterMaxRPM + f1;
TWaterOut += (f4 - TWaterOut) * f * tChangeSpeed * (TWaterOut >= 50F ? 1.0F : 0.4F) * (1.0F - f5 * 0.0006F);
if(TOilOut < f1)
TOilOut = f1;
if(TOilIn < f1)
TOilIn = f1;
if(TWaterOut < f1)
TWaterOut = f1;
if(World.cur().diffCur.Engine_Overheat && (TWaterOut > tWaterCritMax || TOilOut > tOilCritMax))
{
if(heatStringID == -1)
heatStringID = HUD.makeIdLog();
HUD.log(heatStringID, "EngineOverheat");
timeCounter += f;
if(timeCounter > timeOverheat)
{
for(int i = 0; i < Power.length; i++)
if(Power[i] > 0.33F)
{
Power[i] -= 0.00666F * f;
tOilCritMax -= 0.00666F * f * (tOilCritMax - tOilOutMaxRPM);
} else
{
Power[i] = 0.33F;
stage = 7;
}
}
} else
if(timeCounter > 0.0F)
{
timeCounter = 0.0F;
if(heatStringID == -1)
heatStringID = HUD.makeIdLog();
HUD.log(heatStringID, "EngineRestored");
}
}
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #7 on: October 14, 2024, 09:07:56 PM »

Success, it would appear.

Here's a screenshot taken immediately upon spawning on the ground, with an air temp of about 24C. The yellow text is the output of HUD.training(), which I often use to verify code results while testing. Note the oil temp needle (which is for tOilIn) on the combined engine gauge at the lower right, which reads about 25C on the scale. Previously it read zero (which would apply also for temps even colder, as the gauge bottoms out at 0C.)

[click for larger]



Here's the first part of method computeTemperature() in Motor.class. On line #2 the air temp is determined (variable f2). I added a few lines to make sure the oil in and out, and the water out temps now do not go below the air temp, as Engines.update() had done. The new code is the last 8 lines shown here. (BTW, I'm starting to think Engines.class is not even used...)

Code: [Select]
private void computeTemperature(float f)
{
float f1 = Math.max(0.0F, reference.getSpeedKMH());
float f2 = Atmosphere.temperature((float)reference.Loc.z) - 273.15F;
float f3 = controlThrottle;
if(!reference.isPlayers())
f3 *= 1.1F;
float f4 = f3;
float f5 = 0.8F + 60F / (50F + f1);
float f6 = 0.45F;
if(engineBoostFactor > 1.0F)
f4 = (f3 + Math.max(f3 - 1.0F, 0.0F) * (engineBoostFactor - 1.1F) * 10F) / engineBoostFactor;
if(!controlAfterburner && engineAfterburnerBoostFactor > 1.0F && afterburnerType != 1 && afterburnerType != 9 && afterburnerType != 4)
f4 /= engineAfterburnerBoostFactor;
float f7 = f4;
if(type == 0 || type == 1 || type == 7)
f6 = 0.45F / Atmosphere.density((float)reference.Loc.z);
float f8 = coolMult * f4;
if(World.cur().diffCur.ComplexEManagement && reference.isPlayers() && ((RealFlightModel)reference).isRealMode())
f7 = w / wWEP;
if(!reference.isPlayers())
f7 = (w * 1.02F) / wWEP;
if(stage == 6)
{
//            float f9 = f2 + tOilOutMaxRPM * (1.0F - 0.15F * controlRadiator) * (0.65F + 0.45F / Atmosphere.density((float)reference.Loc.z)) * (1.0F + (float)reference.AS.astateOilStates[number] * 0.35F) * 1.2F * f7 * f7 * (0.7F + 0.3F * f8) * f5;  //stock
float f9 = f2 + tOilOutMaxRPM * (1.0F - 0.15F * controlRadiator) * (0.65F + 0.45F / Atmosphere.density((float)reference.Loc.z)) * (1.0F + (float)reference.AS.astateOilStates[number] * 0.175F) * 1.2F * f7 * f7 * (0.7F + 0.3F * f8) * f5;  //to account for the new oil damage state
tOilOut += (f9 - tOilOut) * f * tChangeSpeed;
float f13 = tOilOut * 0.8F;
tOilIn += (f13 - tOilIn) * f * 0.5F;
if(type == 2)
f6 = 0.35F + 0.1F / Atmosphere.density((float)reference.Loc.z);
f13 = f2 + tWaterMaxRPM * (1.0F - 0.15F * controlRadiator) * (0.65F + f6) * (0.6F + 0.4F * f7) * (0.1F + 1.1F * f8) * f5 * (1.1F - 0.1F * controlMix);
tWaterOut += (f13 - tWaterOut) * f * tChangeSpeed;
} else
{
float f10 = f2;
tOilOut += (f10 - tOilOut) * f * tChangeSpeed * (0.2F + 0.2F * controlRadiator);
float f14 = tOilOut;
tOilIn += (f14 - tOilIn) * f * 0.5F;
f14 = f2;
tWaterOut += (f14 - tWaterOut) * f * tChangeSpeed * (0.2F + 0.2F * controlRadiator);
}


if (tOilIn < f2)
tOilIn = f2;
if (tOilOut < f2)
tOilOut = f2;
if (tWaterOut < f2)
tWaterOut = f2;
HUD.training("height = " + reference.Loc.z + "  airTemp= " + f2 + "  tOilIn= " + tOilIn + "  tOilOut= " + tOilOut);
System.out.println("height = " + reference.Loc.z + "  airTemp= " + f2 + "  tOilIn= " + tOilIn + "  tOilOut= " + tOilOut);
.
.
.
.
.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Whiskey_Sierra_972

  • Modder
  • member
  • Offline Offline
  • Posts: 6772
  • In memory of my beloved hero: Saburo SAKAI!
Re: Difference between map temperature and oil temperature at mission start
« Reply #8 on: October 16, 2024, 11:39:32 AM »

Thanks WxTech , your a very java skilled...if only could I at least understand it!

I hope this could be implemented in the future , maybe useful for realistic engine management....maybe a 'not lower than' funcion could be added to avoid under zero oil temperatures in winter maps...where aircrafts were heated before starting engine...maybe a freezing oil limit could be the also historically found....
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6181
Re: Difference between map temperature and oil temperature at mission start
« Reply #9 on: October 16, 2024, 01:37:05 PM »

Walter,
Oh, ye of misplaced faith!  ;)

When it comes to Java I am but a chimpanzee. Maybe I've begun to evolve to a Neanderthalic level. But skilled most assuredly I am not.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: [1]   Go Up
 

Page created in 0.044 seconds with 20 queries.