Orcaflex simulation in Matlab - How to change variables automatically until results are satisfied?

19 次查看(过去 30 天)
This is my code. It's an interface between Matlab and Orcaflex software.
model = ofxModel('Model2.sim'); % Existing model in Orcaflex
% Create a new Line
line = model.CreateObject(ofx.otLine,'Line2');
line.EndAConnection = 'FPSO'; % Connect the Line top end to the Vessel
line.EndBConnection = 'Anchored'; % anchor the Line bottom end
% Set the Line end positions
line.EndAX = 36.0;
line.EndAY = 1.732;
line.EndAZ = -7.5;
line.EndBX = 900.0;
line.EndBY = 1.732;
line.EndBZ = 0.178;
% Set the section lengths
linetype = model('Flexible riser');
line.Length(1) = L(1);
line.Length(2) = L(2);
line.Length(3) = L(3);
%Save data and run simulation
model.SaveData('Model3.dat');
model.CalculateStatics;
model.RunSimulation;
model.SaveSimulation('Model3.sim')
RangeGraphResults = line.RangeGraph('Max von Mises Stress');
max_values1 = RangeGraphResults.Max;
RangeGraphResults = line.RangeGraph('Effective tension');
max_values2 = RangeGraphResults.Max;
% Effective tension
b = max(max_values2')
% Allowable tension
maxVal = 4329e3;
% Check if condition is met
if (b <= maxVal)
disp('Value within specified range.')
elseif (b > maxVal)
disp('Value exceeds maximum value.')
end
My question: Is it possible to re-run this simulation with different values of L(1), L(2) and L(3) until the condition is met automatically, where 875<L(1)<925, 165<L(2)<330 and 280<L(3)<380? Or at least change one variable?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Stress and Strain 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by