Runtime-registered composite-load model for ANDES.
This repository contains a prototype CLM model that replaces an existing
ANDES PQ load with a composite load made of:
- static ZIP load
- fifth-order induction-motor dynamics
- strict initialization check for the replaced load's initial reactive power
The package does not edit the installed ANDES source tree. Instead,
andes_clm.register_clm() injects the model module into ANDES' runtime model
registry before a System is created.
- Python 3.12.3
- ANDES 1.9.2
- Windows 11
Other Python and ANDES 1.9.x environments may work, but should be verified with the included example.
From a local checkout:
python -m pip install -e .For development tests:
python -m pip install -e . pytest
python -m pytestimport andes
from andes_clm import register_clm
register_clm()
system = andes.load(andes.get_case("ieee39/ieee39_full.xlsx"), setup=False, no_undill=True)
system._load_calls()
target = system.PQ.as_df().query("bus == 4").iloc[0]
system.add(
"CLM",
{
"idx": "CLM_bus4",
"pq": target["idx"],
"kpz": 35.0,
"kpi": 25.0,
"kqz": 30.0,
"kqi": 30.0,
"kpct": 60.0,
"rs": 0.08,
"rr": 0.03,
"xs": 0.18,
"xr": 0.12,
"xm": 3.50,
"Tj": 2.0,
"fn": 50.0,
"vmin": 0.60,
},
)
system.prepare(quick=True, incremental=True, models=["CLM"], nomp=True, ncpu=1)
system.setup()
system.PFlow.run()The referenced PQ is disabled during dynamic initialization by CLM.v_numeric.
The solved PQ.Ppf and PQ.Qpf values are used as the pre-disturbance load
target.
python examples/ieee39_clm_demo.pyExpected high-level behavior:
- the IEEE 39-bus power flow converges
- TDS initializes
- the referenced bus-4
PQload is disabled after CLM initialization - a bus-4 voltage trace is produced for the fault disturbance
This prototype intentionally keeps the pure-motor boundary strict.
When kpct = 100, the static ZIP reactive-power compensation is disabled:
qzip0 = Indicator(kpct < 99.999) * (q0 - qmot0)If the motor parameters cannot match the replaced PQ load's initial reactive
power, InitChecker(error_out=True) fails initialization instead of silently
absorbing the mismatch with hidden static reactive compensation.
This is deliberate. A mixed CLM case can run, but a pure-motor replacement is only accepted when the motor itself is consistent with the original load at initialization.
andes_clm/clm.py: CLM model data and equations.andes_clm/register.py: runtime ANDES registry hook.examples/ieee39_clm_demo.py: minimal runnable IEEE39 example.tests/test_registration.py: smoke test for model registration.
Before publishing to GitHub:
- Re-run
python examples/ieee39_clm_demo.pyin a clean environment.
This project is licensed under the MIT License. See LICENSE.
If this model is used in a paper or derivative project, cite the upstream ANDES
project and clearly state that CLM is an external prototype model registered
at runtime, not an upstream ANDES built-in model.