Skip to content

Commit

Permalink
Use Merits CurveTools to sum Fever production curves
Browse files Browse the repository at this point in the history
Closes #1389
  • Loading branch information
noracato authored and mabijkerk committed Feb 15, 2024
1 parent 40788b8 commit daccc0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def demand_curve_from_activities
def production_curve_from_activities
Merit::CurveTools.add_curves(
calculable_activities.filter_map do |_, activity|
activity.activities.sum(&:production_curve) unless activity.empty?
unless activity.empty?
Merit::CurveTools.add_curves(activity.activities.map(&:production_curve))
end
end
) || EMPTY_CURVE
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/qernel/fever_facade/producer_adapter/inject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def inject_aggregator_attributes!(production)

# TODO: should be a method on collection of participants
demand = participants.sum(&:demand)
# puts @node.key
# puts demand
# puts production
# debugger if @node.key == :buildings_space_heater_heatpump_air_water_network_gas
edge = conv.output(:useable_heat).edges.first

edge.share = demand.positive? ? production / demand : 0.0
Expand Down

0 comments on commit daccc0a

Please sign in to comment.