Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Facility BL adjustment math #1226

Closed
koay9f opened this issue Jun 2, 2023 · 3 comments
Closed

New Facility BL adjustment math #1226

koay9f opened this issue Jun 2, 2023 · 3 comments
Assignees
Labels

Comments

@koay9f
Copy link

koay9f commented Jun 2, 2023

Need to figure out how to separate the BL adjustment for normalization from the BL adjustment for new facilities

@koay9f
Copy link
Author

koay9f commented Mar 11, 2024

This is for the conversation we just had about getting the "Adjustment for Normalization" and "Adjustment for Other" numbers correct.

Test:
AdjustedStarStar - totalBaseline = Adjustment for Normalization + Adjustment for Other

@koay9f
Copy link
Author

koay9f commented Mar 25, 2024

FIX # 1:

groupMonthlyAnalysisCalculatedValuesClass.tx
line 115 (change is in line 122)
setAdjustedStar(baselineActualEnergyUse: number, modelYearDataAdjusted: number, baselineAdjustementInput: number, dataAdjustment: number) {
if (this.baselineModeledEnergyUse - modelYearDataAdjusted == 0) {
if (baselineActualEnergyUse + baselineAdjustementInput == 0) {
this.adjustedStar = (this.modeledEnergy + modelYearDataAdjusted);
} else if (this.modeledEnergy - modelYearDataAdjusted == 0) {
this.adjustedStar = (baselineActualEnergyUse + baselineAdjustementInput);
} else {
this.adjustedStar = (this.modeledEnergy - modelYearDataAdjusted) // this is the change! -koa
}
} else {
this.adjustedStar = (baselineActualEnergyUse + baselineAdjustementInput) * ((this.modeledEnergy - modelYearDataAdjusted) / (this.baselineModeledEnergyUse - modelYearDataAdjusted));
}
}

@koay9f
Copy link
Author

koay9f commented Mar 26, 2024

REVISION
groupMonthlyAnalysisCalculatedValuesClass.tx

  • setAdjustedStar
  • setAdjustedStarStar
  • setSavings
  • setBaselineAdjustmentForOtherV2
  • setBaselineAdjustmentForNormalization
setAdjustedStar(baselineActualEnergyUse: number, modelYearDataAdjusted: number, baselineAdjustementInput: number, dataAdjustment: number) {
if (this.baselineModeledEnergyUse - modelYearDataAdjusted == 0) {
if (this.modeledEnergy - modelYearDataAdjusted == 0) {  //M_i = 0 subcase is the weird one
           this.adjustedStar = (baselineActualEnergyUse + baselineAdjustementInput);
   } else {
             this.adjustedStar = (this.modeledEnergy - modelYearDataAdjusted)
             }
} else {
this.adjustedStar = (baselineActualEnergyUse + baselineAdjustementInput) * ((this.modeledEnergy - modelYearDataAdjusted) / (this.baselineModeledEnergyUse - modelYearDataAdjusted));
}
}

setAdjustedStarStar(dataAdjustment: number) {
        if (this.energyUse == 0) {
            this.adjustedStarStar = this.adjustedStar;
         } else {
            this.adjustedStarStar = this.adjustedStar * this.energyUse / (this.energyUse - dataAdjustment);
        }
    }

Basically - if any of those equal zero - do math special

setSavings() {
        if((baselineActualEnergyUse + baselineAdjustementInput)  !=0 &  (this.baselineModeledEnergyUse - modelYearDataAdjusted) !=0 & (this.modeledEnergy - modelYearDataAdjusted) != 0 ) {
this.savings = this.adjusted - this.energyUse;
} else{ ((baselineActualEnergyUse + baselineAdjustementInput)  - (this.baselineModeledEnergyUse - modelYearDataAdjusted)) + ((this.modeledEnergy - modelYearDataAdjusted) - (this.energyUse - dataAdjustment) )
    
} 
    }

setBaselineAdjustmentForNormalization(baselineActualEnergyUse: number, modelYearDataAdjustment: number, dataAdjustment: number) {
        if (this.summaryDataIndex >= 11) {
            let adjustedStarStarRatio: number = 1;
            if (this.energyUse != 0) {
                adjustedStarStarRatio = this.energyUse / (this.energyUse - dataAdjustment);
            }
       if ((this.baselineModeledEnergyUse - modelYearDataAdjustment) == 0) {
               if (this.modeledEnergy - modelYearDataAdjustment) { 
                    this.baselineAdjustmentForNormalization = baselineActualEnergyUse * adjustedStarStarRatio - baselineActualEnergyUse;
                } else {
                    this.baselineAdjustmentForNormalization = (this.modeledEnergy - modelYearDataAdjustment) * adjustedStarStarRatio - baselineActualEnergyUse;
                }
            } else {
                this.baselineAdjustmentForNormalization = baselineActualEnergyUse * ((this.modeledEnergy - modelYearDataAdjustment) / (this.baselineModeledEnergyUse - modelYearDataAdjustment)) * adjustedStarStarRatio - baselineActualEnergyUse
            }
        } else {
            this.baselineAdjustmentForNormalization = 0;
        }
    }

setBaselineAdjustmentForOtherV2(baselineAdjustementInput: number, modelYearDataAdjusted: number, dataAdjustment: number, baselineActualEnergyUse: number) {
        if ((this.energyUse - dataAdjustment) == 0 && this.energyUse != 0) {
            this.baselineAdjustmentForOtherV2 = baselineAdjustementInput;
        } else {
            let adjustedStarStarRatio: number = 1;
            if (this.energyUse != 0) {
                adjustedStarStarRatio = this.energyUse / (this.energyUse - dataAdjustment);
            }
          
  if ((this.baselineModeledEnergyUse - modelYearDataAdjusted) == 0) {
              if ((this.modeledEnergy - modelYearDataAdjusted) == 0) {
                    this.baselineAdjustmentForOtherV2 = baselineAdjustementInput * adjustedStarStarRatio ;
                } else {
                    this.baselineAdjustmentForOtherV2 = 0;
                }
            } else {
                this.baselineAdjustmentForOtherV2 = baselineAdjustementInput * ((this.modeledEnergy - modelYearDataAdjusted) / (this.baselineModeledEnergyUse - modelYearDataAdjusted)) * adjustedStarStarRatio - baselineActualEnergyUse;
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants