About the gearbox diesel locomotives
#11
Posted 31 August 2015 - 01:06 PM
Yeah i've saw that single ReadInt, and changing it to ReadIntBlock fixed that problem.
With initLevel the problem is it's used to check which tables should be filled with default value is not set in .eng (dieselpowertab, dieseltorquetab, etc).
After some testing, i've realized, that even if that IsInitialized method never returns as true, and also creates a warning that says "Diesel engine model has some errors - loading MSTS format", still the advanced parameters are used, and does not fall back to MSTS format, so it seems there are more errors there.
Edit: i think i've found the problem, one flag SettingsFlags.ExhaustColor is added to the initLevel, but the check for it was missing from IsInitialized, that's why the two numbers never could be equal.
So all problems are fixed now, however that parameter checking code requires ALL possible advanced diesel parameters to be present(some are not stated in OR manual), not just the mandatory ones.
But i don't think this will solve the crash with the gearboxed locomotives, that seems to be another problem.
With initLevel the problem is it's used to check which tables should be filled with default value is not set in .eng (dieselpowertab, dieseltorquetab, etc).
After some testing, i've realized, that even if that IsInitialized method never returns as true, and also creates a warning that says "Diesel engine model has some errors - loading MSTS format", still the advanced parameters are used, and does not fall back to MSTS format, so it seems there are more errors there.
Edit: i think i've found the problem, one flag SettingsFlags.ExhaustColor is added to the initLevel, but the check for it was missing from IsInitialized, that's why the two numbers never could be equal.
So all problems are fixed now, however that parameter checking code requires ALL possible advanced diesel parameters to be present(some are not stated in OR manual), not just the mandatory ones.
But i don't think this will solve the crash with the gearboxed locomotives, that seems to be another problem.
#12
Posted 01 September 2015 - 12:21 AM
Hi disc,
can you post here a .patch file of the changes you made, so that I can check it and if OK I can commit it?
can you post here a .patch file of the changes you made, so that I can check it and if OK I can commit it?
#13
Posted 01 September 2015 - 02:03 AM
Here
DieselEngine.cs.zip (923bytes)
Number of downloads: 243
However later it needs some changes, to require less paramters.
Now all of these parameters are needed, which are in example (of course the values should be changed to match the locomotive):
KIHA 31 modification:
If everything is correct, then the locomotive should start with engine STOPPED, and can be started manually. Else, it will be running from start.
Number of downloads: 243
However later it needs some changes, to require less paramters.
Now all of these parameters are needed, which are in example (of course the values should be changed to match the locomotive):
KIHA 31 modification:
SIMISA@@@@@@@@@@JINX0D0t______ include ( ../kiha31.eng ) Engine ( ORTSDieselEngines ( 1 Diesel ( IdleRPM ( 150 ) MaxRPM ( 800 ) StartingRPM ( 50 ) StartingConfirmRPM ( 200 ) ChangeUpRPMpS ( 150 ) ChangeDownRPMpS ( 200 ) RateOfChangeUpRPMpSS ( 10 ) RateOfChangeDownRPMpSS ( 20 ) MaximalPower ( 140kW ) IdleExhaust ( 5 ) MaxExhaust ( 20 ) ExhaustDynamics ( 10 ) ExhaustColor ( 00 fe ) ExhaustTransientColor ( 00 00 00 00 ) DieselPowerTab ( 0 0 150 20000 800 140000 ) DieselConsumptionTab ( 0 0 150 10 800 120 ) ThrottleRPMTab ( 0 150 10 150 100 800 ) DieselTorqueTab ( 0 0 150 10000 800 40000 ) MinOilPressure ( 40 ) MaxOilPressure ( 90 ) MaxTemperature ( 120 ) Cooling ( 3 ) TempTimeConstant ( 720 ) OptTemperature ( 70 ) IdleTemperature ( 60 ) ) ) )
- Pressures are in PSI
- Temperatures are in Celsius
- The cooling numbers are NoCooling = 0, Mechanical = 1, Hysteresis = 2, Proportional(default) = 3
- TemptimeConstant is probably a number that controls how fast the oil temperature is changing.
- Power is in Watts in table
- Torque is in Newtons in table
If everything is correct, then the locomotive should start with engine STOPPED, and can be started manually. Else, it will be running from start.
#14
Posted 01 September 2015 - 08:21 AM
OK, the patch seems reasonable. I have uploaded it in x.3231. disc, thank you.
Referring to the fact that anyhow it is yet required that all custom parameters are present, it's in fact a questionable thing, but as I am not in the head of the original developer, I will leave as it is for the moment, if no specific comments come out from train physics specialists.
Referring to the fact that anyhow it is yet required that all custom parameters are present, it's in fact a questionable thing, but as I am not in the head of the original developer, I will leave as it is for the moment, if no specific comments come out from train physics specialists.
#15
Posted 01 September 2015 - 11:13 AM
Csantucci, on 01 September 2015 - 08:21 AM, said:
OK, the patch seems reasonable. I have uploaded it in x.3231. disc, thank you.
Referring to the fact that anyhow it is yet required that all custom parameters are present, it's in fact a questionable thing, but as I am not in the head of the original developer, I will leave as it is for the moment, if no specific comments come out from train physics specialists.
Referring to the fact that anyhow it is yet required that all custom parameters are present, it's in fact a questionable thing, but as I am not in the head of the original developer, I will leave as it is for the moment, if no specific comments come out from train physics specialists.
I'd like to remove these requirements, as the first 6 params are enough, but this initLevel flagging thing does not seem to be flexible. Either all of the parameters checked, or none of them.
#16
Posted 01 September 2015 - 03:25 PM
I've found another bug in GearBox.cs (which may also have caused those crashes with automatic gearboxes):
I've been using an include file to modify the .eng, and i saw that the Gearbox parameters which have multiple elements (for example: GearBoxMaxSpeedForGears( 9 25 40 70 ) ), are read wrongly to a List<float>. Once from the main .eng file, then from the include file. So if there are 2 elements in original eng, and there are 4 elements in include, then the list will contain 6 elements, which is wrong.
This isn't a problem with single variables, as these get overwritten by assigning new value. But for lists, Add() method is used. So the lists should be cleared before reading the parameters from the include file. I've fixed this already, by putting a GearBoxMaxSpeedForGearsMpS.Clear() just before the element reading loop. I think this problem should be noted, as there could be other parts in ORTS code, that have this "bug" with includes.
I've also found a conversion problem: as i know, GearBoxMaxSpeedForGears( 9 25 40 70 ) read as Mph unit in MSTS, but in Gearbox.cs it's read as Mps, then converted to Mps from Mph (while it's already Mph, just read as mps). That works, but if i use kph unit, then it's converted to mps, then that mps is converted again to mps, from mph :D
See here:
GearBoxMaxSpeedForGearsMpS.Add(stf.ReadFloat(STFReader.UNITS.Speed, 10.0f));
GearBoxMaxSpeedForGearsMpS[i] = MpS.FromMpH(GearBoxMaxSpeedForGearsMpS[i]);
I think stfreader UNITS.Speed should set to UNITS.SpeedDefaultMPH(all other MSTS speed params are set to this), and the MpS.FromMpH conversion should be removed.
Here is the patch: GearBox.cs.zip (474bytes)
Number of downloads: 234
I've been using an include file to modify the .eng, and i saw that the Gearbox parameters which have multiple elements (for example: GearBoxMaxSpeedForGears( 9 25 40 70 ) ), are read wrongly to a List<float>. Once from the main .eng file, then from the include file. So if there are 2 elements in original eng, and there are 4 elements in include, then the list will contain 6 elements, which is wrong.
This isn't a problem with single variables, as these get overwritten by assigning new value. But for lists, Add() method is used. So the lists should be cleared before reading the parameters from the include file. I've fixed this already, by putting a GearBoxMaxSpeedForGearsMpS.Clear() just before the element reading loop. I think this problem should be noted, as there could be other parts in ORTS code, that have this "bug" with includes.
I've also found a conversion problem: as i know, GearBoxMaxSpeedForGears( 9 25 40 70 ) read as Mph unit in MSTS, but in Gearbox.cs it's read as Mps, then converted to Mps from Mph (while it's already Mph, just read as mps). That works, but if i use kph unit, then it's converted to mps, then that mps is converted again to mps, from mph :D
See here:
GearBoxMaxSpeedForGearsMpS.Add(stf.ReadFloat(STFReader.UNITS.Speed, 10.0f));
GearBoxMaxSpeedForGearsMpS[i] = MpS.FromMpH(GearBoxMaxSpeedForGearsMpS[i]);
I think stfreader UNITS.Speed should set to UNITS.SpeedDefaultMPH(all other MSTS speed params are set to this), and the MpS.FromMpH conversion should be removed.
Here is the patch: GearBox.cs.zip (474bytes)
Number of downloads: 234
#18
Posted 07 September 2015 - 03:40 AM
I've tried to reduce the required parameters, and the parameter checking worked well, but the simulation isn't. Perhaps the manual should be modified, as those things that are written there about ORTSDieselEngines, are never worked.
#19
Posted 07 September 2015 - 04:37 AM
You could prepare a revised version of the related pages of the manual, and then we can clean up the English and insert them in the nex release of the manual.
#20
Posted 07 September 2015 - 05:46 AM
The changes are in 8.2.1.4 ORTS Specific Diesel Engine Definition section.
I've attached a docx file with the changes, only the table, and the paragraph just above it has changed.
I've attached a docx file with the changes, only the table, and the paragraph just above it has changed.
Attached File(s)
-
changes.zip (6.02K)
Number of downloads: 289