Linux and QNX Tools Demo and Tutorials

Version 6.4

February 28, 2008

An integrated demonstration and tutorials for the Cogent and Cascade tools in Linux or QNX.

Cogent software is source-code compatible among the Linux, QNX 6, and QNX 4 operating systems.
Go to the Cogent Web Site.
Copyright, trademark, and software license information.

Table of Contents

I. Cogent Tools Demo

1. Introduction
1.1. Overview - Cogent Tools and the Demo Applications
1.2. Data Flow
1.3. Control Flow
1.4. Demo Files and their Locations

2. Running the Cogent Tools Demo
2.1. Starting Up
2.2. Monitoring the PID Loop
2.3. Viewing and Changing Data Points
2.4. Making Logs and Plots
2.4.1. Plotting logs in Linux
2.5. Creating and Querying Historical Records
2.5.1. Interpolator options
2.5.2. Deadband options
2.6. Sending Commands

3. View the Code
3.1. File Overview
3.2. demo.g - The Demo Start-Up mini-program
3.3. gtkcontrol.g - The Controller program in GTK
3.4. phcontrol.g - The Controller program in Photon
3.5. emul.g - The PID Emulator program
3.6. gtkmonitor.g - The Monitor program in GTK
3.7. phmonitor.g - The Monitor program in Photon
3.8. gtklog.g - The Log program in GTK
3.9. phlog.g - The Log program in Photon
3.10. gtkhistory.g - The History program in GTK
3.11. phhistory.g - The History program in Photon
3.12. lib/common.g - Common library
3.13. lib/linux.g - Linux library
3.14. lib/qnx.g - General QNX library
3.15. lib/qnx4.g - QNX 4 library
3.16. lib/qnx6.g - QNX 6 library
3.17. lib/gtk.g - GTK library
3.18. lib/photon.g - Photon library

II. Tutorial One

4. Introduction: A Simplified Demo
4.1. Running the Simple Demo
4.1.1. In Linux
4.1.2. In QNX 4
4.1.3. In QNX 6
4.2. Data and Control Flow

5. The PID Emulator (emul.g)
5.1. The PID Controller Class - PID_Controller
5.2. The Plant Model - change_procvar
5.3. Automatically Change SP Value - auto_control
5.4. Emulating the PID Loop - change_values
5.5. Complete program - emul.g

6. Common Functions (in both gtksimple.g and phsimple.g)
6.1. Setting up Cogent Interprocess Communication - start_qnserves
6.2. Starting Programs - program_startup

7. GTK Functions (in gtksimple.g)
7.1. Global Variables
7.2. The Monitor Window - create_monitor
7.3. Making Scales and Spin Buttons - make_scale, make_prog_bar, make_spinner
7.4. Update Functions - reset_value, write_data
7.5. Button Functions - toggle_sym, change_settings
7.6. Label Functions - set_label, table_labeler
7.7. Complete program - gtksimple.g

8. Photon Functions (in phsimple.g)
8.1. Required Libraries and Initializing Photon
8.2. The Monitor Window - create_monitor
8.3. Button Functions - toggle_sym, change_settings
8.4. Callback Functions - slider_callback, num_callback
8.5. Trend Functions - accumulate_trends, update_trends
8.6. QNX 6-specific Function - numeric_assign
8.7. Complete program - phsimple.g

III. Tutorial Two

9. Common Functions for Any Program (in lib/common.g)
9.1. Requiring OS-Specific Libraries - lib_require
9.2. Starting Programs - program_startup
9.3. Starting qserve and nserve - start_qnserves
9.4. Control Button Functionality - start_stop
9.5. Start a Process - start_process, find_on_path
9.6. Handling Terminated Processes - child_died
9.7. Kill a Child Process - kill_child
9.8. Stop Processes - stop_processes
9.9. Sending Messages - send_message, started_died_hook

