Skip to content

Closed-form reference cases

Every result in this package is a nodal solve, and a nodal solve will happily return a number for a model that is wrong. These cases are the antidote: configurations whose answer is known in closed form from the standard treatment of grounding systems, run through the ordinary public API and compared.

The closed forms are derived in each case's docstring rather than quoted, so they can be checked line by line against whichever text you cite. They are the standard results of the German grounding literature (Oeding/Oswald, the TU Graz treatments and Küchler [1]); attaching the exact clause and equation numbers of your editions is yours to do — the module does not claim a citation it cannot verify.

Each case names the boundary conditions under which its closed form holds. A deviation outside tolerance means either the model is wrong or a condition was not met, and in practice the second is the more common finding.

The table below is written when this site is built, from REFERENCE_CASES and one run of gi.run_reference_cases() — what each case compares, under which condition, and how close the documented version comes:

case quantity condition closed form model rel. deviation tolerance agrees
line_ideal_bonding reduction factor r [-] single line, station electrodes negligible against the shield impedance 0.5 0.499999 2.0e-06 1e-03 yes
line_finite_earthing reduction factor r [-] single line, both ends earthed with a finite electrode 0.005562082816 0.005562082816 7.8e-16 1e-09 yes
en50522_chain earth-return current I_E [A] six-station chain, I_E re-derived from an independently assembled nodal system 32.38457029 32.38457029 6.6e-16 1e-09 yes
ladder_input_impedance input impedance Z_in [Ohm] chain long enough to be semi-infinite (80 sections here) 1.403195874 1.403195879 3.1e-09 1e-06 yes
ladder_potential_decay potential ratio u_20/u_0 [-] same chain, far enough from either end 0.07852933524 0.07852931427 2.7e-07 1e-06 yes
parallel_decomposition driving-point impedance [Ohm] cuts covering every branch at the station 1.724271703 1.724271703 1.2e-15 1e-12 yes

Generated when this site was built, with groundinsight 2026.11.1.

The same call is a self-test of an installation; see Verification and validation for the independent checks behind the cases.

reference

Closed-form reference cases the solver has to reproduce.

Every result in this package is a nodal solve, and a nodal solve will happily return a number for a model that is wrong. The cases below are the antidote: configurations whose answer is known in closed form from the standard treatment of grounding systems, run through the ordinary public API and compared. If the boundary conditions each case names are met, the solver has to land on the closed form — and where it does not, either the model or the assumption is at fault, which is exactly what one wants to find out before a study rests on it.

