slomal bahui
This commit is contained in:
@@ -14,9 +14,9 @@ function Gearbox:initialize(vehicle, name, config)
|
||||
Downshift = 'number'
|
||||
}
|
||||
self.wireOutputs = {
|
||||
Gearbox_RPM = 'number',
|
||||
Gearbox_Torque = 'number',
|
||||
Gearbox_Ratio = 'number'
|
||||
[string.format('%s_RPM', self.name)] = 'number',
|
||||
[string.format('%s_Torque', self.name)] = 'number',
|
||||
[string.format('%s_Ratio', self.name)] = 'number'
|
||||
}
|
||||
|
||||
self.type = config.Type or 'MANUAL'
|
||||
@@ -28,9 +28,9 @@ end
|
||||
function Gearbox:updateWireOutputs()
|
||||
PowertrainComponent.updateWireOutputs(self)
|
||||
|
||||
wire.ports.Gearbox_RPM = self:getRPM()
|
||||
wire.ports.Gearbox_Torque = self.torque
|
||||
wire.ports.Gearbox_Ratio = self.ratio
|
||||
wire.ports[string.format('%s_RPM', self.name)] = self:getRPM()
|
||||
wire.ports[string.format('%s_Torque', self.name)] = self.torque
|
||||
wire.ports[string.format('%s_Ratio', self.name)] = self.ratio
|
||||
end
|
||||
|
||||
function Gearbox:queryInertia()
|
||||
@@ -52,18 +52,18 @@ function Gearbox:queryAngularVelocity(angularVelocity)
|
||||
end
|
||||
|
||||
function Gearbox:forwardStep(torque, inertia)
|
||||
self.torque = torque * self.ratio
|
||||
|
||||
if self.output == nil then
|
||||
return torque
|
||||
end
|
||||
|
||||
if self.ratio == 0 then
|
||||
self.output:forwardStep(0, self.inertia)
|
||||
self.output:forwardStep(0, self.inertia * 0.5)
|
||||
|
||||
return torque
|
||||
end
|
||||
|
||||
self.torque = torque * self.ratio
|
||||
|
||||
return self.output:forwardStep(self.torque, (inertia + self.inertia) * math.pow(self.ratio, 2)) / self.ratio
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user