Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit de5ac95

Browse files
committed
v2.0.4.9
slipping clutch #104
1 parent a07cfb3 commit de5ac95

File tree

5 files changed

+63
-59
lines changed

5 files changed

+63
-59
lines changed

Documents/maxClutchTorque.xlsx

16.5 KB
Binary file not shown.

FS17_GearboxAddon.zip

49 Bytes
Binary file not shown.

FS17_GearboxAddon/gearboxMogli.lua

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ gearboxMogliGlobals.hudTitleSize = 0.03
121121
gearboxMogliGlobals.hudBorder = 0.005
122122
gearboxMogliGlobals.hudWidth = 0.15
123123
gearboxMogliGlobals.stallWarningTime = 250
124-
gearboxMogliGlobals.stallMotorOffTime = 3000
124+
gearboxMogliGlobals.stallMotorOffTime = 1250
125125
gearboxMogliGlobals.realFuelUsage = true
126126
gearboxMogliGlobals.idleFuelTorqueRatio = 0.2
127127
gearboxMogliGlobals.defaultLiterPerSqm = 1.2 -- 1.2 l/m² for wheat
@@ -133,10 +133,8 @@ gearboxMogliGlobals.dtDeltaTargetSlow = 0.0002 -- 5 seconds
133133
gearboxMogliGlobals.ddsDirectory = "dds/"
134134
gearboxMogliGlobals.initMotorOnLoad = true
135135
gearboxMogliGlobals.ptoSpeedLimit = true
136-
gearboxMogliGlobals.clutchFrom = 0.0
137-
gearboxMogliGlobals.clutchTo = 0.8
138-
gearboxMogliGlobals.clutchExp = 2.2
139-
gearboxMogliGlobals.clutchFactor = 2.4
136+
gearboxMogliGlobals.clutchExp = 2.0
137+
gearboxMogliGlobals.clutchFactor = 1.2
140138
gearboxMogliGlobals.grindingMinRpmDelta = 200
141139
gearboxMogliGlobals.grindingMaxRpmSound = 600
142140
gearboxMogliGlobals.grindingMaxRpmDelta = gearboxMogli.huge
@@ -5943,14 +5941,10 @@ function gearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc,
59435941

59445942

59455943
if ( self:mrGbMGetAutoHold() or ( self:mrGbMGetAutoClutch() and acceleration > 0.001 ) )
5946-
and ( ( self.movingDirection * currentSpeed > 5.5555555556e-4 and self.mrGbMS.ReverseActive )
5947-
or ( self.movingDirection * currentSpeed < -5.5555555556e-4 and not ( self.mrGbMS.ReverseActive ) ) ) then
5948-
-- wrong direction
5949-
--if g_currentMission.time >= self.mrGbML.DirectionChangeTime + 2000 then
5950-
brakePedal = 1
5951-
--else
5952-
-- brakePedal = math.max( g_currentMission.time - self.mrGbML.DirectionChangeTime ) * 0.0005
5953-
--end
5944+
and ( ( self.movingDirection * currentSpeed > 2.7777777778e-4 and self.mrGbMS.ReverseActive )
5945+
or ( self.movingDirection * currentSpeed < -2.7777777778e-4 and not ( self.mrGbMS.ReverseActive ) ) ) then
5946+
-- wrong direction
5947+
brakePedal = 1
59545948
brakeLights = true
59555949
end
59565950

@@ -5962,7 +5956,6 @@ function gearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc,
59625956
and acceleration < 0.1 then
59635957
-- auto hold
59645958
brakePedal = 1
5965-
--brakeLights = true
59665959
end
59675960

59685961
self.setBrakeLightsVisibility(self, brakeLights)
@@ -5987,11 +5980,16 @@ function gearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc,
59875980
local c = 0
59885981

59895982
brakePedal = math.max( brakePedal, brakeForce )
5990-
5983+
59915984
if self.motor.clutchPercent < gearboxMogli.minClutchPercent + gearboxMogli.minClutchPercent then
59925985
c = 0
59935986
else
5994-
c = gearboxMogli.huge
5987+
local cp = self.motor.clutchPercent
5988+
if self.mrGbMS.TorqueConverter then
5989+
cp = self.mrGbMS.ManualClutch
5990+
end
5991+
5992+
c = self.mrGbMG.clutchFactor * self.motor.maxMotorTorque * ( ( 0.5 * ( 1 - math.cos( math.pi * cp )) ) ^ self.mrGbMG.clutchExp )
59955993
end
59965994

59975995
setVehicleProps(self.motorizedNode, torque, maxRotSpeed, ratio, c, self.motor:getRotInertia(), self.motor:getDampingRate());
@@ -7169,8 +7167,8 @@ function gearboxMogliMotor:getTorque( acceleration, limitRpm )
71697167
self.ratioFactorR = 1 / ( self.ratioFactorG * self.hydrostaticFactor )
71707168
end
71717169

7172-
elseif self.clutchPercent < 1 and self.vehicle.mrGbMS.TorqueConverter then
7173-
local c = self.clutchRpm / self:getMotorRpm()
7170+
elseif self.autoClutchPercent < 1 and self.vehicle.mrGbMS.TorqueConverter then
7171+
local c = self.clutchRpm / self:getMotorRpm( self.autoClutchPercent )
71747172
if c * self.vehicle.mrGbMS.TorqueConverterFactor > 1 then
71757173
self.ratioFactorG = 1 / c
71767174
else
@@ -7741,12 +7739,12 @@ function gearboxMogliMotor:mrGbMUpdateGear( accelerationPedal )
77417739
and self.vehicle.mrGbMS.HydrostaticMin < gearboxMogli.eps
77427740
and accelerationPedal >= -0.001 then
77437741
brakeNeutral = false
7744-
elseif currentAbsSpeed < -1.8
7745-
and math.abs( self.vehicle.lastSpeedReal * 3600 ) > 1
7746-
and autoOpenClutch
7747-
and not self.vehicle.mrGbMS.TorqueConverterOrHydro then
7748-
brakeNeutral = true
7749-
self.noTorque = true
7742+
--elseif currentAbsSpeed < -1.8
7743+
-- and math.abs( self.vehicle.lastSpeedReal * 3600 ) > 1
7744+
-- and autoOpenClutch
7745+
-- and not self.vehicle.mrGbMS.TorqueConverterOrHydro then
7746+
-- brakeNeutral = true
7747+
-- self.noTorque = true
77507748
elseif self.vehicle.cruiseControl.state ~= 0
77517749
or not autoOpenClutch then
77527750
-- no automatic stop or cruise control is on
@@ -9245,11 +9243,15 @@ end
92459243
--**********************************************************************************************************
92469244
-- gearboxMogliMotor:getMotorRpm
92479245
--**********************************************************************************************************
9248-
function gearboxMogliMotor:getMotorRpm( )
9246+
function gearboxMogliMotor:getMotorRpm( cIn )
92499247
if self.noTransmission then
92509248
return self:getThrottleRpm()
92519249
end
9252-
return self.clutchPercent * self.clutchRpm + ( 1-self.clutchPercent ) * self:getThrottleRpm()
9250+
local c = self.clutchPercent
9251+
if type( cIn ) == "number" then
9252+
c = cIn
9253+
end
9254+
return c * self.clutchRpm + ( 1-c ) * self:getThrottleRpm()
92539255
end
92549256

92559257
--**********************************************************************************************************

FS17_GearboxAddon/modDesc.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
<modDesc descVersion="32">
33
<author>Mogli aka Biedens</author>
44
<iconFilename>dds/store.dds</iconFilename>
5-
<version>2.0.4.8</version>
5+
<version>2.0.4.9</version>
66
<multiplayer supported="true"/>
77

88
<l10n filenamePrefix="modDesc_l10n">
99
<text name="gearboxMogliVERSION">
10-
<de>Getriebe v2.0.4.8 von Mogli</de>
11-
<en>Gearbox v2.0.4.8 by mogli</en>
12-
<it>Cambio v2.0.4.8 by mogli</it>
13-
<fr>Transmission v2.0.4.8 by mogli</fr>
14-
<cz>Řazení v2.0.4.8 by mogli</cz>
15-
<pl>Skrzynia biegów v2.0.4.8 by mogli</pl>
10+
<de>Getriebe v2.0.4.9 von Mogli</de>
11+
<en>Gearbox v2.0.4.9 by mogli</en>
12+
<it>Cambio v2.0.4.9 by mogli</it>
13+
<fr>Transmission v2.0.4.9 by mogli</fr>
14+
<cz>Řazení v2.0.4.9 by mogli</cz>
15+
<pl>Skrzynia biegów v2.0.4.9 by mogli</pl>
1616
</text>
1717
</l10n>
1818

src/gearboxMogli.lua

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ gearboxMogliGlobals.hudTitleSize = 0.03
121121
gearboxMogliGlobals.hudBorder = 0.005
122122
gearboxMogliGlobals.hudWidth = 0.15
123123
gearboxMogliGlobals.stallWarningTime = 250
124-
gearboxMogliGlobals.stallMotorOffTime = 3000
124+
gearboxMogliGlobals.stallMotorOffTime = 1250
125125
gearboxMogliGlobals.realFuelUsage = true
126126
gearboxMogliGlobals.idleFuelTorqueRatio = 0.2
127127
gearboxMogliGlobals.defaultLiterPerSqm = 1.2 -- 1.2 l/m² for wheat
@@ -133,10 +133,8 @@ gearboxMogliGlobals.dtDeltaTargetSlow = 0.0002 -- 5 seconds
133133
gearboxMogliGlobals.ddsDirectory = "dds/"
134134
gearboxMogliGlobals.initMotorOnLoad = true
135135
gearboxMogliGlobals.ptoSpeedLimit = true
136-
gearboxMogliGlobals.clutchFrom = 0.0
137-
gearboxMogliGlobals.clutchTo = 0.8
138-
gearboxMogliGlobals.clutchExp = 2.2
139-
gearboxMogliGlobals.clutchFactor = 2.4
136+
gearboxMogliGlobals.clutchExp = 2.0
137+
gearboxMogliGlobals.clutchFactor = 1.2
140138
gearboxMogliGlobals.grindingMinRpmDelta = 200
141139
gearboxMogliGlobals.grindingMaxRpmSound = 600
142140
gearboxMogliGlobals.grindingMaxRpmDelta = gearboxMogli.huge
@@ -5943,14 +5941,10 @@ function gearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc,
59435941

59445942

59455943
if ( self:mrGbMGetAutoHold() or ( self:mrGbMGetAutoClutch() and acceleration > 0.001 ) )
5946-
and ( ( self.movingDirection * currentSpeed > 5.5555555556e-4 and self.mrGbMS.ReverseActive )
5947-
or ( self.movingDirection * currentSpeed < -5.5555555556e-4 and not ( self.mrGbMS.ReverseActive ) ) ) then
5948-
-- wrong direction
5949-
--if g_currentMission.time >= self.mrGbML.DirectionChangeTime + 2000 then
5950-
brakePedal = 1
5951-
--else
5952-
-- brakePedal = math.max( g_currentMission.time - self.mrGbML.DirectionChangeTime ) * 0.0005
5953-
--end
5944+
and ( ( self.movingDirection * currentSpeed > 2.7777777778e-4 and self.mrGbMS.ReverseActive )
5945+
or ( self.movingDirection * currentSpeed < -2.7777777778e-4 and not ( self.mrGbMS.ReverseActive ) ) ) then
5946+
-- wrong direction
5947+
brakePedal = 1
59545948
brakeLights = true
59555949
end
59565950

@@ -5962,7 +5956,6 @@ function gearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc,
59625956
and acceleration < 0.1 then
59635957
-- auto hold
59645958
brakePedal = 1
5965-
--brakeLights = true
59665959
end
59675960

