Calculate power of each area

4 次查看(过去 30 天)
Tasneem Abed
Tasneem Abed 2023-7-30
编辑: DGM 2023-7-31
I want to calculate the power for each of the shapes in the picture.
Any help?!!
  4 个评论
Image Analyst
Image Analyst 2023-7-31
@DGM I still don't know what "." means. For example at around Timer=6 you have "Q2.Q3" -- what exactly does that mean? And the A1 shape has an area (if A means area) of "4500.Q2". What does that mean? Is the dot supposed to be a multiplication sign? And is the width of the A1 block Q2? If so Q2 would be 5, or since it's half way along, would it be 2.5? If the width is Q2 then the area (energy) would be about 950*Q2, not "4500.Q2" as it's marked.
So if Q2=5, then A1 = 650 Watts * 5 hours = 650 (joules/second) * 5 hours * 3600 (seconds/hour) = 11.7 million joules of energy. Anyway, he wanted power not energy so we just need the height of the shape. But it's unclear what the power of a shape means exactly when the shape is stacked on top of another shape, for example A16. Is the power of A16 5450 (the height from the time axis) OR is it 5450 - 3000 (which is just the height of the light blue A16 rectangle)?
And for "Q2.Q3" at around 6, does this mean that Q3 times Q2 equals 6???? Or is Q2 the integer part and Q3 the fractional part to the right of the decimal point.
Overall an extremely confusing diagram!
Tasneem Abed
Tasneem Abed 2023-7-31
'An' is indeed the area '.
'Q1,2,3' is not important here.
i know this way 'energy (= power * time)'
you say its the 'height of the colored shape', is it the same as in the shapes i pointed at in the pic??
and thats the original code i used polyshape to get the energy
the Partition is optinal not a must
pmax =[0 21.428*42 57.1428*42 109*42 116*42 123*42 127*42 129*42 129.5*42 130*42 130*42 130*42 129*42 123*42 116*42 109*42 57.1428*42 21.428*42 0 ];
t =[5 6 7 7.30 8 9 9.30 10 11 12 13 14 15 15.30 16 16.30 17 18 19 ];
hold on
plot(t,pmax,'r')
hold off
data=[0 6 900;
6 7 2400;
7 15 3000;
15 18 1800;
18 22 3000;
22 24 1800];
power=data(:, 3)
Dt=data(:,2) - data(:,1)
Power_Generated=power.*Dt
Total_power1=sum(Power_Generated)
Total_power2=power.*Dt;
DATA=[data(:,1) data(:,2) power];
Average_load=Total_power2/sum(Dt);
peak_load=max(power);
Daily_LF=Average_load/peak_load*100;
Results=[Average_load peak_load*ones(size(Daily_LF)) Daily_LF];
L=length(data);
timeinterval=data(:,1:2) ;
t = sort(reshape(timeinterval,1,2*L));
for n = 1:L
P(2*n-1) = power(n);
P(2*n) = power(n);
end
hold on
plot(t,P,'b')
hold off
xlim([1 24])
xlabel(['Timer, Hr'])
ylabel(['Power, W'])
title('Combined curves, W versus time, hour')
grid on
grid minor

请先登录,再进行评论。

回答(1 个)

DGM
DGM 2023-7-31
编辑:DGM 2023-7-31
I'm just going to throw this out there.
% this image has points marked manually
inpict = imread('bbbbbb.png');
% data range from original image axis labels
xrange = [0 20];
yrange = [0 6000];
% get vertices and calibration info from marked image
axmask = all(inpict == permute([255 0 0],[1 3 2]),3);
vtmask = all(inpict == permute([0 255 0],[1 3 2]),3);
S = regionprops(axmask,'centroid');
axpts = vertcat(S.Centroid);
S = regionprops(vtmask,'centroid');
vertices = vertcat(S.Centroid);
% rescale to fit data range
pbrect = [axpts(1,:) diff(axpts,1,1)];
xx = xrange(1) + diff(xrange)*(vertices(:,1)-pbrect(1))/pbrect(3);
yy = yrange(1) + diff(yrange)*(pbrect(4) - (vertices(:,2)-pbrect(2)))/pbrect(4);
% get a list of which vertices belong to each polygon
pgons = {[1 2 4 3]; [3 4 6]; [4 7 6]; [6 10 11 7]; [5 6 9]; [6 10 9]; [9 11 14 13]; [8 9 12];
[9 13 12]; [12 16 15]; [15 18 19 16]; [12 14 33 31]; [15 18 17]; [17 21 20];
[20 24 23]; [23 27 26]; [29 30 34]; [34 35 37]; [37 38 40]; [40 41 43]; [43 44 46];
[17 19 22 21]; [20 22 25 24]; [23 25 28 27]; [26 28 31 29]; [30 32 36 34]; [35 37 39 36];
[39 42 40 38]; [41 43 45 42]; [44 46 47 45]; [46 47 48]; [32 33 50 48]; [48 52 53];
[49 53 48]; [49 53 54 50]; [53 54 57]; [53 57 56]; [53 56 55 51]; [55 57 60 58]; [59 60 62 61]};
% get some info about each polygon?
npgons = numel(pgons);
regionarea = zeros(npgons,1);
regionheight = zeros(npgons,1);
regionwidth = zeros(npgons,1);
for k = 1:numel(pgons)
px = xx(pgons{k});
py = yy(pgons{k});
thispgon = polyshape(px,py);
regionarea(k) = area(thispgon);
regionheight(k) = range(py);
regionwidth(k) = range(px);
end
% display it
table(regionarea, regionheight, regionwidth)
ans = 40×3 table
regionarea regionheight regionwidth __________ ____________ ___________ 4488.8 899.2 4.9919 449.6 899.2 1 449.6 899.2 1 899.2 899.2 1 750 1500 1 750 1500 1 193.48 2399.2 0.080645 24.226 600.8 0.080645 24.226 600.8 0.080645 171.97 1579.6 0.21774 1101.9 1579.6 0.70161 23746 3000 7.9194 103.29 294.43 0.70161 147.21 294.43 1 25.525 171.09 0.29839 43.269 123.34 0.70161
Not sure if that's useful, since the order doesn't correspond to the original order, but given the area, you could correlate the two.
EDIT: Oh. There's code. Well maybe I'll look at that later.

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by