- fixed a little bug with hkl: phi limits were not properly tested

- updated powder file writing to properly work with mean and stddev
This commit is contained in:
cvs
2000-05-10 11:45:33 +00:00
parent 1329c3beb4
commit 7b631db965
17 changed files with 183 additions and 286 deletions

View File

@ -51,7 +51,7 @@ VELOOBJ = velo.o velosim.o velodorn.o velodornier.o
HDFROOT=/data/koenneck
CC=cc
EXTRA=
CFLAGS = -I$(HDFROOT)/include -Ihardsup -std1 -g -warnprotos -c
CFLAGS = -I$(HDFROOT)/include -Ihardsup -I. -std1 -g -warnprotos -c
#CFLAGS = -I$(HDFROOT)/include -DFORTIFY -Ihardsup -g -std1 -warnprotos -c
LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Ltecs -ltecsl -ltcl8.0 -lfor -lmfhdf -ldf \
$(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc

View File

@ -162,6 +162,7 @@
char pTime[80];
pSicsVariable pInst = NULL;
char *pPtr = NULL;
SConnection *pIntern = NULL;
if(fauto)
{
@ -198,6 +199,23 @@
pInst->text,pTime);
WriteToCommandLog("SYS>> ", pBueffel);
}
/* if a file to execute is configured, execute it */
pPtr = NULL;
pPtr = IFindOption(pSICSOptions,"logstartfile");
if(pPtr != NULL)
{
pIntern = SCCreateDummyConnection(pServ->pSics);
if(!pIntern)
{
return;
}
SCnoSock(pIntern);
SCSetRights(pIntern,usUser);
sprintf(pBueffel,"fileeval %s",pPtr);
InterpExecute(pServ->pSics,pIntern,pBueffel);
SCDeleteConnection(pIntern);
}
}
/*----------------------------------------------------------------------
AutoTask puts a time stamp into the auto log file any hour and

View File

@ -1,3 +1,3 @@
5438
5451
NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n

View File

@ -7,7 +7,8 @@
<P>
The commandlog is a file where all communication with clients
having user or manager privilege is logged. This log allows to retrace each
step of an experiment. This log is usually switched off and must be
step of an experiment. This log is normally configured in the startup
file or can be
configured by the instrument manager. There exists a special command,
commandlog, which allows to control this log file.
<DL>
@ -27,6 +28,10 @@ Log files are written to the log directory of the instrument account. There
<DT>commandlog tail n
<DD>prints the last n entries made into the command log. n is optional and defaults to 20. Up to 1000 lines are held in an internal buffer for this command.
</DL>
It is now possible to have a script executed whenever a new log file is
started. In order to make this work a ServerOption with the name logstartfile
must exist in the instrument configuration file. The value of this option
must be the full path name of the file to execute.
</P>
</BODY>
</HTML>

View File

@ -207,39 +207,43 @@ current value.
<DT> name val
<DD> will drive the device to the new value val. Please note that the same
can be achieved by using the drive command.
<DT> name log on
<DD> Switches logging on. If logging is on, at each cycle in the
<b>emon</b>
the
current value of the environment variable will be recorded together with a
time stamp. Be careful about this, for each log point a bit of memory is
allocated. At some time the memory is exhausted! <b>Log clear</b>
frees
it again
and <b>log frequency</b> (both below)
allows to set the logging time intervall.
<DT> name log off
<DD>Switches logging off.
</DL>
<h3>Logging </h2>
The values of any sample environement device can be logged. There are two
features:
<ul>
<li>Logging to a file wih a configurable time intervall between log
file entries.
<li>Sums are kept internally which allow the calculation of the mean
value and the standard deviation at all times.
</ul>
The last system is automatically switched on after the first drive or
run command on the environment device completed.
This system is run through the following commands.
<DL>
<DT>name log clear
<DD> Clears all recorded time stamps and values.
<DT>name log gettime
<DD>This command retrieves a list of all recorded time stamps.
<DT>name log getval
<DD> This command retrieves all recorded values.
<DD> Resets all sums for the calculation of the mean value and the
standard deviation.
<DT>name log getmean
<DD>Calculates the mean value and the standard deviation for all logged
values and prints them.
<DT>name log frequency val
<DD> With a parameter sets, without a parameter requests the logging intervall
for the log created. This parameter specifies the time intervall in seconds
for the log file.
This parameter specifies the time intervall in seconds
between log records. The default is 300 seconds.
<DT>name log file filename
<DD> Starts logging of value data to the file filename. All normal logging to
memory will be
disabled. Logging will happen any 5 minutes initially. The logging frequency
<DD> Starts logging of value data to the file filename.
Logging will happen any 5 minutes initially. The logging frequency
can be changed with the name log frequency command. Each entry in the file is
of the form date time value. The name of the file must be specified relative
to the SICS server.
<DT>name log flush
<DD>DigitalUnix buffers output heavily. With this command an update of
the file can be enforced.
<DT>name log status
<DD>Queries if logging to file is currently happening or not.
<DT>name log close
<DD> Stops logging data to the file.
</DL>

View File

@ -670,7 +670,7 @@
}
/* new var log for logging values */
pRes->iLog = 0;
pRes->iLog = 1;
if(!VarlogInit(&pRes->pLog))
{
DeleteEVController(pRes);
@ -942,7 +942,7 @@
SCWrite(pCon,"ERROR: insufficient number of commands for varlog",eError);
return 0;
}
iRet = VarlogWrapper(self->pLog,&self->iLog, pCon,
iRet = VarlogWrapper(self->pLog,pCon,
argv[2],argv[3],argv[0]);
if(iRet)
{
@ -981,7 +981,7 @@
SCWrite(pCon,"ERROR: insufficient number of commands for varlog",eError);
return 0;
}
return VarlogWrapper(self->pLog,&self->iLog, pCon,
return VarlogWrapper(self->pLog,pCon,
argv[2],argv[3],argv[0]);
}
else /* parameter request */

4
hkl.c
View File

@ -867,13 +867,15 @@
{
fSet[2] = 360.0 + fSet[2];
}
/*
if(fSet[3] < 0.0)
{
fSet[3] = 360.0 + fSet[3];
}
*/
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pChi,fSet[2], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pPhi,fSet[4], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pPhi,fSet[3], &fHard,pError,131);
if(iTest == 3) /* none of them burns */
{
sprintf(pBueffel,"Solution found at psi = %4.1f",myPsi);

2
mumo.c
View File

@ -509,7 +509,7 @@
}
pName = strtok(NULL," ");
}
if(iTest == 1)
if(iTest == 1 && (strcmp(pAlias,"back") != 0) )
return pAlias;
pAlias = StringDictGetNext(self->pNamPos,pTestCommand,1063);

View File

@ -1,9 +1,6 @@
/*--------------------------------------------------------------------------
N X D A T A
a module of utility functions which serve to write Nexus
data files.
This implements the data file writing for the Powder diffractometers
HRPT and DMC.
@ -63,6 +60,8 @@
#include "danu.h"
#include "HistMem.h"
#include "udpquieck.h"
#include "evcontroller.h"
#define DMCDETNAM "DMC-BF3-Detector"
#define DMCDETOB "detector"
@ -478,6 +477,8 @@
int32 *iTVal = NULL;
pDummy pDum;
int bHRPT = 0;
float fMean, fStdDev;
pVarLog pLog = NULL;
/* open the file & entry */
Nfil = SNXStartFile(pCon,pSics);
@ -762,7 +763,6 @@
pMot = FindMotor(pSics,"a4");
assert(pMot);
iStat = MotorGetSoftPosition(pMot,pCon,&fStart);
assert(iStat);
iStat = SNputdata1att(Nfil,"two_theta_start",DFNT_FLOAT32,1,
&fStart,"Units","degrees");
if(!iStat)
@ -830,7 +830,16 @@
pDrive = pDum->pDescriptor->GetInterface(pDum,DRIVEID);
if(pDrive) /* a proper environment device */
{
fVal = pDrive->GetValue(pDum,pCon);
pLog = EVCGetVarLog( (pEVControl)pCom->pData);
if(pLog)
{
VarlogGetMean(pLog,&fMean,&fStdDev);
SNputdata1att(Nfil,"temperature_mean",DFNT_FLOAT32, 1,&fMean,
"Units","K");
SNputdata1att(Nfil,"temperature_stddev",DFNT_FLOAT32, 1,
&fStdDev,"Units","K");
}
fVal = pDrive->GetValue(pCom->pData,pCon);
}
else /* a simple variable */
{

2
scan.c
View File

@ -357,7 +357,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
pVar = (pVarEntry)pPtr;
if(pVar)
{
sprintf(pItem,"%-10.10s",pVar->Name);
sprintf(pItem,"%-9.9s ",pVar->Name);
strcat(pLine,pItem);
sprintf(pItem,"%s, ",pVar->Name);
strcat(pInfo,pItem);

View File

@ -23,7 +23,7 @@ th InterruptMode 0.000000
th AccessCode 2.000000
#Crystallographic Settings
hkl lambda 1.178100
hkl setub 0.217614 0.141834 -0.048542 0.151125 -0.057954 0.087584 0.070284 -0.314535 -0.038027
hkl setub -0.154751 -0.003824 -0.019538 0.049741 -0.005912 -0.061157 0.003550 -0.083854 0.005203
det1dist 300.
det1dist setAccess 1
det1zeroy 128.
@ -60,8 +60,8 @@ ch InterruptMode 0.000000
ch AccessCode 2.000000
# Motor ph
ph SoftZero 0.000000
ph SoftLowerLim 0.000000
ph SoftUpperLim 360.000000
ph SoftLowerLim -200.000000
ph SoftUpperLim 100.000000
ph Fixed -1.000000
ph sign 1.000000
ph InterruptMode 0.000000
@ -84,8 +84,8 @@ muca InterruptMode 0.000000
muca AccessCode 2.000000
# Motor phi
phi SoftZero 0.000000
phi SoftLowerLim 0.000000
phi SoftUpperLim 360.000000
phi SoftLowerLim -200.000000
phi SoftUpperLim 100.000000
phi Fixed -1.000000
phi sign 1.000000
phi InterruptMode 0.000000
@ -117,7 +117,7 @@ twotheta AccessCode 2.000000
lastscancommand sscan ch 180 190 10 2
lastscancommand setAccess 2
banana CountMode timer
banana preset 2.000000
banana preset 180.000000
sample_mur 0.000000
sample_mur setAccess 2
email Uwe.Nurps@nurps.nurpstown.de
@ -243,6 +243,38 @@ d1r Fixed -1.000000
d1r sign 1.000000
d1r InterruptMode 0.000000
d1r AccessCode 2.000000
# Motor monochi
monochi SoftZero 0.000000
monochi SoftLowerLim -30.000000
monochi SoftUpperLim 30.000000
monochi Fixed -1.000000
monochi sign 1.000000
monochi InterruptMode 0.000000
monochi AccessCode 2.000000
# Motor monophi
monophi SoftZero 0.000000
monophi SoftLowerLim -30.000000
monophi SoftUpperLim 30.000000
monophi Fixed -1.000000
monophi sign 1.000000
monophi InterruptMode 0.000000
monophi AccessCode 2.000000
# Motor monoy
monoy SoftZero 0.000000
monoy SoftLowerLim -30.000000
monoy SoftUpperLim 30.000000
monoy Fixed -1.000000
monoy sign 1.000000
monoy InterruptMode 0.000000
monoy AccessCode 2.000000
# Motor monox
monox SoftZero 0.000000
monox SoftLowerLim -30.000000
monox SoftUpperLim 30.000000
monox Fixed -1.000000
monox sign 1.000000
monox InterruptMode 0.000000
monox AccessCode 2.000000
# Motor tasse
tasse SoftZero 10.000000
tasse SoftLowerLim -140.000000
@ -365,9 +397,9 @@ a1 InterruptMode 0.000000
a1 AccessCode 2.000000
user Joseph Stalin
user setAccess 2
sample Wuergehals = doof, bloed und dumm
sample EB:12mm
sample setAccess 2
title Nasse Fische in Dosen
title setAccess 2
starttime 2000-03-31 11:40:31
starttime 2000-04-14 14:34:41
starttime setAccess 2

View File

@ -11,6 +11,7 @@ proc SplitReply { text } {
#--------------------------------------------------------------------------
proc count { {mode NULL } { preset NULL } } {
starttime [sicstime]
catch {temperature log clear} msg
#----- deal with mode
set mode2 [string toupper $mode]
set mode3 [string trim $mode2]
@ -37,7 +38,7 @@ proc count { {mode NULL } { preset NULL } } {
banana count
set ret [catch {Success} msg]
#------- StoreData
# StoreData
StoreData
if { $ret != 0 } {
error [format "Counting ended with error"]
}

View File

@ -9,6 +9,8 @@ OBJ= tecs_cli.o coc_client.o coc_util.o err_handling.o \
#------------ for DigitalUnix (add -DFORTIFY to CFLAGS for fortified version)
CC=cc
#CFLAGS= -std1 -g -c -warnprotos -I../ -I. -I../hardsup -DFORTIFY
CFLAGS= -std1 -g -warnprotos -I../ -I. -I../hardsup
.f.o:

View File

@ -6,6 +6,7 @@
#endif
#include <stdio.h>
#include <sys/errno.h>
#include <fortify.h>
/* ErrHDL Error handling utilities
-------------------------------

View File

@ -30,11 +30,13 @@ ServerOption ReadUserPasswdTimeout 7000
ServerOption LogFileDir $shome/log
#LogFileDir is the directory where the command log is going
#ServerOption logstartfile $shome/sics/start.tcl
ServerOption LogFileBaseName $shome/sics/tmp/server
# the path and base name of the internal server logfile to which all
# activity will be logged.
ServerOption TecsStartCmd "tecs/TecsServer -h lnsp21:4000/7"
ServerOption TecsStartCmd "tecs/TecsServer -h lnsp26:4000/0"
# -h host:port/channel is for serial server
ServerOption TecsBinDir tecs/bin/
ServerOption TecsLogDir /data/koenneck/tmp/
@ -121,6 +123,10 @@ Motor SGL SIM -20. 20. .1 3. # sample lower goniometer
Motor SGU SIM -20. 20. .1 3. # sample upper goniometer
Motor SDM SIM -5 50. .1 3. # weird Motor
SicsAlias A4 Tasse
SicsAlias A5 MonoX
SicsAlias A5 MonoY
SicsAlias A5 MonoPhi
SicsAlias A5 MonoChi
Motor D1R SIM -20. 20. .1 3. # Diaphragm 1 right
Motor D1L SIM -20. 20. .1 3. # Diaphragm 1 left
@ -266,6 +272,9 @@ VarMake det1zeroy Text Mugger
det1zeroy 128.
VarMake det1dist Text Mugger
det1dist 300.
VarMake detstepwidth Float Mugger
detstepwidth 0.1
detstepwidth lock
MakeHKL twotheta omega chi phi chi
HKL lambda 0.70379

288
varlog.c
View File

@ -6,6 +6,12 @@
Mark Koennecke, September 1997
Substantially revised to calculate running measn and standard deviations
instead of storing data ain a list. The module now supports running
averages and logging to file.
Mark Koennecke, April 2000
Copyright:
Labor fuer Neutronenstreuung
@ -48,15 +54,14 @@
#include "varlog.h"
#include "commandlog.h"
/* maximum number of log entries, limit memory usage */
#define MAXLOG 2000
/*------------------------------------------------------------------------*/
typedef struct __VarLog
{
int iList;
time_t tFrequency;
time_t tNext;
int iCount;
double dSum;
double dDeviation;
FILE *fd;
}VarLog;
@ -79,19 +84,12 @@
pNew->tFrequency = 300; /* 5 minutes */
pNew->tNext = 0;
pNew->iCount = 0;
pNew->dSum = 0.;
pNew->dDeviation = 0.;
pNew->fd = NULL;
i = LLDcreate(sizeof(LogItem));
if(i < 0)
{
return 0;
}
else
{
pNew->iList = i;
*self = pNew;
return 1;
}
*self = pNew;
return 1;
}
/*---------------------------------------------------------------------------*/
int VarlogDelete(pVarLog self)
@ -100,7 +98,6 @@
{
fclose(self->fd);
}
LLDdelete(self->iList);
return 1;
}
/*--------------------------------------------------------------------------*/
@ -108,18 +105,10 @@
{
int iRet, iList;
iList = self->iList;
assert(iList >= 0);
iRet = LLDnodePtr2First(iList);
while(iRet != 0)
{
LLDnodeDelete(iList);
iRet = LLDnodePtr2Prev(iList);
iRet = LLDnodePtr2Next(iList);
}
self->tNext = 0;
self->iCount = 0;
self->dSum = 0.;
self->dDeviation = 0.;
self->tNext = 0;
return 1;
}
/*-------------------------------------------------------------------------*/
@ -139,6 +128,7 @@
time_t tCurrent;
int iFile = 0;
char pBuffer[80];
double dMean, dTmp;
assert(self);
@ -147,61 +137,38 @@
/* check if we are logging to file */
if(self->fd != NULL)
{
iFile = 1;
iFile = 1;
}
/* limit size of log */
if(self->iCount > MAXLOG)
{
VarlogClear(self);
WriteToCommandLog("SYS>","WARNING: variable log cleared in order to prevent memory overflow");
}
/* log always if tFrequncy is 0 */
if(self->tFrequency == 0)
{
sItem.tTime = tCurrent;
sItem.fVal = fVal;
LLDnodeAppendFrom(self->iList, &sItem);
self->iCount++;
}
/* update the running mean */
self->dSum += fVal;
self->iCount++;
dMean = self->dSum/self->iCount;
dTmp = fVal - dMean;
self->dDeviation += dTmp*dTmp;
/* if not initialised, do it */
if(self->tNext < 1)
{
sItem.tTime = tCurrent;
sItem.fVal = fVal;
if(iFile)
{
VLFormatTime(tCurrent,pBuffer,79);
fprintf(self->fd," %s %f \n", pBuffer,fVal);
}
else
{
LLDnodeAppendFrom(self->iList, &sItem);
self->iCount++;
}
self->tNext = tCurrent + self->tFrequency;
return 1;
}
/* if, log time passed, do it */
/* if, log time passed, write to file */
if(tCurrent > self->tNext)
{
sItem.tTime = tCurrent;
sItem.fVal = fVal;
if(iFile)
{
VLFormatTime(tCurrent,pBuffer,79);
fprintf(self->fd," %s %f \n", pBuffer,fVal);
}
else
{
LLDnodeAppendFrom(self->iList, &sItem);
self->iCount++;
}
self->tNext = tCurrent + self->tFrequency;
return 1;
}
@ -210,115 +177,31 @@
/*--------------------------------------------------------------------------*/
int VarlogLength(pVarLog self, int *iLength)
{
int iLang, iRet, iList;
iList = self->iList;
assert(iList >= 0);
iLang = 0;
iRet = LLDnodePtr2First(iList);
while(iRet != 0)
{
iLang++;
iRet = LLDnodePtr2Next(iList);
}
*iLength = iLang;
return 1;
}
/*---------------------------------------------------------------------------*/
int VarlogGetTime(pVarLog self, time_t *tTime)
{
int iRet, i, iList;
LogItem sItem;
iList = self->iList;
assert(iList >= 0);
i = 0;
iRet = LLDnodePtr2First(iList);
while(iRet != 0)
{
LLDnodeDataTo(iList,&sItem);
tTime[i] = sItem.tTime;
i++;
iRet = LLDnodePtr2Next(iList);
}
return 1;
}
/*---------------------------------------------------------------------------*/
int VarlogGetVal(pVarLog self, float *fValue)
{
int iRet, i, iList;
LogItem sItem;
iList = self->iList;
assert(iList >= 0);
i = 0;
iRet = LLDnodePtr2First(iList);
while(iRet != 0)
{
LLDnodeDataTo(iList,&sItem);
fValue[i] = sItem.fVal;
i++;
iRet = LLDnodePtr2Next(iList);
}
*iLength = self->iCount;
return 1;
}
/*---------------------------------------------------------------------------*/
int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev)
{
int i, iLength = 0, iList;
float fM, fStd, fSum,fD, *fVal = NULL;
double dMean, dStdDev;
iList = self->iList;
assert(iList >= 0);
VarlogLength(self,&iLength);
if(iLength < 1) /* nothing to do */
if(self->iCount > 0)
{
*fMean = 0.;
*fStdDev = 0.;
return 0;
dMean = self->dSum/(double)self->iCount;
dStdDev = sqrt(self->dDeviation/(double)self->iCount);
}
/* get some memory for values */
fVal = (float *)malloc(iLength*sizeof(float));
if(!fVal)
else
{
*fMean = 0.;
*fStdDev = 0.;
return 0;
dMean = .0;
dStdDev = .0;
}
/* get values */
VarlogGetVal(self, fVal);
/* calculate mean first */
fSum = 0.;
for(i = 0; i < iLength; i++)
{
fSum += fVal[i];
}
fM = fSum/(float)iLength;
/* do standard deviation */
fSum = 0.;
for(i = 0; i < iLength; i++)
{
fD = fM - fVal[i];
fSum += fD*fD;
}
fStd = sqrt(fSum/(float)iLength);
*fMean = fM;
*fStdDev = fStd;
free(fVal);
*fMean = (float)dMean;
*fStdDev = (float)dStdDev;
return 1;
}
/*--------------------------------------------------------------------------*/
int VarlogWrapper(pVarLog self, int *iSwitch, SConnection *pCon,
int VarlogWrapper(pVarLog self, SConnection *pCon,
char *subcommand, char *sub2, char *pVarName)
{
float fMean, fStdDev, *fData = NULL;
@ -329,22 +212,9 @@
long lNew;
iList = self->iList;
strtolower(subcommand);
/*------------ on */
if(strcmp(subcommand,"on") == 0)
{
*iSwitch = 1;
return 1;
}
/*----------- off */
else if(strcmp(subcommand,"off") == 0)
{
*iSwitch = 0;
return 1;
}
/*--------- file */
else if(strcmp(subcommand,"file") == 0)
if(strcmp(subcommand,"file") == 0)
{
if(self->fd != NULL)
{
@ -363,10 +233,19 @@
{
self->tFrequency = 300;
}
*iSwitch = 1;
SCSendOK(pCon);
return 1;
}
/*----- flush */
else if(strcmp(subcommand,"flush") == 0)
{
if(self->fd != NULL)
{
fflush(self->fd);
}
SCSendOK(pCon);
return 1;
}
/*----- close */
else if(strcmp(subcommand,"close") == 0)
{
@ -375,82 +254,20 @@
fclose(self->fd);
self->fd = NULL;
}
*iSwitch = 0;
SCSendOK(pCon);
return 1;
}
/* ------------ gettime */
else if(strcmp(subcommand,"gettime") == 0)
/*----- status */
else if(strcmp(subcommand,"status") == 0)
{
iRet = VarlogLength(self, &iLength);
if(!iRet)
if(self->fd != NULL)
{
SCWrite(pCon,"ERROR: Invalid logging list",eError);
return 0;
SCWrite(pCon,"Logging to file on",eValue);
}
pTArray = (time_t *)malloc(iLength * sizeof(time_t));
if(!pTArray)
else
{
SCWrite(pCon,"ERROR: out of memory in varlog",eError);
return 0;
SCWrite(pCon,"No Logging to file",eValue);
}
VarlogGetTime(self,pTArray);
/* format into a string */
pData = (char *)malloc((iLength*35+100)*sizeof(char));
if(!pData)
{
SCWrite(pCon,"ERROR: out of memory in varlog",eError);
return 0;
}
memset(pData,0,(iLength*35+100)*sizeof(char));
sprintf(pData,"%s.TimeStaamps = {",pVarName);
for(i = 0; i < iLength; i++)
{
strcat(pData,",");
VLFormatTime(pTArray[i],pBueffel,80);
strcat(pData,pBueffel);
}
strcat(pData,"}");
SCWrite(pCon,pData,eValue);
free(pTArray);
free(pData);
return 1;
}
/*------------ getval */
else if(strcmp(subcommand,"getval") == 0)
{
iRet = VarlogLength(self, &iLength);
if(!iRet)
{
SCWrite(pCon,"ERROR: Invalid logging list",eError);
return 0;
}
fData = (float *)malloc(iLength * sizeof(float));
if(!fData)
{
SCWrite(pCon,"ERROR: out of memory in varlog",eError);
return 0;
}
memset(fData,0,iLength *sizeof(float));
VarlogGetVal(self,fData);
/* format a reply */
pData = (char *)malloc((iLength*11+50)*sizeof(char));
if(!pData)
{
SCWrite(pCon,"ERROR: out of memory in varlog",eError);
return 0;
}
memset(pData,0,(iLength*11+50)*sizeof(char));
sprintf(pData,"%s.Values = {",pVarName);
for(i = 0; i < iLength; i++)
{
strcat(pData,",");
sprintf(pBueffel,"%8.2f",fData[i]);
strcat(pData,pBueffel);
}
SCWrite(pCon,pData,eValue);
free(fData);
free(pData);
return 1;
}
/*--------- getmean */
@ -470,7 +287,6 @@
/*------------ clear */
else if(strcmp(subcommand,"clear") == 0)
{
*iSwitch = 0;
return VarlogClear(self);
}
/*------------- frequency */

View File

@ -23,11 +23,9 @@
int VarlogAdd(pVarLog self, float fVal);
/*------------------------------ data recovery -------------------------*/
int VarlogLength(pVarLog self, int *iLength);
int VarlogGetTime(pVarLog self, time_t *tTime);
int VarlogGetVal(pVarLog self, float *fValues);
int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);
/*------------------------------ interpreter ---------------------------*/
int VarlogWrapper(pVarLog self, int *iSwitch, SConnection *pCon,
int VarlogWrapper(pVarLog self, SConnection *pCon,
char *subcommand, char *sub2,char *pVarName);
#endif