How ilijakamenko/llm_pid_tuner works
This Python application iteratively tunes PID gains against a modeled plant. The user starts main.py, which simulates the closed-loop step response and passes it to LLM_PID_Tuner; the tuner evaluates response metrics and, unless early stopping applies, requests updated gains from an OpenAI-compatible API. The loop applies those gains, plots responses, and returns a history table. The README documents OpenAI and Ollama options; the sampled source shows both configured through the same client interface. The graph follows sampled runtime code; the standalone delay helper is not wired into this workflow.
Main entry points: main.py Tuning Runner · llm_pid_tuner.py Tuning Logic · pid_controller.py PID Controller
Components 11
Simulation
- Tuning Runner
main.py - Control Library
- Plots and History
main.py
PID Tuning
- PID Controller
pid_controller.py - Tuning Logic
llm_pid_tuner.py - Response Metrics
llm_pid_tuner.py
External Integrations
- LLM Client
llm_pid_tuner.py - OpenAI API
- Ollama API
Other components
- User
- Plant Model
Connections 13
- User → Tuning Runner: starts
- Tuning Runner → PID Controller: copies and updates
- Tuning Runner → PID Controller: builds transfer function
- Tuning Runner → Plant Model: simulates against
- Tuning Runner → Control Library: computes response
- Tuning Runner → Tuning Logic: passes response
- Tuning Logic → Response Metrics: computes metrics
- Response Metrics → Control Library: uses step info
- Tuning Logic → LLM Client: requests gains
- LLM Client → OpenAI API: calls when GPT model
- LLM Client → Ollama API: calls otherwise
- Tuning Logic → Tuning Runner: returns updated gains
- Tuning Runner → Plots and History: plots and returns