pwrs.core.cpf_register_event#

pwrs.core.cpf_register_event.cpf_register_event(cpf_events, name, fcn, tol, locate)[source]#

Register a CPF event detector.

Adds a CPF event definition to the existing event list, resolving string function names lazily and enforcing unique event names to match MATPOWER’s callback registry behavior.

Parameters:
  • cpf_events (dict or list of dict) – Existing CPF event registry, or an empty value to create a new one.

  • name (str) – Unique event name.

  • fcn (callable or str) – Event function or resolvable function name.

  • tol (float) – Event detection tolerance.

  • locate (int or bool) – Flag indicating whether the event should be located precisely.

Returns:

Updated CPF event registry.

Return type:

dict or list of dict