The closed forms are derived in the docstring of each case rather than quoted, so they can be checked line by line against whichever text you cite. They are the standard results of the German grounding literature (Oeding/Oswald, the TU Graz treatments and B. Küchler's dissertation, TU Dresden 2024, urn:nbn:de:bsz:14-qucosa2-901763); attaching the exact clause and equation numbers of your editions is yours to do — this module does not claim a citation it cannot verify.

The cases

line_ideal_bonding The textbook reduction factor r = |1 - Z_m/Z_s|, valid where the station earths vanish against the shield impedance. line_finite_earthing The same line with real electrodes: r = |(Z_s - Z_m)/(Z_s + Z_E)|. The first case is its Z_E -> 0 limit, which is why the two must converge. en50522_chain The earth-return current I_E of a six-station chain, re-derived from a nodal system assembled here from the model's own impedances. The case does not check U_E = 3*I_0 * Z_E * r with all factors read out of one result: with Z_E the driving-point impedance at the fault bus that relation is a physical statement (pinned on a long chain by the test suite), but for the group pair u_earthing_group / z_earthing_group it is closed by construction, and a case built on it would agree to 1e-16 whatever the model did. ladder_input_impedance A chain of bonded stations is a ladder network, and a long one presents Z_in = -Z'/2 + sqrt(Z'^2/4 + Z_e*Z') at its end. ladder_potential_decay Along the same ladder the potential falls off as e^(-n*gamma) with gamma = arccosh(1 + Z'/(2*Z_e)) -- the propagation constant that decides how many stations a fault at one of them actually reaches. parallel_decomposition The driving-point impedance at a station is its own electrode in parallel with what every direction contributes, exactly.

Run them with :func:run_reference_cases, which returns one row per case with the closed form, the model value and the relative deviation.

REFERENCE_CASES module-attribute

REFERENCE_CASES: List[ReferenceCase] = [
    ReferenceCase(
        "line_ideal_bonding",
        "reduction factor r [-]",
        "single line, station electrodes negligible against the shield impedance",
        0.001,
        _line_ideal_bonding,
    ),
    ReferenceCase(
        "line_finite_earthing",
        "reduction factor r [-]",
        "single line, both ends earthed with a finite electrode",
        1e-09,
        _line_finite_earthing,
    ),
    ReferenceCase(
        "en50522_chain",
        "earth-return current I_E [A]",
        "six-station chain, I_E re-derived from an independently assembled nodal system",
        1e-09,
        _en50522_chain,
    ),
    ReferenceCase(
        "ladder_input_impedance",
        "input impedance Z_in [Ohm]",
        "chain long enough to be semi-infinite (80 sections here)",
        1e-06,
        _ladder_input_impedance,
    ),
    ReferenceCase(
        "ladder_potential_decay",
        "potential ratio u_20/u_0 [-]",
        "same chain, far enough from either end",
        1e-06,
        _ladder_potential_decay,
    ),
    ReferenceCase(
        "parallel_decomposition",
        "driving-point impedance [Ohm]",
        "cuts covering every branch at the station",
        1e-12,
        _parallel_decomposition,
    ),
]

ReferenceCase

ReferenceCase(
    name: str,
    quantity: str,
    conditions: str,
    tolerance: float,
    run: Callable[[], Tuple[float, float]],
)

One closed-form case and the model run that has to match it.

Parameters:

Name Type Description Default
name str

Short identifier, used as the row key.

required
quantity str

What is being compared, with its unit.

required
conditions str

The boundary conditions under which the closed form holds. A deviation outside tolerance means either the model is wrong or a condition here was not met -- the second is the more common finding.

required
tolerance float

Relative deviation still counted as agreement.

required
run callable

run() -> (closed_form, model): builds the case's network, solves it and returns both numbers.

required

Attributes:

Name Type Description
name, quantity, conditions, tolerance

The constructor arguments of the same name.

Examples:

>>> import groundinsight as gi
>>> case = gi.REFERENCE_CASES[0]
>>> isinstance(case, gi.ReferenceCase)
True
>>> row = case.evaluate()
>>> row["case"] == case.name, row["agrees"]
(True, True)
Source code in src/groundinsight/analysis/reference.py
def __init__(
    self,
    name: str,
    quantity: str,
    conditions: str,
    tolerance: float,
    run: Callable[[], Tuple[float, float]],
):
    self.name = name
    self.quantity = quantity
    self.conditions = conditions
    self.tolerance = tolerance
    self._run = run

evaluate

evaluate() -> Dict[str, object]

Run the case and return its row.

Returns:

Type Description
dict

The row of :func:run_reference_cases: case, quantity, conditions, closed_form, model, rel_deviation, tolerance and agrees.

Source code in src/groundinsight/analysis/reference.py
def evaluate(self) -> Dict[str, object]:
    """
    Run the case and return its row.

    Returns
    -------
    dict
        The row of :func:`run_reference_cases`: ``case``, ``quantity``,
        ``conditions``, ``closed_form``, ``model``, ``rel_deviation``,
        ``tolerance`` and ``agrees``.
    """
    closed_form, model = self._run()
    reference = abs(closed_form)
    deviation = (
        abs(model - closed_form) / reference if reference > 0 else float("nan")
    )
    return {
        "case": self.name,
        "quantity": self.quantity,
        "conditions": self.conditions,
        "closed_form": float(closed_form),
        "model": float(model),
        "rel_deviation": float(deviation),
        "tolerance": float(self.tolerance),
        "agrees": bool(deviation <= self.tolerance),
    }

run_reference_cases

run_reference_cases(
    cases: Optional[List[ReferenceCase]] = None,
) -> pl.DataFrame

Run the closed-form reference cases and report the comparison.

Parameters:

Name Type Description Default
cases list of ReferenceCase

Defaults to :data:REFERENCE_CASES.

None

Returns:

Type Description
DataFrame

One row per case: case, quantity, conditions, closed_form, model, rel_deviation, tolerance, agrees.

Examples:

>>> import groundinsight as gi
>>> table = gi.run_reference_cases()
>>> table.height == len(gi.REFERENCE_CASES), table["agrees"].all()
(True, True)
Source code in src/groundinsight/analysis/reference.py
def run_reference_cases(
    cases: Optional[List[ReferenceCase]] = None,
) -> pl.DataFrame:
    """
    Run the closed-form reference cases and report the comparison.

    Parameters
    ----------
    cases : list of ReferenceCase, optional
        Defaults to :data:`REFERENCE_CASES`.

    Returns
    -------
    pl.DataFrame
        One row per case: ``case``, ``quantity``, ``conditions``,
        ``closed_form``, ``model``, ``rel_deviation``, ``tolerance``,
        ``agrees``.

    Examples
    --------
    >>> import groundinsight as gi
    >>> table = gi.run_reference_cases()
    >>> table.height == len(gi.REFERENCE_CASES), table["agrees"].all()
    (True, True)
    """
    rows = [case.evaluate() for case in (cases or REFERENCE_CASES)]
    frame = pl.DataFrame(rows)
    failed = frame.filter(~pl.col("agrees"))
    if failed.height:
        logger.warning(
            "%d reference case(s) missed their closed form: %s. Either the model "
            "is wrong or a stated boundary condition was not met -- the second "
            "is the more common finding, so read the 'conditions' column first.",
            failed.height,
            ", ".join(failed["case"].to_list()),
        )
    return frame

References

  1. B. Küchler, Modellbasierte Berechnung der frequenzabhängigen Stromverteilung in räumlich ausgedehnten Erdungssystemen, dissertation, Technische Universität Dresden, 2024. https://nbn-resolving.org/urn:nbn:de:bsz:14-qucosa2-901763