pwrs.core.run_userfcn#

pwrs.core.run_userfcn.run_userfcn(userfcn, stage, *args)[source]#

Run all user callbacks registered for a stage.

Executes each callback registered under stage in sequence, feeding the return value from one callback into the next to mirror MATPOWER’s userfcn execution semantics.

Parameters:
  • userfcn (dict) – User callback registry from a MATPOWER case struct.

  • stage (str) – Callback stage name.

  • *args – Arguments passed to each callback. The first argument is threaded through as the return value accumulator.

Returns:

Final callback return value after all stage callbacks have run.

Return type:

Any