Commit 60b0aa70 authored by Ronan Trepos's avatar Ronan Trepos
Browse files

simplify equations in ContraintesEau

parent 4639d7e7
......@@ -213,41 +213,29 @@ public :
zC2 = 1.0;
{
double zC3_tmp = 0.0;
zC3_tmp =zBilan - ps.zC1 - zC2();
if ( zC3_tmp < 1.0 ){
zC3_tmp = 1.0;
}
zC3 = zC3_tmp;
zC3 = std::max(1.0, zBilan - ps.zC1 - zC2());
}
{
double D1_tmp = 0.0;
if ( C1() >= ( ps.zC1 * RUmmC1() ) ){
D1_tmp = C1() - ( ps.zC1 * RUmmC1() );
D1 = C1() - ( ps.zC1 * RUmmC1() ) ;
} else {
D1_tmp = 0.0;
D1 = 0.0;
}
D1 = D1_tmp;
}
{
double D2_tmp = 0.0;
if ( C2() >= ( zC2() * RUmmC2() ) ){
D2_tmp = C2() - ( zC2() * RUmmC2() );
D2 = C2() - ( zC2() * RUmmC2() );
} else {
D2_tmp = 0.0;
D2 = 0.0;
}
D2 = D2_tmp;
}
{
double D3_tmp = 0.0;
if ( C3() > ( zC3() * RUmmC2() ) ){
D3_tmp = C3() - ( zC3() * RUmmC2() );
D3 = C3() - ( zC3() * RUmmC2() );
} else {
D3_tmp = 0.0;
D3 = 0.0;
}
D3 = D3_tmp;
}
{
double STOCKC1_tmp = 0.0;
......@@ -276,20 +264,13 @@ public :
STOCKC3 = STOCKC3_tmp;
}
{
double TEC1_tmp = 0.0;
TEC1_tmp = STOCKC1() / ps.zC1 ;
TEC1 = TEC1_tmp;
TEC1 = STOCKC1() / ps.zC1 ;
}
{
double RWCC1_tmp = 0.0;
double div = ps.da_C1 * ( ps.Hcc_C1 - ps.Hpf_C1 ) / 100.0;
if ( div == 0.0 ){ // controle
throw ("erreur");
} else { // div non nul
RWCC1_tmp = ( TEC1() - ( ps.da_C1 * ps.Hpf_C1 / 100.0 ) ) / div;
}
RWCC1 = RWCC1_tmp;
RWCC1 = ( TEC1() - ( ps.da_C1 * ps.Hpf_C1 / 100.0 ) ) /
(ps.da_C1 * ( ps.Hcc_C1 - ps.Hpf_C1 ) / 100.0);
}
JS = 0.0; //codeMMpourMemo Initial Value = 0
{
......@@ -303,42 +284,31 @@ public :
ETP = 0.001;
}
{
double EVj_tmp = 0.0;
EVj_tmp = ETP()* ( pow((JS()+1.0),0.5) - pow(JS(),0.5) )
* ( 1.0 - Ei_valeurInitiale );
if ( EVj_tmp > C1() ){
EVj_tmp = C1();
}
EVj = EVj_tmp;
EVj = std::min(C1(),
ETP()* ( pow((JS()+1.0),0.5) - pow(JS(),0.5) )
* ( 1.0 - Ei_valeurInitiale ));
}
traitementStressEau();
vTRp = pp.Kc * ETP() * Ei_valeurInitiale;
{
double fRacC1_tmp = 0.0;
double div = ps.zC1 + zC2();
fRacC1_tmp = ps.zC1 / div;
fRacC1 = fRacC1_tmp;
fRacC1 = ps.zC1 / (ps.zC1 + zC2());
}
{
double vTRC1_tmp = 0.0;
if ( C1() <= 0.0 ){
vTRC1_tmp = 0.0;
vTRC1 = 0.0;
} else if ( zRac() > ps.zC1 ){
vTRC1_tmp = fRacC1() * vTRp() * FHTR();
vTRC1 = fRacC1() * vTRp() * FHTR();
} else {
vTRC1_tmp = vTRp() * FHTR();
vTRC1 = vTRp() * FHTR();
}
vTRC1 = vTRC1_tmp;
}
{
double vTRC2_tmp = 0.0;
if ( zRac() > ps.zC1 ){
vTRC2_tmp = ( 1.0 - fRacC1() ) * vTRp() * FHTR();
vTRC2 = ( 1.0 - fRacC1() ) * vTRp() * FHTR();
} else {
vTRC2= 0;
}
vTRC2 = vTRC2_tmp;
}
vTR = vTRC1() + vTRC2();
TR = 0.001; //codeMMpourMemo Initial Value = 0.001
......@@ -365,123 +335,98 @@ public :
// C1, EQ8 de la publi
{
double ddt = 0.0;
// double ddt = 0.0;
ddt = Pluie() - vTRC1(-1) - EVj(-1) - D1(-1);
if ( (int)ActionIrrig() == 1 ){
ddt = ddt + DoseIrrig();
}
C1 = C1(-1) + ddt;
// ddt = Pluie() - vTRC1(-1) - EVj(-1) - D1(-1);
// if ( (int)ActionIrrig() == 1 ){
// ddt = ddt + DoseIrrig();
// }
C1 = C1(-1) + Pluie() - vTRC1(-1) - EVj(-1) - D1(-1) + DoseIrrig();
}
// C2, EQ9 de la publi
{
double ddt = 0.0;
if ( zC2(-1) == 1.0 ){
ddt = D1(-1) - D2(-1) - vTRC2(-1);
C2 = C2(-1) + D1(-1) - D2(-1) - vTRC2(-1);
} else {
ddt = D1(-1) - D2(-1) - vTRC2(-1) + vRac(-1) * ( C3(-1) / zC3(-1) );
C2 = C2(-1) + D1(-1) - D2(-1) - vTRC2(-1) + vRac(-1) * ( C3(-1) / zC3(-1) );
}
C2 = C2(-1) + ddt;
}
// C3, EQ10 de la publi
{
double ddt = 0.0;
if ( zC2(-1) == 1.0 ){
ddt = D2(-1) - D3(-1);
C3 = C3(-1) + D2(-1) - D3(-1);
} else {
ddt = D2(-1) - D3(-1) - vRac(-1) * ( C3(-1) / zC3(-1) );
C3 = C3(-1) + D2(-1) - D3(-1) - vRac(-1) * ( C3(-1) / zC3(-1) );
}
C3 = C3(-1) + ddt;
}
// zRac, EQ7 de la publi
if ( (int)ActionSemis() == 1 ){
zRac = zSemis(); // initialisation
} else {
double ddt = vRac(-1);
zRac = zRac(-1) + ddt;
zRac = zRac(-1) + vRac(-1);
}
{
double vRac_tmp = 0.0;
if ( ( PhasePhenoPlante() <= PHASEPHENOPLANTE_NONSEMEE)
|| ( PhasePhenoPlante() >= PHASEPHENOPLANTE_RECOLTEE) ){
// traduit condition t<=jsemis or t>=jrecolte
vRac_tmp = 0.0;
vRac = 0.0;
} else if ( Tmoy() <= 0.0 ){
vRac_tmp = 0.0;
vRac = 0.0;
} else if ( zRac() >=zBilan ){
vRac_tmp = 0.0;
vRac = 0.0;
} else {
vRac_tmp = pp.VitCroiRac * Tmoy();
vRac = pp.VitCroiRac * Tmoy();
}
vRac = vRac_tmp;
}
{
double zC2_tmp = 0.0;
if ( ( PhasePhenoPlante() <= PHASEPHENOPLANTE_NONSEMEE )
|| ( PhasePhenoPlante() >= PHASEPHENOPLANTE_RECOLTEE ) ){
// traduit condition t < jsemis or t > jrecolte
zC2_tmp = 1.0;
zC2 = 1.0;
} else if ( zRac() < ps.zC1 ){
zC2_tmp = 1.0;
zC2 = 1.0;
} else if ( ( zRac() - ps.zC1 ) >zBilan ){
zC2_tmp =zBilan - 1.0;
zC2 =zBilan - 1.0;
} else if ( zRac() >zBilan ){
zC2_tmp =zBilan - ps.zC1 - 1.0;
zC2 =zBilan - ps.zC1 - 1.0;
} else {
zC2_tmp = zRac() - ps.zC1 ;
zC2 = zRac() - ps.zC1 ;
}
zC2 = zC2_tmp;
}
{
double zC3_tmp = 0.0;
zC3_tmp =zBilan - ps.zC1 - zC2();
if ( zC3_tmp < 1.0 ){
zC3_tmp = 1.0;
}
zC3 = zC3_tmp;
zC3 = std::max(1.0, zBilan - ps.zC1 - zC2());
}
{
double D1_tmp = 0.0;
if ( C1() >= ( ps.zC1 * RUmmC1() ) ){
D1_tmp = C1() - ( ps.zC1 * RUmmC1() );
D1 = C1() - ( ps.zC1 * RUmmC1() );
} else {
D1_tmp = 0.0;
D1 = 0.0;
}
D1 = D1_tmp;
}
{
double D2_tmp = 0.0;
if ( C2() >= ( zC2() * RUmmC2() ) ){
D2_tmp = C2() - ( zC2() * RUmmC2() );
D2 = C2() - ( zC2() * RUmmC2() );
} else {
D2_tmp = 0.0;
D2 = 0.0;
}
D2 = D2_tmp;
}
{
double D3_tmp = 0.0;
if ( C3() > ( zC3() * RUmmC2() ) ){
D3_tmp = C3() - ( zC3() * RUmmC2() );
D3 = C3() - ( zC3() * RUmmC2() );
} else {
D3_tmp = 0.0;
D3 = 0.0;
}
D3 = D3_tmp;
}
{
......@@ -516,17 +461,12 @@ public :
}
{
double TEC1_tmp = 0.0;
TEC1_tmp = STOCKC1() / ps.zC1 ;
TEC1 = TEC1_tmp;
TEC1 = STOCKC1() / ps.zC1 ;
}
{
double RWCC1_tmp = 0.0;
double div = ps.da_C1 * ( ps.Hcc_C1 - ps.Hpf_C1 ) / 100.0;
RWCC1_tmp = ( TEC1() - ( ps.da_C1 * ps.Hpf_C1 / 100.0 ) ) / div;
RWCC1 = RWCC1_tmp;
RWCC1 = ( TEC1() - ( ps.da_C1 * ps.Hpf_C1 / 100.0 ) ) /
(ps.da_C1 * ( ps.Hcc_C1 - ps.Hpf_C1 ) / 100.0);
}
return true;
......@@ -567,15 +507,9 @@ public :
// EVj, EQ12 de publi
{
double EVj_tmp = 0.0;
EVj_tmp = ETP()*( pow((JS()+1.0),0.5) - pow(JS(),0.5) )
* ( 1.0 - Ei(-1) );
if ( EVj_tmp > C1() ){
EVj_tmp = C1();
}
EVj = EVj_tmp;
EVj = std::min(C1(),
ETP()*( pow((JS()+1.0),0.5) - pow(JS(),0.5) )
* ( 1.0 - Ei(-1) ));
}
......@@ -594,13 +528,7 @@ public :
{
double ATSW_tmp = 0.0;
ATSW_tmp = C1() + C2();
if ( ATSW_tmp < 0.0 ){
ATSW_tmp = 0.0;
}
ATSW = ATSW_tmp;
ATSW = std::max(0.0, C1() + C2());
}
TTSW = ( RUmmC1() * ps.zC1 ) + ( RUmmC2() * zC2() );
......@@ -619,42 +547,35 @@ public :
// FHLE, FHRUE, FHTR, EQ19 de la publi
{
double FHLE_tmp = 0.0;
if ( ( PhasePhenoPlante() < PHASEPHENOPLANTE_JUVENILE)
|| ( PhasePhenoPlante() >= PHASEPHENOPLANTE_RECOLTEE) ){
// traduit condition TT_A2 = 0
FHLE_tmp = 1.0;
FHLE = 1.0;
} else {
FHLE_tmp = -1.0 + 2.0 / (1.0 + exp( pv.a_LE * FTSW() ) );
FHLE = -1.0 + 2.0 / (1.0 + exp( pv.a_LE * FTSW() ) );
}
FHLE = FHLE_tmp;
}
{
double FHRUE_tmp = 0.0;
if ( ( PhasePhenoPlante() < PHASEPHENOPLANTE_JUVENILE)
|| ( PhasePhenoPlante() >= PHASEPHENOPLANTE_RECOLTEE) ){
// traduit condition TT_A2 = 0
FHRUE_tmp = 1.0;
FHRUE = 1.0;
} else {
FHRUE_tmp = -1.0 + 2.0 /( 1.0 + exp( ( pp.a_Pho + pv.a_TR ) * FTSW() ) );
FHRUE = -1.0 + 2.0 /( 1.0 + exp( ( pp.a_Pho + pv.a_TR ) * FTSW() ) );
}
FHRUE = FHRUE_tmp;
}
{
double FHTR_tmp = 0.0;
if ( ( PhasePhenoPlante() < PHASEPHENOPLANTE_JUVENILE)
|| ( PhasePhenoPlante() >= PHASEPHENOPLANTE_RECOLTEE) ){
// traduit condition TT_A2 = 0
FHTR_tmp = 1.0;
FHTR = 1.0;
} else {
FHTR_tmp = -1.0 + 2.0 / ( 1.0 + exp( pv.a_TR * FTSW() ) );
FHTR = -1.0 + 2.0 / ( 1.0 + exp( pv.a_TR * FTSW() ) );
}
FHTR = FHTR_tmp;
}
return true;
......@@ -676,60 +597,50 @@ public :
// fRacC1_tmp, EQ14 de la publi
{
double fRacC1_tmp = 0.0;
double div = ps.zC1 + zC2();
fRacC1_tmp = ps.zC1 / div;
fRacC1 = fRacC1_tmp;
fRacC1 = ps.zC1 / (ps.zC1 + zC2());
}
// vTRC1, EQ15 de la publi
{
double vTRC1_tmp = 0.0;
if ( C1() <= 0.0 ){
vTRC1_tmp = 0.0;
vTRC1 = 0.0;
} else if ( zRac() > ps.zC1 ){
vTRC1_tmp = fRacC1() * vTRp() * FHTR();
vTRC1 = fRacC1() * vTRp() * FHTR();
} else {
vTRC1_tmp = vTRp() * FHTR();
vTRC1 = vTRp() * FHTR();
}
vTRC1 = vTRC1_tmp;
}
// vTRC2, EQ16 de la publi
{
double vTRC2_tmp = 0.0;
if ( zRac() > ps.zC1 ){
vTRC2_tmp = ( 1.0 - fRacC1() ) * vTRp() * FHTR();
vTRC2 = ( 1.0 - fRacC1() ) * vTRp() * FHTR();
} else {
vTRC2 = 0;
}
vTRC2 = vTRC2_tmp;
}
vTR = vTRC1() + vTRC2();
{
double ddt = vTR(-1);
TR = TR(-1) + ddt;
TR = TR(-1) + vTR(-1);
}
{
double ddt = 0.0;
if ( ( PhasePhenoPlante() >= PHASEPHENOPLANTE_DESSICATION)
&& ( PhasePhenoPlante() < PHASEPHENOPLANTE_RECOLTEE) ){
// traduit condition TT_A2 > date_TT_M3
ddt = 0.0;
TRPF = TRPF(-1) +0.0;
} else if ( ( PhasePhenoPlante() < PHASEPHENOPLANTE_FLORAISON)
|| ( PhasePhenoPlante() >= PHASEPHENOPLANTE_RECOLTEE) ){
// traduit condition TT_A2 < date_TT_F1
ddt = 0.0;
TRPF = TRPF(-1) +0.0;
} else {
ddt = vTR(-1);
TRPF = TRPF(-1) + vTR(-1);
}
TRPF = TRPF(-1) + ddt;
}
return true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment