public static string FormatHeightOfSun(TotalSunHeat data) { var sbHour = new StringBuilder(); sbHour.AppendFormat("|{0,13}|", "uur"); var sbValue = new StringBuilder(); sbValue.AppendFormat("|{0,13}|", "zonnehoogte"); var sbQdirn = new StringBuilder(); sbQdirn.AppendFormat("|{0,13}|", "qdirn"); var sbaz = new StringBuilder(); sbaz.AppendFormat("|{0,13}|", "Zons azimuth"); Console.WriteLine(new StringBuilder().AppendFormat("{0,-20}", ">>Hoogte zon:")); var list = data.CalculateDataForDay(); foreach (var(item1, item2, item3, item4) in list) { sbHour.AppendFormat("|{0,8}|", item1); sbValue.AppendFormat("|{0,8:N2}|", item2); sbQdirn.AppendFormat("|{0,8:N0}|", item3); sbaz.AppendFormat("|{0,8:N0}|", item4); } return(sbHour + "\n" + sbValue + "\n" + sbQdirn + "\n" + sbaz + "\n"); }
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()); }
static void Main(string[] args) { Console.WriteLine("Welcome to sun heat calculator alpha-1.01!"); Console.WriteLine("Made by WHIZX-IT"); var input = new DataInput(); input.ReadData(); Stopwatch stopwatch = Stopwatch.StartNew(); var calc = new TotalSunHeat(input); ExcelFormatter formatter = new ExcelFormatter(calc, input); formatter.GenerateAll(); /* * Console.WriteLine(Formatting.FormatOutput("QDIR_0", calc.CalculateQDIR0().ToString())); * Console.WriteLine(Formatting.FormatOutput("D", calc.CalculateDeclination()+ " graden")); * Console.WriteLine(Formatting.FormatHeightOfSun(calc)); * Console.WriteLine(Formatting.FormatEntryAngles(calc)); * Console.WriteLine(Formatting.FormatSunRayHorizontal(calc)); * Console.WriteLine(Formatting.FormatSunRayOnVertical(calc)); * Console.WriteLine(Formatting.FormatSunRayOnTilted(calc)); * Console.WriteLine(Formatting.FormatTotal(calc));*/ stopwatch.Stop(); Console.WriteLine(stopwatch.ElapsedMilliseconds); Console.WriteLine("Done"); }
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); }
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); }
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); }
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()); }
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); }
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()); }
public static string FormatSunRayHorizontal(TotalSunHeat data) { var sb = new StringBuilder(); var sbHour = new StringBuilder(); var sbVal = new StringBuilder(); var sbVal2 = new StringBuilder(); var listData = data.CalculateSunRayOnHorizontalSpot(); sbHour.AppendFormat("|{0,13}|", "uur"); sbVal.AppendFormat("|{0,13}|", "QdirH"); sbVal2.AppendFormat("|{0,13}|", "QhemH"); sb.AppendLine(">>Overzicht zonnestraling op horizontaal vlak: "); foreach (var dat in listData) { sbHour.AppendFormat("|{0,8}|", +dat.Item1); sbVal.AppendFormat("|{0,8:N2}|", dat.Item2); sbVal2.AppendFormat("|{0,8:N2}|", dat.Item3); } sb.AppendLine(sbHour.ToString()); sb.AppendLine(sbVal.ToString()); sb.AppendLine(sbVal2.ToString()); sb.Append("\n"); return(sb.ToString()); }
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); }
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); }
public ExcelFormatter(TotalSunHeat calc, DataInput input) { _calc = calc; _input = input; workbook = new HSSFWorkbook(); }