Skip to content
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

feature/ATC-53 #89

Merged
merged 41 commits into from
Nov 24, 2016
Merged

feature/ATC-53 #89

merged 41 commits into from
Nov 24, 2016

Conversation

n8rzz
Copy link
Owner

@n8rzz n8rzz commented Nov 14, 2016

I have questions for some of this stuff...

n8rzz added 20 commits October 31, 2016 07:21
* Updates refs for new getters
* Begins abstracting waypoint creation to individual methods
* Adds _get for setting properties from passed in object in Leg and Waypoint models
* Adds aircraftConstants to Leg
* Adds new method to get waypoint models for sid in AirportModel
StandardRouteCollections when dealing with sids and stars.
* Removes inline string transformation logic from Leg
…eModel within the AircraftInstanceModel

- Adds doc blocks to Leg
- Adds new methods to Leg to reset the current waypoint array and for adding a new Waypoint to the waypoint array.
* Removes fms.clearedAsFiled() method
* Consolidates runSID() and climbViaSid() logic
@n8rzz n8rzz added this to the v3.1.0 milestone Nov 14, 2016
Copy link
Owner Author

@n8rzz n8rzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikquinn a few questions for you on this feature

// set initial
this.fp.altitude = clamp(1000, options.model.ceiling, 60000);

