目次 例 emittance測定値計算用パネル 例 EPICS用部品を使う場合

例 EPICS CA 用ルーチンを使う場合


1. SADから一定時間毎にIOCをアクセスする場合

10秒毎に"some_record_name"と"some_other_record_name"(両方とも実際には 存在しない)を読み込んで、その値を表示する。1行目の"some_record_name" に関しては、アラームの程度も表示する。


FFS;
w = KBMainFrame["BasicEPICSTest1", f, Title->"Basic EPICS Test 1"];

f1 = Frame[f, PadY->5, Fill->"x"];
f2 = Frame[f, PadY->5, Fill->"x"];
v1 = ""; s1 = "normal"; ch1 = CaOpen["some_record_name"];
v2 = ""; ch2 = CaOpen["some_other_record_name"];
font = Font->TextFont["times","bold",18];
side = Side->"left";

l1a = TextLabel[f1, Text->"EPICS Record No. 1 is ", side, font];
l1b = TextLabel[f1, TextVariable:>v1, FG->"tomato", side, font];
l1c = TextLabel[f1, Text->" unit. Alarm Severity is ", side, font];
l1d = TextLabel[f1, TextVariable:>s1, FG->"tomato", side, font];

l2a = TextLabel[f2, Text->"EPICS Record No. 2 is ", side, font];
l2b = TextLabel[f2, TextVariable:>v2, FG->"tomato", side, font];
l2c = TextLabel[f2, Text->" unit.", side, font];

getvalue[] := (
  $FORM = "6.2";
  e1 = CaRead[ch1];
  v1 = ToString[e1[[1]]];
  s1 = Switch[e1[[3]],0,"normal",1,"minor",2,"major"];
  v2 = ToString[CaRead[ch2][[1]]];
  $FORM = "";
);

getvalue[];
ReadRecord := After[10, getvalue[]; ReadRecord];
ReadRecord;

TkWait[];

EPICS Record Readout Panel Example1

2. Monitorをセットして、値の変化があった時に値を受けとる場合

1の場合と同様の表示をするコードは、以下のようになる。


FFS;
w = KBMainFrame["BasicEPICSTest2", f, Title->"Basic EPICS Test 2"];

f1 = Frame[f, PadY->5, Fill->"x"];
f2 = Frame[f, PadY->5, Fill->"x"];
v1 = ""; s1 = "normal";
ch1 = CaOpenMonitor["some_record_name",
  ValueCommand:>(
    $FORM = "6.2";
    v1=ToString[ch1[Value]];
    $FORM = "";
    s1=Switch[ch1[Severity],0,"normal",1,"minor",2,"major"];
  )];
v2 = "";
ch2 = CaOpenMonitor["some_other_record_name",
  ValueCommand:>(
    $FORM = "6.2";
    v2=ToString[ch2[Value]];
    $FORM = "";
  )];
font = Font->TextFont["times","bold",18];
side = Side->"left";

l1a = TextLabel[f1, Text->"EPICS Record No. 1 is ", side, font];
l1b = TextLabel[f1, TextVariable:>v1, FG->"tomato", side, font];
l1c = TextLabel[f1, Text->" unit. Alarm Severity is ", side, font];
l1d = TextLabel[f1, TextVariable:>s1, FG->"tomato", side, font];

l2a = TextLabel[f2, Text->"EPICS Record No. 2 is ", side, font];
l2b = TextLabel[f2, TextVariable:>v2, FG->"tomato", side, font];
l2c = TextLabel[f2, Text->" unit.", side, font];

TkWait[];

EPICS Record Readout Panel Example2

top


このページに関する御意見・質問は Samo Stanic まで.