|
Sorry, I accidentally sent the message incomplete...
I am trying to control the upper limit for a given PV via asyn (same as DRVH does, but since the value is dynamic, I'd rather handle it in the driver instead of DB links).
I have the following record:
record(ao, "$(P)$(R)$(PUMP)MaxPressure") {
field(DESC, "set max pressure for process")
field(DTYP, "asynFloat64")
field(EGU, "bar")
field(PREC, "2")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PROC_MAX_PRESSURE")
info(asyn:READBACK, "1")
}
And the asyn code that sets the value is
else if (function == procMaxPressure_) {
double maxPressure;
status = getDoubleParam(addr, syrMaxPressure_, &maxPressure);
// do not allow process pressure to be set above syringe max pressure.
if (value > maxPressure) {
asynPrint(pasynUser, ASYN_TRACE_ERROR, "Pressure above syringe limit, clipping to %f\n", maxPressure);
value = maxPressure;
}
if (value < 0) {
value = 0;
}
}
Later on, inside writeFloat64, I do:
if (status == asynSuccess && apiErrCode == ERR_NOERR) {
setDoubleParam(addr, function, value);
callParamCallbacks(addr);
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: port=%s, param=%s, value=%f, status=%d\n", driverName,
functionName, this->portName, paramName, value, (int)status);
} else {
(...)
What I would expect is that the record only assumes the value that I clipped, i.e., 0 <= value <= maxPressure
However, what I see is that the asyn parameter PROC_MAX_PRESSURE is indeed clipped, but the PV value assumes whatever value I put. Assuming maxPressure=517, asynReport gives:
Parameter 10 type=asynFloat64, name=PROC_MAX_PRESSURE, value=517, status=0
But I successfully wrote "600" to "$(P)$(R)$(PUMP)MaxPressure":
> dbgf B02-CSLab:SE-Pumps:SP1MaxPressure
DBF_DOUBLE: 600
I understand the asyn driver and the database are on different layers, but I would expect is that the PROC_MAX_PRESSURE param and VAL field of the record stayed in sync with the setup above.
Maybe I misinterpreted how that is supposed to behave?
I have seen the same behavior in other modules, so I'd like to check if someone has any ideas on how to handle this properly.
Thanks, and sorry for the previous noise 🙂
Cheers,
André Favoto
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of André Favoto via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, June 22, 2026 13:28
To: Tech Talk <tech-talk at aps.anl.gov>
Subject: ASYN parameter value vs VAL field relationship
Hi folks,
I am trying to control the upper limit for a given PV via asyn (same as DRVH does, but since the value is dynamic, I'd rather handle it in the driver instead of DB links).
I have the following record:
record(ao, "$(P)$(R)$(PUMP)MaxPressure") {
field(DESC, "set max pressure for process")
field(DTYP, "asynFloat64")
field(EGU, "bar")
field(PREC, "2")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PROC_MAX_PRESSURE")
info(asyn:READBACK, "1")
}
|