diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb index 12b5ac6feaba175e3b03d1099b9cad394e8b699b..c91fb69fb780f8cded4affb91272d5ecd76f6547 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb @@ -3,793 +3,864 @@ Imports Microsoft.VisualBasic Imports VectoAuxiliaries.Hvac Namespace Hvac - 'Modeling SSHVAC V07 - Public Class SSMCalculate - Implements ISSMCalculate + 'Modeling SSHVAC V07 + Public Class SSMCalculate + Implements ISSMCalculate - Private ssmTOOL As ISSMTOOL - Private Property Run1 As ISSMRun Implements ISSMCalculate.Run1 - Private Property Run2 As ISSMRun Implements ISSMCalculate.Run2 + Private ssmTOOL As ISSMTOOL + Private Property Run1 As ISSMRun Implements ISSMCalculate.Run1 + Private Property Run2 As ISSMRun Implements ISSMCalculate.Run2 - 'Constructor - Sub New(ssmTool As ISSMTOOL) + 'Constructor + Sub New(ssmTool As ISSMTOOL) - Me.ssmTOOL = ssmTool - Run1 = New SSMRun(Me.ssmTOOL, 1) - Run2 = New SSMRun(Me.ssmTOOL, 2) - End Sub + Me.ssmTOOL = ssmTool + Run1 = New SSMRun(Me.ssmTOOL, 1) + Run2 = New SSMRun(Me.ssmTOOL, 2) + End Sub #Region "Main Outputs" - 'BASE RESULTS - Public ReadOnly Property ElectricalWBase As Double Implements ISSMCalculate.ElectricalWBase - Get - - Dim ElectricalWBaseWeightedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the ElectricalWBase for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - ElectricalWBaseWeightedAverage = CalculateElectricalWBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - ElectricalWBaseWeightedAverage += CalculateElectricalWBase(gen, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return ElectricalWBaseWeightedAverage - End Get - End Property - - Public ReadOnly Property MechanicalWBase As Double Implements ISSMCalculate.MechanicalWBase - Get - - Dim MechanicalWBaseWeightedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the MechanicalWBase for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - MechanicalWBaseWeightedAverage = CalculateMechanicalWBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - MechanicalWBaseWeightedAverage += CalculateMechanicalWBase(gen, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return MechanicalWBaseWeightedAverage - End Get - End Property - - Public ReadOnly Property FuelPerHBase As Double Implements ISSMCalculate.FuelPerHBase - Get - - Dim FuelLPerHBaseWeightedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the FuelLPerHBase for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - FuelLPerHBaseWeightedAverage = CalculateFuelLPerHBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - FuelLPerHBaseWeightedAverage += CalculateFuelLPerHBase(gen, envCondition.GetTemperature(), envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return FuelLPerHBaseWeightedAverage - End Get - End Property - - 'ADJUSTED RESULTS - Public ReadOnly Property ElectricalWAdjusted As Double Implements ISSMCalculate.ElectricalWAdjusted - Get - Dim ElectricalWAdjustedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the ElectricalWAdjusted for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - ElectricalWAdjustedAverage = CalculateElectricalWAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - ElectricalWAdjustedAverage += CalculateElectricalWAdjusted(gen, tl, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return ElectricalWAdjustedAverage - End Get - End Property - - Public ReadOnly Property MechanicalWBaseAdjusted As Double Implements ISSMCalculate.MechanicalWBaseAdjusted - Get - - Dim MechanicalWBaseAdjustedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the MechanicalWBaseAdjusted for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - MechanicalWBaseAdjustedAverage = CalculateMechanicalWBaseAdjusted(gen, tl, gen.EC_EnviromentalTemperature, - gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - MechanicalWBaseAdjustedAverage += CalculateMechanicalWBaseAdjusted(gen, tl, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting( - gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return MechanicalWBaseAdjustedAverage - End Get - End Property - - Public ReadOnly Property FuelPerHBaseAdjusted As Double Implements ISSMCalculate.FuelPerHBaseAdjusted - Get - Dim FuelLPerHBaseAdjustedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the FuelLPerHBaseAdjusted for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - FuelLPerHBaseAdjustedAverage = CalculateFuelLPerHBaseAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, - 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - FuelLPerHBaseAdjustedAverage += CalculateFuelLPerHBaseAdjusted(gen, tl, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return FuelLPerHBaseAdjustedAverage - End Get - End Property + 'BASE RESULTS + Public ReadOnly Property ElectricalWBase As Double Implements ISSMCalculate.ElectricalWBase + Get + + Dim ElectricalWBaseWeightedAverage As Double + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature + Dim EC_SolarBefore As Double = gen.EC_Solar + + 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + 'Else if batch is enable calculate the ElectricalWBase for each input in the AENV file and then calculate the weighted average + If Not gen.EC_EnviromentalConditions_BatchEnabled Then + ElectricalWBaseWeightedAverage = CalculateElectricalWBase(gen, gen.EC_EnviromentalTemperature, + gen.EC_Solar, 1) + Else + For Each envCondition As IEnvironmentalCondition In _ + gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() + ElectricalWBaseWeightedAverage += CalculateElectricalWBase(gen, envCondition.GetTemperature(), + envCondition.GetSolar(), + envCondition.GetNormalisedWeighting( + gen.EC_EnvironmentalConditionsMap _ + . + GetEnvironmentalConditions())) + Next + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore + gen.EC_Solar = EC_SolarBefore + End If + + Return ElectricalWBaseWeightedAverage + End Get + End Property + + Public ReadOnly Property MechanicalWBase As Double Implements ISSMCalculate.MechanicalWBase + Get + + Dim MechanicalWBaseWeightedAverage As Double + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature + Dim EC_SolarBefore As Double = gen.EC_Solar + + 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + 'Else if batch is enable calculate the MechanicalWBase for each input in the AENV file and then calculate the weighted average + If Not gen.EC_EnviromentalConditions_BatchEnabled Then + MechanicalWBaseWeightedAverage = CalculateMechanicalWBase(gen, gen.EC_EnviromentalTemperature, + gen.EC_Solar, 1) + Else + For Each envCondition As IEnvironmentalCondition In _ + gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() + MechanicalWBaseWeightedAverage += CalculateMechanicalWBase(gen, envCondition.GetTemperature(), + envCondition.GetSolar(), + envCondition.GetNormalisedWeighting( + gen.EC_EnvironmentalConditionsMap _ + . + GetEnvironmentalConditions())) + Next + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore + gen.EC_Solar = EC_SolarBefore + End If + + Return MechanicalWBaseWeightedAverage + End Get + End Property + + Public ReadOnly Property FuelPerHBase As Double Implements ISSMCalculate.FuelPerHBase + Get + + Dim FuelLPerHBaseWeightedAverage As Double + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature + Dim EC_SolarBefore As Double = gen.EC_Solar + + 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + 'Else if batch is enable calculate the FuelLPerHBase for each input in the AENV file and then calculate the weighted average + If Not gen.EC_EnviromentalConditions_BatchEnabled Then + FuelLPerHBaseWeightedAverage = CalculateFuelLPerHBase(gen, gen.EC_EnviromentalTemperature, + gen.EC_Solar, 1) + Else + For Each envCondition As IEnvironmentalCondition In _ + gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() + FuelLPerHBaseWeightedAverage += CalculateFuelLPerHBase(gen, envCondition.GetTemperature(), + envCondition.GetSolar(), + envCondition.GetNormalisedWeighting( + gen.EC_EnvironmentalConditionsMap. + GetEnvironmentalConditions())) + Next + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore + gen.EC_Solar = EC_SolarBefore + End If + + Return FuelLPerHBaseWeightedAverage + End Get + End Property + + 'ADJUSTED RESULTS + Public ReadOnly Property ElectricalWAdjusted As Double Implements ISSMCalculate.ElectricalWAdjusted + Get + Dim ElectricalWAdjustedAverage As Double + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature + Dim EC_SolarBefore As Double = gen.EC_Solar + + 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + 'Else if batch is enable calculate the ElectricalWAdjusted for each input in the AENV file and then calculate the weighted average + If Not gen.EC_EnviromentalConditions_BatchEnabled Then + ElectricalWAdjustedAverage = CalculateElectricalWAdjusted(gen, tl, gen.EC_EnviromentalTemperature, + gen.EC_Solar, 1) + Else + For Each envCondition As IEnvironmentalCondition In _ + gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() + ElectricalWAdjustedAverage += CalculateElectricalWAdjusted(gen, tl, + envCondition.GetTemperature(), + envCondition.GetSolar(), + envCondition.GetNormalisedWeighting( + gen.EC_EnvironmentalConditionsMap _ + . + GetEnvironmentalConditions())) + Next + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore + gen.EC_Solar = EC_SolarBefore + End If + + Return ElectricalWAdjustedAverage + End Get + End Property + + Public ReadOnly Property MechanicalWBaseAdjusted As Double Implements ISSMCalculate.MechanicalWBaseAdjusted + Get + + Dim MechanicalWBaseAdjustedAverage As Double + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature + Dim EC_SolarBefore As Double = gen.EC_Solar + + 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + 'Else if batch is enable calculate the MechanicalWBaseAdjusted for each input in the AENV file and then calculate the weighted average + If Not gen.EC_EnviromentalConditions_BatchEnabled Then + MechanicalWBaseAdjustedAverage = CalculateMechanicalWBaseAdjusted(gen, tl, + gen.EC_EnviromentalTemperature, + gen.EC_Solar, 1) + Else + For Each envCondition As IEnvironmentalCondition In _ + gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() + MechanicalWBaseAdjustedAverage += CalculateMechanicalWBaseAdjusted(gen, tl, + envCondition.GetTemperature(), + envCondition.GetSolar(), + envCondition. + GetNormalisedWeighting( + gen. + EC_EnvironmentalConditionsMap _ + . + GetEnvironmentalConditions())) + Next + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore + gen.EC_Solar = EC_SolarBefore + End If + + Return MechanicalWBaseAdjustedAverage + End Get + End Property + + Public ReadOnly Property FuelPerHBaseAdjusted As Double Implements ISSMCalculate.FuelPerHBaseAdjusted + Get + Dim FuelLPerHBaseAdjustedAverage As Double + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature + Dim EC_SolarBefore As Double = gen.EC_Solar + + 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + 'Else if batch is enable calculate the FuelLPerHBaseAdjusted for each input in the AENV file and then calculate the weighted average + If Not gen.EC_EnviromentalConditions_BatchEnabled Then + FuelLPerHBaseAdjustedAverage = CalculateFuelLPerHBaseAdjusted(gen, tl, + gen.EC_EnviromentalTemperature, + gen.EC_Solar, + 1) + Else + For Each envCondition As IEnvironmentalCondition In _ + gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() + FuelLPerHBaseAdjustedAverage += CalculateFuelLPerHBaseAdjusted(gen, tl, + envCondition.GetTemperature(), + envCondition.GetSolar(), + envCondition. + GetNormalisedWeighting( + gen. + EC_EnvironmentalConditionsMap _ + . + GetEnvironmentalConditions())) + Next + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore + gen.EC_Solar = EC_SolarBefore + End If + + Return FuelLPerHBaseAdjustedAverage + End Get + End Property #End Region #Region "Staging Calculations" - 'Base Values - Public ReadOnly Property BaseHeatingW_Mechanical As Double Implements ISSMCalculate.BaseHeatingW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseHeatingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.BaseHeatingW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseHeatingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.BaseHeatingW_ElectricalVentilation - Get - '=IF(AND(M89<0,M90<0),IF(AND(C62="yes",C66="high"),C33,IF(AND(C62="yes",C66="low"),C34,0)),0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C33 = gen.BC_HighVentPowerW - 'Dim C34 = gen.BC_LowVentPowerW - 'Dim C62 = gen.VEN_VentilationONDuringHeating - 'Dim C66 = gen.VEN_VentilationDuringHeating - 'Dim M89 = Me.Run1.TotalW - 'Dim M90 = Me.Run2.TotalW - - Dim res As Double - - res = If(Run1.TotalW < 0 AndAlso Run2.TotalW < 0, - If(gen.VEN_VentilationOnDuringHeating AndAlso gen.VEN_VentilationDuringHeating.ToLower() = "high", - gen.BC_HighVentPowerW, - If _ - (gen.VEN_VentilationOnDuringHeating AndAlso gen.VEN_VentilationDuringHeating.ToLower() = "low", - gen.BC_LowVentPowerW, 0)), 0) - - - Return res - End Get - End Property - - Public ReadOnly Property BaseHeatingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.BaseHeatingW_FuelFiredHeating - - Get - '=IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:O90,3),0) - - 'Dim M89 = Me.Run1.TotalW - 'Dim M90 = Me.Run2.TotalW - 'VLOOKUP(MAX(M89:M90),M89:O90 => VLOOKUP ( lookupValue, tableArray, colIndex, rangeLookup ) - - 'If both Run TotalW values are >=0 then return FuelW from Run with largest TotalW value, else return 0 - If (Run1.TotalW < 0 AndAlso Run2.TotalW < 0) Then - - Return If(Run1.TotalW > Run2.TotalW, Run1.FuelW, Run2.FuelW) - - Else - - Return 0 - - End If - End Get - End Property - - Public ReadOnly Property BaseCoolingW_Mechanical As Double Implements ISSMCalculate.BaseCoolingW_Mechanical - Get - '=IF(C46<C28,0,IF(C53="electrical", 0, IF(AND(M89>0,M90>0),MIN(M89:M90),0))) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim C53 = gen.AC_CompressorTypeDerived - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - - Return _ - If _ - (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff, 0, - If _ - (gen.AC_CompressorTypeDerived.ToLower() = "electrical", 0, - If(Run1.TotalW > 0 AndAlso Run2.TotalW > 0, Math.Min(Run1.TotalW, Run2.TotalW), 0))) - End Get - End Property - - Public ReadOnly Property BaseCoolingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.BaseCoolingW_ElectricalCoolingHeating - Get - '=IF(C46<C28,0,IF(C53="electrical",IF(AND(M89>0,M90>0),MIN(M89:M90),0),0)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim C53 = gen.AC_CompressorTypeDerived - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - - Return _ - If _ - (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff, 0, - If _ - (gen.AC_CompressorTypeDerived.ToLower() = "electrical", - If(Run1.TotalW > 0 AndAlso Run2.TotalW > 0, Math.Min(Run1.TotalW, Run2.TotalW), 0), 0)) - End Get - End Property - - Public ReadOnly Property BaseCoolingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.BaseCoolingW_ElectricalVentilation - Get - '=IF(AND(C46>=C28,M89>0,M90>0),IF(AND(C64="yes",C67="high"),C33,IF(AND(C64="yes",C67="low"),C34,0)),0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - 'Dim C64 = gen.VEN_VentilationDuringAC - 'Dim C67 = gen.VEN_VentilationDuringCooling - 'Dim C33 = gen.BC_HighVentPowerW - 'Dim C34 = gen.BC_LowVentPowerW - - Return _ - If _ - ( - gen.EC_EnviromentalTemperature >= gen.BC_TemperatureCoolingTurnsOff AndAlso Run1.TotalW > 0 AndAlso - Run2.TotalW > 0, - If _ - (gen.VEN_VentilationDuringAC AndAlso gen.VEN_VentilationDuringCooling.ToLower() = "high", gen.BC_HighVentPowerW, - If _ - (gen.VEN_VentilationDuringAC AndAlso gen.VEN_VentilationDuringCooling.ToLower() = "low", gen.BC_LowVentPowerW, 0)) _ - , 0) - End Get - End Property - - Public ReadOnly Property BaseCoolingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.BaseCoolingW_FuelFiredHeating - Get - Return 0 - End Get - End Property - - Public ReadOnly Property BaseVentilationW_Mechanical As Double Implements ISSMCalculate.BaseVentilationW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseVentilationW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.BaseVentilationW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseVentilationW_ElectricalVentilation As Double _ - Implements ISSMCalculate.BaseVentilationW_ElectricalVentilation - Get - '=IF(OR(AND(C46<C28,M89>0,M90>0),AND(M89>0,M90<0)),IF(AND(C63="yes",C65="high"),C33,IF(AND(C63="yes",C65="low"),C34,0)),0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - 'Dim C63 = gen.VEN_VentilationWhenBothHeatingAndACInactive - 'Dim C65 = gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive - 'Dim C33 = gen.BC_HighVentPowerW - 'Dim C34 = gen.BC_LowVentPowerW - - Return _ - If _ - ( - (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff AndAlso Run1.TotalW > 0 AndAlso - Run2.TotalW > 0) OrElse (Run1.TotalW > 0 AndAlso Run2.TotalW < 0), - If _ - ( - gen.VEN_VentilationWhenBothHeatingAndACInactive AndAlso - gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() = "high", gen.BC_HighVentPowerW, - If _ - ( - gen.VEN_VentilationWhenBothHeatingAndACInactive AndAlso - gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() = "low", gen.BC_LowVentPowerW, 0)), 0) - End Get - End Property - - Public ReadOnly Property BaseVentilationW_FuelFiredHeating As Double _ - Implements ISSMCalculate.BaseVentilationW_FuelFiredHeating - Get - Return 0 - End Get - End Property - - 'Adjusted Values - Public ReadOnly Property TechListAdjustedHeatingW_Mechanical As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedHeatingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedHeatingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_ElectricalVentilation - Get - '=IF('TECH LIST INPUT'!O92>0,MIN('TECH LIST INPUT'!O92,C43),MAX('TECH LIST INPUT'!O92,-C43)) - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'TECH LIST INPUT'!O92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim TLO92 As Double = tl.VHValueVariation - - - Return _ - If _ - (tl.VHValueVariation > 0, Math.Min(tl.VHValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.VHValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedHeatingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_FuelFiredHeating - Get - '=IF('TECH LIST INPUT'!N92>0,MIN('TECH LIST INPUT'!N92,C43),MAX('TECH LIST INPUT'!N92,-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'TECH LIST INPUT'!N92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim TLN92 As Double = tl.HValueVariation - - - Return _ - If _ - (tl.HValueVariation > 0, Math.Min(tl.HValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.HValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_Mechanical As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_Mechanical - Get - '=IF(IF(C53="mechanical",'TECH LIST INPUT'!R92,0)>0,MIN(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),C43),MAX(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim result As Double - 'Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim C53 As string = gen.AC_CompressorType - - result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0) > 0, - Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), - gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), - -gen.BC_MaxPossibleBenefitFromTechnologyList)) - - Return result - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_ElectricalCoolingHeating - Get - '=IF(IF(C53="mechanical",0,'TECH LIST INPUT'!R92)>0,MIN(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),C43),MAX(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim result As Double - - 'Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim C53 As string = gen.AC_CompressorType - - result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation) > 0, - Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation), - gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation), - -gen.BC_MaxPossibleBenefitFromTechnologyList)) - - Return result - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_ElectricalVentilation - Get - '=IF('TECH LIST INPUT'!Q92>0,MIN('TECH LIST INPUT'!Q92,C43),MAX('TECH LIST INPUT'!Q92,-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'Dim TLQ92 As Double = tl.VCValueVariation'TECH LIST INPUT'!Q92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - - Return If(tl.VCValueVariation > 0, - Math.Min(tl.VCValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.VCValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_FuelFiredHeating - Get - Return 0 - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_Mechanical As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_ElectricalVentilation As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_ElectricalVentilation - Get - '=IF('TECH LIST INPUT'!P92>0,MIN('TECH LIST INPUT'!P92,C43),MAX('TECH LIST INPUT'!P92,-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'Dim TLP92 As Double = tl.VVValueVariation 'TECH LIST INPUT'!P92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - - - Return _ - If _ - (tl.VVValueVariation > 0, Math.Min(tl.VVValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.VVValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_FuelFiredHeating As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_FuelFiredHeating - Get - Return 0 - End Get - End Property + 'Base Values + Public ReadOnly Property BaseHeatingW_Mechanical As Double Implements ISSMCalculate.BaseHeatingW_Mechanical + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property BaseHeatingW_ElectricalCoolingHeating As Double _ + Implements ISSMCalculate.BaseHeatingW_ElectricalCoolingHeating + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property BaseHeatingW_ElectricalVentilation As Double _ + Implements ISSMCalculate.BaseHeatingW_ElectricalVentilation + Get + '=IF(AND(M89<0,M90<0),IF(AND(C62="yes",C66="high"),C33,IF(AND(C62="yes",C66="low"),C34,0)),0) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + + 'Dim C33 = gen.BC_HighVentPowerW + 'Dim C34 = gen.BC_LowVentPowerW + 'Dim C62 = gen.VEN_VentilationONDuringHeating + 'Dim C66 = gen.VEN_VentilationDuringHeating + 'Dim M89 = Me.Run1.TotalW + 'Dim M90 = Me.Run2.TotalW + + Dim res As Double + + res = If(Run1.TotalW < 0 AndAlso Run2.TotalW < 0, + If _ + ( + gen.VEN_VentilationOnDuringHeating AndAlso + gen.VEN_VentilationDuringHeating.ToLower() = "high", + gen.BC_HighVentPowerW, + If _ + ( + gen.VEN_VentilationOnDuringHeating AndAlso + gen.VEN_VentilationDuringHeating.ToLower() = "low", + gen.BC_LowVentPowerW, 0)), 0) + + + Return res + End Get + End Property + + Public ReadOnly Property BaseHeatingW_FuelFiredHeating As Double _ + Implements ISSMCalculate.BaseHeatingW_FuelFiredHeating + + Get + '=IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:O90,3),0) + + 'Dim M89 = Me.Run1.TotalW + 'Dim M90 = Me.Run2.TotalW + 'VLOOKUP(MAX(M89:M90),M89:O90 => VLOOKUP ( lookupValue, tableArray, colIndex, rangeLookup ) + + 'If both Run TotalW values are >=0 then return FuelW from Run with largest TotalW value, else return 0 + If (Run1.TotalW < 0 AndAlso Run2.TotalW < 0) Then + + Return If(Run1.TotalW > Run2.TotalW, Run1.FuelW, Run2.FuelW) + + Else + + Return 0 + + End If + End Get + End Property + + Public ReadOnly Property BaseCoolingW_Mechanical As Double Implements ISSMCalculate.BaseCoolingW_Mechanical + Get + '=IF(C46<C28,0,IF(C53="electrical", 0, IF(AND(M89>0,M90>0),MIN(M89:M90),0))) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + + 'Dim C46 = gen.EC_EnviromentalTemperature + 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff + 'Dim C53 = gen.AC_CompressorTypeDerived + 'Dim M89 = Run1.TotalW + 'Dim M90 = Run2.TotalW + + Return _ + If _ + (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff, 0, + If _ + (gen.AC_CompressorTypeDerived.ToLower() = "electrical", 0, + If(Run1.TotalW > 0 AndAlso Run2.TotalW > 0, Math.Min(Run1.TotalW, Run2.TotalW), 0))) + End Get + End Property + + Public ReadOnly Property BaseCoolingW_ElectricalCoolingHeating As Double _ + Implements ISSMCalculate.BaseCoolingW_ElectricalCoolingHeating + Get + '=IF(C46<C28,0,IF(C53="electrical",IF(AND(M89>0,M90>0),MIN(M89:M90),0),0)) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + + 'Dim C46 = gen.EC_EnviromentalTemperature + 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff + 'Dim C53 = gen.AC_CompressorTypeDerived + 'Dim M89 = Run1.TotalW + 'Dim M90 = Run2.TotalW + + Return _ + If _ + (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff, 0, + If _ + (gen.AC_CompressorTypeDerived.ToLower() = "electrical", + If(Run1.TotalW > 0 AndAlso Run2.TotalW > 0, Math.Min(Run1.TotalW, Run2.TotalW), 0), 0)) + End Get + End Property + + Public ReadOnly Property BaseCoolingW_ElectricalVentilation As Double _ + Implements ISSMCalculate.BaseCoolingW_ElectricalVentilation + Get + '=IF(AND(C46>=C28,M89>0,M90>0),IF(AND(C64="yes",C67="high"),C33,IF(AND(C64="yes",C67="low"),C34,0)),0) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + + 'Dim C46 = gen.EC_EnviromentalTemperature + 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff + 'Dim M89 = Run1.TotalW + 'Dim M90 = Run2.TotalW + 'Dim C64 = gen.VEN_VentilationDuringAC + 'Dim C67 = gen.VEN_VentilationDuringCooling + 'Dim C33 = gen.BC_HighVentPowerW + 'Dim C34 = gen.BC_LowVentPowerW + + Return _ + If _ + ( + gen.EC_EnviromentalTemperature >= gen.BC_TemperatureCoolingTurnsOff AndAlso Run1.TotalW > 0 AndAlso + Run2.TotalW > 0, + If _ + (gen.VEN_VentilationDuringAC AndAlso gen.VEN_VentilationDuringCooling.ToLower() = "high", + gen.BC_HighVentPowerW, + If _ + (gen.VEN_VentilationDuringAC AndAlso gen.VEN_VentilationDuringCooling.ToLower() = "low", + gen.BC_LowVentPowerW, 0)) _ + , 0) + End Get + End Property + + Public ReadOnly Property BaseCoolingW_FuelFiredHeating As Double _ + Implements ISSMCalculate.BaseCoolingW_FuelFiredHeating + Get + Return 0 + End Get + End Property + + Public ReadOnly Property BaseVentilationW_Mechanical As Double _ + Implements ISSMCalculate.BaseVentilationW_Mechanical + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property BaseVentilationW_ElectricalCoolingHeating As Double _ + Implements ISSMCalculate.BaseVentilationW_ElectricalCoolingHeating + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property BaseVentilationW_ElectricalVentilation As Double _ + Implements ISSMCalculate.BaseVentilationW_ElectricalVentilation + Get + '=IF(OR(AND(C46<C28,M89>0,M90>0),AND(M89>0,M90<0)),IF(AND(C63="yes",C65="high"),C33,IF(AND(C63="yes",C65="low"),C34,0)),0) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + + 'Dim C46 = gen.EC_EnviromentalTemperature + 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff + 'Dim M89 = Run1.TotalW + 'Dim M90 = Run2.TotalW + 'Dim C63 = gen.VEN_VentilationWhenBothHeatingAndACInactive + 'Dim C65 = gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive + 'Dim C33 = gen.BC_HighVentPowerW + 'Dim C34 = gen.BC_LowVentPowerW + + Return _ + If _ + ( + (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff AndAlso Run1.TotalW > 0 AndAlso + Run2.TotalW > 0) OrElse (Run1.TotalW > 0 AndAlso Run2.TotalW < 0), + If _ + ( + gen.VEN_VentilationWhenBothHeatingAndACInactive AndAlso + gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() = "high", + gen.BC_HighVentPowerW, + If _ + ( + gen.VEN_VentilationWhenBothHeatingAndACInactive AndAlso + gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() = "low", + gen.BC_LowVentPowerW, 0)), 0) + End Get + End Property + + Public ReadOnly Property BaseVentilationW_FuelFiredHeating As Double _ + Implements ISSMCalculate.BaseVentilationW_FuelFiredHeating + Get + Return 0 + End Get + End Property + + 'Adjusted Values + Public ReadOnly Property TechListAdjustedHeatingW_Mechanical As Double _ + Implements ISSMCalculate.TechListAdjustedHeatingW_Mechanical + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property TechListAdjustedHeatingW_ElectricalCoolingHeating As Double _ + Implements ISSMCalculate.TechListAdjustedHeatingW_ElectricalCoolingHeating + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property TechListAdjustedHeatingW_ElectricalVentilation As Double _ + Implements ISSMCalculate.TechListAdjustedHeatingW_ElectricalVentilation + Get + '=IF('TECH LIST INPUT'!O92>0,MIN('TECH LIST INPUT'!O92,C43),MAX('TECH LIST INPUT'!O92,-C43)) + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + + 'TECH LIST INPUT'!O92 + 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + 'Dim TLO92 As Double = tl.VHValueVariation + + + Return _ + If _ + (tl.VHValueVariation > 0, + Math.Min(tl.VHValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), + Math.Max(tl.VHValueVariation, - gen.BC_MaxPossibleBenefitFromTechnologyList)) + End Get + End Property + + Public ReadOnly Property TechListAdjustedHeatingW_FuelFiredHeating As Double _ + Implements ISSMCalculate.TechListAdjustedHeatingW_FuelFiredHeating + Get + '=IF('TECH LIST INPUT'!N92>0,MIN('TECH LIST INPUT'!N92,C43),MAX('TECH LIST INPUT'!N92,-C43)) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + + 'TECH LIST INPUT'!N92 + 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + 'Dim TLN92 As Double = tl.HValueVariation + + + Return _ + If _ + (tl.HValueVariation > 0, + Math.Min(tl.HValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), + Math.Max(tl.HValueVariation, - gen.BC_MaxPossibleBenefitFromTechnologyList)) + End Get + End Property + + Public ReadOnly Property TechListAdjustedCoolingW_Mechanical As Double _ + Implements ISSMCalculate.TechListAdjustedCoolingW_Mechanical + Get + '=IF(IF(C53="mechanical",'TECH LIST INPUT'!R92,0)>0,MIN(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),C43),MAX(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),-C43)) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + Dim result As Double + 'Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 + 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + 'Dim C53 As string = gen.AC_CompressorType + + result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0) > 0, + Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), + gen.BC_MaxPossibleBenefitFromTechnologyList), + Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), + - gen.BC_MaxPossibleBenefitFromTechnologyList)) + + Return result + End Get + End Property + + Public ReadOnly Property TechListAdjustedCoolingW_ElectricalCoolingHeating As Double _ + Implements ISSMCalculate.TechListAdjustedCoolingW_ElectricalCoolingHeating + Get + '=IF(IF(C53="mechanical",0,'TECH LIST INPUT'!R92)>0,MIN(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),C43),MAX(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),-C43)) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + Dim result As Double + + 'Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 + 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + 'Dim C53 As string = gen.AC_CompressorType + + result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation) > 0, + Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation), + gen.BC_MaxPossibleBenefitFromTechnologyList), + Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation), + - gen.BC_MaxPossibleBenefitFromTechnologyList)) + + Return result + End Get + End Property + + Public ReadOnly Property TechListAdjustedCoolingW_ElectricalVentilation As Double _ + Implements ISSMCalculate.TechListAdjustedCoolingW_ElectricalVentilation + Get + '=IF('TECH LIST INPUT'!Q92>0,MIN('TECH LIST INPUT'!Q92,C43),MAX('TECH LIST INPUT'!Q92,-C43)) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + + 'Dim TLQ92 As Double = tl.VCValueVariation'TECH LIST INPUT'!Q92 + 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + + Return If(tl.VCValueVariation > 0, + Math.Min(tl.VCValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), + Math.Max(tl.VCValueVariation, - gen.BC_MaxPossibleBenefitFromTechnologyList)) + End Get + End Property + + Public ReadOnly Property TechListAdjustedCoolingW_FuelFiredHeating As Double _ + Implements ISSMCalculate.TechListAdjustedCoolingW_FuelFiredHeating + Get + Return 0 + End Get + End Property + + Public ReadOnly Property TechListAdjustedVentilationW_Mechanical As Double _ + Implements ISSMCalculate.TechListAdjustedVentilationW_Mechanical + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property TechListAdjustedVentilationW_ElectricalCoolingHeating As Double _ + Implements ISSMCalculate.TechListAdjustedVentilationW_ElectricalCoolingHeating + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property TechListAdjustedVentilationW_ElectricalVentilation As Double _ + Implements ISSMCalculate.TechListAdjustedVentilationW_ElectricalVentilation + Get + '=IF('TECH LIST INPUT'!P92>0,MIN('TECH LIST INPUT'!P92,C43),MAX('TECH LIST INPUT'!P92,-C43)) + + Dim gen As ISSMGenInputs = ssmTOOL.GenInputs + Dim tl As ISSMTechList = ssmTOOL.TechList + + 'Dim TLP92 As Double = tl.VVValueVariation 'TECH LIST INPUT'!P92 + 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + + + Return _ + If _ + (tl.VVValueVariation > 0, + Math.Min(tl.VVValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), + Math.Max(tl.VVValueVariation, - gen.BC_MaxPossibleBenefitFromTechnologyList)) + End Get + End Property + + Public ReadOnly Property TechListAdjustedVentilationW_FuelFiredHeating As Double _ + Implements ISSMCalculate.TechListAdjustedVentilationW_FuelFiredHeating + Get + Return 0 + End Get + End Property #End Region - 'Provides Diagnostic Information for the user which can be displayed on the form. - 'Based on the inputs generated, can be used to cross reference the Excel Model with the - 'Outputs generated here. - Public Overrides Function ToString() As String + 'Provides Diagnostic Information for the user which can be displayed on the form. + 'Based on the inputs generated, can be used to cross reference the Excel Model with the + 'Outputs generated here. + Public Overrides Function ToString() As String + + Dim sb As New StringBuilder() + + sb.AppendLine("") + sb.AppendLine("TechList Detail") + sb.AppendLine("***********************") + + Dim nameLength As Integer = 40 + Dim catLength As Integer = 15 + Dim unitLength As Integer = 15 + Dim firstValuePos As Integer = nameLength + catLength + unitLength + 2 + Dim cat As String + Dim name As String + Dim units As String + + sb.AppendLine(String.Format(Space(firstValuePos) + "H{0}VH{0}VV{0}VC{0}C{0}", vbtab)) + + + For Each line As ITechListBenefitLine In ssmTOOL.TechList.TechLines + + With line + + Dim extraNameSpaces, extraCatSpaces, extraUnitSpaces As Integer + + extraNameSpaces = nameLength - .BenefitName.Length + extraCatSpaces = catLength - .Category.Length + extraUnitSpaces = unitLength - .Units.Length + + cat = line.Category.Substring(0, Math.Min(line.Category.Length, catLength)) + + Space(If(extraCatSpaces < 0, 0, extraCatSpaces)).Replace(" ", ".") + name = line.BenefitName.Substring(0, Math.Min(line.BenefitName.Length, nameLength)) + + Space(If(extraNameSpaces < 0, 0, extraNameSpaces)).Replace(" ", ".") + units = line.Units.Substring(0, Math.Min(line.Units.Length, unitLength)) + + Space(If(extraUnitSpaces < 0, 0, extraUnitSpaces)).Replace(" ", ".") + + sb.AppendLine(String.Format(units + cat + name + " {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbTab, + .H().ToString("0.000"), + .VH().ToString("0.000"), .VV().ToString("0.000"), + .VC().ToString("0.000"), .C().ToString("0.000"))) + + End With + + Next + + sb.AppendLine("") + sb.AppendLine("TechList Totals") + sb.AppendLine("***********************") + + With ssmTOOL.TechList + + sb.AppendLine(vbTab + vbTab + "H" + vbTab + "VH" + vbTab + "VV" + vbTab + "VC" + vbTab + "C") + sb.AppendLine(String.Format("Base Var % {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbtab, + .HValueVariation.ToString("0.000"), + .VHValueVariation.ToString("0.000"), .VVValueVariation.ToString("0.000"), + .VCValueVariation.ToString("0.000"), + .CValueVariation.ToString("0.000"))) + sb.AppendLine(String.Format("Base Var KW {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbtab, + .HValueVariationKW.ToString("0.000"), .VHValueVariationKW.ToString("0.000"), + .VVValueVariationKW.ToString("0.000"), .VCValueVariationKW.ToString("0.000"), + .CValueVariationKW.ToString("0.000"))) + + End With + + + 'Runs + sb.AppendLine(Run1.ToString()) + sb.AppendLine(Run2.ToString()) + + 'Staging Calcs + sb.AppendLine("Staging Base Values") + sb.AppendLine("*******************") + sb.AppendLine( + vbTab + vbTab + vbTab + "Mechanical" + vbTab + "Elec Cool/Heat" + vbTab + "Elec Vent" + vbTab + + "Fuel Fired Heating") + + sb.AppendLine(String.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, + BaseHeatingW_Mechanical.ToString("0.00"), + BaseHeatingW_ElectricalCoolingHeating.ToString("0.00"), + BaseHeatingW_ElectricalVentilation.ToString("0.00"), + BaseHeatingW_FuelFiredHeating.ToString("0.00"))) + sb.AppendLine(String.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, + BaseCoolingW_Mechanical.ToString("0.00"), + BaseCoolingW_ElectricalCoolingHeating.ToString("0.00"), + BaseCoolingW_ElectricalVentilation.ToString("0.00"), + BaseCoolingW_FuelFiredHeating.ToString("0.00"))) + sb.AppendLine(String.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, + BaseVentilationW_Mechanical.ToString("0.00"), + BaseVentilationW_ElectricalCoolingHeating.ToString("0.00"), + BaseVentilationW_ElectricalVentilation.ToString("0.00"), + BaseVentilationW_FuelFiredHeating.ToString("0.00"))) + + sb.AppendLine("") + sb.AppendLine("Staging Adjusted Values") + sb.AppendLine("***********************") + + sb.AppendLine(String.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, + TechListAdjustedHeatingW_Mechanical.ToString("0.00"), + TechListAdjustedHeatingW_ElectricalCoolingHeating.ToString("0.00"), + TechListAdjustedHeatingW_ElectricalVentilation.ToString("0.00"), + TechListAdjustedHeatingW_FuelFiredHeating.ToString("0.00"))) + sb.AppendLine(String.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, + TechListAdjustedCoolingW_Mechanical.ToString("0.00"), + TechListAdjustedCoolingW_ElectricalCoolingHeating.ToString("0.00"), + TechListAdjustedCoolingW_ElectricalVentilation.ToString("0.00"), + TechListAdjustedCoolingW_FuelFiredHeating.ToString("0.00"))) + sb.AppendLine(String.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, + TechListAdjustedVentilationW_Mechanical.ToString("0.00"), + TechListAdjustedVentilationW_ElectricalCoolingHeating.ToString("0.00"), + TechListAdjustedVentilationW_ElectricalVentilation.ToString("0.00"), + TechListAdjustedVentilationW_FuelFiredHeating.ToString("0.00"))) + + + Return sb.ToString() + End Function - Dim sb As New StringBuilder() - - sb.AppendLine("") - sb.AppendLine("TechList Detail") - sb.AppendLine("***********************") + Private Function CalculateElectricalWBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, + Solar As Double, Weight As Double) As Double + + 'MIN(SUM(H94),C54*1000)/C59+SUM(I93:I95) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature + genInputs.EC_Solar = Solar + + 'Dim H94 = BaseCoolingW_ElectricalCoolingHeating + 'Dim C54 = genInputs.AC_CompressorCapacitykW + 'Dim C59 = genInputs.AC_COP + 'Dim I93 = BaseHeatingW_ElectricalVentilation + 'Dim I94 = BaseCoolingW_ElectricalVentilation + 'Dim I95 = BaseVentilationW_ElectricalVentilation + + Dim ElectricalWBaseCurrentResult As Double = + Math.Min(BaseCoolingW_ElectricalCoolingHeating, genInputs.AC_CompressorCapacitykW*1000)/ + genInputs.AC_COP + + BaseHeatingW_ElectricalVentilation + BaseCoolingW_ElectricalVentilation + + BaseVentilationW_ElectricalVentilation + + Return ElectricalWBaseCurrentResult*Weight + End Function + + Private Function CalculateMechanicalWBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, + Solar As Double, Weight As Double) As Double + + '=MIN(F94,C54*1000)/C59 + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature + genInputs.EC_Solar = Solar + + 'Dim F94 = BaseCoolingW_Mechanical + 'Dim C54 = genInputs.AC_CompressorCapacitykW + 'Dim C59 = genInputs.AC_COP + + Dim MechanicalWBaseCurrentResult As Double = + Math.Min(BaseCoolingW_Mechanical, genInputs.AC_CompressorCapacitykW*1000)/genInputs.AC_COP + + Return MechanicalWBaseCurrentResult*Weight + End Function + + Private Function CalculateFuelLPerHBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, + Solar As Double, + Weight As Double) As Double + + '=(MIN(ABS(J93/1000),C71)/C37)*(1/(C39*C38)) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature + genInputs.EC_Solar = Solar + + 'Dim J93 = BaseHeatingW_FuelFiredHeating + 'Dim C71 = genInputs.AH_FuelFiredHeaterkW + 'Dim C37 = genInputs.BC_AuxHeaterEfficiency + 'Dim C39 = ssmTOOL.HVACConstants.FuelDensity + 'Dim C38 = genInputs.BC_GCVDieselOrHeatingOil + + Dim FuelLPerHBaseCurrentResult As Double = + (Math.Min(Math.Abs(BaseHeatingW_FuelFiredHeating/1000), genInputs.AH_FuelFiredHeaterkW)/ + genInputs.BC_AuxHeaterEfficiency)* + (1/(genInputs.BC_GCVDieselOrHeatingOil*ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)) + + Return FuelLPerHBaseCurrentResult*Weight + End Function + + Private Function CalculateElectricalWAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, + EnviromentalTemperature As Double, Solar As Double, + Weight As Double) As Double + + '=(MIN((H94*(1-H100)),C54*1000)/C59)+(I93*(1-I99))+(I94*(1-I100))+(I95*(1-I101)) - Dim nameLength As Integer = 40 - Dim catLength As Integer = 15 - Dim unitLength As Integer = 15 - Dim firstValuePos As Integer = nameLength + catLength + unitLength + 2 - Dim cat As String - Dim name As String - Dim units As String + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature + genInputs.EC_Solar = Solar - sb.AppendLine(String.Format(Space(firstValuePos) + "H{0}VH{0}VV{0}VC{0}C{0}", vbtab)) + Dim H94 As Double = BaseCoolingW_ElectricalCoolingHeating + Dim H100 As Double = TechListAdjustedCoolingW_ElectricalCoolingHeating + Dim C54 As Double = genInputs.AC_CompressorCapacitykW + Dim C59 As Double = genInputs.AC_COP + Dim I93 As Double = BaseHeatingW_ElectricalVentilation + Dim I94 As Double = BaseCoolingW_ElectricalVentilation + Dim I95 As Double = BaseVentilationW_ElectricalVentilation + Dim I99 As Double = TechListAdjustedHeatingW_ElectricalVentilation + Dim I100 As Double = TechListAdjustedCoolingW_ElectricalVentilation + Dim I101 As Double = TechListAdjustedVentilationW_ElectricalVentilation - For Each line As ITechListBenefitLine In ssmTOOL.TechList.TechLines + Dim ElectricalWAdjusted As Double = (Math.Min((H94*(1 - H100)), C54*1000)/C59) + (I93*(1 - I99)) + + (I94*(1 - I100)) + + (I95*(1 - I101)) - With line + Return ElectricalWAdjusted*Weight + End Function - Dim extraNameSpaces, extraCatSpaces, extraUnitSpaces As Integer + Private Function CalculateMechanicalWBaseAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, + EnviromentalTemperature As Double, Solar As Double, + Weight As Double) As Double - extraNameSpaces = nameLength - .BenefitName.Length - extraCatSpaces = catLength - .Category.Length - extraUnitSpaces = unitLength - .Units.Length + '=(MIN((F94*(1-F100)),C54*1000)/C59) - cat = line.Category.Substring(0, Math.Min(line.Category.Length, catLength)) + - Space(If(extraCatSpaces < 0, 0, extraCatSpaces)).Replace(" ", ".") - name = line.BenefitName.Substring(0, Math.Min(line.BenefitName.Length, nameLength)) + - Space(If(extraNameSpaces < 0, 0, extraNameSpaces)).Replace(" ", ".") - units = line.Units.Substring(0, Math.Min(line.Units.Length, unitLength)) + - Space(If(extraUnitSpaces < 0, 0, extraUnitSpaces)).Replace(" ", ".") + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature + genInputs.EC_Solar = Solar - sb.AppendLine(String.Format(units + cat + name + " {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbTab, .H().ToString("0.000"), - .VH().ToString("0.000"), .VV().ToString("0.000"), .VC().ToString("0.000"), .C().ToString("0.000"))) + Dim F94 As Double = BaseCoolingW_Mechanical + Dim F100 As Double = TechListAdjustedCoolingW_Mechanical + Dim C54 As Double = genInputs.AC_CompressorCapacitykW + Dim C59 As Double = genInputs.AC_COP - End With + Dim MechanicalWBaseAdjusted As Double = (Math.Min((F94*(1 - F100)), C54*1000)/C59) - Next + Return MechanicalWBaseAdjusted*Weight + End Function - sb.AppendLine("") - sb.AppendLine("TechList Totals") - sb.AppendLine("***********************") + Private Function CalculateFuelLPerHBaseAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, + EnviromentalTemperature As Double, Solar As Double, + Weight As Double) As Double - With ssmTOOL.TechList + '=MIN(ABS(IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:P90,4),0)/1000),C71)/C37*(1/(C39*C38)) - sb.AppendLine(vbTab + vbTab + "H" + vbTab + "VH" + vbTab + "VV" + vbTab + "VC" + vbTab + "C") - sb.AppendLine(String.Format("Base Var % {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbtab, .HValueVariation.ToString("0.000"), - .VHValueVariation.ToString("0.000"), .VVValueVariation.ToString("0.000"), .VCValueVariation.ToString("0.000"), - .CValueVariation.ToString("0.000"))) - sb.AppendLine(String.Format("Base Var KW {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbtab, - .HValueVariationKW.ToString("0.000"), .VHValueVariationKW.ToString("0.000"), - .VVValueVariationKW.ToString("0.000"), .VCValueVariationKW.ToString("0.000"), - .CValueVariationKW.ToString("0.000"))) + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature + genInputs.EC_Solar = Solar - End With + 'Dim M89 = Run1.TotalW + 'Dim M90 = genInputs.BC_GCVDieselOrHeatingOil + 'Dim C71 = genInputs.AH_FuelFiredHeaterkW + 'Dim C37 = genInputs.BC_AuxHeaterEfficiency + 'Dim C38 = genInputs.BC_GCVDieselOrHeatingOil + 'Dim C39 = ssmTOOL.HVACConstants.FuelDensity + Dim result As Double = 0 - 'Runs - sb.AppendLine(Run1.ToString()) - sb.AppendLine(Run2.ToString()) + If Run1.TotalW < 0 AndAlso Run2.TotalW < 0 Then + result = + Math.Abs(If(Run1.TotalW > Run2.TotalW, Run1.TechListAmendedFuelW, Run2.TechListAmendedFuelW)/1000) + End If - 'Staging Calcs - sb.AppendLine("Staging Base Values") - sb.AppendLine("*******************") - sb.AppendLine( - vbTab + vbTab + vbTab + "Mechanical" + vbTab + "Elec Cool/Heat" + vbTab + "Elec Vent" + vbTab + "Fuel Fired Heating") + Dim FuelLPerHBaseAdjusted As Double = Math.Min(result, genInputs.AH_FuelFiredHeaterkW)/ + genInputs.BC_AuxHeaterEfficiency* + (1/ + (genInputs.BC_GCVDieselOrHeatingOil* + ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)) - sb.AppendLine(String.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - BaseHeatingW_Mechanical.ToString("0.00"), BaseHeatingW_ElectricalCoolingHeating.ToString("0.00"), - BaseHeatingW_ElectricalVentilation.ToString("0.00"), BaseHeatingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - BaseCoolingW_Mechanical.ToString("0.00"), BaseCoolingW_ElectricalCoolingHeating.ToString("0.00"), - BaseCoolingW_ElectricalVentilation.ToString("0.00"), BaseCoolingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - BaseVentilationW_Mechanical.ToString("0.00"), BaseVentilationW_ElectricalCoolingHeating.ToString("0.00"), - BaseVentilationW_ElectricalVentilation.ToString("0.00"), BaseVentilationW_FuelFiredHeating.ToString("0.00"))) - - sb.AppendLine("") - sb.AppendLine("Staging Adjusted Values") - sb.AppendLine("***********************") - - sb.AppendLine(String.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - TechListAdjustedHeatingW_Mechanical.ToString("0.00"), - TechListAdjustedHeatingW_ElectricalCoolingHeating.ToString("0.00"), - TechListAdjustedHeatingW_ElectricalVentilation.ToString("0.00"), - TechListAdjustedHeatingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - TechListAdjustedCoolingW_Mechanical.ToString("0.00"), - TechListAdjustedCoolingW_ElectricalCoolingHeating.ToString("0.00"), - TechListAdjustedCoolingW_ElectricalVentilation.ToString("0.00"), - TechListAdjustedCoolingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - TechListAdjustedVentilationW_Mechanical.ToString("0.00"), - TechListAdjustedVentilationW_ElectricalCoolingHeating.ToString("0.00"), - TechListAdjustedVentilationW_ElectricalVentilation.ToString("0.00"), - TechListAdjustedVentilationW_FuelFiredHeating.ToString("0.00"))) - - - Return sb.ToString() - End Function - - Private Function CalculateElectricalWBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, - Solar As Double, Weight As Double) As Double - - 'MIN(SUM(H94),C54*1000)/C59+SUM(I93:I95) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim H94 = BaseCoolingW_ElectricalCoolingHeating - 'Dim C54 = genInputs.AC_CompressorCapacitykW - 'Dim C59 = genInputs.AC_COP - 'Dim I93 = BaseHeatingW_ElectricalVentilation - 'Dim I94 = BaseCoolingW_ElectricalVentilation - 'Dim I95 = BaseVentilationW_ElectricalVentilation - - Dim ElectricalWBaseCurrentResult As Double = - Math.Min(BaseCoolingW_ElectricalCoolingHeating, genInputs.AC_CompressorCapacitykW * 1000) / genInputs.AC_COP + - BaseHeatingW_ElectricalVentilation + BaseCoolingW_ElectricalVentilation + BaseVentilationW_ElectricalVentilation - - Return ElectricalWBaseCurrentResult * Weight - End Function - - Private Function CalculateMechanicalWBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, - Solar As Double, Weight As Double) As Double - - '=MIN(F94,C54*1000)/C59 - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim F94 = BaseCoolingW_Mechanical - 'Dim C54 = genInputs.AC_CompressorCapacitykW - 'Dim C59 = genInputs.AC_COP - - Dim MechanicalWBaseCurrentResult As Double = - Math.Min(BaseCoolingW_Mechanical, genInputs.AC_CompressorCapacitykW * 1000) / genInputs.AC_COP - - Return MechanicalWBaseCurrentResult * Weight - End Function - - Private Function CalculateFuelLPerHBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, Solar As Double, - Weight As Double) As Double - - '=(MIN(ABS(J93/1000),C71)/C37)*(1/(C39*C38)) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim J93 = BaseHeatingW_FuelFiredHeating - 'Dim C71 = genInputs.AH_FuelFiredHeaterkW - 'Dim C37 = genInputs.BC_AuxHeaterEfficiency - 'Dim C39 = ssmTOOL.HVACConstants.FuelDensity - 'Dim C38 = genInputs.BC_GCVDieselOrHeatingOil - - Dim FuelLPerHBaseCurrentResult As Double = - (Math.Min(Math.Abs(BaseHeatingW_FuelFiredHeating / 1000), genInputs.AH_FuelFiredHeaterkW) / - genInputs.BC_AuxHeaterEfficiency) * - (1 / (genInputs.BC_GCVDieselOrHeatingOil * ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)) - - Return FuelLPerHBaseCurrentResult * Weight - End Function - - Private Function CalculateElectricalWAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, - EnviromentalTemperature As Double, Solar As Double, Weight As Double) As Double - - '=(MIN((H94*(1-H100)),C54*1000)/C59)+(I93*(1-I99))+(I94*(1-I100))+(I95*(1-I101)) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - Dim H94 As Double = BaseCoolingW_ElectricalCoolingHeating - Dim H100 As Double = TechListAdjustedCoolingW_ElectricalCoolingHeating - Dim C54 As Double = genInputs.AC_CompressorCapacitykW - Dim C59 As Double = genInputs.AC_COP - - Dim I93 As Double = BaseHeatingW_ElectricalVentilation - Dim I94 As Double = BaseCoolingW_ElectricalVentilation - Dim I95 As Double = BaseVentilationW_ElectricalVentilation - Dim I99 As Double = TechListAdjustedHeatingW_ElectricalVentilation - Dim I100 As Double = TechListAdjustedCoolingW_ElectricalVentilation - Dim I101 As Double = TechListAdjustedVentilationW_ElectricalVentilation - - Dim ElectricalWAdjusted As Double = (Math.Min((H94 * (1 - H100)), C54 * 1000) / C59) + (I93 * (1 - I99)) + (I94 * (1 - I100)) + - (I95 * (1 - I101)) - - Return ElectricalWAdjusted * Weight - End Function - - Private Function CalculateMechanicalWBaseAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, - EnviromentalTemperature As Double, Solar As Double, Weight As Double) As Double - - '=(MIN((F94*(1-F100)),C54*1000)/C59) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - Dim F94 As Double = BaseCoolingW_Mechanical - Dim F100 As Double = TechListAdjustedCoolingW_Mechanical - Dim C54 As Double = genInputs.AC_CompressorCapacitykW - Dim C59 As Double = genInputs.AC_COP - - Dim MechanicalWBaseAdjusted As Double = (Math.Min((F94 * (1 - F100)), C54 * 1000) / C59) - - Return MechanicalWBaseAdjusted * Weight - End Function - - Private Function CalculateFuelLPerHBaseAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, - EnviromentalTemperature As Double, Solar As Double, Weight As Double) As Double - - '=MIN(ABS(IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:P90,4),0)/1000),C71)/C37*(1/(C39*C38)) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim M89 = Run1.TotalW - 'Dim M90 = genInputs.BC_GCVDieselOrHeatingOil - 'Dim C71 = genInputs.AH_FuelFiredHeaterkW - 'Dim C37 = genInputs.BC_AuxHeaterEfficiency - 'Dim C38 = genInputs.BC_GCVDieselOrHeatingOil - 'Dim C39 = ssmTOOL.HVACConstants.FuelDensity - - Dim result As Double = 0 - - If Run1.TotalW < 0 AndAlso Run2.TotalW < 0 Then - result = Math.Abs(If(Run1.TotalW > Run2.TotalW, Run1.TechListAmendedFuelW, Run2.TechListAmendedFuelW) / 1000) - End If - - Dim FuelLPerHBaseAdjusted As Double = Math.Min(result, genInputs.AH_FuelFiredHeaterkW) / - genInputs.BC_AuxHeaterEfficiency * - (1 / (genInputs.BC_GCVDieselOrHeatingOil * ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)) - - Return FuelLPerHBaseAdjusted * Weight - End Function - End Class + Return FuelLPerHBaseAdjusted*Weight + End Function + End Class End Namespace diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb index 9c5ee5828b132c42c63a184441dbb544689ddc58..e3a3f8f8879ca5d7d4ea8a3f2903182667851a64 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb @@ -1,4 +1,5 @@ -Imports System.Text +Imports System.IO +Imports System.Text Imports NUnit.Framework Imports NUnit Imports VectoAuxiliaries @@ -16,6 +17,10 @@ Public Class AuxiliaryPersistanceTests 'We load the previously saved config into the Emptu Aux 'We then compare the two Aux's, if they are the same persistance has worked and they are the same. + <OneTimeSetUp> + Public Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + End Sub Public Sub SaveDefaultFile() diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb index f21248343a08496c1201f51952d344b8ba921688..7e50f6c2b043ddc081646036bd0dac9349742b8c 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb @@ -1,4 +1,5 @@ +Imports System.IO Imports VectoAuxiliaries.Pneumatics Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils @@ -24,6 +25,10 @@ Namespace UnitTests Private _defaultInputConfig As IPneumaticUserInputsConfig Private _Signals As ISignals = New Signals + <OneTimeSetUp> + Public Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + End Sub 'Constructors Public Sub New() diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb index c8bb4610d3731cae15c7d1756ffd1ad56faf3c03..2fbe17bf994010b1f065d22a458222427a1262bf 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb @@ -1,4 +1,5 @@ -Imports VectoAuxiliaries.Electrics +Imports System.IO +Imports VectoAuxiliaries.Electrics Imports VectoAuxiliaries.Hvac Imports VectoAuxiliaries Imports NUnit.Framework @@ -8,10 +9,15 @@ Namespace UnitTests <TestFixture()> Public Class M0_5_SmartAlternatorSetEfficiencyTests Private target As M0_5_SmartAlternatorSetEfficiency - Private signals = New Signals + 'Private signals = New Signals - Public Sub New() + <OneTimeSetUp> + Public Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + End Sub + Public Sub New() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) Initialise() End Sub diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb index 39f983cbd52f41fc270476f6a61648e19df8d171..f18a50b750f11230390331c7363e02000fe939b1 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb @@ -73,7 +73,7 @@ Namespace UnitTests <Test()> Public Sub EfficiencyValueTest() - Dim target As M0_NonSmart_AlternatorsSetEfficiency = New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, + Dim target = New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, alternatorMap, powernetVoltage, signals, GetSSM()) Dim actual As Single = target.AlternatorsEfficiency diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb index 02251b0ee0c4d5e00c763385c5da3df17519c670..5cb29bc551421735261f4696567d198c33c81a1b 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb @@ -1,4 +1,5 @@ -Imports NUnit.Framework +Imports System.IO +Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils Imports VectoAuxiliaries Imports VectoAuxiliaries.Electrics @@ -19,13 +20,20 @@ Namespace UnitTests Private m0 As IM0_NonSmart_AlternatorsSetEfficiency - Private alternatorMap As IAlternatorMap = New AlternatorMap(_GOODMAP) + Private alternatorMap As IAlternatorMap Private alternatorGearEfficiency As Single = 0.8 Private compressorGrearEfficiency As Single = 0.8 + <OneTimeSetUp> + Public Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + End Sub Public Sub New() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + + alternatorMap = New AlternatorMap(_GOODMAP) alternatorMap.Initialise() ssm.Load(_SSMMAP) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb index 568ab56168241e1d61e2458d3992c5e595cf835d..8d3a448356993a4e9cd40748f02c0da12d9264ea 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb @@ -1,4 +1,5 @@ -Imports NUnit.Framework +Imports System.IO +Imports NUnit.Framework Imports VectoAuxiliaries.Pneumatics Imports VectoAuxiliariesTests.Mocks Imports VectoAuxiliaries @@ -13,6 +14,11 @@ Namespace UnitTests Private Const GOODTechListALLOFF As String = "TestFiles\testSSMTechBenefitsALLOFF.csv" Private Const GOODTechListEMPTYLIST As String = "TestFiles\testSSMTechBenefitsEMPTYLIST.csv" + <OneTimeSetUp> + Public Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + End Sub + 'Helpers Private Sub AddDefaultTechLine(source As ISSMTOOL) diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd index ce4445daf29f983ec72df2cce34fff9cdcf86552..87aaa30b5f06b7fc9bd7c979cdb41f1e8d270711 100644 --- a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd +++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd @@ -19,7 +19,7 @@ <xs:sequence> <xs:element name="Model" minOccurs="0"> <xs:annotation> - <xs:documentation>P241 / I.1.8.1</xs:documentation> + <xs:documentation>P241 / I.1.8.1 / #96</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationMethod" type="AirdragCertificationOptionType"> @@ -48,7 +48,7 @@ <xs:sequence> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P221 / I.1.6.1</xs:documentation> + <xs:documentation>P221 / I.1.6.1 / #93</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationMethod" type="vdecdef:AngledriveCertificationOptionType"> @@ -58,7 +58,7 @@ </xs:element> <xs:element name="CertificationNumber" type="vdecdef:CertificationNumberType" minOccurs="0"> <xs:annotation> - <xs:documentation>P265 / I.1.6.2</xs:documentation> + <xs:documentation>P265 / I.1.6.2 / #94</xs:documentation> </xs:annotation> </xs:element> <xs:element name="DigestValue" type="xs:token"> @@ -111,7 +111,7 @@ <xs:sequence> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P216 / I.1.7.1</xs:documentation> + <xs:documentation>P216 / I.1.7.1 / #95</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationMethod" type="vdecdef:AxlegearCertificationOptionType"> @@ -201,7 +201,7 @@ <xs:sequence> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P201 / I.1.2.1</xs:documentation> + <xs:documentation>P201 / I.1.2.1 / #85</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationNumber" type="vdecdef:CertificationNumberType"> @@ -280,7 +280,7 @@ <xs:sequence> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P205 / I.1.3.1</xs:documentation> + <xs:documentation>P205 / I.1.3.1 / #86</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationMethod" type="vdecdef:GearboxCertificationOptionType"> @@ -379,17 +379,17 @@ <xs:sequence minOccurs="0"> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P226 / I.1.4.1</xs:documentation> + <xs:documentation>P226 / I.1.4.1 / #87</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationMethod" type="vdecdef:RetarderCertificationOptionType"> <xs:annotation> - <xs:documentation>P255 / I.1.4.3</xs:documentation> + <xs:documentation>P255 / I.1.4.3 / #89</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationNumber" type="vdecdef:CertificationNumberType" minOccurs="0"> <xs:annotation> - <xs:documentation>P266 / I.1.4.2</xs:documentation> + <xs:documentation>P266 / I.1.4.2 / #88</xs:documentation> </xs:annotation> </xs:element> <xs:element name="DigestValue" type="xs:token"> @@ -437,17 +437,17 @@ <xs:sequence> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P211 / I.1.5.1</xs:documentation> + <xs:documentation>P211 / I.1.5.1 / #90</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationMethod" type="vdecdef:TorqueConverterCertificationOptionType"> <xs:annotation> - <xs:documentation>P257 / I.1.5.3</xs:documentation> + <xs:documentation>P257 / I.1.5.3 / #92</xs:documentation> </xs:annotation> </xs:element> <xs:element name="CertificationNumber" type="vdecdef:CertificationNumberType" minOccurs="0"> <xs:annotation> - <xs:documentation>P263 / I.1.5.2</xs:documentation> + <xs:documentation>P263 / I.1.5.2 / #91</xs:documentation> </xs:annotation> </xs:element> <xs:element name="DigestValue" type="xs:token"> @@ -654,7 +654,7 @@ <xs:sequence> <xs:element name="Model" type="vdecdef:ModelType"> <xs:annotation> - <xs:documentation>P236 / I.1.1.2</xs:documentation> + <xs:documentation>P236 / I.1.1.2 / #79</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Manufacturer" type="vdecdef:ManufacturerType"> @@ -704,17 +704,17 @@ </xs:element> <xs:element name="ZeroEmissionVehicle" type="xs:boolean"> <xs:annotation> - <xs:documentation>P269 / I.1.1.10</xs:documentation> + <xs:documentation>P269 / I.1.1.10 / #81</xs:documentation> </xs:annotation> </xs:element> <xs:element name="HybridElectricHDV" type="xs:boolean"> <xs:annotation> - <xs:documentation>P279 / I.1.1.11</xs:documentation> + <xs:documentation>P279 / I.1.1.11 / #82</xs:documentation> </xs:annotation> </xs:element> <xs:element name="DualFuelVehicle" type="xs:boolean"> <xs:annotation> - <xs:documentation>P280 / I.1.1.12</xs:documentation> + <xs:documentation>P280 / I.1.1.12 / #83</xs:documentation> </xs:annotation> </xs:element> <xs:choice> @@ -731,12 +731,12 @@ </xs:element> <xs:element name="VocationalVehicle" type="xs:boolean"> <xs:annotation> - <xs:documentation>P270 / I.1.1.9</xs:documentation> + <xs:documentation>P270 / I.1.1.9 / #80</xs:documentation> </xs:annotation> </xs:element> <xs:element name="SleeperCab" type="xs:boolean"> <xs:annotation> - <xs:documentation>P276 / I.1.1.13</xs:documentation> + <xs:documentation>P276 / I.1.1.13 / #84</xs:documentation> </xs:annotation> </xs:element> <xs:element name="PTO" type="xs:boolean"> @@ -904,22 +904,22 @@ <xs:sequence> <xs:element name="EngineStopStart" type="xs:boolean"> <xs:annotation> - <xs:documentation>P271 / I.1.12.1</xs:documentation> + <xs:documentation>P271 / I.1.12.1 / #97</xs:documentation> </xs:annotation> </xs:element> <xs:element name="EcoRollWithoutEngineStop" type="xs:boolean"> <xs:annotation> - <xs:documentation>P272 / I.1.12.2</xs:documentation> + <xs:documentation>P272 / I.1.12.2 / #98</xs:documentation> </xs:annotation> </xs:element> <xs:element name="EcoRollWithEngineStop" type="xs:boolean"> <xs:annotation> - <xs:documentation>P273 / I.1.12.3</xs:documentation> + <xs:documentation>P273 / I.1.12.3 / #99</xs:documentation> </xs:annotation> </xs:element> <xs:element name="PredictiveCruiseControl" type="xs:boolean"> <xs:annotation> - <xs:documentation>P274 / I.1.12.4</xs:documentation> + <xs:documentation>P274 / I.1.12.4 / #100</xs:documentation> </xs:annotation> </xs:element> </xs:sequence>