Hello tech talkers,
1. I am trying to add the following functionality in my stream device x-ray apps:
Basically I want to kill the x-ray flux based on a timer (an auto shut off timer) if the x-ray is continuously firing upto the set time. I want to give the end user, the ability to set this time.
Currently the way I do this is using a sequencer code (see attached file), But I think it is better to use the countdownTimer records provided in stdApp. So I decided to test it out. The problem I encountered is that when I set the trigger PV to the xray on/off record ($(P):ON), at the end of the countdown, the xray does not turn on or off. So as another test I tried to trigger the sim detector acquire PV (from area detector) using the countdownTimer records, and this worked. Looking at the record types, I see that the acquire PV for sim detector is a busy record. Now when I change the xray on/off to a busy record instead of bo, I get this error:
dbLoadRecords("db/devsri.db","P=VPFI:SRI:xray,PORT=L0,A=0")
Can't set "VPFI:SRI:xray:ON.DTYP" to "stream"
Error at or before ")" in file "db/devsri.db" line 4
Here's the relevant record:
record(busy, "$(P):ON")
{
field(DESC, "X-ray on")
field(DTYP, "stream")
field(VAL, "0")
field(ZNAM, "OFF")
field(ONAM, "ON")
field(OUT , "@devsri.proto setXR L0")
}
(The record works fine when i set the type to bo)
So how do I get the countdownTimer to shut off the xray?
By the way I am fairly new to snl coding so any comments are much appreciated.
2. I have the following records in my records instance file (.db), Basically I get the kVp and power from the device and use it to calculate the tube current. Now when both the kVp and power rbv's are 0 (so 0/0), I would like to show the current as 0 (or NAN) to the end user. How do I do this in the database file.
record(ai, "$(P):KVP_RBV")
{
field(DESC, "Get peak kilovolt")
field(DTYP, "stream")
field(INP, "@devoxford.proto get_val(VM) $(PORT) $(A)")
field(EGU, "kVp")
field(PREC, "0")
field(SCAN, ".1 second")
field(FLNK, "$(P):CALC_UA")
}
record(ai, "$(P):WATT_RBV")
{
field(DESC, "Get tube power")
field(DTYP, "stream")
field(INP, "@devoxford.proto get_val(WM) $(PORT) $(A)")
field(EGU, "W")
field(PREC, "0")
field(SCAN, ".1 second")
field(FLNK, "$(P):CALC_UA")
}
record(calcout, "$(P):CALC_UA")
{
field (INPA,"$(P):KVP_RBV")
field (INPB,"$(P):WATT_RBV")
field (CALC, "B*1*10**(3)/A")
field (OUT, "$(P):UA_RBV.VAL")
field (OOPT,"Every Time")
}
record(longin, "$(P):UA_RBV")
{
field (DESC, "Get Tube Current")
field (DTYP, "Soft Channel")
field (INP, "$(P):CALC_UA.VAL")
field (EGU, "UA")
field (SCAN, ".1 second")
}
Thank you
Best,
Ali