masteresearch
Civil/Environmental
- Dec 11, 2016
- 1
Hi all,
I am new in OAPI SAP2000 to Matlab interface and would like to ask you if possible to help me on a loop. I want to assign different properties to an orthotropic material (shell element) several times and run analysis after each new assignment. I am able to open the file, run the analysis and get the displacement at top of the wall for one case, but when I want to do this several time in aims to do a parametric study, I failed. Could you please help me ?
this is my code, just after opening the sap file :
%% define material property
PropMaterial = NET.explicitCast(SapModel.PropMaterial,'SAP2000v18.cPropMaterial');
%% initialize new material property
% ret = PropMaterial.SetMaterial('CONC', SAP2000v18.eMatType.Concrete);
%% assign orthotropic mechanical properties to material
E = NET.createArray('System.Double',5);
U = NET.createArray('System.Double',5);
A = NET.createArray('System.Double',5);
G = NET.createArray('System.Double',5);
for i = 1 : 5
prop=xlsread('material_property.xlsx');
E(0)=prop(2:end,2);
E(1)=prop(2:end,3);
E(2)=prop(2:end,4);
U(0)=prop(2:end,5);
U(1)=prop(2:end,6);
U(2)=prop(2:end,7);
A(0)=prop(2:end,8);
A(1)=prop(2:end,9);
A(2)=prop(2:end,10);
G(0)=prop(2:end,11);
G(1)=prop(2:end,12);
G(2)=prop(2:end,13);
[ret, E, U, A, G] = PropMaterial.SetMPOrthotropic('140 5s c24', E, U, A, G);
%% run model (this will create the analysis model)
Analyze = NET.explicitCast(SapModel.Analyze,'SAP2000v18.cAnalyze');
ret = Analyze.RunAnalysis();
%% initialize for Sap2000 results
SapResult = zeros(5,1,'double');
%% get Sap2000 results for load case 1
AnalysisResults = NET.explicitCast(SapModel.Results,'SAP2000v18.cAnalysisResults');
AnalysisResultsSetup = NET.explicitCast(AnalysisResults.Setup,'SAP2000v18.cAnalysisResultsSetup');
NumberResults = 0;
Obj = NET.createArray('System.String',4);
Elm = NET.createArray('System.String',4);
ACase = NET.createArray('System.String',4);
StepType = NET.createArray('System.String',4);
StepNum = NET.createArray('System.Double',4);
U1 = NET.createArray('System.Double',4);
U2 = NET.createArray('System.Double',4);
U3 = NET.createArray('System.Double',4);
R1 = NET.createArray('System.Double',4);
R2 = NET.createArray('System.Double',4);
R3 = NET.createArray('System.Double',4);
ret = AnalysisResultsSetup.DeselectAllCasesAndCombosForOutput;
ret = AnalysisResultsSetup.SetCaseSelectedForOutput('Carico oriz unif');
[ret, NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3] = AnalysisResults.JointDispl('1063', SAP2000v18.eItemTypeElm.ObjectElm, NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3);
SapResult(1) = U1(1);
end
Thanks in advance.
I am new in OAPI SAP2000 to Matlab interface and would like to ask you if possible to help me on a loop. I want to assign different properties to an orthotropic material (shell element) several times and run analysis after each new assignment. I am able to open the file, run the analysis and get the displacement at top of the wall for one case, but when I want to do this several time in aims to do a parametric study, I failed. Could you please help me ?
this is my code, just after opening the sap file :
%% define material property
PropMaterial = NET.explicitCast(SapModel.PropMaterial,'SAP2000v18.cPropMaterial');
%% initialize new material property
% ret = PropMaterial.SetMaterial('CONC', SAP2000v18.eMatType.Concrete);
%% assign orthotropic mechanical properties to material
E = NET.createArray('System.Double',5);
U = NET.createArray('System.Double',5);
A = NET.createArray('System.Double',5);
G = NET.createArray('System.Double',5);
for i = 1 : 5
prop=xlsread('material_property.xlsx');
E(0)=prop(2:end,2);
E(1)=prop(2:end,3);
E(2)=prop(2:end,4);
U(0)=prop(2:end,5);
U(1)=prop(2:end,6);
U(2)=prop(2:end,7);
A(0)=prop(2:end,8);
A(1)=prop(2:end,9);
A(2)=prop(2:end,10);
G(0)=prop(2:end,11);
G(1)=prop(2:end,12);
G(2)=prop(2:end,13);
[ret, E, U, A, G] = PropMaterial.SetMPOrthotropic('140 5s c24', E, U, A, G);
%% run model (this will create the analysis model)
Analyze = NET.explicitCast(SapModel.Analyze,'SAP2000v18.cAnalyze');
ret = Analyze.RunAnalysis();
%% initialize for Sap2000 results
SapResult = zeros(5,1,'double');
%% get Sap2000 results for load case 1
AnalysisResults = NET.explicitCast(SapModel.Results,'SAP2000v18.cAnalysisResults');
AnalysisResultsSetup = NET.explicitCast(AnalysisResults.Setup,'SAP2000v18.cAnalysisResultsSetup');
NumberResults = 0;
Obj = NET.createArray('System.String',4);
Elm = NET.createArray('System.String',4);
ACase = NET.createArray('System.String',4);
StepType = NET.createArray('System.String',4);
StepNum = NET.createArray('System.Double',4);
U1 = NET.createArray('System.Double',4);
U2 = NET.createArray('System.Double',4);
U3 = NET.createArray('System.Double',4);
R1 = NET.createArray('System.Double',4);
R2 = NET.createArray('System.Double',4);
R3 = NET.createArray('System.Double',4);
ret = AnalysisResultsSetup.DeselectAllCasesAndCombosForOutput;
ret = AnalysisResultsSetup.SetCaseSelectedForOutput('Carico oriz unif');
[ret, NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3] = AnalysisResults.JointDispl('1063', SAP2000v18.eItemTypeElm.ObjectElm, NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3);
SapResult(1) = U1(1);
end
Thanks in advance.