NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class EngineComponent.ForcedInduction

    Simulates forced induction systems (turbocharger or supercharger) that increase engine power output.

    Inheritance
    object
    EngineComponent.ForcedInduction
    Namespace: NWH.VehiclePhysics2.Powertrain
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    public class EngineComponent.ForcedInduction
    Remarks

    Behavioural model, not a thermodynamic one: air flow, intercooler efficiency, compressor maps and backpressure are all folded into the boost parameters. A turbocharger is exhaust driven and spools with lag; a supercharger tracks RPM instantly.

    Fields

    boost

    Current boost pressure as a normalized value in the range [0, 1], suitable for gauge display.

    Declaration
    [Range(0, 1)]
    [ShowInTelemetry(0, 1, "0.00", null, 1)]
    [Tooltip("Boost value as percentage in 0 to 1 range. Unitless.\r\nCan be used for boost gauges.")]
    public float boost
    Field Value
    Type Description
    float
    Remarks

    Turbocharger: builds over spoolUpTime, peaks at high RPM and full throttle, drops fast on lift. Supercharger: rises with RPM, gated by throttle, no lag. Power gain is interpolated between 1.0x here and powerGainMultiplier at boost = 1.

    forcedInductionType

    Forced induction type, which determines boost behavior.

    Declaration
    [Tooltip("Type of forced induction.")]
    public EngineComponent.ForcedInduction.ForcedInductionType forcedInductionType
    Field Value
    Type Description
    EngineComponent.ForcedInduction.ForcedInductionType

    hasWastegate

    Fires the blow-off event when the throttle closes at high boost on a turbocharger.

    Declaration
    [Tooltip("Imitates the blow-off valve in a turbo setup.\r\nDrives the flutter / blow-off event on lift. Boost follows throttle with or without it and the turbine keeps spinning either way.\r\nNot used with superchargers.")]
    [ShowInSettings("Has Wastegate")]
    public bool hasWastegate
    Field Value
    Type Description
    bool
    Remarks

    Vents manifold boost on lift and fires onWastegateRelease for the flutter sound. Boost is zeroed for that substep only and _turbineSpeed is untouched, so getting back on throttle restores boost without re-spooling. Throttle gates boost either way, so disabling this only stops the event. Superchargers ignore it.

    onWastegateRelease

    Event triggered when the wastegate opens and releases boost pressure.

    Declaration
    [Tooltip("Flag for sound effects.\r\nParameter is the boost value at the time of release.")]
    public UnityEvent<float> onWastegateRelease
    Field Value
    Type Description
    UnityEvent<float>
    Remarks

    Fires when throttle drops below 0.3 while boost is above 0.7 and hasWastegate is on. The parameter is the boost at the moment of release, for scaling flutter volume or pitch.

    powerGainMultiplier

    Maximum power multiplier applied at full boost, ranging from 1.0 (no boost) to 3.0 (3x power).

    Declaration
    [Range(1, 3)]
    [Tooltip("Additional power that will be added to the engine's power.\r\nThis is the maximum value possible and depends on spool percent.")]
    [ShowInSettings("Power Gain Mp.", 1, 2, 0.1)]
    public float powerGainMultiplier
    Field Value
    Type Description
    float
    Remarks

    Multiplies base engine power, so a 200 kW engine at 1.5 makes 300 kW at full boost. The live multiplier lerps from 1.0 at boost 0 to this value at boost 1. 1.2-1.3 daily driver, 1.3-1.5 performance car, 1.5-1.8 sports or race, 1.8-2.5 drag.

    spoolUpTime

    Time in seconds for a turbocharger to spool from zero to full boost under ideal conditions.

    Declaration
    [Range(0.1, 4)]
    [Tooltip("Shortest time possible needed for turbo to spool up to its maximum RPM.\r\nUse larger values for larger turbos and vice versa.\r\nForced to 0 for superchargers.")]
    [ShowInSettings("Spool Up Time", 0, 2, 0.05)]
    public float spoolUpTime
    Field Value
    Type Description
    float
    Remarks

    The floor, reached only at high RPM and full throttle; real spool time scales with RPM and throttle. Coast-down takes SpoolDownRatio times this. 0.2-0.4 s small turbo, 0.4-0.8 s medium, 0.8-1.5 s large, 1.5-3.0 s very large. Superchargers ignore it.

    useForcedInduction

    Enables or disables the forced induction system.

    Declaration
    [ShowInTelemetry(NaN, NaN, null, null, 1)]
    [ShowInSettings("Enabled")]
    [Tooltip("Should forced induction be used?")]
    public bool useForcedInduction
    Field Value
    Type Description
    bool
    Remarks

    False leaves the engine naturally aspirated on its base power curve, and Update clears boost and turbine state.

    Properties

    PowerGainMultiplier

    Gets the current power multiplier based on boost level, ranging from 1.0 to powerGainMultiplier.

    Declaration
    public float PowerGainMultiplier { get; }
    Property Value
    Type Description
    float
    Remarks

    Returns 1.0 flat when forced induction is off. Applied by the engine during torque calculation, so callers do not need to apply it themselves.

    Methods

    Update(EngineComponent, float)

    Updates the forced induction state and current boost level from engine RPM and throttle input each physics frame.

    Declaration
    public void Update(EngineComponent engine, float dt)
    Parameters
    Type Name Description
    EngineComponent engine

    The parent engine component providing RPM and throttle data.

    float dt

    Per-substep delta time in seconds. Used as the explicit SmoothDamp timestep so spool is independent of render framerate and substep count.

    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics