Conversation
…it actually does.
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md # agentlib_mpc/__init__.py
This reverts commit dea0e19
# Conflicts: # CHANGELOG.md # agentlib_mpc/__init__.py # agentlib_mpc/modules/minlp_mpc.py # agentlib_mpc/optimization_backends/casadi_/admm.py # agentlib_mpc/optimization_backends/casadi_/full.py
# Conflicts: # CHANGELOG.md # agentlib_mpc/__init__.py
| t_sample: float = Field( | ||
| default=60, description="Sends the active variable every other t_sample" | ||
| ) | ||
| public_active_message: Optional[AgentVariable] = Field( |
There was a problem hiding this comment.
würden hier nicht auch einfach booleans reichen?
Wäre denke ich erstmal intuitiver für die Nutzung in der Config. Man könnte ja trotzdem noch in der Funktion eine erklärmessage implementieren, falls erwünscht?
Braucht man wirklich inactive und active wenn es nur an und aus gibt? Reicht dann nicht ein Wert?
|
|
||
| # 1. Get current MPC status (assume variable exists and is bool) | ||
| mpc_flag_var = self.get(self.config.mpc_active_flag.name) | ||
| mpc_is_active = bool(mpc_flag_var.value) # Assume value is not None |
There was a problem hiding this comment.
wäre es nicht sinnvoll hier einen Check einzubauen? Wenn die assumption nicht passt, könnte es nervig werden und None ergibt False. Weiß nicht, ob das hier gleichzusetzen ist.
| for state_name in self.var_ref.states: | ||
| state_trajectory = df["variable"][state_name] | ||
| # Convert index (which starts at 0) to actual timestamps | ||
| for idx, value in state_trajectory.items(): |
There was a problem hiding this comment.
hier Index evtl. umbenennen. Das sind ja eig die Zeitschritte (klar auch index) aber so nicht ganz so leicht verständlich aus meiner Sicht
| # Check if measurement is too old | ||
| if measurement_time is None: | ||
| # probably default value, we don't have fallback anyway | ||
| measurement_age = 0 |
| ) | ||
|
|
||
| def do_step(self): | ||
| """ |
There was a problem hiding this comment.
the function is implemented twice at the moment. see above
| # Call parent method to handle actuation | ||
| super().set_actuation(solution) | ||
|
|
||
| # class AgVarDropin: |
|
|
||
| if self.config.results_file.is_file(): | ||
| if self.results_file_exists(): | ||
| # todo, this case is weird, as it is the mistake-append |
Integrate mpc visualization with version 0.9.0 of AgentLib, which offers mas-wide dashboard.