更新项目格式及部分ui细节

This commit is contained in:
2025-10-20 00:23:45 +08:00
parent 071e4da378
commit a22bb42bd4
9 changed files with 1654 additions and 2309 deletions
+499
View File
@@ -0,0 +1,499 @@
"""
知识卡片内容 - 包含时域、频域、根轨迹分析的公式和方法
使用纯HTML格式,无需LaTeX渲染库
"""
# 时域分析知识卡片
TIME_DOMAIN_KNOWLEDGE = """
<div class='knowledge-card'>
<h3 style='color: #667eea; margin-top: 0; display: flex; align-items: center; gap: 10px;'>
<span style='font-size: 1.3em;'>📚</span> 时域分析常用公式
</h3>
<details open>
<summary style='background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
📐 二阶系统标准形式
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<p style='margin: 10px 0;'><strong>标准传递函数:</strong></p>
<div style='text-align: center; background: white; padding: 20px; border-radius: 8px; margin: 10px 0; box-shadow: 0 2px 6px rgba(0,0,0,0.05);'>
<div style='font-size: 1.3em; display: inline-block;'>
<i>G</i>(<i>s</i>) =
<div style='display: inline-block; vertical-align: middle; margin: 0 8px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 10px 5px;'>ω<sub>n</sub><sup>2</sup></div>
<div style='text-align: center; padding: 5px 10px 0;'><i>s</i><sup>2</sup> + 2ζω<sub>n</sub><i>s</i> + ω<sub>n</sub><sup>2</sup></div>
</div>
</div>
</div>
<h4 style='color: #667eea; margin-top: 20px; font-size: 1.1em;'>📊 关键参数</h4>
<table style='width: 100%; border-collapse: collapse; margin: 15px 0; font-size: 0.95em; box-shadow: 0 2px 10px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;'>
<tr style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;'>
<th style='padding: 12px; text-align: left; font-weight: 700;'>参数</th>
<th style='padding: 12px; text-align: left; font-weight: 700;'>含义</th>
<th style='padding: 12px; text-align: left; font-weight: 700;'>影响</th>
</tr>
<tr style='background: white;'>
<td style='padding: 10px; border: 1px solid #e0e7ff;'><strong>ζ (zeta)</strong></td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>阻尼比</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>控制超调量和振荡</td>
</tr>
<tr style='background: #f8f9ff;'>
<td style='padding: 10px; border: 1px solid #e0e7ff;'><strong>ω<sub>n</sub></strong></td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>无阻尼自然频率 (rad/s)</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>决定响应速度</td>
</tr>
</table>
<h4 style='color: #764ba2; margin-top: 20px; font-size: 1.1em;'>🎯 阻尼比分类</h4>
<ul style='line-height: 2; margin-left: 20px;'>
<li><strong style='color: #f5576c;'>ζ &lt; 0:</strong> 不稳定系统</li>
<li><strong style='color: #ffa726;'>ζ = 0:</strong> 无阻尼振荡</li>
<li><strong style='color: #4caf50;'>0 &lt; ζ &lt; 1:</strong> 欠阻尼(有振荡)⭐ 最常见</li>
<li><strong style='color: #2196f3;'>ζ = 1:</strong> 临界阻尼(无超调)</li>
<li><strong style='color: #9c27b0;'>ζ &gt; 1:</strong> 过阻尼(响应慢)</li>
</ul>
</div>
</details>
<details open>
<summary style='background: linear-gradient(135deg, #fff0f8 0%, #fce4ec 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
📊 时域性能指标(欠阻尼系统)
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<div style='background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%); padding: 15px; border-radius: 10px; margin: 12px 0; border-left: 4px solid #667eea;'>
<strong style='color: #667eea; font-size: 1.1em;'>1️⃣ 上升时间 (Rise Time, t<sub>r</sub>)</strong>
<p style='margin: 8px 0;'>响应从 10% 上升到 90% 终值所需时间</p>
<div style='text-align: center; background: white; padding: 15px; border-radius: 6px; margin: 8px 0;'>
<div style='font-size: 1.2em; display: inline-block;'>
<i>t</i><sub>r</sub> ≈
<div style='display: inline-block; vertical-align: middle; margin: 0 5px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 8px 3px;'>1.8</div>
<div style='text-align: center; padding: 3px 8px 0;'>ω<sub>n</sub></div>
</div>
</div>
</div>
</div>
<div style='background: linear-gradient(135deg, #fff4f0 0%, #ffe0b2 100%); padding: 15px; border-radius: 10px; margin: 12px 0; border-left: 4px solid #ff9800;'>
<strong style='color: #f57c00; font-size: 1.1em;'>2️⃣ 峰值时间 (Peak Time, t<sub>p</sub>)</strong>
<p style='margin: 8px 0;'>响应达到第一个峰值的时间</p>
<div style='text-align: center; background: white; padding: 15px; border-radius: 6px; margin: 8px 0;'>
<div style='font-size: 1.2em; display: inline-block;'>
<i>t</i><sub>p</sub> =
<div style='display: inline-block; vertical-align: middle; margin: 0 5px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 8px 3px;'>π</div>
<div style='text-align: center; padding: 3px 8px 0;'>ω<sub>n</sub>√(1−ζ²)</div>
</div>
=
<div style='display: inline-block; vertical-align: middle; margin: 0 5px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 8px 3px;'>π</div>
<div style='text-align: center; padding: 3px 8px 0;'>ω<sub>d</sub></div>
</div>
</div>
</div>
<p style='margin: 8px 0; color: #666; font-size: 0.95em;'>其中 ω<sub>d</sub> = ω<sub>n</sub>√(1−ζ²) 为阻尼振荡频率</p>
</div>
<div style='background: linear-gradient(135deg, #f0fff4 0%, #c8e6c9 100%); padding: 15px; border-radius: 10px; margin: 12px 0; border-left: 4px solid #4caf50;'>
<strong style='color: #388e3c; font-size: 1.1em;'>3️⃣ 超调量 (Overshoot, σ%)</strong>
<p style='margin: 8px 0;'>响应超过稳态值的最大百分比</p>
<div style='text-align: center; background: white; padding: 15px; border-radius: 6px; margin: 8px 0; font-size: 1.2em;'>
σ% = <i>e</i><sup>−πζ/√(1−ζ²)</sup> × 100%
</div>
<p style='margin: 8px 0; color: #388e3c; font-weight: 600;'>💡 仅与 ζ 有关!</p>
<table style='width: 100%; margin: 10px 0; font-size: 0.9em;'>
<tr style='background: #e8f5e9;'>
<td style='padding: 6px; border: 1px solid #c8e6c9;'><strong>ζ = 0.5</strong></td>
<td style='padding: 6px; border: 1px solid #c8e6c9;'>σ% ≈ 16%</td>
</tr>
<tr style='background: white;'>
<td style='padding: 6px; border: 1px solid #c8e6c9;'><strong>ζ = 0.707</strong></td>
<td style='padding: 6px; border: 1px solid #c8e6c9;'>σ% ≈ 4.3% ⭐ 最佳</td>
</tr>
</table>
</div>
<div style='background: linear-gradient(135deg, #fff0f8 0%, #f3e5f5 100%); padding: 15px; border-radius: 10px; margin: 12px 0; border-left: 4px solid #9c27b0;'>
<strong style='color: #7b1fa2; font-size: 1.1em;'>4️⃣ 调节时间 (Settling Time, t<sub>s</sub>)</strong>
<p style='margin: 8px 0;'>响应达到并保持在稳态值 ±2%(或±5%)范围内的时间</p>
<div style='text-align: center; background: white; padding: 15px; border-radius: 6px; margin: 8px 0;'>
<div style='font-size: 1.2em;'>
<i>t</i><sub>s</sub> ≈
<div style='display: inline-block; vertical-align: middle; margin: 0 5px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 8px 3px;'>4</div>
<div style='text-align: center; padding: 3px 8px 0;'>ζω<sub>n</sub></div>
</div>
&nbsp; (2% 误差带)
</div>
<div style='font-size: 1.2em; margin-top: 10px;'>
<i>t</i><sub>s</sub> ≈
<div style='display: inline-block; vertical-align: middle; margin: 0 5px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 8px 3px;'>3</div>
<div style='text-align: center; padding: 3px 8px 0;'>ζω<sub>n</sub></div>
</div>
&nbsp; (5% 误差带)
</div>
</div>
</div>
</div>
</details>
<details>
<summary style='background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🎯 一阶系统特性
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<p><strong>标准传递函数:</strong></p>
<div style='text-align: center; background: white; padding: 20px; border-radius: 8px; margin: 10px 0;'>
<div style='font-size: 1.3em; display: inline-block;'>
<i>G</i>(<i>s</i>) =
<div style='display: inline-block; vertical-align: middle; margin: 0 8px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 10px 5px;'><i>K</i></div>
<div style='text-align: center; padding: 5px 10px 0;'>τ<i>s</i> + 1</div>
</div>
</div>
</div>
<p><strong>阶跃响应:</strong></p>
<div style='text-align: center; background: white; padding: 20px; border-radius: 8px; margin: 10px 0; font-size: 1.2em;'>
<i>y</i>(<i>t</i>) = <i>K</i>(1 <i>e</i><sup><i>t</i>/τ</sup>)
</div>
<div style='background: #e3f2fd; padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>💡 关键时间点:</strong></p>
<ul style='line-height: 1.8;'>
<li><strong><i>t</i> = τ:</strong> 达到稳态值的 63.2%</li>
<li><strong><i>t</i> = 3τ:</strong> 达到稳态值的 95%</li>
<li><strong><i>t</i> = 4τ:</strong> 达到稳态值的 98.2%</li>
<li><strong><i>t</i> = 5τ:</strong> 达到稳态值的 99.3%</li>
</ul>
</div>
</div>
</details>
</div>
"""
# 频域分析知识卡片
FREQUENCY_DOMAIN_KNOWLEDGE = """
<div class='knowledge-card'>
<h3 style='color: #667eea; margin-top: 0; display: flex; align-items: center; gap: 10px;'>
<span style='font-size: 1.3em;'>📚</span> 频域分析常用方法
</h3>
<details open>
<summary style='background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🎯 增益裕度 (Gain Margin, GM)
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<p><strong>定义:</strong>在相角为 -180° 时,系统增益可增加的最大倍数</p>
<div style='text-align: center; background: white; padding: 20px; border-radius: 8px; margin: 10px 0;'>
<div style='font-size: 1.3em;'>
GM<sub>dB</sub> = 20log<sub>10</sub>|<i>G</i>(<i>j</i>ω<sub>pc</sub>)|
</div>
</div>
<p style='margin: 8px 0;'><strong>ω<sub>pc</sub></strong> - 相角交越频率(相角 = -180°)</p>
<h4 style='color: #667eea; margin-top: 15px;'>判断准则</h4>
<table style='width: 100%; border-collapse: collapse; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;'>
<tr style='background: #e8f5e9;'>
<td style='padding: 10px; border: 1px solid #c8e6c9; font-weight: 600;'>GM &gt; 0 dB</td>
<td style='padding: 10px; border: 1px solid #c8e6c9;'>✅ 系统稳定</td>
</tr>
<tr style='background: #fff3e0;'>
<td style='padding: 10px; border: 1px solid #ffe0b2; font-weight: 600;'>GM = 0 dB</td>
<td style='padding: 10px; border: 1px solid #ffe0b2;'>⚠️ 临界稳定</td>
</tr>
<tr style='background: #ffebee;'>
<td style='padding: 10px; border: 1px solid #ffcdd2; font-weight: 600;'>GM &lt; 0 dB</td>
<td style='padding: 10px; border: 1px solid #ffcdd2;'>❌ 系统不稳定</td>
</tr>
</table>
<div style='background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%); padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>💡 工程要求:</strong>通常要求 <strong>GM ≥ 6 dB</strong>(约2倍增益余量)</p>
</div>
</div>
</details>
<details open>
<summary style='background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🎯 相角裕度 (Phase Margin, PM)
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<p><strong>定义:</strong>在增益为 1 (0dB) 时,系统相角与 -180° 的差值</p>
<div style='text-align: center; background: white; padding: 20px; border-radius: 8px; margin: 10px 0; font-size: 1.3em;'>
PM = 180° + ∠<i>G</i>(<i>j</i>ω<sub>gc</sub>)
</div>
<p style='margin: 8px 0;'><strong>ω<sub>gc</sub></strong> - 增益交越频率(幅值 = 1 或 0dB</p>
<h4 style='color: #764ba2; margin-top: 15px;'>判断准则</h4>
<table style='width: 100%; border-collapse: collapse; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;'>
<tr style='background: #e8f5e9;'>
<td style='padding: 10px; border: 1px solid #c8e6c9; font-weight: 600;'>PM &gt; 0°</td>
<td style='padding: 10px; border: 1px solid #c8e6c9;'>✅ 系统稳定</td>
</tr>
<tr style='background: #fff3e0;'>
<td style='padding: 10px; border: 1px solid #ffe0b2; font-weight: 600;'>PM = 0°</td>
<td style='padding: 10px; border: 1px solid #ffe0b2;'>⚠️ 临界稳定</td>
</tr>
<tr style='background: #ffebee;'>
<td style='padding: 10px; border: 1px solid #ffcdd2; font-weight: 600;'>PM &lt; 0°</td>
<td style='padding: 10px; border: 1px solid #ffcdd2;'>❌ 系统不稳定</td>
</tr>
</table>
<div style='background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>💡 工程要求:</strong>通常要求 <strong>PM ∈ [30°, 60°]</strong></p>
<p style='margin: 8px 0;'>• PM ≈ 45° ~ 60°: 良好阻尼特性</p>
<p style='margin: 8px 0;'>• PM 越大,超调量越小</p>
</div>
<h4 style='color: #f57c00; margin-top: 15px;'>与时域性能的关系</h4>
<div style='text-align: center; background: white; padding: 15px; border-radius: 8px; margin: 10px 0; font-size: 1.2em;'>
ζ ≈ <div style='display: inline-block; vertical-align: middle; margin: 0 5px;'>
<div style='text-align: center; border-bottom: 2px solid #333; padding: 0 8px 3px;'>PM</div>
<div style='text-align: center; padding: 3px 8px 0;'>100</div>
</div> &nbsp; (PM 以度为单位)
</div>
<table style='width: 100%; margin: 10px 0; font-size: 0.9em; box-shadow: 0 2px 6px rgba(0,0,0,0.06); border-radius: 6px; overflow: hidden;'>
<tr style='background: #f5f5f5; font-weight: 600;'>
<td style='padding: 8px; border: 1px solid #ddd;'>PM</td>
<td style='padding: 8px; border: 1px solid #ddd;'>ζ</td>
<td style='padding: 8px; border: 1px solid #ddd;'>超调量</td>
</tr>
<tr><td style='padding: 8px; border: 1px solid #ddd;'>30°</td><td style='padding: 8px; border: 1px solid #ddd;'>≈ 0.3</td><td style='padding: 8px; border: 1px solid #ddd;'>≈ 37%</td></tr>
<tr><td style='padding: 8px; border: 1px solid #ddd;'>45°</td><td style='padding: 8px; border: 1px solid #ddd;'>≈ 0.45</td><td style='padding: 8px; border: 1px solid #ddd;'>≈ 20%</td></tr>
<tr><td style='padding: 8px; border: 1px solid #ddd;'>60°</td><td style='padding: 8px; border: 1px solid #ddd;'>≈ 0.6</td><td style='padding: 8px; border: 1px solid #ddd;'>≈ 10% ⭐</td></tr>
</table>
</div>
</details>
<details>
<summary style='background: linear-gradient(135deg, #fff0f8 0%, #fce4ec 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
📊 Bode 图与 Nyquist 图
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<h4 style='color: #667eea;'>Bode 图(伯德图)</h4>
<p><strong>组成:</strong>幅频特性图 + 相频特性图</p>
<ul style='line-height: 1.8;'>
<li><strong>横轴:</strong>频率 ω (对数刻度)</li>
<li><strong>纵轴(幅频):</strong>20log|<i>G</i>(<i>j</i>ω)| (dB)</li>
<li><strong>纵轴(相频):</strong>∠<i>G</i>(<i>j</i>ω) (度)</li>
</ul>
<div style='background: #e3f2fd; padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>💡 优点:</strong></p>
<ul style='line-height: 1.6;'>
<li>便于绘制(渐近线近似)</li>
<li>直观读取稳定裕度</li>
<li>串联系统可图形叠加</li>
</ul>
</div>
<h4 style='color: #764ba2; margin-top: 20px;'>Nyquist 图(奈奎斯特图)</h4>
<p><strong>定义:</strong>开环频率特性在复平面上的轨迹</p>
<div style='background: #fff3e0; padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>🎯 奈奎斯特稳定判据:</strong></p>
<p style='text-align: center; font-weight: 600; margin: 10px 0; font-size: 1.2em;'><i>Z</i> = <i>P</i> <i>N</i></p>
<p style='font-size: 0.95em;'>• <i>Z</i>: 闭环右半平面极点数<br>
• <i>P</i>: 开环右半平面极点数<br>
• <i>N</i>: 曲线逆时针包围 (1, <i>j</i>0) 的圈数</p>
<p style='margin-top: 10px; color: #f57c00; font-weight: 600;'>稳定条件:<i>Z</i> = 0</p>
</div>
</div>
</details>
<details>
<summary style='background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🔧 典型环节频率特性
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<div style='margin-bottom: 15px; padding: 12px; background: white; border-radius: 8px; border-left: 4px solid #667eea;'>
<h4 style='margin-top: 0; color: #667eea;'>1️⃣ 比例环节 <i>K</i></h4>
<p>• 幅频:20log<i>K</i> (dB) - 水平线<br>• 相频:0° - 水平线</p>
</div>
<div style='margin-bottom: 15px; padding: 12px; background: white; border-radius: 8px; border-left: 4px solid #f57c00;'>
<h4 style='margin-top: 0; color: #f57c00;'>2️⃣ 积分环节 1/<i>s</i></h4>
<p>• 幅频:-20dB/dec 斜率<br>• 相频:-90° - 水平线</p>
</div>
<div style='margin-bottom: 15px; padding: 12px; background: white; border-radius: 8px; border-left: 4px solid #4caf50;'>
<h4 style='margin-top: 0; color: #4caf50;'>3️⃣ 惯性环节 1/(<i>Ts</i>+1)</h4>
<p>• 转折频率:ω = 1/<i>T</i><br>• 幅频:低频 0dB,高频 -20dB/dec<br>• 相频:0° → -90°</p>
</div>
</div>
</details>
</div>
"""
# 根轨迹分析知识卡片
ROOT_LOCUS_KNOWLEDGE = """
<div class='knowledge-card'>
<h3 style='color: #667eea; margin-top: 0; display: flex; align-items: center; gap: 10px;'>
<span style='font-size: 1.3em;'>📚</span> 根轨迹分析要点
</h3>
<details open>
<summary style='background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🎯 根轨迹基本概念
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<p><strong>定义:</strong>当开环增益 <i>K</i> 从 0 → ∞ 变化时,闭环特征方程根(极点)在 <i>s</i> 平面上的运动轨迹</p>
<h4 style='color: #667eea; margin-top: 15px;'>特征方程</h4>
<div style='text-align: center; background: white; padding: 15px; border-radius: 8px; margin: 10px 0; font-size: 1.3em;'>
1 + <i>KG</i>(<i>s</i>)<i>H</i>(<i>s</i>) = 0
</div>
<h4 style='color: #764ba2; margin-top: 15px;'>主要作用</h4>
<ul style='line-height: 1.8;'>
<li>✅ 直观显示增益对极点位置的影响</li>
<li>✅ 判断系统稳定性</li>
<li>✅ 选择合适的增益值</li>
<li>✅ 设计控制器参数</li>
</ul>
</div>
</details>
<details open>
<summary style='background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
📐 根轨迹绘制基本条件
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<div style='background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); padding: 15px; border-radius: 10px; margin: 12px 0; border-left: 4px solid #4caf50;'>
<h4 style='margin-top: 0; color: #388e3c;'>1️⃣ 幅值条件(充要条件)</h4>
<div style='text-align: center; background: white; padding: 15px; border-radius: 6px; margin: 8px 0; font-size: 1.2em;'>
|<i>KG</i>(<i>s</i><sub>0</sub>)<i>H</i>(<i>s</i><sub>0</sub>)| = 1
</div>
<p style='margin: 8px 0;'><strong>💡 用途:</strong>确定增益 <i>K</i> 的值</p>
</div>
<div style='background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); padding: 15px; border-radius: 10px; margin: 12px 0; border-left: 4px solid #ff9800;'>
<h4 style='margin-top: 0; color: #f57c00;'>2️⃣ 相角条件(充要条件)</h4>
<div style='text-align: center; background: white; padding: 15px; border-radius: 6px; margin: 8px 0; font-size: 1.2em;'>
∠<i>G</i>(<i>s</i><sub>0</sub>)<i>H</i>(<i>s</i><sub>0</sub>) = (2<i>k</i>+1) × 180°
</div>
<p style='margin: 8px 0; font-size: 0.95em;'>其中 <i>k</i> = 0, ±1, ±2, ...</p>
<p style='margin: 8px 0;'><strong>💡 用途:</strong>判断 <i>s</i> 平面某点是否在根轨迹上</p>
</div>
</div>
</details>
<details open>
<summary style='background: linear-gradient(135deg, #fff0f8 0%, #fce4ec 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🌟 根轨迹基本性质
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<table style='width: 100%; border-collapse: collapse; margin: 15px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;'>
<tr style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;'>
<th style='padding: 12px; text-align: left; font-weight: 700;'>规则</th>
<th style='padding: 12px; text-align: left; font-weight: 700;'>内容</th>
</tr>
<tr style='background: white;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>起点</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'><i>K</i>=0,位于<strong>开环极点</strong></td>
</tr>
<tr style='background: #f8f9ff;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>终点</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'><i>K</i>→∞,位于<strong>开环零点</strong>或无穷远</td>
</tr>
<tr style='background: white;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>分支数</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>max(<i>n</i>, <i>m</i>)<i>n</i>=极点数,<i>m</i>=零点数</td>
</tr>
<tr style='background: #f8f9ff;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>实轴段</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>右侧零极点总数为<strong>奇数</strong>的区段</td>
</tr>
<tr style='background: white;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>渐近线数</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'><strong><i>n</i> <i>m</i></strong> 条</td>
</tr>
<tr style='background: #f8f9ff;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>渐近线角度</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>φ<sub>a</sub> = (2<i>k</i>+1)×180°/(<i>n</i><i>m</i>)</td>
</tr>
<tr style='background: white;'>
<td style='padding: 10px; border: 1px solid #e0e7ff; font-weight: 600;'>渐近线交点</td>
<td style='padding: 10px; border: 1px solid #e0e7ff;'>σ<sub>a</sub> = (Σ<i>p</i> Σ<i>z</i>)/(<i>n</i><i>m</i>)</td>
</tr>
</table>
</div>
</details>
<details>
<summary style='background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
🛡️ <i>s</i> 平面稳定性区域
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<table style='width: 100%; border-collapse: collapse; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;'>
<tr style='background: #f5f5f5; font-weight: 600;'>
<th style='padding: 10px; border: 1px solid #ddd;'>区域</th>
<th style='padding: 10px; border: 1px solid #ddd;'>条件</th>
<th style='padding: 10px; border: 1px solid #ddd;'>稳定性</th>
</tr>
<tr>
<td style='padding: 10px; border: 1px solid #ddd;'>左半平面</td>
<td style='padding: 10px; border: 1px solid #ddd;'>Re(<i>s</i>) &lt; 0</td>
<td style='padding: 10px; border: 1px solid #ddd; background: #c8e6c9;'><strong>✅ 稳定</strong></td>
</tr>
<tr>
<td style='padding: 10px; border: 1px solid #ddd;'>虚轴</td>
<td style='padding: 10px; border: 1px solid #ddd;'>Re(<i>s</i>) = 0</td>
<td style='padding: 10px; border: 1px solid #ddd; background: #fff9c4;'><strong>⚠️ 临界稳定</strong></td>
</tr>
<tr>
<td style='padding: 10px; border: 1px solid #ddd;'>右半平面</td>
<td style='padding: 10px; border: 1px solid #ddd;'>Re(<i>s</i>) &gt; 0</td>
<td style='padding: 10px; border: 1px solid #ddd; background: #ffcdd2;'><strong>❌ 不稳定</strong></td>
</tr>
</table>
<div style='background: #e3f2fd; padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>💡 虚轴(<i>x</i>=0</strong>即为<strong>稳定性边界</strong></p>
<p style='margin: 8px 0;'>根轨迹穿越虚轴点对应<strong>临界增益 <i>K</i><sub>c</sub></strong></p>
</div>
</div>
</details>
<details>
<summary style='background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; color: #333; font-size: 1.05em; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);'>
📏 阻尼比等值线
</summary>
<div style='padding: 15px; background: #fafbff; margin-top: 5px; border-radius: 10px; border: 1px solid #e0e7ff;'>
<p>从原点出发的射线代表恒定阻尼比 ζ 的轨迹:</p>
<div style='text-align: center; background: white; padding: 15px; border-radius: 8px; margin: 10px 0; font-size: 1.2em;'>
θ = arccos(ζ)
</div>
<table style='width: 100%; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-radius: 6px; overflow: hidden;'>
<tr style='background: #f5f5f5; font-weight: 600;'>
<td style='padding: 8px; border: 1px solid #ddd;'>阻尼比 ζ</td>
<td style='padding: 8px; border: 1px solid #ddd;'>角度 θ</td>
<td style='padding: 8px; border: 1px solid #ddd;'>系统特性</td>
</tr>
<tr>
<td style='padding: 8px; border: 1px solid #ddd;'>0.5</td>
<td style='padding: 8px; border: 1px solid #ddd;'>60°</td>
<td style='padding: 8px; border: 1px solid #ddd;'>欠阻尼,较大超调</td>
</tr>
<tr>
<td style='padding: 8px; border: 1px solid #ddd;'><strong>0.707</strong></td>
<td style='padding: 8px; border: 1px solid #ddd;'><strong>45°</strong></td>
<td style='padding: 8px; border: 1px solid #ddd;'><strong>⭐ 最佳阻尼</strong></td>
</tr>
</table>
<div style='background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); padding: 12px; border-radius: 8px; margin: 10px 0;'>
<p><strong>💡 工程应用:</strong>通过根轨迹与阻尼比等值线的交点,选择满足性能要求的增益 <i>K</i></p>
</div>
</div>
</details>
</div>
"""
+337
View File
@@ -0,0 +1,337 @@
/* ==================== 全局样式 ==================== */
* {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.gradio-container {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important;
background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%) !important;
}
/* ==================== Emoji 显示修复 ==================== */
* {
font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gr-markdown code {
background: transparent !important; padding: 0 !important; font-family: inherit !important;
}
.gr-html * {
background-clip: border-box !important; -webkit-background-clip: border-box !important; -webkit-text-fill-color: initial !important;
}
/* ==================== 标题区域 ==================== */
.main-title {
text-align: center; font-size: 3em !important; font-weight: 900 !important; margin-bottom: 0.3em; letter-spacing: -1px; animation: titleGlow 3s ease-in-out infinite; color: #333;
}
h1.main-title {
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
-webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
@keyframes titleGlow {
0%, 100% { filter: brightness(1); }
50% { filter: brightness(1.2); }
}
.subtitle {
text-align: center; color: #555; font-size: 1.2em; font-weight: 500; margin-bottom: 1.5em; letter-spacing: 0.5px;
}
p.subtitle { color: #555 !important; }
/* ==================== 项目信息横幅 ==================== */
.project-info-banner {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 25px 30px;
border-radius: 20px;
margin-bottom: 30px;
box-shadow: 0 10px 40px rgba(102, 126, 234, 0.35);
animation: bannerSlide 0.6s ease-out;
position: relative;
overflow: hidden;
}
.project-info-banner::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
animation: shimmer 8s infinite linear;
}
@keyframes shimmer {
0% { transform: translate(-100%, -100%) rotate(0deg); }
100% { transform: translate(100%, 100%) rotate(360deg); }
}
@keyframes bannerSlide {
from { transform: translateY(-30px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
/* ==================== 标签页样式 ==================== */
.tab-nav {
background: white; border-radius: 12px; padding: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); margin-bottom: 20px;
}
.tab-nav button {
font-weight: 600 !important; font-size: 1.1em !important; padding: 12px 24px !important; border-radius: 8px !important; border: none !important; transition: all 0.3s ease !important;
}
.tab-nav button:hover {
background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%) !important; transform: translateY(-2px) !important;
}
.tab-nav button.selected {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: white !important; box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}
/* ==================== 卡片和分组样式 ==================== */
.gr-group {
background: white !important;
border-radius: 20px !important;
padding: 28px !important;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04) !important;
border: 1px solid rgba(102, 126, 234, 0.08) !important;
margin-bottom: 20px !important;
transition: transform 0.3s ease, box-shadow 0.3s ease !important;
backdrop-filter: blur(10px);
}
.gr-group:hover {
transform: translateY(-6px) !important;
box-shadow: 0 12px 48px rgba(102, 126, 234, 0.12), 0 4px 16px rgba(102, 126, 234, 0.08) !important;
}
.card-title {
font-size: 1.5em;
font-weight: 700;
color: #333 !important;
margin-bottom: 18px;
border-bottom: 3px solid;
border-image: linear-gradient(90deg, #667eea, #764ba2) 1;
padding-bottom: 12px;
display: flex;
align-items: center;
gap: 10px;
letter-spacing: -0.5px;
}
/* ==================== 输入框样式 ==================== */
.gr-textbox input, .gr-textbox textarea {
border: 2px solid #e0e7ff !important; border-radius: 10px !important; padding: 12px 16px !important; font-size: 1em !important; transition: all 0.3s ease !important; background: #fafbff !important;
}
.gr-textbox input:focus, .gr-textbox textarea:focus {
border-color: #667eea !important; box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important; background: white !important; transform: translateY(-2px);
}
.gr-textbox label {
font-weight: 600 !important; color: #4a5568 !important; margin-bottom: 8px !important;
}
/* ==================== 按钮样式 ==================== */
button {
border-radius: 12px !important;
font-weight: 600 !important;
padding: 14px 28px !important;
font-size: 1.05em !important;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
border: none !important;
cursor: pointer !important;
letter-spacing: 0.3px;
}
.primary-btn, button[variant="primary"] {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
position: relative;
overflow: hidden;
}
.primary-btn::before, button[variant="primary"]::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
transform: translate(-50%, -50%);
transition: width 0.6s, height 0.6s;
}
.primary-btn:hover::before, button[variant="primary"]:hover::before {
width: 300px;
height: 300px;
}
.primary-btn:hover, button[variant="primary"]:hover {
transform: translateY(-4px) scale(1.03) !important;
box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5) !important;
}
button[variant="secondary"] {
background-color: white !important;
color: #667eea !important;
border: 2px solid #667eea !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15) !important;
}
button[variant="secondary"]:hover {
background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%) !important;
transform: translateY(-3px) !important;
box-shadow: 0 6px 18px rgba(102, 126, 234, 0.25) !important;
}
/* ==================== 滑块样式 ==================== */
.gr-slider { padding: 20px 10px !important; }
.gr-slider input[type="range"] {
height: 8px !important; border-radius: 4px !important; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%) !important;
}
/* ==================== 聊天机器人样式 ==================== */
.modern-chatbot {
background: white !important;
border-radius: 20px !important;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
border: 1px solid rgba(102, 126, 234, 0.1) !important;
}
.message.user {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
border-radius: 20px 20px 4px 20px !important;
padding: 14px 18px !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25) !important;
animation: messageSlideIn 0.3s ease-out;
}
.message.user * {
color: white !important;
}
.message.bot {
background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%) !important;
border: 1px solid #e0e7ff !important;
border-radius: 20px 20px 20px 4px !important;
color: #2d3748 !important;
padding: 14px 18px !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
animation: messageSlideIn 0.3s ease-out;
}
.message.bot * { color: #2d3748 !important; }
.message.bot code {
background: #f0f4ff !important;
color: #667eea !important;
padding: 3px 8px !important;
border-radius: 6px !important;
border: 1px solid #e0e7ff !important;
font-family: 'Monaco', 'Menlo', 'Consolas', monospace !important;
}
@keyframes messageSlideIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
/* ==================== 知识卡片样式 ==================== */
.knowledge-card {
background: white !important;
border-radius: 16px !important;
padding: 24px !important;
box-shadow: 0 6px 24px rgba(102, 126, 234, 0.1) !important;
border: 1px solid rgba(102, 126, 234, 0.12) !important;
margin: 15px 0 !important;
}
.knowledge-card h3 {
margin-top: 0 !important;
padding-bottom: 15px !important;
border-bottom: 2px solid;
border-image: linear-gradient(90deg, #667eea, #764ba2) 1;
}
.knowledge-card h4 {
margin-top: 18px !important;
margin-bottom: 12px !important;
font-size: 1.1em !important;
font-weight: 700 !important;
}
.knowledge-card details {
margin: 12px 0 !important;
transition: all 0.3s ease !important;
}
.knowledge-card details[open] {
margin-bottom: 18px !important;
}
.knowledge-card details summary {
cursor: pointer !important;
user-select: none !important;
outline: none !important;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
position: relative !important;
}
.knowledge-card details summary:hover {
transform: translateX(5px) !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15) !important;
}
.knowledge-card details summary::marker {
font-size: 1.2em !important;
}
.knowledge-card details[open] summary {
margin-bottom: 8px !important;
}
.knowledge-card table {
border-collapse: collapse !important;
width: 100% !important;
margin: 15px 0 !important;
font-size: 0.95em !important;
}
.knowledge-card table td,
.knowledge-card table th {
padding: 12px !important;
text-align: left !important;
}
.knowledge-card ul {
margin: 10px 0 !important;
padding-left: 25px !important;
}
.knowledge-card li {
margin: 6px 0 !important;
line-height: 1.6 !important;
}
.knowledge-card p {
margin: 10px 0 !important;
line-height: 1.7 !important;
}
.knowledge-card strong {
color: #667eea !important;
font-weight: 700 !important;
}
/* 滚动条美化 */
.knowledge-card::-webkit-scrollbar,
div[style*="overflow-y: auto"]::-webkit-scrollbar {
width: 8px !important;
}
.knowledge-card::-webkit-scrollbar-track,
div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
background: #f1f1f1 !important;
border-radius: 4px !important;
}
.knowledge-card::-webkit-scrollbar-thumb,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
border-radius: 4px !important;
}
.knowledge-card::-webkit-scrollbar-thumb:hover,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, #5568d3 0%, #6a3f8a 100%) !important;
}
/* ... 其他CSS规则可以从原文件复制过来 ... */