Code Duplication    Length = 26-26 lines in 2 locations

src/oemof/solph/flows/_non_convex_flow_block.py 2 locations

@@ 398-423 (lines=26) @@
395
396
        return activity_costs
397
398
    def _inactivity_costs(self):
399
        r"""
400
        .. math::
401
            \sum_{INACTIVITYCOSTFLOWS} \sum_t (1 - Y_{status}(t)) \
402
            \cdot c_{inactivity}
403
        """
404
        inactivity_costs = 0
405
406
        if self.INACTIVITYCOSTFLOWS:
407
            m = self.parent_block()
408
409
            for i, o in self.INACTIVITYCOSTFLOWS:
410
                if valid_sequence(
411
                    m.flows[i, o].nonconvex.inactivity_costs,
412
                    len(m.TIMESTEPS),
413
                ):
414
                    inactivity_costs += sum(
415
                        (1 - self.status[i, o, t])
416
                        * m.flows[i, o].nonconvex.inactivity_costs[t]
417
                        * m.tsam_weighting[t]
418
                        for t in m.TIMESTEPS
419
                    )
420
421
            self.inactivity_costs = Expression(expr=inactivity_costs)
422
423
        return inactivity_costs
424
425
    def _min_downtime_constraint(self):
426
        r"""
@@ 371-396 (lines=26) @@
368
369
        return shutdown_costs
370
371
    def _activity_costs(self):
372
        r"""
373
        .. math::
374
            \sum_{ACTIVITYCOSTFLOWS} \sum_t Y_{status}(t) \
375
            \cdot c_{activity}
376
        """
377
        activity_costs = 0
378
379
        if self.ACTIVITYCOSTFLOWS:
380
            m = self.parent_block()
381
382
            for i, o in self.ACTIVITYCOSTFLOWS:
383
                if valid_sequence(
384
                    m.flows[i, o].nonconvex.activity_costs,
385
                    len(m.TIMESTEPS),
386
                ):
387
                    activity_costs += sum(
388
                        self.status[i, o, t]
389
                        * m.flows[i, o].nonconvex.activity_costs[t]
390
                        * m.tsam_weighting[t]
391
                        for t in m.TIMESTEPS
392
                    )
393
394
            self.activity_costs = Expression(expr=activity_costs)
395
396
        return activity_costs
397
398
    def _inactivity_costs(self):
399
        r"""