Skip to content

42 add datadriven mpc #71

Open
sarahleidolf wants to merge 30 commits into
mainfrom
42-add-datadriven-mpc_
Open

42 add datadriven mpc #71
sarahleidolf wants to merge 30 commits into
mainfrom
42-add-datadriven-mpc_

Conversation

@sarahleidolf

Copy link
Copy Markdown
Collaborator
  • support datadriven mpc
  • adjust collocation time grid specification to general time grid information to allow multiple shooting

This reverts commit 43a6538
Resolve conflicts
note: not properly tested so far and did not check market with multiple shooting
# Resolved Conflicts:
#	agentlib_flexquant/data_structures/flex_results.py
#	agentlib_flexquant/generate_flex_agents.py
#	agentlib_flexquant/modules/shadow_mpc.py
#	agentlib_flexquant/utils/parsing.py
adjust example for linear regression / add to tests
minor changes

@FelixStege FelixStege left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! I left some minor comments

Comment thread agentlib_flexquant/generate_flex_agents.py Outdated
Comment thread agentlib_flexquant/generate_flex_agents.py Outdated
Comment thread agentlib_flexquant/generate_flex_agents.py Outdated
Comment thread agentlib_flexquant/generate_flex_agents.py Outdated
Comment thread examples/OneRoom_SimpleLinRegMPC/flex_configs/flexibility_agent_config.json Outdated
Comment thread agentlib_flexquant/modules/flexibility_indicator.py
Comment thread agentlib_flexquant/data_structures/flex_kpis.py Outdated
Comment thread agentlib_flexquant/modules/flexibility_indicator.py Outdated
…to zero" was removed

add model initialization in config validations, otherwise ML-model is not found
@sarahleidolf sarahleidolf requested a review from FelixStege April 9, 2026 15:03

@FelixStege FelixStege left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! Just some minor comments

default=KPISeries(name="power_flex_offer", unit="kW", integration_method=LINEAR),
description="Power flexibility",
)
power_flex_offer_prepared: KPISeries = pydantic.Field(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe power_flex_offer_prep_int?

self.power_flex_offer_prepared.value = self.power_flex_offer_prepared.value.drop(
time_grid_info["grid"], errors="ignore"
)
power_flex_offer = self.power_flex_offer_prepared.value.iloc[:-1]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to AgentLib-MPCs cost function, right? Can you add a short comment for that?

collocation_time_grid, errors="ignore"
series=self.power_flex_offer_prepared, mpc_time_grid=mpc_time_grid
)
# Calculate the average and stores the original value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove that?

Comment on lines +317 to +318
mpc_time_grid: the MPC time grid over the horizon
time_grid_info: Dictionary with 'type' and 'grid' keys for discretization info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between the mpc_time_grid and timegrid_info["grid"]? Maybe add a short description for that

Comment on lines 632 to 634
# ensure the first value is nan, since it is calculated with the state from the
# controlled system and thus the same for baseline and shadow mpcs
series.iloc[0] = np.nan

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this part as well, since it also messes with the cost calculation, if I am not mistaken

"field in the flex config."
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants