# 功率與效率量測 (`powerMeter`)

> 在電路執行中，計算轉換器的平均輸入功率、輸出功率與效率。

![powerMeter](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/powerMeter.svg)

[元件參考](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/) · [English](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/powerMeter/)

**分類:** 控制 · **種類:** `{"block":"powerMeter","kind":"control"}`

## 何時使用

用來在模擬中看轉換器效率的收斂情形，或在收斂後結束掃描的這一點。只看單一交流埠時改用功率因數量測。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `vin` | 訊號 | 輸入電壓，接自電壓計 |
| `iin` | 訊號 | 輸入電流，接自電流計，流入轉換器 |
| `vout` | 訊號 | 輸出電壓，接自電壓計 |
| `iout` | 訊號 | 輸出電流，接自電流計，流入負載 |
| `freq` | 訊號 | 選用的頻率輸入，單位赫茲，決定視窗 |
| `pin` | 訊號 | 平均輸入功率 |
| `pout` | 訊號 | 平均輸出功率 |
| `eff` | 訊號 | 效率 pout/pin，pin 不為正時為 0 |

## 常用參數

- `f`: Frequency the powers are averaged over: the switching frequency of a DC-DC converter, the line frequency of an inverter (預設值: 必填)
- `cycles`: Window length in periods of f; whole periods give exact figures (預設值: 1)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
| `f` | Hz | 必填 |  | Frequency the powers are averaged over: the switching frequency of a DC-DC converter, the line frequency of an inverter |
| `cycles` | — | 1 |  | Window length in periods of f; whole periods give exact figures |

_參數說明在兩種語言中都是英文。_

## 模型

在最近 cycles/f 秒內，pin = mean(vin*iin)，pout = mean(vout*iout)，皆以梯形法積分，eff = pout/pin。視窗取整數個切換週期時，兩者的切換漣波都會被消去，所以轉換器穩定後效率是精確的。

## 常見錯誤

- 輸出電容還在充電時，部分輸入功率變成儲存能量，效率會偏高或偏低。請在輸出穩定後再讀，或使用很多個週期的視窗。
- f 沒有預設值：DC-DC 轉換器請設為切換頻率，換流器或整流器請設為電網頻率，它們的功率以兩倍電網頻率脈動。

Problems 規則: `pin.unconnected`

## 規格書與來源

轉換器的規格書會給出在指定輸入電壓下效率對負載的曲線；把負載與輸入設在曲線上的某一點，模擬穩定後拿 eff 來比較。

## 範例

以指令 `file.openExample` 開啟範例，名稱為 `demo:powerMeter`.

---
由 `cargo xtask reference` 依使用說明文字與參數規格產生，請勿手動編輯。