10. Abstracted Functions
10.1. Linux or QNX (in lib/linux.g, lib/qnx.g)
10.1.1. System Calls - anyos_system
10.1.2. Showing Help - anyos_help
10.2. Linux, QNX 4, or QNX 6 (in lib/linux.g, lib/qnx4.g, lib/qnx6.g)
10.2.1. Process Termination - anyos_find_process
10.2.2. Reassigning Strings - anyos_assign
10.3. QNX 4 or QNX 6 (in lib/qnx4.g, lib/qnx6.g)
10.3.1. Loading Extra Libraries for QNX 4 - anyver_loadlibs, gui_require
10.4. GTK or Photon (in lib/gtk.g, lib/photon.g)
10.4.1. Displaying Text - anygui_show_text
10.4.2. Process Termination - anygui_sigchild
10.4.3. Process Termination - anygui_destroyer
10.4.4. Buttons - .switched_on
10.4.5. Moving the Window - anygui_move_window
10.4.6. Change PID settings in the Monitor - anyos_change_settings
10.4.7. Creating a Message/Dialog Window - anygui_makemsg
10.5. GTK only (in lib/gtk.g)
10.5.1. Buttons - button_messages
10.6. Photon 1.14 or Photon 2 (in lib/qnx4.g, lib/qnx6.g)
10.6.1. Accessing Trend Data - .put_data
10.6.2. Numeric Callbacks - anyver_numeric_callback
10.6.3. Numeric Assignments - anyver_numeric_assign
10.6.4. Numeric Changing Settings - anyver_change_settings
10.7. Photon only (in lib/photon.g)
10.7.1. Buttons - PtLabel.get_text, PtLabel.set_text
10.7.2. Rollovers - PtBasic.rollover, attach_msg

11. PID Emulator and Monitor Functions
11.1. The PID Emulator
11.2. The Monitor in GTK
11.3. The Monitor in Photon
11.3.1. Differences between Tutorial One and Tutorial Two

12. Controller Functions
12.1. Choosing a Controller - the demo.g program
12.2. GTK: the Controller window - create_control_win
12.3. GTK: Building Control Buttons - control_button
12.4. Photon: the Controller window - create_control_win
12.5. Common: The Text Message Display - read_msg and messages.txt
12.6. Common: The Process Status Display - show_names, toggle_raw, .reassign_prog_name, extra_space
12.7. Common: The Data Directory - make_datadir

13. Log Functions
13.1. GTK: the Log window - create_log
13.2. GTK: Configuring and Using gnuplot
13.3. GTK: Preparing Plots - prepare_times, get_recent_data
13.4. Photon: the Log window - create_log
13.5. Photon: Log callbacks - start_logging
13.6. Common: The Cascade TextLogger Configuration File - tl.cfg
13.7. Common: Starting and Stopping the Cascade TextLogger - log_toggle
13.8. Common: Controlling the Cascade TextLogger - send_command

14. History Functions
14.1. GTK: the History Window - create_history, make_toggle_button
14.2. GTK: Interpolator Options Widgets - qry_radio_but, qry_entry
14.3. GTK: Editing Queries - .change_int, allow_entry_values, .assign_values
14.4. GTK: Recording Data - record_data, countdown
14.5. GTK: Setting Up Plots - reset_deadbands, plot_prep
14.6. GTK: Sending Queries - send_query, .get_data
14.7. GTK: Displaying Query Data - show_data, write_minmax, file_add
14.8. GTK: Configuring gnuplot
14.9. GTK: the Deadband Type Window - create_dbtype_win, db_labels, db_options
14.10. Photon: the History Window - HistoryWindow class, .constructor, create_history
14.11. Photon: Recording Data - record_data, countdown
14.12. Photon: Interpolator Options Widgets - PtText.set_sensitive, PtComboBox.set_sensitive
14.13. Photon: Editing Queries - .change_int, .allow_entry_values
14.14. Photon: Sending Queries - send_query, .assign_values, .get_data
14.15. Photon: Displaying Query Data - show_data
14.16. Photon: Setting Up Plots - make_graph, make_CwGraph_points
14.17. Photon: Plots and Deadbands - query_refresh, reset_deadbands, db_prep_query
14.18. Photon: the Deadband Type Window - create_dbtype_win, db_options
14.19. Photon: the DeadbandType class and .constructor method
14.20. Common: The Cascade Historian Configuration File - hist.cfg
14.21. Common: the InterpolatorSettings class and .set_defaults, .set_interpolator methods
14.22. Common: Sending Commands to the Cascade Historian send_hs_command, assign_history, display_hs_info
14.23. Common: the DeadbandSettings class and .set_parms method
14.24. Common: Plot Setup - find_midnite, min_max

Index