---
title: "RET compliance primer: LGCs, STCs, and the shortfall charge"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{RET compliance primer: LGCs, STCs, and the shortfall charge}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", eval = FALSE)
```

The Renewable Energy Target (RET) is Australia's two-scheme
renewable certificate framework:

- **LRET** (Large-scale): accredited power stations create LGCs
  (Large-scale Generation Certificates). 1 LGC = 1 MWh.
- **SRES** (Small-scale): small-scale systems (rooftop solar,
  solar water heaters, heat pumps) create STCs (Small-scale
  Technology Certificates). STC multipliers vary by system type
  and zone.

Liable entities (mostly electricity retailers) must surrender
LGCs to meet the annual LRET target and STCs to meet the annual
small-scale percentage. The **shortfall charge** caps the price:
AUD 65 per MWh (pre-tax) for LGCs; AUD 40 per STC.

## LRET: accredited power stations

```{r}
library(cer)
cer_snapshot("2026-04-24")

stations <- cer_lgc_power_stations(technology = "solar")
head(stations[, c("accredited_power_station", "state",
                   "capacity_mw", "accreditation_date")])
```

## SRES: postcode installations

```{r}
sres <- cer_sres_installations(measure = "installations")
head(sres[, 1:8])
```

## Quick compliance check

A retailer with 10 TWh (= 10,000,000 MWh) of liable acquisitions
and an LRET target of 18 per cent must surrender 1,800,000 LGCs.
If they surrender 1,700,000 and no grandfathered arrangements
apply, the shortfall is 100,000 LGCs, and the shortfall charge is
AUD 6.5m (pre-tax).

```{r}
liable_mwh <- 10e6
target_pct <- 0.18
lgcs_required <- liable_mwh * target_pct
lgcs_surrendered <- 1700000

shortfall_lgcs <- max(0, lgcs_required - lgcs_surrendered)
shortfall_aud <- shortfall_lgcs * 65   # pre-tax shortfall charge
shortfall_aud
```

## Reconciling against QCMR headline

```{r}
# Cumulative LGC issuances
cer_reconcile(
  value    = sum(stations$capacity_mw, na.rm = TRUE) * 1e3,  # rough
  quarter  = "2024-Q4",
  measure  = "lgc_cumulative_issuances_millions"
)
```

The rough check using capacity is a weak proxy; real reconciliation
would use the published LGC issuance register. This vignette is
illustrative of the reconciliation pattern.
