neural_policy_controller

Modules

neural_policy_controller_system module

class NeuralPolicyControllerSystem(input_size=None, output_size=None, input_output_schema=None, policy_model=None, **kwargs)[source]

Bases: System

Neural policy controller for RL-based building control.

This class implements a neural network-based controller that uses reinforcement learning techniques to optimize building energy performance. The controller takes the current state of the building as input and outputs control signals based on a trained policy.

Features:
  • The controller is based on a neural network model that takes as input the current state of the building and outputs the control signal

  • The neural network model is trained using reinforcement learning techniques to optimize building energy performance

  • The input and output of the controller is defined by a JSON schema that contains the keys and types of the input and output signals

  • The neural policy is initialized at instantiation and the weights are updated manually by the user, typically through a training process

Parameters:
  • input_size (int) – Size of the input state vector

  • output_size (int) – Size of the output control vector

  • input_output_schema (dict) – JSON schema defining input/output structure and ranges

  • policy_model (nn.Module, optional) – Pre-trained neural network policy. If None, a default architecture is created.

  • **kwargs – Additional keyword arguments passed to the parent System class

denormalize_output_data(data)[source]

Denormalize the output data using the schema. Inputs: data (numpy array or tensor of shape (output_size,)) Outputs: denormalized data (numpy array) The min and max values are stored in the input_output_schema[“output”] dictionary.

do_step(secondTime, dateTime, step_size, stepIndex)[source]

Do a single step of the system.

Parameters:
  • secondTime (float) – The current time in seconds.

  • dateTime (datetime.datetime) – The current date and time.

  • step_size (int) – The step size of the simulation in seconds.

  • stepIndex (int) – The current step index.

Return type:

None

initialize(start_time, end_time, step_size, simulator)[source]

Initialize the system.

Parameters:
  • start_time (datetime.datetime) – The start time of the simulation.

  • end_time (datetime.datetime) – The end time of the simulation.

  • step_size (int) – The step size of the simulation in seconds.

  • simulator (core.Simulator) – The simulator.

Return type:

None

load_policy_model(policy_path)[source]
normalize_input_data(data)[source]
select_action(state)[source]
validate_schema(data)[source]
property config