Skip to content

Commit

Permalink
fixed bug with NEAR if the vessel has wings
Browse files Browse the repository at this point in the history
  • Loading branch information
neuoy committed Sep 24, 2014
1 parent 40cfb94 commit 6534dbf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Plugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyVersion("0.2.3.0")]
[assembly: AssemblyFileVersion("0.2.3.0")]
42 changes: 28 additions & 14 deletions Plugin/VesselAerodynamicModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,28 +280,39 @@ public Vector3d computeForces_FAR(double rho, double machNumber, Vector3d airVel
{
if (FARBasicDragModelType.IsInstanceOfType(module))
{
// make sure we don't trigger aerodynamic failures during prediction
double YmaxForce = (double)FARBasicDragModel_YmaxForce.GetValue(module);
double XZmaxForce = (double)FARBasicDragModel_XZmaxForce.GetValue(module);
FARBasicDragModel_YmaxForce.SetValue(module, Double.MaxValue);
FARBasicDragModel_XZmaxForce.SetValue(module, Double.MaxValue);
double YmaxForce = 0, XZmaxForce = 0;
if (!useNEAR)
{
// make sure we don't trigger aerodynamic failures during prediction
YmaxForce = (double)FARBasicDragModel_YmaxForce.GetValue(module);
XZmaxForce = (double)FARBasicDragModel_XZmaxForce.GetValue(module);
FARBasicDragModel_YmaxForce.SetValue(module, Double.MaxValue);
FARBasicDragModel_XZmaxForce.SetValue(module, Double.MaxValue);
}

if(useNEAR)
totalForce += (Vector3d)FARBasicDragModel_RunDragCalculation.Invoke(module, new object[] { airVelocityForFixedAoA, rho });
else
totalForce += (Vector3d)FARBasicDragModel_RunDragCalculation.Invoke(module, new object[] { airVelocityForFixedAoA, machNumber, rho });

FARBasicDragModel_YmaxForce.SetValue(module, YmaxForce);
FARBasicDragModel_XZmaxForce.SetValue(module, XZmaxForce);
if (!useNEAR)
{
FARBasicDragModel_YmaxForce.SetValue(module, YmaxForce);
FARBasicDragModel_XZmaxForce.SetValue(module, XZmaxForce);
}
}

if (FARWingAerodynamicModelType.IsInstanceOfType(module))
{
// make sure we don't trigger aerodynamic failures during prediction
double YmaxForce = (double)FARWingAerodynamicModel_YmaxForce.GetValue(module);
double XZmaxForce = (double)FARWingAerodynamicModel_XZmaxForce.GetValue(module);
FARWingAerodynamicModel_YmaxForce.SetValue(module, Double.MaxValue);
FARWingAerodynamicModel_XZmaxForce.SetValue(module, Double.MaxValue);
double YmaxForce = 0, XZmaxForce = 0;
if (!useNEAR)
{
// make sure we don't trigger aerodynamic failures during prediction
YmaxForce = (double)FARWingAerodynamicModel_YmaxForce.GetValue(module);
XZmaxForce = (double)FARWingAerodynamicModel_XZmaxForce.GetValue(module);
FARWingAerodynamicModel_YmaxForce.SetValue(module, Double.MaxValue);
FARWingAerodynamicModel_XZmaxForce.SetValue(module, Double.MaxValue);
}

double rhoBackup = (double)FARWingAerodynamicModel_rho.GetValue(module);
FARWingAerodynamicModel_rho.SetValue(module, rho);
Expand All @@ -322,8 +333,11 @@ public Vector3d computeForces_FAR(double rho, double machNumber, Vector3d airVel
FARWingAerodynamicModel_rho.SetValue(module, rhoBackup);
FARWingAerodynamicModel_stall.SetValue(module, stallBackup);

FARWingAerodynamicModel_YmaxForce.SetValue(module, YmaxForce);
FARWingAerodynamicModel_XZmaxForce.SetValue(module, XZmaxForce);
if (!useNEAR)
{
FARWingAerodynamicModel_YmaxForce.SetValue(module, YmaxForce);
FARWingAerodynamicModel_XZmaxForce.SetValue(module, XZmaxForce);
}
}
}
}
Expand Down

0 comments on commit 6534dbf

Please sign in to comment.