| Line |
Col. |
Type |
Symbol |
ID |
Obj |
Message |
| 18 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'astor' |
| 19 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'black' |
| 20 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'json' (imported line 11) |
| 20 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "import json" should be placed before "import astor" |
| 20 |
0 |
convention |
ungrouped-imports |
C0412 |
|
Imports from package json are not grouped |
| 21 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'numpy' |
| 22 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'deepcopy' (imported line 14) |
| 22 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from copy import deepcopy" should be placed before "import astor" |
| 22 |
0 |
convention |
ungrouped-imports |
C0412 |
|
Imports from package copy are not grouped |
| 23 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'Path' (imported line 15) |
| 23 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from pathlib import Path" should be placed before "import astor" |
| 23 |
0 |
convention |
ungrouped-imports |
C0412 |
|
Imports from package pathlib are not grouped |
| 24 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'Union' (imported line 16) |
| 24 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from typing import List, Union" should be placed before "import astor" |
| 24 |
0 |
convention |
ungrouped-imports |
C0412 |
|
Imports from package typing are not grouped |
| 24 |
0 |
warning |
unused-import |
W0611 |
|
Unused List imported from typing |
| 25 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pydantic' |
| 26 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.agent' |
| 27 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.datamodels' |
| 28 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.errors' |
| 29 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.module' |
| 30 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.utils' |
| 31 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels' |
| 32 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.models.casadi_model' |
| 33 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.modules.mpc_full' |
| 35 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.optimization_backends.casadi_.basic' |
| 36 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.data_structures.casadi_utils' |
| 52 |
0 |
refactor |
too-many-instance-attributes |
R0902 |
FlexAgentGenerator |
Too many instance attributes (17/7) |
| 199 |
0 |
convention |
line-too-long |
C0301 |
|
Line too long (104/100) |
| 205 |
0 |
convention |
line-too-long |
C0301 |
|
Line too long (104/100) |
| 228 |
13 |
convention |
invalid-name |
C0103 |
FlexAgentGenerator.generate_flex_agents |
Variable name "f" doesn't conform to snake_case naming style |
| 234 |
28 |
warning |
unnecessary-lambda |
W0108 |
FlexAgentGenerator.generate_flex_agents.<lambda> |
Lambda may not be necessary |
| 277 |
17 |
convention |
invalid-name |
C0103 |
FlexAgentGenerator.append_module_and_dump_agent |
Variable name "f" doesn't conform to snake_case naming style |
| 327 |
4 |
refactor |
too-many-branches |
R0912 |
FlexAgentGenerator.adapt_mpc_module_config |
Too many branches (18/12) |
| 538 |
16 |
convention |
unnecessary-dunder-call |
C2801 |
FlexAgentGenerator.adapt_market_config |
Unnecessarily calls dunder method __setattr__. Set attribute directly or use setattr built-in function. |
| 567 |
29 |
warning |
protected-access |
W0212 |
FlexAgentGenerator.get_collocation_time_grid |
Access to a protected member _collocation_polynomial of a client class |
| 579 |
4 |
refactor |
too-many-locals |
R0914 |
FlexAgentGenerator._generate_flex_model_definition |
Too many local variables (17/15) |
| 601 |
65 |
convention |
invalid-name |
C0103 |
FlexAgentGenerator._generate_flex_model_definition |
Variable name "f" doesn't conform to snake_case naming style |
| 651 |
57 |
convention |
invalid-name |
C0103 |
FlexAgentGenerator._generate_flex_model_definition |
Variable name "f" doesn't conform to snake_case naming style |
| 677 |
4 |
refactor |
too-many-branches |
R0912 |
FlexAgentGenerator.run_config_validations |
Too many branches (19/12) |
| 741 |
8 |
refactor |
no-else-raise |
R1720 |
FlexAgentGenerator.run_config_validations |
Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it |
| 835 |
68 |
convention |
invalid-name |
C0103 |
FlexAgentGenerator.adapt_sim_results_path |
Variable name "f" doesn't conform to snake_case naming style |
| Line |
Col. |
Type |
Symbol |
ID |
Obj |
Message |
| 4 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.modules' |
| 5 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "import os" should be placed before "from agentlib_mpc.modules import minlp_mpc, mpc_full" |
| 6 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "import math" should be placed before "from agentlib_mpc.modules import minlp_mpc, mpc_full" |
| 7 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'numpy' |
| 8 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pandas' |
| 9 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from typing import Optional, Dict" should be placed before "from agentlib_mpc.modules import minlp_mpc, mpc_full" |
| 10 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pydantic' |
| 11 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from collections.abc import Iterable" should be placed before "from agentlib_mpc.modules import minlp_mpc, mpc_full" |
| 12 |
0 |
warning |
unused-import |
W0611 |
|
Unused agentlib_flexquant.data_structures.globals imported as glbs |
| 13 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib' |
| 13 |
0 |
convention |
wrong-import-order |
C0411 |
|
third party import "from agentlib import AgentVariable" should be placed before "import agentlib_flexquant.data_structures.globals as glbs" |
| 14 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.modules' |
| 14 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'mpc_full' (imported line 4) |
| 14 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'minlp_mpc' (imported line 4) |
| 14 |
0 |
convention |
wrong-import-order |
C0411 |
|
third party import "from agentlib_mpc.modules import mpc_full, minlp_mpc" should be placed before "import agentlib_flexquant.data_structures.globals as glbs" |
| 14 |
0 |
convention |
ungrouped-imports |
C0412 |
|
Imports from package agentlib_mpc are not grouped |
| 15 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels' |
| 15 |
0 |
convention |
wrong-import-order |
C0411 |
|
third party import "from agentlib_mpc.data_structures.mpc_datamodels import Results" should be placed before "import agentlib_flexquant.data_structures.globals as glbs" |
| 19 |
0 |
convention |
missing-class-docstring |
C0115 |
FlexibilityBaselineMPCConfig |
Missing class docstring |
| 19 |
0 |
refactor |
too-few-public-methods |
R0903 |
FlexibilityBaselineMPCConfig |
Too few public methods (0/2) |
| 72 |
12 |
warning |
bare-except |
W0702 |
FlexibilityBaselineMPC.__init__ |
No exception type(s) specified |
| 88 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityBaselineMPC.set_actuation |
Missing function or method docstring |
| 107 |
8 |
convention |
invalid-name |
C0103 |
FlexibilityBaselineMPC.set_output |
Variable name "df" doesn't conform to snake_case naming style |
| 229 |
4 |
refactor |
too-many-arguments |
R0913 |
FlexibilityBaselineMPC._run_simulation |
Too many arguments (6/5) |
| 229 |
4 |
refactor |
too-many-locals |
R0914 |
FlexibilityBaselineMPC._run_simulation |
Too many local variables (18/15) |
| 230 |
49 |
warning |
unused-argument |
W0613 |
FlexibilityBaselineMPC._run_simulation |
Unused argument 'mpc_time_step' |
| 258 |
30 |
warning |
eval-used |
W0123 |
FlexibilityBaselineMPC._run_simulation |
Use of eval |
| 277 |
0 |
convention |
missing-class-docstring |
C0115 |
FlexibilityBaselineMINLPMPCConfig |
Missing class docstring |
| 277 |
0 |
refactor |
too-few-public-methods |
R0903 |
FlexibilityBaselineMINLPMPCConfig |
Too few public methods (0/2) |
| 330 |
12 |
warning |
bare-except |
W0702 |
FlexibilityBaselineMINLPMPC.__init__ |
No exception type(s) specified |
| 352 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityBaselineMINLPMPC.set_actuation |
Missing function or method docstring |
| 370 |
8 |
convention |
invalid-name |
C0103 |
FlexibilityBaselineMINLPMPC.set_output |
Variable name "df" doesn't conform to snake_case naming style |
| 489 |
4 |
refactor |
too-many-arguments |
R0913 |
FlexibilityBaselineMINLPMPC._run_simulation |
Too many arguments (6/5) |
| 489 |
4 |
refactor |
too-many-locals |
R0914 |
FlexibilityBaselineMINLPMPC._run_simulation |
Too many local variables (19/15) |
| 490 |
49 |
warning |
unused-argument |
W0613 |
FlexibilityBaselineMINLPMPC._run_simulation |
Unused argument 'mpc_time_step' |
| 527 |
30 |
warning |
eval-used |
W0123 |
FlexibilityBaselineMINLPMPC._run_simulation |
Use of eval |
| Line |
Col. |
Type |
Symbol |
ID |
Obj |
Message |
| 1 |
0 |
convention |
missing-module-docstring |
C0114 |
|
Missing module docstring |
| 5 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib' |
| 6 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'numpy' |
| 7 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pandas' |
| 9 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.datamodels' |
| 9 |
0 |
convention |
wrong-import-order |
C0411 |
|
third party import "from agentlib.core.datamodels import AgentVariable" should be placed before "import agentlib_flexquant.data_structures.globals as glbs" |
| 10 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pydantic' |
| 10 |
0 |
convention |
wrong-import-order |
C0411 |
|
third party import "from pydantic import ConfigDict, Field, model_validator" should be placed before "import agentlib_flexquant.data_structures.globals as glbs" |
| 16 |
0 |
convention |
missing-class-docstring |
C0115 |
FlexibilityMarketModuleConfig |
Missing class docstring |
| 16 |
0 |
refactor |
too-few-public-methods |
R0903 |
FlexibilityMarketModuleConfig |
Too few public methods (1/2) |
| 61 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityMarketModuleConfig.check_results_file_extension |
Missing function or method docstring |
| 84 |
8 |
warning |
attribute-defined-outside-init |
W0201 |
FlexibilityMarketModule.set_random_seed |
Attribute 'random_generator' defined outside __init__ |
| 96 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityMarketModule.register_callbacks |
Missing function or method docstring |
| 118 |
8 |
warning |
attribute-defined-outside-init |
W0201 |
FlexibilityMarketModule.register_callbacks |
Attribute 'cooldown_ticker' defined outside __init__ |
| 124 |
8 |
convention |
invalid-name |
C0103 |
FlexibilityMarketModule.write_results |
Variable name "df" doesn't conform to snake_case naming style |
| 136 |
62 |
warning |
unused-argument |
W0613 |
FlexibilityMarketModule.random_flexibility_callback |
Unused argument 'name' |
| 180 |
0 |
convention |
line-too-long |
C0301 |
|
Line too long (102/100) |
| 195 |
20 |
warning |
attribute-defined-outside-init |
W0201 |
FlexibilityMarketModule.random_flexibility_callback |
Attribute 'cooldown_ticker' defined outside __init__ |
| 202 |
62 |
warning |
unused-argument |
W0613 |
FlexibilityMarketModule.single_flexibility_callback |
Unused argument 'name' |
| 256 |
8 |
warning |
unnecessary-pass |
W0107 |
FlexibilityMarketModule.custom_flexibility_callback |
Unnecessary pass statement |
| 258 |
29 |
warning |
unused-argument |
W0613 |
FlexibilityMarketModule.dummy_callback |
Unused argument 'inp' |
| 258 |
49 |
warning |
unused-argument |
W0613 |
FlexibilityMarketModule.dummy_callback |
Unused argument 'name' |
| 269 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityMarketModule.process |
Missing function or method docstring |
| Line |
Col. |
Type |
Symbol |
ID |
Obj |
Message |
| 8 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'numpy' |
| 9 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pandas' |
| 10 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pydantic' |
| 11 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'Dict' (imported line 4) |
| 11 |
0 |
warning |
reimported |
W0404 |
|
Reimport 'Union' (imported line 4) |
| 11 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from typing import Dict, Union, Optional" should be placed before "import numpy as np" |
| 11 |
0 |
convention |
ungrouped-imports |
C0412 |
|
Imports from package typing are not grouped |
| 12 |
0 |
convention |
wrong-import-order |
C0411 |
|
standard import "from collections.abc import Iterable" should be placed before "import numpy as np" |
| 13 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.datamodels' |
| 14 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.modules' |
| 16 |
0 |
warning |
unused-import |
W0611 |
|
Unused full_trajectory_prefix imported from agentlib_flexquant.data_structures.globals |
| 16 |
0 |
warning |
unused-import |
W0611 |
|
Unused STORED_ENERGY_ALIAS_NEG imported from agentlib_flexquant.data_structures.globals |
| 16 |
0 |
warning |
unused-import |
W0611 |
|
Unused STORED_ENERGY_ALIAS_POS imported from agentlib_flexquant.data_structures.globals |
| 24 |
0 |
convention |
missing-class-docstring |
C0115 |
FlexibilityShadowMPCConfig |
Missing class docstring |
| 24 |
0 |
refactor |
too-few-public-methods |
R0903 |
FlexibilityShadowMPCConfig |
Too few public methods (0/2) |
| 62 |
12 |
warning |
bare-except |
W0702 |
FlexibilityShadowMPC.__init__ |
No exception type(s) specified |
| 71 |
8 |
convention |
invalid-name |
C0103 |
FlexibilityShadowMPC.set_output |
Variable name "df" doesn't conform to snake_case naming style |
| 137 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityShadowMPC.register_callbacks |
Missing function or method docstring |
| 180 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityShadowMPC.process |
Missing function or method docstring |
| 238 |
4 |
refactor |
too-many-arguments |
R0913 |
FlexibilityShadowMPC._run_simulation |
Too many arguments (6/5) |
| 238 |
4 |
refactor |
too-many-locals |
R0914 |
FlexibilityShadowMPC._run_simulation |
Too many local variables (18/15) |
| 239 |
49 |
warning |
unused-argument |
W0613 |
FlexibilityShadowMPC._run_simulation |
Unused argument 'mpc_time_step' |
| 267 |
30 |
warning |
eval-used |
W0123 |
FlexibilityShadowMPC._run_simulation |
Use of eval |
| 286 |
0 |
convention |
missing-class-docstring |
C0115 |
FlexibilityShadowMINLPMPCConfig |
Missing class docstring |
| 286 |
0 |
refactor |
too-few-public-methods |
R0903 |
FlexibilityShadowMINLPMPCConfig |
Too few public methods (0/2) |
| 324 |
12 |
warning |
bare-except |
W0702 |
FlexibilityShadowMINLPMPC.__init__ |
No exception type(s) specified |
| 327 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityShadowMINLPMPC.register_callbacks |
Missing function or method docstring |
| 376 |
4 |
convention |
missing-function-docstring |
C0116 |
FlexibilityShadowMINLPMPC.process |
Missing function or method docstring |
| 390 |
8 |
convention |
invalid-name |
C0103 |
FlexibilityShadowMINLPMPC.set_output |
Variable name "df" doesn't conform to snake_case naming style |
| 509 |
4 |
refactor |
too-many-arguments |
R0913 |
FlexibilityShadowMINLPMPC._run_simulation |
Too many arguments (6/5) |
| 509 |
4 |
refactor |
too-many-locals |
R0914 |
FlexibilityShadowMINLPMPC._run_simulation |
Too many local variables (19/15) |
| 510 |
49 |
warning |
unused-argument |
W0613 |
FlexibilityShadowMINLPMPC._run_simulation |
Unused argument 'mpc_time_step' |
| 547 |
30 |
warning |
eval-used |
W0123 |
FlexibilityShadowMINLPMPC._run_simulation |
Use of eval |
| Line |
Col. |
Type |
Symbol |
ID |
Obj |
Message |
| 1 |
0 |
convention |
missing-module-docstring |
C0114 |
|
Missing module docstring |
| 1 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pydantic' |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[362:543]
==agentlib_flexquant.modules.shadow_mpc:[382:563]
if not self.config.set_outputs:
return
self.logger.info("Sending optimal output values to data_broker.")
# simulate with the casadi simulator
self.sim_flex_model(solution)
df = solution.df
if self.flex_results is not None:
for output in self.var_ref.outputs:
if output not in [
self.config.power_variable_name,
self.config.storage_variable_name,
]:
series = df.variable[output]
self.set(output, series)
# send the power and storage variable value from simulation results
upsampled_output_power = self.flex_results[self.config.power_variable_name]
self.set(self.config.power_variable_name, upsampled_output_power)
if self.config.storage_variable_name is not None:
upsampled_output_storage = self.flex_results[self.config.storage_variable_name]
self.set(self.config.storage_variable_name, upsampled_output_storage.dropna())
else:
for output in self.var_ref.outputs:
series = df.variable[output]
self.set(output, series)
def sim_flex_model(self, solution):
"""simulate the flex model over the preditcion horizon and save results"""
# return if sim_time_step is not a positive integer and system is in provision
if not (self.config.casadi_sim_time_step > 0 and not self.get("in_provision").value):
return
# read the defined simulation time step
sim_time_step = self.config.casadi_sim_time_step
mpc_time_step = self.config.time_step
# set the horizon length and the number of simulation steps
total_horizon_time = int(self.config.prediction_horizon * self.config.time_step)
n_simulation_steps = math.ceil(total_horizon_time / sim_time_step)
# read the current optimization result
result_df = solution.df
# initialize the flex sim results Dataframe
self._initialize_flex_results(
n_simulation_steps, total_horizon_time, sim_time_step, result_df
)
# Update model parameters and initial states
self._update_model_parameters()
self._update_initial_states(result_df)
# Run simulation
self._run_simulation(
n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
)
# set index of flex results to the same as mpc result
store_results_df = self.flex_results.copy(deep=True)
store_results_df.index = self.flex_results.index.tolist()
# save results
if not os.path.exists(self.res_file_flex):
store_results_df.to_csv(self.res_file_flex)
else:
store_results_df.to_csv(self.res_file_flex, mode="a", header=False)
# set the flex results format same as mpc result while updating Agentvariable
self.flex_results.index = self.flex_results.index.get_level_values(1)
def _initialize_flex_results(
self, n_simulation_steps, horizon_length, sim_time_step, result_df
):
"""Initialize the flex results dataframe with the correct dimension and index and fill with
existing results from optimization"""
# create MultiIndex for collocation points
index_coll = pd.MultiIndex.from_arrays(
[[self.env.now] * len(result_df.index), result_df.index],
names=["time_step", "time"]
# Match the names with multi_index but note they're reversed
)
# create Multiindex for full simulation sample times
index_full_sample = pd.MultiIndex.from_tuples(
zip(
[self.env.now] * (n_simulation_steps + 1),
range(0, horizon_length + sim_time_step, sim_time_step),
),
names=["time_step", "time"],
)
# merge indexes
new_index = index_coll.union(index_full_sample).sort_values()
# initialize the flex results with correct dimension
self.flex_results = pd.DataFrame(np.nan, index=new_index, columns=self.var_ref.outputs)
# Get the optimization outputs and create a series for fixed optimization outputs with the
# correct MultiIndex format
opti_outputs = result_df.variable[self.config.power_variable_name]
fixed_opti_output = pd.Series(
opti_outputs.values,
index=index_coll,
)
# fill the output value at the time step where it already exists in optimization output
for idx in fixed_opti_output.index:
if idx in self.flex_results.index:
self.flex_results.loc[idx, self.config.power_variable_name] = fixed_opti_output[idx]
def _update_model_parameters(self):
"""update the value of module parameters with value from config,
since creating a model just reads the value in the model class but not the config
"""
for par in self.config.parameters:
self.flex_model.set(par.name, par.value)
def _update_initial_states(self, result_df):
"""set the initial value of states"""
# get state values from the mpc optimization result
state_values = result_df.variable[self.var_ref.states]
# update state values with last measurement
for state, value in zip(self.var_ref.states, state_values.iloc[0]):
self.flex_model.set(state, value)
def _run_simulation(
self, n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
):
"""simulate with flex model over the prediction horizon"""
# get control and input values from the mpc optimization result
control_values = result_df.variable[
[*self.var_ref.controls, *self.var_ref.binary_controls]
].dropna()
input_values = result_df.parameter[self.var_ref.inputs].dropna()
# Get the simulation time step index
sim_time_index = np.arange(0, (n_simulation_steps + 1) * sim_time_step, sim_time_step)
# Reindex the controls and inputs to sim_time_index
control_values_full = control_values.copy().reindex(sim_time_index, method="ffill")
input_values_full = input_values.copy().reindex(sim_time_index, method="nearest")
for i in range(0, n_simulation_steps):
current_sim_time = i * sim_time_step
# Apply control and input values from the appropriate MPC step
for control, value in zip(
self.var_ref.controls,
control_values_full.loc[current_sim_time, self.var_ref.controls],
):
self.flex_model.set(control, value)
for binary_control, value in zip(
self.var_ref.binary_controls,
control_values_full.loc[current_sim_time, self.var_ref.binary_controls],
):
self.flex_model.set(binary_control, value)
for input_var, value in zip(
self.var_ref.inputs, input_values_full.loc[current_sim_time]
):
# change the type of iterable input, since casadi model can't deal with iterable
if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
self.flex_model.get(input_var).type = type(value).__name__
self.flex_model.set(input_var, value)
# do integration
# reduce the simulation time step so that the total horizon time will not be exceeded
if current_sim_time + sim_time_step <= total_horizon_time:
t_sample = sim_time_step
else:
t_sample = total_horizon_time - current_sim_time
self.flex_model.do_step(t_start=0, t_sample=t_sample)
# save output
for output in self.var_ref.outputs:
self.flex_results.loc[
(self.env.now, current_sim_time + t_sample), output
] = self.flex_model.get_output(output).value |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[98:234]
==agentlib_flexquant.modules.shadow_mpc:[382:514]
if not self.config.set_outputs:
return
self.logger.info("Sending optimal output values to data_broker.")
# simulate with the casadi simulator
self.sim_flex_model(solution)
# extract solution DataFrama
df = solution.df
# send the outputs
if self.flex_results is not None:
for output in self.var_ref.outputs:
if output not in [
self.config.power_variable_name,
self.config.storage_variable_name,
]:
series = df.variable[output]
self.set(output, series)
# send the power and storage variable value from simulation results
upsampled_output_power = self.flex_results[self.config.power_variable_name]
self.set(self.config.power_variable_name, upsampled_output_power)
if self.config.storage_variable_name is not None:
upsampled_output_storage = self.flex_results[self.config.storage_variable_name]
self.set(self.config.storage_variable_name, upsampled_output_storage.dropna())
else:
for output in self.var_ref.outputs:
series = df.variable[output]
self.set(output, series)
def sim_flex_model(self, solution):
"""simulate the flex model over the preditcion horizon and save results"""
# return if sim_time_step is not a positive integer and system is in provision
if not (self.config.casadi_sim_time_step > 0 and not self.get("in_provision").value):
return
# read the defined simulation time step
sim_time_step = self.config.casadi_sim_time_step
mpc_time_step = self.config.time_step
# set the horizon length and the number of simulation steps
total_horizon_time = int(self.config.prediction_horizon * self.config.time_step)
n_simulation_steps = math.ceil(total_horizon_time / sim_time_step)
# read the current optimization result
result_df = solution.df
# initialize the flex sim results Dataframe
self._initialize_flex_results(
n_simulation_steps, total_horizon_time, sim_time_step, result_df
)
# Update model parameters and initial states
self._update_model_parameters()
self._update_initial_states(result_df)
# Run simulation
self._run_simulation(
n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
)
# set index of flex results to the same as mpc result
store_results_df = self.flex_results.copy(deep=True)
store_results_df.index = self.flex_results.index.tolist()
# save results
if not os.path.exists(self.res_file_flex):
store_results_df.to_csv(self.res_file_flex)
else:
store_results_df.to_csv(self.res_file_flex, mode="a", header=False)
# set the flex results format same as mpc result while updating Agentvariable
self.flex_results.index = self.flex_results.index.get_level_values(1)
def _initialize_flex_results(
self, n_simulation_steps, horizon_length, sim_time_step, result_df
):
"""Initialize the flex results dataframe with the correct dimension and index
and fill with existing results from optimization
"""
# create MultiIndex for collocation points
index_coll = pd.MultiIndex.from_arrays(
[[self.env.now] * len(result_df.index), result_df.index],
names=["time_step", "time"]
# Match the names with multi_index but note they're reversed
)
# create Multiindex for full simulation sample times
index_full_sample = pd.MultiIndex.from_tuples(
zip(
[self.env.now] * (n_simulation_steps + 1),
range(0, horizon_length + sim_time_step, sim_time_step),
),
names=["time_step", "time"],
)
# merge indexes
new_index = index_coll.union(index_full_sample).sort_values()
# initialize the flex results with correct dimension
self.flex_results = pd.DataFrame(np.nan, index=new_index, columns=self.var_ref.outputs)
# Get the optimization outputs and create a series for fixed optimization outputs with the
# correct MultiIndex format
opti_outputs = result_df.variable[self.config.power_variable_name]
fixed_opti_output = pd.Series(
opti_outputs.values,
index=index_coll,
)
# fill the output value at the time step where it already exists in optimization output
for idx in fixed_opti_output.index:
if idx in self.flex_results.index:
self.flex_results.loc[idx, self.config.power_variable_name] = fixed_opti_output[idx]
def _update_model_parameters(self):
"""update the value of module parameters with value from config,
since creating a model just reads the value in the model class but not the config
"""
for par in self.config.parameters:
self.flex_model.set(par.name, par.value)
def _update_initial_states(self, result_df):
"""set the initial value of states"""
# get state values from the mpc optimization result
state_values = result_df.variable[self.var_ref.states]
# update state values with last measurement
for state, value in zip(self.var_ref.states, state_values.iloc[0]):
self.flex_model.set(state, value)
def _run_simulation(
self, n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
):
"""simulate with flex model over the prediction horizon"""
# get control and input values from the mpc optimization result |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[181:276]
==agentlib_flexquant.modules.shadow_mpc:[190:285]
index_coll = pd.MultiIndex.from_arrays(
[[self.env.now] * len(result_df.index), result_df.index],
names=["time_step", "time"]
# Match the names with multi_index but note they're reversed
)
# create Multiindex for full simulation sample times
index_full_sample = pd.MultiIndex.from_tuples(
zip(
[self.env.now] * (n_simulation_steps + 1),
range(0, horizon_length + sim_time_step, sim_time_step),
),
names=["time_step", "time"],
)
# merge indexes
new_index = index_coll.union(index_full_sample).sort_values()
# initialize the flex results with correct dimension
self.flex_results = pd.DataFrame(np.nan, index=new_index, columns=self.var_ref.outputs)
# Get the optimization outputs and create a series for fixed optimization outputs with the
# correct MultiIndex format
opti_outputs = result_df.variable[self.config.power_variable_name]
fixed_opti_output = pd.Series(
opti_outputs.values,
index=index_coll,
)
# fill the output value at the time step where it already exists in optimization output
for idx in fixed_opti_output.index:
if idx in self.flex_results.index:
self.flex_results.loc[idx, self.config.power_variable_name] = fixed_opti_output[idx]
def _update_model_parameters(self):
"""update the value of module parameters with value from config,
since creating a model just reads the value in the model class but not the config
"""
for par in self.config.parameters:
self.flex_model.set(par.name, par.value)
def _update_initial_states(self, result_df):
"""set the initial value of states"""
# get state values from the mpc optimization result
state_values = result_df.variable[self.var_ref.states]
# update state values with last measurement
for state, value in zip(self.var_ref.states, state_values.iloc[0]):
self.flex_model.set(state, value)
def _run_simulation(
self, n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
):
"""simulate with flex model over the prediction horizon"""
# get control and input values from the mpc optimization result
control_values = result_df.variable[self.var_ref.controls].dropna()
input_values = result_df.parameter[self.var_ref.inputs].dropna()
# Get the simulation time step index
sim_time_index = np.arange(0, (n_simulation_steps + 1) * sim_time_step, sim_time_step)
# Reindex the controls and inputs to sim_time_index
control_values_full = control_values.copy().reindex(sim_time_index, method="ffill")
input_values_full = input_values.copy().reindex(sim_time_index, method="nearest")
for i in range(0, n_simulation_steps):
current_sim_time = i * sim_time_step
# Apply control and input values from the appropriate MPC step
for control, value in zip(
self.var_ref.controls, control_values_full.loc[current_sim_time]
):
self.flex_model.set(control, value)
for input_var, value in zip(
self.var_ref.inputs, input_values_full.loc[current_sim_time]
):
# change the type of iterable input, since casadi model can't deal with iterable
if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
self.flex_model.get(input_var).type = type(value).__name__
self.flex_model.set(input_var, value)
# do integration
# reduce the simulation time step so that the total horizon time will not be exceeded
if current_sim_time + sim_time_step <= total_horizon_time:
t_sample = sim_time_step
else:
t_sample = total_horizon_time - current_sim_time
self.flex_model.do_step(t_start=0, t_sample=t_sample)
# save output
for output in self.var_ref.outputs:
self.flex_results.loc[
(self.env.now, current_sim_time + t_sample), output
] = self.flex_model.get_output(output).value
|
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[109:181]
==agentlib_flexquant.modules.shadow_mpc:[72:137]
if self.flex_results is not None:
for output in self.var_ref.outputs:
if output not in [
self.config.power_variable_name,
self.config.storage_variable_name,
]:
series = df.variable[output]
self.set(output, series)
# send the power and storage variable value from simulation results
upsampled_output_power = self.flex_results[self.config.power_variable_name]
self.set(self.config.power_variable_name, upsampled_output_power)
if self.config.storage_variable_name is not None:
upsampled_output_storage = self.flex_results[self.config.storage_variable_name]
self.set(self.config.storage_variable_name, upsampled_output_storage.dropna())
else:
for output in self.var_ref.outputs:
series = df.variable[output]
self.set(output, series)
def sim_flex_model(self, solution):
"""simulate the flex model over the preditcion horizon and save results"""
# return if sim_time_step is not a positive integer and system is in provision
if not (self.config.casadi_sim_time_step > 0 and not self.get("in_provision").value):
return
# read the defined simulation time step
sim_time_step = self.config.casadi_sim_time_step
mpc_time_step = self.config.time_step
# set the horizon length and the number of simulation steps
total_horizon_time = int(self.config.prediction_horizon * self.config.time_step)
n_simulation_steps = math.ceil(total_horizon_time / sim_time_step)
# read the current optimization result
result_df = solution.df
# initialize the flex sim results Dataframe
self._initialize_flex_results(
n_simulation_steps, total_horizon_time, sim_time_step, result_df
)
# Update model parameters and initial states
self._update_model_parameters()
self._update_initial_states(result_df)
# Run simulation
self._run_simulation(
n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
)
# set index of flex results to the same as mpc result
store_results_df = self.flex_results.copy(deep=True)
store_results_df.index = self.flex_results.index.tolist()
# save results
if not os.path.exists(self.res_file_flex):
store_results_df.to_csv(self.res_file_flex)
else:
store_results_df.to_csv(self.res_file_flex, mode="a", header=False)
# set the flex results format same as mpc result while updating Agentvariable
self.flex_results.index = self.flex_results.index.get_level_values(1)
def register_callbacks(self): |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[441:494]
==agentlib_flexquant.modules.shadow_mpc:[190:243]
index_coll = pd.MultiIndex.from_arrays(
[[self.env.now] * len(result_df.index), result_df.index],
names=["time_step", "time"]
# Match the names with multi_index but note they're reversed
)
# create Multiindex for full simulation sample times
index_full_sample = pd.MultiIndex.from_tuples(
zip(
[self.env.now] * (n_simulation_steps + 1),
range(0, horizon_length + sim_time_step, sim_time_step),
),
names=["time_step", "time"],
)
# merge indexes
new_index = index_coll.union(index_full_sample).sort_values()
# initialize the flex results with correct dimension
self.flex_results = pd.DataFrame(np.nan, index=new_index, columns=self.var_ref.outputs)
# Get the optimization outputs and create a series for fixed optimization outputs with
# the correct MultiIndex format
opti_outputs = result_df.variable[self.config.power_variable_name]
fixed_opti_output = pd.Series(
opti_outputs.values,
index=index_coll,
)
# fill the output value at the time step where it already exists in optimization output
for idx in fixed_opti_output.index:
if idx in self.flex_results.index:
self.flex_results.loc[idx, self.config.power_variable_name] = fixed_opti_output[idx]
def _update_model_parameters(self):
"""update the value of module parameters with value from config,
since creating a model just reads the value in the model class but not the config
"""
for par in self.config.parameters:
self.flex_model.set(par.name, par.value)
def _update_initial_states(self, result_df):
"""set the initial value of states"""
# get state values from the mpc optimization result
state_values = result_df.variable[self.var_ref.states]
# update state values with last measurement
for state, value in zip(self.var_ref.states, state_values.iloc[0]):
self.flex_model.set(state, value)
def _run_simulation(
self, n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
):
"""simulate with flex model over the prediction horizon"""
# get control and input values from the mpc optimization result |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[253:276]
==agentlib_flexquant.modules.shadow_mpc:[542:563]
for input_var, value in zip(
self.var_ref.inputs, input_values_full.loc[current_sim_time]
):
# change the type of iterable input, since casadi model can't deal with iterable
if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
self.flex_model.get(input_var).type = type(value).__name__
self.flex_model.set(input_var, value)
# do integration
# reduce the simulation time step so that the total horizon time will not be exceeded
if current_sim_time + sim_time_step <= total_horizon_time:
t_sample = sim_time_step
else:
t_sample = total_horizon_time - current_sim_time
self.flex_model.do_step(t_start=0, t_sample=t_sample)
# save output
for output in self.var_ref.outputs:
self.flex_results.loc[
(self.env.now, current_sim_time + t_sample), output
] = self.flex_model.get_output(output).value |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[522:543]
==agentlib_flexquant.modules.shadow_mpc:[262:285]
for input_var, value in zip(
self.var_ref.inputs, input_values_full.loc[current_sim_time]
):
# change the type of iterable input, since casadi model can't deal with iterable
if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
self.flex_model.get(input_var).type = type(value).__name__
self.flex_model.set(input_var, value)
# do integration
# reduce the simulation time step so that the total horizon time will not be exceeded
if current_sim_time + sim_time_step <= total_horizon_time:
t_sample = sim_time_step
else:
t_sample = total_horizon_time - current_sim_time
self.flex_model.do_step(t_start=0, t_sample=t_sample)
# save output
for output in self.var_ref.outputs:
self.flex_results.loc[
(self.env.now, current_sim_time + t_sample), output
] = self.flex_model.get_output(output).value |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[318:339]
==agentlib_flexquant.modules.shadow_mpc:[312:327]
if self.config.casadi_sim_time_step > 0:
# generate a separate flex_model for integration to ensure the model used in MPC
# optimization remains unaffected
self.flex_model = type(self.model)(dt=self.config.casadi_sim_time_step)
# generate the filename for the simulation results
self.res_file_flex = self.config.optimization_backend["results_file"].replace(
"mpc", "mpc_sim"
)
# clear the casadi simulator result at the first time step if already exists
try:
os.remove(self.res_file_flex)
except:
pass
def register_callbacks(self): |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[60:81]
==agentlib_flexquant.modules.shadow_mpc:[50:67]
if self.config.casadi_sim_time_step > 0:
# generate a separate flex_model for integration to ensure
# the model used in MPC optimization remains unaffected
self.flex_model = type(self.model)(dt=self.config.casadi_sim_time_step)
# generate the filename for the simulation results
self.res_file_flex = self.config.optimization_backend["results_file"].replace(
"mpc", "mpc_sim"
)
# clear the casadi simulator result at the first time step if already exists
try:
os.remove(self.res_file_flex)
except:
pass
def pre_computation_hook(self):
"""Calculate relative start and end times for flexibility provision.
When in provision mode, computes the relative timing for flexibility
events based on the external power profile timestamps and current
environment time.
""" |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[235:249]
==agentlib_flexquant.modules.shadow_mpc:[517:531]
input_values = result_df.parameter[self.var_ref.inputs].dropna()
# Get the simulation time step index
sim_time_index = np.arange(0, (n_simulation_steps + 1) * sim_time_step, sim_time_step)
# Reindex the controls and inputs to sim_time_index
control_values_full = control_values.copy().reindex(sim_time_index, method="ffill")
input_values_full = input_values.copy().reindex(sim_time_index, method="nearest")
for i in range(0, n_simulation_steps):
current_sim_time = i * sim_time_step
# Apply control and input values from the appropriate MPC step
for control, value in zip( |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[497:511]
==agentlib_flexquant.modules.shadow_mpc:[244:258]
input_values = result_df.parameter[self.var_ref.inputs].dropna()
# Get the simulation time step index
sim_time_index = np.arange(0, (n_simulation_steps + 1) * sim_time_step, sim_time_step)
# Reindex the controls and inputs to sim_time_index
control_values_full = control_values.copy().reindex(sim_time_index, method="ffill")
input_values_full = input_values.copy().reindex(sim_time_index, method="nearest")
for i in range(0, n_simulation_steps):
current_sim_time = i * sim_time_step
# Apply control and input values from the appropriate MPC step
for control, value in zip( |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.flexibility_indicator:[453:476]
==agentlib_flexquant.modules.flexibility_market:[87:96]
results_file = self.config.results_file
try:
results = pd.read_csv(results_file, header=[0], index_col=[0, 1])
return results
except FileNotFoundError:
self.logger.error("Results file %s was not found.", results_file)
return None
def register_callbacks(self): |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[282:288]
==agentlib_flexquant.modules.shadow_mpc:[25:31]
casadi_sim_time_step: int = Field(
default=0,
description="Time step for simulation with Casadi simulator. Value is read from "
"FlexQuantConfig",
)
power_variable_name: str = Field( |
| 1 |
0 |
refactor |
duplicate-code |
R0801 |
|
Similar lines in 2 files
==agentlib_flexquant.modules.flexibility_indicator:[324:332]
==agentlib_flexquant.modules.flexibility_market:[61:69]
if self.results_file and self.results_file.suffix != ".csv":
raise ValueError(
f"Invalid file extension for 'results_file': '{self.results_file}'. "
f"Expected a '.csv' file."
)
return self
|
| 2 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'numpy' |
| 3 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.errors' |
| 4 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.optimization_backends.casadi_.minlp_cia' |
| 5 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.optimization_backends.casadi_.core.casadi_backend' |
| 6 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels' |
| 12 |
4 |
warning |
raise-missing-from |
W0707 |
|
Consider explicitly re-raising using 'except ImportError as exc' and 'raise OptionalDependencyError(used_object='Pycombina', dependency_install='.\\ after cloning pycombina. Instructions: https://pycombina.readthedocs.io/en/latest/install.html#') from exc' |
| 14 |
29 |
warning |
anomalous-backslash-in-string |
W1401 |
|
Anomalous backslash in string: '\ '. String constant might be missing an r prefix. |
| 19 |
0 |
convention |
missing-class-docstring |
C0115 |
ConstrainedCIABackendConfig |
Missing class docstring |
| 19 |
0 |
refactor |
too-few-public-methods |
R0903 |
ConstrainedCIABackendConfig |
Too few public methods (0/2) |
| 27 |
4 |
convention |
missing-class-docstring |
C0115 |
ConstrainedCIABackendConfig.Config |
Missing class docstring |
| 27 |
4 |
refactor |
too-few-public-methods |
R0903 |
ConstrainedCIABackendConfig.Config |
Too few public methods (0/2) |
| 32 |
0 |
convention |
missing-class-docstring |
C0115 |
ConstrainedCasADiCIABackend |
Missing class docstring |
| 32 |
0 |
refactor |
too-few-public-methods |
R0903 |
ConstrainedCasADiCIABackend |
Too few public methods (1/2) |
| 36 |
4 |
warning |
useless-parent-delegation |
W0246 |
ConstrainedCasADiCIABackend.__init__ |
Useless parent or super() delegation in method '__init__' |
| 39 |
4 |
convention |
missing-function-docstring |
C0116 |
ConstrainedCasADiCIABackend.do_pycombina |
Missing function or method docstring |
| 52 |
12 |
refactor |
no-else-continue |
R1724 |
ConstrainedCasADiCIABackend.do_pycombina |
Unnecessary "elif" after "continue", remove the leading "el" from "elif" |
| 64 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 20 spaces, expected 16 |
| 67 |
0 |
convention |
line-too-long |
C0301 |
|
Line too long (149/100) |
| 68 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 20 spaces, expected 16 |
| 70 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 20 spaces, expected 16 |
| 71 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 20 spaces, expected 16 |
| 72 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 20 spaces, expected 16 |
| 74 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 24 spaces, expected 20 |
| 77 |
0 |
warning |
bad-indentation |
W0311 |
|
Bad indentation. Found 24 spaces, expected 20 |
| Line |
Col. |
Type |
Symbol |
ID |
Obj |
Message |
| 1 |
0 |
convention |
missing-module-docstring |
C0114 |
|
Missing module docstring |
| 4 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pandas' |
| 5 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib.core.agent' |
| 6 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.utils' |
| 7 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.utils.analysis' |
| 8 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'agentlib_mpc.utils.plotting.interactive' |
| 9 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'dash' |
| 10 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'plotly' |
| 11 |
0 |
error |
import-error |
E0401 |
|
Unable to import 'pydantic' |
| 13 |
0 |
refactor |
consider-using-from-import |
R0402 |
|
Use 'from agentlib_flexquant.data_structures import flex_results' instead |
| 20 |
0 |
refactor |
too-few-public-methods |
R0903 |
CustomBound |
Too few public methods (0/2) |
| 46 |
0 |
refactor |
too-many-instance-attributes |
R0902 |
Dashboard |
Too many instance attributes (8/7) |
| 64 |
4 |
refactor |
too-many-arguments |
R0913 |
Dashboard.__init__ |
Too many arguments (7/5) |
| 88 |
8 |
convention |
invalid-name |
C0103 |
Dashboard.__init__ |
Attribute name "LINE_PROPERTIES" doesn't conform to snake_case naming style |
| 110 |
12 |
refactor |
unnecessary-comprehension |
R1721 |
Dashboard.__init__ |
Unnecessary use of a comprehension, use list(self.intersection_mpcs_sim.keys()) instead. |
| 110 |
28 |
convention |
consider-iterating-dictionary |
C0201 |
Dashboard.__init__ |
Consider iterating the dictionary directly instead of calling .keys() |
| 119 |
4 |
refactor |
too-many-statements |
R0915 |
Dashboard.show |
Too many statements (135/50) |
| 218 |
34 |
convention |
invalid-name |
C0103 |
Dashboard.show.plot_one_mpc_variable._add_step_to_data |
Argument name "s" doesn't conform to snake_case naming style |
| 343 |
8 |
refactor |
inconsistent-return-statements |
R1710 |
Dashboard.show.plot_flexibility_kpi |
Either all return statements in a function should return an expression, or none of them should. |
| 499 |
8 |
refactor |
inconsistent-return-statements |
R1710 |
Dashboard.show.mark_characteristic_times_of_accepted_offers |
Either all return statements in a function should return an expression, or none of them should. |
| 527 |
8 |
refactor |
too-many-arguments |
R0913 |
Dashboard.show.create_plot |
Too many arguments (6/5) |
| 561 |
29 |
convention |
consider-iterating-dictionary |
C0201 |
Dashboard.show.create_plot |
Consider iterating the dictionary directly instead of calling .keys() |
| 581 |
16 |
convention |
invalid-name |
C0103 |
Dashboard.show.create_plot |
Variable name "ts" doesn't conform to snake_case naming style |
| 608 |
23 |
refactor |
use-dict-literal |
R1735 |
Dashboard.show.create_plot |
Consider using '{"t": 20, "b": 20}' instead of a call to 'dict'. |
| 698 |
41 |
warning |
f-string-without-interpolation |
W1309 |
Dashboard.show |
Using an f-string that does not have any interpolated variables |