EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
<== Date ==> <== Thread ==>

Subject: Re: [EXTERNAL] trouble using event record to control bo record
From: "Hartman, Steven via Tech-talk" <tech-talk at aps.anl.gov>
To: "Saunders, Wyatt" <ws275820 at ohio.edu>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 22 Aug 2024 20:03:04 +0000
Hi Wyatt—

If your relay1off and relay1on records are controlling the hardware output, then you are mostly there.

However, the event record is not needed. The event record is typically used to trigger a number of records to process when some software event occurs. You should be able to do what you need with just one record, not three. 

A single bo record can be configured to write the “off” string to the hardware when it goes to zero and write the “on” string to the hardware when it goes to one. 

First, try this simple test (no hardware required) . . .

record(bo,”$(P)(R)relay1") {

    field(SCAN,"Passive")

    field(PINI,"YES")

    field(ZNAM,"Off")

    field(ONAM,"On")

}


In CS-Studio, use a “Choice Button” controller widget with the PV “$(P)(R)relay1". You should be able to toggle the button to switch between the two states, and see the record go from “Off” (0) to “On” (1). 

If that works, go back to your streams protocol file and modify it so that the output string depends on the value of the bo record. You want it to send the “off" command when the record is zero and the “on" command when the record is one. Now change the relay1 record to use DTYP “stream” again, and point the OUT field to the new entry in your protocol file. 

Good luck and welcome to EPICS,
-- 
Steven Hartman
hartmansm at ornl.gov



On Aug 22, 2024, at 2:48 PM, Saunders, Wyatt via Tech-talk <tech-talk at aps.anl.gov> wrote:

Hi I am a student working at Edwards Accelerator lab and I am trying to toggle a relay on and off. I am using the EPICS IOC (7.0) and I am interfacing with it using CS-Studio to control an Agilent technologies 34980A. I am really new to EPICS and Controls systems using databases.

Goal: I want to use a toggle button in CS-Studio. All CS-Studio does is write a 1 or 0 to a PV when the toggle button is toggled on or off so it is not the focus of the problem

Current working system: Currently I can get the relay to toggle with two buttons that have passive bo records. All the buttons do is call a caput command that puts 1 in VAL of the record. The record is processed, correct me if in wrong, because with SCAN set to passive any event that updates VAL will make the record do its process. My code is below.

record(bo, "$(P)$(R)relay1off"){
  field(DESC, "set parameter relay1")
  field(DTYP, "stream")
  field(SCAN, "Passive")
  field(OUT, "@devKS_34980A_EPICS.proto setRouteOpen(5001) $(PORT) $(A)")
  field(PINI, "YES")

}

record(bo, "$(P)$(R)relay1on"){
  field(DESC, "set parameter for relay1")
  field(DTYP, "stream")
  field(SCAN, "Passive")
  field(OUT, "@devKS_34980A_EPICS.proto setRouteClose(5001) $(PORT) $(A)")
  field(PINI, "YES")

}

Question/problem with event record: The question is how to a make a controlling record that can conditionally call the on or off record based upon the VAL of that controlling record. 

      My guess would be using the event record like I had written below. I think it's supposed to work in the following way. When the VAL of the event record is set by CS-Studio it should cause the record to cause an event with VAL as the event number 0 or 1. With both records that control the relay with scan field set to event this should cause them to process toggling the relay. This did not work for me. I am unsure why and I didn't encounter any error messages. I am open to suggestions on how to accomplish this goal in different ways or let me know if I just missed something in my code that needs fixed. Thanks! 

record(bo, "$(P)$(R)relay1off"){
  field(DESC, "set parameter relay1")
  field(DTYP, "stream")

#  field(SCAN, "Passive")

  field(SCAN, "Event")
  field(EVNT, 0)

  field(OUT, "@devKS_34980A_EPICS.proto setRouteOpen(5001) $(PORT) $(A)")
  field(PINI, "YES")

}

record(bo, "$(P)$(R)relay1on"){
  field(DESC, "set parameter for relay1")
  field(DTYP, "stream")

#  field(SCAN, "Passive")

  field(SCAN, "Event")
  field(EVNT, 1)

  field(OUT, "@devKS_34980A_EPICS.proto setRouteClose(5001) $(PORT) $(A)")
  field(PINI, "YES")

}

record(event, "$(P)$(R)toggleRelay"){
  field(SCAN, "Passive")
  field(PINI, "YES")
}



References:
trouble using event record to control bo record Saunders, Wyatt via Tech-talk

Navigate by Date:
Prev: trouble using event record to control bo record Saunders, Wyatt via Tech-talk
Next: how is envPaths built? William Kirstaedter via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
Navigate by Thread:
Prev: trouble using event record to control bo record Saunders, Wyatt via Tech-talk
Next: how is envPaths built? William Kirstaedter via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025