1 / 85

EPICS Class – Process Database

EPICS Class – Process Database . Most slides here are taken from: “EPICS Database Principles” by Andrew Johnson Some slides modified by me After lecture, study: “EPICS Database Practice” by Andrew Johnson. EPICS Class – Process Database Outline. What is a process database and why use it?

sinjin
Télécharger la présentation

EPICS Class – Process Database

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EPICS Class – Process Database EPICS Class – Process Database • Most slides here are taken from: • “EPICS Database Principles” by Andrew Johnson • Some slides modified by me • After lecture, study: • “EPICS Database Practice” by Andrew Johnson

  2. EPICS Class – Process Database Outline EPICS Class – Process Database What is a process database and why use it? Records Fields in Records (PVs) Record Processing Input and Output Records Record Linking Device Support and Soft Records Synchronous and Asynchronous I/O Common Fields/Functions in Most Records

  3. Control System w/o EPICS Database* Value Probe Some Host1 * An evolutionary tale.

  4. Control System w/o EPICS Database Network Value Probe TCP Some Host1

  5. Control System w/o EPICS Database Network Value Probe TCP Some Host1 History Some Host2

  6. Control System w/o EPICS Database Network Value Probe TCP Some Host1 Only 2 Clients Allowed! History Some Host2 ?? Alarm Handler Some Host3

  7. Control System w/o EPICS DB Network TCP Value Probe Some Host1 TCP Some Driver1 Some Server1 History Some Host2 Alarm Handler Some Host3

  8. Control System w/o EPICS DB Network TCP Value Probe Some Host1 TCP Some Driver1 Some Server1 History Some Host2 Alarm Handler Some Host3

  9. Control System w/o EPICS DB Network TCP Value Probe Channel Access Some Host1 Some Driver1 with CA Server* Some Server1 History Some Host2 Alarm Handler Some Host3 * Very few people actually do this – what they do instead will be discussed later .

  10. Control System w/o EPICS DB Network TCP Value Probe Channel Access Some Host1 Some Driver1 with CA Server Some Server1 History Some Host2 UDP Some Driver2 with CA Server Some Server2 Alarm Handler Some Host3

  11. Control System w/o EPICS DB Network TCP Value Probe Channel Access Some Host1 CC Drv CA Server1 Some Server1 History Some Host2 UDP PSC Drv CA Server2 Some Server2 Alarm Handler Some Host3

  12. Control System w/o EPICS DB Network TCP Value Probe Channel Access Some Host1 CC Analog Input Processing CC Drv CAS1 Some Server1 History Some Host2 UDP PSC Analog Input Processing PSC Drv CAS2 Some Server2 Alarm Handler Some Host3

  13. Control Sys with EPICS DB Network TCP Value Probe Channel Access Some Host1 CC Dev CC Drv AI CAS1 IOC1 on Server1 Config files on NFS History Some Host2 UDP PSC Dev PSC Drv AI CAS2 IOC2 on Server2 Alarm Handler Some Host3

  14. Database = Records + Fields + Links A control system using EPICS will contain one or more IOCs Each IOC loads one or more Database files telling it what to do A Database is a collection of Records of various types: ai, ao, bi, bo, mbbi, mbbo, stringin, stringout, calc, etc A Record is an object with: A unique name A behavior defined by its record type (class) Controllable properties (fields) Optional associated hardware I/O (device support) Links to other records EPICS Class – Process Database

  15. Record Activity Records are active — they can do things: Get data from other records or from hardware Perform calculations Check values are in range & raise alarms Put data to other records or to hardware Activate or disable other records Wait for hardware signals (interrupts) What a record does depends upon its record type and the settings of its fields No action occurs unless a record is processed EPICS Class – Process Database

  16. How is a Record type implemented? A ‘C’ structure with a data member for each record field All records start with a standard set of fields (dbCommon) that the system needs, including pointers to record type information (base/include/dbCommon.h) Additional fields are added depending on record type The configuration of the ‘C’ structure is provided by a database definition ASCII file (<name>Record.dbd) which is unique to the record type <name> Standard records in base/src/rec/<name>Record.dbd Code (ie, ‘C’) which implements the record behavior Standard records in base/src/rec/<name>Record.c New record types can be added to an application as needed – recommend only if absolutely necessary EPICS Class – Process Database

  17. How are individual Records defined? A database configuration ASCII file (.db or .template) providing record field values: Record name The record’s type Values for each design field Can use macros for fields so that same configuration file is used for many records IOC application build (make) can create and/or install .db files Record instantiation (ie, memory allocation on IOC) done before iocInit by dbLoadRecords in the IOC startup file. EPICS Class – Process Database

  18. Record Reference Manual WIKI Example

  19. Graphical View of a Record (VDCT)

  20. ASCII File View of a Record record(ai, "MS1-BD:CntlTempF") { field(DESC, "Controller Temp (deg F)") field(DTYP, "EtherPSC") field(INP, "#L0 N0 P0 S41 @172.22.247.141") field(EGU, "F") field(PREC, "1") field(HOPR, "95") field(LOPR, "80") field(MDEL, "0.1") field(FLNK, "MS1-BD:CntlTemp") }

  21. IOC View of a Record

  22. Fields – Process Variable (PV) EPICS Class – Process Database PV = <record_name>.<field> Example: MS1-BD:CntrlTempF.DESC If .<field> is not provided, .VAL is assumed.

  23. Fields are for... Defining What causes a record to process Where to get/put data from/to How to turn raw I/O data into a numeric engineering value Limits indicating when to report an alarm When to notify value changes to a client monitoring the record A Processing algorithm Anything else which needs to be set for each record of a given type Holding run-time data Input or output values Alarm status, severity and acknowledgments Processing timestamp Other data for internal use EPICS Class – Process Database

  24. Field types — fields can contain: Integers char, short or long signed or unsigned Floating-point numbers float or double Fixed length strings normally 40 characters Enumerated/menu choices select one of up to 16 strings stored as a short integer Arrays of any of the above types Links to other records in this or other IOCs to hardware signals (device support) provide a means of getting or putting a value Other private data not accessible remotely EPICS Class – Process Database

  25. All Records have these design fields: NAME 60 Character unique name (using more than 28 can cause problems) DESC 28 Character description ASG Access security group SCANScan mechanism EVNT Event number PHAS Scan order (phase) PINI Process at IOC initialization? PRIO Scheduling priority SDIS Scan disable input link DISV Scan disable value DISS Disabled severity FLNK Forward link Plus more... EPICS Class – Process Database

  26. All Records have these Run-time fields: PROC Force processing PACT Process active STAT Alarm status SEVR Alarm severity TPRO Trace processing UDF Non-zero if record value undefined TIMETime when record was last processed Plus more... EPICS Class – Process Database

  27. Record Processing IOC ... Scan Task (0.1 sec) Scan Task (10 sec) Hardware EPICS Database with Record Fields Callback Task (High Prio) Callback Task (Medium Prio) Callback Task (Low Prio) EPICS Class – Process Database

  28. How are records given CPU time? Several IOC tasks are used: callback (3 priorities) — I/O Interrupt and Event scanPeriod (periods are configurable) — Periodic A separate task is used for each scan period Faster scan rates are given a higher task priority (if supported by the IOC’s Operating System) scanOnce – special purpose sequence and other run-time database tasks Channel Access tasks use lower priority than record processing If a CPU spends all its time doing I/O and record processing, you may be unable to control or monitor the IOC via the network EPICS Class – Process Database

  29. Record Scanning SCANfield is a menu choice from Periodic — 0.1 seconds .. 10 seconds I/O Interrupt (if device supports this) Soft and Hard event — EVNT field Passive (default) The number in the PHAS field allows processing order to be set within a scan Records with PHAS=0 are processed first Then those with PHAS=1 , PHAS=2 etc. Records with PINI=YES are processed once at startup PRIO field selects Low/Medium/High priority for event and I/O Interrupts (selects which callback task will process the record) A record is also processed whenever any value is written to its PROC field EPICS Class – Process Database

  30. Listing Records for each SCAN Type

  31. Input and Output Records EPICS Class – Process Database

  32. Input records often have these fields: INP Input link DTYP Device type RVAL Raw data value VAL Engineering value LOPR Low operator range HOPR High operator range EPICS Class – Process Database

  33. Analog I/O (ai, ao) records have these fields: EGU Engineering unit string LINR Unit conversion control: No conversion, Linear, Slope,breakpoint table name EGUL Low engineering value EGUF High engineering value ESLO Unit conversion slope EOFF Unit conversion offset EPICS Class – Process Database

  34. Periodically Scanned Analog Input • Analogue Input “Temperature” • Reads from the Xycom XY566 ADC Card 0 Signal 0 • Gets a new value every second • Data is converted from ADC range to 0..120 Celsius

  35. Interrupt Scanned Binary Input • Binary Input “VentValve” • Reads from Allen-Bradley TTL I/O Link 0, Adaptor 0, Card 3, Signal 5 • Processed whenever value changes • 0 = “Closed”, 1 = “Open” • Major alarm when valve open

  36. Most output records have these fields OUTOutput link DTYP Device type VAL Engineering value RVAL Raw output value DOL Input link to fetch output value OMSL Output mode select: Supervisory, Closed Loop LOPR Low operator range HOPR High operator range EPICS Class – Process Database

  37. Analog outputs (ao) records also have these fields: OROCOutput rate of change OIF Incremental or Full output OVAL Output value DRVH Drive high limit DRVL Drive low limit IVOA Invalid output action IVOV Invalid output value RBV Read-back value Note: Restoration of field values (ie, analog output VAL, aka setpoint) on IOC restart is not provided by epics base. Software (or module, ieautosave module) external to epics base must be added to the IOC application and additional configuration done to add this very important functionality. EPICS Class – Process Database

  38. Passive Binary Output • Binary Output “Solenoid” • Controls Xycom XY220 Digital output Card 2 Signal 12 • Record is only processed by • Channel Access ‘put’ to a PP field (e.g. .VAL) • Another record writes to a PP field • Forward Link from another record • Another record reads this with PP

  39. Links A link is a type of field, and is one of Input link (ie, input record INP field, output record DOL field) Fetches data Output link (ie, output record OUT field) Writes data Forward link (ie, any record FLNK field) Points to the record to be processed once this record finishes processing EPICS Class – Process Database

  40. Input and Output links may be... Constant numeric value, e.g.: 0 3.1415926536 -1.6e-19 “Hardware” link A hardware (or external) I/O signal selector, the format of which depends on the device support layer Process Variable link — the name of a record, which at run-time is resolved into Database link - Named record is in this IOC Channel Access link - Named record not found in this IOC EPICS Class – Process Database

  41. Hardware links VME_IO #CnSn @parm Card, Signal INST_IO @parm CAMAC_IO #BnCnNn An Fn @parm Branch, Crate, Node, Address, Function AB_IO #Ln An CnSn @parm Link, Adapter, Card, Signal GPIB_IO #Ln An @parm Link, Address BITBUS_IO #LnNnPnSn @parm Link, Node, Port, Signal BBGPIB_IO #LnBnGn @parm Link, Bitbus Address, GPIB Address VXI_IO #VnCnSn @parm or #VnSn @parm Frame, Slot, Signal EPICS Class – Process Database

  42. Database links These comprise: PV – process variable name Process Passive flag NPP(default), or PP Maximize Severity flag NMS No maximize severity (default) MS Maximize severity MSS Maximize Status and Severity MSI Maximize Severity when Invalid Example M1:current.RBV NPP MS Beware: Database links with the PP flag set never wait for asynchronous record processing to finish, so an input link that triggers a read from slow hardware will return the previous data in that record EPICS Class – Process Database

  43. Channel Access links Similar to a database link Names a record that does not have to be in this IOC Use Channel Access protocol to communicate with the record Just like any other CA client, even for local records Input sets up a CA monitor on the channel May include a field name (default.VAL) PPLink flags are ignored Input links are always NPP Output links follow PP attribute of destination field These are how all CA clients behave MSLink flags apply to Input links Input links honor a given NMS (default) or MS/MSS/MSI flag Output links are always NMS Additional flags for CA links CA Forces a “local” link to use CA CP On input link, process this record on CA monitor event CPP Like CP but only process me if SCAN is Process Passive EPICS Class – Process Database

  44. Forward links Usually a Database link, referring to a record in same IOC No flags (PP, MS etc.), although VDCT includes them erroneously Destination record is only processed if its SCAN field is Passive Does not pass a value, just causes subsequent processing Forward linking to another IOC via Channel Access is possible, but the link must explicitly name the PROC field of the remote record In this case, the remote record does not need to have SCAN set to Passive

  45. Chapter 5 of the IOC Application Developer’s Guide covers record links and scanning in detail, and is worth reading. Good idea to just read the whole manual… EPICS Class – Process Database

  46. Simple FLNK and INP Link Example (VDCT)

  47. Trace Processing

  48. Finding Typos in Links

  49. Processing chains

  50. Which record is never processed?

More Related