応用例: EPICS database

11. 応用例: EPICS database#

EPICS databaseの中身をオブジェクト/クラス図を使って作成してみました。 .dbファイルを読み込んで、.pumlを書き出すようなプログラムがあっても良さそうです。

@startuml
scale 2.0

together{
  object SET_CURRENT_RB <<ai>>{
    PROC
    EGU=mA
    --
    INP = SET_CURRENT
  }

  object SET_CURRENT <<ao>> {
    PROC
    DRVH=100.0
    DRVL=0.0
    EGU=mA
    --
    FLNK = SET_CRRENT_RB
    ..
    VAL
  }
}

together{
  object CURRENT <<calc>> {
       PROC
       SCAN= .1 second
       CALC="B=1?A+RNDM:0"
       --
       INPA = SET_CURRENT
       ..
       INPB = POWER_SW
       ..
       FLNK = READ_CURRENT
       ..
       VAL
  }

  object READ_CURRENT <<ai>>{
    PROC
    HIHI=90.0
    HIGH=80.0
    LOW=20.0
    LOL=10.0
    --
    INP = CURRENT
  }
}

together{
  object POWER_SW_RB <<bi>> {
    PROC
    ZNAM=OFF
    ONAM=ON
    --
    INP = POWER_SW
  }
  object POWER_SW <<bo>> {
    PROC
    ZNAM=OFF
    ONAM=ON
    --
    FLNK = POWER_SW_RB
    ..
    VAL
  }
  POWER_SW::FLNK -l> POWER_SW_RB::PROC
  POWER_SW::VAL -l> POWER_SW_RB::INP  : NMS NPP
  POWER_SW::VAL -r> CURRENT::INPB   : NMS NPP
}

SET_CURRENT -[hidden]d- POWER_SW
SET_CURRENT_RB -[hidden]d- POWER_SW_RB

SET_CURRENT::FLNK -l> SET_CURRENT_RB::PROC : PP NMS
SET_CURRENT::VAL -> CURRENT::INPA  : NMS NPP
SET_CURRENT::VAL -> SET_CURRENT_RB::INPA

CURRENT::FLNK -> READ_CURRENT::PROC
CURRENT::VAL -> READ_CURRENT::INP   : NMS NPP



@enduml

図 11.1 EPICS database#

@startuml
scale 2.0

  Entity SET_CURRENT <<ao>> {
    DRVH = 100.0
    DRVL = 0.0
    EGU = mA
    --
    FLNK SET_CURRENT_RB
    ..
    OUT SET_CURRENT_HW
  }

  Entity SET_CURRENT_RB <<ai>>{
    PROC
    EGU = mA
    --
    INP
  }

Entity READ_CURRENT <<ai>>{
    SCAN = .5 second
    HIHI = 90.0
    HIGH = 80.0
    LOW = 20.0
    LOL = 10.0
    --
    INP
    ..
    FLNK = POWER_SW_RB
  }
  
  Entity POWER_SW_RB <<bi>> {
    ZNAM=OFF
    ONAM=ON
    --
    INP
    PROC
    FLNK = SET_CURRENT_RB
  }
  
  Entity POWER_SW <<bo>> {
    ZNAM=OFF
    ONAM=ON
    --
    VAL
    ..
    OUT = POWER_SW_HW
    ..
    FLNK = POWER_SW_RB
  }

package "SIM_PS" {

  Entity SET_CURRENT_HW <<ai>> {
    DRVH = 100.0
    DRVL = 0.0
    EGU = mA
    --
    VAL
  }
  
  Entity CURRENT <<calc>> {
       PROC
       SCAN= .1 second
       CALC= "B=1?A+RNDM:0"
       --
       VAL
       ..
       INPA
       ..
       INPB
       ..
  }

  Entity POWER_SW_HW <<bi>> {
    PROC
    ZNAM=OFF
    ONAM=ON
    --
    VAL
    INP =  POWER_SW_HW PP MS
  }
}

POWER_SW_RB -[#hidden]- SET_CURRENT_RB


SET_CURRENT::OUT --> SET_CURRENT_HW
SET_CURRENT::FLNK .[#red].> SET_CURRENT_RB::PROC
SET_CURRENT_HW::VAL --> SET_CURRENT_RB::INP


CURRENT::INPB  <- POWER_SW_HW::VAL 
SET_CURRENT_HW::VAL -> CURRENT::INPA    :  NPP NMS

POWER_SW::OUT --> POWER_SW_HW  : NMS NPP
POWER_SW_HW::VAL --> POWER_SW_RB::INP
POWER_SW::FLNK .[#red].> POWER_SW_RB::PROC

READ_CURRENT::INP <-- CURRENT::VAL : NPP NMS 
READ_CURRENT::FLNK .[#red]d.> POWER_SW_RB::PROC
POWER_SW_RB::FLNK .[#red].> SET_CURRENT_RB::PROC

@enduml

図 11.2 EPICS database(class)#