diff --git a/EuroscopeSIMBib/ACFT.cs b/EuroscopeSIMBib/ACFT.cs
index a07f8fc..cc7f263 100644
--- a/EuroscopeSIMBib/ACFT.cs
+++ b/EuroscopeSIMBib/ACFT.cs
@@ -23,4 +23,4 @@ internal ACFT(string callsign, string dep, string dest, string atyp, string squa
Squawk = squawk;
}
}
-}
+}
\ No newline at end of file
diff --git a/EuroscopeSIMBib/Airport.cs b/EuroscopeSIMBib/Airport.cs
new file mode 100644
index 0000000..5c3a30b
--- /dev/null
+++ b/EuroscopeSIMBib/Airport.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization.Formatters;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ES
+{
+ internal class Airport
+ {
+ internal virtual string ICAO { get; set; }
+ ///
+ /// Determines the runway in use i.e. at EDDL 05/23
+ ///
+ internal virtual List RunwayDirections { get; set; } = new List();
+ internal virtual int SelectedRunwayDirectionIndex { get; set; }
+ internal virtual string RunwayHeadingLastNumber { get; set; }
+ ///
+ /// List of SIDSRoute corresponding to the index of the runway described in property "RunwayDirections"
+ ///
+ internal virtual List[] SIDSRoute { get; set; }
+ internal virtual List[] SIDSFpln { get; set; }
+ ///
+ /// List of STARs responding to the index of the runway described in property "RunwayDirections"
+ ///
+ internal virtual List[] STARSRoute { get; set; }
+ internal virtual List[] STARSFpln { get; set; }
+ ///
+ /// List of TRANSITION corresponding to the index of the runway described in property "RunwayDirections"
+ ///
+ internal virtual List[] TRANSITIONRoute { get; set; }
+ internal virtual List[] TRANSITIONFpln { get; set; }
+
+ internal virtual string[] DepartureAirstart { get; set; }
+ internal virtual string[] DepartureGroundstart { get; set; }
+ internal virtual List ArrivalStartPoint { get; set; } = new List();
+
+
+
+
+ ///
+ /// Should be obsolete and property should be in method
+ ///
+ internal virtual string SelectedRunwayDirection { get; set; }
+ internal virtual int InboundHeading { get; set; }
+
+ #region details ES simfile requires
+
+ internal virtual List[] ILSDefinition { get; set; }
+ internal virtual string[] Holdings { get; set; }
+
+ internal virtual List Pseudopilots { get; set; } = new List();
+
+ internal virtual string Elevation { get; set; }
+ internal virtual string[] RunwayNames { get; set; }
+ internal virtual List InboundStartPosition { get; set; } = new List();
+ internal virtual List InboundAltitude { get; set; } = new List();
+
+ #endregion
+ }
+}
diff --git a/EuroscopeSIMBib/EDDL.cs b/EuroscopeSIMBib/EDDL.cs
index 6d17337..ed81e3b 100644
--- a/EuroscopeSIMBib/EDDL.cs
+++ b/EuroscopeSIMBib/EDDL.cs
@@ -4,18 +4,13 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Xml.Schema;
namespace EuroscopeSIMGen
{
- internal class EDDL : IAirport
+ internal class EDDL : Airport
{
- public string ICAO { get; } = "EDDL";
- public string[] RunwayDirections { get; } = { "23", "05" };
- public int SelectedRunwayDirectionIndex { get; } = 0;
- public string SelectedRunwayDirection { get; }
- public List[] SIDS { get; set; }
- public List[] STARS { get; set; }
- public List[] TRANSITION { get; set; }
+
#region EDDL SIDS 05
internal string COL4Z = "DL050 DL058 BAM LIPMI COL";
internal string DODEN6Z = "DL050 DL058 BAM ELBAL BETZO DODEN";
@@ -73,19 +68,12 @@ internal class EDDL : IAirport
#endregion
#region SIM settings / defintions
- public List Pseudopilots { get; set; } = new List { "EDDL_APP", "EDDL_M_APP", "EDGG_P_CTR" };
- public string Pseudopilot { get; set; }
- public string[] Holdings { get; set; } = { "HOLDING:ADEMI:284:-1", "HOLDING:BOT:238:-1", "HOLDING:BAM:251:-1", "HOLDING:DL524:232:1", "HOLDING:DL503:232:-1", "HOLDING:DL429:52:-1", "HOLDING:DL409:52:1", "HOLDING:DOMEG:170:-1", "HOLDING:ELDAR:356:-1", "HOLDING:HMM:257:-1", "HOLDING:LMA:240:1", "HOLDING:LEBTI:234:1", "HOLDING:MHV:359:-1", "HOLDING:RONAD:263:1" };
- public string[] DepartureAirstart { get; set; } = { "N051.16.52.419:E006.45.19.666", "N051.17.49.449:E006.47.19.702" };
- public string[] DepartureGroundstart { get; set; } = { "N051.16.42.803:E006.44.59.646", "N051.16.47.401:E006.45.09.066" };
- public List ArrivalStartPoint { get; set; }
- public string Elevation { get; set; } = "150.0";
- public string[] RunwayNames { get; } = { "23L", "23R", "05R", "05L" };
- public string RunwayHeadingLastNumber { get; } = "2";
- public List[] ILSDefinition { get; }
#endregion
internal EDDL(string _selectedRunwayDirection)
{
+ ICAO = "EDDL";
+ RunwayDirections.Add("23");
+ RunwayDirections.Add("05");
#region Sort
SelectedRunwayDirection = _selectedRunwayDirection;
if (_selectedRunwayDirection == RunwayDirections[0])
@@ -96,79 +84,154 @@ internal EDDL(string _selectedRunwayDirection)
{
SelectedRunwayDirectionIndex = 1;
}
- SIDS = new List[RunwayDirections.Count()];
+ // SID
+ SIDSRoute = new List[RunwayDirections.Count()];
for (int i = 0; i < RunwayDirections.Count(); i++)
{
- SIDS[i] = new List();
+ SIDSRoute[i] = new List();
}
- STARS = new List[RunwayDirections.Count()];
+ SIDSFpln = new List[RunwayDirections.Count()];
for (int i = 0; i < RunwayDirections.Count(); i++)
{
- STARS[i] = new List();
+ SIDSFpln[i] = new List();
}
- TRANSITION = new List[RunwayDirections.Count()];
+ // STAR
+ STARSRoute = new List[RunwayDirections.Count()];
for (int i = 0; i < RunwayDirections.Count(); i++)
{
- TRANSITION[i] = new List();
+ STARSRoute[i] = new List();
+ }
+ STARSFpln = new List[RunwayDirections.Count()];
+ for (int i = 0; i < RunwayDirections.Count(); i++)
+ {
+ STARSFpln[i] = new List();
+ }
+ // TRANS
+ TRANSITIONRoute = new List[RunwayDirections.Count()];
+ for (int i = 0; i < RunwayDirections.Count(); i++)
+ {
+ TRANSITIONRoute[i] = new List();
+ }
+ TRANSITIONFpln = new List[RunwayDirections.Count()];
+ for (int i = 0; i < RunwayDirections.Count(); i++)
+ {
+ TRANSITIONFpln[i] = new List();
}
#endregion
-
#region SIDS 23
- SIDS[0].Add(COL5T);
- SIDS[0].Add(DODEN9T);
- SIDS[0].Add(GMH9T);
- SIDS[0].Add(KUMIK6T);
- SIDS[0].Add(LMA2T);
- SIDS[0].Add(MEVEL3T);
- SIDS[0].Add(MODRU1T);
- SIDS[0].Add(NETEX5T);
- SIDS[0].Add(NVO1T);
- SIDS[0].Add(NUDGO5T);
- SIDS[0].Add(SONEB7T);
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(COL5T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(DODEN9T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(GMH9T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(KUMIK6T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(LMA2T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(MEVEL3T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(MODRU1T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(NETEX5T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(NVO1T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(NUDGO5T)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(SONEB7T)));
+
+ SIDSRoute[0].Add(COL5T);
+ SIDSRoute[0].Add(DODEN9T);
+ SIDSRoute[0].Add(GMH9T);
+ SIDSRoute[0].Add(KUMIK6T);
+ SIDSRoute[0].Add(LMA2T);
+ SIDSRoute[0].Add(MEVEL3T);
+ SIDSRoute[0].Add(MODRU1T);
+ SIDSRoute[0].Add(NETEX5T);
+ SIDSRoute[0].Add(NVO1T);
+ SIDSRoute[0].Add(NUDGO5T);
+ SIDSRoute[0].Add(SONEB7T);
#endregion
#region SIDS 05
- SIDS[1].Add(COL4Z);
- SIDS[1].Add(DODEN6Z);
- SIDS[1].Add(GMH5Z);
- SIDS[1].Add(KUMIK4Z);
- SIDS[1].Add(LMA1Z);
- SIDS[1].Add(MEVEL9Z);
- SIDS[1].Add(MODRU6Z);
- SIDS[1].Add(NETEX3Z);
- SIDS[1].Add(NVO2Z);
- SIDS[1].Add(NUDGO4Z);
- SIDS[1].Add(SONEB5Z);
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(COL4Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(DODEN6Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(GMH5Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(KUMIK4Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(LMA1Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(MEVEL9Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(MODRU6Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(NETEX3Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(NVO2Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(NUDGO4Z)));
+ SIDSFpln[0].Add(CreateFplnRouteBySID(nameof(SONEB5Z)));
+
+
+ SIDSRoute[1].Add(COL4Z);
+ SIDSRoute[1].Add(DODEN6Z);
+ SIDSRoute[1].Add(GMH5Z);
+ SIDSRoute[1].Add(KUMIK4Z);
+ SIDSRoute[1].Add(LMA1Z);
+ SIDSRoute[1].Add(MEVEL9Z);
+ SIDSRoute[1].Add(MODRU6Z);
+ SIDSRoute[1].Add(NETEX3Z);
+ SIDSRoute[1].Add(NVO2Z);
+ SIDSRoute[1].Add(NUDGO4Z);
+ SIDSRoute[1].Add(SONEB5Z);
#endregion
#region STAR 23
- STARS[0].Add(LMA8G);
- STARS[0].Add(PISAP1G);
- STARS[0].Add(DOMUX2G);
- STARS[0].Add(HALME1G);
- STARS[0].Add(BIKMU1G);
+ STARSFpln[0].Add(CreateFplnRouteBySTAR(nameof(LMA8G)));
+ STARSFpln[0].Add(CreateFplnRouteBySTAR(nameof(PISAP1G)));
+ STARSFpln[0].Add(CreateFplnRouteBySTAR(nameof(DOMUX2G)));
+ STARSFpln[0].Add(CreateFplnRouteBySTAR(nameof(HALME1G)));
+ STARSFpln[0].Add(CreateFplnRouteBySTAR(nameof(BIKMU1G)));
+
+ STARSRoute[0].Add(LMA8G);
+ STARSRoute[0].Add(PISAP1G);
+ STARSRoute[0].Add(DOMUX2G);
+ STARSRoute[0].Add(HALME1G);
+ STARSRoute[0].Add(BIKMU1G);
#endregion
#region STAR 05
- STARS[1].Add(LMA9X);
- STARS[1].Add(PISAP1X);
- STARS[1].Add(DOMUX2X);
- STARS[1].Add(HALME1X);
- STARS[1].Add(BIKMU1X);
+ STARSFpln[1].Add(CreateFplnRouteBySTAR(nameof(LMA9X)));
+ STARSFpln[1].Add(CreateFplnRouteBySTAR(nameof(PISAP1X)));
+ STARSFpln[1].Add(CreateFplnRouteBySTAR(nameof(DOMUX2X)));
+ STARSFpln[1].Add(CreateFplnRouteBySTAR(nameof(HALME1X)));
+ STARSFpln[1].Add(CreateFplnRouteBySTAR(nameof(BIKMU1X)));
+
+ STARSRoute[1].Add(LMA9X);
+ STARSRoute[1].Add(PISAP1X);
+ STARSRoute[1].Add(DOMUX2X);
+ STARSRoute[1].Add(HALME1X);
+ STARSRoute[1].Add(BIKMU1X);
#endregion
#region TRANS 23
- TRANSITION[0].Add(LMA23);
- TRANSITION[0].Add(PISAP23);
- TRANSITION[0].Add(DOMUX23);
- TRANSITION[0].Add(HALME23);
- TRANSITION[0].Add(BIKMU23);
+ TRANSITIONFpln[0].Add(CreateFplnRouteBySTAR(nameof(LMA23)));
+ TRANSITIONFpln[0].Add(CreateFplnRouteBySTAR(nameof(PISAP23)));
+ TRANSITIONFpln[0].Add(CreateFplnRouteBySTAR(nameof(DOMUX23)));
+ TRANSITIONFpln[0].Add(CreateFplnRouteBySTAR(nameof(HALME23)));
+ TRANSITIONFpln[0].Add(CreateFplnRouteBySTAR(nameof(BIKMU23)));
+
+ TRANSITIONRoute[0].Add(LMA23);
+ TRANSITIONRoute[0].Add(PISAP23);
+ TRANSITIONRoute[0].Add(DOMUX23);
+ TRANSITIONRoute[0].Add(HALME23);
+ TRANSITIONRoute[0].Add(BIKMU23);
#endregion
#region TRANS 05
- TRANSITION[1].Add(LMA05);
- TRANSITION[1].Add(PISAP05);
- TRANSITION[1].Add(DOMUX05);
- TRANSITION[1].Add(HALME05);
- TRANSITION[1].Add(BIKMU05);
- TRANSITION[1].Add(ELDAR05);
+ TRANSITIONFpln[1].Add(CreateFplnRouteBySTAR(nameof(LMA23)));
+ TRANSITIONFpln[1].Add(CreateFplnRouteBySTAR(nameof(PISAP05)));
+ TRANSITIONFpln[1].Add(CreateFplnRouteBySTAR(nameof(DOMUX05)));
+ TRANSITIONFpln[1].Add(CreateFplnRouteBySTAR(nameof(HALME05)));
+ TRANSITIONFpln[1].Add(CreateFplnRouteBySTAR(nameof(BIKMU05)));
+ TRANSITIONFpln[1].Add(CreateFplnRouteBySTAR(nameof(ELDAR05)));
+
+ TRANSITIONRoute[1].Add(LMA05);
+ TRANSITIONRoute[1].Add(PISAP05);
+ TRANSITIONRoute[1].Add(DOMUX05);
+ TRANSITIONRoute[1].Add(HALME05);
+ TRANSITIONRoute[1].Add(BIKMU05);
+ // include ELDAR?
+ TRANSITIONRoute[1].Add(ELDAR05);
+
+ InboundAltitude.Add("13000");
+ InboundAltitude.Add("17000");
+ InboundAltitude.Add("13000");
+ InboundAltitude.Add("13000");
+ InboundAltitude.Add("13000");
+ InboundAltitude.Add("13000");
#endregion
#region ILS definition
@@ -177,6 +240,43 @@ internal EDDL(string _selectedRunwayDirection)
ILSDefinition[0] = new List { "ILS23L:51.2939846:6.7821006:51.2798199:6.7524291", "ILS23R:51.2968503:6.7762140:51.2838245:6.7490896", "ILS05R:51.2808697:6.7546887:51.2950353:6.7842650", "ILS05L:51.2853858:6.7522646:51.2977799:6.7782330" };
ILSDefinition[1] = ILSDefinition[0];
#endregion
+
+ #region SIM settings
+ Pseudopilots = new List { "EDDL_APP", "EDDL_M_APP", "EDGG_P_CTR" };
+ Holdings = new string[] { "HOLDING:ADEMI:284:-1", "HOLDING:BOT:238:-1", "HOLDING:BAM:251:-1", "HOLDING:DL524:232:1", "HOLDING:DL503:232:-1", "HOLDING:DL429:52:-1", "HOLDING:DL409:52:1", "HOLDING:DOMEG:170:-1", "HOLDING:ELDAR:356:-1", "HOLDING:HMM:257:-1", "HOLDING:LMA:240:1", "HOLDING:LEBTI:234:1", "HOLDING:MHV:359:-1", "HOLDING:RONAD:263:1" };
+ DepartureAirstart = new string[] { "N051.16.52.419:E006.45.19.666", "N051.17.49.449:E006.47.19.702" };
+ DepartureGroundstart = new string[] { "N051.16.42.803:E006.44.59.646", "N051.16.47.401:E006.45.09.066" };
+ Elevation = "150.0";
+ RunwayNames = new string[] { "23L", "23R", "05R", "05L" };
+ RunwayHeadingLastNumber = "2";
+
+ #endregion
+
+ #region start positions
+ InboundStartPosition = new List();
+ InboundStartPosition.Add("N051.05.20.219:E005.43.28.483");
+ InboundStartPosition.Add("N052.05.52.590:E006.28.30.781");
+ InboundStartPosition.Add("N051.30.37.689:E008.02.50.044");
+ InboundStartPosition.Add("N051.51.19.845:E007.42.27.592");
+ InboundStartPosition.Add("N050.45.16.504:E006.44.28.864");
+ InboundStartPosition.Add("N050.45.16.504:E006.44.28.864");
+
+ #endregion
+
+
+
+
+
+
+ }
+
+ private string CreateFplnRouteBySID(string SIDname)
+ {
+ return SIDname + " " + SIDname.Substring(0, SIDname.Length - 2);
+ }
+ private string CreateFplnRouteBySTAR(string STARname)
+ {
+ return STARname.Substring(0, STARname.Length - 2) + " " + STARname;
}
}
}
diff --git a/EuroscopeSIMBib/IAirport.cs b/EuroscopeSIMBib/IAirport.cs
deleted file mode 100644
index 0fb1cfa..0000000
--- a/EuroscopeSIMBib/IAirport.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ES
-{
- public interface IAirport
- {
- string ICAO { get; }
- ///
- /// Determines the runway in use i.e. at EDDL 05/23
- ///
- string[] RunwayDirections { get; }
- int SelectedRunwayDirectionIndex { get; }
- string RunwayHeadingLastNumber { get; }
- ///
- /// List of SIDS corresponding to the index of the runway described in property "RunwayDirections"
- ///
- List[] SIDS { get; }
- ///
- /// List of STARs responding to the index of the runway described in property "RunwayDirections"
- ///
- List[] STARS { get; }
- ///
- /// List of TRANSITION corresponding to the index of the runway described in property "RunwayDirections"
- ///
- List[] TRANSITION { get; }
-
- string[] DepartureAirstart { get; }
- string[] DepartureGroundstart { get; }
- string SelectedRunwayDirection { get; }
-
- #region details ES simfile requires
-
- List[] ILSDefinition { get; }
- string[] Holdings { get; }
-
- List Pseudopilots { get; }
- string Pseudopilot { get; set; }
-
- string Elevation { get; }
- string[] RunwayNames { get; }
-
- #endregion
- }
-}
diff --git a/EuroscopeSIMBib/InputOutput.cs b/EuroscopeSIMBib/InputOutput.cs
index 0f134c6..c3add87 100644
--- a/EuroscopeSIMBib/InputOutput.cs
+++ b/EuroscopeSIMBib/InputOutput.cs
@@ -9,34 +9,48 @@ namespace ES
{
internal class InputOutput
{
- public static List ReadCSV(string suffix)
+ internal static List ImportFlightData(string ICAO)
{
- StreamReader reader = new StreamReader($"C:\\Users\\Leon\\Desktop\\Vatsim\\SIM\\{suffix}.csv");
- List output = new List();
+ List FlightsData = new List();
try
{
+ StreamReader reader = new StreamReader($"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\\Euroscope\\SIMGEN\\{ICAO}.csv");
+
using (reader)
{
string line;
while ((line = reader.ReadLine()) != null)
{
- output.Add(line);
+ FlightsData.Add(line);
}
}
}
+ catch (FileNotFoundException e)
+ {
+ Console.WriteLine(".csv file not found \n Make sure you put the flights.csv in MyDocuments");
+ Console.WriteLine(e.Message);
+ Console.ReadLine();
+ System.Environment.Exit(0);
+ /* string fileName;
+ OpenFileDialog fd = new OpenFileDialog();
+ fd.ShowDialog();
+ fileName = fd.FileName;
+ Console.Write(fileName); */
+ }
catch (Exception e)
{
- Console.WriteLine("Fehler beim Einlesen der CSV: ");
+ Console.WriteLine("Error while reading.csv");
Console.WriteLine(e.Message);
}
- return output;
+ return FlightsData;
}
public static void ExportSimFile(List Output)
{
DateTime dateTime = DateTime.Now;
string date = $"{dateTime.Day}.{dateTime.Month}";
- var File = new StreamWriter($"C:\\Users\\Leon\\Desktop\\Vatsim\\SIM\\{date}.txt");
+ System.IO.Directory.CreateDirectory($"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\\Euroscope\\SIM\\SIMGEN");
+ var File = new StreamWriter($"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\\Euroscope\\SIMGEN\\{date}.txt");
foreach (string line in Output)
{
File.WriteLine(line);
diff --git a/EuroscopeSIMBib/SIM.cs b/EuroscopeSIMBib/SIM.cs
index 395f087..99c7e3d 100644
--- a/EuroscopeSIMBib/SIM.cs
+++ b/EuroscopeSIMBib/SIM.cs
@@ -75,7 +75,7 @@ public static void GenerateSIM()
_input = _input.ToUpper();
} while (_input != "EDDL" && _input != "EDDK");
- IAirport airport;
+ Airport airport;
string _runwaydirection;
if (_input == "EDDL")
{
@@ -130,41 +130,42 @@ public static void GenerateSIM()
int _auswahl;
do
{
- Console.WriteLine("Which interval mode should be used?");
- Console.WriteLine("1. Constant: A constant interval allowing for a steady workflow");
+ Console.WriteLine("Which _inboundinterval mode should be used?");
+ Console.WriteLine("1. Constant: A constant _inboundinterval allowing for a steady workflow");
/*
- Console.WriteLine("2. Decreasing: Selection of 2 intervals, interval is decreasing therby increasing the amount of aircraft per time");
+ Console.WriteLine("2. Decreasing: Selection of 2 intervals, _inboundinterval is decreasing therby increasing the amount of aircraft per time");
Console.WriteLine("3. Alternating: Interval alternates between 2 intervals"); */
erfolgreich = Int32.TryParse(Console.ReadLine(), out _auswahl) && (_auswahl == 1 || _auswahl == 2 || _auswahl == 3);
} while (erfolgreich == false);
- int interval = 1;
+ int _inboundinterval = 1;
if (_auswahl == 1)
{
- Console.WriteLine("Select constant interval: ");
- Int32.TryParse(Console.ReadLine(), out interval);
+ Console.WriteLine("Select constant _inboundinterval: ");
+ Int32.TryParse(Console.ReadLine(), out _inboundinterval);
}
/*
float interval2 = 0;
if (_auswahl == 2)
{
- Console.WriteLine("Select the first/start interval");
- float.TryParse(Console.ReadLine(), out interval);
- Console.WriteLine("Select the second/end interval");
+ Console.WriteLine("Select the first/start _inboundinterval");
+ float.TryParse(Console.ReadLine(), out _inboundinterval);
+ Console.WriteLine("Select the second/end _inboundinterval");
float.TryParse(Console.ReadLine(), out interval2);
}
if (_auswahl == 3)
{
- Console.WriteLine("Select the first interval");
- float.TryParse(Console.ReadLine(), out interval);
- Console.WriteLine("Select the second interval");
+ Console.WriteLine("Select the first _inboundinterval");
+ float.TryParse(Console.ReadLine(), out _inboundinterval);
+ Console.WriteLine("Select the second _inboundinterval");
float.TryParse(Console.ReadLine(), out interval2);
} */
#endregion
#region further SIM settings
+ // Activation of outbounds
int outboundsactive;
string OutboundStartPosition = "";
do
@@ -172,27 +173,27 @@ public static void GenerateSIM()
Console.WriteLine("Should outbounds be included? \n 1. Yes \n2. No");
Int32.TryParse(Console.ReadLine(), out outboundsactive);
} while (outboundsactive != 1 && outboundsactive != 2);
- int outboundinterval = 500; //initialization to avoid problems in region "Generate outbound flow
+ int _outboundinterval = 2; //initialization to avoid problems in region "Generate outbound flow
if (outboundsactive == 1)
{
#region outbound interval
do
{
- Console.WriteLine("Should outbounds have the same interval as inbounds? \n 1. Yes \n2. No");
- Int32.TryParse(Console.ReadLine(), out outboundinterval);
- } while (outboundinterval != 1 && outboundinterval != 2);
- if (outboundinterval == 2)
+ Console.WriteLine("Should outbounds have the same _inboundinterval as inbounds? \n 1. Yes \n2. No");
+ Int32.TryParse(Console.ReadLine(), out _outboundinterval);
+ } while (_outboundinterval != 1 && _outboundinterval != 2);
+ if (_outboundinterval == 2)
{
bool outboundintervaltryparse;
do
{
- Console.WriteLine("Which interval should outbounds have?");
- outboundintervaltryparse = Int32.TryParse(Console.ReadLine(), out outboundinterval);
- } while (outboundintervaltryparse == true);
+ Console.WriteLine("Which _inboundinterval should outbounds have?");
+ outboundintervaltryparse = Int32.TryParse(Console.ReadLine(), out _outboundinterval);
+ } while (outboundintervaltryparse != true);
}
else
{
- outboundinterval = interval;
+ _outboundinterval = _inboundinterval;
}
#endregion
#region Ground or Air start ?
@@ -229,25 +230,41 @@ public static void GenerateSIM()
}
#endregion
}
+
+ // Selection of Initialpseudopilot
+ Console.WriteLine("Which station should control the aircraft");
+ for (int i = 0; i < airport.Pseudopilots.Count; i++)
+ {
+ Console.WriteLine($"{i + 1}. {airport.Pseudopilots[i]}");
+ }
+ do
+ {
+ erfolgreich = Int32.TryParse(Console.ReadLine(), out _auswahl);
+ erfolgreich = erfolgreich == true && _auswahl <= airport.Pseudopilots.Count && _auswahl >= 0;
+ } while (!erfolgreich);
+ string InitialPseudopilot = airport.Pseudopilots[_auswahl - 1];
#endregion
#region Definition text
List SimFile = new List();
SimFile = GenerateSimFileStandardText(SimFile, airport);
#endregion
-
+
#region Generate outbound flow
+ string simroute;
+ bool validEntry = false;
+ Random rnd = new Random();
if (outboundsactive == 1)
{
#region SID Distribution
List SIDSelectionDistribution = new List();
- Console.WriteLine($"Enter SID selection/distribution key: i.e. 5:1:2:5. {airport.ICAO} needs {airport.SIDS[airport.SelectedRunwayDirectionIndex].Count} numbers \n or type \"random\" for a random distribution");
+ Console.WriteLine($"Enter SID selection/outbounddistribution key: i.e. 5:1:2:5. {airport.ICAO} needs {airport.SIDSRoute[airport.SelectedRunwayDirectionIndex].Count} numbers \n or type \"random\" for a random outbounddistribution");
string _lastword = "";
Console.WriteLine("Distribution numbers have to be in this order: \n");
- for (int i = 0; i < airport.SIDS[airport.SelectedRunwayDirectionIndex].Count; i++)
+ for (int i = 0; i < airport.SIDSRoute[airport.SelectedRunwayDirectionIndex].Count; i++)
{
- _lastword = airport.SIDS[airport.SelectedRunwayDirectionIndex][i].Split(' ').Last();
- if (i < airport.SIDS[airport.SelectedRunwayDirectionIndex].Count - 1)
+ _lastword = airport.SIDSRoute[airport.SelectedRunwayDirectionIndex][i].Split(' ').Last();
+ if (i < airport.SIDSRoute[airport.SelectedRunwayDirectionIndex].Count - 1)
{
Console.Write(_lastword + ":");
}
@@ -256,11 +273,11 @@ public static void GenerateSIM()
Console.Write(_lastword + "\n");
}
}
- // reading and computing distribution key
+ // reading and computing outbounddistribution key
string _distributionkey;
- bool validEntry = false;
- List distribution = new List();
+
+ List outbounddistribution = new List();
do
{
_distributionkey = Console.ReadLine();
@@ -271,59 +288,267 @@ public static void GenerateSIM()
if (substring != ":")
{
Int32.TryParse(substring, out int _convertedInt);
- distribution.Add(_convertedInt);
+ outbounddistribution.Add(_convertedInt);
//Console.Write(_convertedInt + " ");
}
}
- if (distribution.Count == airport.SIDS[airport.SelectedRunwayDirectionIndex].Count)
+ if (outbounddistribution.Count == airport.SIDSRoute[airport.SelectedRunwayDirectionIndex].Count)
{
validEntry = true;
}
if (validEntry == false)
{
- Console.Write($"Wrong input, input has to look like this 5:1:3:4 -> It needs {airport.SIDS[airport.SelectedRunwayDirectionIndex].Count} numbers, separated by : \n");
- //Console.Write(distribution.Count);
- distribution.Clear();
+ Console.Write($"Wrong input, input has to look like this 5:1:3:4 -> It needs {airport.SIDSRoute[airport.SelectedRunwayDirectionIndex].Count} numbers, separated by : \n");
+ //Console.Write(outbounddistribution.Count);
+ outbounddistribution.Clear();
}
} while (validEntry != true);
+
#endregion
- for (int i = 0; i < _duration; i++)
+
+ string RWYHeading = "";
+ if (Int32.TryParse(airport.SelectedRunwayDirection + airport.RunwayHeadingLastNumber, out int heading))
+ {
+ RWYHeading = ((int)((heading * 2.88 + 0.5) * 4)).ToString();
+ }
+ else
+ {
+ Console.WriteLine("Error occured while converting runway heading to string");
+ Console.ReadLine();
+ System.Environment.Exit(0);
+ }
+ foreach (int i in outbounddistribution)
+ {
+ Console.Write($"{i}:");
+ }
+ List SolutionSID = new List();
+ for(int i = 0; i < outbounddistribution.Count; i++)
+ {
+ for (int j = 0; j < outbounddistribution[i]; j++)
+ {
+ SolutionSID.Add(i);
+ }
+ }
+
+ for (int i = 0; i < _duration; i += _outboundinterval)
{
// Empty Line to separate each aircraft in .txt file
SimFile.Add("");
+
// random callsign from outbound list
- Random rnd = new Random();
- int r = rnd.Next(Outbounds.Count);
- string RWYHeading = "";
- if (Int32.TryParse(airport.SelectedRunwayDirection + airport.RunwayHeadingLastNumber, out int heading))
- {
- RWYHeading = ((int)((heading * 2.88 + 0.5) * 4)).ToString();
- }
- else
- {
- Console.WriteLine("Error occured while converting runway heading to string");
- Console.ReadLine();
- System.Environment.Exit(0);
- }
+
+ int RandomNumber = rnd.Next(Outbounds.Count);
+
+ // First line
+ SimFile.Add($"@N:{Outbounds[RandomNumber].Callsign}:{Squawks.AssignSquawk()}:1:{OutboundStartPosition}:{airport.Elevation}:0:{RWYHeading}:0");
+
+ // Select SID
+
+ int randomnumber = rnd.Next(SolutionSID.Count);
+
+ int SelectedSID = SolutionSID[randomnumber];
+ Console.WriteLine(SelectedSID);
+ //1:2:3:4:5:6:7:8:9:10:11
+
+ simroute = airport.SIDSRoute[airport.SelectedRunwayDirectionIndex][SelectedSID];
- int SelectedSID = 0; // TODO
- string simroute = ""; //TODO
- SimFile.Add($"@N:{Outbounds[r].Callsign}:{Squawks.AssignSquawk()}:1:{OutboundStartPosition}:{airport.Elevation}:0:{RWYHeading}:0");
- SimFile.Add($"$FP{Outbounds[r].Callsign}:*A:I:{Outbounds[r].ATYP.Substring(0, Outbounds[r].ATYP.Length - 2)}:420:{Outbounds[r].DEP}:::0:{Outbounds[r].DEST}:00:00:0:0:::{airport.SIDS[SelectedSID]}");
- SimFile.Add($"SIMDATA:{Outbounds[r].Callsign}:*:*:25:1:0");
+ SimFile.Add($"$FP{Outbounds[RandomNumber].Callsign}:*A:I:{Outbounds[RandomNumber].ATYP.Substring(0, Outbounds[RandomNumber].ATYP.Length - 2)}:420:{Outbounds[RandomNumber].DEP}:::0:{Outbounds[RandomNumber].DEST}:00:00:0:0:::{airport.SIDSFpln[airport.SelectedRunwayDirectionIndex][SelectedSID]}");
+ SimFile.Add($"SIMDATA:{Outbounds[RandomNumber].Callsign}:*:*:25:1:0");
SimFile.Add($"$ROUTE:{simroute}");
SimFile.Add($"START:{i}");
SimFile.Add($"DELAY:1:2");
SimFile.Add($"REQALT:5000");
- SimFile.Add($"INITIALPSEUDOPILOT:EDGG_P_CTR");
+ SimFile.Add($"INITIALPSEUDOPILOT:{InitialPseudopilot}");
}
}
#endregion
+ ///////
+ #region Generate inbound flow
+
+ string InboundHeading = "";
+ int STARorTRANS = 0;
+ do
+ {
+ Console.WriteLine("Use 1. STAR or 2. TRANS?");
+
+ erfolgreich = Int32.TryParse(Console.ReadLine(), out _auswahl);
+ erfolgreich = erfolgreich == true && _auswahl <= 2 && _auswahl >= 1;
+ STARorTRANS = _auswahl - 1;
+
+ } while (!erfolgreich);
+
+ #region STAR/TRANS distribution
+
+ List ArrivalDistribution = new List();
+
+ #region text settings
+
+ string key = "";
+ string distributionlengthstring = "";
+ int distributionlengthint = 0;
+ List[] RouteList = { new List(), new List() };
+ if(STARorTRANS == 0)
+ {
+ key = "STAR";
+ distributionlengthint = airport.STARSRoute[airport.SelectedRunwayDirectionIndex].Count;
+ distributionlengthstring = $"{distributionlengthint}";
+ RouteList[0] = airport.STARSRoute[0];
+ RouteList[1] = airport.STARSRoute[1];
+ }
+ else
+ {
+ key = "TRANS";
+ distributionlengthint = airport.TRANSITIONRoute[airport.SelectedRunwayDirectionIndex].Count;
+ distributionlengthstring = $"{distributionlengthint}";
+ RouteList[0] = airport.TRANSITIONRoute[0];
+ RouteList[1] = airport.TRANSITIONRoute[1];
+ }
+
+ #endregion
+
+ Console.WriteLine($"Enter {key} outbounddistribution key: {airport.ICAO} needs {distributionlengthstring} numbers \n or type \"random\" for a random outbounddistribution");
+ string _firstword = "";
+
+ Console.WriteLine("Distribution numbers have to be in this order: \n");
+
+ for (int i = 0; i < distributionlengthint; i++)
+ {
+ _firstword = RouteList[airport.SelectedRunwayDirectionIndex][i].Split(' ').First();
+ if (i < RouteList[airport.SelectedRunwayDirectionIndex].Count - 1)
+ {
+ Console.Write(_firstword + ":");
+ }
+ else
+ {
+ Console.Write(_firstword + "\n");
+ }
+ }
+
+ #endregion
+
+ // reading and computing outbounddistribution key
+
+ string _inbounddistributionkey = "";
+ validEntry = false;
+
+ List distribution = new List();
+
+ do
+ {
+ _inbounddistributionkey = Console.ReadLine();
+
+ string[] _subStrings = _inbounddistributionkey.Split(':');
+ foreach(string substring in _subStrings)
+ {
+ if(substring != ":")
+ {
+ Int32.TryParse(substring, out int _convertedInt);
+ ArrivalDistribution.Add(_convertedInt);
+ }
+ }
+ if(ArrivalDistribution.Count == RouteList[airport.SelectedRunwayDirectionIndex].Count)
+ {
+ validEntry = true;
+ }
+ if(validEntry == false)
+ {
+ Console.Write($"Wrong input, input has to look like this 5:1:3:4 -> It needs {distributionlengthstring} numbers, separated by : \n");
+ ArrivalDistribution.Clear();
+ }
+
+ } while (validEntry != true);
+
+
+ // EVERYTHING BELOW IS NOT CHECKED
+
+
+
+
+
+
+
+ simroute = "";
+ string fplnroute = "";
+ string InboundStartPosition = "";
+ string InboundAltitude = "";
+ List SolutionSTAR = new List();
+ for (int i = 0; i < ArrivalDistribution.Count; i++)
+ {
+ for (int j = 0; j < ArrivalDistribution[i]; j++)
+ {
+ SolutionSTAR.Add(i);
+ }
+ }
+ // Debug
+ foreach(int i in SolutionSTAR)
+ {
+ Console.Write($"{i} ");
+ }
+
+ for (int i = 0; i < _duration; i += _inboundinterval)
+ {
+ SimFile.Add("");
+
+ // random callsign from inbound list
+ int RNDintCallsign = rnd.Next(Inbounds.Count);
+
+ // Select STAR / TRANS
+
+ int RANDSTARorTRANSNumber = 0;
+
+
+ int randomnumber = rnd.Next(SolutionSTAR.Count);
+
+ RANDSTARorTRANSNumber = SolutionSTAR[randomnumber];
+
+ if (STARorTRANS == 1)
+ {
+ //RANDSTARorTRANSNumber = rnd.Next(airport.STARSRoute.Length); obsolete due to line 511?
+ simroute = airport.STARSRoute[airport.SelectedRunwayDirectionIndex][RANDSTARorTRANSNumber];
+ fplnroute = airport.STARSFpln[airport.SelectedRunwayDirectionIndex][RANDSTARorTRANSNumber];
+
+ }
+ else
+ {
+ //RANDSTARorTRANSNumber = rnd.Next(airport.TRANSITIONRoute.Length); obsolete due to line 511?
+ simroute = airport.TRANSITIONRoute[airport.SelectedRunwayDirectionIndex][RANDSTARorTRANSNumber];
+ fplnroute = airport.TRANSITIONFpln[airport.SelectedRunwayDirectionIndex][RANDSTARorTRANSNumber];
+ }
+ Console.WriteLine(fplnroute);
+
+
+
+ InboundStartPosition = airport.InboundStartPosition[RANDSTARorTRANSNumber];
+ InboundAltitude = airport.InboundAltitude[RANDSTARorTRANSNumber];
+ // First line
+ // Fix spawn ALTITUDE -> should be fixed
+ SimFile.Add($"@N:{Inbounds[RNDintCallsign].Callsign}:{Squawks.AssignSquawk()}:1:{InboundStartPosition}:{InboundAltitude}:0:{InboundHeading}:0");
+
+ // Second line
+ SimFile.Add($"$FP{Inbounds[RNDintCallsign].Callsign}:*:I:{Inbounds[RNDintCallsign].ATYP.Substring(0, Inbounds[RNDintCallsign].ATYP.Length - 2)}:420:{Inbounds[RNDintCallsign].DEP}:::0:{Inbounds[RNDintCallsign].DEST}:00:00:0:0:::{fplnroute}");
+
+ // Rest of lines
+ SimFile.Add($"SIMDATA:{Inbounds[RNDintCallsign].Callsign}:*:*:25:1:0");
+ SimFile.Add($"$ROUTE:{simroute}");
+ SimFile.Add($"START:{i}");
+ SimFile.Add($"DELAY:1:2");
+ SimFile.Add($"REQALT:{InboundAltitude}");
+ SimFile.Add($"INITIALPSEUDOPILOT:{InitialPseudopilot}");
+
+ }
+
+ #endregion
+
+ #region Output SimFile as txt
+
+ InputOutput.ExportSimFile(SimFile);
+ Console.ReadLine();
+ #endregion
}
- internal static List GenerateSimFileStandardText(List SimFile, IAirport airport)
+ internal static List GenerateSimFileStandardText(List SimFile, Airport airport)
{
#region ILS/runway definitions
for (int i = 0; i < 4; i++)