From 2472091a110e20c0696ab43e35d829b35deaeb50 Mon Sep 17 00:00:00 2001 From: Jay Ravani Date: Mon, 20 Jul 2026 23:51:56 +0200 Subject: [PATCH] style(calc): remove redundant restatement comments --- internal/calc/calc_level_01.go | 53 ---------------------------------- internal/calc/calc_level_02.go | 24 --------------- internal/calc/calc_level_03.go | 25 ---------------- internal/calc/calc_level_04.go | 24 --------------- internal/calc/calc_level_05.go | 27 ----------------- internal/calc/calc_level_06.go | 19 ++---------- internal/calc/calc_level_07.go | 10 ------- internal/calc/calc_level_08.go | 5 ---- internal/calc/calc_level_09.go | 4 +-- internal/calc/calc_level_10.go | 2 -- internal/calc/calc_level_11.go | 2 +- internal/calc/calc_level_12.go | 4 +-- internal/calc/calc_level_14.go | 1 - internal/calc/calc_level_15.go | 2 +- internal/calc/calc_level_16.go | 2 +- internal/calc/calc_level_17.go | 4 +-- internal/hdcp/pipeline.go | 18 ------------ 17 files changed, 10 insertions(+), 216 deletions(-) diff --git a/internal/calc/calc_level_01.go b/internal/calc/calc_level_01.go index 813d1af..60b5c35 100644 --- a/internal/calc/calc_level_01.go +++ b/internal/calc/calc_level_01.go @@ -92,7 +92,6 @@ func (c *CalcLevel1) Run() { c.Q_int = c.calcQInt() } -// calcACRefEstim calculates A_C_Ref_Estim // Estimated by use of conversion factors // Unit: m² // Formula: IF(A_C_IntDim>0, A_C_IntDim, IF(A_C_ExtDim>0, 0.85*A_C_ExtDim, IF(A_C_Living>0, 1.1*A_C_Living, IF(A_C_Use>0, 1.4*A_C_Use, 0.85/3*V_C)))) @@ -110,7 +109,6 @@ func (c *CalcLevel1) calcACRefEstim() float64 { } } -// calcPRoof calculates p_Roof // Unit: m²/m² // Formula: IF(OR($Code_AtticCond="C",$Code_AtticCond="PI",$Code_AtticCond="NI"),1.6,IF($Code_AtticCond="P",0.8,IF($Code_AtticCond="-",1.2,0))) func (c *CalcLevel1) calcPRoof() float64 { @@ -125,7 +123,6 @@ func (c *CalcLevel1) calcPRoof() float64 { return 0 } -// calcQRoof calculates q_Roof // Unit: m² // Formula: IF(OR($Code_AtticCond="C",$Code_AtticCond="PI",$Code_AtticCond="NI"),15,IF($Code_AtticCond="P",7,IF($Code_AtticCond="-",5,0))) func (c *CalcLevel1) calcQRoof() float64 { @@ -140,7 +137,6 @@ func (c *CalcLevel1) calcQRoof() float64 { return 0 } -// calcPCeiling calculates p_Ceiling // Unit: m²/m² // Formula: IF(OR($Code_AtticCond="C",$Code_AtticCond="PI",$Code_AtticCond="NI"),0,IF($Code_AtticCond="P",0.6,IF($Code_AtticCond="-",0,1.2))) func (c *CalcLevel1) calcPCeiling() float64 { @@ -155,7 +151,6 @@ func (c *CalcLevel1) calcPCeiling() float64 { return 1.2 } -// calcQCeiling calculates q_Ceiling // Unit: m² // Formula: IF(OR($Code_AtticCond="C",$Code_AtticCond="PI",$Code_AtticCond="NI"),0,IF($Code_AtticCond="P",3,IF($Code_AtticCond="-",0,5))) func (c *CalcLevel1) calcQCeiling() float64 { @@ -170,7 +165,6 @@ func (c *CalcLevel1) calcQCeiling() float64 { return 5 } -// calcFAtticCond calculates f_AtticCond // Formula: IF(LEFT($Code_AtticCond,1)="C",1,IF(LEFT($Code_AtticCond,1)="P",0.5,0)) func (c *CalcLevel1) calcFAtticCond() float64 { code := c.Lvl0.BasicParameters.BuildingAppearance.Code_AtticCond @@ -185,7 +179,6 @@ func (c *CalcLevel1) calcFAtticCond() float64 { return 0 } -// calcFCellarCond calculates f_CellarCond // Formula: IF(LEFT($Code_CellarCond,1)="C",1,IF(LEFT($Code_CellarCond,1)="P",0.5,0)) func (c *CalcLevel1) calcFCellarCond() float64 { code := c.Lvl0.BasicParameters.BuildingAppearance.Code_CellarCond @@ -200,7 +193,6 @@ func (c *CalcLevel1) calcFCellarCond() float64 { return 0 } -// calcFComplexRoof calculates f_ComplexRoof // Formula: IF(Code_ComplexRoof="Simple",0.9,IF(Code_ComplexRoof="Complex",1.3,1)) func (c *CalcLevel1) calcFComplexRoof() float64 { code := c.Lvl0.BasicParameters.BuildingAppearance.Code_ComplexRoof @@ -212,7 +204,6 @@ func (c *CalcLevel1) calcFComplexRoof() float64 { return 1 } -// calcFComplexFootprint calculates f_ComplexFootprint // Formula: IF(Code_ComplexFootprint="Simple",0.9,IF(Code_ComplexFootprint="Complex",1.2,1)) func (c *CalcLevel1) calcFComplexFootprint() float64 { code := c.Lvl0.BasicParameters.BuildingAppearance.Code_ComplexFootprint @@ -224,7 +215,6 @@ func (c *CalcLevel1) calcFComplexFootprint() float64 { return 1 } -// calcCodeEstimConstructionBorderWallToCellarOrSoil calculates Code_Estim_ConstructionBorder_Wall_ToCellarOrSoil // wall bordering at soil or unheated cellar // Formula: IF($Code_CellarCond="P","Unh","Soil") func (c *CalcLevel1) calcCodeEstimConstructionBorderWallToCellarOrSoil() string { @@ -234,7 +224,6 @@ func (c *CalcLevel1) calcCodeEstimConstructionBorderWallToCellarOrSoil() string return "Soil" } -// calcCodeEstimConstructionBorderFloor calculates Code_Estim_ConstructionBorder_Floor // floor above cellar or soil // Formula: IF($Code_CellarCond="-","Soil","Cellar") func (c *CalcLevel1) calcCodeEstimConstructionBorderFloor() string { @@ -244,8 +233,6 @@ func (c *CalcLevel1) calcCodeEstimConstructionBorderFloor() string { return "Cellar" } -// calcAExactEnvSum calculates A_Exact_Env_Sum -// Calculates the sum of various building element areas // Unit: m² // Formula: SUM(A_Roof_1:A_Door_1) func (c *CalcLevel1) calcAExactEnvSum() float64 { @@ -262,8 +249,6 @@ func (c *CalcLevel1) calcAExactEnvSum() float64 { envelope.A_Door_1 } -// calcACalcWindow2 calculates A_Calc_Window_2 -// element type window 2 // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",0,A_Window_2) func (c *CalcLevel1) calcACalcWindow2() float64 { @@ -273,7 +258,6 @@ func (c *CalcLevel1) calcACalcWindow2() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_2 } -// calcACalcWindowHorizontal calculates A_Calc_Window_Horizontal // tilted below 30°, otherwise classified as vertical // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",0,A_Window_Horizontal) @@ -284,7 +268,6 @@ func (c *CalcLevel1) calcACalcWindowHorizontal() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_Horizontal } -// calcACalcWindowSouth calculates A_Calc_Window_South // deviation from orientation: +/- 45° // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",0,A_Window_South) @@ -295,7 +278,6 @@ func (c *CalcLevel1) calcACalcWindowSouth() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_South } -// calcACalcWindowNorth calculates A_Calc_Window_North // deviation from orientation: +/- 45° // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",0,A_Window_North) @@ -306,8 +288,6 @@ func (c *CalcLevel1) calcACalcWindowNorth() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_North } -// calcDInsulationMeasureRoof1 calculates d_Insulation_Measure_Roof_1 -// Element type roof 1 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Roof_1<>0, d_Insulation_Input_Measure_Roof_1, d_Insulation_PredefinedMeasure_Roof_1) func (c *CalcLevel1) calcDInsulationMeasureRoof1() float64 { @@ -317,8 +297,6 @@ func (c *CalcLevel1) calcDInsulationMeasureRoof1() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Roof_1 } -// calcDInsulationMeasureRoof2 calculates d_Insulation_Measure_Roof_2 -// Element type roof 2 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Roof_2<>0, d_Insulation_Input_Measure_Roof_2, d_Insulation_PredefinedMeasure_Roof_2) func (c *CalcLevel1) calcDInsulationMeasureRoof2() float64 { @@ -328,8 +306,6 @@ func (c *CalcLevel1) calcDInsulationMeasureRoof2() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Roof_2 } -// calcDInsulationMeasureWall1 calculates d_Insulation_Measure_Wall_1 -// Element type wall 1 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Wall_1<>0, d_Insulation_Input_Measure_Wall_1, d_Insulation_PredefinedMeasure_Wall_1) func (c *CalcLevel1) calcDInsulationMeasureWall1() float64 { @@ -339,8 +315,6 @@ func (c *CalcLevel1) calcDInsulationMeasureWall1() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Wall_1 } -// calcDInsulationMeasureWall2 calculates d_Insulation_Measure_Wall_2 -// Element type wall 2 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Wall_2<>0, d_Insulation_Input_Measure_Wall_2, d_Insulation_PredefinedMeasure_Wall_2) func (c *CalcLevel1) calcDInsulationMeasureWall2() float64 { @@ -350,8 +324,6 @@ func (c *CalcLevel1) calcDInsulationMeasureWall2() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Wall_2 } -// calcDInsulationMeasureWall3 calculates d_Insulation_Measure_Wall_3 -// Element type wall 3 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Wall_3<>0, d_Insulation_Input_Measure_Wall_3, d_Insulation_PredefinedMeasure_Wall_3) func (c *CalcLevel1) calcDInsulationMeasureWall3() float64 { @@ -361,8 +333,6 @@ func (c *CalcLevel1) calcDInsulationMeasureWall3() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Wall_3 } -// calcDInsulationMeasureFloor1 calculates d_Insulation_Measure_Floor_1 -// Element type floor 1 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Floor_1<>0, d_Insulation_Input_Measure_Floor_1, d_Insulation_PredefinedMeasure_Floor_1) func (c *CalcLevel1) calcDInsulationMeasureFloor1() float64 { @@ -372,8 +342,6 @@ func (c *CalcLevel1) calcDInsulationMeasureFloor1() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Floor_1 } -// calcDInsulationMeasureFloor2 calculates d_Insulation_Measure_Floor_2 -// Element type floor 2 // Unit: m // Formula: IF(d_Insulation_Input_Measure_Floor_2<>0, d_Insulation_Input_Measure_Floor_2, d_Insulation_PredefinedMeasure_Floor_2) func (c *CalcLevel1) calcDInsulationMeasureFloor2() float64 { @@ -383,48 +351,34 @@ func (c *CalcLevel1) calcDInsulationMeasureFloor2() float64 { return c.Lvl0.AdvancedParameters.InsulationMeasures.D_Insulation_PredefinedMeasure_Floor_2 } -// calcRMeasureWindow1 calculates R_Measure_Window_1 -// Element type window 1 // Unit: m²*K/W // Formula: R_PredefinedMeasure_Window_1 func (c *CalcLevel1) calcRMeasureWindow1() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Window_1 } -// calcRMeasureWindow2 calculates R_Measure_Window_2 -// Element type window 2 // Unit: m²*K/W // Formula: R_PredefinedMeasure_Window_2 func (c *CalcLevel1) calcRMeasureWindow2() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Window_2 } -// calcRMeasureDoor1 calculates R_Measure_Door_1 -// Element type door 1 // Unit: m²*K/W // Formula: R_PredefinedMeasure_Door_1 func (c *CalcLevel1) calcRMeasureDoor1() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Door_1 } -// calcGGlNMeasureWindow1 calculates g_gl_n_Measure_Window_1 -// Element type window 1 -// Unit: m²*K/W // Formula: g_gl_n_PredefinedMeasure_Window_1 func (c *CalcLevel1) calcGGlNMeasureWindow1() float64 { return c.Lvl0.AdvancedParameters.SolarTransmittance.G_gl_n_PredefinedMeasure_Window_1 } -// calcGGlNMeasureWindow2 calculates g_gl_n_Measure_Window_2 -// Element type window 2 -// Unit: m²*K/W // Formula: g_gl_n_PredefinedMeasure_Window_2 func (c *CalcLevel1) calcGGlNMeasureWindow2() float64 { return c.Lvl0.AdvancedParameters.SolarTransmittance.G_gl_n_PredefinedMeasure_Window_2 } -// calcRBeforeWindow1 calculates R_Before_Window_1 -// Element type window 1 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(U_Window_1), 1/U_Window_1, 0), 0) func (c *CalcLevel1) calcRBeforeWindow1() float64 { @@ -435,8 +389,6 @@ func (c *CalcLevel1) calcRBeforeWindow1() float64 { return 0 } -// calcRBeforeWindow2 calculates R_Before_Window_2 -// Element type window 2 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(U_Window_2), 1/U_Window_2, 0), 0) func (c *CalcLevel1) calcRBeforeWindow2() float64 { @@ -447,8 +399,6 @@ func (c *CalcLevel1) calcRBeforeWindow2() float64 { return 0 } -// calcRBeforeDoor1 calculates R_Before_Door_1 -// Element type door 1 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(U_Door_1), 1/U_Door_1, 0), 0) func (c *CalcLevel1) calcRBeforeDoor1() float64 { @@ -459,21 +409,18 @@ func (c *CalcLevel1) calcRBeforeDoor1() float64 { return 0 } -// calcHVentilation calculates h_Ventilation // Unit: W/(m²*K) // Formula: 0.34*(n_air_use + n_air_infiltration)*h_room func (c *CalcLevel1) calcHVentilation() float64 { return 0.34 * (c.Lvl0.AdvancedParameters.AirInfiltration.N_air_use + c.Lvl0.AdvancedParameters.AirInfiltration.N_air_infiltration) * c.Lvl0.BasicParameters.BuildingAppearance.H_room } -// calcSumDeltaTForHeatingDays calculates Sum_DeltaT_for_HeatingDays // Unit: kKh/a // Formula: (theta_i - Theta_e) * HeatingDays func (c *CalcLevel1) calcSumDeltaTForHeatingDays() float64 { return (c.Lvl0.AdvancedParameters.ClimateConditions.Theta_i - c.Lvl0.AdvancedParameters.ClimateConditions.Theta_e) * float64(c.Lvl0.AdvancedParameters.ClimateConditions.HeatingDays) } -// calcQInt calculates q_int // Unit: kWh/(m²*a) // Formula: phi_int * 0.024 * HeatingDays func (c *CalcLevel1) calcQInt() float64 { diff --git a/internal/calc/calc_level_02.go b/internal/calc/calc_level_02.go index 4f3922e..56f936d 100644 --- a/internal/calc/calc_level_02.go +++ b/internal/calc/calc_level_02.go @@ -55,7 +55,6 @@ func (c *CalcLevel2) Run() { c.U_Measure_Door_1 = c.calcUMeasureDoor1() } -// calcACRef calculates A_C_Ref // actually measured by applying the TABULA definition, if available; otherwise estimated by applying standard conversion factors // Formula: IF(A_C_Ref_Input > 0, A_C_Ref_Input, A_C_Ref_Estim) func (c *CalcLevel2) calcACRef() float64 { @@ -65,13 +64,11 @@ func (c *CalcLevel2) calcACRef() float64 { return c.Lvl1.A_C_Ref_Estim } -// calcNStoreyEffective calculates n_Storey_effective // Formula: 0.7 * f_AtticCond + n_Storey + f_CellarCond func (c *CalcLevel2) calcNStoreyEffective() float64 { return 0.7*c.Lvl1.F_AtticCond + float64(c.Lvl0.BasicParameters.BuildingAppearance.N_Storey) + c.Lvl1.F_CellarCond } -// calcNStoreyEffectiveEnvelope calculates n_Storey_effective_envelope // Formula: IF(RIGHT($Code_AtticCond,1)="I",1,f_AtticCond)*0.7+n_Storey+IF(RIGHT($Code_CellarCond,1)="I",1,f_CellarCond) func (c *CalcLevel2) calcNStoreyEffectiveEnvelope() float64 { atticCond := c.Lvl1.F_AtticCond @@ -87,7 +84,6 @@ func (c *CalcLevel2) calcNStoreyEffectiveEnvelope() float64 { return atticCond*0.7 + float64(c.Lvl0.BasicParameters.BuildingAppearance.N_Storey) + cellarCond } -// calcCheckToBeAppliedFloorAreaExactToEstim calculates Check_ToBeApplied_FloorArea_ExactToEstim // Formula: IF(f_AtticCond+f_CellarCond=0,1,0) func (c *CalcLevel2) calcCheckToBeAppliedFloorAreaExactToEstim() int { if c.Lvl1.F_AtticCond+c.Lvl1.F_CellarCond == 0 { @@ -96,8 +92,6 @@ func (c *CalcLevel2) calcCheckToBeAppliedFloorAreaExactToEstim() int { return 0 } -// calcRMeasureRoof1 calculates R_Measure_Roof_1 -// element type roof 1 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Roof_1 <> 0, d_Insulation_Measure_Roof_1 / d_Insulation_PredefinedMeasure_Roof_1, 1) * R_PredefinedMeasure_Roof_1, 0) func (c *CalcLevel2) calcRMeasureRoof1() float64 { @@ -108,8 +102,6 @@ func (c *CalcLevel2) calcRMeasureRoof1() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Roof_1 } -// calcRMeasureRoof2 calculates R_Measure_Roof_2 -// element type roof 2 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Roof_2 <> 0, d_Insulation_Measure_Roof_2 / d_Insulation_PredefinedMeasure_Roof_2, 1) * R_PredefinedMeasure_Roof_2, 0) func (c *CalcLevel2) calcRMeasureRoof2() float64 { @@ -120,8 +112,6 @@ func (c *CalcLevel2) calcRMeasureRoof2() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Roof_2 } -// calcRMeasureWall1 calculates R_Measure_Wall_1 -// element type wall 1 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Wall_1 <> 0, d_Insulation_Measure_Wall_1 / d_Insulation_PredefinedMeasure_Wall_1, 1) * R_PredefinedMeasure_Wall_1, 0) func (c *CalcLevel2) calcRMeasureWall1() float64 { @@ -132,8 +122,6 @@ func (c *CalcLevel2) calcRMeasureWall1() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Wall_1 } -// calcRMeasureWall2 calculates R_Measure_Wall_2 -// element type wall 2 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Wall_2 <> 0, d_Insulation_Measure_Wall_2 / d_Insulation_PredefinedMeasure_Wall_2, 1) * R_PredefinedMeasure_Wall_2, 0) func (c *CalcLevel2) calcRMeasureWall2() float64 { @@ -144,8 +132,6 @@ func (c *CalcLevel2) calcRMeasureWall2() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Wall_2 } -// calcRMeasureWall3 calculates R_Measure_Wall_3 -// element type wall 3 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Wall_3 <> 0, d_Insulation_Measure_Wall_3 / d_Insulation_PredefinedMeasure_Wall_3, 1) * R_PredefinedMeasure_Wall_3, 0) func (c *CalcLevel2) calcRMeasureWall3() float64 { @@ -156,8 +142,6 @@ func (c *CalcLevel2) calcRMeasureWall3() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Wall_3 } -// calcRMeasureFloor1 calculates R_Measure_Floor_1 -// element type floor 1 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Floor_1 <> 0, d_Insulation_Measure_Floor_1 / d_Insulation_PredefinedMeasure_Floor_1, 1) * R_PredefinedMeasure_Floor_1, 0) func (c *CalcLevel2) calcRMeasureFloor1() float64 { @@ -168,8 +152,6 @@ func (c *CalcLevel2) calcRMeasureFloor1() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Floor_1 } -// calcRMeasureFloor2 calculates R_Measure_Floor_2 -// element type floor 2 // Unit: m²K/W // Formula: IFERROR(IF(d_Insulation_PredefinedMeasure_Floor_2 <> 0, d_Insulation_Measure_Floor_2 / d_Insulation_PredefinedMeasure_Floor_2, 1) * R_PredefinedMeasure_Floor_2, 0) func (c *CalcLevel2) calcRMeasureFloor2() float64 { @@ -180,8 +162,6 @@ func (c *CalcLevel2) calcRMeasureFloor2() float64 { return c.Lvl0.AdvancedParameters.ThermalResistances.R_PredefinedMeasure_Floor_2 } -// calcUMeasureWindow1 calculates U_Measure_Window_1 -// element type window 1 // Unit: W/(m²K) // Formula: IFERROR(1 / (IF(Code_MeasureType_Window_1 = "Replace", 0, R_Before_Window_1) + IF(ISNUMBER(R_Measure_Window_1), R_Measure_Window_1, 0)), 0) func (c *CalcLevel2) calcUMeasureWindow1() float64 { @@ -197,8 +177,6 @@ func (c *CalcLevel2) calcUMeasureWindow1() float64 { return 0 } -// calcUMeasureWindow2 calculates U_Measure_Window_2 -// element type window 2 // Unit: W/(m²K) // Formula: IFERROR(1 / (IF(Code_MeasureType_Window_2 = "Replace", 0, R_Before_Window_2) + IF(ISNUMBER(R_Measure_Window_2), R_Measure_Window_2, 0)), 0) func (c *CalcLevel2) calcUMeasureWindow2() float64 { @@ -214,8 +192,6 @@ func (c *CalcLevel2) calcUMeasureWindow2() float64 { return 0 } -// calcUMeasureDoor1 calculates U_Measure_Door_1 -// element type door 1 // Unit: W/(m²K) // Formula: IFERROR(1 / (IF(Code_MeasureType_Door_1 = "Replace", 0, R_Before_Door_1) + IF(ISNUMBER(R_Measure_Door_1), R_Measure_Door_1, 0)), 0) func (c *CalcLevel2) calcUMeasureDoor1() float64 { diff --git a/internal/calc/calc_level_03.go b/internal/calc/calc_level_03.go index 341eb70..2285ffc 100644 --- a/internal/calc/calc_level_03.go +++ b/internal/calc/calc_level_03.go @@ -54,8 +54,6 @@ func (c *CalcLevel3) Run() { c.U_Actual_Door_1 = c.calcUActualDoor1() } -// calcACStorey calculates A_C_Storey -// Calculates the effective area of the storey // Formula: IFERROR(A_C_Ref / n_Storey_effective, 0) func (c *CalcLevel3) calcACStorey() float64 { if c.Lvl2.N_Storey_effective == 0 { @@ -64,7 +62,6 @@ func (c *CalcLevel3) calcACStorey() float64 { return c.Lvl2.A_C_Ref / c.Lvl2.N_Storey_effective } -// calcVEstimC calculates V_Estim_C // Estimates the volume correction based on ceiling height // Unit: m³ // Formula: ROUND(3/0.85, 1) * f_Corr_CeilingHeight * A_C_Ref @@ -72,16 +69,12 @@ func (c *CalcLevel3) calcVEstimC() float64 { return math.Round((3.0/0.85)*10) / 10 * c.Lvl0.AdvancedParameters.PredefinedCodes.F_Corr_CeilingHeight * c.Lvl2.A_C_Ref } -// calcAEstimDoor calculates A_Estim_Door -// Estimates the area of the door // Unit: m² // Formula: 0.01 * A_C_Ref + 1.5 func (c *CalcLevel3) calcAEstimDoor() float64 { return 0.01*c.Lvl2.A_C_Ref + 1.5 } -// calcRBeforeRoof1 calculates R_Before_Roof_1 -// Element type roof 1 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Roof_1), R_Add_UnheatedSpace_Roof_1, 0) + IF(ISNUMBER(U_Roof_1), 1/U_Roof_1 - IF(AND(Code_MeasureType_Roof_1="ReplaceInsulation", NOT(ISERROR(R_Measure_Roof_1))), d_Insulation_Roof_1/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeRoof1() float64 { @@ -100,8 +93,6 @@ func (c *CalcLevel3) calcRBeforeRoof1() float64 { return rAdd + uRoof - rMeasure } -// calcRBeforeRoof2 calculates R_Before_Roof_2 -// Element type roof 2 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Roof_2), R_Add_UnheatedSpace_Roof_2, 0) + IF(ISNUMBER(U_Roof_2), 1/U_Roof_2 - IF(AND(Code_MeasureType_Roof_2="ReplaceInsulation", NOT(ISERROR(R_Measure_Roof_2))), d_Insulation_Roof_2/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeRoof2() float64 { @@ -120,8 +111,6 @@ func (c *CalcLevel3) calcRBeforeRoof2() float64 { return rAdd + uRoof - rMeasure } -// calcRBeforeWall1 calculates R_Before_Wall_1 -// Element type wall 1 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Wall_1), R_Add_UnheatedSpace_Wall_1, 0) + IF(ISNUMBER(U_Wall_1), 1/U_Wall_1 - IF(AND(Code_MeasureType_Wall_1="ReplaceInsulation", NOT(ISERROR(R_Measure_Wall_1))), d_Insulation_Wall_1/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeWall1() float64 { @@ -140,8 +129,6 @@ func (c *CalcLevel3) calcRBeforeWall1() float64 { return rAdd + uWall - rMeasure } -// calcRBeforeWall2 calculates R_Before_Wall_2 -// Element type wall 2 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Wall_2), R_Add_UnheatedSpace_Wall_2, 0) + IF(ISNUMBER(U_Wall_2), 1/U_Wall_2 - IF(AND(Code_MeasureType_Wall_2="ReplaceInsulation", NOT(ISERROR(R_Measure_Wall_2))), d_Insulation_Wall_2/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeWall2() float64 { @@ -160,8 +147,6 @@ func (c *CalcLevel3) calcRBeforeWall2() float64 { return rAdd + uWall - rMeasure } -// calcRBeforeWall3 calculates R_Before_Wall_3 -// Element type wall 3 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Wall_3), R_Add_UnheatedSpace_Wall_3, 0) + IF(ISNUMBER(U_Wall_3), 1/U_Wall_3 - IF(AND(Code_MeasureType_Wall_3="ReplaceInsulation", NOT(ISERROR(R_Measure_Wall_3))), d_Insulation_Wall_3/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeWall3() float64 { @@ -180,8 +165,6 @@ func (c *CalcLevel3) calcRBeforeWall3() float64 { return rAdd + uWall - rMeasure } -// calcRBeforeFloor1 calculates R_Before_Floor_1 -// Element type floor 1 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Floor_1), R_Add_UnheatedSpace_Floor_1, 0) + IF(ISNUMBER(U_Floor_1), 1/U_Floor_1 - IF(AND(Code_MeasureType_Floor_1="ReplaceInsulation", NOT(ISERROR(R_Measure_Floor_1))), d_Insulation_Floor_1/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeFloor1() float64 { @@ -200,8 +183,6 @@ func (c *CalcLevel3) calcRBeforeFloor1() float64 { return rAdd + uFloor - rMeasure } -// calcRBeforeFloor2 calculates R_Before_Floor_2 -// Element type floor 2 // Unit: m²*K/W // Formula: IFERROR(IF(ISNUMBER(R_Add_UnheatedSpace_Floor_2), R_Add_UnheatedSpace_Floor_2, 0) + IF(ISNUMBER(U_Floor_2), 1/U_Floor_2 - IF(AND(Code_MeasureType_Floor_2="ReplaceInsulation", NOT(ISERROR(R_Measure_Floor_2))), d_Insulation_Floor_2/0.04, 0), 0), 0) func (c *CalcLevel3) calcRBeforeFloor2() float64 { @@ -220,8 +201,6 @@ func (c *CalcLevel3) calcRBeforeFloor2() float64 { return rAdd + uFloor - rMeasure } -// calcUActualWindow1 calculates U_Actual_Window_1 -// Actual U-value for window 1 // Unit: W/(m²*K) // Formula: (1-f_Measure_Window_1)*U_Window_1 + f_Measure_Window_1*U_Measure_Window_1 func (c *CalcLevel3) calcUActualWindow1() float64 { @@ -229,8 +208,6 @@ func (c *CalcLevel3) calcUActualWindow1() float64 { c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Window_1*c.Lvl2.U_Measure_Window_1 } -// calcUActualWindow2 calculates U_Actual_Window_2 -// Actual U-value for window 2 // Unit: W/(m²*K) // Formula: (1-f_Measure_Window_2)*U_Window_2 + f_Measure_Window_2*U_Measure_Window_2 func (c *CalcLevel3) calcUActualWindow2() float64 { @@ -238,8 +215,6 @@ func (c *CalcLevel3) calcUActualWindow2() float64 { c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Window_2*c.Lvl2.U_Measure_Window_2 } -// calcUActualDoor1 calculates U_Actual_Door_1 -// Actual U-value for door 1 // Unit: W/(m²*K) // Formula: (1-f_Measure_Door_1)*U_Door_1 + f_Measure_Door_1*U_Measure_Door_1 func (c *CalcLevel3) calcUActualDoor1() float64 { diff --git a/internal/calc/calc_level_04.go b/internal/calc/calc_level_04.go index da0df87..7cde3d3 100644 --- a/internal/calc/calc_level_04.go +++ b/internal/calc/calc_level_04.go @@ -56,7 +56,6 @@ func (c *CalcLevel4) Run() { c.U_Measure_Floor_2 = c.calcUMeasureFloor2() } -// calcAEstimGrossWallStorey calculates A_Estim_GrossWall_Storey // interim quantity // Unit: m² // Formula: f_Corr_CeilingHeight * f_ComplexFootprint * (0.7 * A_C_Storey + IF(Code_AttachedNeighbours = "B_N2", 5, IF(Code_AttachedNeighbours = "B_N1", 25, 50))) @@ -73,23 +72,18 @@ func (c *CalcLevel4) calcAEstimGrossWallStorey() float64 { return c.Lvl0.AdvancedParameters.PredefinedCodes.F_Corr_CeilingHeight * c.Lvl1.F_ComplexFootprint * (0.7*c.Lvl3.A_C_Storey + attachedNeigh) } -// calcAEstimRoof calculates A_Estim_Roof -// roof // Unit: m² // Formula: f_ComplexRoof * (p_Roof * A_C_Storey + q_Roof) func (c *CalcLevel4) calcAEstimRoof() float64 { return c.Lvl1.F_ComplexRoof * (c.Lvl1.P_Roof*c.Lvl3.A_C_Storey + c.Lvl1.Q_Roof) } -// calcAEstimUpperCeiling calculates A_Estim_UpperCeiling -// upper ceiling // Unit: m² // Formula: p_Ceiling * A_C_Storey + q_Ceiling func (c *CalcLevel4) calcAEstimUpperCeiling() float64 { return c.Lvl1.P_Ceiling*c.Lvl3.A_C_Storey + c.Lvl1.Q_Ceiling } -// calcAEstimFloor calculates A_Estim_Floor // floor above cellar or soil // Unit: m² // Formula: 1.2 * A_C_Storey + 5 @@ -97,16 +91,12 @@ func (c *CalcLevel4) calcAEstimFloor() float64 { return 1.2*c.Lvl3.A_C_Storey + 5 } -// calcAEstimWindow calculates A_Estim_Window -// window // Unit: m² // Formula: 0.18 * A_C_Ref - A_Estim_Door func (c *CalcLevel4) calcAEstimWindow() float64 { return 0.18*c.Lvl2.A_C_Ref - c.Lvl3.A_Estim_Door } -// calcACalcDoor1 calculates A_Calc_Door_1 -// door calculation // Unit: m² // Formula: IF(Code_TypeIntake_EnvelopeArea = "Estimation", A_Estim_Door, A_Door_1) func (c *CalcLevel4) calcACalcDoor1() float64 { @@ -116,8 +106,6 @@ func (c *CalcLevel4) calcACalcDoor1() float64 { return c.Lvl0.BasicParameters.Envelope.A_Door_1 } -// calcUMeasureRoof1 calculates U_Measure_Roof_1 -// element type roof 1 // Unit: W/(m²*K) // Formula: IFERROR(1/(IF(Code_MeasureType_Roof_1 = "Replace", IF(ISNUMBER(R_Add_UnheatedSpace_Roof_1), R_Add_UnheatedSpace_Roof_1, 0), R_Before_Roof_1) + IF(ISNUMBER(R_Measure_Roof_1), R_Measure_Roof_1, 0)), 0) func (c *CalcLevel4) calcUMeasureRoof1() float64 { @@ -135,8 +123,6 @@ func (c *CalcLevel4) calcUMeasureRoof1() float64 { return 0 } -// calcUMeasureRoof2 calculates U_Measure_Roof_2 -// element type roof 2 // Unit: W/(m²*K) // Formula: IFERROR(1/(IF(Code_MeasureType_Roof_2 = "Replace", IF(ISNUMBER(R_Add_UnheatedSpace_Roof_2), R_Add_UnheatedSpace_Roof_2, 0), R_Before_Roof_2) + IF(ISNUMBER(R_Measure_Roof_2), R_Measure_Roof_2, 0)), 0) func (c *CalcLevel4) calcUMeasureRoof2() float64 { @@ -154,8 +140,6 @@ func (c *CalcLevel4) calcUMeasureRoof2() float64 { return 0 } -// calcUMeasureWall1 calculates U_Measure_Wall_1 -// element type wall 1 // Unit: W/(m²*K) // Formula: IFERROR(1/(IF(Code_MeasureType_Wall_1 = "Replace", IF(ISNUMBER(R_Add_UnheatedSpace_Wall_1), R_Add_UnheatedSpace_Wall_1, 0), R_Before_Wall_1) + IF(ISNUMBER(R_Measure_Wall_1), R_Measure_Wall_1, 0)), 0) func (c *CalcLevel4) calcUMeasureWall1() float64 { @@ -173,8 +157,6 @@ func (c *CalcLevel4) calcUMeasureWall1() float64 { return 0 } -// calcUMeasureWall2 calculates U_Measure_Wall_2 -// element type wall 2 // Unit: W/(m²*K) // Formula: IFERROR(1/(IF(Code_MeasureType_Wall_2 = "Replace", IF(ISNUMBER(R_Add_UnheatedSpace_Wall_2), R_Add_UnheatedSpace_Wall_2, 0), R_Before_Wall_2) + IF(ISNUMBER(R_Measure_Wall_2), R_Measure_Wall_2, 0)), 0) func (c *CalcLevel4) calcUMeasureWall2() float64 { @@ -192,8 +174,6 @@ func (c *CalcLevel4) calcUMeasureWall2() float64 { return 0 } -// calcUMeasureWall3 calculates U_Measure_Wall_3 -// element type wall 3 // Unit: W/(m²*K) // Formula: IFERROR(1/(IF(Code_MeasureType_Wall_3 = "Replace", IF(ISNUMBER(R_Add_UnheatedSpace_Wall_3), R_Add_UnheatedSpace_Wall_3, 0), R_Before_Wall_3) + IF(ISNUMBER(R_Measure_Wall_3), R_Measure_Wall_3, 0)), 0) func (c *CalcLevel4) calcUMeasureWall3() float64 { @@ -211,8 +191,6 @@ func (c *CalcLevel4) calcUMeasureWall3() float64 { return 0 } -// calcUMeasureFloor1 calculates U_Measure_Floor_1 -// element type floor 1 // Unit: W/(m²K) // Formula: IFERROR(1/(IF(Code_MeasureType_Floor_1="Replace",IF(ISNUMBER(R_Add_UnheatedSpace_Floor_1),R_Add_UnheatedSpace_Floor_1,0),R_Before_Floor_1)+IF(ISNUMBER(R_Measure_Floor_1),R_Measure_Floor_1,0)),0) func (c *CalcLevel4) calcUMeasureFloor1() float64 { @@ -230,8 +208,6 @@ func (c *CalcLevel4) calcUMeasureFloor1() float64 { return 0 } -// calcUMeasureFloor2 calculates U_Measure_Floor_2 -// element type floor 2 // Unit: W/(m²K) // Formula: IFERROR(1/(IF(Code_MeasureType_Floor_2="Replace",IF(ISNUMBER(R_Add_UnheatedSpace_Floor_2),R_Add_UnheatedSpace_Floor_2,0),R_Before_Floor_2)+IF(ISNUMBER(R_Measure_Floor_2),R_Measure_Floor_2,0)),0) func (c *CalcLevel4) calcUMeasureFloor2() float64 { diff --git a/internal/calc/calc_level_05.go b/internal/calc/calc_level_05.go index cb29e04..0e8d705 100644 --- a/internal/calc/calc_level_05.go +++ b/internal/calc/calc_level_05.go @@ -61,7 +61,6 @@ func (c *CalcLevel5) Run() { c.H_Transmission_Door_1 = c.calcHTransmissionDoor1() } -// calcAEstimWallToCellarOrSoil calculates A_Estim_Wall_ToCellarOrSoil // wall bordering at soil or unheated cellar // Unit: m² // Formula: 0.5*IF(RIGHT(Code_CellarCond,1)="I",1,f_CellarCond)*A_Estim_GrossWall_Storey @@ -75,7 +74,6 @@ func (c *CalcLevel5) calcAEstimWallToCellarOrSoil() float64 { return 0.5 * cellarCond * c.Lvl4.A_Estim_GrossWall_Storey } -// calcREnvFloorExactToEstim calculates r_EnvFloor_ExactToEstim // Formula: IFERROR((A_Floor_1+A_Floor_2)/(A_Estim_Floor),0) func (c *CalcLevel5) calcREnvFloorExactToEstim() float64 { if c.Lvl4.A_Estim_Floor == 0 { @@ -84,7 +82,6 @@ func (c *CalcLevel5) calcREnvFloorExactToEstim() float64 { return (c.Lvl0.BasicParameters.Envelope.A_Floor_1 + c.Lvl0.BasicParameters.Envelope.A_Floor_2) / c.Lvl4.A_Estim_Floor } -// calcREnvWindowExactToEstim calculates r_EnvWindow_ExactToEstim // Formula: IFERROR((A_Window_1+A_Window_2+A_Door_1)/(A_Estim_Window+A_Estim_Door),0) func (c *CalcLevel5) calcREnvWindowExactToEstim() float64 { denominator := c.Lvl4.A_Estim_Window + c.Lvl3.A_Estim_Door @@ -94,8 +91,6 @@ func (c *CalcLevel5) calcREnvWindowExactToEstim() float64 { return (c.Lvl0.BasicParameters.Envelope.A_Window_1 + c.Lvl0.BasicParameters.Envelope.A_Window_2 + c.Lvl0.BasicParameters.Envelope.A_Door_1) / denominator } -// calcACalcRoof1 calculates A_Calc_Roof_1 -// element type roof 1 // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",A_Estim_Roof,A_Roof_1) func (c *CalcLevel5) calcACalcRoof1() float64 { @@ -105,8 +100,6 @@ func (c *CalcLevel5) calcACalcRoof1() float64 { return c.Lvl0.BasicParameters.Envelope.A_Roof_1 } -// calcACalcRoof2 calculates A_Calc_Roof_2 -// element type roof 2 // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",A_Estim_UpperCeiling,A_Roof_2) func (c *CalcLevel5) calcACalcRoof2() float64 { @@ -116,8 +109,6 @@ func (c *CalcLevel5) calcACalcRoof2() float64 { return c.Lvl0.BasicParameters.Envelope.A_Roof_2 } -// calcACalcFloor1 calculates A_Calc_Floor_1 -// element type floor 1 // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",IF(Code_Estim_ConstructionBorder_Floor="Soil",0,A_Estim_Floor),A_Floor_1) func (c *CalcLevel5) calcACalcFloor1() float64 { @@ -130,8 +121,6 @@ func (c *CalcLevel5) calcACalcFloor1() float64 { return c.Lvl0.BasicParameters.Envelope.A_Floor_1 } -// calcACalcWindow1 calculates A_Calc_Window_1 -// element type window 1 // Unit: m² // Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation",A_Estim_Window,A_Window_1) func (c *CalcLevel5) calcACalcWindow1() float64 { @@ -141,8 +130,6 @@ func (c *CalcLevel5) calcACalcWindow1() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_1 } -// calcUActualRoof1 calculates U_Actual_Roof_1 -// element type roof 1 // Unit: W/(m²*K) // Formula: IF(U_Roof_1>0,(1-f_Measure_Roof_1)*1/(1/U_Roof_1+R_Add_UnheatedSpace_Roof_1),0)+f_Measure_Roof_1*U_Measure_Roof_1 func (c *CalcLevel5) calcUActualRoof1() float64 { @@ -153,8 +140,6 @@ func (c *CalcLevel5) calcUActualRoof1() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Roof_1*c.Lvl4.U_Measure_Roof_1 } -// calcUActualRoof2 calculates U_Actual_Roof_2 -// element type roof 2 // Unit: W/(m²*K) // Formula: IF(U_Roof_2>0,(1-f_Measure_Roof_2)*1/(1/U_Roof_2+R_Add_UnheatedSpace_Roof_2),0)+f_Measure_Roof_2*U_Measure_Roof_2 func (c *CalcLevel5) calcUActualRoof2() float64 { @@ -165,8 +150,6 @@ func (c *CalcLevel5) calcUActualRoof2() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Roof_2*c.Lvl4.U_Measure_Roof_2 } -// calcUActualWall1 calculates U_Actual_Wall_1 -// element type wall 1 // Unit: W/(m²*K) // Formula: IF(U_Wall_1>0,(1-f_Measure_Wall_1)*1/(1/U_Wall_1+R_Add_UnheatedSpace_Wall_1),0)+f_Measure_Wall_1*U_Measure_Wall_1 func (c *CalcLevel5) calcUActualWall1() float64 { @@ -177,8 +160,6 @@ func (c *CalcLevel5) calcUActualWall1() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Wall_1*c.Lvl4.U_Measure_Wall_1 } -// calcUActualWall2 calculates U_Actual_Wall_2 -// element type wall 2 // Unit: W/(m²*K) // Formula: IF(U_Wall_2>0,(1-f_Measure_Wall_2)*1/(1/U_Wall_2+R_Add_UnheatedSpace_Wall_2),0)+f_Measure_Wall_2*U_Measure_Wall_2 func (c *CalcLevel5) calcUActualWall2() float64 { @@ -189,8 +170,6 @@ func (c *CalcLevel5) calcUActualWall2() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Wall_2*c.Lvl4.U_Measure_Wall_2 } -// calcUActualWall3 calculates U_Actual_Wall_3 -// element type wall 3 // Unit: W/(m²*K) // Formula: IF(U_Wall_3>0,(1-f_Measure_Wall_3)*1/(1/U_Wall_3+R_Add_UnheatedSpace_Wall_3),0)+f_Measure_Wall_3*U_Measure_Wall_3 func (c *CalcLevel5) calcUActualWall3() float64 { @@ -201,8 +180,6 @@ func (c *CalcLevel5) calcUActualWall3() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Wall_3*c.Lvl4.U_Measure_Wall_3 } -// calcUActualFloor1 calculates U_Actual_Floor_1 -// element type floor 1 // Unit: W/(m²*K) // Formula: IF(U_Floor_1>0,(1-f_Measure_Floor_1)*1/(1/U_Floor_1+R_Add_UnheatedSpace_Floor_1),0)+f_Measure_Floor_1*U_Measure_Floor_1 func (c *CalcLevel5) calcUActualFloor1() float64 { @@ -213,8 +190,6 @@ func (c *CalcLevel5) calcUActualFloor1() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Floor_1*c.Lvl4.U_Measure_Floor_1 } -// calcUActualFloor2 calculates U_Actual_Floor_2 -// element type floor 2 // Unit: W/(m²*K) // Formula: IF(U_Floor_2>0,(1-f_Measure_Floor_2)*1/(1/U_Floor_2+R_Add_UnheatedSpace_Floor_2),0)+f_Measure_Floor_2*U_Measure_Floor_2 func (c *CalcLevel5) calcUActualFloor2() float64 { @@ -225,8 +200,6 @@ func (c *CalcLevel5) calcUActualFloor2() float64 { return result + c.Lvl0.AdvancedParameters.MeasureFractions.F_Measure_Floor_2*c.Lvl4.U_Measure_Floor_2 } -// calcHTransmissionDoor1 calculates H_Transmission_Door_1 -// element type door 1 // Unit: W/K // Formula: IF(ISERROR(U_Actual_Door_1*A_Calc_Door_1*1),0,U_Actual_Door_1*A_Calc_Door_1*1) func (c *CalcLevel5) calcHTransmissionDoor1() float64 { diff --git a/internal/calc/calc_level_06.go b/internal/calc/calc_level_06.go index fbb8f06..e0d449a 100644 --- a/internal/calc/calc_level_06.go +++ b/internal/calc/calc_level_06.go @@ -60,14 +60,13 @@ func (c *CalcLevel6) Run() { c.GGlN = c.calcGGlN() } -// calcAEstimWallExtAir calculates wall area (external air) // Excel Formula: n_Storey_effective_envelope*A_Estim_GrossWall_Storey - A_Estim_Wall_ToCellarOrSoil - A_Estim_Window - A_Estim_Door func (c *CalcLevel6) calcAEstimWallExtAir() float64 { return (c.Lvl2.N_Storey_effective_envelope * c.Lvl4.A_Estim_GrossWall_Storey) - c.Lvl5.A_Estim_Wall_ToCellarOrSoil - c.Lvl4.A_Estim_Window - c.Lvl3.A_Estim_Door } -// calcCheckFloorAreaExactToEstim checks if the floor area estimation is within plausible limits +// checks if the floor area estimation is within plausible limits // Excel Formula: IF(AND(r_EnvFloor_ExactToEstim >= f_PlausiCrit_FloorArea_LowerLimit, r_EnvFloor_ExactToEstim <= f_PlausiCrit_FloorArea_UpperLimit), 1, 0) func (c *CalcLevel6) calcCheckFloorAreaExactToEstim() int { if c.Lvl5.R_EnvFloor_ExactToEstim >= c.Lvl0.AdvancedParameters.PredefinedCodes.F_PlausiCrit_FloorArea_LowerLimit && @@ -77,7 +76,7 @@ func (c *CalcLevel6) calcCheckFloorAreaExactToEstim() int { return 0 } -// calcCheckWindowAreaExactToEstim checks if the window area estimation is within plausible limits +// checks if the window area estimation is within plausible limits // Excel Formula: IF(AND(r_EnvWindow_ExactToEstim >= f_PlausiCrit_WindowArea_LowerLimit, r_EnvWindow_ExactToEstim <= f_PlausiCrit_WindowArea_UpperLimit), 1, 0) func (c *CalcLevel6) calcCheckWindowAreaExactToEstim() int { if c.Lvl5.R_EnvWindow_ExactToEstim >= c.Lvl0.AdvancedParameters.PredefinedCodes.F_PlausiCrit_WindowArea_LowerLimit && @@ -87,7 +86,6 @@ func (c *CalcLevel6) calcCheckWindowAreaExactToEstim() int { return 0 } -// calcACalcWall2 calculates wall area based on envelope type and construction border // Excel Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation", IF(Code_Estim_ConstructionBorder_Wall_ToCellarOrSoil="Soil", 0, A_Estim_Wall_ToCellarOrSoil), A_Wall_2) func (c *CalcLevel6) calcACalcWall2() float64 { if c.Lvl0.AdvancedParameters.PredefinedCodes.Code_TypeIntake_EnvelopeArea == "Estimation" { @@ -99,7 +97,6 @@ func (c *CalcLevel6) calcACalcWall2() float64 { return c.Lvl0.BasicParameters.Envelope.A_Wall_2 } -// calcACalcFloor2 calculates floor area based on envelope type // Excel Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation", A_Estim_Floor - A_Calc_Floor_1, A_Floor_2) func (c *CalcLevel6) calcACalcFloor2() float64 { if c.Lvl0.AdvancedParameters.PredefinedCodes.Code_TypeIntake_EnvelopeArea == "Estimation" { @@ -108,7 +105,6 @@ func (c *CalcLevel6) calcACalcFloor2() float64 { return c.Lvl0.BasicParameters.Envelope.A_Floor_2 } -// calcACalcWindowEast calculates east window area based on envelope type // Excel Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation", 0.5 * SUM($A_Calc_Window_1:$A_Calc_Window_2), A_Window_East) func (c *CalcLevel6) calcACalcWindowEast() float64 { if c.Lvl0.AdvancedParameters.PredefinedCodes.Code_TypeIntake_EnvelopeArea == "Estimation" { @@ -117,7 +113,6 @@ func (c *CalcLevel6) calcACalcWindowEast() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_East } -// calcACalcWindowWest calculates west window area based on envelope type // Excel Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation", 0.5 * SUM($A_Calc_Window_1:$A_Calc_Window_2), A_Window_West) func (c *CalcLevel6) calcACalcWindowWest() float64 { if c.Lvl0.AdvancedParameters.PredefinedCodes.Code_TypeIntake_EnvelopeArea == "Estimation" { @@ -126,45 +121,39 @@ func (c *CalcLevel6) calcACalcWindowWest() float64 { return c.Lvl0.BasicParameters.Envelope.A_Window_West } -// calcHTransmissionRoof1 calculates heat transmission through roof 1 // Excel Formula: IF(ISERROR(U_Actual_Roof_1 * A_Calc_Roof_1 * b_Transmission_Roof_1), 0, U_Actual_Roof_1 * A_Calc_Roof_1 * b_Transmission_Roof_1) func (c *CalcLevel6) calcHTransmissionRoof1() float64 { result := c.Lvl5.U_Actual_Roof_1 * c.Lvl5.A_Calc_Roof_1 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Roof_1 return result } -// calcHTransmissionRoof2 calculates heat transmission through roof 2 // Excel Formula: IF(ISERROR(U_Actual_Roof_2 * A_Calc_Roof_2 * b_Transmission_Roof_2), 0, U_Actual_Roof_2 * A_Calc_Roof_2 * b_Transmission_Roof_2) func (c *CalcLevel6) calcHTransmissionRoof2() float64 { result := c.Lvl5.U_Actual_Roof_2 * c.Lvl5.A_Calc_Roof_2 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Roof_2 return result } -// calcHTransmissionFloor1 calculates heat transmission through floor 1 // Excel Formula: IF(ISERROR(U_Actual_Floor_1 * A_Calc_Floor_1 * b_Transmission_Floor_1), 0, U_Actual_Floor_1 * A_Calc_Floor_1 * b_Transmission_Floor_1) func (c *CalcLevel6) calcHTransmissionFloor1() float64 { result := c.Lvl5.U_Actual_Floor_1 * c.Lvl5.A_Calc_Floor_1 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Floor_1 return result } -// calcHTransmissionWindow1 calculates heat transmission through window 1 // Excel Formula: IF(ISERROR(U_Actual_Window_1 * A_Calc_Window_1 * 1), 0, U_Actual_Window_1 * A_Calc_Window_1 * 1) func (c *CalcLevel6) calcHTransmissionWindow1() float64 { result := c.Lvl3.U_Actual_Window_1 * c.Lvl5.A_Calc_Window_1 return result } -// calcHTransmissionWindow2 calculates heat transmission through window 2 // Excel Formula: IF(ISERROR(U_Actual_Window_2 * A_Calc_Window_2 * 1), 0, U_Actual_Window_2 * A_Calc_Window_2 * 1) func (c *CalcLevel6) calcHTransmissionWindow2() float64 { result := c.Lvl3.U_Actual_Window_2 * c.Lvl1.A_Calc_Window_2 return result } -// calcGGlN calculates average for both window types, considering refurbished state +// calculates average for both window types, considering refurbished state // Excel Formula: IFERROR((IF(LEN(Code_Measure_Window_1)>1, IF(ISERROR(g_gl_n_Measure_Window_1), 0, g_gl_n_Measure_Window_1), IF(ISERROR(g_gl_n_Window_1), 0, g_gl_n_Window_1)) * A_Calc_Window_1 + IF(LEN(Code_Measure_Window_2)>1, IF(ISERROR(g_gl_n_Measure_Window_2), 0, g_gl_n_Measure_Window_2), IF(ISERROR(g_gl_n_Window_2), 0, g_gl_n_Window_2)) * A_Calc_Window_2) / (A_Calc_Window_1 + A_Calc_Window_2), 0) func (c *CalcLevel6) calcGGlN() float64 { - // Determine value for window 1 // Note: Code_Measure can be empty string or "0" to indicate no measure var valueWindow1 float64 code1 := c.Lvl0.AdvancedParameters.MeasureTypes.Code_Measure_Window_1 @@ -175,7 +164,6 @@ func (c *CalcLevel6) calcGGlN() float64 { } weightedValueWindow1 := valueWindow1 * c.Lvl5.A_Calc_Window_1 - // Determine value for window 2 var valueWindow2 float64 code2 := c.Lvl0.AdvancedParameters.MeasureTypes.Code_Measure_Window_2 if code2 != "" && code2 != "0" { @@ -185,7 +173,6 @@ func (c *CalcLevel6) calcGGlN() float64 { } weightedValueWindow2 := valueWindow2 * c.Lvl1.A_Calc_Window_2 - // Calculate final average denominator := c.Lvl5.A_Calc_Window_1 + c.Lvl1.A_Calc_Window_2 if denominator == 0 { return 0 diff --git a/internal/calc/calc_level_07.go b/internal/calc/calc_level_07.go index 6d51dc3..98d4dd6 100644 --- a/internal/calc/calc_level_07.go +++ b/internal/calc/calc_level_07.go @@ -54,7 +54,6 @@ func (c *CalcLevel7) Run() { c.QSolNorth = c.calcQSolNorth() } -// calcAEstimEnvSum calculates sum of estimated envelope areas // Excel Formula: SUM(A_Estim_Roof:A_Estim_Door) func (c *CalcLevel7) calcAEstimEnvSum() float64 { return c.Lvl4.A_Estim_Roof + @@ -66,7 +65,6 @@ func (c *CalcLevel7) calcAEstimEnvSum() float64 { c.Lvl3.A_Estim_Door } -// calcACalcWall1 calculates wall area based on envelope type // Excel Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation", A_Estim_Wall_ExtAir, A_Wall_1) func (c *CalcLevel7) calcACalcWall1() float64 { if c.Lvl0.AdvancedParameters.PredefinedCodes.Code_TypeIntake_EnvelopeArea == "Estimation" { @@ -75,7 +73,6 @@ func (c *CalcLevel7) calcACalcWall1() float64 { return c.Lvl0.BasicParameters.Envelope.A_Wall_1 } -// calcACalcWall3 calculates wall area 3 based on envelope type // Excel Formula: IF($Code_TypeIntake_EnvelopeArea="Estimation", A_Estim_Wall_ToCellarOrSoil - A_Calc_Wall_2, A_Wall_3) func (c *CalcLevel7) calcACalcWall3() float64 { if c.Lvl0.AdvancedParameters.PredefinedCodes.Code_TypeIntake_EnvelopeArea == "Estimation" { @@ -84,21 +81,18 @@ func (c *CalcLevel7) calcACalcWall3() float64 { return c.Lvl0.BasicParameters.Envelope.A_Wall_3 } -// calcHTransmissionWall2 calculates heat transmission through wall 2 // Excel Formula: IF(ISERROR(U_Actual_Wall_2 * A_Calc_Wall_2 * b_Transmission_Wall_2), 0, U_Actual_Wall_2 * A_Calc_Wall_2 * b_Transmission_Wall_2) func (c *CalcLevel7) calcHTransmissionWall2() float64 { result := c.Lvl5.U_Actual_Wall_2 * c.Lvl6.ACalcWall2 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Wall_2 return result } -// calcHTransmissionFloor2 calculates heat transmission through floor 2 // Excel Formula: IF(ISERROR(U_Actual_Floor_2 * A_Calc_Floor_2 * b_Transmission_Floor_2), 0, U_Actual_Floor_2 * A_Calc_Floor_2 * b_Transmission_Floor_2) func (c *CalcLevel7) calcHTransmissionFloor2() float64 { result := c.Lvl5.U_Actual_Floor_2 * c.Lvl6.ACalcFloor2 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Floor_2 return result } -// calcQSolHor calculates solar energy gain through horizontal windows // Excel Formula: A_Calc_Window_Horizontal * I_Sol_Hor * F_sh_hor * (1 - F_f) * F_w * g_gl_n func (c *CalcLevel7) calcQSolHor() float64 { return c.Lvl1.A_Calc_Window_Horizontal * @@ -109,7 +103,6 @@ func (c *CalcLevel7) calcQSolHor() float64 { c.Lvl6.GGlN } -// calcQSolEast calculates solar energy gain through east windows // Excel Formula: A_Calc_Window_East * I_Sol_East * F_sh_vert * (1 - F_f) * F_w * g_gl_n func (c *CalcLevel7) calcQSolEast() float64 { return c.Lvl6.ACalcWindowEast * @@ -120,7 +113,6 @@ func (c *CalcLevel7) calcQSolEast() float64 { c.Lvl6.GGlN } -// calcQSolSouth calculates solar energy gain through south windows // Excel Formula: A_Calc_Window_South * I_Sol_South * F_sh_vert * (1 - F_f) * F_w * g_gl_n func (c *CalcLevel7) calcQSolSouth() float64 { return c.Lvl1.A_Calc_Window_South * @@ -131,7 +123,6 @@ func (c *CalcLevel7) calcQSolSouth() float64 { c.Lvl6.GGlN } -// calcQSolWest calculates solar energy gain through west windows // Excel Formula: A_Calc_Window_West * I_Sol_West * F_sh_vert * (1 - F_f) * F_w * g_gl_n func (c *CalcLevel7) calcQSolWest() float64 { return c.Lvl6.ACalcWindowWest * @@ -142,7 +133,6 @@ func (c *CalcLevel7) calcQSolWest() float64 { c.Lvl6.GGlN } -// calcQSolNorth calculates solar energy gain through north windows // Excel Formula: A_Calc_Window_North * I_Sol_North * F_sh_vert * (1 - F_f) * F_w * g_gl_n func (c *CalcLevel7) calcQSolNorth() float64 { return c.Lvl1.A_Calc_Window_North * diff --git a/internal/calc/calc_level_08.go b/internal/calc/calc_level_08.go index fb45278..885d187 100644 --- a/internal/calc/calc_level_08.go +++ b/internal/calc/calc_level_08.go @@ -46,7 +46,6 @@ func (c *CalcLevel8) Run() { c.QSol = c.calcQSol() } -// calcREnvTotalExactToEstim calculates ratio of exact to estimated envelope sum // Excel Formula: IFERROR(A_Exact_Env_Sum/A_Estim_Env_Sum,0) func (c *CalcLevel8) calcREnvTotalExactToEstim() float64 { if c.Lvl7.AEstimEnvSum == 0 { @@ -55,7 +54,6 @@ func (c *CalcLevel8) calcREnvTotalExactToEstim() float64 { return c.Lvl1.A_Exact_Env_Sum / c.Lvl7.AEstimEnvSum } -// calcFractionEnvelopeRefurbished calculates fraction of the envelope that has been refurbished // Excel Formula: IFERROR((IF(R_Measure_Roof_1>0,f_Measure_Roof_1*A_Calc_Roof_1,0)+IF(R_Measure_Roof_2>0,f_Measure_Roof_2*A_Calc_Roof_2,0)+IF(R_Measure_Wall_1>0,f_Measure_Wall_1*A_Calc_Wall_1,0)+IF(R_Measure_Wall_2>0,f_Measure_Wall_2*A_Calc_Wall_2,0)+IF(R_Measure_Wall_3>0,f_Measure_Wall_3*A_Calc_Wall_3,0)+IF(R_Measure_Floor_1>0,f_Measure_Floor_1*A_Calc_Floor_1,0)+IF(R_Measure_Floor_2>0,f_Measure_Floor_2*A_Calc_Floor_2,0)+IF(R_Measure_Window_1>0,f_Measure_Window_1*A_Calc_Window_1,0)+IF(R_Measure_Window_2>0,f_Measure_Window_2*A_Calc_Window_2,0)+IF(R_Measure_Door_1>0,f_Measure_Door_1*A_Calc_Door_1,0))/SUM(A_Calc_Roof_1:A_Calc_Door_1),0) func (c *CalcLevel8) calcFractionEnvelopeRefurbished() float64 { numerator := 0.0 @@ -108,21 +106,18 @@ func (c *CalcLevel8) calcFractionEnvelopeRefurbished() float64 { return numerator / denominator } -// calcHTransmissionWall1 calculates heat transmission through wall 1 // Excel Formula: IF(ISERROR(U_Actual_Wall_1*A_Calc_Wall_1*b_Transmission_Wall_1),0,U_Actual_Wall_1*A_Calc_Wall_1*b_Transmission_Wall_1) func (c *CalcLevel8) calcHTransmissionWall1() float64 { result := c.Lvl5.U_Actual_Wall_1 * c.Lvl7.ACalcWall1 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Wall_1 return result } -// calcHTransmissionWall3 calculates heat transmission through wall 3 // Excel Formula: IF(ISERROR(U_Actual_Wall_3*A_Calc_Wall_3*b_Transmission_Wall_3),0,U_Actual_Wall_3*A_Calc_Wall_3*b_Transmission_Wall_3) func (c *CalcLevel8) calcHTransmissionWall3() float64 { result := c.Lvl5.U_Actual_Wall_3 * c.Lvl7.ACalcWall3 * c.Lvl0.AdvancedParameters.HeatLosses.B_Transmission_Wall_3 return result } -// calcQSol calculates total solar energy gain per unit area // Excel Formula: IFERROR(SUM(Q_Sol_Hor:Q_Sol_North)/A_C_Ref,0) func (c *CalcLevel8) calcQSol() float64 { totalSolarEnergy := c.Lvl7.QSolHor + c.Lvl7.QSolEast + c.Lvl7.QSolSouth + c.Lvl7.QSolWest + c.Lvl7.QSolNorth diff --git a/internal/calc/calc_level_09.go b/internal/calc/calc_level_09.go index 9c5c0c6..f1c7991 100644 --- a/internal/calc/calc_level_09.go +++ b/internal/calc/calc_level_09.go @@ -33,7 +33,7 @@ func (c *CalcLevel9) Run() { c.DeltaUThermalBridging = c.calcDeltaUThermalBridging() } -// calcCheckEnvSumExactToEstim checks if the ratio of exact to estimated envelope sum falls within plausible limits +// checks if the ratio of exact to estimated envelope sum falls within plausible limits // Excel Formula: IF(AND(r_EnvTotal_ExactToEstim>=f_PlausiCrit_EnvSum_LowerLimit,r_EnvTotal_ExactToEstim<=f_PlausiCrit_EnvSum_UpperLimit),1,0) func (c *CalcLevel9) calcCheckEnvSumExactToEstim() int { if c.Lvl8.REnvTotalExactToEstim >= c.Lvl0.AdvancedParameters.PredefinedCodes.F_PlausiCrit_EnvSum_LowerLimit && @@ -43,7 +43,6 @@ func (c *CalcLevel9) calcCheckEnvSumExactToEstim() int { return 0 } -// calcTypeThermalBridgingActual determines the type of thermal bridging based on various conditions // Excel Formula: IF(OR(Code_ThermalBridging_Refurbished="",Code_ThermalBridging_Original=Code_ThermalBridging_Refurbished),Code_ThermalBridging_Original,IF(Code_TypeVariant="Variation",Code_ThermalBridging_Refurbished,IF(Fraction_EnvelopeRefurbished=0,Code_ThermalBridging_Original,IF(Fraction_EnvelopeRefurbished=1,Code_ThermalBridging_Refurbished,Code_ThermalBridging_Original&"("&TEXT(1-Fraction_EnvelopeRefurbished,"##0%")&")."&Code_ThermalBridging_Refurbished&"("&TEXT(Fraction_EnvelopeRefurbished,"##0%")&")")))) func (c *CalcLevel9) calcTypeThermalBridgingActual() string { if c.Lvl0.AdvancedParameters.ThermalBridges.Code_ThermalBridging_Refurbished == "" || @@ -66,7 +65,6 @@ func (c *CalcLevel9) calcTypeThermalBridgingActual() string { } } -// calcDeltaUThermalBridging calculates the delta U value for thermal bridging // Excel Formula: IFERROR(IF(Code_ThermalBridging_Refurbished<>"",IF(Code_TypeVariant="Variation",delta_U_ThermalBridging_Refurbished,(1-Fraction_EnvelopeRefurbished)*delta_U_ThermalBridging_Original+Fraction_EnvelopeRefurbished*delta_U_ThermalBridging_Refurbished),delta_U_ThermalBridging_Original),0) func (c *CalcLevel9) calcDeltaUThermalBridging() float64 { if c.Lvl0.AdvancedParameters.ThermalBridges.Code_ThermalBridging_Refurbished != "" { diff --git a/internal/calc/calc_level_10.go b/internal/calc/calc_level_10.go index d88d5ab..3435128 100644 --- a/internal/calc/calc_level_10.go +++ b/internal/calc/calc_level_10.go @@ -36,7 +36,6 @@ func (c *CalcLevel10) Run() { c.HTransmissionThermalBridging = c.calcHTransmissionThermalBridging() } -// calcCheckEnvAreaExactToEstim checks if the environmental area is exact to estimated based on various conditions // Excel Formula: Check_EnvSum_ExactToEstim * IF(Check_ToBeApplied_FloorArea_ExactToEstim=1, Check_FloorArea_ExactToEstim, 1) * Check_WindowArea_ExactToEstim func (c *CalcLevel10) calcCheckEnvAreaExactToEstim() int { result := c.Lvl9.CheckEnvSumExactToEstim @@ -55,7 +54,6 @@ func (c *CalcLevel10) calcCheckEnvAreaExactToEstim() int { return result } -// calcHTransmissionThermalBridging calculates the supplemental heat loss due to thermal bridging // Excel Formula: SUM(A_Calc_Roof_1:A_Calc_Door_1) * delta_U_ThermalBridging func (c *CalcLevel10) calcHTransmissionThermalBridging() float64 { totalArea := c.Lvl5.A_Calc_Roof_1 + diff --git a/internal/calc/calc_level_11.go b/internal/calc/calc_level_11.go index 4712e97..fc05cfe 100644 --- a/internal/calc/calc_level_11.go +++ b/internal/calc/calc_level_11.go @@ -32,7 +32,7 @@ func (c *CalcLevel11) Run() { c.HTransmission = c.calcHTransmission() } -// calcHTransmission calculates indicator for energy quality of building envelope (compactness + insulation) +// indicator for energy quality of building envelope (compactness + insulation) // Excel Formula: IFERROR(SUM(H_Transmission_Roof_1:H_Transmission_ThermalBridging)/A_C_Ref,0) func (c *CalcLevel11) calcHTransmission() float64 { totalTransmission := c.Lvl6.HTransmissionFloor1 + diff --git a/internal/calc/calc_level_12.go b/internal/calc/calc_level_12.go index a990dbf..b4bc8bd 100644 --- a/internal/calc/calc_level_12.go +++ b/internal/calc/calc_level_12.go @@ -32,7 +32,7 @@ func (c *CalcLevel12) Run() { c.Tau = c.calcTau() } -// calcFRedTemp determines the reduced temperature factor based on h_Transmission +// determines the reduced temperature factor based on h_Transmission // Excel Formula: IF(h_Transmission<=1,F_red_htr1+(1-h_Transmission)/0.5*(1-F_red_htr1),IF(h_Transmission>=4,F_red_htr4,F_red_htr1+(h_Transmission-1)*(F_red_htr4-F_red_htr1)/(4-1))) func (c *CalcLevel12) calcFRedTemp() float64 { if c.Lvl11.HTransmission <= 1 { @@ -46,7 +46,7 @@ func (c *CalcLevel12) calcFRedTemp() float64 { } } -// calcTau calculates time constant relevant for seasonal method +// time constant relevant for seasonal method // Excel Formula: c_m/(h_Transmission+h_Ventilation) func (c *CalcLevel12) calcTau() float64 { return c.Lvl0.AdvancedParameters.HeatTransfer.C_m / (c.Lvl11.HTransmission + c.Lvl1.H_Ventilation) diff --git a/internal/calc/calc_level_14.go b/internal/calc/calc_level_14.go index f7119d8..f195d14 100644 --- a/internal/calc/calc_level_14.go +++ b/internal/calc/calc_level_14.go @@ -22,7 +22,6 @@ func (c *CalcLevel14) Run() { c.QHt = c.calcQHt() } -// calcQHt calculates total heat transfer // Excel Formula: q_ht_tr+q_ht_ve func (c *CalcLevel14) calcQHt() float64 { return c.Lvl13.QHtTr + c.Lvl13.QHtVe diff --git a/internal/calc/calc_level_15.go b/internal/calc/calc_level_15.go index fd9bf2c..af6e67b 100644 --- a/internal/calc/calc_level_15.go +++ b/internal/calc/calc_level_15.go @@ -26,7 +26,7 @@ func (c *CalcLevel15) Run() { c.GammaHGn = c.calcGammaHGn() } -// calcGammaHGn calculates the heat gain utilization ratio +// the heat gain utilization ratio // Excel Formula: IFERROR((q_sol+q_int)/q_ht,0) func (c *CalcLevel15) calcGammaHGn() float64 { if c.Lvl14.QHt == 0 { diff --git a/internal/calc/calc_level_16.go b/internal/calc/calc_level_16.go index 40c17c7..c94ed3a 100644 --- a/internal/calc/calc_level_16.go +++ b/internal/calc/calc_level_16.go @@ -28,7 +28,7 @@ func (c *CalcLevel16) Run() { c.EtaHGn = c.calcEtaHGn() } -// calcEtaHGn calculates the gain utilization factor +// the gain utilization factor // Excel Formula: (1-gamma_h_gn^a_H)/(1-gamma_h_gn^(a_H+1)) func (c *CalcLevel16) calcEtaHGn() float64 { numerator := 1 - math.Pow(c.Lvl15.GammaHGn, c.Lvl13.AH) diff --git a/internal/calc/calc_level_17.go b/internal/calc/calc_level_17.go index 702246d..00902af 100644 --- a/internal/calc/calc_level_17.go +++ b/internal/calc/calc_level_17.go @@ -7,7 +7,7 @@ type CalcLevel17 struct { Lvl14 *CalcLevel14 Lvl16 *CalcLevel16 - // Calculated attributes - FINAL OUTPUT + // Calculated attributes QHNd float64 `json:"q_h_nd"` // Final heating demand per unit area } @@ -29,8 +29,6 @@ func (c *CalcLevel17) Run() float64 { return c.QHNd } -// calcQHNd calculates the final net heating demand per unit area -// This is the FINAL OUTPUT of the entire calculation pipeline // Excel Formula: q_ht - eta_h_gn * (q_sol + q_int) func (c *CalcLevel17) calcQHNd() float64 { return c.Lvl14.QHt - c.Lvl16.EtaHGn*(c.Lvl8.QSol+c.Lvl1.Q_int) diff --git a/internal/hdcp/pipeline.go b/internal/hdcp/pipeline.go index f24033f..2ad3e2e 100644 --- a/internal/hdcp/pipeline.go +++ b/internal/hdcp/pipeline.go @@ -83,104 +83,86 @@ func (p *Pipeline) Run() (float64, error) { return result, nil } -// calcLvl1 runs level 1 calculation and logs any errors func (p *Pipeline) calcLvl1() { defer p.handleError("Calculation level 1") p.Lvl1 = calc.NewCalcLevel1(p.Lvl0) } -// calcLvl2 runs level 2 calculation and logs any errors func (p *Pipeline) calcLvl2() { defer p.handleError("Calculation level 2") p.Lvl2 = calc.NewCalcLevel2(p.Lvl0, p.Lvl1) } -// calcLvl3 runs level 3 calculation and logs any errors func (p *Pipeline) calcLvl3() { defer p.handleError("Calculation level 3") p.Lvl3 = calc.NewCalcLevel3(p.Lvl0, p.Lvl2) } -// calcLvl4 runs level 4 calculation and logs any errors func (p *Pipeline) calcLvl4() { defer p.handleError("Calculation level 4") p.Lvl4 = calc.NewCalcLevel4(p.Lvl0, p.Lvl1, p.Lvl2, p.Lvl3) } -// calcLvl5 runs level 5 calculation and logs any errors func (p *Pipeline) calcLvl5() { defer p.handleError("Calculation level 5") p.Lvl5 = calc.NewCalcLevel5(p.Lvl0, p.Lvl1, p.Lvl3, p.Lvl4) } -// calcLvl6 runs level 6 calculation and logs any errors func (p *Pipeline) calcLvl6() { defer p.handleError("Calculation level 6") p.Lvl6 = calc.NewCalcLevel6(p.Lvl0, p.Lvl1, p.Lvl2, p.Lvl3, p.Lvl4, p.Lvl5) } -// calcLvl7 runs level 7 calculation and logs any errors func (p *Pipeline) calcLvl7() { defer p.handleError("Calculation level 7") p.Lvl7 = calc.NewCalcLevel7(p.Lvl0, p.Lvl1, p.Lvl3, p.Lvl4, p.Lvl5, p.Lvl6) } -// calcLvl8 runs level 8 calculation and logs any errors func (p *Pipeline) calcLvl8() { defer p.handleError("Calculation level 8") p.Lvl8 = calc.NewCalcLevel8(p.Lvl0, p.Lvl1, p.Lvl2, p.Lvl4, p.Lvl5, p.Lvl6, p.Lvl7) } -// calcLvl9 runs level 9 calculation. Includes a log statement for progress. func (p *Pipeline) calcLvl9() { defer p.handleError("Calculation level 9") p.Lvl9 = calc.NewCalcLevel9(p.Lvl0, p.Lvl8) } -// calcLvl10 runs level 10 calculation and logs any errors func (p *Pipeline) calcLvl10() { defer p.handleError("Calculation level 10") p.Lvl10 = calc.NewCalcLevel10(p.Lvl1, p.Lvl2, p.Lvl4, p.Lvl5, p.Lvl6, p.Lvl7, p.Lvl9) } -// calcLvl11 runs level 11 calculation and logs any errors func (p *Pipeline) calcLvl11() { defer p.handleError("Calculation level 11") p.Lvl11 = calc.NewCalcLevel11(p.Lvl2, p.Lvl5, p.Lvl6, p.Lvl7, p.Lvl8, p.Lvl10) } -// calcLvl12 runs level 12 calculation and logs any errors func (p *Pipeline) calcLvl12() { defer p.handleError("Calculation level 12") p.Lvl12 = calc.NewCalcLevel12(p.Lvl0, p.Lvl1, p.Lvl11) } -// calcLvl13 runs level 13 calculation and logs any errors func (p *Pipeline) calcLvl13() { defer p.handleError("Calculation level 13") p.Lvl13 = calc.NewCalcLevel13(p.Lvl1, p.Lvl11, p.Lvl12) } -// calcLvl14 runs level 14 calculation and logs any errors func (p *Pipeline) calcLvl14() { defer p.handleError("Calculation level 14") p.Lvl14 = calc.NewCalcLevel14(p.Lvl13) } -// calcLvl15 runs level 15 calculation and logs any errors func (p *Pipeline) calcLvl15() { defer p.handleError("Calculation level 15") p.Lvl15 = calc.NewCalcLevel15(p.Lvl1, p.Lvl8, p.Lvl14) } -// calcLvl16 runs level 16 calculation and logs any errors func (p *Pipeline) calcLvl16() { defer p.handleError("Calculation level 16") p.Lvl16 = calc.NewCalcLevel16(p.Lvl13, p.Lvl15) } -// calcLvl17 runs the final level 17 calculation and logs any errors. -// Returns: The result of level 17 calculation. func (p *Pipeline) calcLvl17() float64 { defer p.handleError("Calculation level 17") p.Lvl17 = calc.NewCalcLevel17(p.Lvl1, p.Lvl8, p.Lvl14, p.Lvl16)