optimizing the steady state temperature of an MSMPR

3 ビュー (過去 30 日間)
Timothy Campbell
Timothy Campbell 2020 年 12 月 15 日
コメント済み: Timothy Campbell 2020 年 12 月 15 日
Hi I'm a Chemical Engineering PhD student and I'm struggling with solving this problem.
The problem posed is to set the steady state temperature (temperature doesnt change with time) of the MSMPR (Mixed suspension mixed product removal). For a bit of background; it's a type of crystallisation process used in pharmaceutical processing.
Currently my code optimizes the temperature for each of the individual time steps of the dx/dt equations. As a result the temperature goes all over the place with respect to time.
I'm trying to get the code to optimize the size of crystals at the end of the process (@t=400) through altering the steady state temperature of the process.
the iteration process is as follows. there are other sacripts necessary to run the process however I have included the main bits of the iteration.
many thanks in advance.
TC
_________________________________________________________________________________
function [f] = TempOptMSMPR_AvgCrystSize(x)
%Initial conditions
mui = 0;
Ci = 1; %kg/kgwater
x0 = [mui mui mui mui Ci];
tspan = [0, 400];
G = [];
for i=1:1:22; %XXX
T = x(i);
sol = ode45(@TempOptMSMPR_Mod, tspan, x0, [], T);
x0 = sol.y(:,end);
G = [G,sol.y(:,end)];
T=T-1;
end
%maximising Growth
f = G;
end
_________________________________________________________________________________
clear
close all
clc
%% Bounds
x0 = [315];
lb = 293*ones(1,22); %XXXX
ub = 315*ones(1,22); %XXXX
nvars = 22; %difference between ub and lb constraints.
opts = optimoptions('fmincon','OptimalityTolerance',1e-10);
options = optimoptions('ga','PlotFcn', @gaplotbestf, 'Display', 'iter','Generations', 50, 'PopulationSize', 100);
fitfun = @TempOptMSMPR_Fitfun;
[x,fval] = ga(fitfun,nvars,[],[],[],[],lb,ub,[],options);

回答 (1 件)

Hiro Yoshino
Hiro Yoshino 2020 年 12 月 15 日
I am not fully following your code but if you are using MATLAB R2020b (the latest), you should have "Task" in live editor.
From Task, you'll find the one for optimization, which surely helps you work on the optimization.
Actually there are two approaches for optimization in MATLAB:
  1. solver based
  2. problem based
I suppose what you used was (1) which is more difficult than (2) and you can easily set things up from TASK that uses (2) method.
  1 件のコメント
Timothy Campbell
Timothy Campbell 2020 年 12 月 15 日
Many thanks, I shall try and give this a go.
TC

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAgriculture についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by