How to run ansys workbench through system() syntax?
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone, I have a code that runs the ansys workbench and then a journal file to do my study of a heat exchanger optimization.
As you can see, it starts ansys workbench at every loop and then does the calculations, which wastes a lot of time.
I would like to know if there is a way to start the software before the loop and then run the journal file every time which can save me a lot more time in my optimization process. the problem is at the third segment of the code below.
I really appreciate your time and help in advance.
Here is the code.
clc; clear;
London_CF = zeros(1,2);
for i=1:2
%% Changing the input parameters
% inputs of y = Amplitude*sin(2*pi*x/Length)
Length = [8 8];
Angle = [20 30];
Amplitude = [1 1];
% creating new journal file
fid = fopen('BaseJournal.wbjn','r');
f = fread(fid,'*char')';
fclose(fid);
f = strrep(f,'Length' , num2str(Length(i)));
f = strrep(f,'Angle' , num2str(Angle(i)));
f = strrep(f,'Amplitude' , num2str(Amplitude(i)));
fid = fopen('finalJournal.wbjn','w');
fprintf(fid,'%s',f);
fclose(fid);
%% Calculations in ansys with input parameters
system('C:\"Program Files"\"ANSYS Inc"\v212\Framework\bin\Win64\RunWB2.exe -X -R finalJournal.wbjn');
%% saving the output parameter
London_CF(i) = xlsread('export data.csv','export data','G8');
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!