本文へ移動
cccskills
無料GitHub で公開

first-order-model-fitting

Fit first-order dynamic models to experimental step response data and extract K (gain) and tau (time constant) parameters.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

First-Order System Model Fitting

Overview

Many physical systems (thermal, electrical, mechanical) exhibit first-order dynamics. This skill explains the mathematical model and how to extract parameters from experimental data.

The First-Order Model

The dynamics are described by:

tau * dy/dt + y = y_ambient + K * u

Where:

  • y = output variable (e.g., temperature, voltage, position)
  • u = input variable (e.g., power, current, force)
  • K = process gain (output change per unit input at steady state)
  • tau = time constant (seconds) - characterizes response speed
  • y_ambient = baseline/ambient value

Step Response Formula

When you apply a step input from 0 to u, the output follows:

y(t) = y_ambient + K * u * (1 - exp(-t/tau))

This is the key equation for fitting.

Extracting Parameters

Process Gain (K)

At steady state (t -> infinity), the exponential term goes to zero:

y_steady = y_ambient + K * u

Therefore:

K = (y_steady - y_ambient) / u

Time Constant (tau)

The time constant can be found from the 63.2% rise point:

At t = tau:

y(tau) = y_ambient + K*u*(1 - exp(-1))
       = y_ambient + 0.632 * (y_steady - y_ambient)

So tau is the time to reach 63.2% of the final output change.

Model Function for Curve Fitting

def step_response(t, K, tau, y_ambient, u):
    """First-order step response model."""
    return y_ambient + K * u * (1 - np.exp(-t / tau))

When fitting, you typically fix y_ambient (from initial reading) and u (known input), leaving only K and tau as unknowns:

def model(t, K, tau):
    return y_ambient + K * u * (1 - np.exp(-t / tau))

Practical Tips

  1. Use rising portion data: The step response formula applies during the transient phase
  2. Exclude initial flat region: Start your fit from when the input changes
  3. Handle noisy data: Fitting naturally averages out measurement noise
  4. Check units: Ensure K has correct units (output units / input units)

Quality Metrics

After fitting, calculate:

  • R-squared (R^2): How well the model explains variance (want > 0.9)
  • Fitting error: RMS difference between model and data
residuals = y_measured - y_model
ss_res = np.sum(residuals**2)
ss_tot = np.sum((y_measured - np.mean(y_measured))**2)
r_squared = 1 - (ss_res / ss_tot)
fitting_error = np.sqrt(np.mean(residuals**2))

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Redact text from PDF documents for blind review anonymization

日本語の概要は準備中です。原文の説明を表示しています。

agentscope-ai/PawBench1182026年8月3日 更新

Use this skill when reading sensor data from CSV files, writing simulation results to CSV, processing time-series data with pandas, or handling missing values in datasets.

日本語の概要は準備中です。原文の説明を表示しています。

agentscope-ai/PawBench1182026年8月3日 更新

DC power flow analysis for power systems. Use when computing power flows using DC approximation, building susceptance matrices, calculating line flows and loading percentages, or performing sensitivity analysis on transmission networks.

日本語の概要は準備中です。原文の説明を表示しています。

agentscope-ai/PawBench1182026年8月3日 更新

A library for building, validating, visualizing, and serializing dialogue graphs. Use this when parsing scripts or creating branching narrative structures.

日本語の概要は準備中です。原文の説明を表示しています。

agentscope-ai/PawBench1182026年8月3日 更新

docx

無料

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of "Word doc", "word document", ".docx", or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a "report", "memo", "letter", "template", or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.

日本語の概要は準備中です。原文の説明を表示しています。

agentscope-ai/PawBench1182026年8月3日 更新

Generator economic dispatch and cost optimization for power systems. Use when minimizing generation costs, computing optimal generator setpoints, calculating operating margins, or working with generator cost functions.

日本語の概要は準備中です。原文の説明を表示しています。

agentscope-ai/PawBench1182026年8月3日 更新

agentscope-ai のスキルをすべて見る

このスキルの問題を報告する