Skip to content

Fix inconsistent reading of agent share names#586

Merged
tsmbland merged 7 commits intomainfrom
agent_share_bug
Dec 3, 2024
Merged

Fix inconsistent reading of agent share names#586
tsmbland merged 7 commits intomainfrom
agent_share_bug

Conversation

@tsmbland
Copy link
Collaborator

@tsmbland tsmbland commented Nov 29, 2024

Description

Agent shares are specified in the agents files, and then referenced in technodata files to assign a share of existing capacity to the agent. The names specified in the technodata files must match the agents file, otherwise an error will be raised. However, as @Jin-Jun-Mei found, in some cases even when the names do match an error can still be raised.

The reason is that the process for reading in the agent share names is different for the agents file and technodata files. For the agents file (read_csv_agent_parameters), names are converted using a sub operation. For technodata files (read_technodictionary), names are first converted to snake case and then converted using a similar sub operation. If following conventional naming schemes, these end up being equivalent, but if you deviate from this you can end up with inconsistencies and MUSE complaining that you haven't specified an agent share which you have.

I've simplified this so that in both cases were just converting to snake case. This should leave no room for inconsistency, as long as the names match in the files. I've updated the documentation to make it clear that names should match between the files.

Also the trade model needed updating as the names didn't match between the files

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass: $ python -m pytest
  • The documentation builds and looks OK: $ python -m sphinx -b html docs docs/build

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@tsmbland tsmbland marked this pull request as ready for review November 29, 2024 11:46
@tsmbland tsmbland changed the title Remove to_agent_share conversion Fix inconsistent reading of agent share names Nov 29, 2024
@tsmbland tsmbland mentioned this pull request Nov 30, 2024
@tsmbland tsmbland self-assigned this Dec 2, 2024
Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

Nice and simple.

@tsmbland tsmbland merged commit 07b39a3 into main Dec 3, 2024
@tsmbland tsmbland deleted the agent_share_bug branch December 3, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Comments