1 / 23

Console Application Programming

Console Application Programming. Brian Hendricks. 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. Development Environment.

mirit
Download Presentation

Console Application Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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

  3. Development Environment • Language is C • MECCA • builds and archives code • Libraries • CLIB • User libraries • Program testing facility • Skeleton program • Example programs (W1-W7)

  4. 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

  5. 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

  6. Libraries • CLIB • Generic functionality • >2000 entry points • Runtime linking • User libraries • Generally more specific functionality • Few hundred entry points • Statically linked • Maintained in MECCA

  7. 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

  8. 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

  9. 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’

  10. Program Skeleton Event Loop

  11. 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)

  12. 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

  13. 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

  14. Database Dump Program (D80)

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. 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

  21. 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

More Related