MHE APMonitor

13 views
Skip to first unread message

Dr. Jalesh Purohit

unread,
Nov 28, 2024, 9:42:40 AM11/28/24
to apmo...@googlegroups.com
Hi everyone
Can you please let me know how to change the moving horizon window in MHE Apmonitor? What is the meaning of the number of cycles? 

with regards
Thank you
Dr. Jalesh L. Purohit (PhD, IIT-Bombay)
Chemical Engineering Department,
D D University, Nadiad, Gujarat, India
Mob:91 9925665899
https://scholar.google.com/citations?user=WeScPaIAAAAJ&hl=en

John Hedengren

unread,
Nov 28, 2024, 10:39:30 AM11/28/24
to apmo...@googlegroups.com
Jalesh,

I recommend using the Python GEKKO package as an interface to APMonitor. To change the moving horizon window in Moving Horizon Estimation (MHE) with APMonitor (GEKKO), you need to adjust the m.time array. This array specifies the discretized time points over which the estimation is performed. By modifying the length or resolution of the m.time array, you effectively set the size of the moving horizon window.

Example:
from gekko import GEKKO
import numpy as np
m = GEKKO()
m.time = np.linspace(0, 10, 11)  # Moving horizon from 0 to 10 with 11 points

Number of Cycles
The number of cycles in MHE refers to how frequently the model is updated with new measurements. Typically, this matches the time resolution of your data and is tied to the discretization in the m.time array. For every "cycle," new measurements at the current time step are incorporated, and the horizon is shifted forward by dropping the oldest data point and adding the newest.

For automated shifting in GEKKO, you can use:

m.options.TIME_SHIFT = 1  # Enable automatic time shifting

This setting ensures that with each cycle, the time horizon shifts forward, maintaining the moving horizon framework dynamically. The frequency of measurement updates and shifting depends on the problem's setup and data availability.

If you need additional information on estimator tuning with the Python or MATLAB interface, there is more information here: https://apmonitor.com/do/index.php/Main/EstimatorTuning  Use parameters CTRL_HOR and PRED_HOR to adjust the time steps if not specifying m.time (GEKKO) or a CSV file with time column (APM)

Best regards,
John Hedengren
> --
> --
> APMonitor user's group e-mail list.
> - To post a message, send email to apmo...@googlegroups.com
> - To unsubscribe, send email to apmonitor+...@googlegroups.com
> - Visit this group at http://groups.google.com/group/apmonitor
> ---
> You received this message because you are subscribed to the Google Groups "apmonitor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to apmonitor+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/apmonitor/CAOTrZssmHL4C3f8yX8OCYWCm2rZMvuJgyFx7_O1Z2hniCQ6Pwg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages