How to implement map of an aerodrome and aircraft traffic on that ?
Hi, I'm working on a microservice that is called "Ground control", which responsible for ground traffic of aircrafts on the aerodrome. Presumably, it will use the http or RabbitMQ, but I've no way of knowing about how to do some things from business logic:
1) how to implement a map with all taxiways, runways and aprons (which data structures is appropriate, which frameworks or libraries can be useful ?)
2) how to implement aircraft moving from A to B (from A taxiway to another taxiway B, for example. Which algorithm is better for that ?)
3) how to define the communication contract between my microservice and GUI ? (should GUI has an interface of my commands or there is another solutions ?)
I added the aerodrome scheme for better understanding
69 Replies
Is this homework or a work project?
homework
Well, you won't be drawing anything in the microservice imho, rather just send data to the gui
And to be frank, this is a fairly advanced homework. Should you really be asking for outside help on something like this?
that said, consider the following:
* Do you need exact position information or is "at stands", "on runway" etc good enough?
* Do you OWN the data, or do you get updates from somewhere else?
* I guess "at concrete taxiway" or "at concrete apron" is enough
* I only use arrival/departure data from a database, but rest data under my control
okay. is it realtime or does something else control the "speed" of the simulation?
realtime
Just my teacher doesn't want to help and I don't fully understand how to perform this task. Should I ask for it in other forums ?
were you given some data, some interfaces, or you have to do everything?
No, I'm responsible for all
Are you responsible for making the GUI too?
No, I have to place aircrafts and control their traffic by commands
But the whole aerodrome have to be created inside my service
There are endless posibilities of modelling this, and which ones are suitable all depends on the requirements
Is the layout of the aerodrome fixed?
Yes it is
So the simplest possible idea I can think of then would just be to have a
List<Aircraft>
, where each Aircraft
has a .Position
property that keeps track of where they are. Its extremely simplified, but if you dont need granular positions, that does the trick
An alternative is to model each area of the aerodrome as an object, and each area keeps track of the aircraft in them
do you have to simulate takeoffs and landings? ie that they take time and colissions are real etc?To be honest I have to do, but for landing and takeoffs is responsible a local control not the ground one. And collisions must to be, of course
then it sounds like "at apron" is not good enough
yep
you need to actually keep track of their actual position, heading etc
This is very much not trivial stuff tbh. I'm thinking a directional graph datastructure to represent the pathways between the different areas, and you can use dijkstra to find the ways to move around it
you'll still need to figure out how to deal with collisions etc
you'll likely need semaphores or something to keep track of what areas are currently in use
like an aircraft trying to move from the stands to the ramp will need the apron AND the ramp to be clear before it can leave the taxiway outside the stands
and once it enters the apron, no aircraft may leave the ramp, because they would block
And likely I will have something like
Graph<AerodromePart>
?if you go that way, sure
but it'll be fairly complicated. What areas cause blockages in other areas etc must be carefully analyzed and set up
Okay, thank you for help
the graph would primarily be used to pathfind. potentially, you could keep track of what areas are "in use" etc too, so pathfinding fails when they are blocked
as an alternative, you could set up pre-calculated paths
I got it. May be i will add some rules for entering in every taxiway or apron
yeah, you kinda must
Is the GUI just like a preview of the data on a server? Like the position of planes or something like that?
Yes it is
At least I don't know how to do it in another way
The server can send packets to the GUIs that are listening, and those packets could contain position data for all the planes, and then the GUI can be responsible for "animating" the actual plane positions
This is what games do, where the server sends position updates and the client presents them. The client tries to predict where a thing might be in the future, which can be done simply by calculating the position change between the last and current packet to calculate the velocity
The faster the updates are, the more accurate the representation would be obviously
Kinda random example but in GTA5 online, if you open the mini map and look at someone whose flying a jet far away from you, you can see the jet teleporting every second because from a long distance, position updates are slow, but the game still tries to predict and interpolate its movement
I don't clearly understand which part of aerodrome I have to send for updating
I assume just plane position and direction/rotation data right?
Probably yes
for basic functional, it can be enough
And my program does have a several threads, right ?
yeah, since the aerodrome layout is static you prob wont send it at all. At a later stage you might include semaphore information in your "payload" to the GUI
I'd lean towards using async/await over threads. its a nicer abstraction.
maybe use websockets to push data from the server to the client
could you explain how semaphore has to work, in several words ?
I'm just unfamiliar with them
you know stoplights?
those are semaphores.
so the idea would be that when an aircraft crosses a certain point, the lights "turn red"
so no other aircraft tries to enter
essentially, each time an aircraft tries to transition from one area to another, it checks if the area is open
if it is, it moves in. if its not, it waits and retries later
I was going to do that by
state
of each aerodrome itemsure, that works sortof
depends on the type of item
a taxiway can have multiple planes on it
so you'll need to break it up into several sections
Are there other ways to implement a semaphore ?
depends entirely on your overall architecture
just having a bool on each part might be enough
To sum up:
- Aerodrome is represented as a directional graph
- For moving I use the Dijkstra algorithm
- Each aerodrome item has a 'state' used to control the traffic
- Every time (guess 30 times in a second) I will send all planes' positions to the gui
Am I right ?
30 times per second seems outrageous
I was thinking maybe 1-2 times per second tops
and for PATHFINDING you use dijkstra, the actual moving will need to be handled in a different way
actual moving is have to be implemented in program, or it is better to delegate that to the gui?
program
or well, maybe thats not strictly needed if you use enough segments
since only one plane can be in each segment anyways
Just I guess I can send to the gui like "Move Plane#1 to this taxiway" and gui will do the animation during specific amount of seconds
yeah, you'll just send a list of all aircraft and their position. Shouldnt need more then that tbh
idk if you've seen actual ground control instruments, but they are not animated š
the plane icons dont move smoothly, they jump
I didn't know š
doing smooth animations will be a lot of work for very little gain
just let the planes teleport small distances imho, its more than fine š
Okay, thank you guys for your help! It was helpful!
I mean shouldn't u be able to have more planes on hangars and docks?
@Kuno out of curiosity do they also give u an image without all the numbers and planes on it?
if so animating it might be easier then u think in WPF
I would imagine the taxiway would be limited per segment but hangars and docks by the amount the can fit
Regarding planes hangars... i would just teleport them inside and then make them dissapeared
I pull number and may be model from database
I mean there is also ramp, apron, stands but u get the idea
they give u an image per section?
im referring to the visual u have because that could be used on the GUI
if u had it without the details on it and planes
image of plane ?
of the airport like u have a the top of your thread
but without anything on it
I use this image just for understanding, idk. You are talking about using this image (without any signs) as a visual map in WPF ?
You could use images instead of drawing using vector art
imagine u remove all the numbers, planes and names from the image, u get an empty airport
then you can add objects based on the information u receive
so you're populating the stuff based on the information your API sends in
and add (x,y) relatively to the objects on map to visualize?
You would have packets that represents when a plane arrives and departs, and when you gets sent an arrival packet you would also expect the server to start sending you position and rotation data, and you can use that to change the positions and rotatinos of the GUI components
But if the server sends position data as geo coordinates then you'd have to convert that to regular x,y coords
Just the visualization is not my task
I would try to do that for testing
Your software actually instructs the planes/pilots where to go?
Yes
Ahh i thought you were just writing a thing to visualise the data not actually create the data per se
So you just receive when a plane arrives/departs?
And then you control where that plane goes when it arrives?
Yep
Ground and Local Control
in the airport
When you receive that plane arrived packet, that's where you need to do something with the plane?
In that case, I don't know exactly what goes on in real airports but i'd assume they go right to that place where passengers can exit near the terminals maybe
Local Control is responsible for landing and takeoffs
Ground Control for providing a safe path to the apron
If there's a scheduled location that each plane goes to after, then you'd just send an instruction to that plane to say "go <here>". Otherwise, you'd look through all available aircraft stands maybe? then find a free one according to the database
When a plane takes up that place, you'd update the database accordingly
I would rather use
List<T>
for stands, instead a database
Is this kinda what you're trying to make?
Just some make up code, not sure if that's what you're trying to actually do though
Then if you want to visualise the airport with something like unity, then tbh the best bet would be to contain the entire airport and all planes as their own objects (states), and then you'd create the respective unity engine game objects that listen for when data is updated (e.g. the plane position changes, raise an event to let you update the unity object position and so on)
yep just saying that depending on how smoothly u want it to be its not too hard of a task, that is on WPF
with storyboard u can do some really cool thngs on WPF
this project remembers me of a sample program that uses orleans
https://learn.microsoft.com/en-us/samples/dotnet/samples/orleans-gps-device-tracker-sample/
maybe it can be of use
Orleans GPS device tracker sample - Code Samples
An Orleans sample demonstrating how to use GPS device tracker.
Okay, it will speak with person, who is responsible for that, cause Iām not familiar with Unity
Interesting, I would give it a try for testing