Skip to content

Conversation

FWuellhorst
Copy link
Contributor

@EserSteffen the feature worked really well in a local test, I will now do annual simulations. Is the naming and style of the change fine for you?

Copy link
Collaborator

@EserSteffen EserSteffen left a comment

Choose a reason for hiding this comment

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

I like the feature, but I think it should not be in basicmpc.

There is a file mpc_full, which can be used to add more complicated features to mpc.
In this case, I think I would prefer a general approach, where the mpc has an input that activates or deactivates it, which can then be sent from a more general module.

Another possibility, if you would like to keep this feature unchanged, is creating a subclass, i.e. time-conditional mpc or something like that. I just want to make sure that the basempc remains readable for people that want to learn how to handle an mpc module.

@FWuellhorst
Copy link
Contributor Author

@EserSteffen : I agree and added the most general approach by introducing an AgentVariable in the base mpc. Do you agree with the format? The module to skip the MPC does not need to be in the modules, but I wanted to add an example to test the function.

FWuellhorst and others added 4 commits February 3, 2025 17:31
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	agentlib_mpc/__init__.py
@EserSteffen EserSteffen dismissed their stale review March 6, 2025 15:36

Edited it myself, now need external review

@EserSteffen EserSteffen self-requested a review March 6, 2025 15:37
Copy link
Collaborator

@EserSteffen EserSteffen left a comment

Choose a reason for hiding this comment

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

for me its fine now, please check everything works as expected after my change

@FWuellhorst
Copy link
Contributor Author

@EserSteffen : The example works now and the CI passes, so you could check again and approve?

Copy link
Contributor Author

@FWuellhorst FWuellhorst left a comment

Choose a reason for hiding this comment

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

Only a minor comment. Rest LGTM.

if results and "myMPCAgent" in results and "AgentLogger" in results["myMPCAgent"]:
agent_logger = results["myMPCAgent"]["AgentLogger"]
# Try "mpc_active" first, then "MPC_FLAG_ACTIVE"
for var_name in ["MPC_FLAG_ACTIVE"]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use datamodels var?

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.

3 participants