1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 <2014> 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 <2014> 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: How to perform Loop in VDCT |
From: | "Mooney, Tim M." <[email protected]> |
To: | priya tiwari <[email protected]>, "[email protected]" <[email protected]> |
Date: | Thu, 13 Nov 2014 17:22:26 +0000 |
Hi Priya,
I would do this with a subroutine record or an SNL program. Yes, you can make loops in EPICS database, but I would not implement your example in that way. If I had to do this kind of stuff in a database - for example, if I had to be able to write the _expression_ at run time - I'd use an acalcout record, and part of the _expression_ for your example would look like this: sum(100*(ix%2)[0,9])+sum(-100*(!(ix%2))[0,9])
where, for example ix is (0,1,2,3,...) ix%2 is (0,1,0,1,...) ix[0,9] is (0,1,2,3,4,5,6,7,8,9,0,0,0,...) If you're really desperate for an explicit loop, the acalcout and scalcout records have the "until" function: a:=0;b:=0;k:=until(a:=a+1.3;b:=b+1;b>=9);a which is arcane, and difficult, and merely implements this: a=0; for (b=0; b<10; b+=1) { a += 1.3; } If you want to process records in a loop, on the other hand, I second Bob's advice, and note that the calcout record has more help for conditionally executing a link. Finally, the sscan record does loops, and I've used it with calc records to make 2D arrays of sample data. Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov) Advanced Photon Source, Argonne National Lab From: [email protected] [[email protected]] on behalf of priya tiwari [[email protected]]
Sent: Thursday, November 13, 2014 12:51 AM To: [email protected] Subject: How to perform Loop in VDCT How to perform "for loop" in VDCT?
I want to try this program in VDCT .float avg;
int sum=0;int i,j;
for (i=0;i<20;i++)
{ for(j=0;j<10;j++)
{ if(j%2==0)
{ sum=sum+100;
}
else
{ diff=-100;
}
avg=(sum+diff)/10;
printf("%f",avg);
}
}
what type of record and field is used for this program in VDCT?
please provide me solution?
Thanks in advance......
|