-
Notifications
You must be signed in to change notification settings - Fork 0
Modifying Calculations
Another way to change the model is to modify the calculations of the indicators and scores. The indicators are calculated using the CalculateValue functions in the file AvailableData.ts. These functions, or the auxiliary functions, can be modified to change the development of the indicators over time. The code below shows the CalculateValue function for GDP. To change how GDP is calculate the definition of gdpValue can be modified in the function below.
CalculateValue(month: number, energySubsidies: EnergySubsidies, investmentInRenewables: InvestmentInRenewables,
comfortableHousingTemperature: ComfortableHousingTemperature) {
let gdpLastMonth = this.getMonthsValue(month - 1);
let energySubsidiesLastMonth = energySubsidies.GetMonthsDecision(month - 1);
let investmentInRenewableLastMonth = investmentInRenewables.GetMonthsDecision(month - 1);
let fromMonth = ((month) > this.maxPastMonths) ? (month) - this.maxPastMonths : 0;
let sixMonthMinComfort = comfortableHousingTemperature.GetPastMinimum(fromMonth, month - 1);
let gdpValue = gdpLastMonth * (1 + energySubsidiesLastMonth * this.subsidiesImpactOnNextYearsGDP
+ investmentInRenewableLastMonth * this.renewInvestImpactOnNextYearsGDP
+ (sixMonthMinComfort - this.sixMonthMinComfortImpactOnGDPthreshold) * this.sixMonthMinComfortImpactOnGDP)
* (1 + this.defaultGrowth);
this.valuePush = gdpValue;
}The scores are calculated using the CalculateScore functions in the file keyPerformanceIndicators.ts. These functions can be modified to change how the score is defined based on the indicators. The code below shows the CalculateScore function for social score. To change how the social score is defined, the definition of score can be modified in this function.
CalculateScore(month: number, comfortableHousingTemperature: Array<ComfortableHousingTemperature>) {
let calculatedSum = 0;
for (var organizationID = 0; organizationID <= 1; organizationID++) {
calculatedSum += comfortableHousingTemperature[organizationID].getMonthsValue(month);
}
let calculatedScore = calculatedSum / this.benchmark * this._multiplier;
let score = calculatedScore > 100 ? 100 : (calculatedScore < 0 ? 0 : calculatedScore);
this.scorePush = score;
}