Optimization Hydrograph

85 views
Skip to first unread message

Aziz Hassan

unread,
Apr 21, 2017, 10:29:43 AM4/21/17
to apmonitor
Hello,
I need to apply optimization method for my work 
i have curvy (hydrograph) and i have file data (.csv , txt , exl)
I need to apply optimization method on this curvy,
please , what i must to do for imprt data and apply the optimization
Thank you in advanced

John Hedengren

unread,
Apr 21, 2017, 10:40:16 AM4/21/17
to apmo...@googlegroups.com

Dear Aziz,

 

You’ll need to translate your model to the APMonitor modeling language or else use an optimizer such as MATLAB’s fmincon or . Below are basic tutorials that I’d recommend:

 

http://apmonitor.com/che263/index.php/Main/PythonOptimization (Python Optimization - Programming Course)

http://apmonitor.com/che263/index.php/Main/MatlabOptimization (MATLAB Optimization - Programming Course)

http://apmonitor.com/me575/index.php/Main/TwoBarTruss (Two Bar Truss Optimization – Optimization Course)

 

Please go through these exercises and reproduce the results as a first step. You’ll also need to define your design variables and equations for your curvy hydrograph as detailed in Chapter 1 (introduction chapter) of the optimization course:

 

http://apmonitor.com/me575/index.php/Main/BookChapters

 

Are you trying to optimize flow release from an upstream reservoir?

 

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.
For more options, visit https://groups.google.com/d/optout.

Aziz Hassan

unread,
Apr 24, 2017, 8:55:43 AM4/24/17
to apmonitor
Thank you so much...
I am trying to apply optimization methods for shallow water flow modeling, i will make model calibration an optimization of engineering measures and the last step is parameter iddentifcation for highly parameterzed models.
We have simulation for water flow in smale deapth (channel, river, ...)
we use this equations
shallow water equatons.png

John Hedengren

unread,
Apr 24, 2017, 9:25:05 AM4/24/17
to apmo...@googlegroups.com
Aziz,

This looks like an interesting application. The PDAE model with variables in x, y, and t will create a large set of differential and algebraic equations. You'll need to discretize in space and time before solving the equations, although APMonitor can do the discretization in time. There are several APMonitor applications that solve PDEs such as the heated rod, distillation, and a solid oxide fuel cell. They are available in MATLAB and Python. Let me know if you need example files to reference as you get started. You should also look at "shooting methods" for this application where you successively solve the equations and objective function. 

Best regards, 

John Hedengren
Assistant Professor
Department of Chemical Engineering
Brigham Young University


-------- Original message --------
From: Aziz Hassan <aze...@gmail.com>
Date: 4/24/17 6:55 AM (GMT-07:00)
To: apmonitor <apmo...@googlegroups.com>
--

Aziz Hassan

unread,
Apr 26, 2017, 12:58:56 PM4/26/17
to apmonitor
Thank you so much Prof.Hedengren
please, I would like to ask you if I can use ( mean square error method) as first step for minimize :
How I can import file data ( measured and simulated)
how I can apply minimize in apmonitor

Thanks in advanced   


Am Freitag, 21. April 2017 16:29:43 UTC+2 schrieb Aziz Hassan:
interflow.png

John Hedengren

unread,
Apr 26, 2017, 1:02:40 PM4/26/17
to APM Google Groups
Aziz,

Below is a link to two examples in APMonitor (in Python and MATLAB):

http://apmonitor.com/do/index.php/Main/EstimatorObjective

I recommend that you go through the examples to understand how to to set up model equations and data files. You can set the objective function to minimize a sum of squared errors by setting the option:

apm_option(server,app,'nlc.ev_type',2)

in your MATLAB or Python script.

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+unsubscribe@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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
John Hedengren
APMonitor Modeling Language
jo...@apmonitor.com

http://www.youtube.com/subscription_center?add_user=APMonitorCom

Aziz Hassan

unread,
Apr 27, 2017, 8:18:38 AM4/27/17
to apmonitor

Thank you so much Prof,
please can you help me for this problem

