@@ -150,23 +150,27 @@ def subgroup(actor):
150150 @staticmethod
151151 def price_for (obj ) -> float :
152152 """
153- Either FinancialTransactionVolume_eur is 0, or delivery_price is 0
154- Add annual costs to this.
155- Returns the contracts total price
153+ FinancialTransactionVolume_eur includes all contract cost:
154+ 1. Energycarrier_volume x Energycarrier_price
155+ 2. Annual_fee
156+ 3. Taxes
157+ -> All parameters are determined in AnyLogic
156158
157159 Defaults to 0.0
158160 """
159- return (
160- obj .get ("FinancialTransactionVolume_eur" , 0.0 )
161- + CostItem .delivery_or_feedin_price (obj )
162- + obj .get ("annualFee_eur" , 0.0 )
161+ return round (
162+ (
163+ - obj .get ("FinancialTransactionVolume_eur" , 0.0 )
164+ ), # should be negative because costs are negative in frontend
165+ # but positive output from Anylogic
166+ 2 ,
163167 )
164168
165169 @staticmethod
166170 def delivery_or_feedin_price (obj ) -> float :
167- """Check for the delivery price. If no prices sets defaults to 0"""
171+ """Redundant function: Check for the delivery price. If no prices sets defaults to 0"""
168172 volume = obj .get ("EnergyTransactionVolume_kWh" , 0.0 )
169- if volume < 0 :
173+ if volume > 0 :
170174 return volume * (
171175 obj .get ("feedinTax_eurpkWh" , 0.0 ) + obj .get ("feedinPrice_eurpkWh" , 0.0 )
172176 )
@@ -177,9 +181,9 @@ def delivery_or_feedin_price(obj) -> float:
177181 @classmethod
178182 def from_dict (cls , obj : dict , actors : ActorWrapper ):
179183 return cls (
180- actors .find (obj ["contractScope " ]),
181- actors .find (obj ["contractHolder " ]),
182- CostItem .price_for (obj ),
184+ from_actor = actors .find (obj ["contractHolder " ]),
185+ to_actor = actors .find (obj ["contractScope " ]),
186+ price = CostItem .price_for (obj ),
183187 )
184188
185189 @classmethod
0 commit comments