CROSS REFERENCE TO RELATED APPLICATIONSThis is a continuation-in-part of International Application PCT/SE95/00556, with an International filing date of May 17, 1995.
REFERENCE TO MICROFICHE APPENDIXA computer program listing is included in a Microfiche Appendix hereto.
BACKGROUND OF THE INVENTIONThe present invention relates to a measurement system which includes a central processor unit connected to at least one satellite sensor unit for obtaining measurement values. Furthermore, the invention concerns a method for processing measurement values.
Most prior-art measurement systems include one or more sensors, which measure parameters of interest, and a processing unit, which processes the measured values of the parameters before display. For instance, U.S. Pat. No. 5,126,937, incorporated herein by reference, relates to a biological information measurement system including multiple measuring sections connected to a processing unit, which adjusts values obtained by some of the measuring sections to take into account temperatures measured by others of the measuring sections, and which sends the adjusted values to a display unit and a recorder. Another example, U.S. Pat. No. 4,803,625, also incorporated herein by reference, describes a processor-based monitor that gathers patient information which is transmitted to a central computer for display and storage.
In many instances, a parameter of interest that cannot be measured directly must be calculated on the basis of other measured values and according to a mathematical model. For example, pulmonary compliance, monitored to study a patient's response to a new drug, is by its nature a derived value that must be calculated on the basis of respiratory airflow and pulmonary pressure.
The mathematical models involved are sometimes complex, leading to time-consuming calculations which have to be performed in several steps using measurement values from different sensors. Presenting the results in real time typically requires parallel execution of some steps. A synchronous system must take into account that some of the parallel-executing steps may not have the same execution times as others. By starting a later dependent calculation step prior to completion of the calculations of previous steps, an incorrectly-designed system may lose the time information inherent in the measurement values and therefore work out of step, yielding incorrect results.
In addition, a measurement system tailored for a particular application to take into account the specific execution times required for the different calculations involved is typically time-consuming, expensive to use, and suitable for one application only.
Another typical problem of measurement systems, especially those used for research and development, relates to the documentation of the experiments performed. According to good laboratory practice, all pharmacological experiments must be documented in such a way as to provide for repetition. However, while the primary measurement data and the results of any related calculations are typically stored automatically on a diskette or the like, the experimental procedure, including, e.g., which sensors were used with which calibration factors, is typically recorded manually by the researcher, which may result in errors.
SUMMARY OF THE INVENTIONThe invention provides a measurement system in which measurement values obtained are associated with time indications so that the values can be processed asynchronously and then re-synchronized later to produce accurate derived measurement values. In particular, the invention provides a measurement system including a first unit that obtains a first measurement value associated with a first time indication and a second measurement value associated with a second time indication, and a second unit that comprises a processor and receives values asynchronously from the first unit, wherein the processor synchronizes the first and second measurement values using the first and second time indications.
The meaning of "associating," as used herein, means linking by, e.g., juxtaposing in memory or including together in a packet of data. The "second," "third," and "fourth" memories described herein can be not only separate memory arrays but also, e.g., merely different positions in a single database or memory array. Furthermore, "time indication," as used herein, means a timestamp value representing a particular moment in time, such that multiple separate time indications can have the same timestamp value, i.e., point to the same moment in time. In addition, a "first unit" as described herein can be not only a single first unit obtaining both first and second measurement values, but also, e.g., a set of two first units wherein one first unit obtains the first measurement value and the other first unit obtains the second measurement value.
BRIEF DESCRIPTION OF THE DRAWINGSEmbodiments of the invention will now be described with reference to the accompanying drawings, in which
FIG. 1 is an overview schematic block diagram of the hardware of measurement system according to the present invention;
FIG. 2 is a more detailed schematic block diagram of the hardware of a measurement system according to the present invention;
FIG. 3 is a flowchart illustrating the steps of a measurement method according to the present invention;
FIG. 4 is a schematic block diagram illustrating a measuring method according to the present invention as applied to the measurement of power; and
FIG. 5 is a schematic block diagram illustrating a measuring method according to the present invention as applied to the measurement of pulmonary compliance.
DETAILED DESCRIPTIONA measurement system according to the invention provides specialized software running on commercially-available hardware equipment making use of standard measurement gauges and instruments. Although the system uses multiple levels of processors all running different programs, specific time indications showing when measurements are made at the most basic level are preserved and used at all levels to maintain accuracy. The hardware discussion below is followed by a description of the software.
System HardwareAs shown in FIG. 1, a measurement system according to the invention provides a measurement computer 1 (dashed outline), aworkstation 2, and adatabase 3, all of which are connected to adata network 4. Themeasurement computer 1 itself includes various units including one ormore sensor units 5, each of which is connected to aprocessor unit 6 viarespective channel units 7. In this embodiment, the "first unit" includes thesensor units 5a, 5b and thechannel units 7, whereas the "second unit" includes theprocessor unit 6.
The system hardware can be implemented using standard off-the-shelf system-level components. With reference to FIG. 2, the following describes an example of such an implementation in which thedatabase 3 is housed within theworkstation 2. Thesensor units 5a, 5b, coupled to atest subject 8, e.g., a laboratory animal, for measuring different parameters, can use different kinds ofgauges 9, e.g., a pressure gauge, a temperature gauge, or a flow gauge.
One type ofsensor unit 5a includes not only an analog-to-digital converter 10 connected to thegauge 9 for digitizing the analog values measured by thegauge 9, but also aprocessor 11, e.g., a Motorola M68HC711E9, and a non-volatile memory (NVRAM) 14a which can be included in theprocessor 11 as shown in FIG. 2. Theprocessor 11 operates on the measurement values by, for example, scaling to System International units, and also communicates with theassociated channel unit 7 via a connection using a protocol such as RS-422.
Another kind ofsensor unit 5b includes instead aprocessor 12 such as a Motorola M68302FE16 which connects to a pH meter or other commercially-available instrument 13 via an RS-232 connection or the like. Theprocessor 12 also stores an identity code in anon-volatile memory 14b such as XICOR 24C16E2PROM, and also communicates with its associatedchannel unit 7 via an RS-422 or similar type of connection.
Eachchannel unit 7 includes aprocessor 15, e.g., a Motorola MC68HC000P16, and a digital signal processor (DSP) 16, such as an AT&T WEDSP32C, which run programs to perform calculations using only measurement data from the associatedsensor unit 5a, 5b. Such calculations include filtering and averaging and more complex functions. Thus, thechannel units 7 reduce the amount of primary data that theprocessor unit 6 must store and process. However, if there is no need for such a reduction, the above-mentioned calculations by thechannel units 7 can be performed by theprocessor unit 6 instead.
Eachchannel unit 7, which includes anon-volatile memory 17 such as the aforementioned X24C16E2PROM for storing a serial number and communicates via an RS-422 or similar connection with the associatedsensor unit 5a, 5b, is connected by a Complex Programmable Logic Device (CPLD) 18 to theprocessor unit 6 using acommon bus 19 such as VME.
Theprocessor unit 6, a Motorola XC68040HRC25E processor-based Force Sys68K CPU-40B/4 main board or the like, is connected to anetwork 4, e.g., Ethernet, link for communication with theworkstation 2 and performs calculations requiring measurement data fromdifferent sensor units 5a, 5b orchannel units 7 or both.
For time synchronization and generation of time indicators, eachchannel unit 7 includes a clock or registercounter 20, implemented using anotherCPLD 21, to obtain a time indication for each sampled measurement value. More particularly, theprocessor unit 6 provides on the common bus 19 a clock signal used to increment and thus synchronize all thecounters 20. TheCPLD 21, dividing the clock signal into various sampling frequencies, e.g., 16 Mhz into 1000, 500, 200, 100, 50, 20, 10, 5, 2, and 1 Hz, uses one of the frequencies, e.g., 1000 Hz, to increment thecounter 20 from which the time indications are obtained. When an experiment is started, theprocessor unit 6 writes to a specific address on thecommon bus 19, which resets all of thecounters 20, one for each sensor unit, to ensure that all begin at the same count. Thus, although the time indication associated with each measurement value is initially relative, the absolute time of measurement can be established by reference to the time of reset.
Thesensor units 5a, 5b thechannel units 7, and theprocessor unit 6 are all processor-and-memory-based units, each of which can be adapted to perform different operations in accordance with a downloaded program. To this end, each unit in themeasurement computer 1 is given a unique identity code, which is stored in anon-volatile memory 14a, 14b, 17. When the system is turned on, the processor of each unit reads its identity code from anon-volatile memory 14a, 14b, 17. Each unit then requests a program by transmitting the identity code to theprocessor unit 6, which in turn requests the program from thedatabase 3 where all programs applicable in themeasurement computer 1 are stored. After receiving the programs from thedatabase 3, theprocessor unit 6 downloads them into thechannel units 7 and thesensor units 5a, 5b.
In addition to storing all of the programs, thedatabase 3 also stores for each unit in the measurement computer 1 a description including, for instance, the unit's identity code, the kind of gauge 9 asensor unit 5a, 5b uses, the measurement range of thegauge 9, and the scaling factors involved. Furthermore, thedatabase 3 contains a description of all of the measurements that can be carried out by the measurement system. Such a description defines which programs are to be used in the different units of themeasurement computer 1, which data streams are directed into and directed from the programs, and which data streams are to be displayed at theworkstation 2.
When a particular measurement is to be carried out, the hardware is set up for use as follows. First an operator at theworkstation 2 selects the name of a measurement to be made. The appropriate application program is then downloaded into themeasurement computer 1 from thedatabase 3. The operator also specifies the parameters for the experiment for which the measurement is to be performed, e.g., doses of a drug to be given to thetest subject 8. Furthermore, the operator can calibrate thegauges 9 of thesensor units 5a, 5b from theworkstation 2, the calibration factors being automatically stored in thedatabase 3. In addition, all of the information entered from theworkstation 2 is stored in thedatabase 3.
This configuration method has many advantages. First, the operator is able to carry out the experiment easily in the particular way intended. Second, the experiment is adequately documented for later repetition, since all of the information entered is stored in thedatabase 3. Third, the measurement system can be operated only from theworkstation 2, which ensures that all steps taken are automatically documented and provided with a time notation. Finally, if awrong sensor unit 5a, 5b is connected to acertain channel unit 7, so that the hardware configuration of themeasurement computer 1 does not correspond to the description in thedatabase 3, the system will discover the erroneous coupling using the identity code.
The operator can also configure the system for new measurements by entering a description of the new configuration at theworkstation 2. Stored in thedatabase 3, the description of the new configuration can be selected for use at a later stage.
System SoftwareOperating with hardware such as that noted above, the software can be described as separate action processes, i.e., programs, connected by data streams, wherein each stream is buffered by the process receiving it. By combining different processes, different measurement applications can be implemented. In the following very simple application example, a first channel unit (kanal 0) produces one output data stream, "chn 0," and a second channel unit (kanal 1) produces two output data streams, "min 1" and "max 1." These streams are directed to a process in the processor ("main") unit, which in turn produces an output data stream of sums.
______________________________________ define kanal 0 (chn.sub.-- 0); end kanal 0; define kanal 1 (chn.sub.-- 1); minmax (chn.sub.-- 1); => (min.sub.-- 1, max.sub.-- 1);end kanal 1; define main; add (min.sub.-- 1, chn.sub.-- 0) => (summa); end main; ______________________________________
Referring now to FIGS. 2 and 3, the system software flows as follows. Thegauge 9 of asensor unit 5a, 5b samples a parameter to produce "analog measurement values" (step 100), which are then converted to "digital measurement values" for feeding into theprocessor 11, 12 of thesensor unit 5a, 5b (step 102). Theprocessor 11, 12 of thesensor unit 5a, 5b scales the digital measurement values to System International units and forwards the resulting "sampled measurement values" to the associated channel unit 7 (step 104), where the "sampled measurement values" are buffered (step 105). In thechannel unit 7, each sampled measurement value is associated with not only a time indication obtained from thecounter 20 and representing the time at which the measurement value was sampled, but also a data stream identity, defining the parameter sampled by the gauge 9 (step 106).
Eachchannel unit 7 then performs calculation programs, e.g., filtering, which require only sampled measurement values from the associatedsensor unit 5a, 5b (step 108). The output from each of the calculation programs constitutes a stream of "refined measurement values." Theprocessor 15 of thechannel unit 7 adds a time indication to each of the refined measurement values in the output stream (step 110). The purpose of this time indication is to indicate a time origin of the refined measurement value. Thus, multiple refined measurement values originating from either (1) multiple sampled measurement values created at the same time bydifferent sensor units 5a, 5b, or (2) just one sampled measurement value, e.g., filtered and average values derived from the same sampled value, can be synchronized later. This ability is especially important when refined measurement values, having been subjected to different processes of varying durations, have lost their initial inherent synchronization. The time indication which is associated with a certain refined measurement value is usually the time indication associated with the corresponding sampled measurement value input to the calculation program. However, the time indication can instead represent a time between two actual sampling times, e.g., when the calculation is an interpolation or is selected from among the time indications of multiple sampled measurement values. In any case, the time indication of a refined measurement value is derived from the time indication(s) of one or more of the corresponding sampled measurement values. The means for determining the time indication of the refined measurement value can be a part of the calculation programs.
Theprocessor 15 of thechannel unit 7 also adds to each of these refined measurement values a "data stream identity" defining the parameter obtained by the calculations (step 112). The stream of refined measurement values resulting from the processing in thechannel unit 7 is transmitted to the processor unit 6 (step 114). In addition, the stream of sampled measurement values received by thechannel unit 7 or any stream of measurement values resulting from an intermediary calculation step, or both, can be transmitted to theprocessor unit 6, if needed for the calculation steps performed therein, or if to be used as an output from the measurement computer 1 (step 116).
Usually,different channel units 7 require different amounts of time for processing. Accordingly, the refined measurement values received at the same time by theprocessor unit 6 from thedifferent channel units 7 are often unsynchronized, i.e., have different time indications. The same is true for measurement values which are received at one time from asingle channel unit 7 orsensor unit 5a, 5b, and are derived from the same original measurement values, but which may be the result of asynchronous processing of these values.
To enable calculations that use synchronized measurement values, theprocessor unit 6 buffers the data streams until all measurement values with corresponding time indications, and required for a specific calculation, have been received (step 118). Theprocessor unit 6 then uses the time indications to synchronize corresponding measurement values from different data streams (step 120).
The processed data streams resulting from the calculations in theprocessor unit 6 are transmitted with other selected data streams to the workstation for display in real time and to thedatabase 3 for storage (step 122). Thus the time indications permit measurement values obtained bydifferent sensor units 5a, 5b at the same time to be displayed at the same time. The stored data include measurement values, either processed or as sampled, together with their associated time indications and their data stream identities.
EXAMPLESFIG. 4 shows an example of how the invention can be applied to measure power and produce a data stream of power values. In this case, the measurement system has afirst sensor unit 30 and asecond sensor unit 32, each of which includes a sample-and-hold circuit, i.e., analog-to-digital converter 34, 36 and an FIR-filter 37, 38. Here, while there is aprocessor unit 40 for calculating the momentary value, the channel unit functions of (1) associating a time indication and a data stream identity with a sampled measurement value and (2) filtering the sampled measurement value are merged into thesensor units 30, 32. Each of these twosensor units 30, 32 forms a so-called "first unit."
The first analog-to-digital converter 34 samples a voltage. The voltage value sampled at time t is designated Ut. The analog-to-digital converter associates the time indication t, obtained from a clock register or counter 42, and a data stream identity "sampled voltage" with the voltage sample Ut. Similarly, the second analog-to-digital converter 36 samples, at time t, a current I. A time indication t from thecounter 42 and a data stream identity "sampled current" are also associated with the current sample It.
Thefirst FIR filter 37 has a length of 2 m. Thus, the output of theFIR filter 37 depends of the values of 2 m voltage samples. The filtered voltage value output at time t from thefirst FIR filter 37 is designated U't-m--a time indication t-m is associated therewith to indicate that U't-m substantially represents the voltage at time t-m. Furthermore, a data stream identity "filtered voltage" is associated with the filtered voltage value.
Correspondingly, the second FIR filter 38 has a length of 2 n and its output depends on the values of 2 n current samples. The filtered current value output at time t by the second FIR filter 38 is designated I't-n. A time indication t-n and a data stream identity "filtered current" are associated with the filtered current output. If m is shorter than n, the delay created by thefirst FIR filter 37 is shorter than that created by the second FIR filter 38. Thus, the filtered voltage value U't-m is available earlier than the corresponding filtered current value I't-m. So the filtered voltage values are queued in abuffer 44 in theprocessor unit 40. Thisprocessor unit 40 forms the so-called "second unit" in this embodiment.
At time t, detecting the availability of both a filtered voltage value U't-n and a filtered current value I't-n having the same time indication t-n, acalculation program 48 in theprocessor unit 40 produces the power value Pt-n. In addition, thecalculation program 48 associates the time indication t-n and a data stream identity "power" with the calculated power value which then represents the power measured at time t-n. Additional power values are derived in turn in the same manner, which produces a "power" data stream of values.
In another example, shown in FIG. 5, the system is configured to measure pulmonary compliance according to the brief, self-explanatory program listing below.
______________________________________ application "Pulmonary.sub.-- mechanics"; define kanal 0 (pressure.sub.-- raw); 1p.sub.-- filter (pressure.sub.-- raw) => (pressure); end kanal 0; define kanal 1 (airflow.sub.-- raw); 1p.sub.-- filter (airflow.sub.-- raw) => (airflow); volume (airflow) => (volume); breath (volume) => (breath.sub.-- trigger);end kanal 1; define main; lung (pressure, airflow, volume, breath.sub.-- trigger) => (compliance); end main; ______________________________________
Afirst sensor unit 50 and asecond sensor unit 52 sample a pulmonary pressure and a respiratory airflow, respectively, of alaboratory animal 54, whereby a data stream of pressure values and a data stream of airflow values are generated. These streams and others derived in the development of the compliance measurement are all buffered by the programs receiving them in the following steps.
The pressure and airflow data streams are filtered in afirst channel unit 56 and asecond channel unit 58, respectively, bydigital signal processors 60, 62 which include filtering software modules. The stream of filtered pressure values is forwarded directly to the program "lung" running in aprocessor unit 64. Also forwarded to the program "lung," the stream of filtered airflow values is directed as well to thechannel unit 58 program "volume," which integrates the airflow values to obtain a stream of volume values. Together, thesensor units 50, 52 andchannel units 56, 58 form the so-called "first unit."
Likewise, the stream of volume values is directed not only to the "lung" program but also to anotherchannel unit 58 program "breath," which detects the beginning of an inhalation by theanimal 54 and creates a stream of "breath-- trigger" values which is directed to the "lung" program. Thus, asynchronously processed values of the various streams determined at the same time arrive at the "lung" program at different times. However, as described above, the values are synchronized using their associated time indications, allowing the "lung" program to calculate compliance accurately for display or storage.
The microfiche appendix which is incorporated herein by reference, is a listing which includes software routines written in the Modula-2 software language, a compiler for which is available from various sources, including Introl Corporation, ACE Associated Computer Experts bv, and A+L AG. These software routines, self-explanatory to a programmer of ordinary skill in the art, describe a detailed example of how software according to the invention can be created. For example, the procedure "Get-- samples" relates to synchronizing measurement values by reference to time indications, or time "stamps."
The following description, using terminology known to a practitioner of ordinary skill in the art, explains the listing of Appendix A in detail.
The three purposes of the "Applicat" module are (1) to provide primitives for handling streams of data samples between action processes, (2) to manage an application, that is, maintain data structures of action processes with qualifiers and stream connections between the action processes, and (3) to provide a programming interface for application modules containing action process routines.
"DEFINITIONS," i.e., declarations, are included first. The "Sample-- type" record is the basic unit of a stream. The "Stream" fields identify the stream number from which a sample comes or to which it should be sent. The "stamp" field is a timestamp which indicates when the sample was created, by noting how many milliseconds have passed since the application was started. The "sample" field is the actual value of the sample. An action process or satellite sensor unit may be unable to generate a sample at a specific time, in which case the "missing" flag is set to so indicate. If the "missing" flag is set to true, the value in "sample" is undefined and should not be used.
All action processes retrieve information about connected streams and so on through the "Param-- type" data structure which is retrieved by a "Sched.Get-- parameter" procedure. The "stream-- input" vector lists the numbers of the streams connected as inputs to the action process. The "stream-- output" parameter similarly lists output stream numbers. The "buffer-- input" vector contains references to the buffers of all of the input streams connected to this action process.
The following procedures are used in an application module. The procedure "Init-- FIFO-- record" initiates a "vector" structure with information about connected streams from a "param" structure. The "param" structure must be previously initiated with a "Sched.Parameter" procedure. The "FIFO-- record" structure contains buffers and data structures needed by the "Put-- sample" and "Get-- samples" routines, described below.
The procedure "Get-- samples" retrieves samples directed to the process as specified in the "vector" structure. When the procedure returns, the "samples" structure contains a new sample from each stream the process is reading. The incoming samples are synchronized so that the procedure does not return until samples from all streams are received. If necessary, the procedure "Get-- Samples" returns samples for each timestamp value in the connected streams by duplicating the most recent sample in streams lacking a sample with the exact timestamp.
For example, three action processes A, B, and C may be connected so that A and B each generate a stream read by C. Process A generates the following two samples by calling the procedure "Put-- Sample:" (value 1.0, stamp 10) and (value 2.0, stamp 30). Similarly, process B generates three samples: (value 3.0, stamp 20), (value missing, stamp 30), and (value 5.0, stamp 40). This is summarized in the following table:
______________________________________ Stamp (ms) Stream A Stream B ______________________________________ 10 1.0 20 3.0 30 2.0 missing 40 5.0 ______________________________________
Process C can now call the "Get-- samples" procedure three times, receiving the following values:
______________________________________ Call Stamp Stream A Stream B ______________________________________ 1 10 1.0 missing 2 20 1.0 3.0 3 30 2.0 missing ______________________________________
The first call to the procedure "Get-- Samples" returns values for the lowest timestamp, i.e., 10 ms. Since there is no sample in stream B with lower timestamp than 20 ms, a value of "missing" is returned for stream B.
The second call retrieves values fortimestamp 20 ms. Since the next available sample from stream A hastimestamp 30 ms, the routine returns the previous value of 1.0 for stream A.
The samples fortimestamp 40 ms cannot be returned until a new sample is received from stream A, because it is not yet known if the timestamp for the next sample from stream A is higher than 40 ms.
The "Put-- sample" procedure puts one sample into the output stream. The "sample" record contains information such as the stream number and the sample value. The routine name for "caller" is specified to simplify debugging. The value of "sample.stamp" must be higher than the previous sample for the same stream.
The "Register-- action" procedure is called in the main block of an application module to register each application, i.e., action process, defined in the module. "Name" represents the action process name that should be used to refer to the action process in an application description file. "Routine-- proc" is the application process defined. The "stack-- size" parameter determines how much memory to allocate for the process's stack.
The "Create-- FIFO" procedure creates a new FIFO buffer for stream number "index" and is used when starting applications.
Used internally to initiate the data structures that keep track of the application processes and streams, the "Clear-- application" procedure does not deallocate memory or stop processes.
The "Append-- action" procedure, which inserts data from "reply" about a requested action process that will later be started by the "Start-- application" procedure, is called from the load process when receiving an application description from the workstation.
The "Append-- kanal-- param" procedure inserts data from "reply" about a stream from a channel unit that will be set up when the application is started.
Storing the visibility flag for a stream, the "Append-- visible" procedure causes the stream to be sent to the workstation when the application is started.
The "Start-- process" procedure starts an action process and connects it to its streams.
Starting all action processes for an application, the "Start-- application" procedure installs an "append-- proc" procedure that will be called for every sample from a visible stream. Likewise, "Stop-- application" stops all action processes.
The following program, an implementation of a simple action process that sums two input streams, and its subsequent explanation provide a context for descriptions of procedures listed under "IMPLEMENTATION MODULE" in the microfiche appendix hereto.
______________________________________ IMPLEMENTATION MODULE AppDemo; IMPORT Applicat, Console, Sched, Types; PROCEDURE Adder.sub.-- process; CONST routine = "AppDemo.Adder.sub.-- process"; in.sub.-- streams = 2; out.sub.-- streams = 1; VAR param : Applicat.Param.sub.-- type; output : Applicat.Sample.sub.-- type; vector : ARRAY 0 . . in.sub.-- streams-1! OF Applicat.FIFO.sub.-- record.sub.-- type; sample : ARRAY 0 . . in.sub.-- streams-1! OF Applicat.Sample.sub.-- type; BEGIN Sched.Parameter (param); (*Initiate input streams*) Applicat.Init.sub.-- FIFO.sub.-- record (vector, param); (*Initiate output streams*) output.stream := param.stream.sub.-- output 0!; LOOP Applicat.Get.sub.-- samples (vector, sample); output.stamp := sample 0!.stamp; output.missing := (sample 0!.missing ORsample 1!.missing); IF NOT output.missing THEN output.sample := sample 0!.sample +sample 1!.sample; END; END Adder.sub.-- process; BEGIN Applicat.Register.sub.-- action ("ADD", Adder.sub.-- process. 2*1024); END AppDemo. ______________________________________
The action process "Adder-- Process" first connects to its streams through the calls to "Sched.Parameter" and "Applicat.Init-- FIFO-- record." The stream field of the output sample must also be initialized.
The main loop has four phases:
1. Get input samples, i.e., execute "Get-- samples".
2. Check for missing values. If "missing" is true for a sample, the sample's value may contain any number including a meaningless number. If this value is used in a calculation, the process will terminate with an error.
3. Calculate output sample.
4. Put the output sample in an action process designated to receive the sample, i.e., execute "Put-- sample."
The module's initialization code registers the action process to make it available to the application.
To be useful, this application module must be recognized by the application file parser in the workstation program. Subsequently, a statement such as the following can be used to execute this application module noted above:
add(term1, term2)=>(sum)
The following is a short description of the data structures and routines listed under "IMPLEMENTATION MODULE" in Appendix A. "Application-- active," which indicates whether an application is running, is set by "Start-- application" and is cleared by "Stop-- application." Set to TRUE when all parts of an application are loaded correctly, "Application-- valid" must be set to start an application. The "Action" array contains information about all action processes that participate in the loaded application--the "Append-- XXX" procedures add records to the array and "Start-- application" reads it.
The "App-- stream" structure holds information about all streams in an active application. Each stream has a visible flag indicating whether the samples for the stream should be sent to the workstation. For each stream there is a set of buffers, one for each action process reading values from the stream. The "App-- stream" structure contains pointers to these buffers.
"Buffer-- FIFO" is a collection of pointers to all stream buffers for an application and is used by "Start-- application" and "Stop-- application." Also used by the "Start-- application" and "Stop-- application" procedures is "Pid-- FIFO," which includes process identifiers ("PIDs") of all active processes.
"Action-- count" represents the number of started action processes. "Action-- routine-- head" is a linked list of registered action process descriptions. "Append-- proc" points to a routine that is called for each visible sample. "Debug-- count" reflects the number of "Put-- sample" calls for each stream.
"Remember-- stream" stores the stream number in the process's data area for debugging purposes and "Forget-- stream" removes it.
Both "Init-- FIFO-- record" and "Get-- samples" are described above. For further illumination, "Get-- samples" operates as follows. First, for all streams where "next" is empty, a sample from the stream buffer is moved into "next." Second, the oldest timestamp in "next" is moved to "oldstamp." Third, for all samples in "next" with this timestamp, the sample is moved to "previous." Fourth, the timestamp in "previous" is set to "oldstamp." Finally, "previous" is returned.
"Put-- sample," also described above, operates as follows. The fields in the sample are checked; if the stream is visible, then "Append-- proc" is called with the sample. For all action processes reading the stream, the sample is put into the stream input buffer of the action process.
Another routine described above is "Create-- FIFO," which operates in the following way. After a new input buffer for stream number "index" is created, the buffer pointer is stored in "App-- stream" for reference by "Put-- sample" and "Stop-- Application." The buffer pointer is also returned to the caller, i.e., "Start-- application," for later access by "Get-- samples."
With respect to "Register-- action," also described above, the information is stored in a linked list, "Action-- routine-- head," for use by the "Append-- XXX" procedures.
"Lookup-- action" returns a pointer to the registered information on action process "name;" NIL is returned if "name" is not found in the list.
"Clear-- application," mentioned above, initializes "App-- stream." Also mentioned above, "Append-- action" appends an action process to the application according to "reply." The information from "reply" is combined with registered information and stored in the global "Action" vector for use by "Start-- application." Mentioned above as well is "Append-- visible," which sets the visible flag in streams according to "reply."
The "Start-- process" procedure mentioned above is mainly called from "Start-- application." It creates and starts an action process. The procedure initiates the process parameter property using the "stream-- input," "stream-- output," and the qualifier parameters. A stream buffer is also created for each input stream.
"Start-- application" and "stop-- application" are mentioned above. "Init-- debug" clears the put sample counter for all streams. "Show-- streams-- proc" is a console command which displays a listing of all active streams for debugging purposes. "Zero-- streams-- proc," also a console command, resets the sample counters for all streams.
Other EmbodimentsThe embodiments described above are but examples, which can be modified in many ways within the scope of the appended claims. For example, the invention also applies to a measurement computer containing only a single sensor unit, if this sensor unit creates at least two streams of measurement values that need to be synchronized at a later stage in the measurement system. Furthermore, the timestamp-- based synchronization can be utilized not only in the processor unit but also in the sensor units or the channel units or both. In addition, the sensor units need not be connected to the processor unit via respective channel units, but can be connected directly to the processor unit, which can perform all necessary processing. Moreover, as indicated in the power measurement description above, the clock counter need not be situated in a channel unit; the clock counter can be located, e.g., in a sensor unit instead.