108
Software Maintenance and Support Contract — Final Report Tom Gee Covenant Systems Development Covenant Systems Development 27 Bray St, Beeton, Ontario, L0G 1A0 Project Manager: Bill Fraser 416-635-2064 Contract Number: W7711-036681/001/TOR Contract Scientific Authority: Bill Fraser 416-635-2064 Terms of release: The information contained herein is proprietary to Her Majesty and is provided to the recipient on the understanding that it will be used for information and evaluation purposes only. Any commercial use including use for manufacture is prohibited. Release to third parties of this publication or information contained herein is prohibited without the prior written consent of Defence R&D Canada. Defence Research & Development - Toronto Contractor Report September 2004

Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Software Maintenance and Support Contract— Final Report

Tom GeeCovenant Systems Development

Covenant Systems Development27 Bray St, Beeton, Ontario, L0G 1A0

Project Manager: Bill Fraser 416-635-2064

Contract Number: W7711-036681/001/TOR

Contract Scientific Authority: Bill Fraser 416-635-2064

Terms of release: The information contained herein is proprietary to Her Majesty and is provided tothe recipient on the understanding that it will be used for information and evaluation purposes only.Any commercial use including use for manufacture is prohibited. Release to third parties of thispublication or information contained herein is prohibited without the prior written consent of DefenceR&D Canada.

Defence Research & Development - TorontoContractor Report

September 2004

Page 2: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Author

Tom Gee

Approved by

Bill FraserPrincipal Investigator

Approved for release by

Bill FraserProject Manager

The scientific or technical validity of this Contractor Report is entirely theresponsibility of the contractor and the contents do not necessarily have theapproval or endorsement of Defence R&D Canada.

Her Majesty the Queen as represented by the Minister of National Defence, 2004

Sa majeste la reine, representee par le ministre de la Defense nationale, 2004

Page 3: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Table of contents

Table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i

List of figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i

Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

Resume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

Executive summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

Sommaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi

1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Progress Accomplished . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1 Establishing the External Software Platform . . . . . . . . . . 2

2.2 Enhance GUARDIAN Architecture and Support . . . . . . . . 4

2.2.1 Configuring the Processing Network . . . . . . . . . . 6

2.2.2 Navigating the Data Repository . . . . . . . . . . . . . 6

2.2.3 Monitoring via a Graphical Waveform User Interface . 10

2.2.4 Optimizing CPU and Storage Resources . . . . . . . . 13

3 Future Directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Annexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

A C++ Library Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

B Configuration Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

List of figures

1 Sample OpenDX display window . . . . . . . . . . . . . . . . . . . . 3

i

Page 4: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

2 Sample PDP++ model view . . . . . . . . . . . . . . . . . . . . . . . 3

3 Sample dicom2-converted MRI image (inverted) . . . . . . . . . . . . 4

4 Sample dicom2-converted extracted text information . . . . . . . . . 5

5 Sample processing network . . . . . . . . . . . . . . . . . . . . . . . 7

6 Sample datatrac database window . . . . . . . . . . . . . . . . . . . 8

7 Sample konqueror window as file manager . . . . . . . . . . . . . . . 9

8 Sample nautilus window . . . . . . . . . . . . . . . . . . . . . . . . 10

9 Original GUARDIAN user interface . . . . . . . . . . . . . . . . . . . 11

10 Original GUARDIAN user interface with graphing . . . . . . . . . . . 11

11 Sample paraGUI interface . . . . . . . . . . . . . . . . . . . . . . . . 12

12 Sample graphical representation of heart rate. . . . . . . . . . . . . . 13

ii

Page 5: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Abstract

To provide an effective platform for acquiring and processing a large number ofhigh-speed channels, we were engaged to explore several third party software pack-ages. We were also tasked with augmenting the existing software architecture, theGUARDIAN system.

We examined packages for real-time modeling, display, storage and importing out-side data. We evaluated the tasks required to configure and apply GUARDIAN tothis type of problem, as well as those required to navigate the stored data afteracquiring. For those tasks which were onerous, we explored ways of simplifyingthem. We examined various options for creating a graphical configuration editor, afilesystem-type interface to the storage database, and a real-time waveform-orienteduser interface, with the latter proceeding through the design and initial implemen-tation phases.

The existing system, combined with the third party packages, is a suitable platformfor this research, if somewhat awkward in its employ. By completing the modestprojects started under this program, the ease and efficiency of the system will beincreased markedly.

Resume

Afin de fournir une plate-forme efficace pour acquerir et traiter un grand nombre decanaux rapides, on nous a engages etudier fond plusieurs progiciels tiers. On nousa egalement confie la mission de renforcer l’architecture du logiciel existant, soit lesysteme GUARDIAN.

Nous avons examine des progiciels pour en analyser la modelisation, l’affichage, lestockage et l’importation en temps reel de donnees exterieures. Nous avons evalueles taches requises pour configurer et appliquer le systeme GUARDIAN a ce genre deprobleme, d’une part, et celles pour explorer les donnees stockees apres acquisition,d’autre part. Nous avons cherche des moyens pour simplifier les taches qui se sontaverees exigeantes. Nous avons etudie differentes options pour creer un editeur deconfiguration graphique, une interface du genre systeme de fichier a la base dedonnees de stockage et une interface utilisateur en temps reel focalise sur la formed’onde. L’interface utilisateur a traverse les phases de conception et de mise enoeuvre.

Combine aux progiciels tiers, le systeme existant represente une plate-forme conve-

iii

Page 6: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

nable pour la recherche, bien qu’il soit plutot peu maniable. Les modestes projetsaccomplis dans le cadre de ce programme augmenteront notablement la maniabiliteet l’efficacite du systeme.

iv

Page 7: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Executive summary

DRDC Toronto is preparing for a research thrust requiring both physiological mod-eling and physical experimentation. The focus of this contract has been to preparea software platform for serving these ends.

A sophisticated data acquisition, processing and storage architecture called GUARDIANhas already been developed within DRDC. Our task was to augment the system tosupport high-speed acquisition and processing over a large number of channels, toenhance existing software as well as employing third party software to process thedata in real-time and offline, as well as to assist DRDC personnel in integratingapplication-specific modeling code with the rest of the system.

We identified and deployed several third party packages for real-time modeling,display, storage and importing of outside data. We also ensured that GUARDIANwas capable of acquiring and processing the predicted data load and identified sev-eral issues regarding the complexity of configuring the system and navigating theresulting data.

For those issues identified, we proposed and designed a set of solutions. To simplifyconfiguring the system, we proposed and scoped a graphical configuration editor.To ensure reliable use of GUARDIAN with high-speed channels, we designed andbegan implementation of a waveform-oriented graphical user interface which pro-vides a highly customizable presentation with real-time display. Finally to simplifynavigation of the acquired and processed data, we propose and scope a more intu-itive and flexible interface to the existing database system.

The results of these modest projects, carried to completion, will be a platform well-suited to this ambitious application. The user will find the system capable, flexibleand intuitive in the support of any number of paths of inquiry.

Tom Gee; 2004; Software Maintenance and Support Contract —Final Report; ; Defence Research & Development - Toronto.

v

Page 8: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Sommaire

RDDC Toronto se prepare pour un vecteur de recherche qui exige a la fois unesimulation physiologique et une experimentation physique. Le present contrat sefocalise sur l’elaboration d’une plate-forme logicielle dans le but de satisfaire a cesbesoins.

On a deja realise au sein de RDDC une architecture sophistiquee d’acquisition, detraitement et de stockage de donnees appelee GUARDIAN. Notre tache a ete d’aug-menter le systeme afin de faciliter l’acquisition et le traitement sur un grand nombrede canaux. On devait aussi renforcer le logiciel existant, employer un logiciel tierspour traiter les donnees en temps reel et hors ligne ainsi qu’a aider le personnelde RDDC a integrer le code de modelisation particulier a l’application au reste dusysteme.

Nous avons designe et deploye plusieurs progiciels tiers pour modeliser, afficher,stocker et importer en temps reel des donnees de l’exterieur. Nous avons veilleegalement a ce que le GUARDIAN puisse acquerir et traiter un chargement dedonnees prevu et nous avons cerne plusieurs problemes dus a la complexite qu’il ya a configurer le systeme et a explorer les donnees resultantes.

En ce qui concerne les problemes cernes, nous avons propose et elabore des solu-tions. Pour simplifier la configuration du systeme, nous avons propose et specifieun editeur de configuration graphique. Afin que le GUARDIAN puisse etre utilisede facon fiable avec des canaux a haute vitesse, nous avons elabore et commencea mettre en oeuvre une interface utilisateur graphique focalise sur la forme d’onde,qui fournit une presentation personnalisable avec affichage en temps reel. Enfin,pour simplifier la navigation des donnees acquises et traitees, nous proposons etspecifions une interface plus souple et plus intuitive pour le systeme de base dedonnees existant.

Accomplis, ces modestes projets auront comme resultats une plate-forme qui convienttres bien a cette application ambitieuse. L’utilisateur trouvera le systeme capable,souple et intuitif quel que soit le nombre de chemins d’acces pour interroger.

Tom Gee; 2004; Software Maintenance and Support Contract —Final Report; ; Research & Development pour la Defense du Canada- Toronto.

vi

Page 9: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

1 Goals

As shown in the statement of work [1], this contract involved several interrelatedtasks:

The contractor will be required to (1) undertake the modification and in-tegration of real-time and off-line modeling and analysis software into theLinux based IMEOS/Guardian system architecture, (2) modify and test theGuardian architecture for 200+ data channel capacity, and (3) assist DRDCpersonnel in integrating and modifyiong [sic] the C++ code provided by thePDP++ modeling software. [Numbers added]

We will briefly examine how these goals developed during the course of the con-tract.

1. Undertake the modification and integration of real-time and off-line modelingand analysis software in the Linux-based IMEOS/Guardian system architecture

The focus developed under this task was to install and become familiar withthe offline analysis, storage and display technologies of OpenDX [2], HDF5[3], dicom2 [4] and the DICOM Central Test Node (CTN) [5] software. DI-COM and OpenDX were particularly interesting as we were exploring the ideaof projecting EEG and EMG data onto MRI and ultrasound images of the sub-ject’s anatomy. As well, the GUARDIAN software architecture [6] developedunder a previous contract [7] required some modification to efficiently supportmultiple channel EEG; modifications that included creating a basic real-timeuser interface.

2. Modify and test the Guardian architecture for 200+ data channel capacity

Designed as a highly-scalable architecture, GUARDIAN was already theoreti-cally capable of 200+ channels. However, the difficulty of configuring thesechannels using the GUARDIAN data path network paradigm was daunting, aswas the task of navigating the acquired data stored offline. Accordingly, theissues we addressed included designing a user interface to the real-time system,surveying various technologies for creating a configuration tool, and design-ing a simplified paradigm for addressing the resulting data stored in the normaldestination for GUARDIAN, the datatrac database [8].

3. Assist DRDC personnel in integrating and modifying the C++ code providedby the PDP++ modeling software

This task was ultimately restricted to installing PDP++ [9] and gaining a smalldegree of familiarity with it. DRDC did not ultimately produce any PDP++

1

Page 10: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

or C++ code in the timespan of this short contract. However, the modular andgeneric design of GUARDIAN should make such integration straightforward.

2 Progress Accomplished

Although the contract identified three tasks, the vestigial results of the third com-bined with the overlap between the first two make it simpler to examine the progressmade as two main categories, namely, the establishing of the external software plat-form and the enhancing of the GUARDIAN architecture and support software.

2.1 Establishing the External Software Platform

Using a number of packages external to GUARDIAN, we began laying a founda-tion of several real-time and offline storage, analysis and display technologies. Weinvestigated, identified, installed and configured the following:

OpenDX is a superb, open-source version of IBM’s original Data Explorer. Thisprogram takes multidimensional data from various sources and allows it to berepresented in a myriad of complex and ingenious ways, such as that shown infigure 1.

HDF5 is version 5 of the NCSA’s Hierarchical Data Format, a file format and li-brary for storing a hierarchical, mixed type data. Although we do not yet useHDF, it is one of the main formats supported by OpenDX and under consider-ation by DRDC Toronto.

CTN is a collection of software programs used to create, manipulate and exportmedical data such as MRI images. We need access to such information tocreate accurate models for the display and interpretation of physiological data.

dicom2 is a DICOM image exporter which provides a simpler interface than thatof the CTN for exporting medical images.

PDP++ is a simulation environment for developing and testing connectionist mod-els of neural function. A sample image is shown in figure 2 taken from theuser guide [10].

We spent considerable time gaining a basic knowledge of these packages, particu-larly OpenDX. Since this program is capable of receiving streaming data, we ex-plored the idea of using it as a user interface during real-time acquisition. The idea

2

Page 11: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Figure 1: Sample OpenDX display window

Object Actions .views .layers View: Object Actions Selections

Display X: --- Y: --- Z: ---

Select View

Move ReShape

ReScale Rotate

Build All Connect All

Update Init

New Layer(s) New Label

Remove Edit

Monitor Values

r.wt s.wt

r.dwt s.dwt

r.dEdW s.dEdW

targ ext

act net

bias.wt bias.dwt

bias.dEdW err

dEdA dEdNet

1 0Input Layer

0.592554

hid_1

0.380997

hid_2

Hidden Layer

0.546832

outputOutput Layer

XOR Network Unit Text

BOTH

Disp Mode

THREE_D

Auto Scale

1.000

-1.000

Figure 2: Sample PDP++ model view

3

Page 12: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

is compelling and reasonable, but at the moment the need for such a display doesnot justify the effort required.

We also used the dicom2 program and some sample images that came with CTN.It has proven adequate to export the data both as a JPEG graphic (figure 3) and astext information (figure 4) giving dimensions, scan positions, etc. We were unableto locate a sample of MRI scans that were suitable for volumetric rendering. Wewill likely need to wait until subject MRI scans are available before making muchprogress in this area.

Figure 3: Sample dicom2-converted MRI image (inverted)

2.2 Enhance GUARDIAN Architecture and Support

To enhance GUARDIAN for the established tasks required work on several issues,specifically:

1. configuring high-density processing networks

2. navigating a high-density stored data repository

3. confirming and monitoring data quality via a graphical waveform-oriented userinterface

4. optimizing of CPU and onboard storage resources

4

Page 13: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Figure 4: Sample dicom2-converted extracted text information

5

Page 14: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

To reduce the complexity of this report, we will examine each issue in turn.

2.2.1 Configuring the Processing Network

As noted, GUARDIAN was designed with scalability in mind. The requirementof 200+ input data channels required no modification to the architectural designor prototype implementation [11]. However, the expressive power of GUARDIANdoes make initial configuration more difficult than other, simpler systems used pre-viously. In particular, the concept of “virtual data paths” — which allow the en-vironment of the system to be modeled along with the internal elements of thesoftware — place considerable demands on the user.

A processing network consists of an aggregate of interconnected transformations.A transformation is an entity with a collection of data sinks and a collection ofdata sources. Various sinks are connected to various sources to form a network.Typically, a script file is used to describe the elements of the processing network,including transformations, source and sink flows, and connections. For example,figure 5 shows a basic anti-G valve configuration, using 9 transforms, 26 flows and14 connections (dotted lines).

A network configured for 200 data channels will contain at a minimum, 2 transfor-mations, 600 flows and 200 connections. Although not complex to create, such aconfiguration script represents a large amount of typing and is an onerous task tocreate manually, as the author knows all too well.

Accordingly, we looked at various technologies for simplifying this task. We wereprimarily concerned with software packages or libraries that supported the creationof graphs, that is, collections of nodes and arcs. A graph is the most intuitive wayto display a processing network, although each node and arc must be able to haveseveral parameters applied to them.

We found several such packages but none were suitable. The requirement to applyparameters to nodes and arcs exceed anything we have found available. We douse the dot program from the graphviz package [12] to generate simple networkrepresentations (such as figure 5), but it is not adequate to serve as a graph editor.Accordingly, we have started creating a script editor entirely from scratch, with thevisual design borrowing from pgaccess [13] and Khoros’ Canata.

2.2.2 Navigating the Data Repository

Another challenge arising from the large number of acquired channels is that navi-gating the results. Currently, GUARDIAN data is imported into a datatrac database,from where the results can be exported in a number of different formats via the

6

Page 15: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Figure 5: Sample processing network

7

Page 16: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

web interface (figure 6). However, navigating hundreds of data channels throughthis interface is difficult. Accordingly, we began to examine different options forproviding more intuitive and customizable access by the user.

Figure 6: Sample datatrac database window

The most widely used and arguably successful paradigms for data organization isthe file system: a collection of files and directories arranged in a hierarchical andrecursive manner. As this interface is very familiar and intuitive to all computerusers, we decided to implement a file system interface to the datatrac database.

There were three main technologies which we examined for this purpose. The ex-cellent konqueror [14] file manager and web browser provided by the KDE [15]project seemed to be good choice. This file manager (figure 7) is highly customiz-able and pleasant to work with. It uses the KDE KIO [16] connection technologywhich seemed to be a good fit to our requirements. However, KIO is layered on topof the Qt library [17] which is licensed via the GNU General Public License (GPL)[18] which would encumber our software unduly.

The gnomeVFS [19] virtual file system library was another possible option. Usingthis package would require the researcher to use Gnome’s nautilus file manager(figure 8), but this manager is very similar to that of Microsoft Windows, with which

8

Page 17: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Figure 7: Sample konqueror window as file manager

most users are familiar. gnomeVFS is also a simpler if more restricted technologythan KIO. However, this library is also covered under GPL and so is unsuitable forintegration at this low level.

Perhaps a word about GPL would be appropriate here. At DRDC Toronto andat Covenant Systems Development, we make extensive use of Open Source andGPL software packages. However, when looking to deliver an integrated softwarelibrary, if that library would require GPL’d source for basic operation, we typicallyfind another option. Although the GPL represents a noble social experiment and alaudable ideal, Covenant Systems will rarely accept the encumbrance it requires onany software developed for an employer where the intellectual property and sourcereside with the employer.

Finally, we discovered the excellent “Filesystem in User Space” or FUSE package[20]. This library is covered by the LGPL [21] which does not involve encumberingthe software developed under contract. Also, it provides a full, low-level filesysteminterface, which allows the user to employ any file manager they desire, includingkonqueror and nautilus. FUSE also avoids much of the complexity of KIO whilebeing more expressive than gnomeVFS. This is the package we have decided tomove forward with in future development.

9

Page 18: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Figure 8: Sample nautilus window

2.2.3 Monitoring via a Graphical Waveform User Interface

The existing user interface available within GUARDIAN was originally designed asa display for monitoring atmosphere quality in military vehicles [22]. Such param-eters must be displayed with great accuracy, requiring numeric displays (figure 9),but change slowly, meaning that any waveform representation can be updated at alow rate (figure 10). These requirements are completely inverted for this new ap-plication of GUARDIAN, where values such as EEG and EMG are dimensionlessand their magnitude almost meaningless, but the waveform shape and frequencycomposition of these high-speed channels is all important.

Accordingly, we have undertaken the design and implementation of a generic wave-form plotting graphical display. Within GUARDIAN, the design of such a displayhas several challenges, the greatest two being:

1. representing multidimensional data in an intuitive format, and

2. representing the content of the data when a simple label does not suffice as thedata is the sum total of the preceding processing network.

We designed a new active object [23] class called WaveUI. Using the paraGUI [24]graphical toolkit overlayed on the multiplatform SDL library [25] and the OpenGL

10

Page 19: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Figure 9: Original GUARDIAN user interface

Figure 10: Original GUARDIAN user interface with graphing

11

Page 20: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

accelerated graphics library [26], we gained the ability to create a full-featuredinterface with the typical GUI items — pull-down menus, check boxes, buttons —combined with the powerful, accelerated graphics rendering provided by modernvideo cards. Figure 11 shows an extensive if overenthusiastic example.

Figure 11: Sample paraGUI interface

The WaveUI class aggregates any number of lower-level graphing objects whichthemselves handle user interaction through controls, data representation throughgraphical plots and data representation through digital displays. Currently only thegraphical plot classes have been implemented.

Each graphical plot object — the GLGraph class — can represent an arbitrary num-ber of individual traces, encapsulated in the GraphTrace class. Each GraphTracedefines the mapping of a data flow’s dimensions to various graphical elements,scales the data both in X and Y dimensions, and handles colour mapping.

Through these mechanisms, the user can create displays that represent multidimen-sional data in flexible and hopefully intuitive ways. For example, suppose oneof the data flows we wish to display is heart rate, which consists of a stream ofdata triplets: timestamp, heart rate value, reliability index. The user may elect tograph 30 seconds of this data on the screen, using a scrolling display where the firstfive seconds of data use 25% of the screen area and the remaining 25 seconds issqueezed into the other 75%. This would provide a magnified display of the mostrecent data with a more condensed display of older data, keeping trends visiblewithout details. The user may choose to map the heart rate value dimension as theY value and the reliability index value to the trace’s alpha. Thus, as the reliability

12

Page 21: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

value falls, the trace becomes more and more transparent. Reliable data, on theother hand, will be plotted boldly and opaquely (figure 12).

Figure 12: Sample graphical representation of heart rate.

The various dimensions of the data may be used to control the trace’s colour, alphavalue, line width, point size or to create error bars. Dimensions may also be reused,so the same dimension may be used both for colour and for point size.

Although this user interface is implemented using OpenGL, we have also abstractedthe main plot elements to support display device independence. Each GraphTraceobject emits a stream of TraceGraphElement objects, which contain the device-independent graphical parameters. These objects may either to passed to a ren-dering engine, or for efficiency’s sake, they are able to render themselves usingOpenGL upon request.

2.2.4 Optimizing CPU and Storage Resources

The libraries required for implementing the various graphical user interfaces, in-cluding SDL, OpenGL, aedGUI, paraGUI and a few others, greatly increase thesize of the executable and the porting effort for supporting GUARDIAN on any givenplatform. Since these libraries are only required for user interfaces, we created anumber of conditional compilation rules and macros that allow them to be includedonly when required. For simple GUARDIAN applications that have no such needs,these libraries are not required and can be removed from the compilation by chang-ing two compile time parameters.

For optimizing CPU time, we encountered some issues with the ACE Token mutex.GUARDIAN makes extensive use of the ACE architecture [27], including its mu-tual exclusion devices. We were not aware until recently that the ACE Token doesnot support multiple simultaneous readers. We several hours designing and imple-menting a multiple reader, single writer, recursive, timed, fair semaphore only toconclude that such a solution was too complex and too expensive.

