Fix ENsetqualtype to set node initial values
When changing from CHEM to AGE or TRACE, nodes initial quality values
must be returned to their original ones. Reported by R.T., CSIRO AU -
thanks!
@@ -2305,6 +2305,7 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, char
{
/*** Updated 3/1/01 ***/
double ccf = 1.0;
+ int i;
if (!Openflag) return(102);
if (qualcode < EN_NONE || qualcode > EN_TRACE) return(251);
@@ -2340,6 +2341,14 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, char
strcpy(Field[QUALITY].Units,u_HOURS);
}
+ if ((Qualflag == AGE || Qualflag == TRACE) & (Ucf[QUALITY] != 1))
+ {
+ for (i=1; i<=Nnodes; i++)
+ {
+ Node[i].C0 *= Ucf[QUALITY];
+ }
+ }
+
/*** Updated 3/1/01 ***/
Ucf[QUALITY] = ccf;
Ucf[LINKQUAL] = ccf;
