Skip to content

debug: init windows w/o NaNs at k=-1 if direct=true in MovingHorizonEstimator - #465

Open
franckgaga wants to merge 2 commits into
mainfrom
debug_init_De_mhe
Open

franckgaga wants to merge 2 commits into
mainfrom
debug_init_De_mhe

Conversation

@franckgaga

@franckgaga franckgaga commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

The $\mathbf{Y_0^m}$, $\mathbf{U_0}$, $\mathbf{U_e}$ and $\mathbf{D_e}$ data windows was not correctly initialized if direct==true (or $p=0$) just after MovingHorizonEstimator construction. The first element is the time step $k=-1$ according to the table in the extended help of MovingHorizonEstimator, which is equal to the operating point by default (can be customized with initstate!):

image

How to read the table: at $k=0$ we have $N_k=1$ data, thus the first sample is $k-N_k+p = (0) - (1) + (0) = -1$.

Before this PR it was a NaN value instead of the operating point. Note that this is a minor bugfix since the incorrect NaN values vanish once the data windows are filled. Also the bug was not present if initstate! was called before the estimations.

@franckgaga franckgaga changed the title debug: init De without a NaN if direct==true in MovingHorizonEstimator debug: init De without a NaN if direct=true in MovingHorizonEstimator Oct 12, 2026
@franckgaga franckgaga changed the title debug: init De without a NaN if direct=true in MovingHorizonEstimator debug: init windows w/o NaNs if direct=true in MovingHorizonEstimator Oct 12, 2026
@franckgaga franckgaga changed the title debug: init windows w/o NaNs if direct=true in MovingHorizonEstimator debug: init windows w/o NaNs at start if direct=true in MovingHorizonEstimator Oct 12, 2026
@franckgaga franckgaga changed the title debug: init windows w/o NaNs at start if direct=true in MovingHorizonEstimator debug: init windows w/o NaNs at k=-1 if direct=true in MovingHorizonEstimator Oct 12, 2026
@codecov-commenter

codecov-commenter commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.19%. Comparing base (0442dd3) to head (9cc2550).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #465      +/-   ##
==========================================
- Coverage   97.22%   97.19%   -0.03%     
==========================================
  Files          28       28              
  Lines        6874     6879       +5     
==========================================
+ Hits         6683     6686       +3     
- Misses        191      193       +2     
Flag Coverage Δ
unittests 97.19% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants