# Created: 2024-12-01
# Last Modified: 2025-05-19
# (c) Copyright 2024 ETH Zurich, Milos Katanic
# https://doi.org/10.5905/ethz-1007-842
#
# Licensed under the GNU General Public License v3.0;
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# https://www.gnu.org/licenses/gpl-3.0.en.html
#
# This software is distributed "AS IS", WITHOUT WARRANTY OF ANY KIND,
# express or implied. See the License for specific language governing
# permissions and limitations under the License.
#
# The code is based on the publication: Katanic, M., Lygeros, J., Hug, G.: Recursive
# dynamic state estimation for power systems with an incomplete nonlinear DAE model.
# IET Gener. Transm. Distrib. 18, 3657–3668 (2024). https://doi.org/10.1049/gtd2.13308
# The full paper version is available at: https://arxiv.org/abs/2305.10065v2
# See full metadata at: README.md
# For inquiries, contact: mkatanic@ethz.ch
from pydynamicestimator.run import run
import numpy as np
from pydynamicestimator.config import config
[docs]
def test_run():
new_config = config.updated(
testsystemfile="IEEE39_bus_ideal",
fn=50,
Sb=100,
ts=0.001,
te=0.001,
T_start=0.0,
T_end=5.0,
int_scheme="backward",
int_scheme_sim="idas",
init_error_diff=0,
init_error_alg=False,
plot=False,
plot_voltage=False,
plot_diff=False,
proc_noise_alg=0.0,
proc_noise_diff=0.0,
filter="iekf",
log_level="WARNING",
incl_lim=False,
)
dae_est, dae_sim = run(new_config)
for key in dae_est.grid.yf:
assert np.allclose(
dae_sim.grid.yf[key][
:,
round(dae_est.T_start / dae_sim.t) : round(
dae_est.T_end / dae_sim.t
) : round(dae_est.t / dae_sim.t),
],
dae_est.grid.yf[key],
atol=1e-04,
), f"The error of voltages estimation is too large even without noise for node {key}"