# natlabrockies/hycon architecture

> Architecture diagram of the GitHub repository natlabrockies/hycon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/natlabrockies/hycon
- Repository: https://github.com/natlabrockies/hycon

## Overview

1. **What Hycon is**
   Hycon is a Python package for real-time hybrid power plant control. Its core role is to sit between a plant simulator or plant runtime and a set of plant-level controllers, producing coordinated setpoints for assets like wind turbines, batteries, solar, and hydrogen systems.

2. **Top-level structure**
   The repository is organized around three main runtime subsystems:
   - `hycon/controllers`: control logic
   - `hycon/interfaces`: adapters to external simulators/control systems
   - `hycon/design_tools`: offline analysis and precomputation tools, especially for wake steering
   Supporting pieces include `examples/`, `tests/`, and `docs/`.

3. **Controller layer**
   Controllers are the main decision-making components. `controller_base.py` defines the common controller contract, and the concrete controllers implement different plant behaviors:
   - `battery_controller.py`
   - `solar_passthrough_controller.py`
   - `wind_farm_power_tracking_controller.py`
   - `hydrogen_plant_controller.py`
   - `lookup_based_wake_steering_controller.py`
   - `wake_steering_rosco_standin.py`
   - `hybrid_supervisory_controller.py`
   
   The supervisory controller is the main coordination boundary for hybrid plants, combining multiple asset-specific controllers into one plant-level decision path.

4. **Interface layer**
   The interface subsystem isolates Hycon from the runtime environment. `interface_base.py` defines the integration contract, while the concrete interfaces target specific external systems:
   - `hercules_interface.py` and `hercules_v1_interface.py` for Hercules-based simulation integration
   - `rosco_zmq_interface.py` for ROSCO communication over ZeroMQ
   - `python_interface_temp.py` as a temporary or experimental Python-side interface
   
   This layer is the key boundary where external plant state enters Hycon and setpoints/commands leave it.

5. **Data flow through the system**
   The typical flow is: external simulator or plant runtime sends measurements and state through an interface, the interface maps them into Hycon’s internal format, the appropriate controller computes setpoints or reference signals, and the interface returns those outputs to the external system. This makes Hycon an orchestration layer rather than a full simulator itself.

6. **Wake steering architecture**
   Wake steering is treated as a combination of design-time optimization and run-time control. `hycon/design_tools/wake_steering_design.py` and `wake_steering_visualization.py` support offline analysis, while the wake-steering controllers consume precomputed or lookup-based yaw strategies during operation. The repository also includes a ROSCO stand-in controller for scenarios where a lower-level yaw/torque controller is not available.

7. **External dependencies that shape the architecture**
   Hycon is explicitly designed to integrate with:
   - **Hercules** as a simulation/testbed environment
   - **FAST.Farm / OpenFAST** as turbine/farm simulation context
   - **ROSCO** as a lower-level controller
   - **FLORIS** as the wake-modeling/design tool used by wake-steering workflows
   
   These systems define the major integration boundaries and explain why the repo emphasizes adapters and design tools.

8. **Examples as executable architecture**
   The `examples/` directory shows the intended deployment patterns:
   - battery control and market revenue control
   - simple hybrid plant coordination
   - single-turbine flexible interconnect
   - wind farm power tracking
   - lookup-based wake steering using a FLORIS stand-in
   
   These examples use YAML configuration files, CSV time-series inputs, and `runscript.py` entry points, which indicates Hycon is configured primarily through files and executed as scripted simulations.

9. **Input/output model**
   Example assets include wind inputs, LMP price series, turbine/filter models, reference power profiles, and FLORIS input files. This suggests Hycon controllers are driven by time-series operational data and configuration documents rather than by a persistent internal database. Output handling is example-specific, often using plotting scripts to inspect controller behavior after a run.

10. **Testing and validation**
   The `tests/` folder validates the controller base, interface contracts, Hercules compatibility, battery logic, and wake-steering design tools. This implies the most important architectural contracts are not UI contracts but controller/interface behavior and external integration semantics.

11. **Packaging and runtime environment**
   The repo is a standard Python project (`pyproject.toml`) with support for automated testing and release. The GitHub workflows cover continuous integration, publishing to Python package infrastructure, and GitHub Pages deployment for documentation. This reinforces that Hycon is meant to be installed and used as a library plus runnable example suite.

12. **Documentation boundary**
   The `docs/` tree provides installation, controller, interface, example, and design-tool documentation, which mirrors the code boundaries. For diagramming, it is helpful to show documentation as a separate support layer around the main runtime modules, not part of the control loop itself.

Main entry points: [`hycon/controllers/controller_base.py`](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/controller_base.py) (Controller base), [`hycon/controllers/hybrid_supervisory_controller.py`](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/hybrid_supervisory_controller.py) (Supervisory), [`hycon/interfaces/interface_base.py`](https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/interface_base.py) (Interface base), [`hycon/design_tools/wake_steering_design.py`](https://github.com/natlabrockies/hycon/blob/main/hycon/design_tools/wake_steering_design.py) (Wake design)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime core"]
  node_hycon_pkg["Hycon<br/>python package<br/>[__init__.py]"]
end

subgraph group_controllers["Controllers"]
  node_ctrl_base["Controller base<br/>contract<br/>[controller_base.py]"]
  node_supervisory_ctrl["Supervisory<br/>hybrid coordinator"]
  node_battery_ctrl["Battery<br/>asset controller"]
  node_solar_ctrl["Solar pass-through<br/>asset controller"]
  node_wind_ctrl["Wind tracking<br/>asset controller"]
  node_hydrogen_ctrl["Hydrogen<br/>asset controller"]
  node_wake_lookup_ctrl["Wake lookup<br/>wake-steering controller"]
  node_wake_rosco_ctrl["ROSCO stand-in<br/>wake-steering controller"]
end

subgraph group_interfaces["Interfaces"]
  node_iface_base["Interface base<br/>integration contract<br/>[interface_base.py]"]
  node_hercules_iface["Hercules<br/>simulation adapter"]
  node_hercules_v1_iface["Hercules v1<br/>simulation adapter"]
  node_rosco_iface["ROSCO ZMQ<br/>messaging adapter"]
  node_python_temp_iface["Python temp<br/>experimental adapter"]
end

subgraph group_design["Design tools"]
  node_wake_design["Wake design<br/>offline analysis"]
  node_wake_viz["Wake viz<br/>analysis tooling"]
end

subgraph group_support["Support"]
  node_examples["Examples<br/>runnable scenarios<br/>[readme.txt]"]
  node_docs["Docs<br/>documentation<br/>[intro.md]"]
  node_tests["Tests<br/>validation suite"]
end

node_hycon_pkg -->|"exposes"| node_ctrl_base
node_hycon_pkg -->|"exposes"| node_iface_base
node_hycon_pkg -->|"includes"| node_wake_design
node_ctrl_base -->|"base for"| node_supervisory_ctrl
node_ctrl_base -->|"base for"| node_battery_ctrl
node_ctrl_base -->|"base for"| node_solar_ctrl
node_ctrl_base -->|"base for"| node_wind_ctrl
node_ctrl_base -->|"base for"| node_hydrogen_ctrl
node_ctrl_base -->|"base for"| node_wake_lookup_ctrl
node_ctrl_base -->|"base for"| node_wake_rosco_ctrl
node_iface_base -->|"base for"| node_hercules_iface
node_iface_base -->|"base for"| node_hercules_v1_iface
node_iface_base -->|"base for"| node_rosco_iface
node_iface_base -->|"base for"| node_python_temp_iface
node_supervisory_ctrl -->|"coordinates"| node_battery_ctrl
node_supervisory_ctrl -->|"coordinates"| node_wind_ctrl
node_supervisory_ctrl -->|"coordinates"| node_solar_ctrl
node_supervisory_ctrl -->|"coordinates"| node_hydrogen_ctrl
node_wake_design -->|"feeds"| node_wake_lookup_ctrl
node_wake_design -->|"inspects"| node_wake_viz
node_hercules_iface -->|"invokes"| node_supervisory_ctrl
node_hercules_v1_iface -->|"invokes"| node_supervisory_ctrl
node_rosco_iface -->|"invokes"| node_wake_rosco_ctrl
node_python_temp_iface -->|"invokes"| node_supervisory_ctrl
node_examples -->|"demonstrates"| node_hercules_iface
node_examples -->|"demonstrates"| node_wake_design
node_docs -->|"documents"| node_hycon_pkg
node_tests -->|"verifies"| node_ctrl_base
node_tests -->|"verifies"| node_iface_base
node_tests -->|"verifies"| node_hercules_iface
node_tests -->|"verifies"| node_wake_design

click node_hycon_pkg "https://github.com/natlabrockies/hycon/blob/main/hycon/__init__.py"
click node_ctrl_base "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/controller_base.py"
click node_supervisory_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/hybrid_supervisory_controller.py"
click node_battery_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/battery_controller.py"
click node_solar_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/solar_passthrough_controller.py"
click node_wind_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/wind_farm_power_tracking_controller.py"
click node_hydrogen_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/hydrogen_plant_controller.py"
click node_wake_lookup_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/lookup_based_wake_steering_controller.py"
click node_wake_rosco_ctrl "https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/wake_steering_rosco_standin.py"
click node_iface_base "https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/interface_base.py"
click node_hercules_iface "https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/hercules_interface.py"
click node_hercules_v1_iface "https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/hercules_v1_interface.py"
click node_rosco_iface "https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/rosco_zmq_interface.py"
click node_python_temp_iface "https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/python_interface_temp.py"
click node_wake_design "https://github.com/natlabrockies/hycon/blob/main/hycon/design_tools/wake_steering_design.py"
click node_wake_viz "https://github.com/natlabrockies/hycon/blob/main/hycon/design_tools/wake_steering_visualization.py"
click node_examples "https://github.com/natlabrockies/hycon/blob/main/examples/readme.txt"
click node_docs "https://github.com/natlabrockies/hycon/blob/main/docs/intro.md"
click node_tests "https://github.com/natlabrockies/hycon/blob/main/tests/controller_base_test.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hycon_pkg toneBlue
class node_ctrl_base,node_supervisory_ctrl,node_battery_ctrl,node_solar_ctrl,node_wind_ctrl,node_hydrogen_ctrl,node_wake_lookup_ctrl,node_wake_rosco_ctrl toneAmber
class node_iface_base,node_hercules_iface,node_hercules_v1_iface,node_rosco_iface,node_python_temp_iface toneMint
class node_wake_design,node_wake_viz toneRose
class node_examples,node_docs,node_tests toneIndigo
```

## Components

### Runtime core

Main control loop for hybrid plant operation

- [Hycon](https://github.com/natlabrockies/hycon/blob/main/hycon/__init__.py): python package · Top-level package for hybrid power plant control · `hycon/__init__.py`

### Controllers

Plant-level decision logic and asset-specific control policies

- [Controller base](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/controller_base.py): contract · Shared controller interface and lifecycle · `hycon/controllers/controller_base.py`
- [Supervisory](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/hybrid_supervisory_controller.py): hybrid coordinator · Coordinates multiple asset controllers into one plant-level decision path · `hycon/controllers/hybrid_supervisory_controller.py`
- [Battery](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/battery_controller.py): asset controller · Battery charging and dispatch logic · `hycon/controllers/battery_controller.py`
- [Solar pass-through](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/solar_passthrough_controller.py): asset controller · Forwards or relays solar setpoints · `hycon/controllers/solar_passthrough_controller.py`
- [Wind tracking](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/wind_farm_power_tracking_controller.py): asset controller · Tracks wind farm power reference signals · `hycon/controllers/wind_farm_power_tracking_controller.py`
- [Hydrogen](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/hydrogen_plant_controller.py): asset controller · Hydrogen plant control logic · `hycon/controllers/hydrogen_plant_controller.py`
- [Wake lookup](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/lookup_based_wake_steering_controller.py): wake-steering controller · Uses precomputed lookup-based yaw strategies · `hycon/controllers/lookup_based_wake_steering_controller.py`
- [ROSCO stand-in](https://github.com/natlabrockies/hycon/blob/main/hycon/controllers/wake_steering_rosco_standin.py): wake-steering controller · Stand-in for lower-level yaw and torque control · `hycon/controllers/wake_steering_rosco_standin.py`

### Interfaces

Adapters to simulators and external control systems

- [Interface base](https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/interface_base.py): integration contract · Common adapter boundary for external runtimes · `hycon/interfaces/interface_base.py`
- [Hercules](https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/hercules_interface.py): simulation adapter · Integrates with Hercules-based simulation environments · `hycon/interfaces/hercules_interface.py`
- [Hercules v1](https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/hercules_v1_interface.py): simulation adapter · Older Hercules integration path · `hycon/interfaces/hercules_v1_interface.py`
- [ROSCO ZMQ](https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/rosco_zmq_interface.py): messaging adapter · Communicates with ROSCO over ZeroMQ · `hycon/interfaces/rosco_zmq_interface.py`
- [Python temp](https://github.com/natlabrockies/hycon/blob/main/hycon/interfaces/python_interface_temp.py): experimental adapter · Temporary Python-side interface for experiments · `hycon/interfaces/python_interface_temp.py`

### Design tools

Offline analysis and wake-steering precomputation

- [Wake design](https://github.com/natlabrockies/hycon/blob/main/hycon/design_tools/wake_steering_design.py): offline analysis · Precomputes wake-steering strategies and design data · `hycon/design_tools/wake_steering_design.py`
- [Wake viz](https://github.com/natlabrockies/hycon/blob/main/hycon/design_tools/wake_steering_visualization.py): analysis tooling · Visualizes wake-steering design results · `hycon/design_tools/wake_steering_visualization.py`

### Support

Examples, docs, tests, and packaging

- [Examples](https://github.com/natlabrockies/hycon/blob/main/examples/readme.txt): runnable scenarios · Executable deployment patterns and input data · `examples/readme.txt`
- [Docs](https://github.com/natlabrockies/hycon/blob/main/docs/intro.md): documentation · Installation, controller, interface, example, and design-tool docs · `docs/intro.md`
- [Tests](https://github.com/natlabrockies/hycon/blob/main/tests/controller_base_test.py): validation suite · Checks controller contracts and external integration behavior · `tests/controller_base_test.py`

## Connections

- Hycon → Controller base: exposes · Package exports controller abstractions
- Hycon → Interface base: exposes · Package exports interface abstractions
- Hycon → Wake design: includes · Package includes design tooling
- Controller base → Supervisory: base for · Common contract implemented by concrete controllers
- Controller base → Battery: base for · Common contract implemented by concrete controllers
- Controller base → Solar pass-through: base for · Common contract implemented by concrete controllers
- Controller base → Wind tracking: base for · Common contract implemented by concrete controllers
- Controller base → Hydrogen: base for · Common contract implemented by concrete controllers
- Controller base → Wake lookup: base for · Common contract implemented by concrete controllers
- Controller base → ROSCO stand-in: base for · Common contract implemented by concrete controllers
- Interface base → Hercules: base for · Common contract implemented by adapters
- Interface base → Hercules v1: base for · Common contract implemented by adapters
- Interface base → ROSCO ZMQ: base for · Common contract implemented by adapters
- Interface base → Python temp: base for · Common contract implemented by adapters
- Supervisory → Battery: coordinates · Combines asset-specific control outputs
- Supervisory → Wind tracking: coordinates · Combines asset-specific control outputs
- Supervisory → Solar pass-through: coordinates · Combines asset-specific control outputs
- Supervisory → Hydrogen: coordinates · Combines asset-specific control outputs
- Wake design → Wake lookup: feeds · Precomputed wake-steering strategies are consumed at runtime
- Wake design → Wake viz: inspects · Visualization supports design-time analysis
- Hercules → Supervisory: invokes · Maps simulator state into controller inputs
- Hercules v1 → Supervisory: invokes · Legacy Hercules runtime path
- ROSCO ZMQ → ROSCO stand-in: invokes · Messaging bridge for wake-steering control
- Python temp → Supervisory: invokes · Experimental Python-side execution path
- Examples → Hercules: demonstrates · Example scenarios use Hercules-style inputs and runscripts
- Examples → Wake design: demonstrates · Wake-steering examples use FLORIS-style design data
- Docs → Hycon: documents · Documentation mirrors the code architecture
- Tests → Controller base: verifies · Validates controller contract behavior
- Tests → Interface base: verifies · Validates interface contract behavior
- Tests → Hercules: verifies · Checks Hercules compatibility
- Tests → Wake design: verifies · Checks wake-steering design tool behavior
