Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Optimizaztion

Subject: Optimizaztion

From: pietro

Date: 15 Apr, 2014 07:27:11

Message: 1 of 2

Hi all,

I need to perform an optimazation of a simscape valve model where I have to fit the step response and the hysteresis of the valve. So I wrote the objective function where two simulations are run and the two values are computed. From these the SSE are computed and it must be minimized.

One of the design variable is the maximum valve displacement (MaxDisp in the following matlab code) and both the hysteresis and the step response are strongly dependent by MaxDisp. As example the hystereris is expressed in percentage of MaxDisp (e. g. 0.4% of MaxDisp). So during the optimization, anytime the solver changes MaxDisp and therefore the target value is changed as well. Here the code.


f=myfun(x,RefData)
...

SpoolDispRes=spline(SpoolDisp.Time,SpoolDisp.Data,t);
        MoveUp=SpoolDispRes(t>0.75 & t<=1.25);
        MoveDown=fliplr(SpoolDispRes(t>0.25 & t<=0.75));
        Hyst=max(abs(MoveUp-MoveDown))/MaxDisp*100;
        fi(1)=((Hyst-RefData{1})/RefData{1}).^2;
...

StepResponse=stepinfo(SpoolDisp.Data,SpoolDisp.Time,MaxDisp,'SettlingTimeThreshold',13/100);

fi(2)=((StepResponse.SettlingTime-0.5-RefData{2})).^2;

f=sum(fi);

end

Unfortunately the solver (fmincon) gets stucks and I believe it is due to the fact the target values is dependent by the displacement. I tried also to fit only the hysteresis or the step response, but also in this way the solver gets stucks. I thinks the problem can be solved writing the objective function in a different way, but I don't know how. Does anyone have any idea to write it in a different way so the solver will not get stuck? I'm quite sure this is the problems because beside this I have to fit the valve steady response and this target value is costant during the simulation and the solver has quickly converged.

Thanks

Cheers

Pietro

Subject: Optimizaztion

From: Alan_Weiss

Date: 18 Apr, 2014 12:30:05

Message: 2 of 2

On 4/15/2014 3:27 AM, pietro wrote:
> Hi all,
> I need to perform an optimazation of a simscape valve model where I
> have to fit the step response and the hysteresis of the valve. So I
> wrote the objective function where two simulations are run and the two
> values are computed. From these the SSE are computed and it must be
> minimized.
> One of the design variable is the maximum valve displacement (MaxDisp
> in the following matlab code) and both the hysteresis and the step
> response are strongly dependent by MaxDisp. As example the hystereris
> is expressed in percentage of MaxDisp (e. g. 0.4% of MaxDisp). So
> during the optimization, anytime the solver changes MaxDisp and
> therefore the target value is changed as well. Here the code.
>
>
> f=myfun(x,RefData)
> ...
>
> SpoolDispRes=spline(SpoolDisp.Time,SpoolDisp.Data,t);
> MoveUp=SpoolDispRes(t>0.75 & t<=1.25);
> MoveDown=fliplr(SpoolDispRes(t>0.25 & t<=0.75));
> Hyst=max(abs(MoveUp-MoveDown))/MaxDisp*100;
> fi(1)=((Hyst-RefData{1})/RefData{1}).^2;
> ...
>
> StepResponse=stepinfo(SpoolDisp.Data,SpoolDisp.Time,MaxDisp,'SettlingTimeThreshold',13/100);
>
> fi(2)=((StepResponse.SettlingTime-0.5-RefData{2})).^2;
>
> f=sum(fi);
>
> end
>
> Unfortunately the solver (fmincon) gets stucks and I believe it is due
> to the fact the target values is dependent by the displacement. I
> tried also to fit only the hysteresis or the step response, but also
> in this way the solver gets stucks. I thinks the problem can be solved
> writing the objective function in a different way, but I don't know
> how. Does anyone have any idea to write it in a different way so the
> solver will not get stuck? I'm quite sure this is the problems because
> beside this I have to fit the valve steady response and this target
> value is costant during the simulation and the solver has quickly
> converged.
>
> Thanks
>
> Cheers
>
> Pietro

I do not really understand what you are doing, or what "gets stuck"
means. But perhaps this section of the documentation will be of some use:
http://www.mathworks.com/help/optim/ug/optimizing-a-simulation-or-ordinary-differential-equation.html

In particular, I suggest that you look at problems with finite
differences, and the suggestions.

Alan Weiss
MATLAB mathematical toolbox documentation

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us