Differences between revisions 13 and 14
Revision 13 as of 2018-01-19 10:57:23
Size: 3999
Editor: YoichiAso
Comment:
Revision 14 as of 2018-01-19 10:58:15
Size: 4019
Editor: YoichiAso
Comment:
Deletions are marked like this. Additions are marked like this.
Line 70: Line 70:
How to add a User PV
=== How to add a User PV ===
Line 74: Line 73:
Adding a new database file
=== Adding a new database file ===
Line 78: Line 76:
Starting/Restarting the EPICS translator === Starting/Restarting the EPICS translator ===

EPICS interface for the PLC system

Overview

PLC system holds signal values in its internal registers. By reading the register values or writing values into the registers, we can communicate with the PLC system.

EPICS translator is a software translating the PLC register values to EPICS process variables (PVs). It can also transfer EPICS PV values into PLC registers.

The EPICS translator is implemented as an EPICS IOC. It is running on a computer called k1kiki0 (the name should be changed to k1plc0). Physical location of this computer is the PLC rack in the center area. You can login to this computer from the KAGRA control network with the controls account.

A note on EPICS terminology

The following words are used to mean basically the same thing.

PV (Process Variable)
EPICS record
EPICS channel

"PV" and "record" are correct EPICS terms. "Channel" is widely used to mean PV or record, but it is a misuse.

As a policy, the PLC system provide two classes of EPICS PVs.

  • Hardware PVs

These PVs read or write into hardware channels, for example: channel 1 of Y-End ADC, channel 6 of X-End DI and so on. These PVs have names such as K1:PLC-YEND_ADC_Ch1 or K1:PLC-XEND_DI_Ch6. The names do not contain the information of what is connected. So users of the PLC system should create User PVs to have more meaningful names. The PLC administrator (currently Aso) will make all the hardware channels available as hardware PVs.

  • User PVs

These PVs read one or more hardware PVs and (optionally) do some calculations to produce physically meaningful values and PV names. For example, assuming that a vacuum gauge is connected to Y-End ADC Ch1 and the corresponding hardware PV is K1:PLC-YEND_ADC_Ch1, you can create an user PV, K1:PLC-VAC_EY_PRESSURE, with the following database definition.

record (calc, "$(SYSTEM)-VAC_EY_PRESSURE")
{
    field (DESC, "EY Vacuum pressure" )
    field (INPA, "$(SYSTEM)-YEND_ADC_Ch1")
    field (CALC, "10^(1.667*A*10/4096 - 9.33)" )
    field (EGU, "Pa")
    field (SCAN,"$(SCAN) second")

}

This PV holds the vaccum pressure in Pa.

You do not have to do a calculation unless necessary. Just copying the value of a hardware PV is fine in most cases.

Adding a hardware PVs (usually not necessary for users)

  • Check the register address to which the hardware channel is assigned by looking at the documents provided by Hitz. センターエリアレジスターマップ.pdf shows the register assignments.

  • Login to k1kiki0 as controls
  • Go to "/home/controls/PLC/EPICS_Trans/base-3.14.12.2/db/". Actually, /home/controls/PLC folder is linked to KAGRA Dropbox's Dropbox/Subsystems/PLC. Therefore, you can also edit files in this directory from Dropbox and the result is automatically synchronized to k1kiki0.
  • Edit a database file. For example, to add/modify ADC channels in Y-End, open yEndADC.db.
  • PLC register values are first read into EPICS array records, such as "K1:PLC:M0-959". These arrays are defined in "kagraMpsArray.db".

  • To extract a single channel value for a hardware PV, use DTYP of "devFromArray". Here is an example:

record (ai, "$(SYSTEM)-XEND_ADC_Ch1")
{
    field (DESC, "D3792:X-End ADC Ch1 value" )
    field (DTYP, "devFromArray")
    field (INP, "$(SYSTEM):D3640-D4599 @ 152" )
    field (SCAN,"$(SCAN) second")
}
  • This example reads a register value at D3792 from the EPICS array "$(SYSTEM):D3640-D4599", making it available as "$(SYSTEM)-XEND_ADC_Ch1".
  • If you add a new database file, see the section "Adding a new database file" below.
  • Restart the EPICS translator IOC.

How to add a User PV

Adding a new database file

Starting/Restarting the EPICS translator

KAGRA/Subgroups/MIF/PLC/EPICS (last edited 2018-02-01 16:06:24 by YoichiAso)