[Wave modeling 2] 3D wave modeling and wave generator modeling matlab simulation

1. Software version

matlab2017b

2. Core source code

function func_power_gen_machine(HHup,R_buoy,seepart,seeall);


if seepart == 0 & seeall == 1
    %先产生固定部分
    %第一:海底的圆柱体
    t  = 0:pi/20:2*pi;
    RR =  100;
    HH = -6.5;
    x= 600+RR*sin(t);
    y= 300+RR*cos(t)/2;
    z=linspace(-8,HH,length(t));
    X=meshgrid(x);
    Y=meshgrid(y);
    Z=[meshgrid(z)]';
    surf(X,Y,Z);
    xlabel('x'),ylabel('y'),zlabel('z')
    shading interp;
    colormap([255/255,100/255,103/255]);
    hold on
    clear X Y Z


    %第二:上半部分的柱体
    t  = 0:pi/20:2*pi;
    RR2 = 60;
    HH2 = -6;
    x= 600+RR2*sin(t);
    y= 300+RR2*cos(t)/2;
    z=linspace(-8,HH2,length(t));
    X=meshgrid(x);
    Y=meshgrid(y);
    Z=[meshgrid(z)]';
    surf(X,Y,Z);
    xlabel('x'),ylabel('y'),zlabel('z')
    shading interp;
    colormap([255/255,100/255,103/255]);
    hold on
    clear X Y Z

    %第三:线圈
    HH3 = -8:0.5:-3;
    for i = 1:floor(length(HH3)/2)
        t  = 0:pi/20:2*pi;
        RR3 = 10;

        x= 600+RR3*sin(t);
        y= 300+RR3*cos(t)/2;
        z=linspace(HH3(2*i-1),HH3(2*i),length(t));
        X=meshgrid(x);
        Y=meshgrid(y);
        Z=[meshgrid(z)]';
        plot3(X,Y,Z,'b');
        xlabel('x'),ylabel('y'),zlabel('z')
        shading interp;
        colormap([255/255,100/255,103/255]);
        hold on;
    end

    alpha(0.5);
    clear X Y Z


    HHup = HHup + 0.1;
    %第四:滑动活塞
    t  = 0:pi/20:2*pi;
    RR2  = 15;
    x= 600+RR2*sin(t);
    y= 300+RR2*cos(t)/2;

    z=linspace(-6+HHup,-5+HHup,length(t));
    X=meshgrid(x);
    Y=meshgrid(y);
    Z=[meshgrid(z)]';
    surf(X,Y,Z);
    xlabel('x'),ylabel('y'),zlabel('z')
    shading interp;
    colormap([255/255,100/255,103/255]);
    hold on
    alpha(0.5);
    clear X Y Z

    %第五:连接引线
    t  = 0:pi/20:2*pi;
    RR2  = 0.01;
    x= 600+RR2*sin(t);
    y= 300+RR2*cos(t)/2;

    z=linspace(-5+HHup,0+HHup,length(t));
    X=meshgrid(x);
    Y=meshgrid(y);
    Z=[meshgrid(z)]';
    plot3(X,Y,Z,'k');
    xlabel('x'),ylabel('y'),zlabel('z')
    shading interp;
    colormap([255/255,100/255,103/255]);
    hold on
    alpha(0.5);
    clear X Y Z

    %第六:水面浮标,球形
    t=linspace(0,pi,25);
    p=linspace(0,2*pi,25);
    [theta,phi]=meshgrid(t,p);
    x= 600+R_buoy*sin(theta).*sin(phi);
    y= 300+R_buoy*sin(theta).*cos(phi)/2;
    z=R_buoy*cos(theta)/28 + HHup;
    surf(x,y,z);
    shading interp;
    colormap([255/255,100/255,103/255]);
    hold on
    alpha(0.5);

    alpha(0.5);
end 


if seepart == 1 & seeall == 0
    %第六:水面浮标,球形
    t=linspace(0,pi,25);
    p=linspace(0,2*pi,25);
    [theta,phi]=meshgrid(t,p);
    x= 600+R_buoy*sin(theta).*sin(phi);
    y= 300+R_buoy*sin(theta).*cos(phi)/2;
    z=R_buoy*cos(theta)/28 + HHup;
    surf(x,y,z);
    shading interp;
    colormap([255/255,100/255,103/255]);
    hold on
    alpha(0.5);

    alpha(0.5);
end 

3. Test results

On the basis of the previous results [Wave Modeling 1] , the dynamic effect of the wave generator is added, and the power generation is simply calculated. According to the design requirements, after the entire generator, the simulation effect is as follows:

       It can be seen from here that the control interface has been adjusted and three buttons have been added. Among them, part_View is the dynamic effect of the sea buoy, All_View is the dynamic effect of the entire generator, and Close the power mach is the dynamic effect of closing the generator. , only shows the effect of waves, and electricity is the effect of showing the amount of electricity generated. The simulation results of the whole system are as follows:

Initial wave modeling:

Click the Part_View button:

Adjust the viewing angle slider, the effect is as follows:

Click the All_View button:

Adjust the viewing angle slider, the effect is as follows:

Click the Close the power Mach button:

A19-07

Guess you like

Origin blog.csdn.net/ccsss22/article/details/125610732