Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
Use stock lift/mass equations
Browse files Browse the repository at this point in the history
  • Loading branch information
Crzyrndm committed Jun 8, 2015
1 parent b24a6ce commit dab7ab7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions B9 PWings Fork/WingProcedural.cs
Expand Up @@ -2017,30 +2017,27 @@ public void CalculateAerodynamicValues ()
DebugLogWithID ("CalculateAerodynamicValues", "Passed cost/force/torque");

// Stock-only values

if (!assemblyFARUsed || !assemblyFARMass)
{
if (WPDebug.logCAV)
DebugLogWithID ("CalculateAerodynamicValues", "FAR/NEAR is inactive or FAR mass is not enabled, calculating stock part mass");
part.mass = Mathf.Round ((float) aeroStatMass * 100f) / 100f;
}
if (!assemblyFARUsed)
{
float stockLiftCoefficient = (float)aeroStatSurfaceArea / 3.52f;
if (!isCtrlSrf && !isWingAsCtrlSrf)
{
if (WPDebug.logCAV)
DebugLogWithID ("CalculateAerodynamicValues", "FAR/NEAR is inactive, calculating values for winglet part type");
((ModuleLiftingSurface)this.part.Modules["ModuleLiftingSurface"]).deflectionLiftCoeff = (float)Math.Round(aeroStatCl, 2);
((ModuleLiftingSurface)this.part.Modules["ModuleLiftingSurface"]).deflectionLiftCoeff = (float)Math.Round(stockLiftCoefficient, 2);
part.mass = stockLiftCoefficient * 0.1f;
}
else
{
if (WPDebug.logCAV)
DebugLogWithID ("CalculateAerodynamicValues", "FAR/NEAR is inactive, calculating stock control surface module values");
ModuleControlSurface mCtrlSrf = part.Modules.OfType<ModuleControlSurface> ().FirstOrDefault ();
mCtrlSrf.deflectionLiftCoeff = (float)Math.Round(aeroStatCl, 2);
mCtrlSrf.deflectionLiftCoeff = (float)Math.Round(stockLiftCoefficient, 2);
mCtrlSrf.ctrlSurfaceArea = aeroConstControlSurfaceFraction;
part.mass = stockLiftCoefficient * (1 + mCtrlSrf.ctrlSurfaceArea) * 0.1f;
}
}

if (WPDebug.logCAV)
DebugLogWithID ("CalculateAerodynamicValues", "Passed stock drag/deflection/area");

Expand Down
Binary file modified GameData/B9_Aerospace/Plugins/B9_Aerospace_WingStuff.dll
Binary file not shown.

0 comments on commit dab7ab7

Please sign in to comment.