Ejemplo n.º 1
0
        public static void INIT_Radiation(ref bool LGEOM, ref bool LGEOMW, ref bool LGEOMR, ref int ISTUD, ref double AMIND,
                                          ref int IMIND, ref double ASECD, ref int ISECD, List <int>[] Month_List)
        {
            int NX_Radiat_Guess = Math.Max(NX / 4, 3 * nr_cell_smooth);
            int NY_Radiat_Guess = Math.Max(NY / 4, 3 * nr_cell_smooth);

            Program.ISOL           = 1;    // thin clouds -> default value
            Solar_reduction_factor = 1.0F; // full solar radiation = default value

            if (((METEO == "Y") || (METEO == "y")) && (Program.ISTAT == 0))
            {
                if (IMETSTR == 1)
                {
                    LGEOM   = false;
                    LGEOMW  = false;
                    LGEOMR  = false;
                    IMETSTR = 1;
                }
                else
                {
                    LGEOM  = true;
                    LGEOMW = true;
                    LGEOMR = false;
                }
                if (ISTAT == 0)
                {
                    //option: dynamic sun rise for convective classes (1-3)
                    if (Program.meteopgt_nr > 0)
                    {
                        if (AKLA == 1)
                        {
                            ITAG = 21;
                            if (BGRAD > 0)
                            {
                                IMON = 6;
                            }
                            else
                            {
                                IMON = 12;
                            }
                            IJAHR = 2006;
                            ISTU  = 6;
                            IMIN  = 0;

                            int   month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                            bool  exit          = false;
                            float rsolg_max     = 0;

                            //find the month and time of the year, where the radiation equals xx W/m? as required by SC 1
                            foreach (int imonth_var in Month_List[month_setting])
                            {
                                for (int iday_var = 6; iday_var < 26; iday_var += 2)
                                {
                                    float rsolg_daymax = 0;
                                    for (int istu_var = 4; istu_var < 14; istu_var += 2)
                                    {
                                        TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                        ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                        AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                        IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                        ASECD  = (AMIND - (float)IMIND) * 60;
                                        ISECD  = Convert.ToInt32(Math.Floor(ASECD));

                                        RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, NX_Radiat_Guess, NY_Radiat_Guess, 3);
                                        Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                        Console.SetCursorPosition(0, Console.CursorTop);

                                        float rsolg_mean = Mean_Array_Value(GLOBRAD, NX_Radiat_Guess, NY_Radiat_Guess);
                                        rsolg_daymax = Math.Max(rsolg_daymax, rsolg_mean);

                                        if (Windspeed_meteopgt <= 2)
                                        {
                                            if (rsolg_mean > 800)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if (Windspeed_meteopgt > 2)
                                        {
                                            if (rsolg_mean > 950)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                    }

                                    // find the day with the max. radiation
                                    rsolg_max = Math.Max(rsolg_max, rsolg_daymax);
                                    if ((rsolg_daymax + 1) < rsolg_max)
                                    {
                                        ISTU     = 12;
                                        ITAG     = iday_var;
                                        IMON     = imonth_var;
                                        iday_var = 31;
                                        exit     = true;
                                    }
                                }
                                if (exit)
                                {
                                    break;
                                }
                            }
                            //reset hour to 6 o'clock as the sun rises dynamically
                            ISTU = 6;
                        }
                        else if (AKLA == 2)
                        {
                            ITAG  = 21;
                            IMON  = 3;
                            IJAHR = 2006;
                            ISTU  = 6;
                            IMIN  = 0;

                            int  month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                            bool exit          = false;

                            //find the month and time of the year, where the radiation equals xx W/m? as required by SC 2
                            foreach (int imonth_var in Month_List[month_setting])
                            {
                                for (int iday_var = 1; iday_var < 29; iday_var += 2)
                                {
                                    for (int istu_var = 4; istu_var < 14; istu_var += 2)
                                    {
                                        TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                        ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                        AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                        IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                        ASECD  = (AMIND - (float)IMIND) * 60;
                                        ISECD  = Convert.ToInt32(Math.Floor(ASECD));

                                        RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, NX_Radiat_Guess, NY_Radiat_Guess, 3);
                                        Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                        Console.SetCursorPosition(0, Console.CursorTop);

                                        float rsolg_mean = Mean_Array_Value(GLOBRAD, NX_Radiat_Guess, NY_Radiat_Guess);

                                        if (Windspeed_meteopgt <= 2)
                                        {
                                            if ((rsolg_mean > 200) && (rsolg_mean <= 600))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if ((Windspeed_meteopgt > 2) && (Windspeed_meteopgt <= 3))
                                        {
                                            if ((rsolg_mean > 690) && (rsolg_mean <= 900))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if (Windspeed_meteopgt > 3)
                                        {
                                            if (rsolg_mean > 690)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (exit)
                                {
                                    break;
                                }
                            }

                            //reset hour to 12 o'clock as the sun goes down dynamically
                            ISTU = 12;
                        }
                        else if (AKLA == 3)
                        {
                            ITAG  = 21;
                            IMON  = 3;
                            IJAHR = 2006;
                            ISTU  = 6;
                            IMIN  = 0;

                            int  month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                            bool exit          = false;

                            //find the month and time of the year, where the radiation equals xx W/m? as required by SC 3
                            foreach (int imonth_var in Month_List[month_setting])
                            {
                                for (int iday_var = 1; iday_var < 29; iday_var += 2)
                                {
                                    for (int istu_var = 4; istu_var < 13; istu_var += 2)
                                    {
                                        TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                        ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                        AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                        IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                        ASECD  = (AMIND - (float)IMIND) * 60;
                                        ISECD  = Convert.ToInt32(Math.Floor(ASECD));
                                        RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, 3, 3, 3);
                                        Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                        Console.SetCursorPosition(0, Console.CursorTop);

                                        if (Windspeed_meteopgt <= 2)
                                        {
                                            if ((GLOBRAD[2][2] > 100) && (GLOBRAD[2][2] <= 200))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if ((Windspeed_meteopgt > 2) && (Windspeed_meteopgt <= 3))
                                        {
                                            if ((GLOBRAD[2][2] > 150) && (GLOBRAD[2][2] <= 650))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if ((Windspeed_meteopgt > 3) && (Windspeed_meteopgt <= 5))
                                        {
                                            if ((GLOBRAD[2][2] > 180) && (GLOBRAD[2][2] <= 650))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if (Windspeed_meteopgt > 5)
                                        {
                                            if (GLOBRAD[2][2] > 900)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (exit)
                                {
                                    break;
                                }
                            }

                            //reset hour to 9 o'clock as the sun proceedes dynamically
                            ISTU = 9;
                        }
                    } // option dynamic sunrise end
                    else
                    {
                        if (AKLA == 1)
                        {
                            ITAG = 21;
                            if (BGRAD > 0)
                            {
                                IMON = 6;
                            }
                            else
                            {
                                IMON = 12;
                            }
                            IJAHR = 2006;
                            ISTU  = 12;
                            IMIN  = 0;

                            int   month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                            bool  exit          = false;
                            float rsolg_max     = 0;

                            //find the month and time of the year, where the radiation equals xx W/m? as required by SC 1
                            foreach (int imonth_var in Month_List[month_setting])
                            {
                                for (int iday_var = 6; iday_var < 26; iday_var += 2)
                                {
                                    float rsolg_daymax = 0;
                                    for (int istu_var = 4; istu_var < 14; istu_var += 2)
                                    {
                                        TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                        ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                        AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                        IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                        ASECD  = (AMIND - (float)IMIND) * 60;
                                        ISECD  = Convert.ToInt32(Math.Floor(ASECD));
                                        RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, NX_Radiat_Guess, NY_Radiat_Guess, 3);
                                        Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                        Console.SetCursorPosition(0, Console.CursorTop);

                                        float rsolg_mean = Mean_Array_Value(GLOBRAD, NX_Radiat_Guess, NY_Radiat_Guess);
                                        rsolg_daymax = Math.Max(rsolg_daymax, rsolg_mean);

                                        if (Windspeed_meteopgt <= 2)
                                        {
                                            if (rsolg_mean > 800)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if (Windspeed_meteopgt > 2)
                                        {
                                            if (rsolg_mean > 950)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                    }

                                    // find the day with the max. radiation
                                    rsolg_max = Math.Max(rsolg_max, rsolg_daymax);
                                    if ((rsolg_daymax + 1) < rsolg_max)
                                    {
                                        ISTU     = 12;
                                        ITAG     = iday_var;
                                        IMON     = imonth_var;
                                        iday_var = 31;
                                        exit     = true;
                                    }
                                }
                                if (exit)
                                {
                                    break;
                                }
                            }
                        }
                        else if (AKLA == 2)
                        {
                            ITAG  = 21;
                            IMON  = 3;
                            IJAHR = 2006;
                            ISTU  = 12;
                            IMIN  = 0;

                            int  month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                            bool exit          = false;

                            //find the month and time of the year, where the radiation equals xx W/m? as required by SC 2
                            foreach (int imonth_var in Month_List[month_setting])
                            {
                                for (int iday_var = 1; iday_var < 29; iday_var += 2)
                                {
                                    for (int istu_var = 4; istu_var < 14; istu_var += 2)
                                    {
                                        TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                        ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                        AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                        IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                        ASECD  = (AMIND - (float)IMIND) * 60;
                                        ISECD  = Convert.ToInt32(Math.Floor(ASECD));

                                        RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, NX_Radiat_Guess, NY_Radiat_Guess, 3);
                                        Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                        Console.SetCursorPosition(0, Console.CursorTop);

                                        float rsolg_mean = Mean_Array_Value(GLOBRAD, NX_Radiat_Guess, NY_Radiat_Guess);

                                        if (Windspeed_meteopgt <= 2)
                                        {
                                            if ((rsolg_mean > 200) && (rsolg_mean <= 600))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if ((Windspeed_meteopgt > 2) && (Windspeed_meteopgt <= 3))
                                        {
                                            if ((rsolg_mean > 690) && (rsolg_mean <= 900))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if (Windspeed_meteopgt > 3)
                                        {
                                            if (rsolg_mean > 690)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (exit)
                                {
                                    break;
                                }
                            }
                        }
                        else if (AKLA == 3)
                        {
                            ITAG  = 21;
                            IMON  = 3;
                            IJAHR = 2006;
                            ISTU  = 10;
                            IMIN  = 0;

                            int  month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                            bool exit          = false;

                            //find the month and time of the year, where the radiation equals xx W/m? as required by SC 3
                            foreach (int imonth_var in Month_List[month_setting])
                            {
                                for (int iday_var = 1; iday_var < 29; iday_var += 2)
                                {
                                    for (int istu_var = 4; istu_var < 13; istu_var += 2)
                                    {
                                        TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                        ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                        AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                        IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                        ASECD  = (AMIND - (float)IMIND) * 60;
                                        ISECD  = Convert.ToInt32(Math.Floor(ASECD));
                                        RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, 3, 3, 3);
                                        Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                        Console.SetCursorPosition(0, Console.CursorTop);

                                        if (Windspeed_meteopgt <= 2)
                                        {
                                            if ((GLOBRAD[2][2] > 100) && (GLOBRAD[2][2] <= 200))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if ((Windspeed_meteopgt > 2) && (Windspeed_meteopgt <= 3))
                                        {
                                            if ((GLOBRAD[2][2] > 150) && (GLOBRAD[2][2] <= 650))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if ((Windspeed_meteopgt > 3) && (Windspeed_meteopgt <= 5))
                                        {
                                            if ((GLOBRAD[2][2] > 180) && (GLOBRAD[2][2] <= 650))
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                        else if (Windspeed_meteopgt > 5)
                                        {
                                            if (GLOBRAD[2][2] > 900)
                                            {
                                                ISTU     = istu_var;
                                                ITAG     = iday_var;
                                                IMON     = imonth_var;
                                                iday_var = 31;
                                                exit     = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (exit)
                                {
                                    break;
                                }
                            }
                        }
                    } // option dynamic sunrise

                    if (AKLA == 4)
                    {
                        ITAG                   = 21;
                        IMON                   = 3;
                        IJAHR                  = 2006;
                        ISTU                   = 12;
                        IMIN                   = 0;
                        Program.ISOL           = 2;    // 04/07/2018 Kuntner: thick clouds + lower solar radiation
                        Solar_reduction_factor = 0.1F; // try with reduced solar radiation

                        int  month_setting = set_month_type(Windspeed_meteopgt, AKLA, BGRAD);
                        bool exit          = false;

                        //find the month and time of the year, where the radiation equals 100 W/m? as required by SC 4
                        foreach (int imonth_var in Month_List[month_setting])
                        {
                            for (int iday_var = 1; iday_var < 29; iday_var += 2)
                            {
                                for (int istu_var = 1; istu_var < 16; istu_var += 2)
                                {
                                    TJETZT = (float)istu_var * 3600 + (float)IMIN * 60;
                                    ISTUD  = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                                    AMIND  = (TJETZT / 3600 - (float)istu_var) * 60;
                                    IMIND  = Convert.ToInt32(Math.Floor(AMIND));
                                    ASECD  = (AMIND - (float)IMIND) * 60;
                                    ISECD  = Convert.ToInt32(Math.Floor(ASECD));
                                    RadiationModel.RADIATRAD(LGEOM, false, false, iday_var, imonth_var, IJAHR, TJETZT, NX_Radiat_Guess, NY_Radiat_Guess, 3);
                                    Console.Write(iday_var.ToString() + "." + imonth_var.ToString() + "  -  " + istu_var.ToString() + ":00        ");
                                    Console.SetCursorPosition(0, Console.CursorTop);

                                    float rsolg_mean = Mean_Array_Value(GLOBRAD, NX_Radiat_Guess, NY_Radiat_Guess);

                                    if ((rsolg_mean > 45) && (rsolg_mean <= 150))
                                    {
                                        ISTU     = istu_var;
                                        ITAG     = iday_var;
                                        IMON     = imonth_var;
                                        iday_var = 31;
                                        istu_var = 16;
                                        exit     = true;
                                        break;
                                    }
                                }
                                if (Solar_reduction_factor < 0.95F) // found no situation -> increase solar_reduction_factor
                                {
                                    Solar_reduction_factor += 0.05F;
                                }
                            }
                            if (exit)
                            {
                                break;
                            }
                        }
                    }
                    else if (AKLA == 5)
                    {
                        ITAG  = 21;
                        IMON  = 12;
                        IJAHR = 2006;
                        ISTU  = 18;
                        IMIN  = 0;
                    }
                    else if (AKLA == 6)
                    {
                        ITAG  = 21;
                        IMON  = 12;
                        IJAHR = 2006;
                        ISTU  = 18;
                        IMIN  = 0;
                    }
                    else if (AKLA == 7)
                    {
                        ITAG  = 21;
                        IMON  = 12;
                        IJAHR = 2006;
                        ISTU  = 18;
                        IMIN  = 0;
                    }
                }
                TJETZT = (float)ISTU * 3600 + (float)IMIN * 60;
                Console.WriteLine("  ** STR **                                ");
                ISTUD = Convert.ToInt32(Math.Floor((TJETZT + 10) / 3600d));
                AMIND = (TJETZT / 3600 - (float)ISTUD) * 60;
                IMIND = Convert.ToInt32(Math.Floor(AMIND));
                ASECD = (AMIND - (float)IMIND) * 60;
                ISECD = Convert.ToInt32(Math.Floor(ASECD));
                RadiationModel.RADIATRAD(LGEOM, LGEOMW, LGEOMR, ITAG, IMON, IJAHR, TJETZT, NX, NY, NZ);
            }
        }
Ejemplo n.º 2
0
        ///<summary> Add radiation sub-panel, including tooltips </summary>
        private static void AddSubPanelRadiation(Panel p)
        {
            // get first radiation rule
            // - guaranteed to exist, as this panel is not rendered if it doesn't
            // - even without crew, it is safe to evaluate the modifiers that use it
            Rule rule = Profile.rules.Find(k => k.modifiers.Contains("radiation"));

            // detect if it use shielding
            bool use_shielding = rule.modifiers.Contains("shielding");

            // calculate various radiation levels
            double[] levels = new[]
            {
                Math.Max(Radiation.Nominal, (env_analyzer.surface_rad + vessel_analyzer.emitted)),                        // surface
                Math.Max(Radiation.Nominal, (env_analyzer.magnetopause_rad + vessel_analyzer.emitted)),                   // inside magnetopause
                Math.Max(Radiation.Nominal, (env_analyzer.inner_rad + vessel_analyzer.emitted)),                          // inside inner belt
                Math.Max(Radiation.Nominal, (env_analyzer.outer_rad + vessel_analyzer.emitted)),                          // inside outer belt
                Math.Max(Radiation.Nominal, (env_analyzer.heliopause_rad + vessel_analyzer.emitted)),                     // interplanetary
                Math.Max(Radiation.Nominal, (env_analyzer.extern_rad + vessel_analyzer.emitted)),                         // interstellar
                Math.Max(Radiation.Nominal, (env_analyzer.storm_rad + vessel_analyzer.emitted))                           // storm
            };

            // evaluate modifiers (except radiation)
            List <string> modifiers_except_radiation = new List <string>();

            foreach (string s in rule.modifiers)
            {
                if (s != "radiation")
                {
                    modifiers_except_radiation.Add(s);
                }
            }
            double mod = Modifiers.Evaluate(env_analyzer, vessel_analyzer, resource_sim, modifiers_except_radiation);

            // calculate life expectancy at various radiation levels
            double[] estimates = new double[7];
            for (int i = 0; i < 7; ++i)
            {
                estimates[i] = rule.fatal_threshold / (rule.degeneration * mod * levels[i]);
            }

            // generate tooltip
            RadiationModel mf      = Radiation.Info(env_analyzer.body).model;
            string         tooltip = Lib.BuildString
                                     (
                "<align=left />",
                String.Format("{0,-20}\t<b>{1}</b>\n", Local.Planner_surface, Lib.HumanReadableDuration(estimates[0])),                          //"surface"
                mf.has_pause ? String.Format("{0,-20}\t<b>{1}</b>\n", Local.Planner_magnetopause, Lib.HumanReadableDuration(estimates[1])) : "", //"magnetopause"
                mf.has_inner ? String.Format("{0,-20}\t<b>{1}</b>\n", Local.Planner_innerbelt, Lib.HumanReadableDuration(estimates[2])) : "",    //"inner belt"
                mf.has_outer ? String.Format("{0,-20}\t<b>{1}</b>\n", Local.Planner_outerbelt, Lib.HumanReadableDuration(estimates[3])) : "",    //"outer belt"
                String.Format("{0,-20}\t<b>{1}</b>\n", Local.Planner_interplanetary, Lib.HumanReadableDuration(estimates[4])),                   //"interplanetary"
                String.Format("{0,-20}\t<b>{1}</b>\n", Local.Planner_interstellar, Lib.HumanReadableDuration(estimates[5])),                     //"interstellar"
                String.Format("{0,-20}\t<b>{1}</b>", Local.Planner_storm, Lib.HumanReadableDuration(estimates[6]))                               //"storm"
                                     );

            // render the panel
            p.AddSection(Local.Planner_RADIATION, string.Empty,            //"RADIATION"
                         () => { p.Prev(ref special_index, panel_special.Count); enforceUpdate = true; },
                         () => { p.Next(ref special_index, panel_special.Count); enforceUpdate = true; });
            p.AddContent(Local.Planner_surface, Lib.HumanReadableRadiation(env_analyzer.surface_rad + vessel_analyzer.emitted), tooltip); //"surface"
            p.AddContent(Local.Planner_orbit, Lib.HumanReadableRadiation(env_analyzer.magnetopause_rad), tooltip);                        //"orbit"
            if (vessel_analyzer.emitted >= 0.0)
            {
                p.AddContent(Local.Planner_emission, Lib.HumanReadableRadiation(vessel_analyzer.emitted), tooltip);                //"emission"
            }
            else
            {
                p.AddContent(Local.Planner_activeshielding, Lib.HumanReadableRadiation(-vessel_analyzer.emitted), tooltip);                                        //"active shielding"
            }
            p.AddContent(Local.Planner_shielding, rule.modifiers.Contains("shielding") ? Habitat.Shielding_to_string(vessel_analyzer.shielding) : "N/A", tooltip); //"shielding"
        }