Accordingly, we needed to reanalyze some critical areas of GUARDIAN, in particu-lar the ubiquitous DataPathManager, to ensure the finest possible degree of gran-ularity in its locking of critical sections. Once done, we experienced no problemsin running the prototype at the required rates.

13

Page 22: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

3 Future Directions

The current direction of this program is excellent, thus our recommendations are fo-cused on continuing in the current direction and bringing to completion the projectsstarted under this contract.

With WaveUI and its helper classes, we have just achieved basic functionality. Thissubsystem should be completed and integrated into GUARDIAN, as it will providea good foundation for both embedded and remote data displays. For embeddedsystems with graphical interfaces, the user will have access to several simultaneousplots, while being careful to conserve CPU resources for real-time operations. Forremote systems connected over a network, the user will be able to employ manydifferent displays and graphs simultaneously thanks to the splitting of the real-timeacquisition and display functionality.

The filesystem interface to the datatrac database should be implemented. We be-lieve giving the users control over how their data appears, how it’s filtered, and theorganization of its various elements, will simplify their interaction with this ever-growing database.

Together with the new interface, a plugin module for exporting datatrac databaseinformation in HDF5 format should be created. Although datatrac currently sup-ports several file formats, including zip archives, text files and various binary for-mats, HDF5 export will likely provide a better interface for supporting more exten-sive use of OpenDX.

Also, the ways that OpenDX can assist this research project need to be exploredfurther. While we have gained some experience in using this program, the specificinteraction required by the users with their acquired data needs further clarification.Implementing the previous recommendations regarding the database will provide agood foundation for this future interaction.

The creation of a script editor for GUARDIAN we consider more of a “nice to have”than a “need to have”. Although tedious and somewhat error prone, the currentmanual method for creating network scripts is usable (see the example in annex B).The effort required to create an graphical editor is at this point difficult to justify.

Finally, we need to put together some basic PDP++ scripts that are applicable tothis research project. From these we can generate the C++ which will be integratedinto GUARDIAN. Even some simple examples should allow us to understand therequirements of the resulting code, in particular, the I/O, memory and CPU require-ments.

14

Page 23: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Annex AC++ Library Code

15

Page 24: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

GLGraph.cpp/∗ ∗∗ $ R e v i s i o n : 1 . 2 $∗ /

# i f d e f WAVE UI ENABLED

# i n c l u d e <SDL / SDL . h>

# i n c l u d e "GLGraph.h"# i n c l u d e "GraphTrace.h"# i n c l u d e "GuardianLock .h"# i n c l u d e "Guardian.h"# i n c l u d e "GuardianLog .h"

GLGraph : : GLGraph ( c o n s t unsigned i n t inWidth ,c o n s t unsigned i n t i n H e i g h t ,c o n s t unsigned i n t inX ,c o n s t unsigned i n t inY )

: maToken ( ) , mnWidth ( inWid th ) , mnHeight ( i n H e i g h t ) ,mnOriginX ( inX ) , mnOriginY ( inY )

{DBUG BTRACE ( "GLGraph::ctor" ,

"( inWidth = %d, inHeight = %d, inX = %d, inY = %d )" ,inWidth , i n H e i g h t , inX , inY ) ;

ACE Time Value l a T e n t h S e c o n d ;

l a T e n t h S e c o n d . s e t ( 0 . 1 ) ;

ACE Time Value laTenSeconds ;

l aTenSeconds . s e t ( 1 0 . 0 ) ;

DBUG PRINT ( DBUG DEBUG, "test time = %f" ,l aTenSeconds . msec ( ) ∗ 1 . 0 e −3 ) ;

s e t P r i m a r y T i m e s c a l e ( 1 . 0 ) ;}

GLGraph : : ˜ GLGraph ( void ){

DBUG TRACE ( "GLGraph::dtor" ) ;GuardWri te gua rd ( maToken ) ;

}

void GLGraph : : n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t inSinkID ,D a t a B l o c k P t r i a D a t a B l o c k )

16

Page 25: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

{DBUG BTRACE ( "GLGraph::notifyDataListener " ,

"( inSinkID = %d, iaDataBlock )" , i nS inkID ) ;

GuardWri te gua rd ( maToken ) ;

/∗∗ Map s i n k ID t o t h e t r a c e .∗ /

TRACE MAP : : i t e r a t o r l i T r a c e = maTraceMap . f i n d ( inS inkID ) ;

i f ( l i T r a c e = = maTraceMap . end ( ) ) {DBUG WARN ( "Received data on unknown sink ID (%d)" , i nS inkID ) ;re turn ;

}

/∗∗ Update DataBlock by c o n c a t e n a t i n g t h e n t r imming .∗ /

l i T r a c e−>second . mbDataChanged = t rue ;

DataBlock & l r D a t a B l o c k = l i T r a c e−>second . maDataBlock ;

l r D a t a B l o c k . addDataBlock ( ∗ ( i a D a t a B l o c k . g e t ( ) ) ) ;

f l o a t l f F i n a l T i m e s t a m p = l r D a t a B l o c k . g e t F i n a l T i m e s t a m p ( ) ;

f l o a t l f T o t a l T i m e = l f F i n a l T i m e s t a m p − l r D a t a B l o c k . g e t I n i t i a l T i m e s t a m p ( ) ;

i f ( l f T o t a l T i m e > maTimesca leVec to r [ 0 ] . mfTimeWidth ) {/ / f l o a t l f C u t T i m e = l f F i n a l T i m e s t a m p − l f T o t a l T i m e ;f l o a t l fCu tT ime = l f F i n a l T i m e s t a m p − maTimesca leVec to r [ 0 ] . mfTimeWidth ;l r D a t a B l o c k . c u t ( l fCu tT ime ) ;

}}

void GLGraph : : n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t )

{DBUG BTRACE ( "GLGraph::notifyDataListener " ,

"( sinkID = %d, event )" , s i nk ID ) ;

i f ( even t−>ge tType ( ) = = D a t a P a t h E v e n t : : EVENT TIMER ) {drawUpdate ( ) ;

}}

void GLGraph : : drawUpdate ( void ){

17

Page 26: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DBUG TRACE ( "GLGraph::drawUpdate" ) ;

GuardRead guard ( maToken ) ;

/∗∗ Run t h r o u g h a l l o f t h e t r a c e s and upda te them . Update Y v a l u e s i f∗ t h e da ta has changed , t h e n draw u s i n g t h e r e p r e s e n t a t i v e da ta v a l u e s .∗ /

TRACE MAP : : i t e r a t o r l i C u r r = maTraceMap . b e g i n ( ) ;

whi le ( l i C u r r ! = maTraceMap . end ( ) ) {i f ( l i C u r r−>second . mbDataChanged ) {

DBUG PRINT ( DBUG GRAPH , "update trace %d" , l i C u r r−> f i r s t ) ;l i C u r r−>second . mpTrace−>u p d a t e V a l u e S c a l i n g ( l i C u r r−>second . maDataBlock ) ;l i C u r r−>second . mbDataChanged = f a l s e ;l i C u r r−>second . mpTrace−>graphDa taBlock ( l i C u r r−>second . maDataBlock ,

NULL ) ;}l i C u r r ++;

}}

void GLGraph : : s e t P r i m a r y T i m e s c a l e ( c o n s t f l o a t i fT imeWid th ){

DBUG BTRACE ( "GLGraph::setPrimaryTimescale " , "( ifTimeWidth = %f )" ,i fT imeWid th ) ;

GuardWri te gua rd ( maToken ) ;

maTimesca leVec to r . r e s e r v e ( 1 ) ;

i f ( maTimesca leVec to r . s i z e ( ) < 1 ) {s t r u c t TimescaleWindowInfo l a T I ;maTimesca leVec to r . push back ( l a T I ) ;

}

maTimesca leVec to r [ 0 ] . mfTimeWidth = i fT imeWid th ;maTimesca leVec to r [ 0 ] . mfWindowWidth = GraphTrace : : TOTAL WINDOW WIDTH;maTimesca leVec to r [ 0 ] . mnPrecedingWindow = 0 ;

TRACE MAP : : i t e r a t o r c u r r = maTraceMap . b e g i n ( ) ;whi le ( c u r r ! = maTraceMap . end ( ) ) {

c u r r−>second . mpTrace−>s e t P r i m a r y T i m e s c a l e ( i fT imeWid th ) ;}

}

void GLGraph : : addTimescaleWindow ( c o n s t f l o a t i fTimeWidth ,c o n s t f l o a t ifWindowWidth ,c o n s t unsigned i n t inPrecedingWindow )

{

18

Page 27: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DBUG BTRACE ( "GLGraph::addTimescaleWindow " ,"( ifTimeWidth = %f, ifWindowWidth = %f, inPrecedingWindow = %d )" ,

i fTimeWidth , ifWindowWidth , inPrecedingWindow ) ;

GuardWri te gua rd ( maToken ) ;

maTimesca leVec to r . r e s e r v e ( maTimesca leVec to r . s i z e ( ) + 1 ) ;

s t r u c t TimescaleWindowInfo l a T I ;

l a T I . mfTimeWidth = i fT imeWid th ;l a T I . mfWindowWidth = ifWindowWidth ;l a T I . mnPrecedingWindow = inPrecedingWindow ;

maTimesca leVec to r . push back ( l a T I ) ;

TRACE MAP : : i t e r a t o r c u r r = maTraceMap . b e g i n ( ) ;whi le ( c u r r ! = maTraceMap . end ( ) ) {

c u r r−>second . mpTrace−>addTimescaleWindow ( i fTimeWidth ,ifWindowWidth ,inPrecedingWindow ) ;

}

}

GraphTrace ∗ GLGraph : : addNewTrace ( c o n s t ACE CString & isName ,c o n s t unsigned i n t inID )

{DBUG BTRACE ( "GLGraph::addNewTrace " , "( isName = \"%s\", inID = %d )" ,

isName . c s t r ( ) , inID ) ;

GraphTrace ∗ lpNewTrace = new GraphTrace ( ) ;

GuardRead guardRead ( maToken ) ;

lpNewTrace−>s e t D i s p l a y S i z e ( mnWidth , mnHeight ,mnOriginX , mnOriginY ) ;

lpNewTrace−>s e t P r i m a r y T i m e s c a l e ( maTimesca leVec to r [ 0 ] . mfTimeWidth ) ;

f o r ( unsigned i n t l n I n d e x = 1 ; l n I n d e x < maTimesca leVec to r . s i z e ( ) ; l n I n d e x ++){lpNewTrace−>addTimescaleWindow ( maTimesca leVec to r [ l n I n d e x ] . mfTimeWidth ,

maTimesca leVec to r [ l n I n d e x ] . mfWindowWidth ,maTimesca leVec to r [ l n I n d e x ] . mnPrecedingWindow ) ;

}

GuardWri te gua rd ( maToken ) ;

maTraceMap [ inID ] . mpTrace = lpNewTrace ;maTraceMap [ inID ] . msName = isName ;

19

Page 28: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

re turn ( lpNewTrace ) ;}

GraphTrace ∗ GLGraph : : ge tTraceByFlowID ( c o n s t unsigned i n t inFlowID ){

DBUG BTRACE LOW ( "GLGraph:: getTraceByFlowID " , "( inFlowID = %d )" , inFlowID ) ;

GuardRead guard ( maToken ) ;

TRACE MAP : : c o n s t i t e r a t o r l i C u r r = maTraceMap . f i n d ( inFlowID ) ;

i f ( l i C u r r = = maTraceMap . end ( ) ) {re turn ( NULL ) ;

}re turn ( l i C u r r−>second . mpTrace ) ;

}

void GLGraph : : i n i t i a l i z e G L A t t r i b u t e s ( void ){

DBUG TRACE STATIC ( "GLGraph:: initializeGLAttributes " ) ;

S D L G L S e t A t t r i b u t e ( SDL GL RED SIZE , 5 ) ;S D L G L S e t A t t r i b u t e ( SDL GL GREEN SIZE , 5 ) ;S D L G L S e t A t t r i b u t e ( SDL GL BLUE SIZE , 5 ) ;S D L G L S e t A t t r i b u t e ( SDL GL DEPTH SIZE , 1 6 ) ;S D L G L S e t A t t r i b u t e ( SDL GL DOUBLEBUFFER , 1 ) ;S D L G L S e t A t t r i b u t e ( SDL GL ALPHA SIZE , 5 ) ;

}

# e n d i f / / WAVE UI ENABLED

20

Page 29: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

GLGraph.h/∗ ∗∗ @ f i l e∗∗ @vers ion∗ $ R e v i s i o n : 1 . 1 $∗ /

# i f d e f WAVE UI ENABLED

# i f n d e f GLGRAPH H# d e f i n e GLGRAPH H

# i n c l u d e <SDL / SDL . h>

# i n c l u d e < ace / Token . h>

# i n c l u d e < ace / S S t r i n g . h>

# i n c l u d e <map>

# i n c l u d e "DataPathListener .h" / / f o r D a t a B l o c k Pt r

# i n c l u d e "GraphTrace.h"

us ing namespace s t d ;

/∗ ∗∗ M i n i m i a l i s t G r a p h i c a l d i s p l a y u s i n g OpenGL .∗∗ T h i s o b j e c t r e q u i r e s SDL and assumes t h a t SDL w i l l be opened w i t h∗ a p p r o p r i a t e OpenGL i n i t i a l i z a t i o n ( i . e . SDL OPENGL or SDL OPENGLBIT ,∗ t y p i c a l l y t h e l a t t e r s i n c e t h i s c l a s s i s t y p i c a l l y used w i t h ParaGUI .∗∗ The c l a s s p r o v i d e s a s t a t i c method i n i t i a l i z e G L A t t r i b u t e s ( ) which can∗ be c a l l e d <em>b e f o r e </em> SDL i n i t i a l i z a t i o n t o s e t up GL a p p r o p r i a t e l y .∗∗ So t h e c a l l p a t t e r n i s :∗ <code>

∗ S D L I n i t ( SDL VIDEO ) ;∗ GLGraph : : i n i t i a l i z e G L A t t r i b u t e s ( ) ;∗ SDL SetVideoMode ( . . . , SDL OPENGL ) ;∗ GLGraph myGraph ( ) ;∗ < / code>

∗ /

c l a s s GLGraph : p u b l i c D a t a P a t h L i s t e n e r{

p u b l i c :

void drawUpdate ( void ) ;

21

Page 30: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

v i r t u a l void n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a B l o c k P t r d a t a ) ;

v i r t u a l void n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t ) ;

/∗ ∗∗ E s t a b l i s h n e c e s s a r y GL a t t r i b u t e s t h r o u g h t h e S D L G L S e t A t t r i b u t e ( )∗ /

s t a t i c void i n i t i a l i z e G L A t t r i b u t e s ( void ) ;

/∗ ∗∗ Update t h e g i v e n t r a c e w i t h a new DataBlock .∗∗ @param[ i n ] inTrace ID t h e ID o f t h e t r a c e t o be upda ted∗ @param[ i n ] i a D a t a B l o c k t h e a u t o p t r t o t h e DataBlock∗ /

void u p d a t e T r a c e ( c o n s t unsigned i n t i nTrace ID ,D a t a B l o c k P t r i a D a t a B l o c k ) ;

/∗ ∗∗ Removes a d i s p l a y t r a c e from t h e graph .∗∗ @param[ i n ] i p T r a c e p o i n t e r t o t h e t r a c e∗ /

void removeTrace ( GraphTrace ∗ i p T r a c e ) ;

void removeTrace ( c o n s t unsigned i n t i n T r a c e I D ) ;

/∗ ∗∗ Adds a d i s p l a y t r a c e t o t h e graph .∗∗ A ” t r a c e ” i s a s i n g l e l i n e or da ta s i g n a l on t h e d i s p l a y . When t h i s∗ method i s c a l l e d , a new t r a c e s l o t i s e s t a b l i s h e d and a prepared∗ GraphTrace o b j e c t i s r e t u r n e d .∗∗ @param[ i n ] isName t h e name o f t h e t r a c e∗ @param[ i n ] inID t h e f l o w ID o f t h e t r a c e . I t i s t h i s v a l u e t h a t w i l l be∗ used when da ta comes i n v i a n o t i f y D a t a L i s t e n e r ( ) t o a s s i g n t h e da ta∗ t o t h e c o r r e c t t r a c e∗∗ @returns a p o i n t e r t o t h e t r a c e∗ /

GraphTrace ∗ addNewTrace ( c o n s t ACE CString & isName ,c o n s t unsigned i n t inID ) ;

22

Page 31: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

GraphTrace ∗ getTraceByFlowID ( c o n s t unsigned i n t inFlowID ) ;

/∗ ∗∗ D e f i n e t h e w i d t h o f t h e t o t a l p l o t i n t e r m s o f s e c o n d s o f da ta .∗∗ T h i s i n f o r m a t i o n i s propaga ted t o a l l GraphTrace ’ s a g g r e g a t e d by∗ t h e GLGraph .∗∗ @param[ i n ] i f T i m e W i d t h w i d t h o f t h e p l o t i n s e c o n d s o f da ta∗ /

void s e t P r i m a r y T i m e s c a l e ( c o n s t f l o a t i fT imeWid th ) ;

/∗ ∗∗ Add a d d i t i o n a l t i m e s c a l e s t o a l l o f t h e GraphTrace o b j e c t s a g g r e g a t e d∗ by t h i s GLGraph .∗∗ @param[ i n ] i f T i m e W i d t h w i d t h o f t h e p l o t i n s e c o n d s o f da ta∗ @param[ i n ] i fWindowWidth w i d t h o f t h e p l o t i n t e r m s o f p e r c e n t a g e o f∗ t o t a l w i d t h o f window ( 0 . 0 t o 1 . 0 )∗ @param[ i n ] inPrecedingWindow i n d e x o f t h e e x i s t i n g t i m e s c a l e window∗ which t h i s new window w i l l be i n s e r t e d j u s t t o t h e l e f t o f∗ @ref GraphTrace : : addTimescaleWindow∗ /

void addTimescaleWindow ( c o n s t f l o a t i fTimeWidth ,c o n s t f l o a t ifWindowWidth ,c o n s t unsigned i n t inPrecedingWindow ) ;

/∗ ∗∗ Crea te a graph w i t h t h e window s i z e and o r i g i n g i v e n i n p i x e l s .∗ For t h e o r i g i n o r i e n t a t i o n , ( 0 , 0 ) i s upper− l e f t c o r n e r .∗∗ @param[ i n ] i n W i d t h w i d t h o f t h e graph ing window i n p i x e l s .∗ @param[ i n ] i n H e i g h t h e i g h t o f t h e graph ing window i n p i x e l s .∗ @param[ i n ] inX X c o o r d i n a t e o f t h e o r i g i n i n p i x e l s .∗ @param[ i n ] inY Y c o o r d i n a t e o f t h e o r i g i n i n p i x e l s .∗ /

GLGraph ( c o n s t unsigned i n t inWidth , c o n s t unsigned i n t i n H e i g h t ,c o n s t unsigned i n t inX , c o n s t unsigned i n t inY ) ;

v i r t u a l ˜ GLGraph ( ) ;

p r i v a t e :mutable ACE Token maToken ;

unsigned i n t mnWidth ;unsigned i n t mnHeight ;unsigned i n t mnOriginX ;

23

Page 32: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

unsigned i n t mnOriginY ;

ACE Time Value maLeadBuf fe rS ize ;

/∗ ∗∗ S t o r e s i n f o r m a t i o n r e g a r d i n g t h e s c a l i n g o f t h e da ta t o t h e s c r e e n∗ over a f i x e d t i m e ( X ) w i d t h .∗ /

s t r u c t TimescaleWindowInfo {f l o a t mfTimeWidth ;f l o a t mfWindowWidth ;unsigned i n t mnPrecedingWindow ;

} ;

t y p e d e f v e c t o r <s t r u c t TimescaleWindowInfo > TIMESCALE VECTOR ;

TIMESCALE VECTOR maTimesca leVec to r ;

c l a s s TraceMapInfo {p u b l i c :

TraceMapInfo ( void ): mpTrace (NULL) , msName( "" ) , maDataBlock ( ) , mbDataChanged ( f a l s e ) ,mpGraphVector (NULL){

mpGraphVector = new GraphTrace : : TRACE GRAPH VECTOR ;}

GraphTrace ∗ mpTrace ;ACE CString msName ;DataBlock maDataBlock ;bool mbDataChanged ;GraphTrace : : TRACE GRAPH VECTOR ∗ mpGraphVector ;

} ;

t y p e d e f map<unsigned i n t , TraceMapInfo > TRACE MAP;

TRACE MAP maTraceMap ;} ;

# e n d i f / / GLGRAPH H

# e n d i f / / WAVE UI ENABLED

24

Page 33: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

GraphTrace.cpp/∗ ∗∗ @ f i l e∗∗ $ R e v i s i o n : 1 . 1 $∗ /

# i f d e f WAVE UI ENABLED

# i n c l u d e "ACE_DBUG.h"

# i n c l u d e "DataBlock.h"# i n c l u d e "Guardian.h"# i n c l u d e "GuardianException .h"# i n c l u d e "TraceGraphElement .h"# i n c l u d e "GraphTrace.h"

# i n c l u d e < i o s t r e a m >

GraphTrace : : GraphTrace ( void ): maToken ( ) , maTimesca leVec to r ( ) ,

mfMaxValue ( −HUGE VALF ) , mfMinValue ( HUGE VALF ) ,mfM ( 1 . 0 ) , mfB ( 0 . 0 ) ,mnDisplayWidth ( 0 ) , mnDisp layHe igh t ( 0 ) ,mnDisplayOrig inX ( 0 ) , mnDisplayOrig inY ( 0 )

{DBUG TRACE LOW ( "GraphTrace ::ctor" ) ;

se tDimCount ( 1 ) ;se tDimPr imary ( 0 ) ;s e t P r i m a r y T i m e s c a l e ( 1 . 0 ) ;s e t P r i m a r y T r a c e T y p e ( ( unsigned i n t ) TT LINES ) ;s e t V a l u e S c a l i n g ( SF LINEAR , SUT LOCAL ) ;

}

GraphTrace : : ˜ GraphTrace ( void ){

DBUG TRACE LOW ( "GraphTrace ::dtor" ) ;GuardWri te gua rd ( maToken ) ;

}

unsigned i n t GraphTrace : : getDimCount ( void ){

DBUG TRACE LOW ( "GraphTrace :: getDimCount " ) ;GuardRead guard ( maToken ) ;re turn ( maDimTraceModifier . s i z e ( ) ) ;

}

void GraphTrace : : s e tDimPr imary ( c o n s t unsigned i n t i nPr imaryDimIndex ){

25

Page 34: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DBUG BTRACE ( "GraphTrace :: setDimPrimary " , "( inPrimaryDimIndex = %d )" ,i nPr imaryDimIndex ) ;

GuardWri te gua rd ( maToken ) ;

i f ( inPr imaryDimIndex >= getDimCount ( ) ) {GEX ( "Primary index larger than dimension count" , E BADINDEX ) ;

}

mnPrimaryDimIndex = inPr imaryDimIndex ;}

unsigned i n t GraphTrace : : ge tDimPrimary ( void ) c o n s t{

DBUG TRACE LOW ( "GraphTrace :: getDimPrimary " ) ;

GuardRead guard ( maToken ) ;

re turn ( mnPrimaryDimIndex ) ;}

void GraphTrace : : s e t P r i m a r y T r a c e T y p e ( c o n s t unsigned i n t i n T r a c e T y p e F l a g s ){

DBUG BTRACE ( "GraphTrace :: setPrimaryTraceType " , "( inTraceTypeFlags = %d )" ,i n T r a c e T y p e F l a g s ) ;

GuardWri te gua rd ( maToken ) ;

/∗∗ V e r i f y t r a c e t y p e .∗ /

i f ( i n T r a c e T y p e F l a g s >= ( 1 < < 2 ) ) {DBUG PRINT ( DBUG EX , "Trace flags setting invalid (%d > %d max)" ,

i n T r a c e T y p e F la gs , ( 1 < < 4 ) − 1 ) ;GEX ( "Invalid trace type flags" , E BADARG ) ;

}

mnTraceType = i n T r a c e T y p e F l a g s ;}

void GraphTrace : : se tDimCount ( c o n s t unsigned i n t inDimCount ){

DBUG BTRACE ( "GraphTrace :: setDimCount" , "( inDimCount = %d )" , inDimCount ) ;

GuardWri te gua rd ( maToken ) ;

i f ( inDimCount = = maDimTraceModifier . s i z e ( ) ) {re turn ;

}

26

Page 35: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

i f ( inDimCount < maDimTraceModifie r . s i z e ( ) ) {i f ( inDimCount <= mnPrimaryDimIndex ) { / / a re we d e l e t i n g pr imary ?

GEX ( "New dim count would delete primary" , E BADARG ) ;}

unsigned i n t l n D e l e t e C o u n t = maDimTraceModifier . s i z e ( ) − inDimCount ;

DBUG WARN ( "Deleting %d dimensions " , l n D e l e t e C o u n t ) ;

f o r ( unsigned i n t l n I n d e x = 0 ; l n I n d e x < l n D e l e t e C o u n t ; l n I n d e x + + ) {maDimTraceModifier . pop back ( ) ;

}

re turn ;}

maDimTraceModifie r . r e s e r v e ( inDimCount ) ;

unsigned i n t lnAddCount = inDimCount − maDimTraceModifie r . s i z e ( ) ;

s t r u c t D i m T r a c e M o d i f i e r In fo laNewTrace ;

f o r ( unsigned i n t l n I n d e x = 0 ; l n I n d e x < lnAddCount ; l n I n d e x + + ) {maDimTraceModifie r . push back ( laNewTrace ) ;s e t D i m T r a c e M o d i f i e r ( getDimCount ( ) −1 , ( unsigned i n t )TM NONE ) ;

}

re turn ;}

void GraphTrace : : s e t D i m T r a c e M o d i f i e r ( c o n s t i n t inDimIndex ,c o n s t unsigned i n t i n T r a c e M o d i f i e r F l a g s )

{DBUG BTRACE ( "GraphTrace :: setDimTraceModifier " ,

"( inDimIndex = %d, inTraceModifierFlags = %d )" ,inDimIndex , i n T r a c e M o d i f i e r F l a g s ) ;

GuardWri te gua rd ( maToken ) ;

/∗∗ Check i n d e x .∗ /

i f ( inDimIndex > = 0 ) {i f ( inDimIndex >= ( i n t ) maDimTraceModifier . s i z e ( ) ) {

DBUG PRINT ( DBUG EX , "Index (%d) greater than configured (%d)" ,inDimIndex , maDimTraceModif ie r . s i z e ( ) ) ;

GEX ( "Index greater than number of dimensions configured" , E BADINDEX ) ;}

}

27

Page 36: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

/∗∗ V e r i f y t r a c e t y p e .∗ /

i f ( i n T r a c e M o d i f i e r F l a g s >= ( 1 < < 4 ) ) {DBUG PRINT ( DBUG EX , "Trace flags setting invalid (%d > %d max)" ,

i n T r a c e M o d i f i e r F l a g s , ( 1 < < 4 ) − 1 ) ;GEX ( "Invalid trace type flags" , E BADARG ) ;

}

/∗∗ Cyc le t h r o u g h a l l s e l e c t e d i n d i c e s ( i . e . e i t h e r t h e g i v e n i n d e x v a l u e∗ or a l l p o s s i b l e d i m e n s i o n s ) .∗ /

DIM TRACE MODIFIER VECTOR : : i t e r a t o r c u r r = maDimTraceModif ie r . b e g i n ( ) ;

i f ( inDimIndex > = 0 ) {c u r r + = inDimIndex ;

}

whi le ( c u r r ! = maDimTraceModifier . b e g i n ( ) ) {c u r r−>mnTraceModi f i e r s = i n T r a c e M o d i f i e r F l a g s ;i f ( inDimIndex > = 0 ) {

break ;}c u r r ++;

}}

void GraphTrace : : a d d P r i m a r yC olo ur ( c o n s t f l o a t i fRed ,c o n s t f l o a t i f G r e e n ,c o n s t f l o a t i f B l u e ,c o n s t f l o a t i f A l p h a ,c o n s t bool i bUseVa lueLimi t s ,c o n s t f l o a t i fMinValue ,c o n s t f l o a t i fMaxValue )

{DBUG BTRACE ( "GraphTrace :: addPrimaryColour " ,

"( ifRed = %g, ifGreen = %g, ifBlue = %g, ifAlpha = %g, ibUseValueLimits = %d, ifMinValue = %f, ifMaxValue = %f )" ,i fRed , i f G r e e n , i f B l u e , i f A l p h a ,ibUseVa lueLimi t s , i fMinValue , i fMaxValue ) ;

addDimColour ( t h i s−>getDimPrimary ( ) ,i fRed , i f G r e e n , i f B l u e , i f A l p h a ,ibUseVa lueLimi t s , i fMinValue , i fMaxValue ) ;

}

void GraphTrace : : addDimColour ( c o n s t i n t inDimIndex ,c o n s t f l o a t i fRed ,

28

Page 37: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

c o n s t f l o a t i f G r e e n ,c o n s t f l o a t i f B l u e ,c o n s t f l o a t i f A l p h a ,c o n s t bool i bUseVa lueLimi t s ,c o n s t f l o a t i fMinValue ,c o n s t f l o a t i fMaxValue )

{DBUG BTRACE ( "GraphTrace :: addDimColour " ,

"( inDimIndex = %d, ifRed = %g, ifGreen = %g, ifBlue = %g, ifAlpha = %g, ibUseValueLimits = %d, ifMinValue = %f, ifMaxValue = %f )" ,inDimIndex , i fRed , i f G r e e n , i f B l u e , i f A l p h a ,ibUseVa lueLimi t s , i fMinValue , i fMaxValue ) ;

GuardWri te gua rd ( maToken ) ;

/∗∗ Check d i m e n s i o n i n d e x .∗ /

i f ( inDimIndex > = 0 ) {i f ( inDimIndex >= ( i n t ) maDimTraceModifier . s i z e ( ) ) {

DBUG PRINT ( DBUG EX , "Index (%d) greater than configured (%d)" ,inDimIndex , maDimTraceModif ie r . s i z e ( ) ) ;

GEX ( "Index greater than number of dimensions configured" , E BADINDEX ) ;}

}

/∗∗ Clamp c o l o u r v a l u e s .∗ /

s t r u c t ColourWindow l a C o l o u r ;

l a C o l o u r . mfRed = ( i f R e d < 0 . 0 ) ? 0 . 0 : ( i f R e d > 1 . 0 ) ? 1 . 0 : i f R e d ;l a C o l o u r . mfGreen = ( i f G r e e n < 0 . 0 ) ? 0 . 0 : ( i f G r e e n > 1 . 0 ) ? 1 . 0 : i f G r e e n ;l a C o l o u r . mfBlue = ( i f B l u e < 0 . 0 ) ? 0 . 0 : ( i f B l u e > 1 . 0 ) ? 1 . 0 : i f B l u e ;l a C o l o u r . mfAlpha = ( i f A l p h a < 0 . 0 ) ? 0 . 0 : ( i f A l p h a > 1 . 0 ) ? 1 . 0 : i f A l p h a ;

l a C o l o u r . mbUseValueLimits = i b U s e V a l u e L i m i t s ;

i f ( i b U s e V a l u e L i m i t s ) {i f ( i fMinVa lue >= ifMaxValue ) {

GEX ( "Min value and max value are not compatible (min >= max)" ,E BADARG ) ;

}}

l a C o l o u r . mfMinValue = i fMinVa lue ;l a C o l o u r . mfMaxValue = ifMaxValue ;

/∗∗ Cyc le t h r o u g h a l l s e l e c t e d i n d i c e s ( i . e . e i t h e r t h e g i v e n i n d e x v a l u e

29

Page 38: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗ or a l l p o s s i b l e d i m e n s i o n s ) .∗ /

DIM TRACE MODIFIER VECTOR : : i t e r a t o r c u r r = maDimTraceModif ie r . b e g i n ( ) ;

i f ( inDimIndex > = 0 ) {c u r r + = inDimIndex ;

}

whi le ( c u r r ! = maDimTraceModifier . end ( ) ) {c u r r−>maColours . i n s e r t ( l a C o l o u r ) ;c u r r−>mnTraceModi f i e r s = ( TM COLOUR | c u r r−>mnTraceModi f i e r s ) ;i f ( inDimIndex > = 0 ) {

break ;}c u r r ++;

}}

void GraphTrace : : s e t V a l u e S c a l i n g ( c o n s t SCALE FUNCTION & i a S c a l i n g F u n c t i o n ,c o n s t SCALE UPDATE TYPE & i a S c a l i n g T y p e )

{DBUG BTRACE ( "GraphTrace :: setValueScaling " ,

"( iaScalingFunction = %d, iaScalingType = %d )" ,i a S c a l i n g F u n c t i o n , i a S c a l i n g T y p e ) ;

GuardWri te gua rd ( maToken ) ;

maUpdateType = i a S c a l i n g T y p e ;m a S c a l e F u n c t i o n = i a S c a l i n g F u n c t i o n ;

}

void GraphTrace : : s e t S c a l e C o e f f s ( c o n s t f l o a t ifM ,c o n s t f l o a t i f B )

{DBUG BTRACE ( "GraphTrace :: setScaleCoeffs " ,

"( ifM = %f, ifB = %f )" , ifM , i f B ) ;

GuardWri te gua rd ( maToken ) ;

mfM = ifM ;mfB = i f B ;

}

void GraphTrace : : s e t V a l u e P e a k s ( c o n s t f l o a t i fMin ,c o n s t f l o a t i fMax )

{DBUG BTRACE ( "GraphTrace :: setValuePeaks " ,

"( ifMin = %f, ifMax = %f )" , i fMin , ifMax ) ;

GuardWri te gua rd ( maToken ) ;

30

Page 39: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

mfMinValue = i fMin ;mfMaxValue = ifMax ;

}

void GraphTrace : : u p d a t e V a l u e S c a l i n g ( DataBlock & irDB ){

DBUG TRACE ( "GraphTrace :: updateValueScaling " ) ;

i f ( maUpdateType = = SUT FIXED ) {re turn ;

}i f ( irDB . g e t P o i n t C o u n t ( ) = = 0 ) {

re turn ;}

unsigned i n t l nPr imaryDimIndex ;f l o a t l fMaxValue ;f l o a t l fMinVa lue ;

GuardRead guard ( maToken ) ;

lnPr imaryDimIndex = mnPrimaryDimIndex ;l fMaxValue = mfMaxValue ;l fMinVa lue = mfMinValue ;

i f ( irDB . g e t V e c t o r W i d t h ( ) <= lnPr imaryDimIndex ) {DBUG WARN ( "Given db is too narrow (%d dims) for this trace (min %d dims)" ,

irDB . g e t V e c t o r W i d t h ( ) , l nPr imaryDimIndex + 1 ) ;re turn ;

}

i f ( maUpdateType = = SUT LOCAL ) {l fMaxValue = s c a l e V a l u e ( irDB . g e t P o i n t ( 0 , lnPr imaryDimIndex ) ) ;l fMinVa lue = lfMaxValue ;

}

unsigned i n t lnMax = irDB . g e t P o i n t C o u n t ( ) ;

f o r ( unsigned i n t i = 0 ; i < lnMax ; i + + ) {f l o a t l f V a l = s c a l e V a l u e ( irDB . g e t P o i n t ( i , l nPr imaryDimIndex ) ) ;i f ( l f V a l > l fMaxValue ) {

l fMaxValue = l f V a l ;}i f ( l f V a l < l fMinVa lue ) {

l fMinVa lue = l f V a l ;}

}

/∗∗ Check t h a t t h e d i f f e r e n c e be tween min and max i s n ’ t so s m a l l as t o

31

Page 40: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗ d e s t a b l i z e t h e s c a l i n g c a l c u l a t i o n . I f i t i s , s e t i t t o a minimum v a l u e .∗ /

f l o a t l f D i f f e r e n c e = f a b s ( mfMaxValue − mfMinValue ) ;i f ( l f D i f f e r e n c e < 0 . 0 0 0 1 ) {

mfMaxValue + = 0 . 0 0 0 1 ;}

GuardWri te g u a r d W r i t e ( maToken ) ;mfMaxValue = lfMaxValue ;mfMinValue = l fMinVa lue ;

}

f l o a t GraphTrace : : getMaxValue ( void ) c o n s t{

DBUG TRACE LOW ( "GraphTrace :: getMaxValue " ) ;

GuardRead guard ( maToken ) ;

re turn ( mfMaxValue ) ;}

f l o a t GraphTrace : : ge tMinValue ( void ) c o n s t{

DBUG TRACE LOW ( "GraphTrace :: getMinValue " ) ;

GuardRead guard ( maToken ) ;

re turn ( mfMinValue ) ;}

void GraphTrace : : s e t P r i m a r y T i m e s c a l e ( c o n s t f l o a t i fT imeWid th ){

DBUG BTRACE ( "GraphTrace :: setPrimaryTimescale " , "( ifTimeWidth = %f )" ,i fT imeWid th ) ;

i f ( i fT imeWid th < = 0 . 0 ) {GEX ( "Timewidth must be positive and non -zero" , E BADARG ) ;

}

GuardWri te gua rd ( maToken ) ;

maTimesca leVec to r . r e s e r v e ( 1 ) ; / / need a t l e a s t 1 s l o t

i f ( maTimesca leVec to r . s i z e ( ) = = 0 ) {DBUG PRINT ( DBUG GRAPH , "initializing maTimescaleVector " ) ;s t r u c t TimescaleWindow laDummy ;maTimesca leVec to r . push back ( laDummy ) ;

}

maTimesca leVec to r [ 0 ] . mfTimeWidth = i fT imeWid th ;

32

Page 41: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

maTimesca leVec to r [ 0 ] . mfS ta r tT ime = 0 . 0 ; / / r i g h t m o s t s t a r t s a t 0 e l a p s e dmaTimesca leVec to r [ 0 ] . mfWindowWidth = 1 . 0 ∗ TOTAL WINDOW WIDTH;maTimesca leVec to r [ 0 ] . m f D i l a t i o n = TOTAL WINDOW WIDTH / i fT imeWid th ;maTimesca leVec to r [ 0 ] . m f T r a n s l a t i o n = 0 . 0 ;

}

/∗ ∗∗ @todo Someday I need t o make s u r e t h a t windows are s o r t e d a c c o r d i n g to ,∗ i n o r d e r :∗ < ol>∗ < l i >s t a r t t i m e∗ < l i >end t i m e∗ < l i >window w i d t h∗ < / o l>∗∗ I f t h i s was t r u e , t h e n t h e s e a r c h t h a t t a k e s p l a c e i n∗ GraphTrace : : ge tT imesca leWindow ( ) c o u l d be more e f f i c i e n t .∗ /

unsigned i n t GraphTrace : : addTimescaleWindow ( c o n s t f l o a t i fTimeWidth ,c o n s t f l o a t ifWindowWidth ,

c o n s t unsigned i n t inPrecedingWindow ){

DBUG BTRACE ( "GraphTrace :: addTimescaleWindow " ,"( ifTimeWidth = %f, ifWindowWidth = %f, inPrecedingWindow = %d )" ,

i fTimeWidth , ifWindowWidth , inPrecedingWindow ) ;

i f ( i fT imeWid th < = 0 . 0 ) {GEX ( "Timewidth must be positive and non -zero" , E BADARG ) ;

}

GuardWri te gua rd ( maToken ) ;

i f ( inPrecedingWindow >= maTimesca leVec to r . s i z e ( ) ) {GEX ( "Given index greater than maximum" , E BADINDEX ) ;

}

maTimesca leVec to r . r e s e r v e ( maTimesca leVec to r . s i z e ( ) + 1 ) ;

s t r u c t TimescaleWindow laWindow ;

laWindow . mfTimeWidth = i fT imeWid th ;

laWindow . mfS ta r tT ime= maTimesca leVec to r [ inPrecedingWindow ] . mfS ta r tT ime+ maTimesca leVec to r [ inPrecedingWindow ] . mfTimeWidth ;

laWindow . mfWindowWidth = ifWindowWidth ∗ TOTAL WINDOW WIDTH;

laWindow . m f T r a n s l a t i o n = maTimesca leVec to r [ inPrecedingWindow ] . m f T r a n s l a t i o n+ maTimesca leVec to r [ inPrecedingWindow ] . mfWindowWidth ;

33

Page 42: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

laWindow . m f D i l a t i o n = TOTAL WINDOW WIDTH ∗ ifWindowWidth / i fT imeWid th ;

TIMESCALE VECTOR : : i t e r a t o r c u r r = maTimesca leVec to r . b e g i n ( ) ;

c u r r + = ( maTimesca leVec to r . s i z e ( ) − inPrecedingWindow − 1 ) ;

maTimesca leVec to r . i n s e r t ( c u r r , laWindow ) ;

re turn ( inPrecedingWindow + 1 ) ;}

void GraphTrace : : s e t D i s p l a y S i z e ( c o n s t unsigned i n t inWidth ,c o n s t unsigned i n t i n H e i g h t ,c o n s t unsigned i n t i nOr ig inX ,c o n s t unsigned i n t i n O r i g i n Y )

{DBUG BTRACE ( "GraphTrace :: setDisplaySize " ,

"( inWidth = %d, inHeight = %d, inOriginX = %d, inOriginY = %d )" ,inWidth , i n H e i g h t , i nOr ig inX , i n O r i g i n Y ) ;

GuardWri te gua rd ( maToken ) ;

mnDisplayWidth = inWid th ;mnDisp layHe igh t = i n H e i g h t ;mnDisplayOrig inX = i n O r i g i n X ;mnDisplayOrig inY = i n O r i g i n Y ;

}

unsigned i n t GraphTrace : : ge tTimescaleWindowCount ( void ) c o n s t{

DBUG TRACE LOW ( "GraphTrace :: getTimescaleWindowCount " ) ;GuardRead guard ( maToken ) ;re turn ( maTimesca leVec to r . s i z e ( ) ) ;

}

void GraphTrace : : ge tTimescaleWindow ( c o n s t unsigned i n t i n I n d e x ,f l o a t & o f S t a r t T i m e ,f l o a t & ofEndTime ,f l o a t & ofTimeWidth ,f l o a t & ofWindowWidth ,f l o a t & o f D i l a t i o n ,f l o a t & o f T r a n s l a t i o n )

{DBUG BTRACE LOW ( "GraphTrace :: getTimescaleWindow " ,"( inIndex = %d, ofStartTime , ofEndTime , ofTimeWidth , ofWindowWidth , ofDilation , ofTranslation )" ,

i n I n d e x ) ;

i f ( i n I n d e x >= t h i s−>getTimescaleWindowCount ( ) ) {GEX ( "Given index larger than number of timescales " , E TOOLARGE ) ;

}

34

Page 43: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

s t r u c t TimescaleWindow laGraph = maTimesca leVec to r [ i n I n d e x ] ;

o f S t a r t T i m e = laGraph . mfS ta r tT ime ;ofEndTime = laGraph . mfS ta r tT ime + laGraph . mfTimeWidth ;ofTimeWidth = laGraph . mfTimeWidth ;ofWindowWidth = laGraph . mfWindowWidth ;o f D i l a t i o n = laGraph . m f D i l a t i o n ;o f T r a n s l a t i o n = laGraph . m f T r a n s l a t i o n − TOTAL WINDOW OFFSET;

}

void GraphTrace : : g raphDa taBlock ( c o n s t DataBlock & irDB ,TRACE GRAPH VECTOR ∗ opGraph )

{DBUG BTRACE ( "GraphTrace :: graphDataBlock " ,

"( irDB , opGraph %s )" , ( opGraph = = NULL ) ? "= NULL" : "" ) ;

GuardRead guard ( maToken ) ;

/∗∗ Pick up pr imary mapping f i r s t ( t i m e s c a l e window 0 ) . De te rmine t h e∗ t i m e s t a m p o f t h e f i r s t p o i n t t h a t we care abou t .∗ /

f l o a t l f P r i m a r y S t a r t T i m e ;f l o a t l fP r imaryEndTime ;f l o a t l fP r imaryTimeWid th ;f l o a t l fPr imaryWindowWidth ;f l o a t l f P r i m a r y D i l a t i o n ;f l o a t l f P r i m a r y T r a n s l a t i o n ;

ge tTimescaleWindow ( 0 , l f P r i m a r y S t a r t T i m e , l fPr imaryEndTime ,l fP r imaryTimeWidth , lfPrimaryWindowWidth ,l f P r i m a r y D i l a t i o n , l f P r i m a r y T r a n s l a t i o n ) ;

DBUG PRINT ( DBUG GRAPH , "Primary timescale : (start = %f, end = %f), (time = %f, window = %f), dilate = %f, translate = %f" ,l f P r i m a r y S t a r t T i m e , l fPr imaryEndTime ,l fP r imaryTimeWid th , lfPrimaryWindowWidth ,l f P r i m a r y D i l a t i o n , l f P r i m a r y T r a n s l a t i o n ) ;

unsigned i n t lnTimescaleWindowCount = getTimescaleWindowCount ( ) ;

DBUG PRINT ( DBUG GRAPH , "lnTimescaleWindowCount = %d" ,lnTimescaleWindowCount ) ;

f l o a t l f I n i t i a l T i m e s t a m p = irDB . g e t F i n a l T i m e s t a m p ( ) − l fP r imaryTimeWid th ;

i f ( l f I n i t i a l T i m e s t a m p < 0 . 0 ) {l f I n i t i a l T i m e s t a m p = 0 . 0 ;

}

35

Page 44: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DBUG PRINT ( DBUG GRAPH , "primary init timestamp = %f (= %f - %f)" ,l f I n i t i a l T i m e s t a m p ,irDB . g e t F i n a l T i m e s t a m p ( ) ,l fP r imaryTimeWid th ) ;

unsigned i n t lnDimPrimary = getDimPrimary ( ) ;

/∗∗ I n d e x i n t o t h e DataBlock t o t h e s t a r t o f t h e f i r s t t i m e s t a m p∗ we care abou t .∗ /

unsigned i n t lnDBIndex ;unsigned i n t lnDBIndexMax = irDB . g e t P o i n t C o u n t ( ) ;

f o r ( lnDBIndex = 0 ; lnDBIndex < lnDBIndexMax ; lnDBIndex + + ) {i f ( irDB . getTimestamp ( lnDBIndex ) >= l f I n i t i a l T i m e s t a m p ) {

break ;}

}

/∗∗ Ensure t h e r e i s enough space i n t h e opGraph ( i f g i v e n ) t o s t o r e t h e∗ da ta . Space r e q u i r e d i s t h e s i z e o f t h e DataBlock ( # p t s ) minus∗ t h e a l r e a d y−s k i p p e d p o i n t s ( t h e v a l u e o f lnDBIndex ) .∗ /

unsigned i n t l nS izeReqd = irDB . g e t P o i n t C o u n t ( ) − lnDBIndex ;

i f ( opGraph ! = NULL ) {unsigned i n t l n C a p a c i t y = opGraph−>c a p a c i t y ( ) ;i f ( l n C a p a c i t y < l nS izeReqd ) {

DBUG PRINT ( DBUG GRAPH , "expanding opGraph size by %d elements" ,l nS izeReqd − l n C a p a c i t y ) ;

opGraph−>r e s e r v e ( lnS izeReqd ) ;TraceGraphElement dummy ;f o r ( unsigned i n t i = l n C a p a c i t y ; i < l nS izeReqd ; i + + ) {

opGraph−>push back ( dummy ) ;}

}}

/∗∗ Run t h r o u g h a l l o f t h e da ta p o i n t s . We s t a r t a t t h e c u r r e n t v a l u e∗ o f lnDBIndex , s i n c e t h i s has been forwarded t o t h e s t a r t o f our∗ o v e r a l l window .∗ /

unsigned i n t l n G r a p h Inde x = 0 ;

f o r ( ; lnDBIndex < lnDBIndexMax ; lnDBIndex + + ) {

36

Page 45: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

/∗∗ S e t t h e i n i t i a l t i m e s c a l e v a l u e s .∗ /

f l o a t l f S t a r t T i m e = l f P r i m a r y S t a r t T i m e ;f l o a t l fEndTime = l fP r imaryEndTime ;f l o a t l f T r a n s l a t i o n = l f P r i m a r y T r a n s l a t i o n ;f l o a t l f D i l a t i o n = l f P r i m a r y D i l a t i o n ;f l o a t l fT imeWid th = l fP r imaryTimeWid th ;

unsigned i n t lnTimeWindowIndex = 0 ;

/∗∗ Get t h e c u r r e n t da ta t i m e s t a m p . Conver t t o t i m e window c e n t r i c∗ t i m e ( i . e . s u b t r a c t t h e i n i t i a l t i m e s t a m p o f t h e window ) .∗ /

f l o a t l f C u r r e n t T i m e = irDB . getTimestamp ( lnDBIndex ) ;

l f C u r r e n t T i m e −= l f I n i t i a l T i m e s t a m p ;

DBUG ASSERT ( l f C u r r e n t T i m e > −0 . 0 0 0 0 1 ) ; / / j u s t a check

/∗∗ Run t h r o u g h t i m e s c a l e windows , l o o k i n g f o r t h e s m a l l e s t non−pr imary∗ window which bounds t h e c u r r e n t p o i n t .∗ /

f o r ( unsigned i n t i = 1 ; i < lnTimescaleWindowCount ; i + + ) {f l o a t l f I n n e r S t a r t T i m e ;f l o a t l f I n n e r E n d T i m e ;f l o a t l f I n n e r T i m e W i d t h ;f l o a t lfDummy ;f l o a t l f I n n e r T r a n s l a t i o n ;f l o a t l f I n n e r D i l a t i o n ;

ge tTimescaleWindow ( i , l f I n n e r S t a r t T i m e , l f Inne rEndTime ,l f Inne rEndTime , lfDummy ,l f I n n e r D i l a t i o n , l f I n n e r T r a n s l a t i o n ) ;

i f ( ( l f C u r r e n t T i m e >= l f I n n e r S t a r t T i m e ) &&( l f C u r r e n t T i m e <= l f I n n e r E n d T i m e ) ) {

i f ( l f I n n e r T i m e W i d t h <= l fT imeWid th ) {DBUG ASSERT ( f a l s e ) ;lnTimeWindowIndex = i ;l f S t a r t T i m e = l f I n n e r S t a r t T i m e ;l fEndTime = l f I n n e r E n d T i m e ;l fT imeWid th = l f I n n e r T i m e W i d t h ;l f T r a n s l a t i o n = l f I n n e r T r a n s l a t i o n ;l f D i l a t i o n = l f I n n e r D i l a t i o n ;

37

Page 46: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

}}

}

/∗∗ Now , use t h e found t i m e s c a l e window t o s c a l e t h i s da ta p o i n t .∗ /

TraceGraphElement l aGraph ;

/∗∗ F i r s t , s c a l e t h e t i m e s t a m p and s t o r e .∗ /

DBUG PRINT ( DBUG GRAPH , "tsw[%d] = (%f, %f) --> (%f, %f)" ,lnTimeWindowIndex , l f S t a r t T i m e , lfEndTime ,l f D i l a t i o n , l f T r a n s l a t i o n ) ;

l aGraph . mfX = ( l f C u r r e n t T i m e − l f S t a r t T i m e ) ∗ l f D i l a t i o n + l f T r a n s l a t i o n ;

/∗∗ Next , s c a l e t h e v a l u e o f t h e pr imary d i m e n s i o n .∗ /

f l o a t l f C u r r e n t V a l u e = irDB . g e t P o i n t ( lnDBIndex , lnDimPrimary ) ;f l o a t l fYtemp = s c a l e V a l u e ( l f C u r r e n t V a l u e ) ;l aGraph . mfY = mapValue ( l fYtemp ) ;

/∗∗ Run t h r o u g h a l l o f t h e d imens ions , p e r f o r m i n g p l o t t i n g as r e q u i r e d .∗ /

unsigned i n t lnDimCount = irDB . g e t V e c t o r W i d t h ( ) ;unsigned i n t lnDimMax = getDimCount ( ) ;

i f ( lnDimCount > lnDimMax ) {lnDimCount = lnDimMax ;

}

f o r ( unsigned i n t lnDimIndex = 0 ; lnDimIndex < lnDimCount ; lnDimIndex + + ) {unsigned i n t l n M o d i f i e r s

= maDimTraceModifier [ lnDimIndex ] . mnTraceModi f i e r s ;

DBUG PRINT ( DBUG GRAPH , "mod[%d] = %d" , lnDimIndex , l n M o d i f i e r s ) ;

i f ( l n M o d i f i e r s ! = TM NONE ) {i f ( l n M o d i f i e r s & TM DOTSIZE ) {}i f ( l n M o d i f i e r s & TM COLOUR ) {

mapColours ( l f C u r r e n t V a l u e , lnDimIndex ,l aGraph . mfRed , l aGraph . mfGreen , l aGraph . mfBlue ,

38

Page 47: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

l aGraph . mfAlpha ) ;}i f ( l n M o d i f i e r s & TM ERROR BARS ) {}i f ( l n M o d i f i e r s & TM THICKNESS ) {}

}}

DBUG PRINT ( DBUG GRAPH,"laGraph: X = %f, Y = %f, colour = (%f, %f, %f, %f)" ,l aGraph . mfX , l aGraph . mfY ,l aGraph . mfRed , l aGraph . mfGreen , l aGraph . mfBlue ,l aGraph . mfAlpha ) ;

i f ( opGraph ! = NULL ) {(∗ opGraph ) [ l n G r a p h I ndex ] = laGraph ;DBUG PRINT ( DBUG GRAPH , "assigned laGraph to %d" , l n G r a p h I ndex ) ;l n G r a p h I nde x ++;

}}

}

void GraphTrace : : mapColours ( c o n s t f l o a t i f V a l u e ,c o n s t unsigned i n t inDimIndex ,f l o a t & ofRed ,f l o a t & ofGreen ,f l o a t & ofBlue ,f l o a t & ofAlpha )

{DBUG BTRACE LOW ( "GraphTrace :: mapColours" ,"( ifValue = %f, inDimIndex = %d, ofRed , ofGreen , ofBlue , ofAlpha )" ,

i f V a l u e , inDimIndex ) ;

GuardRead guard ( maToken ) ;

i f ( inDimIndex >= maDimTraceModifier . s i z e ( ) ) {GEX ( "Index too large " , E TOOLARGE ) ;

}

c o n s t COLOUR SET & l r C o l o u r s = maDimTraceModifier [ inDimIndex ] . maColours ;

COLOUR SET : : c o n s t i t e r a t o r l i C u r r = l r C o l o u r s . b e g i n ( ) ;

ofRed = 0 . 0 ;o fGreen = 0 . 0 ;o fB lue = 0 . 0 ;o fAlpha = 0 . 0 ;

/∗∗ Cyc le t h r o u g h a l l o f t h e ColourWindow ’ s i n t h e COLOUR SET . I f we f i n d

39

Page 48: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗ one which u s e s t h e l i m i t s , i f our v a l u e i s w i t h i n i t s l i m i t s , s e t∗ t h e c o l o u r and s t o p t h e s e a r c h . I f we f i n d a v a l u e which u s e s t h e∗ l i m i t s b u t our v a l u e i s o u t s i d e o f t h o s e , keep s e a r c h i n g . I f we∗ f i n d a v a l u e which has no l i m i t s , s e t t h e c o l o u r b u t keep s e a r c h i n g∗ i n case t h e r e i s a more r e s t r i c t i v e l i m i t −e n f o r c i n g c o l o u r which w i l l∗ t a k e p r e c e d e n c e .∗ /

whi le ( l i C u r r ! = l r C o l o u r s . end ( ) ) {i f ( l i C u r r−>mbUseValueLimi ts ) {

i f ( i f V a l u e >= l i C u r r−>mfMinValue ) {i f ( i f V a l u e <= l i C u r r−>mfMaxValue ) {

ofRed = l i C u r r−>mfRed ;o fGreen = l i C u r r−>mfGreen ;o fB lue = l i C u r r−>mfBlue ;o fAlpha = l i C u r r−>mfAlpha ;break ;

}}

} e l s e {ofRed = l i C u r r−>mfRed ;o fGreen = l i C u r r−>mfGreen ;o fB lue = l i C u r r−>mfBlue ;o fAlpha = l i C u r r−>mfAlpha ;

}

l i C u r r ++;}

}

f l o a t GraphTrace : : mapValue ( c o n s t f l o a t i f V a l u e ){

DBUG BTRACE LOW ( "GraphTrace :: mapValue" , "( ifValue = %f )" , i f V a l u e ) ;

f l o a t l f V a l u e = 0 . 0 ;

l f V a l u e = ( i f V a l u e − mfMinValue ) / ( mfMaxValue − mfMinValue )∗ TOTAL WINDOW WIDTH − TOTAL WINDOW OFFSET;

re turn ( l f V a l u e ) ;}

f l o a t GraphTrace : : s c a l e V a l u e ( c o n s t f l o a t i f V a l u e ){

DBUG BTRACE LOW ( "GraphTrace :: scaleValue" , "( ifValue = %f )" , i f V a l u e ) ;

f l o a t l f V a l u e = 0 . 0 ;

swi tch ( m a S c a l e F u n c t i on ) {case GraphTrace : : SF LINEAR :

l f V a l u e = ( i f V a l u e − mfB ) / mfM;

40

Page 49: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

break ;case GraphTrace : : SF LOG :

l f V a l u e = l o g ( i f V a l u e − mfB ) / mfM;break ;

d e f a u l t :DBUG ASSERT ( f a l s e ) ;

}

re turn ( l f V a l u e ) ;}

# e n d i f / / WAVE UI ENABLED

41

Page 50: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

GraphTrace.h/∗ ∗∗ @ f i l e∗∗ $ R e v i s i o n : 1 . 1 $∗ /

# i f d e f WAVE UI ENABLED

# i f n d e f TRACEINFO H# d e f i n e TRACEINFO H

# i n c l u d e < s e t >

# i n c l u d e < v e c t o r >

# i n c l u d e < ace / Token . h>

# i n c l u d e "TraceGraphElement .h"

c l a s s DataBlock ;

/∗ ∗∗ R e p r e s e n t s t h e i n f o r m a t i o n used i n r e n d e r i n g a t r a c e , i n c l u d i n g c o l o u r s ,∗ s i z e s , d i m e n s i o n s bo th s c r e e n and da ta . The o b j e c t MT−s a f e s i n c e i t∗ c o u l d p o t e n t i a l l y be a c c e s s e d by m u l t i p l e t h r e a d s s i m u l t a n e o u s l y .∗ /

c l a s s GraphTrace{

p u b l i c :

/∗ ∗∗ D i f f e r e n t ways any p a r t i c u l a r d i m e n s i o n s c a l a r can be a p p l i e d t o t h e∗ graph . A l l o f t h e s e f l a g s can be OR ’ d t o c r e a t e a c o m p o s i t e d i s p l a y .∗ /

enum TRACE TYPE FLAGS {TT NONE = ( 0 < < 0 ) , / / ! < Dimension n o t usedTT POINTS = ( 1 < < 0 ) , / / ! < I n d i v i d u a l p o i n t s ( t ime , v a l u e )TT LINES = ( 1 < < 1 ) ,

/ / ! < D i m e n s i o n l e s s p o i n t s w i t h c o n n e c t i n g 0 t h o r d e r l i n e s} ;

/∗ ∗∗ D i f f e r e n t ways any p a r t i c u l a r d i m e n s i o n s c a l a r can be a p p l i e d t o t h e∗ pr imary d i m e n s i o n graph . A l l o f t h e s e f l a g s can be OR ’ d t o c r e a t e a∗ c o m p o s i t e d i s p l a y .∗ /

enum TRACE MODIFIER FLAGS {

42

Page 51: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

TM NONE = ( 0 < < 0 ) , / / ! < Dimension n o t used .TM DOTSIZE = ( 1 < < 0 ) , / / ! < Changes t h e d o t s i z e on pr imary p l o tTM COLOUR = ( 1 < < 1 ) , / / ! < Changes c o l o u r o f pr imary p l o tTM ERROR BARS = ( 1 < < 2 ) , / / ! < Adds s y m m e t r i c e r r o r bars t o pr imaryTM THICKNESS = ( 1 < < 3 ) / / ! < C o n t r o l s t h i c k n e s s o f d o t / l i n e o f pr imary

} ;

/∗ ∗∗ D i f f e r e n t ways s c a l e s can be computed or upda ted .∗ /

enum SCALE UPDATE TYPE {SUT FIXED = 0 , / / ! < Use f i x e d mappingSUT LOCAL = 1 , / / ! < Use l o c a l max / min o f d i s p l a y e d da taSUT PEAKS = 2 , / / ! < Use non−l o c a l max / min as d i s c o v e r d

} ;

/∗ ∗∗ S c a l e f u n c t i o n f o r mapping v a l u e t o s c r e e n v a l u e ( Y a x i s ) c o o r d i n a t e s .∗ /

enum SCALE FUNCTION {SF LINEAR = 0 , / / ! < Use l i n e a r mapping , Y = ( y − b ) / mSF LOG = 1 / / ! < Use l o g mapping , Y = l o g ( y − b ) / m

} ;

/∗ ∗∗ S e t t h e pr imary d i m e n s i o n .∗ /

void se tDimPr imary ( c o n s t unsigned i n t i nPr imaryDimIndex ) ;

unsigned i n t getDimPrimary ( void ) c o n s t ;

/∗ ∗∗ S e t t h e pr imary d i m e n s i o n p l o t t y p e .∗∗ @inTraceTypeFlags t y p e o f d i s p l a y , an OR ’ d l i s t o f∗ /

void s e t P r i m a r y T r a c e T y p e ( c o n s t unsigned i n t i n T r a c e T y p e F l a g s ) ;

/∗ ∗∗ S e t s e c o n d a r y d i m e n s i o n t r a c e m o d i f i e r t y p e s .∗∗ @param inDimIndex i n d e x be tween 0 and # dims −1 ( i f n e g a t i v e , s e t t i n g∗ a p p l i e s t o a l l d i m e n s i o n s e x c e p t t h e pr imary )∗ @param i n T r a c e M o d i f i e r F l a g s t y p e o f d i s p l a y , an OR ’ d l i s t o f∗ TRACE MODIFIER FLAGS∗ /

43

Page 52: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

void s e t D i m T r a c e M o d i f i e r ( c o n s t i n t inDimIndex ,c o n s t unsigned i n t i n T r a c e M o d i f i e r F l a g s ) ;

/∗ ∗∗ Add a c o l o u r s e t t i n g t o t h e pr imary d i m e n s i o n .∗∗ @param i f R e d t h e d e s i r e d amount o f red , be tween 0 . 0 and 1 . 0∗ @param i f G r e e n t h e d e s i r e d amount o f green , be tween 0 . 0 and 1 . 0∗ @param i f B l u e t h e d e s i r e d amount o f b lue , be tween 0 . 0 and 1 . 0∗ @param i f A l p h a t h e d e s i r e d amount o f t r a n s p a r e n c y , be tween 0 . 0∗ ( f u l l y t r a n s p a r e n t ) and 1 . 0 ( f u l l y opaque ) .∗ @param i b U s e V a l u e L i m i t s i f t r u e , t h e n use t h e g i v e n v a l u e l i m i t s ,∗ o t h e r w i s e a lways a p p l y t h i s c o l o u r∗ @param i f M i n V a l u e t h e minimum data v a l u e f o r which t h i s c o l o u r s h o u l d∗ be used∗ @param i fMaxValue t h e maximum data v a l u e f o r which t h i s c o l o u r s h o u l d∗ be used∗ /

void a d d P r i m a r yC olour ( c o n s t f l o a t i fRed ,c o n s t f l o a t i f G r e e n ,c o n s t f l o a t i f B l u e ,c o n s t f l o a t i f A l p h a ,c o n s t bool i b U s e V a l u e L i m i t s = f a l s e ,c o n s t f l o a t i fMinVa lue = 0 . 0 ,c o n s t f l o a t i fMaxValue = 0 . 0 ) ;

/∗ ∗∗ Add a c o l o u r and o p t i o n a l v a l u e range f o r t h e g i v e n d i m e n s i o n i f∗ b e i n g used as a c o l o u r map i n d e x .∗∗ @param inDimIndex i n d e x o f t h e t a r g e t d i m e n s i o n ( i f n e g a t i v e , a p p l i e s∗ t o a l l d i m e n s i o n s )∗ @param i f R e d t h e d e s i r e d amount o f red , be tween 0 . 0 and 1 . 0∗ @param i f G r e e n t h e d e s i r e d amount o f green , be tween 0 . 0 and 1 . 0∗ @param i f B l u e t h e d e s i r e d amount o f b lue , be tween 0 . 0 and 1 . 0∗ @param i f A l p h a t h e d e s i r e d amount o f t r a n s p a r e n c y , be tween 0 . 0∗ ( f u l l y t r a n s p a r e n t ) and 1 . 0 ( f u l l y opaque ) .∗ @param i b U s e V a l u e L i m i t s i f t r u e , t h e n use t h e g i v e n v a l u e l i m i t s ,∗ o t h e r w i s e a lways a p p l y t h i s c o l o u r∗ @param i f M i n V a l u e t h e minimum data v a l u e f o r which t h i s c o l o u r s h o u l d∗ be used∗ @param i fMaxValue t h e maximum data v a l u e f o r which t h i s c o l o u r s h o u l d∗ be used∗ /

void addDimColour ( c o n s t i n t inDimIndex ,c o n s t f l o a t i fRed ,c o n s t f l o a t i f G r e e n ,c o n s t f l o a t i f B l u e ,c o n s t f l o a t i f A l p h a ,

44

Page 53: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

c o n s t bool i b U s e V a l u e L i m i t s = f a l s e ,c o n s t f l o a t i fMinVa lue = 0 . 0 ,c o n s t f l o a t i fMaxValue = 0 . 0 ) ;

/∗ ∗∗ S e t t h e v a l u e ( Y a x i s ) s c a l i n g p r o t o c o l .∗∗ @param i a S c a l i n g F u n c t i o n t h e method whereby v a l u e l i m i t s are t o be∗ recomputed∗ @param i a S c a l i n g T y p e t h e t y p e o f s c a l i n g t o be used∗ /

void s e t V a l u e S c a l i n g ( c o n s t SCALE FUNCTION & i a S c a l i n g F u n c t i o n ,c o n s t SCALE UPDATE TYPE & i a S c a l i n g T y p e ) ;

/∗ ∗∗ S e t t h e v a l u e ( Y a x i s ) s c a l i n g c o e f f i c i e n t s .∗∗ @param i fM i n i t i a l m u l t i p l i e r ( s l o p e i f l i n e a r ) v a l u e∗ @param i f B i n i t i a l o f f s e t ( Y i n t e r c e p t i f l i n e a r ) v a l u e∗ /

void s e t S c a l e C o e f f s ( c o n s t f l o a t ifM ,c o n s t f l o a t i f B ) ;

/∗ ∗∗ S e t t h e peak ( max / min ) v a l u e s f o r t h e t r a c e .∗∗ @param i f M i n i n i t i a l minimum Y v a l u e∗ @param i fMax i n i t i a l maximum Y v a l u e∗ /

void s e t V a l u e P e a k s ( c o n s t f l o a t i fMin , c o n s t f l o a t i fMax ) ;

/∗ ∗∗ S c a l e t h e g i v e n v a l u e u s i n g t h e c u r r e n t s l o p e , o f f s e t and mapping∗ f u n c t i o n .∗ /

f l o a t s c a l e V a l u e ( c o n s t f l o a t i f V a l u e ) ;

/∗ ∗∗ Map t h e g i v e n s c a l e d v a l u e ( s c a l e d v i a s c a l e V a l u e ( ) ) t o a n o r m a l i z e d∗ p l o t t i n g ( Y c o o r d i n a t e ) p o s i t i o n u s i n g t h e peaks s e t t i n g s and v a l u e s ,∗ s l o p e , o f f s e t , and mapping f u n c t i o n .∗ /

f l o a t mapValue ( c o n s t f l o a t i f V a l u e ) ;

/∗ ∗∗ S e t t h e p h y s i c a l d i m e n s i o n s o f t h e p l o t t i n g d i s p l a y i n p i x e l s .

45

Page 54: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗∗ @param i n W i d t h w i d t h o f t h e d i s p l a y / window∗ @param i n H e i g h t h e i g h t o f t h e d i s p l a y / window∗ @param i n O r i g i n X X p o s i t i o n ( h o r i z o n t a l ) t o be used f o r drawing t h i s∗ t r a c e∗ @param i n O r i g i n Y Y p o s i t i o n ( v e r t i c a l ) t o be used f o r drawing t h i s t r a c e∗ /

void s e t D i s p l a y S i z e ( c o n s t unsigned i n t inWidth ,c o n s t unsigned i n t i n H e i g h t ,c o n s t unsigned i n t i nOr ig inX ,c o n s t unsigned i n t i n O r i g i n Y ) ;

/∗ ∗∗ S e t t h e pr imary t i m e s c a l e which i s a p p l i e d t o t h e e n t i r e window .∗∗ @param i f T i m e W i d t h number o f s e c o n d s o f da ta t o be d i s p l a y e d over t h e∗ e n t i r e window .∗ /

void s e t P r i m a r y T i m e s c a l e ( c o n s t f l o a t i fT imeWid th ) ;

/∗ ∗∗ Add a d d i t i o n a l t i m e s c a l e windows .∗∗ T i m e s c a l e windows c o n s i s t o f two v a l u e s :∗ < ol>∗ < l i >t h e w i d t h o f t h e window r e l a t i v e t o da ta t ime , i n seconds </ l i >

∗ < l i >t h e w i d t h o f t h e window r e l a t i v e t o t h e t o t a l g r a p h i c a l ( p i x e l )∗ window , as a p e r c e n t a g e be tween 0 . 0 and 1 . 0 .∗ < / o l>∗∗ The p l a c e m e n t o f t i m e s c a l e windows needs a d d i t i o n a l e x p l a n a t i o n . The∗ pr imary t i m e s c a l e window d e f i n e s t h e b a s i c mapping over t h e e n t i r e∗ g r a p h i c a l window . A d d i t i o n a l t i m e s c a l e windows are i n s e r t e d t o t h e l e f t∗ ( da ta s c r o l l s from r i g h t t o l e f t ) o f t h e e x i s t i n g t i m e s c a l e window whose∗ i n d e x i s g i v e n as inPrecedingWindow . I f t h i s i s t h e f i r s t t i m e s c a l e∗ window t o be d e f i n e d , i t w i l l be p l a c e d t o t h e most e x t r e m e r i g h t o f∗ t h e o v e r a l l window .∗∗ For example , i f you want t h e b a s i c , o v e r a l l window t o be 2 5 s e c o n d s∗ wide , w i t h incoming da ta d i s p l a y e d a t h igh r e s o l u t i o n f o r 1 / 3 o f t h e∗ sc reen , t h e n accumula ted a t a much reduced r e s o l u t i o n over t h e remain ing ,∗ you would use t h e f o l l o w i n g commands :∗ \ code∗ GraphTrace l a T I ;∗∗ l a T I . s e t P r i m a r y T i m e s c a l e ( 2 5 . 0 ) ;∗∗ u n s i g n e d i n t l a I n d e x = l a T I . addTimescaleWindow ( 5 . 0 , 0 . 3 , 0 ) ;∗

46

Page 55: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗ l a T I . addTimescaleWindow ( 2 0 . 0 , 0 . 7 , l a I n d e x ) ;∗ \ endcode∗∗ @param i f T i m e W i d t h number o f s e c o n d s o f da ta t o be d i s p l a y e d over t h i s∗ new t i m e s c a l e window∗ @param i fWindowWidth p e r c e n t a g e ( be tween 0 . 0 and 1 . 0 ) o f t h e t o t a l window∗ which i s t o be d e d i c a t e d t o t h i s t i m e s c a l e window∗ @param inPrecedingWindow i n d e x number o f a p r e v i o u s l y d e f i n e d window∗ t o which t h i s one i s t o be j o i n e d t o ( s e t t o 0 i f t h i s i s t h e f i r s t∗ t i m e s c a l e window t o be added )∗∗ @returns t h e i n d e x o f t h e new t i m e s c a l e window∗ /

unsigned i n t addTimescaleWindow ( c o n s t f l o a t i fTimeWidth ,c o n s t f l o a t ifWindowWidth ,c o n s t unsigned i n t inPrecedingWindow = 0 ) ;

/∗ ∗∗ S e t t h e number o f d i m e n s i o n s i n t h e t r a c e .∗ /

void se tDimCount ( c o n s t unsigned i n t inDimCount ) ;

/∗ ∗∗ R e t u r n s t h e number o f known d i m e n s i o n s .∗ /

unsigned i n t getDimCount ( void ) ;

t y p e d e f s t d : : v e c t o r <TraceGraphElement > TRACE GRAPH VECTOR ;

/∗ ∗∗ Given a c o m p l e t e s c r e e n DataBlock , t h i s method p l o t s t h e da ta . E i t h e r∗ i t g e n e r a t e s t h e high− l e v e l p l o t i n f o r m a t i o n and r e t u r n s i t v i a∗ t h e opGraph v e c t o r , or i f t h e v e c t o r i s NULL , makes t h e OpenGL c a l l s∗ d i r e c t l y . ( OpenGL c a l l s are n o t made i f t h e v e c t o r i s n o t NULL . )∗∗ @param irDB i n p u t DataBlock r e p r e s e n t i n g t h e e n t i r e s c r e e n∗ @param opGraph o u t p u t h igh− l e v e l p l o t v e c t o r , which i f n o t NULL w i l l∗ be f i l l e d w i t h t h e n e c e s s a r y i n f o r m a t i o n f o r c r e a t i n g t h e graph .∗ /

void graphDa taBlock ( c o n s t DataBlock & irDB , TRACE GRAPH VECTOR ∗ opGraph ) ;

f l o a t getMaxValue ( void ) c o n s t ;

f l o a t getMinValue ( void ) c o n s t ;

/∗ ∗∗ Update t h e v a l u e s c a l e s ( min and max Y v a l u e s ) from t h e g i v e n DataBlock

47

Page 56: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗ a c c o r d i n g t o t h e s e t upda te a l g o r i t h m .∗ /

void u p d a t e V a l u e S c a l i n g ( DataBlock & irDB ) ;

/∗ ∗∗ Return t h e number o f t i m e s c a l e windows .∗ /

unsigned i n t getTimescaleWindowCount ( void ) c o n s t ;

/∗ ∗∗ R e t r i e v e t h e l i m i t s and t r a n s f o r m a t i o n v a l u e s f o r a p a r t i c u l a r∗ t i m e s c a l e window .∗∗ @param ofT imeWid th number o f s e c o n d s o f da ta r e p r e s e n t e d by t h i s∗ p a r t i c u l a r window∗ @param ofWindowWidth p h y s i c a l w i d t h o f t h e window r e p r e s e n t e d i n∗ n o r m a l i z e d window c o o r d i n a t e s ( i . e . t h e e n t i r e window i s ( −1 , + 1 ) ,∗ w i t h t h i s window b e i n g some s u b s e t o f t h a t va lue , b e i n g∗ ( ofWindowWidth , ofWindowWidth + o f T r a n s l a t i o n )∗∗ To map a t i m e s t a m p X v i a t h e t i m e s c a l e , c o n f i r m t h a t X i s w i t h i n∗ t h e window ( o f S t a r t T i m e <= X <= ofEndTime ) , t h e n t h e p l o t t i n g X∗ c o o r d i n a t e v a l u e = ( X − o f S t a r t T i m e ) ∗ o f D i l a t i o n + o f T r a n s l a t i o n .∗ /

void getTimescaleWindow ( c o n s t unsigned i n t i n I n d e x ,f l o a t & o f S t a r t T i m e ,f l o a t & ofEndTime ,f l o a t & ofTimeWidth ,f l o a t & ofWindowWidth ,f l o a t & o f D i l a t i o n ,f l o a t & o f T r a n s l a t i o n ) ;

/∗ ∗∗ Return t h e c o l o u r s which are a s s i g n e d t o a g i v e n v a l u e o f t h e∗ g i v e n d i m e n s i o n .∗∗ @param i f V a l u e t h e v a l u e o f t h e d i m e n s i o n∗ @param inDimIndex t h e i n d e x o f t h e d i m e n s i o n∗ @param i f R e d r e t u r n e d red c o o r d i n a t e∗ @param i f G r e e n r e t u r n e d green c o o r d i n a t e∗ @param i f B l u e r e t u r n e d b l u e c o o r d i n a t e∗ @param i f A l p h a r e t u r n e d a lpha c o o r d i n a t e∗ /

void mapColours ( c o n s t f l o a t i f V a l u e ,c o n s t unsigned i n t inDimIndex ,f l o a t & ifRed ,f l o a t & i f G r e e n ,

48

Page 57: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

f l o a t & i f B l u e ,f l o a t & i f A l p h a ) ;

/∗ ∗∗ The c o o r d i n a t e s y s t e m we p l o t i n t o i s t h e o r t h o n o r m a l one used by∗ OpenGL , where t h e X a x i s and Y a x i s run from −1 . 0 t o + 1 . 0 , g i v i n g∗ a t o t a l w i d t h o f 2 . 0 .∗ /

s t a t i c c o n s t f l o a t TOTAL WINDOW WIDTH = 2 . 0 ;

/∗ ∗∗ The c o o r d i n a t e s y s t e m we p l o t i n t o i s t h e o r t h o n o r m a l one used by∗ OpenGL , where t h e X a x i s and Y a x i s run from −1 . 0 t o + 1 . 0 , g i v i n g∗ a t o t a l w i d t h o f 2 . 0 , which i s s h i f t e d n e g a t i v e l y by an o f f s e t o f 1 . 0 .∗ /

s t a t i c c o n s t f l o a t TOTAL WINDOW OFFSET = 1 . 0 ;

/∗ ∗∗ A s a n i t y−c h e c k i n g maximum f o r t h e number o f t i m e s c a l e windows .∗ P r i m a r i l y used f o r a l l o c a t i n g caches .∗ /

s t a t i c c o n s t unsigned i n t MAX TIMESCALE WINDOW COUNT = 1 0 0 ;

GraphTrace ( void ) ;

v i r t u a l ˜ GraphTrace ( void ) ;

p r i v a t e :mutable ACE Token maToken ;

/∗ ∗∗ I n f o r m a t i o n which makes up t h e i n d i v i d u a l t i m e s c a l e windows .∗∗ T i m e s c a l e windows have t h e i r t i m e v a l u e s d e f i n e d i n t i m e e l a p s e d from∗ t h e r i g h t o f t h e s c r e e n ( so , t i m e e l a p s e d d u r i n g t h e d i s p l a y o f a∗ g i v e n p o i n t ) which i s t h e r e v e r s e o f t i m e o f a c q u i s i t i o n .∗∗ So , t i m e e l a p s e d = 0 . 0 i s t h e v e r y r i g h t m o s t p o i n t o f t h e s c r e e n ( which∗ i s t h e newes t d i s p l a y e d da ta p o i n t ) . Time e l a p s e d = 5 . 0 i n d i c a t e s a∗ da ta p o i n t which has been d i s p l a y e d f o r 5 s e c o n d s .∗∗ I f t h e a c t u a l t i m e s t a m p o f t h e newes t p l o t t e d da ta p o i n t i s T , t h e n∗ t h e t i m e s t a m p s o f da ta d i s p l a y e d i n a TimescaleWindow o f m f S t a r t T i m e∗ = ST and a mfTimeWidth o f W would be t h o s e t i m e s t a m p s S such t h a t∗ T − ST − W <= S <= T − ST .∗ /

s t r u c t TimescaleWindow {

49

Page 58: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

f l o a t mfTimeWidth ; / / ! < Number o f s e c o n d s i n t h e windowf l o a t mfSta r tT ime ; / / ! < When t h e window s t a r t sf l o a t mfWindowWidth ; / / ! < Width o f t h e s c r e e n a s s i g n e df l o a t m f T r a n s l a t i o n ;f l o a t m f D i l a t i o n ;

} ;

t y p e d e f s t d : : v e c t o r <s t r u c t TimescaleWindow > TIMESCALE VECTOR ;

TIMESCALE VECTOR maTimesca leVec to r ;

s t r u c t ColourWindow {bool mbUseValueLimits ;f l o a t mfMinValue ;f l o a t mfMaxValue ;f l o a t mfRed ;f l o a t mfGreen ;f l o a t mfBlue ;f l o a t mfAlpha ;

} ;

s t r u c t l tColourWindow {bool operator ( ) ( c o n s t s t r u c t ColourWindow & a ,

c o n s t s t r u c t ColourWindow & b ){

i f ( ! a . mbUseValueLimi ts && ! b . mbUseValueLimits ) {re turn ( t rue ) ;

} e l s e i f ( a . mbUseValueLimi ts && ! b . mbUseValueLimits ) {re turn ( f a l s e ) ;

} e l s e i f ( ! a . mbUseValueLimits && b . mbUseValueLimits ) {re turn ( t rue ) ;

}re turn ( a . mfMinValue < b . mfMinValue ) ;

}} ;

t y p e d e f s t d : : s e t <s t r u c t ColourWindow , l tColourWindow > COLOUR SET ;

c l a s s D i m T r a c e M o d i f i e r I n fo {p u b l i c :

unsigned i n t mnTraceModi f i e r s ; / / ! < from TRACE MODIFIER FLAGSCOLOUR SET maColours ; / / ! < A p p l i c a b l e c o l o u r s t r u c t sD i m T r a c e M o d i f i e r In fo ( void ) : mnTraceModi f i e r s (TM NONE ) , maColours ( ) { }

} ;

t y p e d e f s t d : : v e c t o r <DimTraceModi f i e r In fo > DIM TRACE MODIFIER VECTOR;

DIM TRACE MODIFIER VECTOR maDimTraceModifier ;

unsigned i n t mnTraceType ; / / ! < Flags from TRACE TYPE FLAGS

50

Page 59: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

/ / ! I n d e x o f t h e main t r a c e d i m e n s i o nunsigned i n t mnPrimaryDimIndex ;

SCALE UPDATE TYPE maUpdateType ; / / ! < How t o upda te t h e v a l u e s c a l i n gf l o a t mfMaxValue ; / / ! < Max Y a x i s v a l u ef l o a t mfMinValue ; / / ! < Min Y a x i s v a l u eSCALE FUNCTION m a S c a l e F u n c t i on ; / / ! < Mapping from v a l u e t o Y a x i sf l o a t mfM; / / ! < Value s c a l i n g m u l t i p l i e rf l o a t mfB ; / / ! < Value s c a l i n g o f f s e t

/∗ ∗∗ Width i n p i x e l s o f t h e d i s p l a y area used by t h i s t r a c e .∗ /

unsigned i n t mnDisplayWidth ;

/∗ ∗∗ Heigh t i n p i x e l s o f t h e d i s p l a y area used by t h i s t r a c e .∗ /

unsigned i n t mnDisp layHe igh t ;

/∗ ∗∗ X o r i g i n ( h o r i z o n t a l ) o f t h e d i s p l a y window .∗ /

unsigned i n t mnDisplayOrig inX ;

/∗ ∗∗ Y o r i g i n ( v e r t i c a l ) o f t h e d i s p l a y window .∗ /

unsigned i n t mnDisplayOrig inY ;} ;

# e n d i f / / TRACEINFO H

# e n d i f / / WAVE UI ENABLED

51

Page 60: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

TraceGraphElement.cpp

/∗ ∗∗ @ f i l e∗∗ $ R e v i s i o n : 1 . 1 $∗ /

# i f d e f GL ENABLED# i n c l u d e <GL/ g l u . h>

# e n d i f / / GL ENABLED

# i n c l u d e "TraceGraphElement .h"

# i n c l u d e "ACE_DBUG.h"# i n c l u d e "Guardian.h"

TraceGraphElement : : T raceGraphElement ( void ): mfX ( 0 . 0 ) , mfY ( 0 . 0 ) , mfRadius ( 0 . 0 ) , mfErrBar ( 0 . 0 ) ,

mfRed ( 0 . 0 ) , mfGreen ( 0 . 0 ) , mfBlue ( 0 . 0 ) , mfAlpha ( 0 . 0 ){

DBUG TRACE LOW ( "TraceGraphElement ::ctor" ) ;}

TraceGraphElement : : ˜ TraceGraphElement ( void ){

DBUG TRACE LOW ( "TraceGraphElement ::dtor" ) ;}

void TraceGraphElement : : renderGL ( void ){

DBUG TRACE LOW ( "TraceGraphElement ::renderGL" ) ;

# i f d e f GL ENABLEDg l C o l o r 4 f ( mfRed , mfGreen , mfBlue , mfAlpha ) ;g l V e r t e x 2 f ( mfX , mfY ) ;

# e n d i f}

52

Page 61: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

TraceGraphElement.h

/∗ ∗∗ @ f i l e∗∗ $ R e v i s i o n : 1 . 1 $∗ /

# i f n d e f TRACEGRAPHELEMENT H# d e f i n e TRACEGRAPHELEMENT H

/∗ ∗∗ R e p r e s e n t s a high− l e v e l d e s c r i p t i o n o f a s i n g l e e l e m e n t w i t h i n a da ta∗ p l o t or graph . Can a l s o r e n d e r i t s e l f u s i n g GL i f e n a b l e d .∗ /

c l a s s TraceGraphElement{

p u b l i c :T raceGraphElemen t ( void ) ;v i r t u a l ˜ TraceGraphElement ( void ) ;void renderGL ( void ) ;f l o a t mfX ;f l o a t mfY ;f l o a t mfRadius ; / / ! < c i r c l e / d o t r a d i u sf l o a t mfErrBar ; / / ! < s i z e o f e r r o r bar ( s )f l o a t mfRed ;f l o a t mfGreen ;f l o a t mfBlue ;f l o a t mfAlpha ;

} ;

# e n d i f / / TRACEINFO H

53

Page 62: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

WaveUI.cpp/∗ ∗∗ $ R e v i s i o n : 1 . 2 $∗ /

# i f d e f WAVE UI ENABLED

# i n c l u d e < ace / S S t r i n g . h># i n c l u d e < ace / Env Value T . h>

# i n c l u d e <pgwindow . h>

# i n c l u d e "WaveUI .h"# i n c l u d e "WaveUIMO.h"# i n c l u d e "ACE_DBUG.h"# i n c l u d e "DataBlock.h"# i n c l u d e "DataPathFlow .h"# i n c l u d e "DataPathManager .h"# i n c l u d e "DataPathTransform .h"# i n c l u d e "GraphTrace.h"# i n c l u d e "Guardian.h"# i n c l u d e "GuardianException .h"# i n c l u d e "PropertyList .h"# i n c l u d e "Timer .h"# i n c l u d e "TimerServer .h"

WaveUI ∗ WaveUI : : mpIns t ance = ( WaveUI ∗ )NULL;

void WaveUI : : g e t P a r a m e t e r s ( P r o p e r t y L i s t & r m P r o p L i s t ){

DBUG TRACE LOW STATIC ( "WaveUI ::getParameters " ) ;

D a t a P a t h T r a n s f o rm : : g e t P a r a m e t e r s ( r m P r o p L i s t ) ;

r m P r o p L i s t . s e t S t r i n g P r o p e r t y ( Guard ian : : param , "name" , "WaveUI " ) ;r m P r o p L i s t . s e t S t r i n g P r o p e r t y ( Guard ian : : param , "device " , "user interface" ) ;r m P r o p L i s t . s e t S t r i n g P r o p e r t y ( Guard ian : : param , "width" , "800" ) ;r m P r o p L i s t . s e t S t r i n g P r o p e r t y ( Guard ian : : param , "height " , "600" ) ;

}

# i f d e f WORKING WAVEvoid WaveUI : : b u t t o n C a l l b a c k ( WaveButton ∗ mpButton ){

DBUG TRACE LOW ( "WaveUI :: buttonCallback " ) ;

WUIbuttonCallback MO ∗ mo = new WUIbuttonCallback MO ( t h i s , mpButton ) ;

queueMethodObjec t ( mo ) ;}# e n d i f

54

Page 63: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

void WaveUI : : p o s t C o n f i r m D i a l o g ( c o n s t char ∗ i p T i t l e ){

DBUG BTRACE ( "WaveUI ::postConfirmDialog_ " ,"( ipTitle = \"%s\" )" , i p T i t l e ) ;

/∗∗ Only one c o n f i r m a t i o n can be a c t i v e a t a t i m e .∗ /

# i f d e f WORKING WAVE

i f ( mpConfirmFrame ! = NULL ) {re turn ;

}

/∗∗ Crea te frame .∗ /

DBUG PRINT ( DBUG DEBUG, "_ValueFrameWidth = %d" , ValueFrameWidth ) ;DBUG PRINT ( DBUG DEBUG, "_ValueFrameHeight = %d" , Va lueFrameHeigh t ) ;DBUG PRINT ( DBUG DEBUG, "_ConfirmFrameWidth = %d" , Conf i rmFrameWidth ) ;DBUG PRINT ( DBUG DEBUG, "_ConfirmFrameHeight = %d" , Conf i rmFrameHeigh t ) ;DBUG PRINT ( DBUG DEBUG, "_ConfirmFrameOriginX = %d" , Conf i rmFrameOrig inX ) ;DBUG PRINT ( DBUG DEBUG, "_ConfirmFrameOriginY = %d" , Conf i rmFrameOrig inY ) ;

mpConfirmFrame = new aedFrame ( ) ;mpConfirmFrame−>c r e a t e ( mpValueFrame ,

aedRec t ( Conf i rmFrameOrig inX ,Conf i rmFrameOrig inY ,ConfirmFrameWidth ,Conf i rmFrameHeigh t ) ,

i p T i t l e ) ;

/∗∗ Crea te b u t t o n s .∗ /

DBUG ASSERT DETAIL ( mpOkButton = = NULL , f a l s e , "" ) ;DBUG ASSERT DETAIL ( mpCancelBut ton = = NULL , f a l s e , "" ) ;

mpOkButton = new a e d B u t t o n ( ) ;

mpOkButton−>c r e a t e ( mpConfirmFrame ,aedRec t ( 0 , 0 ,

Conf i rmBut tonWidth , C o n f i r m B u t t o n H e i g h t ) ,"OK" ) ;

mpOkButton−>c o n n e c t ( MOUSE LBUTTON UP,aedCa l lBack ( WaveUI : : b u t t o n C a l l b a c k S t a t i c ) ) ;

55

Page 64: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

mpCancelBut ton = new a e d B u t t o n ( ) ;

mpCancelButton−>c r e a t e ( mpConfirmFrame ,aedRec t ( Conf i rmBut tonWid th ∗2 , 0 ,

Conf i rmBut tonWidth , C o n f i r m B u t t o n H e i g h t ) ,"Cancel " ) ;

mpCancelButton−>c o n n e c t ( MOUSE LBUTTON UP,aedCa l lBack ( WaveUI : : b u t t o n C a l l b a c k S t a t i c ) ) ;

# e n d i f}

void WaveUI : : b u t t o n C a l l b a c k ( void ∗ mpButton ){

DBUG TRACE ( "WaveUI :: buttonCallback_ " ) ;}

void WaveUI : : saveCommand ( c o n s t char ∗ isCommand ){

DBUG BTRACE ( "WaveUI ::saveCommand " , "( isCommand = \"%s\" )" ,isCommand ) ;

i f ( msContro lFi leName . l e n g t h ( ) > 0 ) {FILE ∗ l p F i l e = fopen ( msContro lFi leName . c s t r ( ) , "w" ) ;i f ( l p F i l e = = NULL ) {

GEX ( "Could not open control file" , E IO ) ;}f p r i n t f ( l p F i l e , "%s\n" , isCommand ) ;f c l o s e ( l p F i l e ) ;

}}

# i f d e f WORKING WAVE

void WaveUI : : g r a p h D a t a ( c o n s t unsigned i n t mSinkID ,c o n s t WaveUI : : GRAPH TYPE mType )

{DBUG BTRACE ( "WaveUI ::graphData_" ,

"( mSinkID = %d, mType = %d )" , mSinkID , ( i n t ) mType ) ;

U p d a t e V a l u es = f a l s e ;

mpCanvas = new Canvas ( ) ;

char lpTmp [ 8 1 ] ;

s n p r i n t f ( lpTmp , 8 1 , "%s (%s)" ,ValueRow [ mSinkID ] . pLabel−>g e t C a p t i o n ( ) . c s t r ( ) ,ValueRow [ mSinkID ] . msUni ts . c s t r ( ) ) ;

56

Page 65: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

mpCanvas−>c r e a t e ( mpDesktop ,aedRec t ( GraphFrameOriginX , GraphFrameOriginY ,

GraphFrameWidth , GraphFrameHeight ) ,lpTmp ) ;

mpCanvas−>c o n n e c t ( MOUSE LBUTTON UP,aedCa l lBack ( WaveUI : : b u t t o n C a l l b a c k S t a t i c ) ) ;

mpCanvas−>br ingToTop ( ) ;mpCanvas−>r e n d e r A l l ( ) ;

mpGraph = new Graph ( mpCanvas ) ;

maGraphType = mType ;mnGraphSinkID = mSinkID ;

mpGraph−>u p d a t e G r a p h S t r u c t u r e ( ) ;

mpDesktop−>r e n d e r A l l ( ) ;}# e n d i f

# i f d e f WORKING WAVEvoid WaveUI : : b u t t o n C a l l b a c k S t a t i c ( void ∗ mpButton , void ∗ ) {

DBUG TRACE STATIC ( "WaveUI ::buttonCallbackStatic " ) ;WaveUI ∗ lpUI = WaveUI : : i n s t a n c e ( ) ;i f ( lpUI ! = NULL ) {

lpUI−>b u t t o n C a l l b a c k ( ( WaveButton ∗ ) mpButton ) ;}

}# e n d i f

WaveUI ∗ WaveUI : : i n s t a n c e ( ){

re turn ( mpIns t ance ) ;}

WaveUI : : WaveUI ( c o n s t ACE CString & i s C o n t r o l F i l e ): D a t a P a t h T r a n s fo r m ( ) , m a A p p l i c a t i o n ( ) , mpGraph (NULL) ,

m b G r a p h i c s I n i t i a l i z e d ( f a l s e ) , WUITask ( new WaveUITask ( t h i s ) ) ,m b S D L i n i t i a l i z e d ( f a l s e ) , mpCleanupHandler ( new WaveUICleanup ( t h i s ) )

{DBUG BTRACE ( "WaveUI ::ctor" , "( isControlFile = \"%s\" )" ,

i s C o n t r o l F i l e . c s t r ( ) ) ;

GuardWri te gua rd ( t o k e n ) ;

i f ( mpIns t ance ! = NULL ) {GEX ( "Attempt to instantiate a second WaveUI " , E INTERNAL ) ;

}

57

Page 66: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

s e t U p d a t e R a t e ( 1 0 . 0 ) ;

mpIns t ance = t h i s ;}

WaveUI : : WaveUI ( P r o p e r t y L i s t & p l ): D a t a P a t h T r a n s fo r m ( p l ) , m a A p p l i c a t i o n ( ) , mpGraph (NULL) ,

m b G r a p h i c s I n i t i a l i z e d ( f a l s e ) , WUITask ( new WaveUITask ( t h i s ) ) ,m b S D L i n i t i a l i z e d ( f a l s e ) , mpCleanupHandler ( new WaveUICleanup ( t h i s ) )

{DBUG TRACE ( "WaveUI ::ctor(pl)" ) ;

GuardWri te gua rd ( t o k e n ) ;i f ( mpIns t ance ! = NULL ) {

GEX ( "Attempt to instantiate a second WaveUI " , E INTERNAL ) ;}

ACE CString l s S t r i n g ;

p l . g e t S t r i n g P r o p e r t y ( Guard ian : : param , "width " , l s S t r i n g ) ;

mnDisplayWidth = Guard ian : : s t r t o l ( l s S t r i n g ) ;

DBUG PRINT ( DBUG DEBUG, "mnDisplayWidth = %d (%s)" , mnDisplayWidth ,l s S t r i n g . c s t r ( ) ) ;

p l . g e t S t r i n g P r o p e r t y ( Guard ian : : param , "height " , l s S t r i n g ) ;

mnDisp layHe igh t = Guard ian : : s t r t o l ( l s S t r i n g ) ;

p l . g e t S t r i n g P r o p e r t y ( Guard ian : : param , "update " , l s S t r i n g ) ;

mfUpdateRate = Guard ian : : s t r t o f ( l s S t r i n g ) ;

mpIns t ance = t h i s ;}

WaveUI : : ˜ WaveUI ( ){

DBUG TRACE ( "WaveUI ::dtor" ) ;}

void WaveUI : : m I n i t i a l i z e G r a p h i c s ( void ){

DBUG TRACE ( "WaveUI :: mInitializeGraphics " ) ;

i f ( m b G r a p h i c s I n i t i a l i z e d ) {re turn ;

}m b G r a p h i c s I n i t i a l i z e d = t rue ;

58

Page 67: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

s e t U p d a t e R a t e ( 1 0 . 0 ) ;

m a A p p l i c a t i o n . LoadTheme ( "default" ) ;

GLGraph : : i n i t i a l i z e G L A t t r i b u t e s ( ) ;

DBUG PRINT ( DBUG DEBUG, "width = %d, height = %d" ,mnDisplayWidth , mnDisp layHe igh t ) ;

i f ( ! m a A p p l i c a t i o n . I n i t S c r e e n ( mnDisplayWidth , mnDisplayHeight , 1 6 ,SDL DOUBLEBUF | SDL HWSURFACE |SDL ANYFORMAT | SDL OPENGLBLIT ) ) {

GEX ( "Could not initialize SDL/paraGUI screen ." , E IO ) ;}

m b S D L i n i t i a l i z e d = t rue ;

/∗∗ Crea te t h e graph . Then c r e a t e s u f f i c i e n t graph t r a c e s f o r a l l c u r r e n t l y∗ known f l o w s t o be p l o t t e d ( i f any ) .∗ /

mpGraph = new GLGraph ( mnDisplayWidth , mnDisplayHeight , 0 , 0 ) ;}

void WaveUI : : m I n i t i a l i z e T r a c e s ( void ){

DBUG TRACE ( "WaveUI :: mInitializeTraces " ) ;

/∗∗ Cyc le t h r o u g h our i n v o k i n g P r o p e r t y L i s t , c r e a t i n g a t r a c e∗ and a s i n k f o r each g i v e n t r a c e v a l u e .∗ /

P r o p e r t y L i s t & l r P r o p = t h i s−>g e t D e t a i l s W r i t e a b l e ( ) ;

unsigned i n t l n T r a c e C o u n t = l r P r o p . g e t P r o p e r t y C o u n t ( "trace" ) ;

DBUG PRINT ( DBUG GRAPH , "creating %d traces " , l n T r a c e C o u n t ) ;

f o r ( unsigned i n t l n I n d e x = 0 ; l n I n d e x < l n T r a c e C o u n t ; l n I n d e x + + ) {char l p I n d e x S t r i n g [ 8 1 ] ;

/∗∗ R e t r i e v e t h e t r a c e name .∗ /

s n p r i n t f ( l p I n d e x S t r i n g , 8 1 , "%d" , l n I n d e x ) ;

ACE CString lsTraceName ;

59

Page 68: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

i f ( l r P r o p . g e t S t r i n g P r o p e r t y ( "trace " , l p I n d e x S t r i n g , l sTraceName ) ! = 1 ) {DBUG ASSERT ( f a l s e ) ;

}

/∗∗ Make t h e f l o w .∗ /

char lpTmp [ 8 1 ] ;s n p r i n t f ( lpTmp , 8 1 , "%s %d" , l sTraceName . c s t r ( ) , l n I n d e x ) ;

DataPathFlow ∗ lpNewFlow = new DataPathFlow ( lpTmp , "" ,DataPathFlow : : SINK ,

DataPathFlow : : PERIODICITY UNSPECIFIED ,DataPathFlow : : PHYSICAL ,1 . 0 ,f a l s e ) ;

lpNewFlow−>se tDPTransID ( ge t ID ( ) ) ;lpNewFlow−>s e t V e c t o r W i d t h ( 1 ) ;lpNewFlow−> i n i t i a l i z e ( ) ;

/∗∗ Make t h e t r a c e .∗ /

DBUG ASSERT ( mpGraph ! = NULL ) ;

GraphTrace ∗ l p T r a c e = mpGraph−>addNewTrace ( lsTraceName ,lpNewFlow−>ge t ID ( ) ) ;

/∗∗ F i n i s h c o n f i g u r i n g t h e t r a c e ( c o l o u r s , d i m e n s i o n mappings , e t c . ) .∗ /

l p T r a c e−>se tDimCount ( 1 ) ;l p T r a c e−>se tDimPr imary ( 0 ) ;

}}

void WaveUI : : s e t U p d a t e R a t e ( c o n s t f l o a t i f R a t e ){

DBUG BTRACE ( "WaveUI ::setUpdateRate " , "( ifRate = %f )" , i f R a t e ) ;

f l o a t l f R a t e = i f R a t e ;

i f ( l f R a t e < = 0 . 0 ) {l f R a t e = 0 . 0 0 0 1 ;

}

m a U p d a t e I n t e r v a l . s e t ( 1 . 0 / l f R a t e ) ;

60

Page 69: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

}

i n t WaveUI : : open ( void ∗ ){

DBUG TRACE ( "WaveUI ::open" ) ;

/ / T h i s i s a good t i m e t o r e g i s t e r any I /O hand les , f i l e d e s c r i p t o r s ,/ / s o c k e t s , e t c . w i t h t h e R e a c t o r . N o t i c e t h a t t h e h a n d l e r g i v e n i s t h e/ / WUITask , s i n c e t h i s i s our a d a p t o r which i n c l u d e s t h e ACE Event Handler/ / i n t e r f a c e ./ // / ACE Reactor : : i n s t a n c e ()−> r e g i s t e r h a n d l e r ( T r i g g e r P i p e [ 0 ] , WUITask ,/ / ACE Event Handler : : READ MASK ) ;

/ / We ∗ must ∗ r e g i s t e r o u r s e l v e s t o r e c e i v e e v e n t s from t h e R e a c t o r/ / t o d e a l w i t h i n i t i a l i z a t i o n from t h e Thread manager .

ACE Reactor : : i n s t a n c e ()−> r e g i s t e r h a n d l e r ( WUITask ,ACE Event Handler : : READ MASK ) ;

/ / Now , c a l l our a d a p t o r ’ s ” a c t i v a t e ” method , which w i l l s t a r t up our/ / new t h r e a d w i t h t h e g i v e n p a r a m e t e r s . Re turn t h e r e t u r n code as our/ / f i n a l s t e p .

re turn ( WUITask −>a c t i v a t e ( Guard ian : : T h r e a d S c he du le ) ) ;}

i n t WaveUI : : svc ( void ){

DBUG TRACE ( "WaveUI ::svc" ) ;

/ / The f o l l o w i n g i s t h e f i r s t b i t o f code t o run i n our new WaveUI/ / th read , so we i m m e d i a t e l y name t h e t h r e a d .

DBUG THREAD( "WUI" ) ;ACE Thread Manager : : i n s t a n c e ()−> w a i t o n e x i t ( 1 ) ;

/ / R e g i s t e r our ACE Cleanup w i t h t h e ACE Object Manager so t h a t i f t h e/ / s y s t e m i s s h u t down we ’ l l be g i v e n a chance t o check Guardian and/ / d e t e r m i n e t h e t e r m i n a t i o n s t a t e .

ACE Object Manager : : i n s t a n c e ()−> a t e x i t ( mpCleanupHandler ) ;

/ // / A c t i v a t e t h e g r a p h i c s s y s t e m ./ /

t r y {m I n i t i a l i z e G r a p h i c s ( ) ;

/ /

61

Page 70: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

/ / I n i t i a l i z e t h e upda te t i m e r ./ /

ACE Future<Timer ∗> t i m e r f u t u r e =TIMER SERVER : : i n s t a n c e ()−>ge tT imer ( Timer : : T PERIODIC , m a U p d a t e I n t e r v a l ,

t h i s ) ;

whi le ( ! GUARDIAN : : i n s t a n c e ()−> i s T e r m i n a t e ( ) ) {ACE Auto Bas ic P t r<ACE Method Request > mo ( a c t i v a t i o n q u e u e . dequeue ( ) ) ;

i f ( ( ∗ mo ) . c a l l ( ) = = − 1 ) {break ;

}}

}catch ( G u a r d i a n E x c e p t i o n & ge ) {

DBUG PRINT ( DBUG EX , "Caught exception .. exiting" ) ;}

i f ( m b S D L i n i t i a l i z e d ) {SDL Quit ( ) ;

}

DBUG PRINT ( DBUG TRACE , "exiting" ) ;

re turn ( 0 ) ;}

void WaveUI : : n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t )

{DBUG BTRACE ( "WaveUI ::notifyDataListener " ,

"( sinkID = %d, event )" , s i nk ID ) ;

WUIno t i fyDataL is t ene r MO ∗ mo = new WUIno t i fyDa taLis t ene r MO ( t h i s , s inkID ,e v e n t ) ;

queueMethodObjec t ( mo ) ;}

void WaveUI : : n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t )

{DBUG TRACE ( "WaveUI :: notifyDataListener_ (event )" ) ;

/∗∗ I f i t ’ s a TIMER e v e n t , do a g r a p h i c s upda te .∗ /

i f ( even t−>ge tType ( ) = = D a t a P a t h E v e n t : : EVENT TIMER ) {

62

Page 71: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

GuardRead guard ( ∗ t o k e n ) ;

/∗∗ But don ’ t c a l l SDL commands i f SDL i s n o t f i r s t i n i t i a l i z e d .∗ /

i f ( m b S D L i n i t i a l i z e d ) {

/∗∗ . . . and don ’ t c a l l SDL commands i f we ’ ve been t o l d t o t e r m i n a t e ,∗ s i n c e t h e window ( s ) may a l r e a d y be c l o s e d .∗ /

i f ( ! GUARDIAN : : i n s t a n c e ()−> i s T e r m i n a t e ( ) ) {

/∗∗ N o t i f y t h e graph t h a t we need t o do an upda te ( t h a t i s , send∗ i t t h e t i m e r e v e n t ) .∗ /

mpGraph−>n o t i f y D a t a L i s t e n e r ( s inkID , e v e n t ) ;

/∗∗ F l i p t h e b u f f e r s .∗ /

PG Window : : B u l k B l i t ( ) ;SDL GL SwapBuffers ( ) ;SDL Fl ip ( m a A p p l i c a t i o n . Ge tSc reen ( ) ) ;

/∗∗ Run t h r o u g h any e v e n t s .∗ /

SDL Event l a E v e n t ;whi le ( SDL Pol lEven t ( & l a E v e n t ) ) {

m a A p p l i c a t i o n . PumpIntoEventQueue ( & l a E v e n t ) ; / / f o r p a r a g u i p r o c e s s n gi f ( l a E v e n t . t y p e = = SDL QUIT ) {

GUARDIAN : : i n s t a n c e ()−> shutdown ( ) ;break ;

}}

}}

}

/ / Then i n v o k e t h e p a r e n t c l a s s h a n d l e r .

D a t a P a t h T r a n s f o rm : : n o t i f y D a t a L i s t e n e r ( s inkID , e v e n t ) ;}

63

Page 72: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

i n t WaveUI : : h a n d l e i n p u t ( ACE HANDLE h a n d l e ){

DBUG TRACE ( "WaveUI ::handle_input " ) ;

WUIhandle input MO ∗ mo = new WUIhandle input MO ( t h i s , h a n d l e ) ;

queueMethodObjec t ( mo ) ;

re turn ( 0 ) ;}

i n t WaveUI : : h a n d l e i n p u t ( ACE HANDLE h a n d l e ){

DBUG TRACE ( "WaveUI :: handle_input_ " ) ;

/ / Per form whatever i n p u t p r o c e s s i n g i s r e q u i r e d f o r t h i s hand le .re turn ( 0 ) ;

}

i n t WaveUI : : h a n d l e c l o s e ( ACE HANDLE h a n d l e ){

DBUG TRACE ( "WaveUI ::handle_close " ) ;

WUIhandle close MO ∗ mo = new WUIhandle close MO ( t h i s , h a n d l e ) ;

queueMethodObjec t ( mo ) ;

re turn ( 0 ) ;}

i n t WaveUI : : h a n d l e c l o s e ( ACE HANDLE h a n d l e ){

DBUG TRACE ( "WaveUI :: handle_close_ " ) ;

/ / Per form whatever c l o s e p r o c e s s i n g i s r e q u i r e d f o r t h i s hand le .re turn ( 0 ) ;

}

void WaveUI : : dump ( void ){

t h i s−>dump ( 0 ) ;}

void WaveUI : : dump ( unsigned i n t l e v e l ){

GuardRead guard ( ∗ t o k e n ) ;}

void WaveUI : : n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a B l o c k P t r d a t a )

{

64

Page 73: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DBUG BTRACE ( "WaveUI ::notifyDataListener " ,"( sinkID = %d, data )" , s i nk ID ) ;

WUIno t i fyDataL is t ene r MO ∗ mo = new WUIno t i fyDa taLis t ene r MO ( t h i s , s inkID ,d a t a ) ;

queueMethodObjec t ( mo ) ;}

i n tWaveUI : : queueMethodObjec t ( ACE Method Request ∗ mo ){

DBUG BTRACE LOW ( "WaveUI :: queueMethodObject " ,"( mo = 0x%08x )" , ( unsigned i n t )mo ) ;

ACE Time Value t i m e o u t ( GLock : : i n s t a n c e ()−>getTimeoutTime ( ) ) ;ACE Time Value ∗ t i m e o u t P t r = & t i m e o u t ;

i f ( t i m e o u t = = ACE Time Value : : z e r o ) {t i m e o u t P t r = 0 ;

}

re turn ( a c t i v a t i o n q u e u e . enqueue ( mo , t i m e o u t P t r ) ) ;}

void WaveUI : : i n i t i a l i z e F l o w s ( void ){

DBUG TRACE ( "WaveUI :: initializeFlows " ) ;WUI in i t i a l i zeF lows MO ∗ mo = new WUIin i t i a l i zeF lows MO ( t h i s ) ;

queueMethodObjec t ( mo ) ;}

void WaveUI : : i n i t i a l i z e F l o w s ( void ){

DBUG TRACE ( "WaveUI :: initializeFlows_ " ) ;

m I n i t i a l i z e T r a c e s ( ) ;}

void WaveUI : : n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a B l o c k P t r d a t a )

{DBUG TRACE ( "WaveUI :: notifyDataListener_ (data)" ) ;

i f ( d a t a . g e t ( ) = = NULL ) {GEX ( "Received NULL DataBlock" , E BADARG ) ;

}

i f ( mpGraph ! = NULL ) {mpGraph−>n o t i f y D a t a L i s t e n e r ( s inkID , d a t a ) ;

65

Page 74: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

}

# i f d e f WORKING WAVEi f ( mpGraph ! = NULL ) {

i f ( s ink ID = = mnGraphSinkID ) {i f ( maGraphType = = WaveUI : : GRAPH CURRENT ) {

mpGraph−>addData ( d a t a ) ;}

}}

# e n d i f}

# e n d i f / / WAVE UI ENABLED

66

Page 75: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

WaveUI.h/∗ ∗∗ G r a p h i c a l Waveform User I n t e r f a c e .∗∗ $ R e v i s i o n : 1 . 1 $∗∗ /

# i f d e f WAVE UI ENABLED

# i f n d e f WAVEUI H# d e f i n e WAVEUI H

# i n c l u d e < ace / A c t i v a t i o n Q u e u e . h> / / r e q u i r e d f o r a c t i v e o b j e c t# i n c l u d e < ace / Synch . h> / / r e q u i r e d f o r m u l t i t h r e a d i n g# i n c l u d e < ace / Task . h> / / r e q u i r e d f o r m u l t i t h r e a d i n g

# i n c l u d e < p a r a g u i . h>

# i n c l u d e < p g a p p l i c a t i o n . h>

# i n c l u d e "ACE_DBUG.h"# i n c l u d e "DataPathTransform .h"# i n c l u d e "GLGraph.h"# i n c l u d e "GuardianLog .h"

# i n c l u d e <map>

us ing namespace s t d ;

c l a s s WaveUITask ;c l a s s WaveUICleanup ;

c l a s s WaveUI : p u b l i c D a t a P a t h T r a n s f o rm{

p u b l i c :/∗ ∗∗ Not e x a c t l y a S i n g l e t o n . There may o n l y be once WaveUI i n a sys t em ,∗ and i t i s a c c e s s i b l e t h r o u g h t h i s method , however , i f t h i s method i s∗ c a l l e d b e f o r e an i n s t a n c e i s c r e a t e d , i t w i l l s i m p l y r e t u r n NULL r a t h e r∗ t han c r e a t e an WaveUI .∗ /

s t a t i c WaveUI ∗ i n s t a n c e ( void ) ;

/∗ ∗∗ T h i s method i s t h e p a r a g u i v a l u e b u t t o n c a l l b a c k f u n c t i o n .∗ /

/ / s t a t i c v o i d b u t t o n C a l l b a c k S t a t i c ( v o i d ∗ b u t t o n , v o i d ∗ da ta ) ;

67

Page 76: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

/∗ ∗∗ T h i s method i s t h e WaveUI : : b u t t o n C a l l b a c k S t a t i c c a l l b a c k f u n c t i o n t o∗ c r o s s from c l a s s method t o s p e c i f i c o b j e c t method .∗ /

/ / v o i d b u t t o n C a l l b a c k ( A q u a t s B u t t o n ∗ b u t t o n ) ;

s t a t i c void g e t P a r a m e t e r s ( P r o p e r t y L i s t & r m P r o p L i s t ) ;

v i r t u a l void dump ( void ) ;v i r t u a l void dump ( unsigned i n t l e v e l ) ;

/∗ ∗∗ DataPa thTrans form ( proxy ) methods .∗ /

v i r t u a l void i n i t i a l i z e F l o w s ( ) ;

v i r t u a l void n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a B l o c k P t r d a t a ) ;

v i r t u a l void n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t ) ;

/∗ ∗∗ Task methods .∗ /

i n t open ( void ∗ ) ;

i n t svc ( void ) ;

i n t queueMethodObjec t ( ACE Method Request ∗ mo ) ;

/∗ ∗∗ Even t h a n d l e r ( proxy ) methods .∗ /

i n t h a n d l e i n p u t ( ACE HANDLE h a n d l e ) ;i n t h a n d l e c l o s e ( ACE HANDLE h a n d l e ) ;

/∗ ∗∗ C o n s t r u c t o r .∗∗ @param i s C o n t r o l F i l e t h e name ( f u l l pa th ) o f t h e f i l e i n t o which∗ t h e u s e r i n t e r f a c e w r i t e s t h e c o n t r o l words . I f t h e u s e r s e l e c t s∗ ” save ” , t h e n ” save ” i s w r i t t e n i n t o t h e f i l e . I f ” d i s c a r d ” , t h e n∗ ” d i s c a r d ” i s w r i t t e n i n t o i t .∗ /

WaveUI ( c o n s t ACE CString & i s C o n t r o l F i l e ) ;

68

Page 77: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

WaveUI ( P r o p e r t y L i s t & param ) ;v i r t u a l ˜ WaveUI ( ) ;

void saveCommand ( c o n s t char ∗ ) ;

void s e t U p d a t e R a t e ( c o n s t f l o a t i f H e r t z ) ;

p r i v a t e :

void m I n i t i a l i z e G r a p h i c s ( void ) ;

void m I n i t i a l i z e T r a c e s ( void ) ;

/∗ ∗ Width o f t h e p h y s i c a l d i s p l a y i n p i x e l s . ∗ /unsigned i n t mnDisplayWidth ;

/∗ ∗ Heigh t o f t h e p h y s i c a l d i s p l a y i n p i x e l s . ∗ /unsigned i n t mnDisp layHe igh t ;

/∗ ∗ Colour d e p t h o f t h e p h y s i c a l d i s p l a y i n b i t s / p i x e l . ∗ /unsigned i n t mnDisplayDepth ;

P G A p p l i c a t i o n m a A p p l i c a t i o n ;

GLGraph ∗ mpGraph ;

bool m b G r a p h i c s I n i t i a l i z e d ;

f l o a t mfUpdateRate ;

ACE Time Value m a U p d a t e I n t e r v a l ;

ACE CString msContro lFi leName ;

void p o s t C o n f i r m D i a l o g ( c o n s t char ∗ ) ;void u n p o s t C o n f i r m D i a l o g ( void ) ;

void i n i t i a l i z e V a l u e s ( void ) ;void i n i t i a l i z e F i x e d ( void ) ;

void u p d a t e C u r r e n t T i m e ( void ) ;

/∗ ∗∗ DataPa thTrans form ( s e r v a n t ) methods .∗ /

f r i e n d c l a s s WUIin i t i a l i zeF lows MO ;f r i e n d c l a s s WUIno t i fyDa taLi s tener MO ;

v i r t u a l void i n i t i a l i z e F l o w s ( ) ;

69

Page 78: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

v i r t u a l void n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a B l o c k P t r d a t a ) ;

v i r t u a l void n o t i f y D a t a L i s t e n e r ( c o n s t unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t ) ;

/∗ ∗∗ Crea te a g r a p h i c a l d i s p l a y o f t h e g i v e n b u t t o n a c c o r d i n g t o t h e g i v e n∗ t y p e .∗ /

/ / v o i d graphData ( c o n s t u n s i g n e d i n t s ink ID , c o n s t GRAPH TYPE t y p e ) ;

f r i e n d c l a s s WUIbuttonCallback MO ;void b u t t o n C a l l b a c k ( void ∗ b u t t o n ) ;

/∗ ∗∗ Even t h a n d l e r ( s e r v a n t ) methods .∗ /

f r i e n d c l a s s WUIhandle input MO ;f r i e n d c l a s s WUIhandle close MO ;

i n t h a n d l e i n p u t ( ACE HANDLE h a n d l e ) ;i n t h a n d l e c l o s e ( ACE HANDLE h a n d l e ) ;

/∗ ∗∗ Queue r e q u i r e d f o r a c t i v e o b j e c t .∗ /

ACE Act iva t ion Queue a c t i v a t i o n q u e u e ;

/∗ ∗∗ ACE Task a d a p t o r .∗ /

WaveUITask ∗ WUITask ;

s t a t i c WaveUI ∗ mpIns tance ;

ACE Token t o k e n ;

bool m b S D L i n i t i a l i z e d ;

WaveUICleanup ∗ mpCleanupHandler ;} ;

/∗ ∗∗ Adapt t h e ACE Task i n t e r f a c e t o t h e WaveUI .∗∗ T h i s c l a s s a l l o w s WaveUI t o run i n i t s own t h r e a d as an

70

Page 79: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

∗ a c t i v e o b j e c t . I t does r e q u i r e manual l o c k i n g o f any r e s o u r c e s which∗ may be shared be tween t h r e a d s .∗∗ ACE Task a l s o i m p l e m e n t s e v e n t h a n d l e r . I f you don ’ t want t h e e v e n t∗ h a n d l e r f u n c t i o n s , j u s t d e l e t e t h e h a n d l e ∗ methods .∗ /

c l a s s WaveUITask : p u b l i c ACE Task<ACE MT SYNCH>

{p u b l i c :

WaveUITask ( WaveUI ∗ agg ) : agg ( agg ){ }

i n t open ( void ∗ v ) {a s s e r t ( agg ! = NULL ) ;re turn ( agg −>open ( v ) ) ;

}i n t svc ( void ) {

a s s e r t ( agg ! = NULL ) ;re turn ( agg −>svc ( ) ) ;

}v i r t u a l i n t h a n d l e i n p u t ( ACE HANDLE h a n d l e ) {

re turn ( agg −>h a n d l e i n p u t ( h a n d l e ) ) ;}v i r t u a l i n t h a n d l e c l o s e ( ACE HANDLE hand le , ACE Reactor Mask ) {

re turn ( agg −>h a n d l e c l o s e ( h a n d l e ) ) ;}v i r t u a l ˜ WaveUITask ( )

{ }p r i v a t e :WaveUI ∗ agg ;

} ;

/∗ ∗∗ Adapt t h e ACE Cleanup i n t e r f a c e t o t h e WaveUI t o a l l o w c l e a n u p by t h e∗ ACE Object Manager .∗ /

c l a s s WaveUICleanup : p u b l i c ACE Cleanup{

p u b l i c :

/∗ ∗∗ Send an EOD e v e n t t o t h e WaveUI t o a l l o w i t t o d e t e c t and p r o c e s s∗ t e r m i n a t i o n .∗ /

v i r t u a l void c l e a n u p ( void ∗ param = 0 ) {/ / SDL Quit ( ) ;c e r r << "cleanup called " << e n d l ;a s s e r t ( mpAgg ! = NULL ) ;D a t a P a t h E v e n t P t r l C o m p l e t e E ve n t ( new D a t a P a t h E v e n t (

71

Page 80: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

D a t a P a t h E v e n t : : EVENT END OF DATA ) ) ;mpAgg−>n o t i f y D a t a L i s t e n e r ( 0 , l C o m p l e t e E ven t ) ;

}WaveUICleanup ( WaveUI ∗ ipAgg ) : mpAgg ( ipAgg ) {

a s s e r t ( mpAgg ! = NULL ) ;}v i r t u a l ˜ WaveUICleanup ( ) {}

p r i v a t e :WaveUI ∗ mpAgg ;

} ;

# e n d i f / / WAVEUI H

# e n d i f / / WAVE UI ENABLED

72

Page 81: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

WaveUIMO.h/∗ ∗∗ Method o b j e c t s f o r t h e WaveUI .∗∗ $ R e v i s i o n : 1 . 1 $∗ /

# i f d e f WAVE UI ENABLED

# i f n d e f WAVEUIMO H# d e f i n e WAVEUIMO H

# i n c l u d e < ace / Method Reques t . h>

# i n c l u d e "WaveUI .h"

c l a s s WUIin i t i a l i zeF lows MO : p u b l i c ACE Method Request {p u b l i c :

WUI in i t i a l i zeF lows MO ( WaveUI ∗ waveUI ){

DBUG TRACE LOW ( "WUIinitializeFlows_MO ::ctor" ) ;waveUI = waveUI ;

}

˜ WUI in i t i a l i zeF lows MO ( ){

DBUG TRACE LOW ( "WUIinitializeFlows_MO ::dtor" ) ;}

v i r t u a l i n t c a l l ( void ){

DBUG TRACE LOW ( "WUIinitializeFlows_MO ::call" ) ;t h i s −>waveUI −> i n i t i a l i z e F l o w s ( ) ;re turn ( 0 ) ;

}p r i v a t e :WaveUI ∗ waveUI ;

} ;

c l a s s WUIhandle input MO : p u b l i c ACE Method Request {p u b l i c :

WUIhandle input MO ( WaveUI ∗ waveUI , ACE HANDLE h a n d l e ){

DBUG TRACE LOW ( "WUIhandle_input_MO ::ctor" ) ;waveUI = waveUI ;h a n d l e = h a n d l e ;

}

˜ WUIhandle input MO ( ){

73

Page 82: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DBUG TRACE LOW ( "WUIhandle_input_MO ::dtor" ) ;}

v i r t u a l i n t c a l l ( void ){

DBUG TRACE LOW ( "WUIhandle_input_MO ::call" ) ;t h i s −>waveUI −>h a n d l e i n p u t ( h a n d l e ) ;re turn ( 0 ) ;

}p r i v a t e :WaveUI ∗ waveUI ;ACE HANDLE h a n d l e ;

} ;

# i f d e f WORKING WAVEc l a s s WUIbuttonCallback MO : p u b l i c ACE Method Request {

p u b l i c :WUIbuttonCallback MO ( WaveUI ∗ waveUI , WaveButton ∗ b u t t o n )

{DBUG TRACE LOW ( "WUIbuttonCallback_MO ::ctor" ) ;waveUI = waveUI ;b u t t o n = b u t t o n ;

}

˜ WUIbuttonCallback MO ( ){

DBUG TRACE LOW ( "WUIbuttonCallback_MO ::dtor" ) ;}

v i r t u a l i n t c a l l ( void ){

DBUG TRACE LOW ( "WUIbuttonCallback_MO ::call" ) ;t h i s −>waveUI −>b u t t o n C a l l b a c k ( b u t t o n ) ;re turn ( 0 ) ;

}p r i v a t e :WaveUI ∗ waveUI ;WaveButton ∗ b u t t o n ;

} ;# e n d i f

c l a s s WUIhandle close MO : p u b l i c ACE Method Request {p u b l i c :

WUIhandle close MO ( WaveUI ∗ waveUI , ACE HANDLE h a n d l e ){

DBUG TRACE LOW ( "WUIhandle_close_MO ::ctor" ) ;waveUI = waveUI ;h a n d l e = h a n d l e ;

}

˜ WUIhandle close MO ( )

74

Page 83: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

{DBUG TRACE LOW ( "WUIhandle_close_MO ::dtor" ) ;

}

v i r t u a l i n t c a l l ( void ){

DBUG TRACE LOW ( "WUIhandle_close_MO ::call" ) ;t h i s −>waveUI −>h a n d l e c l o s e ( h a n d l e ) ;re turn ( 0 ) ;

}p r i v a t e :WaveUI ∗ waveUI ;ACE HANDLE h a n d l e ;

} ;

c l a s s WUIno t i fyDataLis t ene r MO : p u b l i c ACE Method Request {p u b l i c :

WUIno t i fyDataL is t ene r MO ( WaveUI ∗ s t ,unsigned i n t s inkID ,D a t a B l o c k P t r d a t a )

{DBUG BTRACE LOW ( "WUInotifyDataListener_MO ::ctor" ,

"( sinkID = %d, data )" , s i nk ID ) ;s t = s t ;s i n k I D = s inkID ;d a t a = d a t a ;i s D a t a = t rue ;

}WUIno t i fyDataL is t ene r MO ( WaveUI ∗ s t ,

unsigned i n t s inkID ,D a t a P a t h E v e n t P t r e v e n t )

{DBUG BTRACE LOW ( "WUInotifyDataListener_MO ::ctor" ,

"( sinkID = %d, event )" , s i nk ID ) ;s t = s t ;s i n k I D = s inkID ;e v e n t = e v e n t ;i s D a t a = f a l s e ;

}

˜ WUIno t i fyDataLi s tener MO ( ){

DBUG TRACE LOW ( "WUInotifyDataListener_MO ::dtor" ) ;}

v i r t u a l i n t c a l l ( void ){

DBUG TRACE LOW ( "WUInotifyDataListener_MO ::call" ) ;i f ( i s D a t a ) {

s t −>n o t i f y D a t a L i s t e n e r ( s ink ID , d a t a ) ;} e l s e {

75

Page 84: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

s t −>n o t i f y D a t a L i s t e n e r ( s ink ID , e v e n t ) ;}re turn ( 0 ) ;

}p r i v a t e :WaveUI ∗ s t ;unsigned i n t s i n k I D ;bool i s D a t a ;D a t a B l o c k P t r d a t a ;D a t a P a t h E v e n t P t r e v e n t ;

} ;

# e n d i f / / WAVEUIMO H

# e n d i f / / WAVE UI ENABLED

76

Page 85: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

Annex BConfiguration Script

77

Page 86: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

waveui.txt## WaveUI s i m u l a t i o n and t e s t .#

## Crea te t h e p h y s i c a l ( so , w i t h i n Guardian , v i r t u a l ) e n v i r o n m e n t we are# measur ing .#

a i r [ dpe= D a t a P a t h V i r t u a l ,name="submarine air" ,d e v i c e ="environment " ,a c t i o n ="create "

] ;

