Skip to content

In message received from PvPool.power_status target_power is None until someone set value to the microgrid #1118

Description

@ela-kotulska-frequenz

What happened?

I would like to receive pv power on every update of pv power or its bounds.

I receive power status from pv_pool.power_status.new_receiver() but until I send pv_pool.propose_power, the target_power is None.

Also on every update pv status is send 2 times. I expect 1 message per update.

async def main():
    await initialize_microgrid()

    pv_pool = microgrid.new_pv_pool(priority=1)
    pv_power = pv_pool.power.new_receiver()
    pv_status = pv_pool.power_status.new_receiver()

    counter = 0
    async for selected in select(pv_power, pv_status):
        if selected_from(selected, pv_power):
            print(f"PV power: {selected.message.value}")
        elif selected_from(selected, pv_status):
            print(f"PV status: {selected.message}")

        counter += 1
        if counter % 10 == 0:
            await pv_pool.propose_power(Power.from_watts(-counter))

Logs:

PV status: _Report(target_power=None, _inclusion_bounds=Bounds(lower=Power(value=-30000.0, exponent=0), upper=Power(value=0.0, exponent=0)), _exclusion_bounds=Bounds(lower=Power(value=0.0, exponent=0), upper=Power(value=0.0, exponent=0)))
PV status: _Report(target_power=None, _inclusion_bounds=Bounds(lower=Power(value=-60000.0, exponent=0), upper=Power(value=0.0, exponent=0)), _exclusion_bounds=Bounds(lower=Power(value=0.0, exponent=0), upper=Power(value=0.0, exponent=0)))
PV power: -39 kW
PV power: -39 kW
PV power: -39 kW
PV power: -39 kW
PV power: -39 kW
PV power: -39 kW
PV power: -39 kW
PV power: -39 kW
PV status: _Report(target_power=Power(value=-10.0, exponent=0), _inclusion_bounds=Bounds(lower=Power(value=-60000.0, exponent=0), upper=Power(value=0.0, exponent=0)), _exclusion_bounds=Bounds(lower=Power(value=0.0, exponent=0), upper=Power(value=0.0, exponent=0)))
PV status: _Report(target_power=Power(value=-10.0, exponent=0), _inclusion_bounds=Bounds(lower=Power(value=-60000.0, exponent=0), upper=Power(value=0.0, exponent=0)), _exclusion_bounds=Bounds(lower=Power(value=0.0, exponent=0), upper=Power(value=0.0, exponent=0)))

What did you expect instead?

  • target_power has correct pv power since startup. (not None)
  • I expect 1 message per update.

Affected version(s)

v1.0.0-rc1200, v1.0.0-rc1300,

Affected part(s)

Microgrid (API, component graph, etc.) (part:microgrid)

Extra information

No response

Activity

  1. shsms commented on Nov 26, 2024

    @shsms
    Contributor

    target_power is the power we want to set, not the measured power. So, I think the behaviour is correct. But maybe we can make it easier to understand.

  2. shsms commented on Nov 26, 2024

    @shsms
    Contributor

    Also on every update pv status is send 2 times. I expect 1 message per update.

    This is also a known issue, just hasn't been prioritized: #818 (comment)

  3. llucax commented on Nov 27, 2024

    @llucax
    Contributor

    Should we convert this issue to a docs improvement issue?

  4. added
    part:docsAffects the documentation
    type:enhancementNew feature or enhancement visitble to users
    and removed
    type:bugSomething isn't working
    on Nov 27, 2024
  5. llucax commented on Nov 27, 2024

    @llucax
    Contributor

    The power_status docs are definitely confusing as they talk about batteries, and I guess we could highlight there that is only for receiving the status of the power manager itself and not the readings from the components.

    Image


    The PVPoolReport.target_power docs are not super verbose but the attribute itself seems clear that is a target and not the actual read value, no? Maybe we can be more verbose in the docs anyway.

    Image

  6. ela-kotulska-frequenz commented on Nov 28, 2024

    @ela-kotulska-frequenz
    ContributorAuthor

    Should we convert this issue to a docs improvement issue?

    Yes, please! :) The name of the method is also confusing it could be power_manager_status or something else.

  7. added this to the Untriaged milestone on May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    part:docsAffects the documentationpart:microgridAffects the interactions with the microgridpriority:❓We need to figure out how soon this should be addressedtype:enhancementNew feature or enhancement visitble to users

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions