NEW

P&K TAL2K

Multi-Core

Berechnung wird mit fast 2-facher (Dual Core) oder 4-facher (Quad-Core) Geschwindigkeit ausgeführt.

Cluster

Berechnung wird mit bis zu 16-facher Geschwindigkeit ausgeführt. (Bedarf mehrere speziell vernetzte ausreichende PCs; Spezielles Installationswissen ist notwendig)

Petersen & Kade


AUSTAL2000 (modifiziert)

TalMon.c

// ======================================================== TalMon.c
//
// Calculation of time series at monitor points for AUSTAL2000
// ===========================================================
//
// Copyright (C) Umweltbundesamt, 14191 Berlin, Germany, 2002-2005
// Copyright (C) Janicke Consulting, 26427 Dunum, Germany, 2002-2005
// email: info@austal2000.de
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// last change: 2007-02-03 uj
//
//========================================================================
//
// Berechnung der Zeitreihen an den Beurteilungspunkten
// Tagesmittel erfordert mindestens 12 Stundenwerte
//
//==========================================================================

static char *TalMonVersion = "2.3.5";
static char *eMODn = "TalMon";
static int CHECK = 0;

#include
#include
#include
#include
#include
#include

#include "IBJmsg.h"
#include "IBJary.h"
#include "IBJtxt.h"
#include "IBJdmn.h"
#include "TalCfg.h"
#include "TalMon.h"
#include "TalMon.nls"

#ifdef MAIN
static char *TipGruppen[6] = { "gas", "gas", "gas", "pm3", "pm4", "pmu" };
static char *TipGrpXten[6] = { "", "-1", "-2", "-3", "-4", "-u" };
#else
#include "TalInp.h"
#endif

static ARYDSC MntAry, SpcAry;
static TXTSTR UsrHeader = { NULL, 0 };
static TXTSTR SysHeader = { NULL, 0 };
static char MntName[80] = "work/mnt%04ld";
static char Path[256];
static int SpcIndex[8], SpcIsGas[8];
static int SpcDayNum, SpcHourNum;
static char SpcName[8];
static char SpcConForm[32], SpcDayForm[32], SpcDepForm[32], SpcHourForm[32];
static char SpcConUnit[32], SpcDepUnit[32], SpcUc[32];
static float SpcConFac, SpcDepFac;
static float SpcConRef, SpcDayRef, SpcDepRef, SpcHourRef;
static int SpcSequ=-1;
static char **Names, YearForm[32], DayForm[32], HourForm[32];
static double T0, T1, T2;
static int Nv, Nc, Nm, Intervall, AddMeasured;
static char **MntN;
static float *MntX, *MntY, *MntZ;
static int *MntI, *MntJ, *MntK, *GrdL, *GrdI;
static TXTSTR MntNames = { NULL, 0 };
static float RefDays = 365;
static float RefHours = 365*24;
static char locale[256], locl[256]="";

