News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Landing plane behaviour

Started by Spacethingy, December 26, 2015, 09:50:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spacethingy

I know that this is a bit of a recurring request from users, so I must start by apologising...  ;D

Currently in standard, when a plane is flying into an airport, it doggedly routes to the runway closest to its destination ramp/apron/stop. This is actually fairly realistic behaviour - pilots in real life plan to a particular runway before departing, as airport landing/take-off patterns are fairly predictable. Obviously you want to be moving with your engines drinking expensive fuel for as short as time as possible.

However, pilots don't always get what they want - if there's too much traffic, an ATC may redirect them to a different runway to alleviate congestion.

In Simutrans, could this be simulated? For instance, if a plane arrives at its descent point for its intended runway, but the runway is already reserved, could it then attempt to route to its destination using a different runway, then if that fails (or if there isn't another routable runway), continue to circle and wait for the first runway to clear? Only problem here I suppose, is that a queue/stack might develop for the second runway while the plane makes its way over to it - i.e. there might be a rather unrealistic tennis-match of planes shuffling between the two runways. Perhaps this could be avoided by allowing a plane only one change of runway per journey?

(I'm not sure if this kind of logic would extend to take-off runways - probably just the current logic of picking the runway closest to you is enough.)

This would mean that multiple runways could used efficiently without having to use separate schedules or waypoints.

Just a thought!  :::)
Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.

Ters

I've been told that Simutrans builds on a principle of predictability. Vehicles don't go doing things on their own, which could interfere with other things (maybe the airport has been set up with a high-priority and a low-priority runway, where you don't want planes diverting from the latter to the former) or cause stupid, money-wasting behaviour (like the runway ping-pong you describe, although perhaps more problematic in a more general sense than with this thing in particular).

Leartin

How about implementing an auto-choose-signal at every airport (since I wouldn't know where to place them if they were actual signals)
Every plane approaching the Airport will, at a certain point, start to check for an empty runway and reserve it, then fly over there and land.
If no free runway is found, the plane could just do one full circle around the airport and try again when it's back in the original spot.

As for the problem of high-priority runways, you'd add an 'end_of_choose' like signal to exclude them, so only planes scheduled for that runway might actually take it (but still take others in an 'emergency')

There still is some unpredictability, but the player would at least have the tools to eradicat it completely (setting an end_of_choose equivalent on every runway) it is somewhat expected due to how other vehicles work (they stop and wait... planes obviously can't do that) and there can't be any runway-pingpong since the moment it's chosen it's reserved and will be taken.

Ters

Quote from: Leartin on December 27, 2015, 10:36:21 AM
How about implementing an auto-choose-signal at every airport

There is one. But choose signals select a gate, not the path to get there. It might be that this "choose signal" is on the runway, which is too late for this.

Quote from: Leartin on December 27, 2015, 10:36:21 AM
There still is some unpredictability, but the player would at least have the tools to eradicat it completely

I think this is backwards with regards to the existing philosophy. It should be predictable by default, with unpredictability something you opt in to. (Not that that will keep players from shooting themselves in the leg.)

Not that I'm happy with how airports work. I hardly use them, in part because of chaotic landing patterns (I don't think planes are first-come first-serve), but also because I like trains and planes look silly flying so low (and planes are very speed bonus sensitive in pak64).

isidoro

Another possibility is give use to controlling towers.  If you build one in an airport, then a free runway is chosen.  If not, normal behavior.

Other, in combination with the previous one: controlling towers can be chosen as way-points.  If done by a plane, at that point, it chooses a free runway.  It can be seen as the plane contacting with air controllers at that point and they give it a free runway in the airport...

jamespetts

In Experimental, control towers are compulsory. A better interface might be to be able to specify in an aircraft's schedule whether any given stop is one at which it ought to choose a free runway or land only on the default runway.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

HarrierST

Quote from: Spacethingy on December 26, 2015, 09:50:44 PM
I know that this is a bit of a recurring request from users, so I must start by apologising...  ;D

Currently in standard, when a plane is flying into an airport, it doggedly routes to the runway closest to its destination ramp/apron/stop. This is actually fairly realistic behaviour - pilots in real life plan to a particular runway before departing, as airport landing/take-off patterns are fairly predictable. Obviously you want to be moving with your engines drinking expensive fuel for as short as time as possible.

However, pilots don't always get what they want - if there's too much traffic, an ATC may redirect them to a different runway to alleviate congestion.

In Simutrans, could this be simulated? For instance, if a plane arrives at its descent point for its intended runway, but the runway is already reserved, could it then attempt to route to its destination using a different runway, then if that fails (or if there isn't another routable runway), continue to circle and wait for the first runway to clear?Just a thought!  :::)

Many many years ago - I can remember being in a stack over Heathrow - London for about an hour or so. Very impressive seeing the city below and about  20 or more planes at different heights circling around.

Can not remember the reason for the delay.  But it happens.

DrSuperGood

You should be able to select specific runways using a waypoint. I recall this feature being added earlier this year (and producing a number of bugs which had to be fixed subsequently).

For runway auto select the problem is specifying when you want the feature to be used or not. It is stupid having the plane comedown on a runway intended for another purpose across the airport and spending ages taxying to its stop.

Maybe a special tile improvement for the runways? This signifies that it can be used to land when free if the natural runway is in use as long as the plane is still able to reach its target bay (it only looks for another bay once landed).

prissi

The simple problem is that choosing can be only done in a step, which only occurs every 4-5 "sync_steps" (which moves things around). Since aicrafts are quite fast they would be frozen in mid-air for a second when searching a runway. When circling the aircraft just looks of the runway is free. Only on end of the runway the coosing starts.

You can force another runway using waypoints, but this is a tricky buisness.

Leartin

Can vehicles choose while moving?

Say the choosing can only be done every second. If the plane starts choosing while it is more then a second away from it's destination, it can continue to fly while waiting for the choosing step to happen which might adjust the destination, and if so the plane would then simply turn and fly there.

Similarly, a circling plane could be considered waiting, so it checks during circling. Quite often. Checking for an empty runway should be simple in comparison to a route, right?


I don't think an airport currently is aware of what it is, probably each vehicle has to check on it's own if a route from runway to gate is available.
Maybe a control tower could turn this around, making the airport aware which runway is empty and connected to which gate. It could also save a list of all airplanes trying to land at the airport. Therefore, instead of the vehicle checking for a route, the tower would check whether the target gate is available (or any other if there is a choose signal), then would check if the 'target' (waypoint) runway is available and connected, if not if any other connected runway without "end_of_choose"-signal is available. If not, keep circling.
If the list of planes is not empty, at any "choose"-step the tower would check whether a runway or gate changed to "available", and if so, go through the list if any plane can now land.
Seems to be more efficient than having every vehicle act on it's own, and would simulate pretty much exactly what a tower does. It would also be predictable, since no vehicle acts on it's own but behaves within a group, as a player might expect.
Drawback (beside the obvious "someone has to program it") is that if no runway is available, planes would move towards the tower. This is fine, it would move anyway until it can land. However, with a giant airport it might take quite a while to travel back. Allowing for more then one tower per airport might answer that.

Ters

Quote from: Leartin on December 30, 2015, 07:53:15 AM
Can vehicles choose while moving?

No, because that changes the premises. Choosing involves calculating a route. By the time it is done the airplane is no longer at the position the calculated route starts at. The plane would either have to warp back to the start of the route, which looks just as silly as just standing still, or start calculating a new route, which leads to infinite recursion.

Quote from: Leartin on December 30, 2015, 07:53:15 AM
I don't think an airport currently is aware of what it is, probably each vehicle has to check on it's own if a route from runway to gate is available.

This is true for all vehicles in Simutrans. They are all autonomous, with no central authority (apart from the player). It is actually the trains that control the signals. Changing this is a major redesign.

Leartin

Quote from: Ters on December 30, 2015, 10:17:21 AM
Can vehicles choose while moving?
No, because that changes the premises. Choosing involves calculating a route. By the time it is done the airplane is no longer at the position the calculated route starts at. The plane would either have to warp back to the start of the route, which looks just as silly as just standing still, or start calculating a new route, which leads to infinite recursion.
Perhaps I asked the wrong question.
Prissi made it sound as if choosing is not something any vehicle can do at any point in time, instead every few "sync_steps" there is a "choosing step" for which vehicles have to wait. My question was if a vehicle can be told to choose, then move on until this "choosing step" and only change route after that. In hindsight, this was a rather dumb question, since I don't usually see trains stopping at a choose signal which, if a vehicle had to stand still for choosing, would happen even if nothing was blocking the way.

As for your explanation, I am sure there is a third solution: Don't route from where you are, but from where you are going to be. Pick a point on your route you will pass eventually, create a new route from there, then go on the new route as soon as you reached that point. I assume that's about what trains do, where the "point in the future" is probably the choose signals location.
For planes, perhaps one or two tiles in front would be enough, if you calculate in the right order. With planes, the only pathfinding takes place between runway and gate. You can calculate the route there no matter how long it takes, since the planes position is not yet involved. Once you know where the plane has to land, you only have to add the short distance between plane and runway, which is always a straight line since there are never any obstacle. This is so trivial you should get the result practically instantanious, and if not you can always additionally check which tiles are the next the plane will travel to.
You could also add a few "basic turns" which tell the plane the next few steps before the route is actually calculated. Basically, you'd choose which of 8 directions would be best to go next based on the current position vs. landing postition, and use an appropriate turning manouver. Eg. if you are going exactly the wrong direction, you'd tell the plane to move around in steps of 45° rather than just turning 180° mid-air. As soon as that manouver starts, you know where it will end, so route from there.

Just to stress again, this is what I think should in theory work. When denying it, please state if I am simply wrong or if it is just too much work to implement for too little gain.

Quote from: Ters on December 30, 2015, 10:17:21 AM
This is true for all vehicles in Simutrans. They are all autonomous, with no central authority (apart from the player). It is actually the trains that control the signals. Changing this is a major redesign.

I wouldn't call it redesign if it is an additional possibility. Every vehicle would keep it's own autonomity, however they get additional information from another entity.
What I am thinking of here are traffic lights, which don't get controlled by cars but by a timer. The interaction works as it does with most signals, the vehicle moves based on the information it gets from the signal.
If traffic lights can be controlled by a timer, why not by something else? For example, it could calculate the amount of cars driving through from each direction and adjust the length of red and green periods. Wouldn't that already be a kind of very simple KI?
The Tower would be more complex, but do essentially the same thing, it would give planes information they can act on. Sometimes as a stop-signal, which would stop other vehicles - but planes circle around it instead, because stopping in mid-air is quite stupid. A choose-signal already tells vehicles to change their route, so having the tower as a signal that tells vehicles to change their route to a specific location does not seem far-fetched. Planes would still do their own pathfinding and move autonomous, just based on informations given by the signal. They would still complain about "no route" if they have to "stop" at the tower for too long.

Well, this is, if you meant redesign to be "change the current behaviour and game philosophy" rather than "it's a lot of work", because otherwise I totally agree. Still, talking about it does not hurt.

Vladki

Quote... I don't usually see trains stopping at a choose signal ...

They do. Just look carefully, with reservations showed. Only if the target platform is free, then the train travels without any stop. But if it has to choose another platform, there is small stop-and-go effect at the choose signal. And if there is no free platform, it just waits at the choose signal.

TurfIt

Quote from: Leartin on December 30, 2015, 03:50:56 PM
"choosing step" for which vehicles have to wait. My question was if a vehicle can be told to choose, then move on until this "choosing step" and only change route after that. In hindsight, this was a rather dumb question, since I don't usually see trains stopping at a choose signal which, if a vehicle had to stand still for choosing, would happen even if nothing was blocking the way.
Vehicles do stop when choosing if their scheduled platform is full. That's why they slow to 50km/h approaching the choose point as well. If another platform is empty, the stop will be only for ~200ms hence you normally won't really see it. Just a hiccup in motion. The vehicles restart with speed too, not from 0.

For planes, this stop would be very noticable. Older versions of Simutrans had planes stopping midair for waypoints, this was fixed so reintroducing it for choosing wouldn't be very good.

I did post a proof of concept patch to try as you suggest, and start the route search earlier to allow for non-stop choosing, but it needs work. And to apply it to planes is likely very difficult, but anyone if free to take it and try...


isidoro

A similar concept:

We have the problem with airplanes circling.  If we were able to detect that state, at the beginning of the loop, the plane can ask for a route.  The route is calculated while the airplane is circling.  Once it reaches the starting point again, it checks if the route is completed and viable and substitutes it if so.

If, while the calculation is done, the airplane finds the original route free, it lands and calculations are aborted.

DrSuperGood

QuoteThey do. Just look carefully, with reservations showed. Only if the target platform is free, then the train travels without any stop. But if it has to choose another platform, there is small stop-and-go effect at the choose signal. And if there is no free platform, it just waits at the choose signal.
Which really messes up high-throughput lines because ultimately the bottleneck is the choose signal. I would even go as far to say that having the train pause and then resume at full speed when passing these signals is worth the "looks bad" part.

The airplane problem could possibly be solved by moving landing from the convoy to the airport stop. When the plane approaches the destination airport the airport takes over and manages its actions. If it has a free runway that is suitable it then assigns the plane to land on it. If it does not then it orders the plane to orbit in a big circle around the airport (not some small one like currently) and adds them to the "stack". As a runway is made free it grabs the oldest from the stack and orders it to land on the now free runway. The airport maintains some kind of runway and bay mapping so that it can quickly tell which runways are suitable for landing a plane and when landed which bay is the most appropriate to use.

Isaac Eiland-Hall

You need a pre-choose signal so you can have multiple tracks in front of multiple choose signals. :D

Ters

Quote from: DrSuperGood on December 31, 2015, 04:09:18 AM
The airplane problem could possibly be solved by moving landing from the convoy to the airport stop.

There is no point in doing that. The plane has access to every single bit of information that the stop has. There is only the concept of OOP that makes it seem as if it's the plane that does the "thinking".

Quote from: DrSuperGood on December 31, 2015, 04:09:18 AM
The airport maintains some kind of runway and bay mapping

But naturally, the plane would need more information, like perhaps this. However, a stop is a stop. If a feature is added to airports, it is also added to train stations and bus stops. Runways are also not an identifiable thing, only a sequence of individual runway tiles next to each other that can change at any time. But the question still remains how the game is supposed to understand the player's intent. How does the player tell which runways are for use  (not not for use) for each plane or stop, so that planes don't start landing at the wrong runways when/if new behavior is introduced in the game?

Isaac Eiland-Hall

I have often wished I could group a number of tiles (part of a stop) and reserve them for one line's use. It's not optimal gameplay, but still doesn't mean I didn't wish I could do it. But I've not filed an extension request because the wish is small, the effort is probably high, and the support (i.e. others who want this) is probably also minimal.

But it sounds like the sort of idea that would actually help in some cases: Assign tiles in a stop to one of a number of groups; then, when creating a line or schedule, when adding a stop to the schedule, a new menu item would appear with a dropdown of stop-groups to choose from.

Yeah, I know. It's not practical. It's one possible way to accomplish the desire, but I don't think it's practical at all. (Main reason for posting is that maybe someone will be inspired and have a really good idea that might be practical)

DrSuperGood

Quote
There is no point in doing that. The plane has access to every single bit of information that the stop has. There is only the concept of OOP that makes it seem as if it's the plane that does the "thinking".
Currently each plan is pretty much working in a free for all to land. If a runway is full it does a loop around and then checks again if it is full. If during that loop another plane arrives and that runway has been made empty then that plane gets to land and the plane that was looping will need to loop around again. If that looping plane is unlucky it could be stuck looping for a very long time before landing, after which it will probably be running majorly in the red due to wasting fuel.

If the runway logic was extended to contain a queue of "trying to land" aircraft then you can order the landings. The aircraft looping the longest could get to land first. It also opens up other potential improvements such as spacing out the aircraft in a loop or ordering aircraft to exit the loop to land earlier. This logic could be extended to multiple runways so that the longest looping aircraft gets pulled to available runways.

Leartin

Quote from: DrSuperGood on December 31, 2015, 04:09:18 AM
The airplane problem could possibly be solved by moving landing from the convoy to the airport stop. When the plane approaches the destination airport the airport takes over and manages its actions. If it has a free runway that is suitable it then assigns the plane to land on it. If it does not then it orders the plane to orbit in a big circle around the airport (not some small one like currently) and adds them to the "stack". As a runway is made free it grabs the oldest from the stack and orders it to land on the now free runway. The airport maintains some kind of runway and bay mapping so that it can quickly tell which runways are suitable for landing a plane and when landed which bay is the most appropriate to use.

That's exactly what I tried to convey as the concept of an airport tower, but you said it much clearer.

Quote from: Ters on December 31, 2015, 10:03:10 AM
There is no point in doing that. The plane has access to every single bit of information that the stop has. There is only the concept of OOP that makes it seem as if it's the plane that does the "thinking".

If you get a bunch of planes circling over the airport, truthfully it's not them searching for a route. But still, 'something' is trying to find a route, and I highly suspect this 'something' would do it for each plane, even though it's clear that it will fail for each plane if it fails for the first.
And each time any plane arrives, it (the 'something', not the plane) needs to check for a suitable runway that is connected to the destined gate, even though this rarely changes.
If the airport maps all it's runways, gates and connections, you'd save a lot of work for the 'something' routing in the background. It would only check on player input whether a runway and gate are connected. Each arriving plane would still need to get the actual route it's supposed to move on, but 'something' only needs to check A to B knowing that it will succeed, not checking if there is any connection from {A1, A2, A3} to {B1, B2, B3, B4,...}


Quote from: Ters on December 31, 2015, 10:03:10 AMHowever, a stop is a stop. If a feature is added to airports, it is also added to train stations and bus stops. [...] But the question still remains how the game is supposed to understand the player's intent. How does the player tell which runways are for use  (not not for use) for each plane or stop, so that planes don't start landing at the wrong runways when/if new behavior is introduced in the game?
If you mean the player building type "airport" which was at some point replaced by "stop", yes. But this would cause problems either way, since runways can be shared by stops.
You'd probably need to define the airport as a taxiway-network. So every piece of taxiway, gate and runway a plane could reach without taking off (ignoring signals) would be one airport, even if it connects to more than one stop.
This would also mean that you can have two airports at one stop to totally seperate "low-priority-traffic" and "high-priority-traffic". Let's compare it to a railway station:

If you have a choose signal at the very entrance of a railway station, it's the same as placing a tower.
If you have choose signals a bit further in to have seperate station areas for different kinds of trains, it's the same as having two or more seperated taxiway-networks with towers . Those will not interfere with each other.
If you have an "end of choose"-signal on the railway station, it's the same as placing an "end of choose"-like-signal on a runway. That place will only be used if it's on the schedule.

Also, I think it's important to mention that the change is intended to come into effect when you build a control tower. Thus older games won't be affected at all.

Quote from: Ters on December 31, 2015, 10:03:10 AMRunways are also not an identifiable thing, only a sequence of individual runway tiles next to each other that can change at any time.
And they are not part of a stop, hence you can't add the logic to stops but need something different. Something that makes runways identifiable. Sure, they can change at any time, whenever the player builds or deletes any part of the airport, reevaluation is required. But placing a tower is for busy airports, you don't need it if there is only one runway or not many planes in the first place. If there are many planes, it's likely that reevaluation whenever something is changed is still better then routing whenever a plane arrives.
By the way, if runways were identifiable things, wouldn't it be easy to keep track of their length and have required runway lengths for planes as well, just as a side effect?

Ters

Quote from: Leartin on January 01, 2016, 12:46:32 AM
If you get a bunch of planes circling over the airport, truthfully it's not them searching for a route.

No. Whether we are talking real world or Simutrans, there is no searching for route. The route (or flight plan in real life) is determined before take-off, although in real life, it can be changed due to weather or failures. I'm not sure if runway or gate is preselected, though.

Quote from: DrSuperGood on December 31, 2015, 11:25:55 PM
Currently each plan is pretty much working in a free for all to land. If a runway is full it does a loop around and then checks again if it is full. If during that loop another plane arrives and that runway has been made empty then that plane gets to land and the plane that was looping will need to loop around again. If that looping plane is unlucky it could be stuck looping for a very long time before landing, after which it will probably be running majorly in the red due to wasting fuel.

If the runway logic was extended to contain a queue of "trying to land" aircraft then you can order the landings. The aircraft looping the longest could get to land first. It also opens up other potential improvements such as spacing out the aircraft in a loop or ordering aircraft to exit the loop to land earlier. This logic could be extended to multiple runways so that the longest looping aircraft gets pulled to available runways.

This is somewhat similar to the train signal problem where one train can get stuck for a long time, while later arrivals on other tracks get a green light. Finding a common solution would have been ideal, but probably unlikely since planes probably should reroute, while trains have the added complexity of partially overlapping "blocks".

-

As it currently is, all vehicles will calculate a route from where they are, to the next hard waypoint. I will consider only waypoints placed on stop tiles to keep it simple. If a choose signal is encountered along the way, and the stop tile with the waypoint is occupied, it will search for another accessible stop tile in the same stop. Runways have implicit choose signs in some way. What this means, is that an airplane will head for a designated runway, and if finding it occupied, will start circling from a point X tiles before the end of the runway. This means that there is a holding pattern for each runway. In real life, there is only one holding pattern, which is much bigger than the airport (except maybe for very large airports?).

If this should be changed so that there is "a choose sign" for not only choosing not only gate, but also runway, it doesn't make sense that airplanes should head towards one runway, only to then decide for another runway, perhaps on the other side of the airport. There should be just one holding pattern. But where? I think the only option on the table is the position of the stop's name, which may or may not be optimal.

All this, and proper queueing, requires extra data structures. The only obvious place to put these are on the stop itself, which means all stops, not just airports. One big problem is hangar. You can just build a hangar in the middle of nowhere and give it a runway. Even if the hangar is located at an airport, it is not part of it. Airplanes heading for a hangar will therefore not have any notion of an airport to deal with when coming in to land. Usually, you want the airplane to unload at a gate before sending it to the hangar, but the possibility of not doing it must still be dealt with.

prissi

Queuing planes will reduce throughput, since the landing plane can be processed immediately while the circling plane would land later.

You can split an airport in two halves with no connections between or even use waypoints on runway to force certain runways for certain lines. Given that planes are already a problems as they easily rake in too much money, better planes will be even more problematic.

Isaac Eiland-Hall

Quote from: Ters on January 01, 2016, 11:19:40 AM
No. Whether we are talking real world or Simutrans, there is no searching for route. The route (or flight plan in real life) is determined before take-off, although in real life, it can be changed due to weather or failures. I'm not sure if runway or gate is preselected, though.

Well. The route is, but the landing runway is not. Aircraft may generally request a runway, but that determination is made by ATC upon approach. And ATC may, of course, otherwise redirect aircraft - to hold, or in emergencies, go elsewhere. Of course, pilots may have to go around.... but emergencies and go arounds and such aren't simulated by Simutrans, which is fine.

But landing runway is ATC, not the plane and not preplanned, so there's an argument that simulation of that as the airplace approaches might be considered valid. Of course, there's always a choice on how to handle things in Simutrans - not everything in real life translates perfectly. :)

DrSuperGood

QuoteQueuing planes will reduce throughput, since the landing plane can be processed immediately while the circling plane would land later.
Currently you have on average half a loop delay before the runway is available and a looping plane lands. Less if more than 1 plane is looping due to how the probabilities work. If a looping plane was to be ordered to the runway as soon as it becomes available this delay will be potentially less. Delay will not improve with number circling like it currently does due to the queue dealing with 1 plane at a time.

However if one could estimate landing times (which one should quite easily) and estimate ground clearance time (maybe possible?) you can schedule the next queued aircraft to already get into position before the currently landing aircraft finishes landing and clearing the runway. This would potentially reduce the delay more than currently possible.

The controller could also space out aircraft in a more eye pleasing way. If the queue becomes very large then bigger circles could be made for arriving aircraft, and aircraft in each circle are neatly spaced. In fact if one was to do just this then throughput would improve as landing attempts would be made more evenly spaced so have a significantly lower maximum delay from runway free until landing attempt.

prissi

Landing times cannot be evaluated, sicne the choosing will be only done after a plane lands. Also the planes circle with the smallest possible radius which still looks pretty, so it cannot abort cicrling at all.