59685961
self.setBrakeLightsVisibility(self, brakeLights)
@@ -5987,11 +5980,16 @@ function gearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc,
59875980
local c = 0
59885981

59895982
brakePedal = math.max( brakePedal, brakeForce )
5990-
5983+
59915984
if self.motor.clutchPercent < gearboxMogli.minClutchPercent + gearboxMogli.minClutchPercent then
59925985
c = 0
59935986
else
5994-
c = gearboxMogli.huge
5987+
local cp = self.motor.clutchPercent
5988+
if self.mrGbMS.TorqueConverter then
5989+
cp = self.mrGbMS.ManualClutch
5990+
end
5991+
5992+
c = self.mrGbMG.clutchFactor * self.motor.maxMotorTorque * ( ( 0.5 * ( 1 - math.cos( math.pi * cp )) ) ^ self.mrGbMG.clutchExp )
59955993
end
59965994

59975995
setVehicleProps(self.motorizedNode, torque, maxRotSpeed, ratio, c, self.motor:getRotInertia(), self.motor:getDampingRate());
@@ -7169,8 +7167,8 @@ function gearboxMogliMotor:getTorque( acceleration, limitRpm )
71697167
self.ratioFactorR = 1 / ( self.ratioFactorG * self.hydrostaticFactor )
71707168
end
71717169

7172-
elseif self.clutchPercent < 1 and self.vehicle.mrGbMS.TorqueConverter then
7173-
local c = self.clutchRpm / self:getMotorRpm()
7170+
elseif self.autoClutchPercent < 1 and self.vehicle.mrGbMS.TorqueConverter then
7171+
local c = self.clutchRpm / self:getMotorRpm( self.autoClutchPercent )
71747172
if c * self.vehicle.mrGbMS.TorqueConverterFactor > 1 then
71757173
self.ratioFactorG = 1 / c
71767174
else
@@ -7741,12 +7739,12 @@ function gearboxMogliMotor:mrGbMUpdateGear( accelerationPedal )
77417739
and self.vehicle.mrGbMS.HydrostaticMin < gearboxMogli.eps
77427740
and accelerationPedal >= -0.001 then
77437741
brakeNeutral = false
7744-
elseif currentAbsSpeed < -1.8
7745-
and math.abs( self.vehicle.lastSpeedReal * 3600 ) > 1
7746-
and autoOpenClutch
7747-
and not self.vehicle.mrGbMS.TorqueConverterOrHydro then
7748-
brakeNeutral = true
7749-
self.noTorque = true
7742+
--elseif currentAbsSpeed < -1.8
7743+
-- and math.abs( self.vehicle.lastSpeedReal * 3600 ) > 1
7744+
-- and autoOpenClutch
7745+
-- and not self.vehicle.mrGbMS.TorqueConverterOrHydro then
7746+
-- brakeNeutral = true
7747+
-- self.noTorque = true
77507748
elseif self.vehicle.cruiseControl.state ~= 0
77517749
or not autoOpenClutch then
77527750
-- no automatic stop or cruise control is on
@@ -9245,11 +9243,15 @@ end
92459243
--**********************************************************************************************************
92469244
-- gearboxMogliMotor:getMotorRpm
92479245
--**********************************************************************************************************
9248-
function gearboxMogliMotor:getMotorRpm( )
9246+
function gearboxMogliMotor:getMotorRpm( cIn )
92499247
if self.noTransmission then
92509248
return self:getThrottleRpm()
92519249
end
9252-
return self.clutchPercent * self.clutchRpm + ( 1-self.clutchPercent ) * self:getThrottleRpm()
9250+
local c = self.clutchPercent
9251+
if type( cIn ) == "number" then
9252+
c = cIn
9253+
end
9254+
return c * self.clutchRpm + ( 1-c ) * self:getThrottleRpm()
92539255
end
92549256

92559257
--**********************************************************************************************************

0 commit comments

Comments
 (0)