Skip to content

Move External State Updates from VariableKiosk to Engine #105

@SCiarella

Description

@SCiarella

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__.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions