Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Latter code is less efficient because it searches for configuration object on every event which can be avoided if one uses first option.

Accessing EPICS Data

Access to EPICS data is provided through one more special object in the environments. This object can be accessed trough the cal to env.epicsStore() method which returns reference to the object of PSEnv::EpicsStore class.

It is possible to obtain the full list of PV names using corresponding methods of the EpicsStore object:

Code Block

  const std::vector<std::string>& pvNames = env.epicsStore().pvNames();

To obtain current value of particular PV the value() method can be used, for example:

Code Block

  double value = env.epicsStore().value("BEAM:LCLS:ELEC:Q");

or for the array EPICS data:

Code Block

  double value = env.epicsStore().value("BEAM:LCLS:ELEC:Q", index);

The result returned from value() method can be converted to any numeric type or std::string. The method will throw an exception (which will terminate application if not handled) if the PV name does not exist or if conversion fails.

Status information for particular PV can be obtained with status() method:

Code Block

  int status, severity;
  PSTime::Time time;
  env.epicsStore().status("BEAM:LCLS:ELEC:Q", status, severity, time);

which returns standard EPICS codes for status and severity plus time of the most recent change of the PV status or value. Time will be set to 0 (UNIX epoch time) when its value is unknown, typically at the beginning of job and may be few first events.