package impact import ( "github.com/damirmukimov/city_resource_graph/models/customer" "github.com/damirmukimov/city_resource_graph/models/params" ) // ImpactMetrics represents environmental impact metrics for a given year. type ImpactMetrics struct { CO2Avoided float64 `json:"co2_avoided"` // CO₂ avoided (t CO₂/year) WaterReused float64 `json:"water_reused"` // Water reused (m³/year) WasteDiverted float64 `json:"waste_diverted"` // Waste diverted from landfill (t/year) } // CalculateImpact computes environmental impact metrics for a given year. func CalculateImpact(year int, custMetrics customer.CustomerMetrics, p *params.Params) ImpactMetrics { ip := p.Impact // CO₂ avoided from heat recovery // Formula: CO₂ = Heat_MWh × Grid_Factor × HX_Eff × Utilization heatMWh := ip.HeatMWh.GetYear(year) co2Avoided := heatMWh * ip.GridFactor * ip.HXEff * ip.Utilization // Water reused // Formula: Water_Reused = Total_Orgs × Water_Per_Org × Reuse_Rate waterReuseRate := ip.WaterReuseRate.GetYear(year) waterReused := float64(custMetrics.TotalOrgs) * ip.WaterPerOrg * waterReuseRate // Waste diverted // Formula: Waste_Diverted = Total_Orgs × Waste_Per_Org × Diversion_Rate wasteDiversionRate := ip.WasteDiversionRate.GetYear(year) wasteDiverted := float64(custMetrics.TotalOrgs) * ip.WastePerOrg * wasteDiversionRate return ImpactMetrics{ CO2Avoided: co2Avoided, WaterReused: waterReused, WasteDiverted: wasteDiverted, } }