Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > VCL

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2012, 04:55 PM
Petros Petros is offline
Junior Member
 
Join Date: Jul 2012
Posts: 3
Default calculation problem

Hi I have an issue with my code and i would appreciate a lot if someone could help me.

my code is the following

begin
Height := -0.0002*Age*Age + 0.1732*Age + 6.1517;
Crown_Diameter := 0.0000003*Age*Age*Age + 0.0001*Age*Age + 0.1421*Age + 1.8887;
DBH := 0.000003*Age*Age*Age - 0.0038*Age*Age + 1.529*Age +2;



for l := 0 to Length(FGtarray1[0]) do
begin
solarAzimuth := FGtarray1[15,l];
Elevation := FGtarray1[16,l];
BeamInsolation := FGtarray1[7,l];
DiffuseInsolation := FGtarray1[6,l];
BeamInsolation2 := FGtarray1[8,l]-FGtarray1[9,l];
DiffuseInsolation2 := FGtarray1[9,l];
skydome1 := GetSkyDome (10,solarAzimuth,Elevation,BeamInsolation,DiffuseI nsolation,BeamInsolation2,DiffuseInsolation2);



for i:=0 to 2 do
for j:=0 to 2 do
begin
x := i * s/2;
y := j * s/2;
d1 := D + Crown_Diameter/4 + cos(DegToRad(a))*x;
d2 := D - Crown_Diameter/4 + cos(DegToRad(a))*x;
h1 := (Height-(Crown_Diameter/2)) - sin(DegToRad(a))*x;
h2 := Height -sin(DegToRad(a))*x;
Exclude_E1 := arctan((h1/d1));
Exclude_E1 := RadToDeg(Exclude_E1);
Exclude_E2 := arctan( (h2/d2));
Exclude_E2 := RadToDeg(Exclude_E2);

d3 := D + cos(DegToRad(a))*x;

z1 := Z + (DBH*0.01)/2 + y;
Exclude_A1 := arctan((d3/z1));
Exclude_A1 := RadToDeg(Exclude_A1);
z2 := Z - (DBH*0.01)/2 + y;
Exclude_A2 := arctan((d3/z2));
Exclude_A2 := RadToDeg(Exclude_A2);

z3 := z + crown_diameter/4 +y;
Exclude_A3 := arctan((d3/z3));
Exclude_A3 := RadToDeg(Exclude_A3);
z4 := z - crown_diameter/4 + y;
Exclude_A4 := arctan((d3/z4));
Exclude_A4 := RadToDeg(Exclude_A4);


irradianceOnPoint := 0;

for k := 0 to Length(skyDome1) - 1 do
if (skyDome1[k].elevation > Exclude_E1) and
((skyDome1[k].azimuth < Exclude_A1) or
(skyDome1[k].azimuth > Exclude_A2)) then

if (skyDome1[k].elevation > Exclude_E2) and
(skydome1[k].azimuth < Exclude_A3) or
(skydome1[k].azimuth > Exclude_A4) then

begin

irradianceOnPoint := irradianceOnPoint + skyDome1[k].irradiation;


end;

end;


end;
end;


So in the end I calculate my irradiance on each point of my PV panel and it works just fine. Thus for each line of my FGtarray1 i have 9 values of irradiance which are the 9 points of my PV.

My question is how can I calculate the total irradiance on each pv point.

I was trying to do something like that

Calculate the irradiance for one hour
add it to a variable
Calculate the irradiance for hour 2
add it to the variable

but i do something wrong .
Reply With Quote
  #2  
Old 08-23-2012, 06:53 PM
emailx45 emailx45 is offline
Junior Member
 
Join Date: May 2012
Posts: 18
Default

Will be, maybe, using one ARRAY:

xRadiance:Array of Integer; //open array

iTotal:=0
for i:= low(xRadiance) to high(xRadiance) do begin
iTotal := iTotal + xRadiance[i];
end;

iMedium := iTotal div high(xRadiance);
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.