Optimizing using fmincon in a "discrete" way

조회 수: 7 (최근 30일)
Julio Maximiliano Ramirez Oyanarte
편집: Bruno Luong 2023년 9월 4일
I am modelling a battery and interested in finding the best current that maximizes the energy output, using fmincon. I will summarize the idea:
  1. The battery is a system of differential-algebraic equations, so we employ ode15s.
  2. The cell potential will be obtained upon solving the DAE's, and this value is a subtraction of the integrated variables. Say it is y(20) - y(19) (the cathode minus the anode).
  3. We integrate the cell potential across the capacity, the capacity being "time multiplied by the current", so that the energy is trapz(t.*I, y(:, 20) - y(:, 19)).
  4. One of the restrictions in fmincon is that the time for the discharge doesn't exceed some limit. Thus, we would have something like t(end) = 10 in the ceq vector in nonlcon within fmincon.
The system can be solved only if we give a value to the electric current I. The most direct way is a constant discharge, so we just give ode15s some constant value of I. Another way can be to set up a function of the current, say I(t) = a*cos(t) + b*t. This function doesn't make sense, but anyways, fmincon will vary the parameters a and b in order to maximize the energy given by the said integral.
However, my question is the following. Lets say I don't want to set any time-dependent function for the current I(t). I would like to maximize the energy with a current that is an array of numbers. So, at the times given at tspan, we would have a different value I. Thus, we would have obtained the "optimal values" for the current at every instant of time, that maximizes the integral. In other words, instead of obtaining a set of parameters with fmincon, its output would be a vector of I = [I(t = 0), I(t = t1), ..., I(t = end)].
Is it possible to implement this? Maybe fmincon is not the correct way to do this, and there is other path, which of course I am interested in knowing. Thanks in advance

답변 (1개)

Bruno Luong
Bruno Luong 2023년 9월 4일
편집: Bruno Luong 2023년 9월 4일
There is no problem for fmincon to optimize "discrete" variables as long as you can simuate the model with it, meaning you can solve your ode15s by mean of interpolation of I so as it is available at all t.
I put "discrete" in quote because usualy discrete means the variable can only take discrete values. In your case I(t0), ...I(tend) are continuous but you have a finite disretization of the continuous signal (value). So it perfectly fine for fmincon.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by