Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Calculation in SNL/SEQ
From: "liuping" <liuping@sinap.ac.cn>
To: <tech-talk@aps.anl.gov>
Date: Wed, 11 May 2011 10:35:11 +0800

Hello,

I need your help about the calculation in SNL/SEQ.

In my SNL/SEQ application, I need to execute the mathematical operation: fabs() and exp().

Here is the codes abstracted from the my application:

%%/////////////////////

double   temp;

  double  err;

  double  r1;

  double  r2;

 

  ss test123{ 

         state calctest

        { 

           when(delay(2))

           {

                r1=1.0;

               r2=2.0;

                temp=fabs(r1-r2);

                printf("fabs:  %lf\n",temp);

                temp=exp(r1+r2);

                printf("exp:  %lf\n", temp);  

           } state calctest

        }

   }

%%//////////////////////////

 

The operation result is:

fabs:  1.000000

exp:  2287528.000000

fabs:  1.000000

exp:  2287528.000000

fabs:  1.000000

exp:  2287528.000000

……

Obviously, the result of “fabs” is right, and the other is wrong. Then I check the output of compiler. There are two warning and no error (see the bold and incline words).

.....

make[3]: Entering directory `/home/blctrl/watercool-Mono/motorApp/OmsSrc/O.vxWorks-ppc604_long'

converting ../sncExample.stt

/home/blctrl/seq-2.0.11/bin/linux-x86/snc    ../sncExample.stt -o sncExample.c.tmp

mv sncExample.c.tmp sncExample.c

/BLC/epics/Tornado2.2/host/x86-linux/bin/ccppc -c   -D_POSIX_SOURCE       -DCPU=PPC604  -DvxWorks -include /BLC/epics/Tornado2.2/target/h/vxWorks.h  -ansi  -O3  -Wall     -mcpu=604 -mstrict-align -mlongcall    -fno-builtin  -I. -I.. -I../../../include/os/vxWorks -I../../../include -I/home/blctrl/asyn4-8/include/os/vxWorks -I/home/blctrl/asyn4-8/include -I/home/blctrl/seq-2.0.11/include/os/vxWorks -I/home/blctrl/seq-2.0.11/include -I/BLC/epics/base/include/os/vxWorks -I/BLC/epics/base/include      -I/BLC/epics/Tornado2.2/target/h  sncExample.c

../sncExample.stt: In function `A_test123_calctest':

../sncExample.stt:38: warning: implicit declaration of function `fabs'

../sncExample.stt:40: warning: implicit declaration of function `exp'

perl /BLC/epics/base/bin/linux-x86/registerRecordDeviceDriver.pl ../O.Common/omsMAXv.dbd omsMAXv_registerRecordDeviceDriver > temp.cpp

mv temp.cpp omsMAXv_registerRecordDeviceDriver.cpp

.....

 

Again, I tried to do such process:

1)Power off the VME rack,

2)Change the value of r1 and r2:    r1=9.0;    r2=12.0;

3)make clean

4)make

5)Power on the VME rack

 

Sadly I saw the result was same to last test:

fabs:  1.000000

exp:  2287528.000000

fabs:  1.000000

exp:  2287528.000000

fabs:  1.000000

exp:  2287528.000000

……

The result of “fabs” and “exp” are both wrong. Who can tell me the reason and how to get the right result?

Any advices are appreciated!

 

===================================
 

LIU Ping

 

Beamline Control Group
Shanghai Synchrotron Radiation Facility
Shanghai Institute of Applied Physics
Chinese Academy of Sciences
Zhangheng Rd 239,Pudong Dist.,
Shanghai 201204
China
Tel:+86-21-33933237(Lab)

 

http://ssrf.sinap.ac.cn
===================================

 


Replies:
Re: Calculation in SNL/SEQ Chestnut, Ronald P.
Re: Calculation in SNL/SEQ Dirk Zimoch

Navigate by Date:
Prev: asynPortDriver callbacks to I/O Intr, how to propagate an error? Angus Gratton
Next: Re: Disconnected PVs Matt Newville
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: RE: asynPortDriver callbacks to I/O Intr, how to propagate an error? Mark Rivers
Next: Re: Calculation in SNL/SEQ Chestnut, Ronald P.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·