Skip to content

[BUG] threshold in stats.plot.effects is not working #719

Description

@PStange

What's broken?

Es werden auch nicht investierte Komponenten trotz threshold im plot angezeigt, siehe Beispiel. In diesem sollte S2 nicht dargestellt werden.

Code to reproduce

import pandas as pd
import flixopt as fx


timesteps = pd.date_range('2024-01-15 08:00', periods=2, freq='h')

flow_system = fx.FlowSystem(timesteps)

flow_system.add_elements(
    fx.Bus('Heat', carrier='heat'),
    fx.Effect('costs', '€', 'Total Costs', is_standard=True, is_objective=True),
    fx.Source(
        'S1',
        outputs=[fx.Flow('S1', bus='Heat',
                         size=fx.InvestParameters(minimum_size=10,
                                                  maximum_size=500,
                                                  effects_of_investment_per_size=10,
                                                  mandatory=False),
                         effects_per_flow_hour=10)],
    ),
    fx.Source(
        'S2',
        outputs=[fx.Flow('S2', bus='Heat',
                         size=fx.InvestParameters(minimum_size=10,
                                                  maximum_size=500,
                                                  effects_of_investment_per_size=100,
                                                  mandatory=False),
                         effects_per_flow_hour=100)],
    ),
    fx.Sink(
        'ABC',
        inputs=[fx.Flow('abc', bus='Heat', size=1, fixed_relative_profile=222)],
    )
)

flow_system.optimize(fx.solvers.HighsSolver())

flow_system.stats.plot.effects('periodic', effect="costs", by="component", threshold=1.0, show=True)

Error message

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions