阳光石油网|石油技术交流|石油人论坛

 找回密码
 欢迎注册
查看: 16669|回复: 15

运用MATLAB计算天然气工程中的水倾量

[复制链接]
  • TA的每日心情
    奋斗
    2017-11-3 11:16
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2017-11-3 12:00:00 | 显示全部楼层 |阅读模式

    马上注册,下载丰富资料,享用更多功能,让你轻松玩转阳光石油论坛。

    您需要 登录 才可以下载或查看,没有账号?欢迎注册

    x
    游客,如果您要查看本帖隐藏内容请回复

    [sell=5,2]function varargout = shuiqingliang(varargin)gui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @shuiqingliang_OpeningFcn, ...                   'gui_OutputFcn',  @shuiqingliang_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});end if nargout    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else    gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT  % --- Executes just before shuiqingliang is made visible.function shuiqingliang_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject    handle to figure% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% varargin   command line arguments to shuiqingliang (see VARARGIN) % Choose default command line output for shuiqinglianghandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes shuiqingliang wait for user response (see UIRESUME)% uiwait(handles.figure1);  % --- Outputs from this function are returned to the command line.function varargout = shuiqingliang_OutputFcn(hObject, eventdata, handles) % varargout  cell array for returning output args (see VARARGOUT);% hObject    handle to figure% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout{1} = handles.output;        function ctt_Callback(hObject, eventdata, handles)% hObject    handle to ctt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of ctt as text%        str2double(get(hObject,'String')) returns contents of ctt as a double  % --- Executes during object creation, after setting all properties.function ctt_CreateFcn(hObject, eventdata, handles)% hObject    handle to ctt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function miut_Callback(hObject, eventdata, handles)% hObject    handle to miut (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of miut as text%        str2double(get(hObject,'String')) returns contents of miut as a double  % --- Executes during object creation, after setting all properties.function miut_CreateFcn(hObject, eventdata, handles)% hObject    handle to miut (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function thetat_Callback(hObject, eventdata, handles)% hObject    handle to thetat (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of thetat as text%        str2double(get(hObject,'String')) returns contents of thetat as a double  % --- Executes during object creation, after setting all properties.function thetat_CreateFcn(hObject, eventdata, handles)% hObject    handle to thetat (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function kt_Callback(hObject, eventdata, handles)% hObject    handle to kt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of kt as text%        str2double(get(hObject,'String')) returns contents of kt as a double  % --- Executes during object creation, after setting all properties.function kt_CreateFcn(hObject, eventdata, handles)% hObject    handle to kt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function ht_Callback(hObject, eventdata, handles)% hObject    handle to ht (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of ht as text%        str2double(get(hObject,'String')) returns contents of ht as a double  % --- Executes during object creation, after setting all properties.function ht_CreateFcn(hObject, eventdata, handles)% hObject    handle to ht (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function rrt_Callback(hObject, eventdata, handles)% hObject    handle to rrt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of rrt as text%        str2double(get(hObject,'String')) returns contents of rrt as a double  % --- Executes during object creation, after setting all properties.function rrt_CreateFcn(hObject, eventdata, handles)% hObject    handle to rrt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function at_Callback(hObject, eventdata, handles)% hObject    handle to at (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of at as text%        str2double(get(hObject,'String')) returns contents of at as a double  % --- Executes during object creation, after setting all properties.function at_CreateFcn(hObject, eventdata, handles)background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function tt_Callback(hObject, eventdata, handles)% hObject    handle to tt (see GCBO)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function pt_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties.function pt_CreateFcn(hObject, eventdata, handles)% hObject    handle to pt (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end  % --- Executes on selection change in listbox1.function listbox1_Callback(hObject, eventdata, handles)% hObject    handle to listbox1 (see GCBO)  % --- Executes during object creation, after setting all properties.function listbox1_CreateFcn(hObject, eventdata, handles)% hObject    handle to listbox1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end function fetkovich_Callback(hObject, eventdata, handles)% hObject    handle to fetkovich (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes on selection change in listbox2.global h;global a;global td;global k;global t;global fai;global miu;global ct;global rr;global b;global p;global p1;global theta;global a;a=str2num(get(handles.at,'string'));ra=(a*360/(pi*theta))^0.5;wi=pi*(ra^2-rr^2)*h*fai*theta/360;wei=ct*p(1)*wi;j=2*pi*k*h*theta/(360*miu*(log(ra/rr)-0.75));for i=1:length(p)-1    dertat(i)=t(i+1)-t(i);  if i==1      paq(1)=p(1);      pr(i)=0.5*(p(i+1)+p(i));      dertawe(i)=wei/p(1)*(paq(i)-pr(i))*(1-exp(-j*p(1)*dertat(i)/wei));      we(i)=dertawe(i);  else      paq(i)=p(1)*(1-we(i-1)/wei);      pr(i)=0.5*(p(i+1)+p(i));      dertawe(i)=wei/p(1)*(paq(i)-pr(i))*(1-exp(-j*p(1)*dertat(i)/wei));      we(i)=we(i-1)+dertawe(i);  endend we1=we'; set(handles.listbox5,'string',num2str(we1));   % --- Executes on button press in tianjia2.function tianjia2_Callback(hObject, eventdata, handles)% hObject    handle to tianjia2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global p;p=str2num(get(handles.pt,'string'));p1=p';set(handles.listbox2,'string',num2str(p1)); % set(handles.listbox2,'string',[get(handles.listbox2,'string') ;num2str(p)]);  % --- Executes on button press in tianjia1.function tianjia1_Callback(hObject, eventdata, handles)% hObject    handle to tianjia1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global p;p=str2num(get(handles.pt,'string'));global p1;p1=p(2:end);global t;t=str2num(get(handles.tt,'string'));global fai;fai=str2num(get(handles.fait,'string'));global ct;ct=str2num(get(handles.ctt,'string'))*10^(-4);global miu;miu=str2num(get(handles.miut,'string'));global rr;rr=str2num(get(handles.rrt,'string'));global theta;theta=str2num(get(handles.thetat,'string'));global k;k=str2num(get(handles.kt,'string'));global h;h=str2num(get(handles.ht,'string'));global b;b=2*3.1415926*fai*ct*h*rr^2*theta/360;t1=t';set(handles.listbox1,'string',num2str(t1));    function listbox2_Callback(hObject, eventdata, handles)% hObject    handle to listbox2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns listbox2 contents as cell array%        contents{get(hObject,'Value')} returns selected item from listbox2  % --- Executes during object creation, after setting all properties.function listbox2_CreateFcn(hObject, eventdata, handles)% hObject    handle to listbox2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end  % --- Executes on button press in van.function van_Callback(hObject, eventdata, handles)% hObject    handle to van (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) global p;global p1;%&#188;&#198;&#203;&#227;dertapfor i= 1:length(p1)    if i<=2        dertap(i)=0.5*(p(1)-p1(i));    else        dertap(i)=0.5*(p1(i-2)-p1(i));    endendglobal td;global k;global t;global fai;global miu;global ct;global rr;global b;td=k*t/(fai*miu*ct*rr^2);%&#188;&#198;&#203;&#227;qpdqpd=(1.2838*td.^0.5+1.19328*td+0.269872*td.^0.667+0.00855294*td.^2)./(1+0.616599*td.^0.5+0.0413008*td);%&#188;&#198;&#203;&#227;wefor m=1:length(p1)    if m==1        we(1)=b*dertap(1)*qpd(2);    else        we(m)=0;        for j=1:m            dertawe(j)=b*dertap(j)*qpd(m+2-j);            we(m)=we(m)+ dertawe(j);        end    end   endwe1=we';set(handles.listbox3,'string',num2str(we1)); % --- Executes during object creation, after setting all properties.function listbox3_CreateFcn(hObject, eventdata, handles)ws.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end  % --- Executes during object creation, after setting all properties.function fait_CreateFcn(hObject, eventdata, handles)% hObject    handle to fait (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end   function fait_Callback(hObject, eventdata, handles)% hObject    handle to fait (see GCBO)  % --- Executes on button press in carter.function carter_Callback(hObject, eventdata, handles)% hObject    handle to carter (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global td;global k;global t;global fai;global miu;global ct;global rr;global b;global p;global p1;for i=2:length(p)  dertap(i-1)=p(1)-p(i);endpdtd=(370.529*td.^0.5+137.582*td+5.69549*td.^1.5)./(328.834+265.488*td.^0.5+45.2157*td+td.^1.5);pdtd1=(716.441+46.7984*td.^0.5+270.038*td+71.0098*td.^1.5)./(1296.86*td.^0.5+1204.73*td+618.618*td.^1.5+538.072*td.^2+142.41*td.^2.5);for i=1:length(td)    if i<=2        td1(i)=0;    else        td1(i)=td(i-1);    endendtd2=td-td1;for i=1:length(dertap)    if i==1        we(1)=td2(2)*(b*dertap(1))/pdtd(2);    else        we(i)=we(i-1)+td2(i+1)*(b*dertap(i)-we(i-1)*pdtd1(i+1))/(pdtd(i+1)-td(i)*pdtd1(i+1));    endendwe1=we';set(handles.listbox4,'string',num2str(we1));          % --- Executes on selection change in listbox4.function listbox4_Callback(hObject, eventdata, handles)  % --- Executes during object creation, after setting all properties.function listbox4_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end  % --- Executes on selection change in listbox5.function listbox5_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties.function listbox5_CreateFcn(hObject, eventdata, handles)% hObject    handle to listbox5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end[/sell]
  • TA的每日心情
    擦汗
    昨天 16:39
  • 签到天数: 455 天

    [LV.9]以坛为家II

    发表于 2017-11-3 12:22:51 | 显示全部楼层

    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    昨天 20:09
  • 签到天数: 1481 天

    [LV.10]以坛为家III

    发表于 2017-11-3 16:52:58 | 显示全部楼层
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2019-4-16 14:49
  • 签到天数: 439 天

    [LV.9]以坛为家II

    发表于 2017-11-3 19:47:20 | 显示全部楼层
    66666
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2019-4-20 08:52
  • 签到天数: 204 天

    [LV.7]常住居民III

    发表于 2017-11-3 20:28:19 | 显示全部楼层
    Thanks for the sharing!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2021-7-18 16:29
  • 签到天数: 1240 天

    [LV.10]以坛为家III

    发表于 2018-3-13 16:36:25 | 显示全部楼层
    感谢楼主
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    慵懒
    2018-4-12 09:58
  • 签到天数: 7 天

    [LV.3]偶尔看看II

    发表于 2018-3-27 09:21:08 | 显示全部楼层
    学习一下
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2019-7-5 22:02
  • 签到天数: 240 天

    [LV.8]以坛为家I

    发表于 2018-9-6 19:04:02 | 显示全部楼层
    学习学习

    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2021-7-18 16:29
  • 签到天数: 1240 天

    [LV.10]以坛为家III

    发表于 2019-1-9 20:22:50 | 显示全部楼层
    感谢楼主
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2019-12-30 14:24
  • 签到天数: 112 天

    [LV.6]常住居民II

    发表于 2019-3-7 09:40:27 | 显示全部楼层
    运用MATLAB计算天然气工程中的水倾量
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 欢迎注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|阳光石油网 ( 鲁ICP备2021003870号-1 )

    GMT+8, 2024-4-28 04:24 , Processed in 0.064512 second(s), 19 queries .

    Powered by Discuz! X3.4 Licensed

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表