-
Notifications
You must be signed in to change notification settings - Fork 540
Add NEU (North East Up) properties for distance from IC start #1321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -83,6 +83,8 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex) | |||
| vAeroPQR.InitMatrix(); | ||||
| vMachUVW.InitMatrix(); | ||||
| vEulerRates.InitMatrix(); | ||||
| vNEUFromStart.InitMatrix(); | ||||
| NEUFromStartInitialized = false; | ||||
|
|
||||
| bind(); | ||||
|
|
||||
|
|
@@ -116,6 +118,8 @@ bool FGAuxiliary::InitModel(void) | |||
| vAeroPQR.InitMatrix(); | ||||
| vMachUVW.InitMatrix(); | ||||
| vEulerRates.InitMatrix(); | ||||
| vNEUFromStart.InitMatrix(); | ||||
| NEUFromStartInitialized = false; | ||||
|
|
||||
| return true; | ||||
| } | ||||
|
|
@@ -180,7 +184,15 @@ bool FGAuxiliary::Run(bool Holding) | |||
| vMachUVW(eV) = vAeroUVW(eV) / in.SoundSpeed; | ||||
| vMachUVW(eW) = vAeroUVW(eW) / in.SoundSpeed; | ||||
|
|
||||
| // Position | ||||
| // Position tracking in local frame with local frame origin at lat, lon of initial condition | ||||
| // and at 0 altitude relative to the reference ellipsoid. Position is NEU (North, East, UP) in feet. | ||||
| if (!NEUFromStartInitialized) { | ||||
| NEUStartLocation = FDMExec->GetIC()->GetPosition(); | ||||
| NEUStartLocation.SetPositionGeodetic(NEUStartLocation.GetLongitude(), NEUStartLocation.GetGeodLatitudeRad(), 0.0); | ||||
| NEUFromStartInitialized = true; | ||||
| } | ||||
| vNEUFromStart = NEUStartLocation.LocationToLocal(in.vLocation); | ||||
| vNEUFromStart(3) *= -1.0; // Flip sign for Up, so + for altitude above reference ellipsoid | ||||
|
|
||||
| Vground = sqrt( in.vVel(eNorth)*in.vVel(eNorth) + in.vVel(eEast)*in.vVel(eEast) ); | ||||
|
|
||||
|
|
@@ -355,15 +367,15 @@ double FGAuxiliary::GetNlf(void) const | |||
| double FGAuxiliary::GetLongitudeRelativePosition(void) const | ||||
| { | ||||
| return in.vLocation.GetDistanceTo(FDMExec->GetIC()->GetLongitudeRadIC(), | ||||
| in.vLocation.GetGeodLatitudeRad())* fttom; | ||||
| in.vLocation.GetGeodLatitudeRad()); | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not clear why the unit conversion from feet to meters is removed ? This method is used to compute the property jsbsim/src/models/FGAuxiliary.cpp Line 446 in 83e3df2
|
||||
| } | ||||
|
|
||||
| //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||||
|
|
||||
| double FGAuxiliary::GetLatitudeRelativePosition(void) const | ||||
| { | ||||
| return in.vLocation.GetDistanceTo(in.vLocation.GetLongitude(), | ||||
| FDMExec->GetIC()->GetGeodLatitudeRadIC())* fttom; | ||||
| FDMExec->GetIC()->GetGeodLatitudeRadIC()); | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. This method is used to compute the property jsbsim/src/models/FGAuxiliary.cpp Line 447 in 83e3df2
|
||||
| } | ||||
|
|
||||
| //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||||
|
|
@@ -372,7 +384,7 @@ double FGAuxiliary::GetDistanceRelativePosition(void) const | |||
| { | ||||
| auto ic = FDMExec->GetIC(); | ||||
| return in.vLocation.GetDistanceTo(ic->GetLongitudeRadIC(), | ||||
| ic->GetGeodLatitudeRadIC())* fttom; | ||||
| ic->GetGeodLatitudeRadIC()); | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. This method is used to compute the property jsbsim/src/models/FGAuxiliary.cpp Line 448 in 83e3df2
|
||||
| } | ||||
|
|
||||
| //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||||
|
|
@@ -437,6 +449,10 @@ void FGAuxiliary::bind(void) | |||
| PropertyManager->Tie("position/vrp-gc-latitude_deg", &vLocationVRP, &FGLocation::GetLatitudeDeg); | ||||
| PropertyManager->Tie("position/vrp-longitude_deg", &vLocationVRP, &FGLocation::GetLongitudeDeg); | ||||
| PropertyManager->Tie("position/vrp-radius-ft", &vLocationVRP, &FGLocation::GetRadius); | ||||
|
|
||||
| PropertyManager->Tie("position/neu-n-ft", this, eX, &FGAuxiliary::GetNEUPositionFromStart); | ||||
| PropertyManager->Tie("position/neu-e-ft", this, eY, &FGAuxiliary::GetNEUPositionFromStart); | ||||
| PropertyManager->Tie("position/neu-u-ft", this, eZ, &FGAuxiliary::GetNEUPositionFromStart); | ||||
| } | ||||
|
|
||||
| //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather initialize
NEUStartLocationin a method that would be called byFGFDMExec::Initialize:jsbsim/src/FGFDMExec.cpp
Lines 676 to 681 in 83e3df2
Since
FGFDMExec::Initializeis called itself byFGFDMExec::RunICthat would ensure thatNEUStartLocationwould be initialized at the same time than the rest of the simulation. And that would save te usage of the flagNEUFromStartInitialized.