Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ela-kotulska-frequenz opened this issue Nov 26, 2024 · 5 comments
Labels
part:docs Affects the documentation part:microgrid Affects the interactions with the microgrid priority:❓ We need to figure out how soon this should be addressed type:enhancement New feature or enhancement visitble to users

Comments

@ela-kotulska-frequenz
Copy link
Contributor

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

@ela-kotulska-frequenz ela-kotulska-frequenz added priority:❓ We need to figure out how soon this should be addressed type:bug Something isn't working labels Nov 26, 2024
@keywordlabeler keywordlabeler bot added the part:microgrid Affects the interactions with the microgrid label Nov 26, 2024
@shsms
Copy link
Contributor

shsms commented Nov 26, 2024

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.

@shsms
Copy link
Contributor

shsms commented Nov 26, 2024

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)

@llucax
Copy link
Contributor

llucax commented Nov 27, 2024

Should we convert this issue to a docs improvement issue?

@llucax llucax added part:docs Affects the documentation type:enhancement New feature or enhancement visitble to users and removed type:bug Something isn't working labels Nov 27, 2024
@llucax
Copy link
Contributor

llucax commented Nov 27, 2024

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

@ela-kotulska-frequenz
Copy link
Contributor Author

ela-kotulska-frequenz commented Nov 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:docs Affects the documentation part:microgrid Affects the interactions with the microgrid priority:❓ We need to figure out how soon this should be addressed type:enhancement New feature or enhancement visitble to users
Projects
Status: To do
Development

No branches or pull requests

3 participants