# Compressor (AHRI 540 + maps)

Config type: `"Compressor"`  
Source: `crates/components/src/compressor.rs`  
Related: `polynomials.rs` (Polynomial2D), registry `SstSdt` model variant

---

## EN

### Purpose

Positive-displacement compressor performance from **published coefficient maps**:

1. **AHRI 540** (CLI default for `"Compressor"`) — 10 coefficients M1–M10  
2. **SST/SDT polynomial** (API / registry) — 2D polynomials ṁ(SST,SDT), Ẇ(SST,SDT)

### Model A — AHRI 540

**Mass flow [kg/s]:**

```
ṁ = M1 · (1 − (P_suc / P_dis)^(1/M2)) · ρ_suc · V_disp · N/60
```

**Power cooling [W]:**

```
Ẇ = M3 + M4 · (P_dis/P_suc) + M5 · T_suc + M6 · T_dis
```

**Power heating [W]:**

```
Ẇ = M7 + M8 · (P_dis/P_suc) + M9 · T_suc + M10 · T_dis
```

| Coeff | Role | Typical CLI default |
|-------|------|---------------------|
| M1 | flow scale | 0.85 |
| M2 | PR exponent (>0) | 2.5 |
| M3–M6 | cooling power poly | 500, 1500, −2.5, 1.8 |
| M7–M10 | heating power poly | 600, 1600, −3.0, 2.0 |

Also required: `speed_rpm`, `displacement_m3`, `efficiency` (isentropic / overall as used by the arm).

### Model B — SST/SDT polynomial (same `Compressor` type)

Select with JSON / UI: `"model_type": "SstSdt"` (aliases: `SstSdtPolynomial`, `sst_sdt`).

```
ṁ = Σ a_ij · SST^i · SDT^j     [kg/s]   (SST, SDT in Kelvin)
Ẇ = Σ b_ij · SST^i · SDT^j     [W]
```

Bilinear form (CLI / UI coefficients):

```
ṁ = a00 + a10·SST + a01·SDT + a11·SST·SDT
Ẇ = b00 + b10·SST + b01·SDT + b11·SST·SDT
```

| JSON key | Role | Default (example) |
|----------|------|-------------------|
| `mf_a00` … `mf_a11` | mass-flow bilinear | 0.05, 0.001, 0.0005, 1e−5 |
| `pw_b00` … `pw_b11` | power bilinear | 1000, 50, 30, 0.5 |

Also used by **ScrewEconomizerCompressor** (same bilinear form + eco fraction + presets Bitzer/Grasso).

### Residuals / ports

Two-port suction/discharge. Residual count depends on same-branch mass and model wiring (typically flow + energy).

### Calibration

| Factor | Default | Effect |
|--------|---------|--------|
| `z_flow` | **1.0** | scales ṁ |
| `z_power` | **1.0** | scales Ẇ |

### JSON (CLI `"Compressor"`)

| Key | Meaning | Default |
|-----|---------|---------|
| `model_type` | `Ahri540` \| `SstSdt` | `Ahri540` |
| `speed_rpm` | speed | **required** |
| `displacement_m3` | displacement | **required** |
| `efficiency` | efficiency | 0.85 |
| `fluid` | refrigerant | required |
| `m1` … `m10` | AHRI coeffs (if Ahri540) | see table |
| `mf_a00`…`mf_a11`, `pw_b00`…`pw_b11` | SST/SDT bilinear (if SstSdt) | see table |
| `p_suction_bar` / `h_suction_kj_kg` | init ports | 3.5 / 400 |
| `p_discharge_bar` / `h_discharge_kj_kg` | init ports | 12 / 440 |

### UI guidance

- **Modèle de carte** : bascule Ahri540 ↔ SstSdt  
- Sections **AHRI 540** ou **Map SST/SDT** selon le choix  
- Section **Machine** : speed, displacement, efficiency  
- L’**IsentropicCompressor** est un modèle physique différent (η_is + cylindrée)

---

## FR

### But

Compresseur à **cartes de performance** constructeur.

### AHRI 540

```
ṁ = M1 · (1 − (P_s/P_d)^{1/M2}) · ρ · V · N/60
Ẇ = M3 + M4·PR + M5·T_s + M6·T_d   (froid)
```

### Polynôme SST/SDT

```
ṁ, Ẇ = polynôme 2D en SST et SDT
```

(Utilisé surtout sur le **vis** ; presets Bitzer/Grasso.)

### Calibration

`z_flow`, `z_power` = **1.0** par défaut.

### JSON

Voir tableau EN (`m1`…`m10`, `speed_rpm`, `displacement_m3`).
