Download presentation
Presentation is loading. Please wait.
Published byGriffin Robinson Modified over 9 years ago
1
SAD and Python with EPICS at IHEP,Beijing, 2002.8.21 Noboru Yamamoto KEK, JAPAN
9
Simple, well understood behavior
13
High Level Applications in KEKB ● Applications and Operator displays in KEKB Application Launcher ● SAD is widely used for high level applications. ● medm/dm2k is used for simple displays. ● Python is also used for application development.
14
SAD applications ● Operator Interface – Optics measurement – Optics calculation and Optics – Collision Monitors... ● Slow Feedback (with OPI)* – iBump:a system keeps beams in collision – Closed orbit correction *)It is preferable to separate FB loop and its user interface into different processes.
15
KEKB Launcher ● Program written in SAD/KEKB Frame ● Starting point of KEKB operation ● User can register a new command on the fly*. ● simple load balancing between servers. ● User can select a host to execute a command. *) Application reads a configuration file, kbl.conf, at start up and on request by operator.
16
Applications in KBL
17
A sample SAD/KBFrame application
18
Applications using Python and Pmw
19
SAD and Python compared ● SAD – Accelerator modeling – Developed at KEK – Mathematica like scripting – support CA and Tk widget – Modules for KEKB operation ● Python – General Purpose Object Oriented dynamic language – Developed by Open source project – Simple and Clean syntax – Support CA and Tk widget – RDBMS interface – Variety of extension modules
22
SAD installation ● SAD Source Download Page – http://acc-physics.kek.jp/SAD/SADDownloadPage.html – You need ID and password to download the source code. Contact susumu.kamada@kek.jp for your ID and password. – You also need Tcl/Tk source code and a patch specific to SAD/Tkinter. – Electric conference room for SAD (in Japanese).
23
SAD script ● SAD Scripts follows Mathematica(R) syntax.No statements, just functions. ● Every Elements has a form: – Head[arg1, arg2,...] – eg. If[cond, st1, st2 ] ● Some Element has a special notation – Plus[ 1, 2] 1+2 – List[a,b,c] {a, b, c} ● Name of element/function is same as that of Mathematica.
26
KEKB Frame ● Framework, i.e. a collection of programs/scripts, to support development of GUI Application – Standard Menu – Help menu including “Process Info” – status bar including print button ● Build upon Tkinter Widget Set
28
Extending SAD ● SAD modules can be used to extend SAD script functionality, i.e. add a new function to SAD script. ● SAD modules is a library written in SAD script. ● Fortran and C is used to develop SAD program itself. ● Fortran or C can be used add a new functionality to SAD script.
29
Python installation ● Python Web site: http://www.python.org/ – Source code and binary(Windows, Mac, rpm) – gnuzip;tar; configure; make from tar.gz file. – Use of Pmw(Python mega widget) together with Tkinter is recommended – Use of Gtk+(PyGtk) is another possibility. – Get CA interface from ANL EPICS web site or KEKB web site (or Both)
30
Python syntax ● Python uses indentation to specify a block structure of a program e.g.: if cond : statements_1 else: statements_2 other_statements ● Usage of special characters are common to most of programing language.
34
Extending Python ● Python modules add new functions and/or classes to Python language. ● There already exists a rich set of Python modules. ● C or C++ can be also used to develop new modules ( C-modules). ● Tools such as SWIG can be used to develop a C- module.
35
Embedding Python ● Python can be used as an extension language of the existing program. ● It adds flexibility and extendability to the program. ● For example, PostgreSQL, a free RDBMS, can use Python to define a stored procedure or define a new object.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.