EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Possible improvements to simulation mode [patch]
From: "Denison, PN \(Peter\)" <[email protected]>
To: <[email protected]>
Date: Fri, 30 Sep 2005 20:11:49 +0100
During a recent training course, it became clear that the simulation mode of some records is not as useful as it could be.

Specifically, when in simulation mode (SIMM="YES"), the simulation value is fetched through the SIOL link into SVAL, and then copied into VAL. Thus, simulation mode can only use the cooked values after conversion, and not simulate the input from hardware. I'm sure this was fine for its original purpose, but it would be nice to also be able to simulate real input, and test the record processing.

I propose that the simulate mode (SIMM) be extended from a NO/YES menu to a NO/YES/RAW menu, with the RAW mode writing the SVAL into RVAL, and then performing conversion as normal. I enclose a (tested) patch with the infrastructure and the mbbiRecord altered to implement this behaviour. Other input-type records can clearly be altered in a similar way, but what happens to output-type records may require a little more thought.

I know that the records in base are stable and change rarely, for very good reason. However, I believe this change is completely backward-compatible, and would not affect any existing databases. (That is why I left the name of the cooked-simulation mode as YES, and didn't change it to COOKED)

If the patch is acceptable, I can provide a patch for the other input-type records, and have a think about the others.

Comments?

Peter Denison, Senior Software Engineer
Diamond Light Source Ltd., Diamond House, Chilton, Didcot, Oxon, OX11 0DE
Tel: +44 1235 778511

Patch against R3.14.7:

--- src/db/menuSimm.dbd	(revision 0)
+++ src/db/menuSimm.dbd	(revision 0)
@@ -0,0 +1,14 @@
+#*************************************************************************
+# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
+#     National Laboratory.
+# Copyright (c) 2002 The Regents of the University of California, as
+#     Operator of Los Alamos National Laboratory.
+# EPICS BASE Versions 3.14.7
+# and higher are distributed subject to a Software License Agreement found
+# in file LICENSE that is included with this distribution. 
+#*************************************************************************
+menu(menuSimm) {
+	choice(menuSimmNO,"NO")
+	choice(menuSimmYES,"YES")
+	choice(menuSimmRAW,"RAW")
+}
--- src/db/menuGlobal.dbd	(revision 328)
+++ src/db/menuGlobal.dbd	(working copy)
@@ -17,3 +17,4 @@
 include "menuPriority.dbd"
 include "menuScan.dbd"
 include "menuYesNo.dbd"
+include "menuSimm.dbd"
--- src/db/Makefile	(revision 328)
+++ src/db/Makefile	(working copy)
@@ -44,6 +44,7 @@
 DBDINC += menuPriority
 DBDINC += menuScan
 DBDINC += menuYesNo
+DBDINC += menuSimm
 
 INC += dbCommon.h
 
--- src/rec/mbbiRecord.c	(revision 328)
+++ src/rec/mbbiRecord.c	(working copy)
@@ -29,6 +29,7 @@
 #include "dbFldTypes.h"
 #include "devSup.h"
 #include "errMdef.h"
+#include "menuSimm.h"
 #include "recSup.h"
 #include "recGbl.h"
 #include "special.h"
@@ -348,20 +349,31 @@
 	}
 
 	status=dbGetLink(&(pmbbi->siml),DBR_USHORT,&(pmbbi->simm),0,0);
-	if (status)
+	if (status) {
 		return(status);
+	}
 
-	if (pmbbi->simm == NO){
+	if (pmbbi->simm == menuSimmNO){
 		status=(*pdset->read_mbbi)(pmbbi);
 		return(status);
 	}
-	if (pmbbi->simm == YES){
+	if (pmbbi->simm == menuSimmYES){
 		status=dbGetLink(&(pmbbi->siol),DBR_USHORT,&(pmbbi->sval),0,0);
 		if (status==0){
 			pmbbi->val=pmbbi->sval;
 			pmbbi->udf=FALSE;
 		}
                 status=2; /* dont convert */
+	}
+	if (pmbbi->simm == menuSimmRAW){
+		status=dbGetLink(&(pmbbi->siol),DBR_USHORT,&(pmbbi->sval),0,0);
+		if (status==0){
+			pmbbi->rval=pmbbi->sval;
+			pmbbi->udf=FALSE;
+		}
+                status=0; /* convert since we've written RVAL */
 	} else {
 		status=-1;
 		recGblSetSevr(pmbbi,SOFT_ALARM,INVALID_ALARM);
--- src/rec/mbbiRecord.dbd	(revision 328)
+++ src/rec/mbbiRecord.dbd	(working copy)
@@ -458,7 +458,7 @@
 	field(SIMM,DBF_MENU) {
 		prompt("Simulation Mode")
 		interest(1)
-		menu(menuYesNo)
+		menu(menuSimm)
 	}
 	field(SIMS,DBF_MENU) {
 		prompt("Sim mode Alarm Svrty")







Replies:
Re: Possible improvements to simulation mode [patch] Steve Lewis

Navigate by Date:
Prev: RE: Channel access problem on cygwin IOC Jeff Hill
Next: Re: Possible improvements to simulation mode [patch] Steve Lewis
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: ASL field Liyu, Andrei
Next: Re: Possible improvements to simulation mode [patch] Steve Lewis
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·