imc-tuning-rules
Tuning tool for PI/PID controllers based on IMC methods.
Install
mkdir -p .claude/skills/imc-tuning-rules && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2566" && unzip -o skill.zip -d .claude/skills/imc-tuning-rules && rm skill.zipInstalls to .claude/skills/imc-tuning-rules
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Calculate PI/PID controller gains using Internal Model Control (IMC) tuning rules for first-order systems.Key capabilities
- →Calculate PI controller proportional gain
- →Calculate PI controller integral gain
- →Determine closed-loop time constant
- →Analyze first-order system response
How it works
The skill applies Internal Model Control tuning formulas to derive controller gains based on identified first-order process parameters. It uses a lambda tuning parameter to balance closed-loop speed against model uncertainty.
Inputs & outputs
When to use imc-tuning-rules
- →Tune PI controller gains
- →Calculate PID constants
- →Analyze first-order system response
- →Validate control loop stability
About this skill
IMC Tuning Rules for PI/PID Controllers
Overview
Internal Model Control (IMC) is a systematic method for tuning PI/PID controllers based on a process model. Once you've identified system parameters (K and tau), IMC provides controller gains.
Why IMC?
- Model-based: Uses identified process parameters directly
- Single tuning parameter: Just choose the closed-loop speed (lambda)
- Guaranteed stability: For first-order systems, always stable if model is accurate
- Predictable response: Closed-loop time constant equals lambda
IMC Tuning for First-Order Systems
For a first-order process with gain K and time constant tau:
Process: G(s) = K / (tau*s + 1)
The IMC-tuned PI controller gains are:
Kp = tau / (K * lambda)
Ki = Kp / tau = 1 / (K * lambda)
Kd = 0 (derivative not needed for first-order systems)
Where:
Kp= Proportional gainKi= Integral gain (units: 1/time)Kd= Derivative gain (zero for first-order)lambda= Desired closed-loop time constant (tuning parameter)
Choosing Lambda (λ)
Lambda controls the trade-off between speed and robustness:
| Lambda | Behavior |
|---|---|
lambda = 0.1 * tau | Very aggressive, fast but sensitive to model error |
lambda = 0.5 * tau | Aggressive, good for accurate models |
lambda = 1.0 * tau | Moderate, balanced speed and robustness |
lambda = 2.0 * tau | Conservative, robust to model uncertainty |
Default recommendation: Start with lambda = tau
For noisy systems or uncertain models, use larger lambda. For precise models and fast response needs, use smaller lambda.
Implementation
def calculate_imc_gains(K, tau, lambda_factor=1.0):
"""
Calculate IMC-tuned PI gains for a first-order system.
Args:
K: Process gain
tau: Time constant
lambda_factor: Multiplier for lambda (default 1.0 = lambda equals tau)
Returns:
dict with Kp, Ki, Kd, lambda
"""
lambda_cl = lambda_factor * tau
Kp = tau / (K * lambda_cl)
Ki = Kp / tau
Kd = 0.0
return {
"Kp": Kp,
"Ki": Ki,
"Kd": Kd,
"lambda": lambda_cl
}
PI Controller Implementation
class PIController:
def __init__(self, Kp, Ki, setpoint):
self.Kp = Kp
self.Ki = Ki
self.setpoint = setpoint
self.integral = 0.0
def compute(self, measurement, dt):
"""Compute control output."""
error = self.setpoint - measurement
# Integral term
self.integral += error * dt
# PI control law
output = self.Kp * error + self.Ki * self.integral
# Clamp to valid range
output = max(output_min, min(output_max, output))
return output
Expected Closed-Loop Behavior
With IMC tuning, the closed-loop response is approximately:
y(t) = y_setpoint * (1 - exp(-t / lambda))
Key properties:
- Rise time: ~2.2 * lambda to reach 90% of setpoint
- Settling time: ~4 * lambda to reach 98% of setpoint
- Overshoot: Minimal for first-order systems
- Steady-state error: Zero (integral action eliminates offset)
Tips
- Start conservative: Use
lambda = tauinitially - Decrease lambda carefully: Smaller lambda = larger Kp = faster but riskier
- Watch for oscillation: If output oscillates, increase lambda
- Anti-windup: Prevent integral wind-up when output saturates
When not to use it
- →Higher-order systems
- →Non-linear process models
Limitations
- →Derivative gain is always zero for first-order systems
- →Accuracy depends on the precision of the process model
How it compares
This method provides a systematic, model-based calculation for controller gains instead of trial-and-error manual tuning.
Compared to similar skills
imc-tuning-rules side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| imc-tuning-rules (this skill) | 2 | 6mo | No flags | Advanced |
| quant-analyst | 103 | 2mo | No flags | Advanced |
| stock-analyzer | 71 | 2mo | Review | Beginner |
| xlsx | 87 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by benchflow-ai
View all by benchflow-ai →You might also like
quant-analyst
zenobi-us
Expert quantitative analyst specializing in financial modeling, algorithmic trading, and risk analytics. Masters statistical methods, derivatives pricing, and high-frequency trading with focus on mathematical rigor, performance optimization, and profitable strategy development.
stock-analyzer
FrancyJGLisboa
Provides comprehensive technical analysis for stocks and ETFs using RSI, MACD, Bollinger Bands, and other indicators. Activates when user requests stock analysis, technical indicators, trading signals, or market data for specific ticker symbols.
xlsx
anthropics
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
google-analytics
davila7
Analyze Google Analytics data, review website performance metrics, identify traffic patterns, and suggest data-driven improvements. Use when the user asks about analytics, website metrics, traffic analysis, conversion rates, user behavior, or performance optimization.
market-sizing-analysis
wshobson
This skill should be used when the user asks to "calculate TAM", "determine SAM", "estimate SOM", "size the market", "calculate market opportunity", "what's the total addressable market", or requests market sizing analysis for a startup or business opportunity.
data-engineering
pluginagentmarketplace
ETL pipelines, Apache Spark, data warehousing, and big data processing. Use for building data pipelines, processing large datasets, or data infrastructure.