Community Forum
ANVEL Licensing Options

Engine load

  • Is there a way to access instantaneous engine load, torque or power from inside a plugin?

  • A quick and dirty way get the instant torque and power via a plugin ,assuming you have a pointer to your vehicle and the name of the motor, you can get the ID and grab it's properties through the PropertyManager in your update loop.

     PropertyManager& propMgr = PropertyManager::GetSingleton();
     Anvel::ObjectPropertySet motor_prop = propMgr.GetProperties(pVehicle->GetMotorByName("Motor")->GetID());
     LogMessage("EngineTorque: " +[27].ToString());
     LogMessage("EngineHorsepower: " +[28].ToString());

    In this case the Generic 4x4's motor is named "Motor".


  • @chudson Awesome, thank you! I was looking for this property, but now I see it. One thing though - for the default 4x4 model, engine torque bottoms out at 166Nm, even when sitting still. And engine horsepower is at -1.75hp. I'd expect both of these to be close to 0 at rest. Bug?

  • @rr No problem. It might be a bug, not sure. I never had a reason to look directly at hp and engine torque, I just saw your post and just knew how to get the data. Any thoughts @ANVEL-Team ?

  • @chudson thank you for responding so quickly to @rr!

    So for engine properties, the values are being displayed as intended. The Engine Horsepower property is the maximum possible torque at that given Motor Speed RPM (the property at the top of the motor properties menu in your picture).
    Engine torque is not near 0 during engine idle because of the torque curve definition in the Generic 4x4 vehicle definition.

    If you refer to the torque curve you will see that this is the intended value at idle:

    <motor idleRPM="750" name="Motor" redlineRPM="6200.0" shiftTime="0.25">
    		<!-- Engine torque curve defined as a lookup table -->
    		<torquecurve rpm="0" value="0"/>
    		<torquecurve rpm="400" value="0"/>
    		<torquecurve rpm="517" value="105"/>
    		<torquecurve rpm="630" value="150"/>
    		<torquecurve rpm="750" value="166.75"/>

    And the small negative horsepower value is caused from the manifold vacuum.

  • Hmm, if I understand you correctly then these numbers are not what I am looking for. You are saying that these properties expose the MAX hp and torque values, i.e. essentially the same info contained in the power and torque curves. I am looking for instantaneous power and torque output of the motor, which depends on throttle position. Is there a property that gives me that?

  • Guys, could really use this information - it can't be that hard to get, is it?

  • Upon further investigation, our previous response was partially incorrect. Currently, the values of the Motor Speed RPM and EngineHorsepower properties are instantaneous values, as intended. However, the EngineTorque property being displayed is currently showing the MAX possible value (based on the torque curve shown in my previous response) irrespective of throttle input. This is not intended, and will be fixed in our next release.

    To work around the issue in the meantime, you can calculate the instantaneous torque that you need by querying the Motor Speed RPM, EngineHorsepower, and Power(this is throttle input) properties in the Motor.

  • Got it. I kinda arrived at the same conclusion after doing a few experiments - good to confirm. For now, I am just scaling max torque @rpm by throttle position to get instantaneous torque (even though that's not very accurate). I tried using EngineHorsepower, but it's very erratic and jumps into the 10s of thousands sometimes. Have seen this as well?