Kay,
Thanks, that works amazingly well! I wound up with the following 4 records:
record(bi, "$(P)$(R):Sign") {
field(DESC, "Output Current Direction")
field(ONAM, "Positive")
field(ZNAM, "Negative")
field(FLNK, "$(P)$(R):CalcCurrent")
field(VAL, "1")
}
record(ao, "$(P)$(R):Amplitude") {
field(DESC, "Amplitude of Current")
field(EGU, "Amps")
field(DRVL, "0")
field(DRVH, "250")
field(FLNK, "$(P)$(R):CalcCurrent")
}
record(calc, "$(P)$(R):CalcCurrent") {
field(DESC, "Calculated Current")
field(CALC, "A ? B: -B")
field(INPA, "$(P)$(R):Sign")
field(INPB, "$(P)$(R):Amplitude")
field(FLNK, "$(P)$(R)SetCurrent")
}
# Interface commands for Heinzinger PCU50_300 (should work with others as well)
# Setting commands
record(ao, "$(P)$(R)SetCurrent") {
field(DESC, "Write output current")
field(DTYP, "stream")
field(SCAN, "Passive")
field(OUT, "@devPCU50_300.proto setCurrent(%d) $(PORT) $(A)")
field(FLNK, "$(P)$(R)GetCurrent")
field(EGU, "Amps")
field(ESLO, "0.001")
field(LINR, "SLOPE")
field(DRVL, "0")
field(DRVH, "300")
field(DOL, "$(P)$(R):CalcCurrent")
field(OMSL, "closed_loop")
}
I tried playing around with the OROC field on the Amplitude record and on the SetCurrent record, but neither of those seemed to make any behavioral changes that I could see. I tested by running camonitor
PCU50_300testSetCurrent and saw output that looked like:
PCU50_300testSetCurrent 2023-06-29 13:36:17.363253 68.0718
PCU50_300testSetCurrent 2023-06-29 13:36:17.379272 63.3797
PCU50_300testSetCurrent 2023-06-29 13:36:17.395914 59.2742
PCU50_300testSetCurrent 2023-06-29 13:36:17.413147 55.022
PCU50_300testSetCurrent 2023-06-29 13:36:17.429905 50.9164
PCU50_300testSetCurrent 2023-06-29 13:36:17.446571 48.717
PCU50_300testSetCurrent 2023-06-29 13:36:17.463580 46.8108
PCU50_300testSetCurrent 2023-06-29 13:36:17.479832 46.2243
PCU50_300testSetCurrent 2023-06-29 13:36:21.316094 -46.2243
PCU50_300testSetCurrent 2023-06-29 13:36:22.552344 46.2243
This was with the OROC value on the PCU50_300testSetCurrent record set to 1.
I believe this is a non-issue, because the PCU is smart enough to ramp the current to 0 before allowing the polarity reversal switch to actuate. Thanks for all of your help,
Greg
From: Kasemir, Kay <kasemirk at ornl.gov>
Sent: Wednesday, June 28, 2023 8:58 AM
To: Leblanc, Gregory <leblanc at ohio.edu>
Subject: [External] Re: Use phoebus toggle to adjust sign for ao record?
Use caution with links and attachments.
- think I can then add a CALC record to set the sign of the number as positive or negative
Exactly. Somewhat like that:
# changing either the sign or the amplitude will FLNK to the output chain
record(bi, “$(P):Sign”)
{
field(ZNAM, “Negative”)
field(ONAM, “Positive”)
field(FLNK, “CalcVoltage”)
}
record(ao, “$(P):Amplitude”)
{
field(DRVL, “0”)
# Configure maximum amplitude…
field(DRVH, “25”)
field(FLNK, “CalcVoltage”)
}
record(calc, “$(P): CalcVoltage”)
{
field(INPA, “$(P):Sign”)
field(INPB, “$(P): Amplitude”)
field(CALC, “A ? B : -B”)
field(FLNK, “SetVoltage”)
}
record(ao, “$(P): SetVoltage”)
{
field(DOL, “$(P): CalcVoltage”)
field(OMSL, “closed_loop”)
.. set DTYP and OUT as needed for asyn/stream device to write the voltage to the device
}
This does mean, however, that the output could toggle from +25 to -25 right away with a simple click on the GUI for the …Sign PV.
Can the system handle that?
Or do you actually need to change it in a more gentle way?
The AO record’s OROC (output rate of change) field might help with that.
-Kay
Hi folks,
One of my next steps is to get polarity reversal working on the Heinzinger supplies. I've got the attached bob file where I am hoping to use the slider to tune the beam. The PCUs want me to send a negative value to indicate one polarity and a positive value
to indicate the opposite polarity. The command 'DA 0,025000' will run the supply to 25A. The command 'DA 0,-025000' will reverse the polarity switch and run the supply to 25A (the software on the supply takes care of running everything down before switching).
I would prefer not to have a slider that goes from -300 to 300. This makes it harder to run the supply down to 0 and is also more confusing for operators. My thought is to implement a toggle button and display which deflection the user has selected. I think
I can then add a CALC record to set the sign of the number as positive or negative, and then send that composite out to the instrument. Does it sound like I'm on the right track or feedback on how you've accomplished something like this?
Greg
--
Gregory Leblanc
Accelerator Engineer
Edwards Accelerator Lab - Ohio University
123 University Terrace
Athens, OH 45701 USA
leblanc at ohio.edu
M: (401) 52-OUAL1 or (401) 526-8251