Home > Back-end >  High marks for ~ ~ about Float type data processing problem ~ ~ ~ ~ ~
High marks for ~ ~ about Float type data processing problem ~ ~ ~ ~ ~

Time:10-19

Younger brother beginners BCB, for help ~ ~ ~ my code read from the database table data in the float type array P and EI, code to calculate a new float type array in the Sevrer2008 SQL database, but after insert 2046 lines to line 2047 to start an error

Pow: DOMAIN error after close the window, continue to report errors pow: OVERFLOW error, continuous popup a dozen, breakpoint testing found that after running to the 2047th running to XAJ_HydroModel: : Control the Runoff () function () function is an error, for help how to solve a great god, has been bothering me for a week, and why float type I input the data in BCB is 0.1, in the program ShowMessage () output is 0.1000000013947,
Code below * * *. CPP
# pragma resource "*. DFM
"//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void XAJ_HydroModel: : Control ()
{
//calculation sequence control: first rainfall runoff depth calculation, and then divides the water finally confluence
Runoff ();//rain deep
The Source ();//three water dividing
Infall ();//bus
}
//get the data series
Float * XAJ_HydroModel: : getR ()
{
Return R;
}
Float * XAJ_HydroModel: : getE ()
{
Return E;
}
Float * XAJ_HydroModel: : getW ()
{
Return W;
}
Float * XAJ_HydroModel: : getQ ()
{
return Q;
}
Float * XAJ_HydroModel: : getQRS ()
{
Return QRS;
}
Float * XAJ_HydroModel: : getQRSS ()
{
Return QRSS;
}
Float * XAJ_HydroModel: : getQRG ()
{
Return the QRG;
}

Void XAJ_HydroModel: : Runoff ()
{
Float Wmax, A;//river basin water storage capacity, the initial average storage capacity corresponding ordinate
Float dW.
int i;
Wmax=WM * (1 + B)/(1 - IMP);
W [0]=WU WL [0] + [0] + WD [0];//on a period of time average of the initial water storage capacity
//calculate the production flow, from the beginning of the period
for(i=1; i<=N; I++)
{
EM [I]=K * EI [I];
//calculate evaporation
If ((P + WU [I]] [I - 1) & gt;=EM [I])
{
EU [I]=EM [I];
EL [I]=0;
ED [I]=0;
}
The else
{
EU [I]=P + WU [I] [I - 1);
EL [I]=(EM [I] - EU [I]) * WL] [I - 1/WLM;
ED [I]=0;
If (EL [I] {
EL [I]=C * (EM [I] - EU [I]);
If (WL [I - 1] {
EL [I]=WL [I - 1);
ED [I]=C * (EM [I] - EU [I]) - EL [I];
}
}
}
E=EU [I] [I] + EL [I] + ED [I];
//after the evaporation capacity calculation, can calculate net rainfall
PE [I]=P - E [I] [I];
//calculate the production flow
If (PE [I] <=0)
R [I]=0;
The else
{
//WM watershed
(A=Wmax * (1 - pow [I - 1) (1 - W/WM), 1/(1 + B)));
If ((PE [I] + A) & lt; Wmax)
R=PE [I] - [I] WM + W [I - 1) + WM * pow ((1 - (PE [I] + A)/Wmax), 1 + B);
The else
R=PE [I] - [I] (WM - W] [I - 1);
}

//water balance principle of calculating soil pondage
DW=PE [I] - R [I];
If (dW> 0)
{
If ((WU [I - 1) + dW) & lt; WUM)
{
WU [I]=WU [I - 1) + dW.
WL [I]=WL [I - 1);
WD=[I] WD [I - 1);
}
The else
{
WU [I]=WUM;
WL [I]=WL [I - 1) + dW - (WUM - WU [I - 1));
WD=[I] WD [I - 1);
If (WL [I] & gt; WLM)
{
WL [I]=WLM;
WD [I]=WD [I - 1) + dW - (WUM - WU] [I - 1) - (WLM - WL [I - 1));
}
}
}
The else
{
If (WU] [I - 1 & gt; Fabs (dW))
{
WU [I]=WU] [I - 1 - fabs (dW);
WL [I]=WL [I - 1);
WD=[I] WD [I - 1);
}
The else
{
WU [I]=0;
WL [I]=WU] [I - 1 - fabs (dW) + WL [I - 1);
WD=[I] WD [I - 1);
If (WL [I] <0)
{
WL [I]=0;
WD=WU [I] [I - 1) + WL] [I - 1 - fabs (dW) + WD [I - 1);
}
}
}
W=WU [I] [I] + WL [I] + WD [I];
}
}
Void XAJ_HydroModel: : Source ()
{
int i;
Float FR.//runoff area
Float GX, KSSD KGD is;//the flow index, after conversion in the soil of outflow flow coefficient and groundwater discharge coefficient
Float AU, Smax;//and free water storage capacity S corresponding to the water storage capacity curve of the longitudinal coordinate values
Float temP, temS;
Float RS0, RSS0 RG0;
Smax=(1 + EX) * SM; At some point//basin on the free storage capacity of the largest storage quantity
for(i=1; i<=N; I++)
{
RIMP [I]=[I] PE * IMP;//impervious area of runoff
If (PE [I] <=0)//PE<=0 runoff calculation
{
GX=24/dT;
KSSD=(1 - pow (1 - (KG + KSS), 1/GX))/(1 + KG/KSS);
KGD is=KSSD * KG/KSS;
FR=1 - IMP - pow (1 - W/WM, [I - 1] B/(1 + B)) * (1 - IMP);
RS [I]=0;
RSS [I]=S [I - 1) * KSSD * FR;
RG [I]=S [I - 1) * KGD is * FR;
S [I]=(1 - KSSD - KGD is) * S [I - 1);
}
The else//PE> 0 runoff calculation
{
FR=R/PE [I] - [I] IMP;//permeable area runoff area
GX=24/dT * int (PE [I]/5 + 1);
KSSD=(1 - pow (1 - (KG + KSS), 1/GX))/(1 + KG/KSS);
KGD is=KSSD * KG/KSS;
TemP=[I] PE/int (PE [I]/5 + 1);
TemS=S [I - 1);
RS0=0;
RSS0=0;
RG0=0;
//the following treatment to avoid the error due to the differential
for(int j=1; J<=int (PE [I]/5 + 1); J++)
{
AU=Smax * (1 - pow (1 - temS/SM, 1/(1 + EX)));
If ((temP + AU) & lt; Smax)
{
RS0=RS0 + (temP - SM + temS + SM * pow (1 - (temP + AU)/Smax, 1 + EX)) * FR;
RSS0=RSS0 + (SM - SM * pow (1 - (temP + AU)/Smax, 1 + EX)) * KSSD * FR;
RG0=RG0 + (SM - SM * pow (1 - (temP + AU)/Smax, 1 + EX)) * KGD is * FR;
TemS=(1 - KSSD - KGD is) * (SM - SM * pow (1 - (temP + AU)/Smax, 1 + EX));
}
The else
{
RS0=RS0 + (temP - SM + temS) * FR;
RSS0=KSSD RSS0 + SM * * FR;
RG0=RG0 + KGD is SM * * FR;
TemS=(1 - KSSD - KGD is) * SM;
}
}
RS [I]=RS0;
RSS [I]=RSS0;
RG [I]=RG0;
S [I]=temS;
}
}
}
Void XAJ_HydroModel: : Infall ()
{
int i,j;
Float KKSSD KKGD;
Float sum;
KKSSD=pow (KKSS, dT/24);
KKGD=pow (KKG, dT/24);
//soil grains, groundwater (linear reservoir method)
for(i=1; i<=N; I++)
{
QRSS [I]=QRSS [I - 1) + RSS [I] * * KKSSD Area/dT) (3.6 * * (1 - KKSSD);
QRG [I]=QRG [I - 1) * KKGD + RG [I] * Area/dT) (3.6 * * (1 - KKGD);
}
//the surface (the unit line method UH)
for(j=1; J<=2 * N; J++)
for(i=1; i<=2 * N; I++)
Qs [I] [j]=0;
for(j=1; J<=N; J++)
{
for(i=1; i<=j - 1; I++)
Qs [I] [j]=0;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related