Finished stuff with manual gearbox
This commit is contained in:
@@ -15,31 +15,42 @@ function Clutch:initialize(config)
|
||||
self.targetTorque = 0
|
||||
self.torque = 0
|
||||
|
||||
self._engine = nil
|
||||
self._gearbox = nil
|
||||
self.engine = nil
|
||||
self.gearbox = nil
|
||||
end
|
||||
|
||||
function Clutch:linkEngine(eng)
|
||||
self._engine = eng
|
||||
self.engine = eng
|
||||
end
|
||||
|
||||
function Clutch:linkGearbox(gbox)
|
||||
self._gearbox = gbox
|
||||
self.gearbox = gbox
|
||||
end
|
||||
|
||||
function Clutch:getInputs()
|
||||
return {}
|
||||
if self.gearbox ~= nil and self.gearbox.type == gearboxTypes.MANUAL then
|
||||
return {
|
||||
Clutch = 'number'
|
||||
}
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function Clutch:getOutputs()
|
||||
return {
|
||||
ClutchTorque = 'number',
|
||||
ClutchSlip = 'number'
|
||||
Clutch_Torque = 'number',
|
||||
Clutch_Slip = 'number'
|
||||
}
|
||||
end
|
||||
|
||||
function Clutch:updateOutputs()
|
||||
wire.ports.Clutch_Torque = self.torque
|
||||
wire.ports.Clutch_Slip = self.slip
|
||||
end
|
||||
|
||||
function Clutch:getPress()
|
||||
if self._gearbox ~= nil and self._gearbox.type == gearboxTypes.MANUAL then
|
||||
if self.gearbox ~= nil and self.gearbox.type == gearboxTypes.MANUAL then
|
||||
return wire.ports.Clutch
|
||||
else
|
||||
return self.press
|
||||
@@ -49,9 +60,9 @@ end
|
||||
function Clutch:update()
|
||||
local someConversionCoeff = 0.10472
|
||||
|
||||
local engRPM = self._engine and self._engine.rpm or 0
|
||||
local gboxRPM = self._gearbox and self._gearbox.rpm or 0
|
||||
local gboxRatio = self._gearbox and self._gearbox.ratio or 0
|
||||
local engRPM = self.engine and self.engine.rpm or 0
|
||||
local gboxRPM = self.gearbox and self.gearbox.rpm or 0
|
||||
local gboxRatio = self.gearbox and self.gearbox.ratio or 0
|
||||
local gboxRatioNotZero = gboxRatio ~= 0 and 1 or 0
|
||||
|
||||
self.slip = ((engRPM - gboxRPM) * someConversionCoeff) * gboxRatioNotZero / 2
|
||||
|
||||
Reference in New Issue
Block a user