a i r : : CO2 [ name="carbon dioxide" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

a i r : : O2 [ name="oxygen " ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

a i r : : VOC [ name="volatile organic compounds" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

a i r : : CO [ name="carbon monoxide" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

a i r : : H2 [ name="hydrogen" ,d i r e c t i o n ="source " ,

78

Page 87: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

a i r : : temp [ name="temperature " ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

a i r : : p r e s s [ name="pressure" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

a i r : : h u m i d i t y [ name="humidity" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

## We a l s o m o n i t o r t h e b a t t e r y s t a t e o f t h e s y s t e m#

b a t t e r y [ dpe= D a t a P a t h V i r t u a l ,name="AQUATS battery" ,d e v i c e ="battery" ,M a n u f a c t u r e r . name="Tri -M Systems" ,M a n u f a c t u r e r . s e r i a l n o ="199392-332 " ,M a n u f a c t u r e r . p r o d u c t n o ="Tri -M Batt 32V NiMH" ,a c t i o n ="create "

] ;

b a t t e r y : : v o l t s [ name="battery voltage" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

79

Page 88: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

## We a l s o m o n i t o r t h e t e m p e r a t u r e o f t h e CPU.#

CPU [ dpe= D a t a P a t h V i r t u a l ,name="Pentium III , 500 MHz" ,d e v i c e ="CPU" ,a c t i o n ="create " ,M a n u f a c t u r e r . name="Lippert Cool Road Runner III PC/104+ " ,M a n u f a c t u r e r . p r o d u c t n o ="CRIII " ,M a n u f a c t u r e r . s e r i a l n o ="99-291-293"

] ;

CPU : : temp [ name="temperature " ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

## Crea te t h e s e n s o r s we are u s i n g t o m o n i t o r t h e e n v i r o n m e n t .#

# OXYGEN SENSOR

O2sensor [ dpe= D a t a P a t h V i r t u a l ,name="FireSystems O2 Sensor " ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

O2sensor : : i n [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

O2sensor : : o u t [ name="O2 Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

# CARBON DIOXIDE SENSOR

80

Page 89: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

CO2sensor [ dpe= D a t a P a t h V i r t u a l ,name="FireSystems CO2 Sensor " ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

CO2sensor : : i n [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

CO2sensor : : o u t [ name="CO2 Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e =200 .0 ,a c t i o n ="create "

] ;

CO2sensor : : c o n t r o l [ name="CO2 Control Input" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="periodic" ,r a t e = 0 . 0 1 ,a c t i o n ="create "

] ;

CO2sensor : : watchdog [ name="CO2 Watchdog" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

# VOC SENSOR

VOCsensor [ dpe="DataPathVirtual " ,name="Malamute Inc. VOC Sensor " ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

VOCsensor : : i n [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,

81

Page 90: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

a c t i o n ="create "] ;

VOCsensor : : o u t [ name="VOC Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

# CO SENSOR

COsensor [ dpe= D a t a P a t h V i r t u a l ,name="First Alert CO Sensor " ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

COsensor : : i n [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

COsensor : : o u t [ name="CO Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

# H2 SENSOR

H2sensor [ dpe= D a t a P a t h V i r t u a l ,name="Microcore H2 Sensor " ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

H2sensor : : i n [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

82

Page 91: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

H2sensor : : o u t [ name="H2 Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

# TEMPERATURE/ HUMIDITY SENSOR

TempSensor [ dpe= D a t a P a t h V i r t u a l ,name="Microcore Temperature /Humidity Probe" ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

TempSensor : : tempIn [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

TempSensor : : humidIn [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

TempSensor : : tempOut [ name="Temperature Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

TempSensor : : humidOut [ name="Humidity Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

# PRESSURE SENSOR

P r e s s S e n s o r [ dpe= D a t a P a t h V i r t u a l ,

83

Page 92: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

name="Validyne Absolute Pressure Transducer" ,d e v i c e ="sensor " ,a c t i o n ="create "

] ;

P r e s s S e n s o r : : i n [ name="Vent In" ,d i r e c t i o n ="sink" ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

P r e s s S e n s o r : : o u t [ name="Pressure Out" ,d i r e c t i o n ="source " ,v e c t o r W i d t h =1 ,p e r i o d i c i t y ="timeseries" ,r a t e = 1 . 0 ,a c t i o n ="create "

] ;

## Connect our v i r t u a l s e n s o r s t o our v i r t u a l s e n s a n d s .#

a i r : : CO2 −> CO2sensor : : i n [ name="CO2 connection " ,t y p e ="virtual" ,l a b e l ="CO2_sensor" ,a c t i o n ="create "

] ;

a i r : : O2 −> O2sensor : : i n [ name="O2 connection" ,t y p e ="virtual" ,l a b e l ="O2_sensor" ,a c t i o n ="create "

] ;

a i r : : VOC −> VOCsensor : : i n [ name="VOC connection " ,t y p e ="virtual" ,l a b e l ="VOC_sensor" ,a c t i o n ="create "

] ;

a i r : : CO −> COsensor : : i n [ name="CO connection" ,t y p e ="virtual" ,l a b e l ="CO_sensor" ,a c t i o n ="create "

] ;

a i r : : H2 −> H2sensor : : i n [ name="H2 connection" ,t y p e ="virtual" ,

84

Page 93: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

l a b e l ="H2_sensor" ,a c t i o n ="create "

] ;

a i r : : temp −> TempSensor : : tempIn [ name="Temperature connection" ,t y p e ="virtual" ,l a b e l ="Temp_sensor " ,a c t i o n ="create "

] ;

a i r : : h u m i d i t y −> TempSensor : : humidIn [ name="Humidity connection" ,t y p e ="virtual" ,l a b e l ="Humid_sensor " ,a c t i o n ="create "

] ;

a i r : : p r e s s −> P r e s s S e n s o r : : i n [ name="Pressure connection" ,t y p e ="virtual" ,l a b e l ="Pressure_sensor " ,a c t i o n ="create "

] ;

## Crea te t h e ADC/DAC i n t e r f a c e s i m u l a t i o n d e v i c e .#

adc [ dpe= Ana logDig i t a lS im ,name="analog to digital" ,d e v i c e ="adc simulator" ,

a n a l o g I n C h a n n e l .0= "O2:sine ,10,30,5 " ,a n a l o g I n C h a n n e l .1= "CO2:sine ,20,5,5 " ,a n a l o g I n C h a n n e l .2= "VOC:sine ,2,10,5 " ,a n a l o g I n C h a n n e l .3= "CO:sine ,15,20,10" ,a n a l o g I n C h a n n e l .4= "H2:sine ,100,1,1 " ,a n a l o g I n C h a n n e l .5= "temperature :sine ,10,32,1 " ,a n a l o g I n C h a n n e l .6= "pressure:sine ,20,22,5 " ,a n a l o g I n C h a n n e l .7= "humidity:sine ,1,100,1 " ,a n a l o g I n C h a n n e l .8= "battery voltage:sine ,10,16,16" ,a n a l o g I n C h a n n e l .9= "CPU temperature :sine ,5,70,10 " ,a n a l o g I n . r a t e =100 ,a n a l o g I n . c o u n t = 3 2 , # 3 2 ADC c h a n n e l s

d i g i t a l O u t . c o u n t =4 ,d i g i t a l O u t . r a t e =1 ,d i g i t a l O u t C h a n n e l .0= "power down" ,d i g i t a l O u t C h a n n e l .1= "reset O2" ,

d i g i t a l I n . c o u n t =8 ,d i g i t a l I n . r a t e =1 ,

85

Page 94: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

d i g i t a l I n C h a n n e l .5= "O2 sensor status "

a c t i o n ="create "] ;

## Get a c c e s s t o some o f t h e v i r t u a l ana log i n p u t s .#

adc : : AIchan00 [ name="AI channel 00" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan01 [ name="AI channel 01" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan02 [ name="AI channel 02" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan03 [ name="AI channel 03" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan04 [ name="AI channel 04" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan05 [ name="AI channel 05" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan06 [ name="AI channel 06" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan07 [ name="AI channel 07" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan08 [ name="AI channel 08" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : AIchan12 [ name="AI channel 12" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

## Get a c c e s s t o some o f t h e o u t p u t s .#

adc : : O2out [ name="O2" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : CO2out [ name="CO2" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : COout [ name="CO" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : H2out [ name="H2" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : VOCout [ name="VOC" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : P r e s s O u t [ name="pressure" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : TempOut [ name="temperature " , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : HumidOut [ name="humidity" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

adc : : B a t t e r y O u t [ name="battery voltage" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

86

Page 95: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

adc : : CPUTempOut [ name="CPU temperature" , r a t e = 2 0 0 . 0 , a c t i o n ="assign " ] ;

## Get a c c e s s t o some o f t h e v i r t u a l d i g i t a l i n p u t s and o u t p u t s .#

adc : : DIchan05 [ name="DI channel 05" , r a t e = 1 . 0 , a c t i o n ="assign " ] ;

adc : : DOchan00 [ name="DO channel 00" , r a t e = 1 . 0 , a c t i o n ="assign " ] ;

adc : : O 2 s t a t u s [ name="O2 sensor status " , r a t e = 1 . 0 , a c t i o n ="assign " ] ;

adc : : O 2 r e s e t [ name="reset O2" , r a t e = 1 . 0 , a c t i o n ="assign " ] ;

adc : : powerDown [ name="power down" , r a t e = 1 . 0 , a c t i o n ="assign " ] ;

## Connect s e n s o r o u t p u t s t o ana log i n p u t s .#

O2sensor : : o u t −> adc : : AIchan00[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

CO2sensor : : o u t −> adc : : AIchan01[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

VOCsensor : : o u t −> adc : : AIchan02[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

COsensor : : o u t −> adc : : AIchan03[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

CPU : : temp −> adc : : AIchan04[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

H2sensor : : o u t −> adc : : AIchan05[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

TempSensor : : tempOut −> adc : : AIchan06[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

TempSensor : : humidOut −> adc : : AIchan07[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

P r e s s S e n s o r : : o u t −> adc : : AIchan08[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

b a t t e r y : : v o l t s −> adc : : AIchan12[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

#

87

Page 96: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

# Connect s e n s o r s t o d i g i t a l i n p u t s and o u t p u t s .#

CO2sensor : : watchdog −> adc : : DIchan05[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : DOchan00 −> CO2sensor : : c o n t r o l[ name="connection" , t y p e ="virtual" , l a b e l ="conn" , a c t i o n ="create " ] ;

## Crea te c a l i b r a t i o n t r a n s f o r m s and a c c e s s f l o w s .#

O 2 C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="O2 Calibration " ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 0.1 * 2.1" ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

O 2 C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

O 2 C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

VOCCal ibra te [ dpe= D a t a P a t h A r i t h m e t i c ,name="VOC Calibration" ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 0.1 * 2.1" ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

VOCCal ibra te : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

VOCCal ibra te : : o u t [ name="out" ,r a t e =200 .0 ,

88

Page 97: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

a c t i o n ="assign " ] ;

C O C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="CO Calibration " ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 0.1 * 2.1" ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

C O C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

C O C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

C O 2 C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="CO2 Calibration" ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 30.1 * 0.5 " ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

C O 2 C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

C O 2 C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

H 2 C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="H2 Calibration " ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 30.1 * 0.5 " ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

89

Page 98: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

a c t i o n ="create "] ;

H 2 C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

H 2 C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

T e m p C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="Temp Calibration " ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 30.1 * 0.5 " ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

T e m p C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

T e m p C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

CPUTempCalibrate [ dpe= D a t a P a t h A r i t h m e t i c ,name="CPU Temp Calibration" ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 3.1" ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

CPUTempCalibrate : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

CPUTempCalibrate : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

90

Page 99: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

P r e s s C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="Press Calibration " ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 30.1 * 0.5 " ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

P r e s s C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

P r e s s C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

H u m i d C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="Humid Calibration " ,d e v i c e ="computation " ,

i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 - 30.1 * 0.5 " ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

H u m i d C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

H u m i d C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

B a t t e r y C a l i b r a t e [ dpe= D a t a P a t h A r i t h m e t i c ,name="Battery Calibration " ,d e v i c e="computation " ,i n i t i a l i z e r ="" ,a r i t h m e t i c ="output0 = input0 / 32.0" ,i n p u t V e c t o r W i d t h =1 ,o u t p u t V e c t o r W i d t h =1 ,

a c t i o n ="create "] ;

91

Page 100: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

B a t t e r y C a l i b r a t e : : i n [ name="in" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

B a t t e r y C a l i b r a t e : : o u t [ name="out" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

## Connect t h e C a l i b r a t i o n t r a n s f o r m s t o ADC o u t p u t s .#

adc : : O2out −> O 2 C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : CO2out −> C O 2 C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : COout −> C O C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : VOCout −> VOCCal ibra te : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : P r e s s O u t −> P r e s s C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : HumidOut −> H u m i d C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : TempOut −> T e m p C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : H2out −> H 2 C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

adc : : B a t t e r y O u t −> B a t t e r y C a l i b r a t e : : i n[ name="connection" , t y p e ="physical" , l a b e l ="conn" , a c t i o n ="create " ] ;

## Crea te a D a t a P a t h F i l e t o s t o r e a l l o f t h i s da ta .#

o u t p u t F i l e [ dpe= D a t a P a t h F i l e ,name="output file" ,d e v i c e ="datapathfile " ,

# d i r e c t o r y =”/ tmp / AQUATSstore ” ,d i r e c t o r y ="$AQUATSFILE " ,a c c e s s ="w" ,a c t i o n ="create " ] ;

92

Page 101: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

## Obta in an a l i a s f o r t h e o u t p u t f i l e ’ s w i l d c a r d s i n k .#

o u t p u t F i l e : : w i l d S i n k [ name="*" ,d i r e c t i o n ="sink" ,w i l d c a r d = 1 ] ;

## A t t e m p t a c o n n e c t i o n be tween s i g n a l s p r o c e s s from t h e i n p u t f i l e and t h e# o u t p u t .#

adc : : O2out −> o u t p u t F i l e : : w i l d S i n k[ name="raw O2 volts" , t y p e ="physical" , a c t i o n ="create " ] ;

O 2 C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="O2" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : CO2out −> o u t p u t F i l e : : w i l d S i n k[ name="raw CO2 volts " , t y p e ="physical" , a c t i o n ="create " ] ;

C O 2 C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="CO2" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : COout −> o u t p u t F i l e : : w i l d S i n k[ name="raw CO volts" , t y p e ="physical" , a c t i o n ="create " ] ;

C O C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="CO" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : VOCout −> o u t p u t F i l e : : w i l d S i n k[ name="raw VOC volts " , t y p e ="physical" , a c t i o n ="create " ] ;

VOCCal ibra te : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="VOC" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : P r e s s O u t −> o u t p u t F i l e : : w i l d S i n k[ name="raw Pressure volts" , t y p e ="physical" , a c t i o n ="create " ] ;

P r e s s C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="Pressure" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : HumidOut −> o u t p u t F i l e : : w i l d S i n k[ name="raw Humidity volts" , t y p e ="physical" , a c t i o n ="create " ] ;

H u m i d C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="Humidity" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : TempOut −> o u t p u t F i l e : : w i l d S i n k

93

Page 102: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

[ name="raw Temperature volts " , t y p e ="physical" , a c t i o n ="create " ] ;

T e m p C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="Temperature " , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : B a t t e r y O u t −> o u t p u t F i l e : : w i l d S i n k[ name="raw Battery volts" , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : CPUTempOut −> o u t p u t F i l e : : w i l d S i n k[ name="raw CPU temp volts" , t y p e ="physical" , a c t i o n ="create " ] ;

CPUTempCalibrate : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="CPU Temperature " , t y p e ="physical" , a c t i o n ="create " ] ;

adc : : O 2 s t a t u s −> o u t p u t F i l e : : w i l d S i n k[ name="raw O2 status volts " , t y p e ="physical" , a c t i o n ="create " ] ;

B a t t e r y C a l i b r a t e : : o u t −> o u t p u t F i l e : : w i l d S i n k[ name="battery remaining" , t y p e ="physical" , a c t i o n ="create " ] ;

## Crea te t h e d i s p l a y .#

u i [ dpe=WaveUI ,name="user interface" ,c o n t r o l ="$AQCONTROLFILE " ,w id th="800" ,h e i g h t ="600" ,t r a c e .0= "CO" ,t r a c e .1= "CO2" ,t r a c e .2= "VOC" ,t r a c e .3= "O2" ,t r a c e .4= "H2" ,t r a c e .5= "temp" ,t r a c e .6= "humid " ,t r a c e .7= "press " ,a c t i o n ="create " ] ;

u i : : COin [ name="CO 0" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

u i : : CO2in [ name="CO2 1" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

u i : : VOCin [ name="VOC 2" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

94

Page 103: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

u i : : O2in [ name="O2 3" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

u i : : H2in [ name="H2 4" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

u i : : Tempin [ name="temp 5" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

u i : : Humidin [ name="humid 6" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

u i : : P r e s s i n [ name="press 7" ,r a t e =200 .0 ,a c t i o n ="assign " ] ;

C O C a l i b r a t e : : o u t −> u i : : COin[ name="CO" , t y p e ="physical" , a c t i o n ="create " ] ;

C O 2 C a l i b r a t e : : o u t −> u i : : CO2in[ name="CO2" , t y p e ="physical" , a c t i o n ="create " ] ;

VOCCal ibra te : : o u t −> u i : : VOCin[ name="VOC" , t y p e ="physical" , a c t i o n ="create " ] ;

O 2 C a l i b r a t e : : o u t −> u i : : O2in[ name="O2" , t y p e ="physical" , a c t i o n ="create " ] ;

H 2 C a l i b r a t e : : o u t −> u i : : H2in[ name="H2" , t y p e ="physical" , a c t i o n ="create " ] ;

T e m p C a l i b r a t e : : o u t −> u i : : Tempin[ name="temp" , t y p e ="physical" , a c t i o n ="create " ] ;

P r e s s C a l i b r a t e : : o u t −> u i : : Humidin[ name="press " , t y p e ="physical" , a c t i o n ="create " ] ;

H u m i d C a l i b r a t e : : o u t −> u i : : P r e s s i n[ name="humid " , t y p e ="physical" , a c t i o n ="create " ] ;

95

Page 104: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

References

1. (2004). Contract W7711-036681/001/TOR, Software Maintenance andSupport.

2. (2004). OpenDX: Open Visualization Data Explorer (Online). OpenDXOrganization. http://www.opendx.org (March 10, 2004).

3. (2004). NCSA HDF Home Page (Online). National Center for SupercomputingApplications. http://hdf.ncsa.uiuc.edu (March 10, 2004).

4. (2000). dicom2 (Online). Sebastian Barre.www.barre.nom.fr/medical/dicom2 (March 10, 2004).

5. (1997). MIR DICOM Central Test Node (Online). Electronic RadiologyLaboratory, Mallinckrodt Institute of Radiology.http://wuerlim.wustl.edu/DICOM/ctn.html (March 10, 2004).

6. Tom Gee, William Fraser (2003). Software architecture for modeling andimplementing dynamic, heterogenous acquisition and control networks.Technical Report. DRDC Toronto.

7. (2001). Contract W7711-017733/001/TOR, Design of System Architecture forMulti-Station Battlefield Biomedical Signal Acquisition System.

8. Tom Gee, Edward Kozak, Frank Ing, William Fraser (2003). A databaseschema for storing varied data types and configurations associated withphysiological and environmental monitoring and control. Technical Report.DRDC Toronto.

9. (2004). The PDP++ Software Home Page (Online). Center for Neural Basis ofCognition, Carnegie Mellon University.http://www.cnbc.cmu.edu/Resources/PDP++/PDP++.html (July 4, 2004).

10. (2003). PDP++ Software Users Manual (Online). Chandley K. Dawson,Randall C. O’Reilly, James L. McClelland.file:///usr/local/pdp++/manual/html/pdp-user-1.html (July 20,2004).

11. Tom Gee, William Fraser (2003). Prototype implementation of a medicalmonitoring and control system based on GUARDIAN architecture. TechnicalReport. DRDC Toronto.

12. (2003). graphviz - open source graph drawing software (Online). AT&T.http://www.research.att.com/sw/tools/graphviz (July 28, 2004).

96

Page 105: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

13. (2004). PostgreSQL: The most advanced Open Source database system in theworld (Online). PostgreSQL Global Development Group.http://www.postgresql.org (July 20, 2004).

14. (2003). Konqueror - Web Browser, File Manager - and more! (Online). KDE e.V.. http://konqueror.kde.org (July 20, 2004).

15. (2004). the KDE Desktop Environment (Online). KDE e. V..http://www.kde.org (July 20, 2004).

16. (2001). The Omnivore: KDE’s flexible I/O architecture (Online). c’t magazine.http://www.heise.de/ct/english/01/05/242/ (March 10, 2004).

17. (2004). Qt Overview (Online). Trolltech Inc..http://www.trolltech.com/products/qt/index.html (July 20, 2004).

18. Free Software Foundation Inc. (1991). GNU General Public License. Version2.

19. (2001). GnomeVFS - Filesystem Abstraction Library (Online). Seth Nickel.http://developer.gnome.org/API/gnome-vfs (March 10, 2004).

20. (2004). AVFS - A Virtual File System (Online). Miklos Szeredi.http://sourceforge.net/projects/avf (July 20, 2004).

21. Free Software Foundation Inc. (1991). GNU Library General Public License.Version 2.

22. (2003). Contract W7711-037867/A, Enhancement of integrated computerarchitecture sub-system components for monitoring armoured vehicles andsubmarine air quality.

23. R. Greg Lavender, Douglas C. Schmidt (1995). Active Object - an ObjectBehavioral Pattern for Concurrent Programming. In Proceedings of the SecondPattern Languages of Programs Conference.

24. (2000). ParaGUI Cross-Platform Widget Set (Online). ParaGUI Project,Alexander Pipelka. http://www.paragui.org (May 7, 2004).

25. (2003). Simple MediaDirect Layer (SDL) (Online). Sam Latinga.http://www.libsdl.org (October 1, 2003).

26. (2003). Open Graphics Library OpenGL (Online). OpenGL.http://www.opengl.org (October 1, 2003).

27. Schmidt, Douglas C. (1993). The ADAPTIVE Communication Environment:An Object-Oriented Network Programming Toolkit for DevelopingCommunication Software. In 12th Sun User Group Conference.

97

Page 106: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

IndexACE, 13aedGUI, 13

C++, 2, 14configuration editor, iii, v, 6, 14, 21

database, iii, v, 1, 8, 21datatrac, 1, 8, 14DICOM, 1, 2, 4dicom2, 4dot, 6

EEG, 1, 10EMG, 10

filesystem, iii, 8, 14, 21flows

sink, 6source, 6

FUSE, 9

GLGraph, 12gnomeVFS, 9GPL, 8, 9GraphTrace, 12graphviz, 6GUARDIAN, iii, v, 1, 6, 8, 10, 13, 21

HDF5, 1, 2, 14

IMEOS, 1

KDE, 8KIO, 8konqueror, 8

LGPL, 9Linux, 1, 13

Microsoft Windows, 9modeling, iii, v, 21MRI, 4

nautilus, 9

OpenDX, 1, 2, 4, 14OpenGL, 12, 13

paraGUI, 12, 13PDP++, 1, 2, 14PostgreSQL, 6processing network, 6

Qt, 8

SDL, 12, 13

TraceGraphElement, 13

user interface, 1, 10

WaveUI, 12

98

Page 107: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

DOCUMENT CONTROL DATA(Security classification of title, body of abstract and indexing annotation must be entered when document is classified)

1. ORIGINATOR (the name and address of the organization preparing the document.Organizations for whom the document was prepared, e.g. Centre sponsoring acontractor’s report, or tasking agency, are entered in section 8.)

Covenant Systems Development27 Bray St, Beeton, Ontario, L0G 1A0

2. SECURITY CLASSIFICATION(overall security classification of the documentincluding special warning terms if applicable).

UNCLASSIFIED

3. TITLE (the complete document title as indicated on the title page. Its classification should be indicated by the appropriateabbreviation (S,C,R or U) in parentheses after the title).

Software Maintenance and Support Contract — Final Report

4. AUTHORS(Last name, first name, middle initial. If military, show rank, e.g. Doe, Maj. John E.)

Gee, Tom

5. DATE OF PUBLICATION (month and year of publication of document)

September 2004

6a. NO. OF PAGES (totalcontaining information. IncludeAnnexes, Appendices, etc).

107

6b. NO. OF REFS (total cited indocument)

27

7. DESCRIPTIVE NOTES (the category of the document, e.g. technical report, technical note or memorandum. If appropriate, enter the type of report,e.g. interim, progress, summary, annual or final. Give the inclusive dates when a specific reporting period is covered).

Contractor Report

8. SPONSORING ACTIVITY (the name of the department project office or laboratory sponsoring the research and development. Include address).

Defence Research & Development - TorontoPO Box 2000, 1133 Sheppard Ave. West, Toronto, Ontario, CANADA M3M 3B9

9a. PROJECT OR GRANT NO. (if appropriate, the applicable research anddevelopment project or grant number under which the document waswritten. Specify whether project or grant).

9b. CONTRACT NO. (if appropriate, the applicable number under whichthe document was written).

W7711-036681/001/TOR

10a. ORIGINATOR’S DOCUMENT NUMBER (the official document numberby which the document is identified by the originating activity. Thisnumber must be unique.)

10b. OTHER DOCUMENT NOs. (Any other numbers which may beassigned this document either by the originator or by the sponsor.)

11. DOCUMENT AVAILABILITY (any limitations on further dissemination of the document, other than those imposed by security classification)

( X ) Unlimited distribution( ) Defence departments and defence contractors; further distribution only as approved( ) Defence departments and Canadian defence contractors; further distribution only as approved( ) Government departments and agencies; further distribution only as approved( ) Defence departments; further distribution only as approved( ) Other (please specify):

12. DOCUMENT ANNOUNCEMENT (any limitation to the bibliographic announcement of this document. This will normally correspond to the DocumentAvailability (11). However, where further distribution beyond the audience specified in (11) is possible, a wider announcement audience may beselected).

Page 108: Software Maintenance and Support Contract Š Final Report · Software Maintenance and Support Contract Š Final Report Tom Gee Covenant Systems Development Covenant Systems Development

13. ABSTRACT (a brief and factual summary of the document. It may also appear elsewhere in the body of the document itself. It is highly desirable that theabstract of classified documents be unclassified. Each paragraph of the abstract shall begin with an indication of the security classification of theinformation in the paragraph (unless the document itself is unclassified) represented as (S), (C), (R), or (U). It is not necessary to include here abstracts inboth official languages unless the text is bilingual).

To provide an effective platform for acquiring and processing a large number of high-speed channels, wewere engaged to explore several third party software packages. We were also tasked with augmenting theexisting software architecture, the GUARDIAN system.

We examined packages for real-time modeling, display, storage and importing outside data. We evaluatedthe tasks required to configure and apply GUARDIAN to this type of problem, as well as those required tonavigate the stored data after acquiring. For those tasks which were onerous, we explored ways of simplifyingthem. We examined various options for creating a graphical configuration editor, a filesystem-type interfaceto the storage database, and a real-time waveform-oriented user interface, with the latter proceeding throughthe design and initial implementation phases.

The existing system, combined with the third party packages, is a suitable platform for this research, ifsomewhat awkward in its employ. By completing the modest projects started under this program, the easeand efficiency of the system will be increased markedly.

14. KEYWORDS, DESCRIPTORS or IDENTIFIERS (technically meaningful terms or short phrases that characterize a document and could be helpful incataloguing the document. They should be selected so that no security classification is required. Identifiers, such as equipment model designation, tradename, military project code name, geographic location may also be included. If possible keywords should be selected from a published thesaurus. e.g.Thesaurus of Engineering and Scientific Terms (TEST) and that thesaurus-identified. If it not possible to select indexing terms which are Unclassified, theclassification of each should be indicated as with the title).