That's not the way you initialize the value of a scalcout-record input field.
Hi all. I happened to bump into an interesting problem. Im using calc and scalcout records to translate a very small current measurement into a more convenient unit of measurement.
After having trouble with the software showing the wrong measurement unit, i came to the conclusion that for some reason, although calc and scalcout are both double types, they seem to have different precision for comparisons.
I have the following example, made to get a very small amount of current in Amps and decide to either display it in pA, nA, uA, etc.:
record(ai, "CURRENT"){}
record(calc, "CALC") {
field(INPA, "CURRENT CP")
field(INPB, "1e-12")
field(INPC, "1e-9")
field(INPD, "1e-6")
field(INPE, "1e-3")
field(CALC, "F:=ABS(A);F<C?1:(F<D?2:(F<E?3:4))")
field(PREC, "4")
field(PINI, "YES")
field(SCAN, "Passive")
}
record(scalcout, "CURRENTSCALEDUNIT"){
field(INPA, "CURRENT CP")
field(PREC, "15")
field(INPB, "1e-9")
field(BB, "pA")
field(INPC, "1e-6")
field(CC, "nA")
field(INPD, "1e-3")
field(DD, "uA")
field(INPE, "1")
field(EE, "mA")
field(CALC, "A:=ABS(A);A<B?BB:(A<C?CC:(A<D?DD:EE))")
field(OUT, "CURRENTSCALED.EGU")
field(OOPT, "Every Time")
field(PINI, "YES")
field(SCAN, "Passive")
}
record(calc, "CURRENTSCALED"){
field(INPA, "15")
field(CALC, "A")
field(PINI, "YES")
field(SCAN, "Passive")
}
However, if you caput CURRENT 9.94e-10 you will see CURRENTSCALEDUNIT.SVAL=nA and CALC.VAL=1, meaning that for the calc record, 9.94e-10<1e-09 is True but for the scalcout this is false.
Is this expected?
Thanks,
Marco
Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta
ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente.
Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying
to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately.