Download presentation
Presentation is loading. Please wait.
Published byGarry Black Modified over 9 years ago
1
Console Application Programming Brian Hendricks
2
Getting Started On the web –New user help adcon.fnal.gov/controls/clib/new_user.html –Library help adcon.fnal.gov/controls/libraries.html Console introduction area (cns_intro) –Skeleton program –Help files
4
Development Environment Language is C MECCA –builds and archives code Libraries –CLIB –User libraries Program testing facility Skeleton program Example programs (W1-W7)
5
Guidelines Application style guide –describes user interface expectations in terms of both appearance and functionality –adcon.fnal.gov/controls/clib/application_style_guide.html Application programming guidelines –describes standard coding practices –adcon.fnal.gov/controls/clib/application_guidelines.html
6
MECCA Works on a single directory Handles compiling and linking Supports testing environment Archives operational code Simple command line interface –mecca/copy {program} (copy from archive) –mecca/dev {program} (build test version) –mecca {program} (build and release) Maintains history and keeper information
7
Libraries CLIB –Generic functionality –>2000 entry points –Runtime linking User libraries –Generally more specific functionality –Few hundred entry points –Statically linked –Maintained in MECCA
8
Testing Environment Z index page –Allows access to all users (unless protected) –Cleaned up at 3 AM every day –mecca/dev and @build_z_page support it Debugger –Command line and windowed versions –Help at adcon.fnal.gov/controls/clib/intro_debugger.html
9
Testing Environment (contd) Redirection –Redirect data acquisition to a memory model Settings locks CLIB Peeker (D22) –View inner workings of CLIB routines DPM Peeker (D3) –View data acquisition requests
10
Skeleton Program Basic paradigm is infinite event handling loop Events are served by calls to ‘window_intype’ –Initialization (occurs once) –Periodic (15 Hz) –Keyboard (mouse clicks) –Termination (occurs once) Alternative is ‘window_intype_loop_c’
11
Program Skeleton Event Loop
12
A Word About ACNET Devices… Fundamental organizational block of control system information Configuration data in central database Power supply paradigm Consists of properties –smallest addressable unit of data –reading, setting, digital status, digital control, analog alarm, digital alarm Properties can be atomic values, arrays, or structures (default length vs. maximum length)
13
ACNET Devices (contd) Addressed by an 8 character ASCII name or an integer key called a device index ACNET device access protocols –RETDAT for reading properties –SETDAT for setting properties Setting property can be read as well as set Digital control property can only be set
14
ACNET Devices (contd) Devices can be grouped as families or linked as siblings Front ends return only “raw” data Scaling routines convert raw data to primary units (volts) or common (engineering) units Database dump program (D80) displays fairly complete information about devices
15
Database Dump Program (D80)
16
Anatomy of a Library Routine Help Entry Functional description of routine List of arguments with data types –{name}.{data type}.{passing mechanism} Description of each argument Description of returned status (if applicable) Required header file(s) Related functions Usage example
17
Anatomy of a Library Routine Help Entry (continued) Arguments having the type ‘.ch.d’ can be passed either by descriptor or by reference Arguments enclosed in square brackets are optional Default values of optional arguments should be listed –Zero is NOT the universal default value
19
CLIB Functional Groups dio_xxx – Data I/O –supports reading/setting devices –supports reading device database information –typically uses device index/property addressing –maintains usage/error statistics db_xxx – DataBase access –accesses relational database
20
CLIB Functional Groups (continued) window_xxx – alphanumeric window access –row/column addressing wn_xxx – graphic WiNdow access –views created in unitary coordinate system –each view has its own internal coordinate system error_xxx –displays/logs error and informational messages str_xxx – STRing functions –adds to C RTL string support
21
User Libraries ul_cbsaux – CLIB auxiliary routines –BPM support –GPIB support –waveform generator support ul_physlib – generic physics routines –contains ‘Numerical Recipes in C’ routines ul_model – lattice database access
22
User Libraries (continued) ul_pasa and ul_net – networking support ul_scopes – GPIB scope support ul_sequencer – Sequencer interface routines ul_windowlib –additional window_xxx routines ul_dialoglib – special user dialogs
23
BPMUTI Part of ul_cbsaux General BPM support for all accelerators Key routines –bpm_machine_c – select BPM system –bpm_get_data_c – read BPM data –blm_get_data_c – read BLM data –bpm_plot_data – makes BPM plots Based upon configuration database Supports BPM file system
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.