[Wave modeling 3] 3D random real ocean wave modeling and wave generator modeling matlab simulation

1. Software version

matlab2017b

2. Algorithm overview

According to the mode of the last wave simulation [ Wave Modeling 1 ] [ Wave Modeling 2 ], this time the waves are changed from the previous regular waves to random waves to simulate real waves.

Then the two generators are simulated in the irregular waves respectively.

Generator mode 1 was just done before, and the technician should have a backup.

Generator mode 2 is as shown below:

 

       As shown in the figure), energy converters are installed in each of the four circular tubes. The picture is the overall appearance of the equipment. With the movement of the sea wave, the energy converter is driven to move to generate electricity. The entire device floats in the sea.

3. Core source code

global Winds;   %风速
global g; %重力加速度
global kk; %仿真模型沙盘和实际区域的大小比例
global Xmax;
global Ymax;
global Dxy;
global flag;
global VX;
global VY;
global VZ;
global seepart;
global seeall;
global sel;

RandStream.setDefaultStream(RandStream('mt19937ar','seed',3));

flag = 0;

g    = 9.8; %重力加速度
kk   = 1/40; %仿真模型沙盘和实际区域的大小比例
%仿真的间隔
Dxy  = 4;


%仿真覆盖的海域范围
Xmax = 1000;
Ymax = 1000;

Start  = 200;
x      = [Start:Dxy:Xmax];
Ymax2  = round(Ymax/2);
y      = [Start:Dxy:Ymax2];
[xo,yo]= meshgrid(x,y);
z2     = zeros(size(x));

%海浪自身运动的波高
r = (3.5325*Winds^2.5)/1000;

%海浪自身运动的波长
k = 2*g/(3*Winds^2);
L = 2*pi/k;

%周期T
T = sqrt(2*pi*L/g);

%波频率
w = sqrt(2/3)*g/T;
T = 0;

%发电量
Power = 0;
amps  = 0;


while(flag == 0)
    T = T + 1;    
    
    PP = floor(6*(Winds - 5.8));%1~90
    
    [d,g,H,alpha,beta,waves,wave_no_lookup,angle_lookup,scales] = func_Random_Ocean_Initial(PP);
    
 
    t = 0.1*T;
    surfo = zeros(scales,scales);
    for X=1:scales
        x        = X-1;
        xplot(X) = x;
        for Y=1:scales
            y        = Y-1;
            yplot(Y) = y;
            for i=1:PP
                surfo(X,Y) = surfo(X,Y) + waves(i).amp*cos( waves(i).xcoeff*x + waves(i).ycoeff*y + waves(i).w*t + waves(i).phase);
            end
        end
    end    

    %显示局部效果
    axes(handles.axes1);
    
    surf(xplot,yplot,surfo);
    
    hold on;
    

    amps = surfo(50,50);
    if sel == 1
       func_power_gen_machine_randomOcean(amps,1.6,seepart,seeall);
    else
       func_power_gen_machine2_randomOcean(amps,1.6,seepart,seeall); 
    end
 
    
    axis([0,scales,0,scales,-H,H]);
    shading interp;
    colormap([143/255,157/255,203/255]);
    lightangle(-30,90);    
    xlabel('x');
    ylabel('y');
    zlabel('z');
    grid on;
    

    view([VX,VY,VZ]);
    pause(0.000001);    
    
    %海浪自身运动的波长
    k = 2*g/(3*Winds^2);
    Ls = 2*pi/k;
    set(handles.edit1,'String',num2str(Ls));
    
    %计算得到海浪的参数指标
    %海浪自身运动的波高
    rs = (3.5325*Winds^2.5)/1000;
    set(handles.edit3,'String',num2str(rs));
    
    %周期T
    T = sqrt(2*pi*L/g);
    %速度
    c = g*T/(2*pi); 
    set(handles.edit4,'String',num2str(c)); 
    
    %波频率
    w = sqrt(2/3)*g/T;    
    set(handles.edit5,'String',num2str(w/2/pi));
    
    %发电量
    %注意,由于海浪发电的具体的计算公式,你没有提供,所以这里发电量仅仅使用简单的海浪的大小来表示,
    %实际中,发电量就是和海浪大小相关的。所以在得到公式之后,修改210行代码即可。
    Power = abs(2*max(surfo(1,:)));   
    set(handles.edit12,'String',num2str(Power));    
    hold off;
end

4. Test results

Through the modeling of this new model and the combination of the previous effect, the interface of the software obtained this time is as follows:

As can be seen from the above interface, there is a choose power mach button in the original interface. The main function of this button is to select the buttons of different generators.

The following screenshots and description analysis of the entire simulation process:

Next, click the button that was newly put in, select a different generator, and get the following results:

Click again to get the following interface:

The following is an introduction to the side of this newly put power generation model:

A19-08

Guess you like

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