Am Freitag, 21. April 2017 16:29:43 UTC+2 schrieb Aziz Hassan:
problem.png

John Hedengren

unread,
Apr 27, 2017, 8:51:52 AM4/27/17
to apmo...@googlegroups.com, Trent O

Aziz,

 

Could you insert the following lines of code?:

 

try:

    from APMonitor.apm import *

except:

    # Automatically install APMonitor

    import pip

    pip.main(['install','APMonitor'])

    from APMonitor.apm import *

 

It appears that APMonitor may not be “pip” installed yet or there was a problem with the installation.

 

 

If this doesn’t work, please obtain the file (apm.py) and put it in your run directory. The file apm.py is available from http://apmonitor.com/wiki/uploads/Main/apm_python_v0.7.6.zip or https://github.com/APMonitor/apm_python/blob/master/apm.py  If you use the apm.py file, you’ll just need to change the import line to:

 

from apm import *

 

I’ve CC’d the APMonitor pip administrator (Trent) in case there are further problems with the pip install.

 

Best regards,

 

John Hedengren

 

From: apmo...@googlegroups.com [mailto:apmo...@googlegroups.com] On Behalf Of Aziz Hassan
Sent: Thursday, April 27, 2017 5:09 AM
To: apmonitor <apmo...@googlegroups.com>
Subject: [APM] Re: Optimization Hydrograph

 

--

--
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.

Aziz Hassan

unread,
May 11, 2017, 1:20:59 PM5/11/17
to apmonitor
Hi Professor,
At first thank you so much for helping
please I have problem,
what I must do for apply the optimization
I have exccel file for (time , measurement, simulation) 
and ihave shallow water equations 
the parameter is manning's coefficient its value( 0,02-0,08)
Can you please tell me by steps...!?

Thanks in advance



Am Freitag, 21. April 2017 16:29:43 UTC+2 schrieb Aziz Hassan:

John Hedengren

unread,
May 11, 2017, 1:24:05 PM5/11/17
to apmo...@googlegroups.com

Aziz,

 

Below is a link to a tutorial on using Excel solver:

 

http://apmonitor.com/che263/index.php/Main/ExcelSolver

 

Excel uses the GRG2 (Generalized Reduced Gradient -2) method by default. There are equivalent Python and MATLAB tutorials as well:

 

http://apmonitor.com/che263/index.php/Main/PythonOptimization

http://apmonitor.com/che263/index.php/Main/MatlabOptimization

 

that use fmincon (MATLAB), Scipy.optimize.minimize (Python), or APMonitor.

 

Best regards,

 

John Hedengren

 

From: apmo...@googlegroups.com [mailto:apmo...@googlegroups.com] On Behalf Of Aziz Hassan
Sent: Thursday, May 11, 2017 9:20 AM
To: apmonitor <apmo...@googlegroups.com>
Subject: [APM] Re: Optimization Hydrograph

 

Hi Professor,

--

Aziz Hassan

unread,
May 17, 2017, 2:55:30 PM5/17/17
to apmonitor
Hello Professor
I would like to ask you about station
I made 10 simulation and have 10 results for Hydrograph
I have also observation hydrograph 
I would likt ao apply the mean square error (MSE) on this results to find the fit hydrograph vy minimum 
Can i do that Automatically therefor a can enter this 10 results and compare them wtith python , and python give me the best reults 

Thanks in advance



Am Freitag, 21. April 2017 16:29:43 UTC+2 schrieb Aziz Hassan:

John Hedengren

unread,
May 18, 2017, 12:17:33 AM5/18/17
to APM Google Groups
Aziz,

You'll need to identify parameters that you can adjust to fit the simulation results to the observation hydrograph. You can minimize the sum of squared errors (SSE) or the mean square error (MSE). Both should give you the same answer because you are just scaling the objective function by the number of samples. You should be able to do this optimization with Python. Here are two methods for solving optimization problems with Python (Scipy.optimize.minimize and APM Python): http://apmonitor.com/che263/index.php/Main/PythonOptimization  I recommend that you go through these tutorials and others before you try to apply it to your problem.

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+unsubscribe@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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages