飞码网-免费源码博客分享网站

点击这里给我发消息

从Matlab中以批量模式运行CSI Sap 2000以寻找自然频率的简单代码|-Matlab

文件名称-飞码网: 从Matlab中以批量模式运行CSI Sap 2000以寻找自然频率的简单代码
文件类型-飞码网: 压缩包
文件大小-飞码网: 4.64 KB
作 者-飞码网: 其实我很介意
下载点数-飞码网: 0
下载权限-飞码网: 普通会员
整理时间-飞码网: 2021-04-18 18:46:47
文件说明-飞码网:

%################################################ ########################%%
PROGRAMMER:MOHAMED SAJEER IBN AZAD MODAVAN#
%%#日期:03.09.2013(最后修改时间:01:12 :2015)#%%
#摘要:此代码用于从Matlab运行SAP2000以查找#
%%#自然频率。该代码可以帮助您调整#%%
#材料属性,以使
模型的固有频率#%%#与固有频率的实际值相匹配%#
%#您还可以将优化工具与此代码结合使用,以#
%%#查找最佳的设计属性。
%%#=============================================== ==========================#%%
#可能需要修改#
%%#============== ================================================== ========#%
%#*在第31行中修改SAP2000的版本号#%%
#*在第40行中修改此文件路径所需的代码#
%%#*在第57和58行中,根据您的模型更改材料名称#
%%# *您可以#
%#########################################################################%
clear; clc; close all
% Material Properties
Eco = 20e6; % Modulus of Elasticity of Concrete
Est = 21e7; % Modulus of Elasticity of Steel
nu_c = 0.2; % Poisson's Ratio of Concrete
nu_s = 0.3; % Poisson's Ratio of Steel
% Pass data to Sap2000 as one-dimensional arrays
feature('COM_SafeArraySingleDim', 1);
% Pass non-scalar arrays to Sap2000 API by reference
feature('COM_PassSafeArrayByRef', 1);
% Create Sap2000 object
SapObject = actxserver('sap2000v15.SapObject'); % Version of Sap2000
% Start Sap2000 application
SapObject.ApplicationStart;
% Hide Application, Hide <=> Unhide
SapObject.Hide;
% Create SapModel object
Sap = SapObject.SapModel;
%%
% Open existing file
FilePath = 'D:\Frame'; % Location of Sap2000 Model
Sap.File.OpenFile([FilePath,'.sdb']);
%%
% Edit Model
% ----------
% Model lock =>(1)or unlock =>(0)
Sap.SetModelIsLocked(0);

% Switch to units
% lb_in_F = 01 lb_ft_F = 02 kip_in_F = 03 kip_ft_F = 04
% kN_mm_C = 05 kN_m_C = 06 kgf_mm_C = 07 kgf_m_C = 08
% N_mm_C = 09 N_m_C = 10 Ton_mm_C = 11 Ton_m_C = 12
% kN_cm_C = 13 kgf_cm_C = 14 N_cm_C = 15 Ton_cm_C = 16
Unit = 06;
Sap.SetPresentUnits(Unit);

% Assign isotropic mechanical properties
Sap.PropMaterial.SetMPIsotropic('Concrete', Eco, nu_c, 1.170E-05);
Sap.PropMaterial.SetMPIsotropic('Steel', Est, nu_s, 1.170E-05);

% Run model (this will create the analysis model)
Sap.Analyze.RunAnalysis();
% Set run case model
% Sap.Analyze.SetRunCaseFlag('MODAL', 1);
%%
% Results
% -------
% Count number of joints & DOF
countP = Sap.PointElm.Count;
DOF = countP*3-12;
disp('DEGREE OF FREEDOM');disp(DOF)

% Frequency
AA = fopen([FilePath,'.LOG'],'r');
Fr1 = fread(AA);
s = char(Fr1');
fclose(AA);
word1Location = strfind(s, 'NUMBER OF EIGEN MODES FOUND');
word2Location = strfind(s, 'NUMBER OF ITERATIONS PERFORMED');
TextLine = s(word1Location:word2Location-1);
Number_Modes = str2double(TextLine(54:end));
disp('NUMBER OF EIGEN MODES');disp(Number_Modes)
Frq = zeros(Number_Modes,1);
for ii = 1:Number_Modes
if ii == Number_Modes
word1Location = strfind(s, ['Found mode ' num2str(ii)]);
word2Location = strfind(s, 'NUMBER OF EIGEN MODES FOUND');
elseif ii < 9
word1Location = strfind(s, ['Found mode ' num2str(ii)]);
word2Location = strfind(s, ['Found mode ' num2str(ii+1)]);
elseif ii == 9
word1Location = strfind(s, ['Found mode ' num2str(ii)]);
word2Location = strfind(s, ['Found mode ' num2str(ii+1)]);
elseif (ii>9) && (ii~=Number_Modes)
word1Location = strfind(s, ['Found mode ' num2str(ii)]);
word2Location = strfind(s, ['Found mode ' num2str(ii+1)]);
end
Mode = s(word1Location:word2Location-1);
word1Location = strfind(Mode, 'f=');
word2Location = strfind(Mode, ', T= ');
Fre = Mode(word1Location:word2Location-1);
Freq = str2double(Fre(3:14));
Frq(ii,:) = Freq;
end
disp('FREQUENCY IN Hz');disp(Frq)
%%
% save model
Sap.File.Save([FilePath,'.sdb']);
%%
% close Sap2000
SapObject.ApplicationExit(false());
SapModel = 0;
SapObject = 0;

下载地址-飞码网: [ 下载地址1 ]
提 取 码-飞码网:
下载说明-飞码网: ⊙本网站所有资料都是由飞码网或其它作者上传,若资料造成侵权,请联系我们删除。
⊙如果文件出现下载问题,或链接失效,请在评论区反馈或者直接联系我们!
⊙如果下载网页缓冲慢,可能是网页浏览量比较大,请稍后再试!
⊙如果遇到积分扣除错误或其它问题,请直接点击qq图标联系我们!
⊙本站所提供的资料均由飞码网在网络上收集作为学习用途,请勿商用!
赞 ()

相关推荐

内容页底部广告位3
留言与评论(共有 0 条评论)
   
验证码: