add circles demo

This commit is contained in:
Michael Davidsaver
2016-03-27 16:19:42 +09:00
parent 480698be67
commit de4af82e92
8 changed files with 124 additions and 0 deletions

6
iocBoot/Makefile Normal file
View File

@ -0,0 +1,6 @@
TOP = ..
include $(TOP)/configure/CONFIG
DIRS += $(wildcard *ioc*)
DIRS += $(wildcard as*)
include $(CONFIG)/RULES_DIRS

18
iocBoot/README Normal file
View File

@ -0,0 +1,18 @@
Demo IOCs
ioccircle and ioccircle together demonstrate PVA groups and links.
ioccircle maintains a "phase" counter which counts from 0 to 359
then rolls over.
From this phase are calculated an X and Y which are points on a circule with radius 1.
A group PVA PV is defined which includes both and X and Y.
ioccircle2 contains two calc records which subscribe to the X and Y
from ioccircle and multiply each by 2.
A second group PVA PV is defined including the multipled X and Y.
Due to the atomicity of a group PV it is certain that pairs of
X and Y will not be mixed. In this example, the magnitude
sqrt(X*X+Y*Y) will never change by more than floating point epsilon.

View File

@ -0,0 +1,5 @@
TOP = ../..
include $(TOP)/configure/CONFIG
ARCH = linux-x86_64-debug
TARGETS = envPaths
include $(TOP)/configure/RULES.ioc

View File

@ -0,0 +1,53 @@
record(ao, "circle:step") {
field(VAL , "1.0")
field(DRVL, "0.0")
field(DRVH, "359")
field(PINI, "YES")
# field(TPRO, "1")
}
record(ao, "circle:period") {
field(VAL , "1.0")
field(PINI, "YES")
field(OUT , "circle:y.ODLY NPP")
# field(TPRO, "1")
}
record(calc, "circle:angle") {
field(PINI, "RUNNING")
# field(SCAN, "2 second")
field(INPA, "circle:angle NPP")
field(INPB, "circle:step NPP")
field(INPD, "360")
field(CALC, "C:=A+B;(C>D)?C-D:C")
field(FLNK, "circle:x")
field(PREC, "3")
# field(TPRO, "1")
info(pdbGroup, "circle|angle=VAL")
}
record(calc, "circle:x") {
field(INPA, "circle:angle NPP")
field(CALC, "cos(A*PI/180)")
field(TSEL, "circle:angle.TIME")
field(FLNK, "circle:y")
field(PREC, "3")
info(pdbGroup, "circle|x=VAL")
}
record(calc, "circle:y") {
field(INPA, "circle:angle NPP")
field(CALC, "sin(A*PI/180)")
field(TSEL, "circle:angle.TIME")
field(PREC, "3")
field(FLNK, "circle:tick")
info(pdbGroup, "circle|y=VAL")
info(pdbTrigger,"circle|y>*")
}
record(calcout, "circle:tick") {
field(ODLY, "1.0")
field(OUT , "circle:angle.PROC CA") # loop
# field(TPRO, "1")
}

5
iocBoot/ioccircle/st.cmd Executable file
View File

@ -0,0 +1,5 @@
#!../../bin/linux-x86_64-debug/softIocPVA
dbLoadRecords("circle.db","")
iocInit()

View File

@ -0,0 +1,5 @@
TOP = ../..
include $(TOP)/configure/CONFIG
ARCH = linux-x86_64-debug
TARGETS = envPaths
include $(TOP)/configure/RULES.ioc

View File

@ -0,0 +1,27 @@
record(calc, "circle2:x") {
field(INPA, "pva://circle.x CP")
field(CALC, "2*A")
field(FLNK, "circle2:y")
info(pdbGroup, "circle2|x=VAL")
# field(TPRO, "1")
}
record(calc, "circle2:y") {
field(INPA, "pva://circle.y")
field(CALC, "2*A")
field(TSEL, "circle2:x.TIME")
field(FLNK, "circle2:mag")
info(pdbGroup, "circle2|y=VAL")
# field(TPRO, "1")
}
record(calc, "circle2:mag") {
field(INPA, "circle2:x NPP")
field(INPB, "circle2:y NPP")
field(CALC, "SQRT(A*A+B*B)")
field(MDEL, "-1")
field(TSEL, "circle2:x.TIME")
info(pdbGroup, "circle2|mag=VAL")
info(pdbTrigger,"circle2|mag>*")
# field(TPRO, "1")
}

5
iocBoot/ioccircle2/st.cmd Executable file
View File

@ -0,0 +1,5 @@
#!../../bin/linux-x86_64-debug/softIocPVA
dbLoadRecords("circle2.db","")
iocInit()