pwrs.core.cpf_register_callback#
- pwrs.core.cpf_register_callback.cpf_register_callback(cpf_callbacks, fcn, priority=None, args=None)[source]#
Register a CPF callback.
Adds a CPF callback to the existing callback list, resolving string function names lazily and sorting callbacks by descending priority to match MATPOWER’s execution order.
- Parameters:
cpf_callbacks (dict or list of dict) – Existing CPF callback registry, or an empty value to create a new one.
fcn (callable or str) – Callback function or resolvable function name.
priority (int, optional) – Callback priority. Higher-priority callbacks run first.
args (list, optional) – Extra callback arguments stored with the registration record.
- Returns:
Updated CPF callback registry.
- Return type:
dict or list of dict