//============================================================ ReadMntValues
//
static int ReadMntValues( int i )
{
dP(ReadMntValues);
int n;
char name[120], fname[256], s[80];
char t1s[40], t2s[40], *_ps=NULL;
double t0, t1, t2;
if (CHECK) vMsg("TMO: read point %d", i);
if (MntAry.start) AryFree(&MntAry);
sprintf(name, MntName, i);
strcpy(fname, Path);
strcat(fname, name);
if (CHECK) vMsg("TMO: read file %s", fname);
if (1 > DmnRead(fname, &UsrHeader, &SysHeader, &MntAry)) eX(20);
if (MntAry.elmsz != sizeof(float)) eX(1);
if (MntAry.numdm != 2) eX(2);
n = MntAry.bound[0].hgh - MntAry.bound[0].low + 1;
if (Nv) {
if (n != Nv) eX(3);
}
else Nv = n;
n = MntAry.bound[1].hgh - MntAry.bound[1].low + 1;
if (Nc) {
if (n != Nc) eX(4);
}
else Nc = n;
if (!Intervall) {
if (1 == DmnGetString(UsrHeader.s, "Interval", &_ps, 1)) {
Intervall = MsgDateSeconds(MsgDateVal("00:00:00"), MsgDateVal(_ps)) + 0.5; //-2002-07-04
FREE(_ps); _ps = NULL;
}
else Intervall = 3600;
if (1 == DmnGetString(UsrHeader.s, "refdate", &_ps, 1)) {
T0 = MsgDateVal(_ps);
FREE(_ps); _ps = NULL;
}
if (1 != DmnGetString(UsrHeader.s, "T1", &_ps, 1)) eX(7);
strcpy(t1s, _ps); FREE(_ps); _ps = NULL;
if (1 != DmnGetString(UsrHeader.s, "T2", &_ps, 1)) eX(8);
strcpy(t2s, _ps); FREE(_ps); _ps = NULL;
t0 = MsgDateVal("00:00:00");
t1 = MsgDateVal(t1s);
T1 = MsgDateIncrease(T0, (int)(MsgDateSeconds(t0, t1) + 0.5)); //-2007-02-03
t2 = MsgDateVal(t2s);
T2 = MsgDateIncrease(T0, (int)(MsgDateSeconds(t0, t2) + 0.5)); //-2007-02-03
Names = ALLOC((Nc+1)*sizeof(char*));
n = DmnGetString(UsrHeader.s, "name", Names, Nc); if (n != Nc) eX(9);
}
if (1 != DmnGetString(UsrHeader.s, "mntn", &_ps, 1)) eX(18);
sprintf(s, " %6s", TxtQuote(_ps));
TxtCat(&MntNames, s);
if (CHECK) vMsg("TMO: C");
FREE(_ps);
if (1 != DmnGetFloat(UsrHeader.s, "mntx", "%f", MntX+i-1, 1)) eX(10);
if (1 != DmnGetFloat(UsrHeader.s, "mnty", "%f", MntY+i-1, 1)) eX(11);
if (1 != DmnGetFloat(UsrHeader.s, "mntz", "%f", MntZ+i-1, 1)) eX(12);
if (1 != DmnGetInt(UsrHeader.s, "mnti", "%d", MntI+i-1, 1)) eX(13);
if (1 != DmnGetInt(UsrHeader.s, "mntj", "%d", MntJ+i-1, 1)) eX(14);
if (1 != DmnGetInt(UsrHeader.s, "mntk", "%d", MntK+i-1, 1)) eX(15);
if (1 != DmnGetInt(UsrHeader.s, "grdl", "%d", GrdL+i-1, 1)) eX(16);
if (1 != DmnGetInt(UsrHeader.s, "grdi", "%d", GrdI+i-1, 1)) eX(17);
return 0;
eX_20:
eMSG(_cant_read_$_, fname);
eX_1: eX_2: eX_3: eX_4: eX_7: eX_8: eX_9:
eX_10: eX_11: eX_12: eX_13: eX_14: eX_15: eX_16: eX_17: eX_18:
eMSG(_inconsistent_structure_);
}

//================================================================= AddValues
//
static int AddValues( int n ) {
dP(AddValues);
int ii, i, i0, l, ic;
char name[40];
float *psrc, *pdst;
if (CHECK) vMsg("AddValues(%d)", n);
if (!SpcAry.start) {
AryCreate(&SpcAry, sizeof(float), 2, 1, Nv, 1, Nm); eG(1);
}
strcpy(name, "gas.");
strcat(name, SpcName);
for (ii=0; ii<8; ii++) {
SpcIsGas[ii] = 0;
SpcIndex[ii] = -1;
}
ii = 0;
for (ic=0; ic<3; ic++) {
sprintf(name, "%s.%s%s", TipGruppen[ic], SpcName, TipGrpXten[ic]);
for (l=0; l if (!strcmp(Names[l], name)) {
SpcIndex[ii] = l;
SpcIsGas[ii] = 1;
ii++;
break;
}
}
}
if (ii == 0) return 1; //-2001-07-07
i0 = MntAry.bound[0].low;
for (ii=0; ii<8; ii++) {
l = SpcIndex[ii];
if (l < 0) break;
if (!SpcIsGas[ii]) continue;
for (i=0; i pdst = AryPtr(&SpcAry, 1+i, n); if (!pdst) eX(3);
psrc = AryPtr(&MntAry, i0+i, l); if (!psrc) eX(4);
if (*psrc >= 0) *pdst += SpcConFac*(*psrc);
else *pdst = -1;
}
}
return 0;
eX_1: eX_3: eX_4:
eMSG(_internal_error_);
}

//============================================================= WriteSpcValues
//
static int WriteSpcValues( char *fn ) {
dP(WriteSpcValues);
char s[256], *_ps, fname[256], src, dst;
//
if (*locl) { //-2003-07-07
strcpy(locale, setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, locl);
}
if (!strcmp(locl, "german")) { src = '.'; dst = ','; }
else { src = ','; dst = '.'; }
DmnRplChar(&UsrHeader, "xmin", src, dst);
DmnRplChar(&UsrHeader, "ymin", src, dst);
DmnRplChar(&UsrHeader, "valid", src, dst);
DmnRplChar(&UsrHeader, "sk|zk", src, dst);
DmnRplChar(&UsrHeader, "dd|delta", src, dst);
//
DmnRplName(&UsrHeader, "kennung", "idnt");
DmnRplValues(&UsrHeader, "name", TxtQuote(SpcName));
DmnRplValues(&UsrHeader, "file", TxtQuote(fn));
DmnRplValues(&UsrHeader, "einheit", NULL);
DmnRplValues(&UsrHeader, "unit", SpcConUnit);
DmnRplValues(&UsrHeader, "form", SpcConForm);
if (*locl) {
sprintf(s, "\"%s\"", locl);
DmnRplValues(&UsrHeader, "locl", s); //-2003-07-07
}
else DmnRplValues(&UsrHeader, "locl", NULL); //-2003-07-07
DmnRplValues(&UsrHeader, "refc", NULL);
sprintf(s, YearForm, SpcConRef);
DmnRplValues(&UsrHeader, "refv", s);
DmnRplValues(&UsrHeader, "artp", NULL);
DmnRplValues(&UsrHeader, "axes", "\"ti\"");
DmnRplValues(&UsrHeader, "T1", TxtQuote(MsgDateString(T1)));
DmnRplValues(&UsrHeader, "T2", TxtQuote(MsgDateString(T2)));
DmnRplValues(&UsrHeader, "undf", "-1");
DmnRplValues(&UsrHeader, "mntn", MntNames.s);
_ps = ALLOC(20*Nm+4);
if (Nm != DmnPutFloat(_ps, 20*Nm, "", " %8.1f", MntX, Nm)) eX(1);
DmnRplValues(&UsrHeader, "mntx", _ps);
*_ps = 0;
if (Nm != DmnPutFloat(_ps, 20*Nm, "", " %8.1f", MntY, Nm)) eX(2);
DmnRplValues(&UsrHeader, "mnty", _ps);
*_ps = 0;
if (Nm != DmnPutFloat(_ps, 20*Nm, "", " %8.1f", MntZ, Nm)) eX(3);
DmnRplValues(&UsrHeader, "mntz", _ps);
*_ps = 0;
if (Nm != DmnPutInt(_ps, 20*Nm, "", " %8d", MntI, Nm)) eX(4);
DmnRplValues(&UsrHeader, "mnti", _ps);
*_ps = 0;
if (Nm != DmnPutInt(_ps, 20*Nm, "", " %8d", MntJ, Nm)) eX(5);
DmnRplValues(&UsrHeader, "mntj", _ps);
*_ps = 0;
if (Nm != DmnPutInt(_ps, 20*Nm, "", " %8d", MntK, Nm)) eX(6);
DmnRplValues(&UsrHeader, "mntk", _ps);
*_ps = 0;
if (Nm != DmnPutInt(_ps, 20*Nm, "", " %8d", GrdL, Nm)) eX(7);
DmnRplValues(&UsrHeader, "grdl", _ps);
*_ps = 0;
if (Nm != DmnPutInt(_ps, 20*Nm, "", " %8d", GrdI, Nm)) eX(8);
DmnRplValues(&UsrHeader, "grdi", _ps);
FREE(_ps);
{ // direct write
FILE *f;
int i, j;
float *pf;
sprintf(fname, "%s%s.dmna", Path, fn);
f = fopen(fname, "w"); if (!f) eX(10);
fprintf(f, "%s\n", UsrHeader.s);
fprintf(f, "dims\t2\n");
fprintf(f, "sequ\t\"i,j\"\n");
fprintf(f, "lowb\t%3d\t%3d\n", 1, 1);
fprintf(f, "hghb\t%3d\t%3d\n", Nv, Nm);
fprintf(f, "*\n");
for (i=1; i<=Nv; i++) {
for (j=1; j<=Nm; j++) {
pf = AryPtr(&SpcAry, i, j); if (!pf) eX(11);
fprintf(f, YearForm, *pf);
}
fprintf(f, " ' %s\n", MsgDateString(MsgDateIncrease(T0, i*Intervall)));
}
fclose(f);
}
if (*locl) setlocale(LC_NUMERIC, locale);
return 0;
eX_1: eX_2: eX_3: eX_4: eX_5: eX_6: eX_7: eX_8:
eMSG(_internal_error_);
eX_10: eX_11:
eMSG(_cant_write_$_, fname);
}

//============================================================== TmoEvalSeries
//
static int add( ARYDSC *psrc, ARYDSC *pdst ) {
int i, i1, i2, j, j1, j2, js, jd;
float fs, fd;
if (!psrc) return 1;
if (!psrc->start) return 2;
if (psrc->numdm != 2) return 3;
if (psrc->elmsz != sizeof(float)) return 4;
if (!pdst) return 11;
if (!pdst->start) return 12;
if (pdst->numdm != 2) return 13;
if (pdst->elmsz != sizeof(float)) return 14;
i1 = psrc->bound[0].low;
i2 = psrc->bound[0].hgh;
j1 = psrc->bound[1].low;
j2 = psrc->bound[1].hgh;
jd = pdst->bound[1].hgh; //-2001-12-06
if (i1 != pdst->bound[0].low) return 21;
if (i2 != pdst->bound[0].hgh) return 22;
if (j1 != pdst->bound[1].low) return 23;
for (i=i1; i<=i2; i++) {
for (j=j1; j<=jd; j++) { //-2001-12-06
js = (j > j2) ? j2 : j; //-2001-12-06
fs = *(float*)AryPtrX(psrc, i, js); //-2001-12-06
fd = *(float*)AryPtrX(pdst, i, j);
if (fs<0 || fd<0) fd = -1;
else fd += fs;
*(float*)AryPtrX(pdst, i, j) = fd;
}
}
return 0;
}

static int compare( const void *p1, const void *p2 ) {
if (*(float*)p1 < *(float*)p2) return 1;
else if (*(float*)p1 > *(float*)p2) return -1;
else return 0;
}

