Exemplo n.º 1
0
        public static string FormatEntryAngles(TotalSunHeat data)
        {
            var sb       = new StringBuilder();
            var sbHour   = new StringBuilder();
            var sbVal    = new StringBuilder();
            var listData = data.CalculateEntryAngleForAll();



            sb.AppendLine(">>Overzicht hellingshoeken: ");
            foreach (var dat in listData)
            {
                sb.AppendFormat(">>Alpha: {0}\n", TotalSunHeat.CalculateRadianToDegree(dat.Item1));
                sb.AppendFormat(">>WandAzimuth: {0}\n", dat.Item2);
                var list = dat.Item3;
                sbHour = new StringBuilder();
                sbVal  = new StringBuilder();
                sbHour.AppendFormat("|{0,13}|", "uur");
                sbVal.AppendFormat("|{0,13}|", "invals hoek");
                foreach (var yeet in list)
                {
                    sbHour.AppendFormat("|{0,8}|", yeet[0]);
                    sbVal.AppendFormat("|{0,8:N2}|", TotalSunHeat.CalculateRadianToDegree(yeet[1]));
                }

                sb.AppendLine(sbHour.ToString());
                sb.AppendLine(sbVal.ToString());
                sb.Append("\n");
                sb.Append("\n");
            }

            return(sb.ToString());
        }
Exemplo n.º 2
0
        public void TestRadianToAngleConversion()
        {
            var input = new DataInput();

            input.Date            = DateTime.ParseExact("15-08-2019", "dd-MM-yyyy", CultureInfo.InvariantCulture);
            input.GeoGraphicWidth = 52.0;
            var calc = new TotalSunHeat(input);

            Assert.Equal(57.2958, TotalSunHeat.CalculateRadianToDegree(1), 4);
        }
Exemplo n.º 3
0
        public void TestSunheatStraightOOnSurface()
        {
            var input = new DataInput();

            input.Date            = DateTime.ParseExact("15-08-2019", "dd-MM-yyyy", CultureInfo.InvariantCulture);
            input.GeoGraphicWidth = 52.0;
            var calc = new TotalSunHeat(input);

            Assert.Equal(52.1, TotalSunHeat.CalculateRadianToDegree(calc.CalculateSunHeight(12)), 1);
            Assert.Equal(854.5, calc.CalculateQdirN(12), 1);
        }
Exemplo n.º 4
0
        private int GenerateTotal(int rowIndex, ISheet sheet)
        {
            rowIndex++;
            rowIndex++;
            var row13 = sheet.CreateRow(rowIndex);

            row13.CreateCell(0).SetCellValue("overzicht totaal");
            rowIndex++;
            rowIndex++;

            var list = _calc.CalculateTotal();


            foreach (var data in list)
            {
                var alpha = sheet.CreateRow(rowIndex);
                alpha.CreateCell(0).SetCellValue("Alpha");
                alpha.CreateCell(1).SetCellValue(TotalSunHeat.CalculateRadianToDegree(data.Item1));

                rowIndex++;

                var wandAzimuth = sheet.CreateRow(rowIndex);
                wandAzimuth.CreateCell(0).SetCellValue("wand azimuth");
                wandAzimuth.CreateCell(1).SetCellValue(data.Item2);

                rowIndex++;
                int col_hoogte_zon = 2;
                var uur            = sheet.CreateRow(rowIndex);
                uur.CreateCell(0).SetCellValue("uur");
                uur.CreateCell(1).SetCellValue("uur");

                rowIndex++;
                var Qz = sheet.CreateRow(rowIndex);
                Qz.CreateCell(0).SetCellValue("Qz");
                Qz.CreateCell(1).SetCellValue("graden");


                foreach (var yeet in data.Item3)
                {
                    uur.CreateCell(col_hoogte_zon).SetCellValue(yeet.Item1);
                    Qz.CreateCell(col_hoogte_zon).SetCellValue(yeet.Item2);

                    col_hoogte_zon++;
                }

                rowIndex++;
                rowIndex++;
            }


            return(rowIndex);
        }
