hynet.test package

Submodules

hynet.test.installation module

Regression test to verify the proper installation of hynet at the user.

hynet.test.installation.test_installation(verbose=True)[source]

Verify the OPF solution of a test system for all available solvers.

Parameters:verbose (bool, optional) – If True (default), the test is documented to the standard output.
Returns:success – True if the test was passed, False otherwise.
Return type:bool

hynet.test.regression module

Support for OPF regression tests.

class hynet.test.regression.OPFVerificationData[source]

Bases: hynet.test.regression.OPFVerificationData

OPF solution verification data for regression tests.

This class contains the minimum amount of reference data to properly verify the outcome of an OPF calculation. It was introduced to compactly embed the reference solution for installation testing in hynet’s code - it’s not too pleasing, but simple and robust ;)

static create(result)[source]

Return a OPF verification data object for the given OPF result.

Parameters:result (hynet.opf.result.OPFResult) – OPF result for which the OPF verification data shall be created.
Returns:reference – OPF verification data.
Return type:OPFVerificationData
hynet.test.regression.verify_opf_result(result, reference, tolerance)[source]

Verify an OPF result versus a reference solution.

The OPF result is verified by comparing the OPF verification data to a reference solution by calculating the respective relative mean absolute errors and checking them against a tolerance threshold. As the bus voltage magnitudes are less rigid (in particular w.r.t. relaxations), the error threshold is relaxed for those comparisons.

Parameters:
  • result (OPFVerificationData) – OPF solution that shall be verified.
  • reference (OPFVerificationData) – Reference OPF solution.
  • tolerance (hynet_float_) – Tolerance on the relative mean absolute error of the individual result vectors.
Raises:

ValueError – In case any mismatch beyond the tolerance is detected.

hynet.test.system module

Artificial system for OPF regression tests.

This testing data is embedded as code to obtain simple and robust access to it.

Module contents

Testing functionality to verify the proper setup of hynet at the user.