Multiply and integrate two plots for single output value

조회 수: 2 (최근 30일)
Ben Bawtree
Ben Bawtree 2023년 3월 27일
답변: Peter Perkins 2023년 3월 27일
Below is illustrated the code used to compute functions, with a comment at the bottom summarising the aim. To obtain a single value for annual energy output from two plots.
%% Clear Workspace
clc; clear all; clear;
% Define Parameters
K_0 = 3149/1080;
K_1 = 469/1080;
T_1 = 12.4/24; %hours
T_0 = 353/24; %hours
% Define Timestep
ts_min = 2; %mins
ts_hours = ts_min/60;
ts_days = ts_hours/24;
ts_years = ts_days/365;
start_val = 0; % days
end_val = 365; % days
nElements = 1/ts_years; % intervals in a year
ts = linspace(start_val, end_val, nElements); % create timestep array
% Define Harmonic Analysis
V = (K_0 + K_1.*cos((2.*pi.*ts)/T_1)).*cos((2.*pi.*ts)/T_0);
V2 = V.^2;
Vnorm = sqrt(V2);
plot(ts,Vnorm);
grid on;
% Plot Histogram of Wind Velocity Frequencies
hist(Vnorm);
grid on;
%% Tidal Power Curves for 4m and 6.5m from Excel
PowerTable = readtable('TidalData.xlsx','Sheet','Sheet1');
x4 = PowerTable.Header1; % Flow Speed [m/s] at 4m turbine
y4 = PowerTable.Header2; % Electrical Power [kW] at 4m turbine
x63 = PowerTable.Header3; %: Flow Speed [m/s] at 6.3m turbine
y63 = PowerTable.Header4; %: Electrical Power [kW] at 6.3m turbine
figure;
plot(x4,y4,'DisplayName','4m');
hold on;
grid on;
plot(x63,y63,'DisplayName','6.3m');
hold off;
legend
%% Multiplication Calculation power curve by yearly quantity
% aim to multiply plot(x4,y4)- flow speed (m/s) vs. electrical power (kW),
% by hist(Vnorm)- flow speed (m/s) vs. annual number of hours, to get the total annual
% electrical power kWh in a year..
  댓글 수: 4
Mathieu NOE
Mathieu NOE 2023년 3월 27일
hello
first comment, you did not provide the excel file needed to run your code
second comment, why would we need the histogram distribution if you know the velocity all year long and you know the turbine power output vs velocity.
Combining both data will give you the power output every time increment (hour ?) of the year. and the end you just have to sum all those numbers to have the total kWh in one year.
Ben Bawtree
Ben Bawtree 2023년 3월 27일
Understood thank you, will attempt this.

댓글을 달려면 로그인하십시오.

답변 (1개)

Peter Perkins
Peter Perkins 2023년 3월 27일
Any time the number 365 appears in code, thatr's probably a bug.
You might try to use datetimes and durations in your code, including the plot.

카테고리

Help CenterFile Exchange에서 Geology에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by