Exemplo n.º 5
0
        public static string FormatSunRayOnTilted(TotalSunHeat data)
        {
            var sb = new StringBuilder();

            var listData = data.CalculateSunRayOnTiltedScreen();


            sb.AppendLine(">>Overzicht zonnestraling op scheef vlak: ");
            foreach (var dat in listData)
            {
                var sbAwaplhaComb = new StringBuilder();
                var aplh          = dat.Item1;
                var Aw            = dat.Item2;
                sbAwaplhaComb.AppendLine(">>aplha: " + TotalSunHeat.CalculateRadianToDegree(aplh));
                sbAwaplhaComb.AppendLine(">>Aw: " + Aw);

                var list = dat.Item3;

                var sbHour = new StringBuilder();
                var sbVal  = new StringBuilder();
                var sbVal2 = new StringBuilder();
                var sbVal3 = new StringBuilder();

                sbHour.AppendFormat("|{0,13}|", "uur");
                sbVal.AppendFormat("|{0,13}|", "Qdir");
                sbVal2.AppendFormat("|{0,13}|", "Qhem");
                sbVal3.AppendFormat("|{0,13}|", "Qgr");
                foreach (var tuple in list)
                {
                    sbHour.AppendFormat("|{0,8}|", +tuple.Item1);
                    sbVal.AppendFormat("|{0,8:N2}|", tuple.Item2);
                    sbVal2.AppendFormat("|{0,8:N2}|", tuple.Item3);
                    sbVal3.AppendFormat("|{0,8:N2}|", tuple.Item4);
                }

                sbAwaplhaComb.AppendLine(sbHour.ToString());
                sbAwaplhaComb.AppendLine(sbVal.ToString());
                sbAwaplhaComb.AppendLine(sbVal2.ToString());
                sbAwaplhaComb.AppendLine(sbVal3.ToString());
                sbAwaplhaComb.AppendLine();


                sb.Append(sbAwaplhaComb.ToString());
            }

            sb.Append("\n");
            return(sb.ToString());
        }
Exemplo n.º 6
0
        private int GenerateHellAngle(int rowIndex, ISheet sheet)
        {
            var row13 = sheet.CreateRow(rowIndex);

            row13.CreateCell(0).SetCellValue("overzicht hellingshoeken");
            rowIndex++;
            rowIndex++;

            var list = _calc.CalculateEntryAngleForAll();


            foreach (var data in list)
            {
                var alpha = sheet.CreateRow(rowIndex);
                alpha.CreateCell(0).SetCellValue("Alpha");
                alpha.CreateCell(1).SetCellValue(TotalSunHeat.CalculateRadianToDegree(data.Item1));

                rowIndex++;

                var wandAzimuth = sheet.CreateRow(rowIndex);
                wandAzimuth.CreateCell(0).SetCellValue("wand azimuth");
                wandAzimuth.CreateCell(1).SetCellValue(data.Item2);

                rowIndex++;
                int col_hoogte_zon = 2;
                var uur            = sheet.CreateRow(rowIndex);
                uur.CreateCell(0).SetCellValue("uur");
                uur.CreateCell(1).SetCellValue("uur");
                rowIndex++;
                var zonnehoogte = sheet.CreateRow(rowIndex);
                zonnehoogte.CreateCell(0).SetCellValue("zonnehoogte");
                rowIndex++;
                zonnehoogte.CreateCell(1).SetCellValue("graden");
                foreach (var yeet in data.Item3)
                {
                    uur.CreateCell(col_hoogte_zon).SetCellValue(yeet[0]);
                    zonnehoogte.CreateCell(col_hoogte_zon).SetCellValue(TotalSunHeat.CalculateRadianToDegree(yeet[1]));

                    col_hoogte_zon++;
                }

                rowIndex++;
                rowIndex++;
            }

            return(rowIndex);
        }
Exemplo n.º 7
0
        public static string FormatTotal(TotalSunHeat data)
        {
            var sb = new StringBuilder();

            var listData = data.CalculateTotal();


            sb.AppendLine(">>Totaal Qz1: ");
            foreach (var dat in listData)
            {
                var sbAwaplhaComb = new StringBuilder();
                var aplh          = dat.Item1;
                var Aw            = dat.Item2;
                sbAwaplhaComb.AppendLine(">>aplha: " + TotalSunHeat.CalculateRadianToDegree(aplh));
                sbAwaplhaComb.AppendLine(">>Aw: " + Aw);

                var list = dat.Item3;

                var sbHour = new StringBuilder();
                var sbVal  = new StringBuilder();

                sbHour.AppendFormat("|{0,13}|", "uur");
                sbVal.AppendFormat("|{0,13}|", "Qz");
                foreach (var tuple in list)
                {
                    sbHour.AppendFormat("|{0,8}|", +tuple.Item1);
                    sbVal.AppendFormat("|{0,8:N2}|", tuple.Item2);
                }

                sbAwaplhaComb.AppendLine(sbHour.ToString());
                sbAwaplhaComb.AppendLine(sbVal.ToString());
                sbAwaplhaComb.AppendLine();


                sb.Append(sbAwaplhaComb.ToString());
            }

            sb.Append("\n");
            return(sb.ToString());
        }
Exemplo n.º 8
0
        public void Generate()
        {
            var sheet = workbook.CreateSheet("straling warmte" + _input.Date.ToShortDateString().Replace("/", "-"));

            var rowIndex = 0;
            var row      = sheet.CreateRow(rowIndex);

            row.CreateCell(0).SetCellValue("Generated by Whizx-It");
            row.CreateCell(3).SetCellValue("Version: V1.01");
            row.CreateCell(5).SetCellValue("contact: [email protected]");
            rowIndex++;
            rowIndex++;
            rowIndex++;
            var row1 = sheet.CreateRow(rowIndex);

            row1.CreateCell(0).SetCellValue("in gegeven data");
            rowIndex++;
            var row2 = sheet.CreateRow(rowIndex);

            row2.CreateCell(0).SetCellValue("Datum: ");
            row2.CreateCell(1).SetCellValue(_input.Date.ToShortDateString());
            rowIndex++;
            var row3 = sheet.CreateRow(rowIndex);

            row3.CreateCell(0).SetCellValue("GeoBreedte: ");
            row3.CreateCell(1).SetCellValue(_input.GeoGraphicWidth);
            row3.CreateCell(2).SetCellValue("graden");
            rowIndex++;
            var row4 = sheet.CreateRow(rowIndex);

            row4.CreateCell(0).SetCellValue("Rs: ");
            row4.CreateCell(1).SetCellValue(_input.Rs);
            rowIndex++;
            rowIndex++;
            var row5 = sheet.CreateRow(rowIndex);

            row5.CreateCell(0).SetCellValue("Hellings hoeken");
            rowIndex++;
            var row6 = sheet.CreateRow(rowIndex);

            row6.CreateCell(0).SetCellValue("nummer");
            row6.CreateCell(1).SetCellValue("graden");
            row6.CreateCell(3).SetCellValue("radialen");
            int ctrHel = 1;

            foreach (var hellHoek in _input.AlphaListInRadial)
            {
                rowIndex++;
                var tempRow = sheet.CreateRow(rowIndex);
                tempRow.CreateCell(0).SetCellValue(ctrHel);
                tempRow.CreateCell(1).SetCellValue(TotalSunHeat.CalculateRadianToDegree(hellHoek));
                tempRow.CreateCell(2).SetCellValue(hellHoek);
                ctrHel++;
            }

            rowIndex++;
            rowIndex++;


            var row7 = sheet.CreateRow(rowIndex);

            row7.CreateCell(0).SetCellValue("Wand mazimuth");
            rowIndex++;
            var row8 = sheet.CreateRow(rowIndex);

            row8.CreateCell(0).SetCellValue("nummer");
            row8.CreateCell(1).SetCellValue("graden");
            row8.CreateCell(3).SetCellValue("radialen");
            int ctrMaz = 1;

            foreach (var mazHoek in _input.WallAzimuthListInDegrees)
            {
                rowIndex++;
                var tempRow = sheet.CreateRow(rowIndex);
                tempRow.CreateCell(0).SetCellValue(ctrMaz);
                tempRow.CreateCell(1).SetCellValue(mazHoek);
                tempRow.CreateCell(3).SetCellValue(TotalSunHeat.CalculateDegreeToRadian(mazHoek));
                ctrMaz++;
            }

            rowIndex++;
            rowIndex++;
            rowIndex++;
            rowIndex++;


            var row9 = sheet.CreateRow(rowIndex);

            row9.CreateCell(0).SetCellValue("Berekende data");
            rowIndex++;
            rowIndex++;

            var row10 = sheet.CreateRow(rowIndex);

            row10.CreateCell(0).SetCellValue("Berekende data");

            const string eenheidWattsqr = "Watt/m²";

            var row11 = sheet.CreateRow(rowIndex);

            row11.CreateCell(0).SetCellValue("Qdir_0");
            row11.CreateCell(1).SetCellValue(_calc.CalculateQDIR0());
            row11.CreateCell(2).SetCellValue(eenheidWattsqr);
            rowIndex++;


            var row12 = sheet.CreateRow(rowIndex);

            row12.CreateCell(0).SetCellValue("Declinatie");
            row12.CreateCell(1).SetCellValue(_calc.CalculateDeclination());
            row12.CreateCell(2).SetCellValue("graden");
            rowIndex++;
            rowIndex++;
            rowIndex++;

/*
 *          var row13 = sheet.CreateRow(rowIndex);
 *          row13.CreateCell(0).SetCellValue("Hoogtezon");
 *          rowIndex++;
 *          rowIndex++;
 *
 *          var list = _calc.CalculateDataForDay();
 *
 *          var uur = sheet.CreateRow(rowIndex);
 *          uur.CreateCell(0).SetCellValue("uur");
 *          uur.CreateCell(1).SetCellValue("uur");
 *          rowIndex++;
 *          var zonnehoogte = sheet.CreateRow(rowIndex);
 *          zonnehoogte.CreateCell(0).SetCellValue("zonnehoogte");
 *          zonnehoogte.CreateCell(1).SetCellValue("graden");
 *          rowIndex++;
 *          var qdirn = sheet.CreateRow(rowIndex);
 *          qdirn.CreateCell(0).SetCellValue("Qdir_n");
 *          qdirn.CreateCell(1).SetCellValue(eenheidWattsqr);
 *          rowIndex++;
 *          var azimuth = sheet.CreateRow(rowIndex);
 *          azimuth.CreateCell(0).SetCellValue("zonsAzimuth");
 *          azimuth.CreateCell(1).SetCellValue("graden");
 *          rowIndex++;
 *          int col_hoogte_zon = 2;
 *          foreach (var data in list)
 *          {
 *              uur.CreateCell(col_hoogte_zon).SetCellValue(data.Item1);
 *              zonnehoogte.CreateCell(col_hoogte_zon).SetCellValue(data.Item2);
 *              qdirn.CreateCell(col_hoogte_zon).SetCellValue(data.Item3);
 *              azimuth.CreateCell(col_hoogte_zon).SetCellValue(data.Item4);
 *              col_hoogte_zon++;
 *          }
 *
 *          rowIndex++;
 *          rowIndex++;
 *          rowIndex++;*/
            //rowIndex = GenerateHellAngle(rowIndex, sheet);
            //rowIndex = GenerateHellHorizontal(rowIndex, sheet);
            //rowIndex = GenerateHellVertical(rowIndex, sheet);
            //rowIndex = GenerateHelltilted(rowIndex, sheet);
            rowIndex = GenerateTotal(rowIndex, sheet);
        }
Exemplo n.º 9
0
        private int GenerateHelltilted(int rowIndex, ISheet sheet)
        {
            rowIndex++;
            rowIndex++;
            var row13 = sheet.CreateRow(rowIndex);

            row13.CreateCell(0).SetCellValue("overzicht scheef vlak");
            rowIndex++;
            rowIndex++;

            var list = _calc.CalculateSunRayOnTiltedScreen();


            foreach (var data in list)
            {
                var alpha = sheet.CreateRow(rowIndex);
                alpha.CreateCell(0).SetCellValue("Alpha");
                alpha.CreateCell(1).SetCellValue(TotalSunHeat.CalculateRadianToDegree(data.Item1));

                rowIndex++;

                var wandAzimuth = sheet.CreateRow(rowIndex);
                wandAzimuth.CreateCell(0).SetCellValue("wand azimuth");
                wandAzimuth.CreateCell(1).SetCellValue(data.Item2);

                rowIndex++;
                int col_hoogte_zon = 2;
                var uur            = sheet.CreateRow(rowIndex);
                uur.CreateCell(0).SetCellValue("uur");
                uur.CreateCell(1).SetCellValue("uur");

                rowIndex++;
                var Qdirv = sheet.CreateRow(rowIndex);
                Qdirv.CreateCell(0).SetCellValue("Qdir");
                Qdirv.CreateCell(1).SetCellValue("graden");


                rowIndex++;
                var QhemV = sheet.CreateRow(rowIndex);
                QhemV.CreateCell(0).SetCellValue("Qhem");
                QhemV.CreateCell(1).SetCellValue("eenheid");

                rowIndex++;
                var Qgrv = sheet.CreateRow(rowIndex);
                Qgrv.CreateCell(0).SetCellValue("Qgr");
                Qgrv.CreateCell(1).SetCellValue("eenheid");


                foreach (var yeet in data.Item3)
                {
                    uur.CreateCell(col_hoogte_zon).SetCellValue(yeet.Item1);
                    Qdirv.CreateCell(col_hoogte_zon).SetCellValue(yeet.Item2);
                    QhemV.CreateCell(col_hoogte_zon).SetCellValue(yeet.Item3);
                    Qgrv.CreateCell(col_hoogte_zon).SetCellValue(yeet.Item4);

                    col_hoogte_zon++;
                }

                rowIndex++;
                rowIndex++;
            }


            return(rowIndex);
        }