package financial import "math" // CapexEstimatorImpl implements CapexEstimator interface type CapexEstimatorImpl struct { config *Config } // NewCapexEstimator creates a new CAPEX estimator func NewCapexEstimator(config *Config) CapexEstimator { return &CapexEstimatorImpl{config: config} } // EstimateCapex estimates capital expenditure based on distance and resource type func (ce *CapexEstimatorImpl) EstimateCapex(resourceType string, distanceKm float64, annualVolume float64) float64 { // Get base CAPEX per km from config baseCapex, exists := ce.config.CapexPerKm[resourceType] if !exists { baseCapex = 20000 // Default estimate } // Base infrastructure cost infrastructureCost := baseCapex * distanceKm // Add connection costs (heat exchangers, meters, etc.) connectionCost := 20000.0 // Fixed connection cost // Scale factor based on volume (larger volumes need larger equipment) scaleFactor := 1.0 + math.Log10(math.Max(1, annualVolume/1000)) return (infrastructureCost + connectionCost) * scaleFactor }