Solverz’ Utility

This lib provides the simulation routines for integrated energy systems, including electric power, natural gas and heat.

A simple usage of this library can be

from SolUtil import GasFlow
gf = GasFlow('belgium.xlsx')
gf.run()
gf.Pi # get the node Pressure results

The required .xlsx data format can be found in SolUtil/energyflow/test directory for reference.

Contents

class SolUtil.energyflow.gas_flow.GasFlow(file: str)

Perform natural gas flow with models and algorithms from [1].

Methods

run([tee])

Run gas flow

output_results

References

[1]
  1. Jia, T. Ding, Y. Yuan, and H. Zhang, “Fast Probabilistic Energy Flow Calculation for Natural Gas Systems: A Convex Multiparametric Programming Approach,” IEEE Trans. Automat. Sci. Eng., vol. 22, pp. 6786–6796, 2025, doi: 10.1109/TASE.2024.3454750.

class SolUtil.energyflow.dhs_flow.DhsFlow(file: str, heatmdl=None, tempmdl=None)

Perform heating network power flow with models from [1]. We are currently preparing the paper of our developed robust algorithm.

Methods

run([tee])

Run heat flow based on IPOPT

References

[1]
  1. Liu, J. Wu, N. Jenkins, and A. Bagdanavicius, “Combined analysis of electricity and heat networks,” Applied Energy, vol. 162, pp. 1238–1250, Jan. 2016, doi: 10.1016/j.apenergy.2015.01.102.

class SolUtil.energyflow.power_flow.PowerFlow(file: str, mdl=None, loopeqn: bool = True)

The electric power flow with Newton-Raphson method.

Parameters:
filestr

MATPOWER-format .xlsx case file (parsed by load_mpc).

mdldict or None

Optional pre-built {'mdl': numerical_model, 'y0': Vars} to skip the symbolic build entirely.

loopeqnbool, default True

Formulate the polar power-flow equations as a small number of LoopEqn blocks over a flat full-bus Vm / Va state (P_eqn over pv+pq, Q_eqn over pq, plus Vm_pin / Va_pin pinning the ref+pv magnitudes and ref angles), instead of expanding O(nb) scalar Eqn``s. The two formulations are algebraically identical, but the LoopEqn form builds and compiles to a handful of vector kernels rather than one scalar ``Eqn per bus, so create_instance and the Jacobian assembly scale with the number of equation blocks rather than the number of buses. This is the default since 0.9.0.

LoopEqn is only supported by the Numba-JIT module path (module_printer), not by the inline made_numerical path, so the model is rendered to a temporary directory and imported. This pays a one-off Numba compile cost.

loopeqn=False selects the legacy per-bus scalar inline build. It is deprecated and will be removed in a future release; it emits a DeprecationWarning. The scalar build is much slower to construct and lambdify on non-trivial networks and exists only for backward compatibility.

Methods

mdlpf_loopeqn()

Polar power flow as LoopEqn blocks over a flat full-bus state.

mdlpf

mdlpf_scalar

parse_data_post_pf

run