WUR-AI / WUR-AI/diffWOFOST

Move External State Updates from VariableKiosk to Engine

Open
#105 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
25
Forks
6
Avg merge
2d 23h
Merged PRs (30d)
1

Description

As mentioned here, the VariableKiosk handles its own updates for external states. To make the architecture cleaner and more flexible (especially for ML), we want to move this responsibility to the Engine. This turns the Kiosk into a simple data container and lets the Engine orchestrate the data flow.

Proposed Change

Modify the Engine to accept an update_external_states function. This function will be called during initialization and at every simulation step.

class Engine:
    def __init__(self, update_external_states, ...):
        self.kiosk = VariableKiosk()
        self.update_external_states = update_external_states
        
        # Initial state update
        if self.update_external_states:
            self.update_external_states(self.start_date, self.kiosk)

    def _run(self):
        self.day, delt = self.timer()

        # Update states at each timestep
        if self.update_external_states:
            self.update_external_states(self.day, self.kiosk)
            
        # Continue with simulation...

This will require the following modifications:

  • Add update_external_states argument to Engine.
  • Implement the update calls in __init__ and _run.
  • Remove update logic from VariableKiosk.__call__.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Engine and VariableKiosk implementations and trace Engine initialization, _run, and VariableKiosk.call. Check existing tests around simulation startup and timestep updates. Done means the Engine invokes the optional callback at initialization and each step, while VariableKiosk no longer performs those updates itself.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, machine-learning
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.