# Presentation: 175946

## Badlfish: an EDD/DM to EDM translator 

- Outline
- Introduction
- EDD/DM file structure
- EDM file structure
- Widget translation
- Color map and color rule translation
- Example translations
- Further information for use
- Summary and future enhancements

## Introduction  

- EDD/DM format unreadable by EDM
- Need an automated tool (so many panels!)
- Use perl to make use of pattern matching

## EDD/DM file structure 

- file {}                                                                    header
- display {}
- “<<color map>>” {}                                              here or in an
- “<<color rules>>” {}                                             external file
- “<<basic attribute>>” {}                                        x,y,w,h,group
- “<<dynamic attribute>>” {}      (optional)              clrrule,vis
- “widget that uses basic, dyn attributes” {}            image,line,
- “another-widget-that-uses same attributes” {}     oval, rect, text
- “stand-alone widget that doesn’t use attribs” {}   exec, rdisp,
-                                                                              kill disp, text
-                                                                              update

## EDM file structure 

- header object                               display size, colors, fonts
- self-contained graphical object    all widgets

## Widget translation  

- file {}                                                  no internal storing of filename
- display {}                                            header object
- “<<color map>>” {}                           lookup table of matched colors
- “<<color rules>>” {}                          new dynamic color definitions
- “<<basic attribute>>” {}
- “<<dynamic attribute>>” {}
- “widget (basic, dyn attribs)” {}          self-contained graphical object
- “another-widget (same attribs)” {}     self-contained graphical object
- “stand-alone widget” {}                      self-contained graphical object

## Widget translation 

|  | EDD/DM | EDM |
| --- | --- | --- |
| Graphics | Rectangle | Rectangle |
|  | Line | Line |
|  | Oval | Circle |
|  | Arc | Arc |
|  | Text | Static Text |
|  | 3-D Border | N/A |
|  | Image | GIF Image |

## Widget translation 

|  | EDD/DM | EDM |
| --- | --- | --- |
| Monitors | Indicator | Bar |
|  | Bar | Bar |
|  | Text Update | Text Monitor |
|  | Meter | Meter |
|  | Byte | Byte |

## Widget translation 

|  | EDD/DM | EDM |
| --- | --- | --- |
| Controllers
 | Valuator | ? |
|  | Text Entry | Text Entry |
|  | Choice Button | Choice Button |
|  | Message Button | Message Button |
|  | Toggle Button | Button |
|  | Menu | ? |
|  | File Selection Menu | ? |

## Widget translation 

|  | EDD/DM | EDM |
| --- | --- | --- |
| Controllers  (continued) | Related Display | Related Display |
|  | Execute Script | Shell Command |
|  | Kill Display | Exit Button |
|  | Print Display | N/A |
|  | Print Options | N/A |
|  | Cartesian Plot | X-Y Plot |

## Color map translation 

- 8-bit EDD/DM colors (RGB) 	16-bit colors (RGB)
- Blinking EDD/DM colors          (R,G,B,R/2,G/2,B/2)
- Add basic blinking color entries to EDM colors so they exist
- Least square fit to match 16-bit EDD/DM to EDM colors
- Save results in color lookup table to use in widget translation
- User has option to intervene and change LUT during process
- Except for add’l blinking colors, EDM colors unchanged

## Color rule translation 

- EDD/DM has two kinds: single PV and multi-PV rules
- Single PV color rules become new “colors” in EDM colors which set a static color based on value of PV
- Multi-PV color rules also become new “colors” but the input PVs have to be combined first into a CALC so that there is only one output (which becomes the input to the new “color”) and is then set, as done for the single PV, to a static color based on the value
- The new “colors” must be added to EDM color definition before EDM can be run on translated panel

## Color rule translation example

## Color rule translation example

## Color rule translation example

- Contents of color rule look-up table for rule “alarm”:
- _rule name  type__	__calc__	__ __	__	__                                clr_
- 0     alarm   s      CALC\{$(STN):$(NAME).SEVR}	84
- New color for EDM color definition file looks like this:
- rule 84 alarm {
-  = -1	: “purple-46”
-  = 2 	: “Monitor: MAJOR”
-  = 1	: “Monitor: MINOR”
- }
- Note that “purple-46”, “Monitor*” are existing EDM static colors

## Slide 15

## Example translations

## Further information for use 

- User manual gives more details and instructions for use:
- 	 _[http://www.slac.stanford.edu/comp/unix/package/epics/lcls/badlfish](http://www.slac.stanford.edu/comp/unix/package/epics/lcls/badlfish)_
- The basic steps are:
- Download the tarball and modify the run* scripts for your setup (where the .adl files are, where badlfish is, etc)
- Run badlfish to translate .adl files
- Intervene midway through (optional) to change anything in color map or color rule lookup tables
- Update your colors.list with new colors and menumap
- Run new .edl screens with EDM

## Summary and future enhancements 

- Badlfish is a tool available to translate EDD/DM displays to EDM
- Byte translation needs work
- Valuator, menu and file menu not yet implemented

## Additional slides

## Complex (multi-PV) color rule

## Complex (multi-PV) color rule

- _rule  name  type  calc__	__ __	__	__                                               __	__clr_
-     1 rf_ilck     c CALC\{($(STN):STNDCM:SUMY:MODU.SEVR>1)?30:    ($(STN):$(MODULE):MODU.SEVR>1)?30:($(STN):$(COMP):FRST.SEVR==-1)?30:($(STN):$(COMP):LTCH.SEVR==-1)?30:($(STN):$(COMP):FRST.SEVR>0)?3:($(STN):$(COMP):LTCH.SEVR>0)?3:($(STN):$(COMP):LTCH.SEVR>0)?24:($(STN):$(NAME).SEVR==1)?30:($(STN):$(NAME).SEVR==2)?23:($(STN):$(NAME).SEVR==1)?4:($(STN):$(MODULE):MODU.SEVR==1)?23:($(STN):$(NAME).SEVR==0)?6:14)}	                                                                              85

## Complex (multi-PV) color rule

- New color for EDM color definition file looks like this:
- rule 85 rf_ilck {
-  = 30   :"Controller/alt"
-  = 30   :"Controller/alt"
-  = 30   :"Controller/alt"
-  = 30   :"Controller/alt"
-  = 3    :"GLOBAL canvas"
-  = 3    :"GLOBAL canvas"
-  = 24   :"red-24"
-  = 30   :"Controller/alt"
-  = 23   :"red-23"
-  = 4    :"grey-4"
-  = 23   :"red-23"
-  = 6    :"GLOBAL title"
- }

## Example translations