if (options.aircraft.category === 'arrival') {
// TODO: why KDBG?
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just an arbitrary icao? or is there some meaning here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. back in the good old days, "KDBG", aka "Debug Airport" was the first airport in the game. When needing to fill the origin and destination airports in, "KDBG" was an arbitrary choice so it wasn't empty.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is confusing. Perhaps we could update this to be a little clearer like UNASSIGNED or something. I'll add an issue for future consideration #102.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's misleading. Something like that would be perfectly fine.

// arrival airport
r.push(this.legs[l].route.split('.')[2]);
flightPlanRoute.push(leg.route.exit);

break;
case FP_LEG_TYPE.IAP:
// no need to include these in flightplan (because wouldn't happen in real life)
break;
case FP_LEG_TYPE.AWY:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are airways in use in the app yet or is that a future enhancement?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no; they just have to be added to the airport files. They should work fine once airports have airways added in.

// add speeds to wp
wp[i].speed = spd;
waypoint.setAltitude(ctr_ceiling, cruise_alt);
waypoint.setSpeed(cruise_spd);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so now I have model methods doing this logic, but I feel they should be run when the waypoints are set not here after the fact.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not. Here's an example:
image

You can see there are altitude restrictions obviously, but aircraft not having been told to "descend via the KORRY3 arrival" would have last been told to "climb and maintain FL370" (or whatever their cruise altitude is. So they have to maintain that until being told to cvs or dvs.

So the setAltitude and setSpeed methods actually put the restrictions in the altitude property of the given waypoints, and this should not be done until they are are cleared to descend via STAR or climb via SID. Currently, the former is done automatically on spawn, but the actions of storing the restrictions and instructing to comply with the restrictions should remain separate.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you're saying makes sense.

I guess what I was getting at here is that once we know an aircraft is going to fly the sid/star, we should set the restrictions then when we create the Waypoints. The fms doesnt care about future restrictions, only the restrictions for the current Waypoint. Maybe that isn't practical in this case. ehh :-/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the restrictions are only ro be followed after they have been cleared to "descend via the GSLIN8 arrival" or "climb via SID".

If they aren't told to do this, they aren't allowed to do anything regarding those posted altitudes; they must just remain at the altitude last assigned.

So assigning the altitude waypoint based on the fixRestrictions should not be done until that cvs / dvs command is given.

Is that more clear hopefully? I don't think I made much sense in the last comment.

* Adds .getStarLegWaypoints()
* Removes dead code
} else if (firstRouteSegment === 'KDBG' && this.heading === null) {
// FIXME: radial is not defined or set anywhere in this class
// aim arrival @ middle of airspace
this.heading = this.radial + Math.PI;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is radial coming from? This is the only spot it exists within this class?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block seems to be for arrivals that somehow got messed up and have no waypoint to fly to or no assigned heading. this.radial is one of those old properties of the aircraft model that I had mentioned a while ago that should eventually be removed. Nonetheless, this.radial is the bearing (radians) from the airport to the aircraft. Thus, line 160 is just telling the aircraft to fly on a heading to the airport so they don't get stuck out in the abyss outside the airspace boundary.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except this.radial is never used in Waypoint. This is the only spot its mentioned, which leads me to believe that when the game is being played, this section never gets hit. This would fail if it did or at least cause some weirdness

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The truth is, this.radial predates the entire fms, and is no longer used for anything important. It is one of the many things I intend to clean out of the aircraft object at some point here.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any qualms with me removing it from this block entirely? I'd like to try and remove stale code whenever possible :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be some airports that use it. Maybe MSP off the top of my head? But I'd have to check. In general, I have no qualms though; I'd love to see it gone.

const minAlt = parseInt(altitudeRestriction.replace(ABOVE_SYMBOL, ''), DECIMAL_RADIX);
const minimumAltitudeWithoutSymbol = minAlt * FL_TO_THOUSANDS_MULTIPLIER;

this.altitude = Math.min(minimumAltitudeWithoutSymbol, cruiseAltitude);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikquinn is Math.min correct here? I would thin it should be cruiseAltitude unless minimumAltitudeWithoutSymbol is higher.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right; this should be max not min.

…ypoint

* Adds tests and supporting fixutes and mocks for Waypoint
…TC-53

Conflicts:
- src/assets/scripts/canvas/CanvasController.js
- test/airport/fix/FixCollection.spec.js
@n8rzz n8rzz changed the title [WIP] feature/ATC-53 feature/ATC-53 Nov 20, 2016
@n8rzz n8rzz removed the WIP label Nov 20, 2016
@erikquinn erikquinn modified the milestones: v3.2.0, v3.1.0 Nov 20, 2016

// TODO: simplify this
// FIXME: is this.legs an array?
for (const l in this.legs) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

const legs = [];
const curr = this.currentWaypoint(); // save the current waypoint
// const legs = this._generateLegsForFixOrStandardRoute(route);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment


if (Object.keys(window.airportController.airport_get().sids).indexOf(pieces[1]) > -1) {
if (typeof currentAirport.sidCollection.findRouteByIcao(routeModel.procedure) !== 'undefined') {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with _isNil()

@@ -975,7 +921,8 @@ export default class AircraftFlightManagementSystem {
return null;
}

return `${this.following.sid}.${this.currentLeg().route.split('.')[2]}`;
// TODO: use the `RouteModel` for this
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

* Refactors StandardRouteModel to use _entryCollection, _bodySegmentModel and _exitCollection for both SIDs and STARs
* Updates tests
* Adds istanbul-ignore to constructors inheriting one of the Base classes
@n8rzz
Copy link
Owner Author

n8rzz commented Nov 22, 2016

@erikquinn ready for you.

I had to modify how the StandardRouteModel was working a little. Its a good thing I have tests for those files, that made it much easier to do. Its also more generalized now. Take a peak, run it through its paces and let me know what you think!

this.legs = [];

this.current = [0, 0]; // [current_Leg, current_Waypoint_within_that_Leg]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the nerdery conventions on whitespacing between properties like this?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually, not cool. But there should be doc blocks for each property which is why, I think, I left the spacing here.

I'll add those now.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -180,15 +206,17 @@ export default class AircraftFlightManagementSystem {
* Insert a waypoint after the *current* waypoint
*/
appendWaypoint(data) {
this.currentLeg().waypoints.splice(this.current[WAYPOINT_WITHIN_LEG] + 1, 0, new Waypoint(data, this));
const airport = window.airportController.airport_get();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we might want to change airport_get() to a getter. Just a thought.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #150 for this

@n8rzz n8rzz merged commit 840e073 into develop Nov 24, 2016
@n8rzz n8rzz deleted the feature/ATC-53 branch November 24, 2016 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants