opensky-to / api

OpenSky core API
https://opensky.to
MIT License
2 stars 2 forks source link

Create aircraft "world populator" #20

Closed sushiat closed 3 years ago

sushiat commented 3 years ago

Based on airport size, number of parking spots and gates Pick from available vanilla (for now) aircraft types and based on the airport location generate registrations based on icao naming rules with a few percent chosen randomly

Flusinerd commented 3 years ago

Registrations:

For US: N100-N99999 N1A-N9Z, N10A-N99Z, N100A-N999Z, N1000A-N9999Z N1AA-N9ZZ, N10AA-N99ZZ, N1000AA-N999ZZ

https://en.wikipedia.org/wiki/List_of_aircraft_registration_prefixes

Flusinerd commented 3 years ago

image DataDump from current airport set that has average amount of gates and GaRamps per airport grouped by size

Flusinerd commented 3 years ago

All the special snowflakes:

Colombia: HJ, HK, 7
Cuba: CU, 7
Dominican Republic: HI, 6-7
Eritrea: E3, 7
Eswatini: 3DC, 7
Hong Kong: B-H, B-K, B-L, 5
Japan: JA, 7
Kazakhstan: UP, 7
North Korea: P, 500-999 only
Korea: HL, 6 with no dash
Laos: RDPL, 10000-99999 only
Macau: B-M, 5
Moldova: ER, 6 with letters and dash or 10000-99999
Mongolia: JU, 1000-9999
Philippines: RP, C0001-C9999
Taiwan: B, 000000-99999
Tajikistan: EY, 10000-99999
USA: N, 1-999999, 1A-9999Z, 1AA-999ZZ
Uzbekistan: UK, 10000-99999, no dash
sushiat commented 3 years ago

Really like the numbers were are getting for ramps and gates from the current dataset, I think those could serve as quite nice averages for airports that don't have those populated. And I just checked the smallest vanilla airliner the A320 needs around 4500 feet at sealevel to land so that would make it size 2, but I would keep it a rare sight at airports that small, so maybe there should be a random roll that includes like a 50% chance to not be present at all. Should we maybe have a column in general on the aircraft type for minimum airport size required? I think I have seen this before :)

Flusinerd commented 3 years ago

The minimum size column definetly makes sense to have. To avoid having aircraft on to short runways. I would reduce the chance of having aircraft larger aircraft at size 2 airport even further to smth like 20% max.

I looked up a local airport I know of "EDLD" which is size 2 and there was never a A320 or smth similar there. Only small GAs and business jets. Also "EDLE" another local airport is under the same category and only has A320s landing there because of a flight school.

Flusinerd commented 3 years ago
I am thinking about ratios smth like this: Size SEP MEP SET MET JET NBAirliner WBAirliner
-1 95% 5% - - - - -
0 85% 15% - - - - -
1 80% 15% 5% - - - -
2 40% 25% 10% 10% 10% 5% -
3 20% 30% 15% 10% 10% 20% -
4 10% 15% 10% 10% 10% 35% 10%
5 5% 5% 5% 5% 10% 40% 30%
6 5% 5% 5% 5% 5% 35% 40%

Any thoughts?

sushiat commented 3 years ago

Agree with the previous, we should introduce a min airport size on the types and that the number I pulled out of hat for the a320 was too high :)

Regarding the ratios: -1 is closed, so there should be no planes generated And can't small jets like the cj4 land on a size 1? I know embrearguy added the aerosoft crj 550-700 into the jet category as well but I initially though we put only small jets (like the cirrus vision jet) and small business jets in there ... should we maybe add a "regional airliner" category to seperate them out or do we have too many categories alreay? In that case they should maybe be moved up into the nbairliner category

Flusinerd commented 3 years ago

Ahh okay makes sense.

Ye the crj and so on should be moved into NBAirliner or its own category then. Then we can maybe change the ratios to this

Size SEP MEP SET MET JET Regional NBAirliner WBAirliner
-1 - - - - - - - -
0 85% 15% - - - - - -
1 75% 15% 5% - 5% - - -
2 40% 20% 10% 10% 10% 5% 5% -
3 15% 30% 15% 10% 10% 10% 10% -
4 7.5% 7.5% 10% 5% 10% 20% 30% 10%
5 5% 5% 5% 5% 5% 15% 35% 25%
6 5% 5% 5% 5% 5% 5% 30% 40%
sushiat commented 3 years ago

Damn, the gap for MET at size 1 made me look up the two most common planes for those in MSFS, now I wish I hadn't :)

MET: King Air 350, min runway 3300 feet Jet: Cj4, min runway also 3300 feet

But size 1 starts at 2300. So we got a few options:

Cause I checked in the airports table, there are over 7000 size 1 airports with a runway length >=3300 and around 9500 with <3000. So over 40% of the size ones are ok for both those planes.

My gut tells me go with option 3, but what are your thoughts?

sushiat commented 3 years ago

And what I forgot: still use the table of percentages you created, just add another 5% for the MET at size 1, and when picking planes for the airport make sure the types can land there based on longest runway length, if all planes get excluded the category gets simply skipped over

Flusinerd commented 3 years ago
Size SEP MEP SET MET JET Regional NBAirliner WBAirliner
-1 - - - - - - - -
0 85% 15% - - - - - -
1 70% 15% 5% 5% 5% - - -
2 40% 20% 10% 10% 10% 5% 5% -
3 15% 30% 15% 10% 10% 10% 10% -
4 7.5% 7.5% 10% 5% 10% 20% 30% 10%
5 5% 5% 5% 5% 5% 15% 35% 25%
6 5% 5% 5% 5% 5% 5% 30% 40%

Add column for minumum RWY length to AircraftTypes If no Aircraft of that type is available for the RWY -> Go 1 category down

So for MET/JET to SET For MEP to SET

Flusinerd commented 3 years ago

Should I edit the DB myself or let Embraer do that?

sushiat commented 3 years ago

Unless you want to get really fancy and also include the elevation of the airport, but I think that's taking it a step too far :)

Do you know how to create EF migrations? And we might have to fetch the data for the plane runway lengths ourselves, he has like 2 more 12 hour days of work from noon to midnight at the moment

Flusinerd commented 3 years ago

Okay, I'll read into the migrations using EF and will edit the DB myself then.

sushiat commented 3 years ago

Migrations with code first (that's what we are using) are pretty easy: 1) Modify the model class in c#, in this case add an integer column property to the aircraft type class 2) open developer powershell and type: dotnet ef migrations add "AircraftMinimumRunway" ..... or something similar for the name 3) it will then create a new migration in the migrations folder, you can double check what it plans to do and for example change default values if you don't want to allow null values for the column 4) apply it to the database manually by using "dotnet ef database update" or simply start the container - I think it's set to auto apply migrations

Flusinerd commented 3 years ago

Okay ty :)

Flusinerd commented 3 years ago

@markuskorbel The worker has been implemented. Since there is no way to "move" aircraft yet, no hook has been implemented. Once there is the ability, we can close this.

Future (probably me): When an aircraft has been moved, set the hasBeenPopulated flag on the airport to NeedsHandling