static int TmoEvalSeries( int ii ) {
dP(TmoEvalSeries);
int i, i1, i2, n, n1, n2, nv, nm;
int nparts=0; //-2002-08-28
char s[80], fn[256], gn[256], *pc;
FILE *f;
ARYDSC dsc, msr;
TXTSTR usr = { NULL, 0 };
TXTSTR sys = { NULL, 0 };
if (CHECK) vMsg("TMO: TmoEvalSeries");
memset(&dsc, 0, sizeof(ARYDSC));
memset(&msr, 0, sizeof(ARYDSC));
if (AddMeasured) {
sprintf(gn, "%s%s-%s.dmna", Path, SpcName, CfgMntBckString); //-2006-10-31
if (!DmnFileExist(gn)) return 0;
DmnRead(gn, &usr, &sys, &msr); eG(10);
}
sprintf(fn, "%s%s-%s.dmna", Path, SpcName, CfgMntAddString); //-2006-10-31
if (!DmnFileExist(fn)) return 0; //-2002-08-28
for (pc=SpcName; (*pc); pc++) *pc = toupper(*pc);
DmnRead(fn, &usr, &sys, &dsc); eG(1);
if (AddMeasured) {
n = add(&msr, &dsc); if (n) eX(11);
}
if (dsc.numdm != 2) eX(2);
i1 = dsc.bound[0].low;
i2 = dsc.bound[0].hgh;
n1 = dsc.bound[1].low;
n2 = dsc.bound[1].hgh;
nv = i2 - i1 + 1;
nm = n2 - n1 + 1;
f = (MsgFile) ? MsgFile : stdout;
if (ii <= 0) {
MntN = ALLOC(nm*sizeof(char*));
MntX = ALLOC(nm*sizeof(float));
MntY = ALLOC(nm*sizeof(float));
MntZ = ALLOC(nm*sizeof(float));
n = DmnGetString(usr.s, "mntn", MntN, nm); if (n != nm) eX(3);
n = DmnGetFloat(usr.s, "mntx", "%f", MntX, nm); if (n != nm) eX(4);
n = DmnGetFloat(usr.s, "mnty", "%f", MntY, nm); if (n != nm) eX(5);
n = DmnGetFloat(usr.s, "mntz", "%f", MntZ, nm); if (n != nm) eX(6);
fprintf(f, _evaluation_);
if (AddMeasured) fprintf(f, _total_load_);
else fprintf(f, _additional_load_);
fprintf(f, _sep1_);
fprintf(f, _point_);
for (n=0; n fprintf(f, "\n");
fprintf(f, "%-4s ", "xp");
for (n=0; n fprintf(f, "\n");
fprintf(f, "%-4s ", "yp");
for (n=0; n fprintf(f, "\n");
fprintf(f, "%-4s ", "hp");
for (n=0; n fprintf(f, "\n");
for (n=0; n FREE(MntN);
FREE(MntX);
FREE(MntY);
FREE(MntZ);
nparts++; //-2002-08-28
}
if (ii <= 1) { //-2002-08-28
fprintf(f, "--------");
for (n=0; n fprintf(f, "+------");
if (strlen(YearForm) > 6) fprintf(f, "----"); //-2003-02-21
}
fprintf(f, "\n");
nparts++; //-2002-08-28
}
if (SpcConRef > 0) {
float v, vsum;
int av;
fprintf(f, "%-4s", SpcName);
fprintf(f, " J00"); //-2001-07-07
for (n=1; n<=nm; n++) {
vsum = 0;
av = 0;
for (i=1; i<=nv; i++) {
v = *(float*) AryPtrX(&dsc, i, n);
if (v < 0) continue;
vsum += v;
av++;
}
if (av > 0) vsum /= av;
fprintf(f, YearForm, vsum);
}
fprintf(f, " %s\n", SpcUc);
nparts++;
}
if (SpcDayRef>0 && nv>=24) {
float *vv, v;
int nd, k, id, av, ii, ndrop, nu; //-2001-07-02
int dnum = SpcDayNum; //-2001-07-02
nd = nv/24;
vv = ALLOC(nd*sizeof(float));
for (ii=0; ii<2; ii++) { //-2001-07-02
dnum = (ii > 0) ? 0 : SpcDayNum; //-2002-08-10
sprintf(s, "T%02d", dnum); //-2001-07-07
fprintf(f, "%-4s", SpcName);
fprintf(f, " %s", s);
for (n=1; n<=nm; n++) {
ndrop = 0; //-2002-08-10
for (i=1, id=0; id vv[id] = 0;
av = 0;
for (k=0; k<24; k++, i++) {
v = *(float*)AryPtrX(&dsc, i, n);
if (v < 0) continue;
vv[id] += v;
av++;
}
if (av >= 12) vv[id] /= av;
else {
vv[id] = -1;
ndrop++;
}
}
nu = nd - ndrop;
qsort(vv, nd, sizeof(float), compare);
if (ii > 0) dnum = 0; //-2002-08-10
else if (nu < 0.9*RefDays) dnum = SpcDayNum*nu/RefDays;
i = (dnum < nd) ? dnum : nd-1;
for ( ; i>0; i--) if (vv[i] >= 0) break;
fprintf(f, YearForm, vv[i]);
}
if (ii==0 && dnum fprintf(f, " %s\n", SpcUc);
nparts++;
if (dnum == 0) break;
dnum = 0;
}
FREE(vv);
}
if (SpcHourRef > 0) {
float *vv;
int ii, ndrop, nu; //-2001-07-02
int hnum = SpcHourNum; //-2001-07-02
vv = ALLOC(nv*sizeof(float));
for (ii=0; ii<2; ii++) { //-2001-07-02
sprintf(s, "S%02d", hnum); //-2001-07-07
fprintf(f, "%-4s", SpcName);
fprintf(f, " %s", s);
for (n=1; n<=nm; n++) {
ndrop = 0;
for (i=1; i<=nv; i++) {
vv[i-1] = *(float*)AryPtrX(&dsc, i, n);
if (vv[i-1] < 0) ndrop++; //-2002-08-10
}
nu = nv - ndrop;
qsort(vv, nv, sizeof(float), compare);
if (ii > 0) hnum = 0; //-2002-08-10
else if (nu < 0.9*RefHours) hnum = SpcHourNum*nu/RefHours;
i = (hnum < nv) ? hnum : nv-1;
for ( ; i>0; i--) if (vv[i] >= 0) break;
fprintf(f, YearForm, vv[i]);
}
if (ii==0 && hnum fprintf(f, " %s\n", SpcUc);
nparts++;
if (hnum == 0) break;
hnum = 0;
}
FREE(vv);
}
TxtClr(&usr);
TxtClr(&sys);
AryFree(&dsc);
return nparts; //-2002-08-28
eX_1:
eMSG(_cant_read_$_, fn);
eX_2: eX_3: eX_4: eX_5: eX_6:
eMSG(_$_inconsistent_dimensions_, fn);
eX_10:
eMSG(_cant_read_$_, gn);
eX_11:
eMSG(_$_incompatible_structure_$_, gn, n);
}

//======================================================================= main
//
static void define_component( char *s ) {
char name[40], format[40], units[40], t[400], *pc, uc[40], un[40], tp[40];
char locale[256] = "C";
int n, dy, dd, dh, dn, nh, nd;
float fc, fn, ry, rd, rh, rn, vd;
strcpy(locale, setlocale(LC_NUMERIC, NULL)); //-2003-07-07
setlocale(LC_NUMERIC, "C");
*name = 0;
strcpy(t, s);
for (pc=t; (*pc); pc++) if (*pc == ';') *pc = ' ';
n = sscanf(t, "%s %f %f %s %f %s %f %d %d %f %d %d %f %d %f %d",
name, // name of the component
&vd, // deposition velocity
// concentration:
&fc, // conversion factor
uc, // units used
// deposition:
&fn, // conversion factor
un, // units used
// yearly average:
&ry, // reference value
&dy, // number of digits after the decimal point
// daily average:
&nd, // number of allowed exceedings (days)
&rd, // reference value for daily maximum
&dd, // number of digits after the decimal point
// hourly average:
&nh, // number of allowed exceedings (hours)
&rh, // reference value for hourly maximum
&dh, // number of digits after the decimal point
// deposition:
&rn, // reference value
&dn // number of digits after the decimal point
);
MsgLow(name);
strcpy(SpcName, name);
if (n < 16) goto done;
SpcConFac = fc;
SpcConRef = ry;
strcpy(tp, (strncmp(name, "odor",4)) ? "con" : "frq");//bp //-2004-06-10
if (dy < 0) {
sprintf(format, "\"%s%%10.3f\"", tp);
strcpy(YearForm, " %10.3e");
}
else {
sprintf(format, "\"%s%%5.%df\"", tp, dy);
sprintf(YearForm, " %%6.%df", dy);
}
strcpy(SpcConForm, format);
strcpy(SpcUc, uc);
sprintf(units, "\"%s\"", uc);
strcpy(SpcConUnit, units);
SpcDayNum = nd;
SpcDayRef = rd;
if (rd <= 0) nd = -1;
if (dd < 0) {
strcpy(format, "\"con%10.3e\""); //-2003-02-21
strcpy(DayForm, " %10.3e");
}
else {
sprintf(format, "\"con%%5.%df\"", dd);
sprintf(DayForm, " %%6.%df", dd);
}
strcpy(SpcDayForm, format);
SpcHourNum = nh;
SpcHourRef = rh;
if (rh <= 0) nh = -1;
if (dh < 0) {
strcpy(format, "\"con%10.3e\""); //-2003-02-21
strcpy(HourForm, " %10.3e");
}
else {
sprintf(format, "\"con%%5.%df\"", dh);
sprintf(HourForm, " %%6.%df", dh);
}
strcpy(SpcHourForm, format);
SpcDepFac = fn;
SpcDepRef = rn;
if (dn < 0) {
strcpy(format, "\"dep%10.3e\""); //-2003-02-21
}
else {
sprintf(format, "\"dep%%5.%df\"", dn);
}
strcpy(SpcDepForm, format);
sprintf(units, "\"%s\"", un);
strcpy(SpcDepUnit, units);
if (CHECK) vMsg(
"Name=%s, fc=%10.3e, ry=%10.3e, mc=%s, uc=%s, nd=%d, rd=%10.3e, md=%s, "
"fn=%10.3e, rn=%10.3e, mn=%s, un=%s\n",
SpcName, SpcConFac, SpcConRef, SpcConForm, SpcConUnit, SpcDayNum,
SpcDayRef, SpcDayForm, SpcDepFac, SpcDepRef, SpcDepForm, SpcDepUnit);
done:
setlocale(LC_NUMERIC, locale);
}

int TmoMain( char *s )
{
dP(TmoMain);
int i, n, l;
char *pc, fn[256];
if (CHECK) vMsg("TmoMain(%s)", s);
if (*s) {
pc = s;
if (*pc == '-')
switch (pc[1]) {
case '0': Nv=0; Nc=0; T0=0; Nm=0; Intervall=0;
strcpy(MntName, "work/mnt%04ld");
strcpy(YearForm, " %10.3e");
strcpy(DayForm, " %10.3e");
strcpy(HourForm, " %10.3e");
*SpcName = 0;
SpcSequ = -1;
AddMeasured = 0;
break;
case 'A': strcpy(locl, pc+2); //-2003-07-07
break;
case 'e': SpcSequ = 0;
sscanf(pc+2, "%d", &SpcSequ);
break;
case 'g': AddMeasured = 1;
break;
case 'n': sscanf(pc+2, "%d", &Nm);
break;
case 'q': MsgQuiet = 1;
sscanf(pc+2, "%d", &MsgQuiet);
break;
case 's': define_component(pc+2);
break;
default: vMsg("TalMonitor: Unbekannte Option: %s ", pc);
break;
}
else {
strcpy(Path, pc);
l = strlen(Path);
for (i=0; i if ((l) && (Path[l-1]!='/') && (Path[l-1]!=':')) {
Path[l] = '/';
Path[l+1] = 0;
}
}
return 0;
}
if (SpcSequ >= 0) {
n = TmoEvalSeries(SpcSequ);
return n;
}
if (Nm < 1) return 0;
if (SpcConRef <= 0) return 0;
MntX = ALLOC(Nm*sizeof(float));
MntY = ALLOC(Nm*sizeof(float));
MntZ = ALLOC(Nm*sizeof(float));
MntI = ALLOC(Nm*sizeof(int));
MntJ = ALLOC(Nm*sizeof(int));
MntK = ALLOC(Nm*sizeof(int));
GrdL = ALLOC(Nm*sizeof(int));
GrdI = ALLOC(Nm*sizeof(int));
n = 0;
for (i=1; i<=Nm; i++) {
ReadMntValues(i); eG(1);
n = AddValues(i); eG(3);
if (n) break;
AryFree(&MntAry);
}
if (n) vMsg(_no_concentration_$_, SpcName);
else { //-2002-07-07
vMsg(_time_series_$_, SpcName);
sprintf(fn, "%s-%s", SpcName, CfgMntAddString); //-2006-10-31
WriteSpcValues(fn); eG(4);
vMsg(_$$_written_, Path, fn);
}
TxtClr(&MntNames);
TxtClr(&UsrHeader);
TxtClr(&SysHeader);
AryFree(&SpcAry);
for (i=0; ;i++) {
if (!Names[i]) break;
FREE(Names[i]);
}
FREE(Names);
FREE(MntX);
FREE(MntY);
FREE(MntZ);
FREE(MntI);
FREE(MntJ);
FREE(MntK);
FREE(GrdL);
FREE(GrdI);
return 0;
eX_1: eX_3:
eMSG(_error_calculation_);
eX_4:
eMSG(_error_writing_);
}

//=============================================================================
//
// history:
//
// 2002-06-21 lj 0.13.0 final test version
// 2002-07-04 lj 0.13.1 rounding for values of seconds
// 2002-07-07 lj 0.13.2 message, if no concentration available
// 2002-08-28 lj 0.13.3 return of nparts in TmoEvalSeries()
// 2002-09-24 lj 1.0.0 final release candidate
// 2003-02-21 lj 1.1.1 optional scientific notation
// 2004-06-10 lj 2.0.0 output format for odor
// 2005-03-17 uj 2.2.0 version number upgrade
// 2006-10-26 lj 2.3.0 external strings
// 2006-10-31 lj 2.3.1 configuration data
// 2007-02-03 uj 2.3.5 rounding of seconds corrected
//
//=============================================================================


Google
  Web www.Petersen-Kade.com