예제 #1
0
        public void Save(string title)
        {
            FileSupport.Save(TE, title, "T_TE_MAP");
            FileSupport.Save(TW, title, "T_TW_MAP");
            FileSupport.Save(TL, title, "T_TL_MAP");
            FileSupport.Save(TS, title, "T_TS_MAP");

            FileSupport.Save(SNOW, title, "N_00_MAP");
            FileSupport.Save(RAIN, title, "R_00_MAP");

            FileSupport.Save(BLIZZARD, title, "B_00_MAP");
            FileSupport.Save(ALBEDO, title, "A_00_MAP");

            FileSupport.Save(Precip, title, "C_00_MAP");
            FileSupport.Save(TLow, title, "T_SL_MAP");
            FileSupport.Save(THigh, title, "T_SH_MAP");
            FileSupport.Save(LIDX, title, "L_00_MAP");

            FileSupport.Save(FOG, title, "F_SI_MAP");

            FileSupport.Save(TNormLow, title, "T_NL_MAP");
            FileSupport.Save(TNormHigh, title, "T_NH_MAP");

            FileSupport.Save(TLow - TNormLow, title, "T_DL_MAP");
            FileSupport.Save(THigh - TNormHigh, title, "T_DH_MAP");
            FileSupport.Save(0.5f * (TLow - TNormLow + THigh - TNormHigh).EQ(), title, "T_DA_MAP");

            FileSupport.Save((1000 * WL - MatrixFactory.Init(500)), title, "E_00_MAP");
        }
예제 #2
0
        public void Save(string title)
        {
            SeaLevel.Save(title);
            MidLevel.Save(title);
            TopLevel.Save(title);
            JetLevel.Save(title);

            FileSupport.Save(AirMass, title, "M_00_MAP");
            FileSupport.Save(Fronts, title, "F_00_MAP");
        }
예제 #3
0
 public virtual void Save(string title)
 {
     FileSupport.Save(P.EQ(), title, string.Format("P_{0:d2}_MAP", _levelType));
     FileSupport.Save(T.EQ(), title, string.Format("T_{0:d2}_MAP", _levelType));
     FileSupport.Save(H.EQ(), title, string.Format("H_{0:d2}_MAP", _levelType));
 }
예제 #4
0
        public override void RebuildState()
        {
            float sunLatRad   = References.GetSunLatitude_Radians(Earth.UTC);
            float daysElapsed = (Earth.HoursElapsed / AbsoluteConstants.HoursPerDay);

            float dailyJetAdvance = SimulationParameters.Instance.JetStreamWaveSpeed;
            float deltaLonRad     = daysElapsed * dailyJetAdvance * (float)Math.PI / 180;

            P = ((Earth.ATM.SeaLevel.P.Multiply(100 / LevelPressure.SeaLevelPressure) +
                  Earth.ATM.TopLevel.P.Multiply(100 / LevelPressure.TopLevelPressure) +
                  Earth.ATM.MidLevel.P.Multiply(100 / LevelPressure.MidLevelPressure)) as DenseMatrix).EQ();

            var _ridgePatternDevs = P.ToWindComponents();

            var this_BP = this.BP;
            var this_FP = this.FP;

            FileSupport.Save(this_BP, Earth.UTC.Title, "D_BP");
            FileSupport.Save(this_FP, Earth.UTC.Title, "D_FP");

            DenseMatrix[] extDev = null;

            var pattern = SimulationParameters.Instance.JetStreamPattern;

            _actualDev.Assign2D
            (
                (r, c) =>
            {
                float lat    = EarthModel.MaxLat - r;
                float lon    = c - 180;
                float latRad = lat * (float)Math.PI / 180;

                float f    = 0;
                float devE = 0;

                var devX = 0f;

                switch (pattern)
                {
                case SimulationParameters.JetStreamPatterns.SingleJet_WithReversal:
                    {
                        f         = SingleJet_WithReversal(Earth.UTC.DayOfYear, latRad);
                        var devX1 = f * dailyJetAdvance;
                        devX      = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                case SimulationParameters.JetStreamPatterns.DualJet_WithReversal:
                    {
                        f         = DualJet_WithReversal(Earth.UTC.DayOfYear, latRad);
                        var devX1 = f * dailyJetAdvance;
                        devX      = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                case SimulationParameters.JetStreamPatterns.SingleJet_SeasonalReversal:
                    {
                        f         = SingleJet_SeasonalReversal(Earth.UTC.DayOfYear, latRad);
                        var devX1 = f * dailyJetAdvance;
                        devX      = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                case SimulationParameters.JetStreamPatterns.DualJet_SeasonalReversal:
                    {
                        f         = DualJet_SeasonalReversal(Earth.UTC.DayOfYear, latRad);
                        var devX1 = f * dailyJetAdvance;
                        devX      = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                case SimulationParameters.JetStreamPatterns.VariableJet_WithReversal:
                    {
                        var fSingle = SingleJet_WithReversal(Earth.UTC.DayOfYear, latRad);
                        var fDual   = DualJet_WithReversal(Earth.UTC.DayOfYear, latRad);

                        var fVar = GetVariability(daysElapsed);
                        f        = (1 - fVar) * fSingle + fVar * fDual;

                        var devX1 = f * dailyJetAdvance;

                        devX = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;


                case SimulationParameters.JetStreamPatterns.VariableJet_SeasonalAndBlock_Reversal:
                    {
                        var fSingle = SingleJet_SeasonalReversal(Earth.UTC.DayOfYear, latRad);
                        var fDual   = DualJet_SeasonalReversal(Earth.UTC.DayOfYear, latRad);

                        var fVar = GetVariability(daysElapsed);
                        f        = (1 - fVar) * fSingle + fVar * fDual;

                        var bp = this_BP[r, c];

                        var devX1 = (f - 0.5f * bp) * dailyJetAdvance;

                        devX = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;


                case SimulationParameters.JetStreamPatterns.VariableJet_SeasonalReversal:
                    {
                        var fSingle = SingleJet_SeasonalReversal(Earth.UTC.DayOfYear, latRad);
                        var fDual   = DualJet_SeasonalReversal(Earth.UTC.DayOfYear, latRad);

                        var fVar = GetVariability(daysElapsed);
                        f        = (1 - fVar) * fSingle + fVar * fDual;

                        var devX1 = f * dailyJetAdvance;

                        devX = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                case SimulationParameters.JetStreamPatterns.AdaptiveJet:
                    {
                        f = 1;

                        var devX1 = f * dailyJetAdvance;

                        devX = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                case SimulationParameters.JetStreamPatterns.AdaptiveJet_WithBlock:
                    {
                        f = 1;

                        var bp    = this_BP[r, c];
                        var devX1 = (f - 0.5f * bp) * dailyJetAdvance;

                        devX = Earth.SnapshotDivFactor * (
                            JetDevFactor_X * (devX1 + devE) +
                            RidgeDevFactor_X * _ridgePatternDevs[Direction.X][r, c]);
                    }
                    break;

                default:
                    break;
                }

                return(devX % 360);
            },

                (r, c) =>
            {
                float lat = EarthModel.MaxLat - r;
                float lon = c - 180;

                float lonRad = lon * (float)Math.PI / 180;

                float latRad = lat * (float)Math.PI / 180;
                //float latRad = lat * (float)Math.PI / 180 + References.GetSunLatitude_Radians(Earth.UTC);

                float sinLat = (float)Math.Sin(latRad);
                float cosLat = (float)Math.Cos(latRad);
                float sinLon = (float)Math.Sin(SimulationParameters.Instance.JetStreamPeaks * (lonRad - deltaLonRad));

                var devY = 0f;

                switch (pattern)
                {
                case SimulationParameters.JetStreamPatterns.AdaptiveJet:
                    {
                        float f = sinLat * cosLat * sinLon;

                        var devY1 = f * SimulationParameters.Instance.JetStreamWaveSpeed;

                        devY = Earth.SnapshotDivFactor * (
                            JetDevFactor_Y * devY1 +
                            RidgeDevFactor_Y * _ridgePatternDevs[Direction.Y][r, c]);
                    }
                    break;

                default:
                    {
                        float f = sinLat * cosLat * sinLon * GetVariability(daysElapsed);

                        var devY1 = f * SimulationParameters.Instance.JetStreamWaveSpeed;

                        devY = Earth.SnapshotDivFactor * (
                            JetDevFactor_Y * devY1 +
                            RidgeDevFactor_Y * _ridgePatternDevs[Direction.Y][r, c]);
                    }
                    break;
                }

                return(devY % 180);
            }
            );
        }
예제 #5
0
파일: Program.cs 프로젝트: bartech99/PO2
        static void Main(string[] args)
        {
            Cars        cars = new Cars();
            FileSupport file = new FileSupport();

            bool ifData = false;

            while (true)
            {
                switch (Menu.MainList())
                {
                case 1:

                    Support.WriteCol("--- Wczytywanie z pliku ---", "G");
                    Console.WriteLine();

                    if (File.Exists(file.GetTitle()))
                    {
                        Support.Clear(cars);
                    }
                    ifData = file.Read(cars);

                    break;

                case 2:

                    Support.WriteCol("--- Zapis do pliku ---", "G");
                    Console.WriteLine();
                    if (ifData)
                    {
                        file.GetTitle();
                        file.Save(cars);
                    }
                    else
                    {
                        Support.WriteCol("Brak danych w bazie do zapisania", "DY");
                    }
                    break;

                case 3:

                    Support.WriteCol("--- Dodawanie samochodu do bazy ---", "G");
                    Console.WriteLine();
                    cars.Add();
                    ifData = true;
                    break;

                case 4:

                    Support.WriteCol("--- Usuwanie samochodu z bazy ---", "G");
                    Console.WriteLine();
                    if (ifData)
                    {
                        cars.Remove(cars.Search());
                    }
                    else
                    {
                        Support.WriteCol("Brak danych w bazie", "DY");
                    }
                    break;

                case 5:

                    Support.WriteCol("--- Wszystkie samochody ---", "G");
                    Console.WriteLine();
                    cars.PrintAll();
                    break;

                case 6:

                    Support.WriteCol("--- Warunowa lista samochodow ---", "G");
                    Console.WriteLine();
                    if (ifData)
                    {
                        cars.PrintConditional(Menu.ConditionalList());
                    }
                    else
                    {
                        Support.WriteCol("Brak danych w bazie", "DY");
                    }
                    break;

                case 7:

                    Support.WriteCol("--- Wyszukiwanie samochodu ---", "G");
                    Console.WriteLine();
                    if (ifData)
                    {
                        cars.Search();
                    }
                    else
                    {
                        Support.WriteCol("Brak danych w bazie", "DY");
                    }
                    break;

                case 8:

                    Support.WriteCol("--- Posortowana lista samochodow ---", "G");
                    Console.WriteLine();
                    if (ifData)
                    {
                        cars.PrintSorted(Menu.SortingList(), Menu.SortingDeOrIn());
                    }
                    else
                    {
                        Support.WriteCol("Brak danych w bazie", "DY");
                    }
                    break;

                case 9:

                    return;
                }
                Support.PressEnter();
            }
        }