載波 (carrier)
介於 0 與 1 的三角波或鋸齒波,供 PWM 使用。
分類: 控制 · 種類: {"block":"carrier","kind":"control"}
何時使用
用於在自己的比較器中比較參考值與載波,或讓多個閘極共用同一個載波。PWM 產生器已內建載波。
接腳
| 接腳 | 訊號域 | 意義 |
|---|---|---|
phase |
訊號 | 選用的相位輸入,單位為度;接上時取代 phase 參數(移相橋式)。 |
freq |
訊號 | 選用的頻率輸入,單位為 Hz;接上時取代 freq,載波對其積分,所以頻率改變時不會跳動。 |
out |
訊號 | 介於 0 與 1 的載波 |
常用參數
freq: Carrier frequency; a wired freq input replaces it (預設值: 必填)shape: Triangle or sawtooth wave shape:triangleorsawtooth(預設值: triangle)phase: How far the wave is shifted, as a fraction of one period; a wired phase input (degrees) replaces it (預設值: 0)
參數
| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
freq |
Hz | 必填 | Carrier frequency; a wired freq input replaces it | |
shape |
— | triangle | Triangle or sawtooth wave shape: triangle or sawtooth |
|
phase |
— | 0 | How far the wave is shifted, as a fraction of one period; a wired phase input (degrees) replaces it |
參數說明在兩種語言中都是英文。
模型
令 x 為目前週期內的位置(0 到 1,並以 phase 位移);triangle 載波在 x < 0.5 時為 2*x,之後為 2 - 2*x,因此從 0 開始、半個週期時達到 1 的峰值,再回到 0。sawtooth 從 0 線性升到 1,每個週期結束時掉回 0。頻率為 freq(Hz),phase 為一個週期的分數。接上的 phase 輸入(度,除以 360)與 freq 輸入會取代這兩個參數;接上 freq 時,週期內的位置是頻率的積分。
常見錯誤
- 比步長快很多的載波無法被解析。請讓最大步長不超過載波週期的五十分之一,20 kHz 時就是 1 us。
- 頻率要連同字首一起寫,是 20k,不是 20。載波介於 0 與 1,所以介於 -1 與 1 的參考值要先轉成責任比,例如用 output 設為 duty 的空間向量調變器。
Problems 規則: step.too_large, param.out_of_range
規格書與來源
沒有規格書可查。freq 是你選的切換頻率,通常受元件切換損耗與 MCU 計時器限制,phase 可用來讓多個載波交錯。
範例
以指令 file.openExample 開啟範例,名稱為 demo:carrier.
由 cargo xtask reference 依使用說明文字與參數規格產生,請勿手動編輯。