Virtual machine programming system4849880Abstract A system for programming a computer provides a set of software-based virtual machines each for instructing a computer to carry out a selected operation. Each virtual machine is represented by a virtual front panel displayed on a screen and each virtual front panel graphically displays operator controllable values of input and output parameters utilized by the virtual machine it represents. The system is adapted to synthesize a new virtual machine for instructing the computer to perform a sequence of operations wherein each operation is carried out by the computer according to the instructions of an operator selected one of the existing virtual machines. The system also creates a new virtual front panel for displaying input and output parameters associated with the new virtual machine. The system permits the operator to program the computer by directing synthesis of a hierarchy of virtual machines. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
______________________________________
runMe [1]
.vertline.q5 q4 q3 q2 q1 t.vertline.
[2]
"Gainmeter" [3]
"1 October 1985" [4]
t <- (Generator InstrumentList) at: `aSignalGenerator15`.
[5]
t frequency: (self atFreq). [6]
t amplitude: (self inLevel). [7]
q1 <- t runMe. [8]
t <- (Generator InstrumentList) at: `aVoltmeter16`.
[9]
q2 <- t runMe. [10]-t <- (Generator InstrumentList) at:
`aDivider12`. [11]
t denominator: (self inLevel).
[12]
t numerator: (q2). [13]
q3 <- t runMe. [14]
t <- (Generator InstrumentList) at: `aLogarithm13`.
[15]
t number: (q3). [16]
t base: 10. [17]
q4 <- t runMe. [18]
t <- (Generator InstrumentList) at: `aMultiplier14`.
[19]
t left: 20. [20]
t right: (q4). [21]
q5 <- t runMe. [22]
self measuredGain: q5 "Replace Me"
[23]
______________________________________
Line [1] is the title of the method, runMe. Line [2] declares q5, q4, q3, q2, q1 and t as temporary variables. Line [3] is a comment identifying the runMe method as being associated with the Gainmeter and line [4] is a comment indicating the date when the runMe method was created. In line [5] the variable t is made to reference the aSignalGenerator15 object on the Generator InstrumentList. In other words, when the variable t is then used to designate an object, the designated object is the aSignalGenerator15 virtual instrument. In line [6] a message is sent to the aSignalGenerator15 virtual instrument which assigns the value of the gainmeter (referenced by the word "self") input parameter atFreq to the frequency input parameter of aSignalGenerator15. In line [7] a message is sent to the aSignalGenerator15 object which assigns the value of the gainmeter input parameter inLevel to the amplitude input parameter of aSignalGenerator15. In line [8] a "runMe" message is sent to the aSignalGenerator15 virtual instrument which causes it to set the frequency and amplitude controls of the signal generator 14 of FIG. 1 consistent with the atFreq and inLevel input values provided in lines [6] and [7] . Also in line [8] an output of the aSignalGenerator15 runMe method, an indication of method completion, is assigned to a variable q1. In line [9] the t variable is reassigned to reference the aVoltmeter16 virtual instrument on the generator instrument list and in line [10] a runMe message is sent to the aVoltmeter16 virtual instrument causing it to acquire the output voltage measured by the voltmeter 16 of FIG. 1 and to assign the value of the measured voltage (V2 in equation [A] hereinabove) to another variable q2. In line [11] the variable t is reassigned to reference the aDivider12 virtual instrument and in lines [12] and [13] messages are sent to aDivider12 causing it to assign the value of the inLevel gainmeter input parameter (V1 in equation [A] hereinabove) to the denominator parameter of Divider12 and to assign the q2 variable (i.e., V2) of line [10] to the numerator parameter of aDivider12. In line [14] a runMe message is sent to aDivider12 causing it to divide the numerator parameter by the denominator parameter thereby producing an output quantity equal to V2/V1. Also in line [14] the aDivider12 output is assigned to another variable q3. In line [15] the variable t is reassigned to reference the aLogarithm13 virtual instrument and in lines [16] and [17] messages are sent to aLogarithm13 causing it to assign the value of the q3 variable (V2/V1) to the number parameter of aLogarithm13 and to assign the constant 10 to the base parameter of aLogarithm13. In line [18] a runMe message is sent to aLogarithm13 causing it to produce an output quantity equal to the log to the base 10 of number (i.e., Log.sub.10 (V2/V1)). This quantity is assigned to the variable q4. In line [19] the variable t is reassigned to reference the aMultiplier14 virtual instrument and in lines [20] and [21] messages are sent to aMultiplier14 requesting it to assign the constant 20 to its left parameter and to assign the variable q4 produced in line 18 as its right parameter. In line [22] a runMe message is sent to aMultiplier14 causing it to produce an output quantity equal to the 20 times q4, i.e., 20Log.sub.10 (V2/V1). This output quantity is assigned to the variable q5. Finally, in line [23] , the measured gain of the device under test q5 is assigned as the Gainmeter output parameter, measuredGain, and this value is returned. The above runMe method listing for the gainmeter virtual instrument is produced during the synthesis process and displayed in region 86 of the synthesizing window 82 of FIG. 4. Initially, when the window is opened, lines [1]-[4] are automatically displayed in region 86, followed by a fifth line: self myValue: self myValue "replace me" [23a] This last line is a precursor to line [23] of the runMe listing wherein the instance of "myValue:" is a dummy variable subsequently to be replaced during the synthesizing process by "measuredGain:" and wherein the following "self myValue" dummy expression is subsequently to be replaced by the "q5" variable as described hereinbelow. The remaining lines [5]-[22] are also inserted into the listing during the synthesizing process. Referring again to the synthesizing window 82 of FIG. 4, the top region 84 of window 82 is divided into three subregions. The first subregion 90 of top region 84 contains a list of the names of the input and output parameters of the synthesized virtual instrument. Initially subregion 90 is empty because the input and output parameters of the instrument have not been defined. A second subregion 92 of window region 84 contains a list of parameter types and a pair of selection boxes 94 and 96 for indicating whether a parameter is an input or an output of the synthesized virtual instrument. In this example, the possible parameter types include "function" (e.g., selection from a list such as square, sine, triangle), and "number" (a floating point decimal number). However, in other applications, other types of parameters may be included in the parameter type list including integers, character strings, binary numbers, etc. A third subregion 98 of window region 84 includes a list of the possible types of virtual front panel displays available for each parameter including in the present example, "linearGraph", "linearMeter", "logGraph", and "logMeter" which are adapted to display the value of a number. The "volts" display 36 of the voltmeter virtual front panel of FIG. 2B is an example of a linearGraph display wherein the value of a parameter is displayed as a bar of proportional length. The "left" meter 56 of the multiplier virtual front panel of FIG. 2E is an example of a linearMeter display wherein the value of a parameter is proportional to the position of a pointer on a dial. The "inLevel" display 64 and the "atFreq" 66 displays of the gainmeter of FIG. 2F are examples of the logGraph and logMeter displays wherein, respectively, the value of parameter is logarithmically proportional to the length of a bar or the position of a pointer on a dial. In other applications of the present invention, the list of possible displays in subregion 98 may be expanded to provide for displays of other types of parameters including, for example, an alphanumeric readout for displaying character strings, simulated lamps for displaying binary parameter states, selectors from lists, etc. The operator may define an input or output parameter for the synthesized instrument by adding it to the parameter list in subregion 90. First the cursor is moved over the subregion and a yellow mouse button is pressed to open a second command menu window 100 as illustrated in FIG. 3H super-imposed over region 90. This window includes four commands, "add", "delete", "new instance" and "inspect parameter". The operator then moves the cursor over the "add" command and releases the mouse button. The system then closes the second command window and opens a dialog window similar to that shown in FIG. 3F, except requesting "add parameter named". At this point the operator types the name of a parameter such as "atFreq" and then presses a carriage return button on the terminal keyboard. The system displays the name "atFreq" in subregion 90 with the name highlighted and also highlights the "input" selection box in subregion 92 as well as the "linearGraph" display type in subregion 98, to indicate that the highlighted parameter atFreq is, by default, a floating point number input to the gainmeter to be displayed as a linear graph on the virtual front panel for the gainmeter. The operator may change the nature of the front panel display for a parameter in high-lighted subregion 90 by placing the cursor over the desired display type in subregion 98 and depressing the red mouse button. Similarly the operator may change the parameter type and whether it is an input or an output by using the cursor and red button to select the appropriate defining words in subregion 92. Next, in the same manner in which the operator used the cursor in the second command window to add and define the atFreq parameter, the operator also adds and defines the "inLevel" and "measuredGain" parameters. At this point all three parameters appear in the input/output parameter list of subregion 90 as seen in FIG. 4. Each time the operator adds an input or an output parameter to the parameter list of subregion 90, a line is added to region 88 listing the parameter. As shown in FIG. 4, the first line in the "bind list" of region 88 reads "self atFreq" indicating a parameter atFreq has been defined according to the front panel specifications of the gainmeter ("self"), rather than according to the specifications of some other virtual instrument on the instrument list. Similarly, when the operator adds the inLevel and measuredGain parameters to the parameter list of subregion 90, the system displays second and third lines in region 88 reading "self inLevel" and "self measuredGain". At this point the operator has defined the virtual front panel for the gainmeter, as illustrated in FIG. 2F wherein the gainmeter virtual front panel is analogous to a "real" front panel as would be required for a "real" gainmeter and which could be constructed from hardware components. A real front panel for a gainmeter would include a knob for controlling and indicating output signal frequency, a knob for controlling and indicating output signal voltage, and a meter for displaying gain. In order to construct a "real" gainmeter it would be necessary to interconnect the front panel with inputs and outputs of various hardware components capable of producing a test signal, to measure a voltage and to perform a gain calculation. Similarly, in order to cause the virtual front panel of a virtual gainmeter instrument to operate properly it is necessary to create the runMe code for the gainmeter virtual instrument for directing the flow of messages which "interconnect" the gainmeter virtual front panel with the aDivider12, aLogarithm13, aMultiplier14, aSignalGenerator15 and aVoltmeter16 virtual instruments, in a fashion analogous to the wired interconnection of corresponding hardware instruments. First, the operator selects the first virtual instrument to be utilized by the gainmeter, aSignalGenerator15, by moving the cursor over the displayed virtual front panel for the aSignalGenerator15, illustrated in FIG. 2A, and clicking a button on the mouse. The "aSignalGenerator15" label on the front panel is then highlighted to indicate the selection. To test the operation of the virtual signal generator and the corresponding real signal generator, the operator may set test values for the frequency and amplitude input parameters of the virtual signal generator, operate the virtual signal generator and then measure the output of the corresponding real signal generator to see if it produces a signal with the desired voltage and frequency characteristics. To adjust an input parameter of a virtual instrument after selecting the instrument, the operator moves the cursor over the meter area of a panel meter or a bar graph meter, depresses a red selection button on the mouse, moves the cursor to move the pointer or the bar to the desired position on the meter, and releases the red button. This is analogous to moving a knob or a slide control on a real front panel. Alternatively, the operator may select a meter and then operate a yellow button on the mouse to open a third command menu window 102 as illustrated in FIG. 3I listing " generate", "run", "stop", "inspect me" and "set parameters" commands. When the operator selects the set parameters command with the cursor, third command menu window 102 is replaced with a dialog window 104 as illustrated in FIG. 3K. In the example of FIG. 3K the operator has selected the frequency meter of the signal generator virtual front panel 28 of FIG. 2A. The dialog window 104 requests the operator to type in a new value for frequency. In this example, the operator has responded by typing in "1325". When the operator presses the carriage return, the dialog window 104 disappears and the frequency meter 30 of FIG. 2A is set to the new value. Assuming that the operator has now set the frequency parameter to 1325 and the voltage parameter to 5.59, the operator may "run" the signal generator virtual instrument by opening the third command menu window 102 of FIG. 3I and selecting the "run" command. This causes the signal generator virtual instrument to send the frequency and amplitude data to the rear signal generator 14 of FIG. 1 along with a signal causing it to operate. The operator may then test the output of the real signal generator to see if it produces a signal of the desired voltage and frequency. After the output of the signal generator 14 is tested, the operator may stop the operation of the signal generator by selecting the virtual signal generator, opening the third command menu window of FIG. 3I, and selecting the "stop" command, thereby causing the virtual signal generator to send a stop instruction to its real counterpart. Once operation of the virtual signal generator is verified (if such is desired), the code for "connecting" the virtual signal generator to the aGainmeter1 front panel may be synthesized. First, the operator uses the cursor and a red mouse button to select the last line of the listing currently displayed in region 86 of the synthesizing window of FIG. 4. The operator then selects the aSignalGenerator15 front panel, uses a mouse button to open the third command menu window 102 of FIG. 3I, and selects the "generate" command. This causes the system to insert the following code lines immediately preceding the selected line, in this case the last line in region 86:
______________________________________
(Generator InstrumentList) at:
[5]
`aSignalGenerator15`.
t frequency:1325. [6a]
t amplitude:5.59. [7a]
q1 <- t runMe. [8]
______________________________________
These lines are similar to lines [5]-[8] of the completed runMe listing except that in lines [6a] and [7a] the frequency variable is assigned its current test setting of 1325 Hertz and the amplitude variable is assigned its current test setting of 5.59 volts rather than the values of atFreq and inLevel indicated in lines [6] and [7] of the completed listing. At the same time lines [5], [6a], [7a], and [8] are added to the listing in region 86, the q1 variable produced in line [8] is added to the bind list in region 88, as well as to the temporary variable declarations in line 2. The operator may now "connect" the inLevel and atFreq parameters of the Gainmeter so that the virtual signal generator inputs may be set from the inLevel and atFreq inputs of the Gainmeter. To connect the atFreq parameter to the frequency input of the aSignalGenerator virtual instrument, the operator uses the cursor and a red selection button on the mouse to select line [6a] of the listing in region 86 and the "self atFreq" line of the bind list in region 88 and then operates a yellow selection button on the mouse to open a fourth command menu window 106 as illustrated in FIG. 3J. The fourth command menu window lists the commands "modify code", "delete", "clear", and "inspect". At this time, the operator selects the modify code command which causes the system to modify the code of line [6a] so that it reads as in line [6] of the completed runMe listing hereinabove by replacing the number 1325 with "(self atFreq)". In a similar fashion, the operator modifies Line [7a] to read as in line [7] of the completed listing by selecting line [7a] in region 86, selecting the "self inLevel" line from the bind list in region 88 and then selecting the modify code command from the fourth command window 106 of FIG. 3J. Next the operator selects the aVoltmeter 16 front panel 34 of FIG. 2B and may test its operation by applying a known reference voltage to voltmeter 16 of FIG. 1, selecting the "run" command of the third command menu 102, and checking meter 36 of the aVoltmeter16 front panel to see that it properly indicates the reference voltage. The operator then inserts lines [9] and [10] into the runMe listing in region 86 by selecting the last line of the listing, selecting the aVoltmeter16 front panel, and then selecting the "generate" command from the third command menu 102 of FIG. 3I.
______________________________________
t <- (Generator InstrumentList) at: "aVoltmeter16".
[9]
q2 <- t runMe. [10]
______________________________________
At the same time these lines are inserted into the listing in region 86, the q2 variable is added to the bind list in region 88 and to the temporary variables in line 2 of region 86. In similar fashion the following lines are added to the listing in region 86 when the operator selects the aDivider12 instrument and the generate command of the command menu 102 of FIG. 3I:
______________________________________
t <- (Generator InstrumentList) at: "aDivider12".
[11]
t denominator: 1. [12a]
t numerator: 1. [13a]
q3 <- t runMe. [14]
______________________________________
The q3 variable is also added to the bind list in region 88 of the synthesizing window 82 of FIG. 4, and to line 2 of region 86. At this point the operator modifies line [12a] to replace the "1" constant with (self inLevel) by selecting line 12a and the "self inLevel" parameter in region 88, and then selecting the modify code command from the command menu 106 of FIG. 3J. The operator also modifies line [13a] in similar manner except that the q2 variable in the bind list of region 88 is selected to replace the constant "1" in line [13a]. In a similar fashion, the operator may select and use the generate and modify code commands of the menu of FIG. 3J to insert code lines [15]-[22] into the runMe listing for the aGainmeter1 virtual instrument displayed in region 86 of the synthesizing window. Finally, the operator must modify the last line [23a] of the code in region 86 to match line [23] of the completed runMe listing. To do so the operator selects line [23a] and uses a mouse button to open a command menu window 108 of FIG. 3L which lists the commands "modify code", "edit code", "add code", "clear code", "reset code", "compile message", and "inspect code". The operator selects the "edit code" command in the menu and the menu is then replaced with dialog window 110 as illustrated in FIG. 3M which contains selectd code line [23a] . This dialog window permits the operator to use the cursor to indicate the dummy variables to be replaced and to type in the appropriate information (as hereinbefore mentioned) in their place. With the runMe code for the gainmeter synthesized, the complete code for the gainmeter virtual instrument may now be compiled. To do so, the operator opens the command menu window 108 of FIG. 3L and selects the "compile message" command. Once the code is compiled, the synthesis process for the Gainmeter class is complete and the operator may create an instance of the Gainmeter class by selecting the "Gainmeter" class from the Generator list window 70 of FIG. 3G, opening the command menu window 74 of FIG. 3C (or opening the command window 100 of FIG. 3H in region 90 of the synthesizing window of FIG. 4), and selecting new instance. Thereafter the aGainmeter1 virtual front panel 62 of FIG. 2F is displayed. This instance of the gainmeter virtual instrument may be operated in the same manner any other virtual instrument is operated. The inLevel and atFreq control inputs may be modified by using the cursor to set the appropriate meter settings (or by typing the desired values into a dialog window) and then selecting the run command from the command menu of FIG. 3I. When the operator no longer wishes the front panel of a virtual instrument to be displayed, he may select such front panel and then open the blue button menu window 112 as illustrated in FIG. 3N, displaying "under", "move", "frame", "collapse", and "close" commands. The close command removes the selected panel from view, the under command causes a selected window to appear beneath any overlappng windows, and the move command permits the operator to relocate any selected window by using the cursor to move the window across the screen to a new position. The frame command permits the operator to use the cursor to resize a window by moving a corner of the window. The collapse command shrinks a selected window until only its title is shown on the screen. A collapsed window may be opened again by selecting the frame command from the blue button menu. It will be realized that all these functions are performed by commercially available graphics software, such as Smalltalk 80. Referring to FIG. 3C, the command menu 74 includes a delete and an inspect me command in addition to the new instance, synthesize and add commands previously discussed. The operator may delete an instrument class by selecting the class on the generator list 70 of FIG. 3G, opening command menu 74 of FIG. 3C and selecting the delete command. The inspect me command invokes a standard Smalltalk feature which enables the operator to obtain information regarding a selected object, in this case a virtual instrument class. The add code command of the command menu of FIG. 3L permits an operator to type in a line of code in a selected location within the runMe listing region 86 and the clear code command permits the operator to clear the entire code. The delete command permits him to delete a selected line of code. The reset code command permits the operator to restore the code to the initial value as in FIG. 4. The Smalltalk software for the preferred embodiment of the present invention is implemented using three system categories: "MyInstruments", "Synthesizer", and "Interface-Meters". The MyInstruments system category includes virtual instrument classes. Appendix I includes listing for example virtual instrument classes for adding and multiplying. The Adder virtual instrument class listing appears on the first page of Appendix I and will be discussed in detail by way of example. The other virtual instrument class listings are structure in a similar fashion as will be apparent to those skilled in the art. Referring to the Adder virtual instrument class listing, line (1) identifies the virtual instrument subclass "Adder" and line (2) defines three instance variables: left, output and right. Lines (3) and (4) indicate the VirtualInstruments class has no class variables and no pool dictionaries. Line (5) identifies the class category, myInstruments. Each instrument subclass has two groups of instance methods, "parameters" and "set values". The parameters methods include methods to set and read the values of selected instance variables and a runMe method to carry out the operation of the virtual instrument. The setValues methods provide the prompt in dialog windows of the type shown in FIG. 3K when the operator uses the "set frequency" command of the command menu of FIG. 3I to specify a frequency value. When a different meter is selected, the word frequency in menu 102 is replaced by the name of the parameter displayed by the meter. Line (6) introduces the parameter methods and line (7) defines a first parameter method corresponding to the selector "left" which returns the value of the left variable to any object sending a "left" message to the adder. If the value of the left variable has never been set, i.e., it is "Nil", the method sets the value of the left parameter to 1 and returns 1 as the parameter value. This line also includes comments indicating the date when the method was last modified, the variable type (number), the type of meter used to display the variable (linearGraph), and whether the variable is an input or an output. Line (8) defines a second parameter method responding to the selector "left:". This method sets the value of the left variable to any value specified in a message of the form left:xx, where xx is the specified value. The method returns the set value of left to the message sender. Similarly, lines (9), (10), (11) and (12) define methods responding to the selectors "output", "output:", "right", and "right:" which permit the interrogation and setting of the output and right variables in the same manner that lines (7) and (8) permit interrogation and setting of the left variable. Lines (13)-(18) define the parameter method executed in response to a runMe method. Line (13) recites the runMe selector and lines (14) and (15) are comments indicating the class (Adder) and the date of creation of the class. Line (16) defines a temporary variable, t. In line (17) the value of the left parameter and the value or the right parameter are obtained by using the left and right methods of lines (7) and (11). The two values are summed and the sum is assigned to a variable "myValue" which is returned to the object which sent the runMe message. Line 17 also invokes the "output:" method to set the output parameter on the virtaul front panel of an adder. Line (19) introduces the setValues methods, the first of which is defined in line (20) as responsive to a message containing a "setleft" selector. This line returns a character string "left value?" to be placed in a dialog window when the operator is to type in a new parameter value after having invoked the setleft command. The methods of lines (21) and (22) are similar to the method of line 20 except that line (21) relates to the setting of the output parameter and line (22) relates to the setting of the right parameter. The above listing for the Adder subclass is structured in a fashion which is typical for all virtual instrument subclasses, each having a pair of parameter methods similar to "left" and "left:" of lines (7) and (8) and a setValues method similar to that of line (20) associated with each parameter. Also each has a runMe method similar to that given in the adder example and designed to implement the primary function of the virtual instrument. The code for the runMe method, associated a virtual instrument which sends data to and/or receives data from a real instrument such as a signal generator or a volt-meter, includes provisions for sending data out on the bus to the receiving instrument and/or acquiring data over the bus from the instrument in a well known manner. Appendix II is a listing of a new Smalltalk system category "Synthesizer, according to the present invention, which includes three new Smalltalk classes: "Generator", "ParameterBlok", and "VirtualInstruments". Generator is a new subclass of the standard Smalltalk class "Object" while Parameterblok and VirtualInstruments are new subclasses of the standard Smalltalk class "Number". Each virtual instrument class is a subclass of VirtualInstruments. The Generator class, also diagrammed in FIG. 6, includes instance methods 120 and class methods 122 invoked during the creation of new classes of virtual instruments and new virtual instrument instances, and invoked to control the operation of the virtual instruments instances. The ParameterBlok class, also diagrammed in FIG. 7, includes a class method 124 and an instance method 126 invoked to create and maintain records of the attributes (i.e. name, type, value, meter view, etc.) of the various input and output parameters associated with each virtual instrument. The VirtualInstruments class, also diagrammed in FIG. 8, includes class methods 128 and instance methods 130 also invoked during the creation of virtual instrument instances, providing common display messages for the virtual instrument classes. The virtual instrument classes are used as "generators" to generate new virtual instrument instances, and these classes are included in a data structure called "GeneratorList". The names of these generator classes are displayed on a generator list 70 illustrated in FIG. 3D. The names of the virtual instrument instances available for a project are displayed on an instrument list 72 as illustrated in FIG. 3E. Referring to FIG. 6, the generator class is initialized by an "initialize" method which calls an "addGeneratorSpec: parameters:" method to add the available virtual instruments to the generator list and to invoke a "compileGenerator:" method which compiles the generator classes. Initially when an operator opens a project, the operator types and executes the line, "Generator example". This calls the generator class method "example" which in turn calls the methods "displayGenerators" and "displayInstruments" to initiate the display of the generator list 70 of FIG. 3C and the instrument list 72 of FIG. 3B. Once the generator list is displayed, the operator may select a generator using the cursor and the red mouse button, thereby invoking a "wakeGenerators" method which sets a variable indicating the selected generator. The operator may open the generator command menu 74 of FIG. 3C by operation of the yellow mouse button which invokes a "generatorMenu" method for displaying the menu. The operator may delete the selected generator from the generator list by selecting the delete command from the menu, calling a "deleteGenerator" method. The operator may inspect a selected generator by selecting the inspect me command from the menu whereupon an "inspectSelectedGenerator" method is called which invokes a standard Smalltalk inspect method. The operator may add an instance of a virtual instrument to the instrument list by selecting the appropriate generator on the generator list and then selecting the new instanes command on the generator menu 74 of FIG. 3C. An "addInstrument" method is called which obtains the name of the selected generator and passes it to an "addInstrument:" method. The "addInstrument:" method adds the name of the virtual instrument instance to the instrument list and invokes a "newInstance" method which initiates display of the virtual front panel for the new virtual instrument. The "addInstrument:" method also invokes a VirtualInstruments class method "new:" (listed in FIG. 8) which creates the new instance of the instrument and initializes it with a name and a parameter block. The "new:parameters:" method calls a VirtualInstruments instance method "initialize:", setting the values of the parameters in the parameter block associated with the new virtual instrument instance. The operator may select a virtual instrument instance on the instrument list using the cursor and the red mouse button and may open an instrument command menu 73 as illustrated in FIG. 3P by depressing the yellow mouse button when the cursor is within the instrument list. The front panel of a selected virtual instrument is displayed if the operator selects a "show me" command from the instrument command window, invoking a "showSelectedInstrument" method to initiate the display. The operator may "run" a selected virtual instrument by selecting the run command which calls a "runSelectedInstrument" method for sending a "runMe" message to the selected virtual instrument. The operator may add a new instance of a selected virtual instrument by selecting the add command to invoke the "addInstrument" method discussed hereinabove. The operator may inspect a selected virtual instrument by choosing the inspect command which calls an "inspectInstrument" method invoking the Smalltalk inspect method, and can delete a selected virtual instrument instance by selecting the delete command from the instrument list menu to call for a "deleteInstrument" method for removing the selected instrument from the instrument list. The generate command on the instrument menu is discussed hereinbelow in conjunction with the synthesis process methods. When a virtual front panel is displayed, the operator may open the meter menu 102 of FIG. 3I by placing the cursor over a meter and operating the yellow button to call for a "makeYBM:" instance method of the virtualInstruments class (FIG. 6). Referring to FIG. 6, the run, stop and inspect me commands invoke, respectively, a "run" method for sending a runMe message to the virtual instrument, a "stopMe" method for sending message halting instrument operation, and an "InspectMe" method invoking the Smalltalk "inspect" method. The set parameter command on the meter menu invokes a "setValue" method for opening a dialog window permitting the operator to type in a new value for the parameter displayed by a selected meter and sets the parameter to the new value. The generate command on the meter menu will also be discussed hereinbelow in conjunction with the synthesis process. In order to synthesize a new generator, the operator first adds the generator to the generator list. To do so the operator uses the add command on the generator command menu 74 of FIG. 3C. Referring to FIG. 6, this command calls an "addGenerator" method for opening a dialog window permitting the operator to type in the name of the new generator and then calls an "addGenerator:" method which adds the generator name to the generator list and invokes a generator "new:" method. The "new" method creates a new generator instance and provides an instance method "initialize:" which creates the initial Smalltalk code listing for the runMe method for the new generator class. This initial listing includes the runMe code lines [1]-[4] and [22a] described hereinabove. These lines are obtained by a call to an "initialCodeList:" Generator class method which returns the code lines. The "initialize" method also initializes parameter and bind lists for the generator. After the "addGenerator:" method is completed, the "addGenerator" method invokes a "compileGenerator:" method which creates the new class by calling a standard Smalltalk method subclass:instanceVariableNames:classVariable-Names:poolDictionaries:catego ry:. The method "compileGenerator:" invokes the "makeParameterMessage:in:" Generator instance method which creates the parameter methods for the generator. Once a generator appears on the generator list, the operator may "synthesize" the generator (i.e., alter its function) by opening the synthesis window. When the operator selects a generator to be synthesized from the generator list and utilizes the synthesize command on the generator menu, a "synthesis" Generator class method is called. This method then invokes the "displaySynthesis" instance method for the selected generator which opens the synthesis window 82 of FIG. 4. The window displays any existing input or output parameters on the parameter list in region 90 of the window and on the bind list in region 88, and displays the runMe code for the generator in region 86. When the operator opens the parameter menu 100 of FIG. 3H, a "parameterMenu" instance method is called to display the menu. The operator may add a parameter to the list by selecting the add command which calls an "addParameter" method for displaying a dialog window enabling the operator to type in a new input/output parameter name. After the name is typed in, "addParameter" passes the name to an "addParameter:" method which forwards the parameter name to an "addParameterToList:" method for adding the parameter to the parameter list. Before adding the parameter to the parameter list the "addParameterToList:" method initializes the parameter attributes (i.e. view, type, input/out) to default values by invoking a "setParameter:blok:" instance method. The "setParameter:blok:" method calls a set of ParameterBlok class instance methods (listed in FIG. 6) "in:", "out:", "name:", "type:", "value:" and "view:". These methods specify the attributes of the parameter. The "addParameter" method also passes the parameter name to a "makeParameterMessage:in:" method which adds the parameter to the list of instance variables for the generator class, adds the variable to the bind list, and creates the instance methods for the class being synthesized for setting and returning the value of the new parameter. A new parameter is initialized as an input of the "number" parameter type to be displayed on a linear graph. The operator may change these parameter attributes by using the cursor and the red mouse button to select the parameter and then the appropriate parameter attributes in region 84 of the synthesizing window. When either the Input or the Output parameter attribute is selected, or deselected, the "in:" or the "out:" parameter block instance method is invoked to set the input/output attribute for the parameter. When a parameter type (i.e., number or function) or parameter view (i.e., linearGraph, linearMeter, etc.) is selected, a "type:" method or "view:" method is used to set the selected parameter type or view. Whenever the operator selects a parameter on the parameter list, a "wakeParameter:" Generator instance method is called which highlights the selected parameter and the appropriate attributes displayed in region 84 of the window. The "wakeParameter:" method determines the appropriate view, type and input/output parameter attributes by invoking the parameterBlok methods ("view", "type", "in", and "out") and passing the returned data to instance methods ("sView:", "sType:", "myIn:", and "myOut:") which control the highlighting of the attributes. The "wakeParameter:" method then modifies the display by calling a standard Smalltalk method "changed:". The operator can delete a parameter from the parameter list by selecting the parameter to be deleted and then selecting the delete command from the parameter menu 100 of FIG. 3H, thereby calling for a "deleteParameter" Generator instance method which removes the parameter from the parameter and bind lists and updates the display. The operator can also inspect the parameter by selecting the inspect command from the parameter command menu to call an "inspectParameter" method which in turn invokes the smalltalk inspect method. The operator can also create a new instance of the selected generator virtual instrument by selecting the "new instance" on the parameter command window of FIG. 3. This calls a "newInstance" Generator instance method which utilizes the generator class method "newInstance" discussed hereinabove. As part of the synthesizing process, the operator may insert new lines into the runMe listing in region 86 of the synthesizing window 82 of FIG. 4 which cause a synthesized virtual instrument to utilize another virtual instrument to perform a selected operation. First the instance of the selected virtual instrument is selected and then the generate command within menu 73 of FIG. 3P is selected. The generate command of the instance command menu invokes a "generateSelectedInstrument" Generator class method which in turn calls a Virtual Instruments instance method "generate". Selection of the generate command from menu 102 of FIG. 3I calls the "generate" method directly. The "generate" method produces the runMe code lines. These lines are then inserted into the runMe code listing for the generator being synthesized just above a selected existing code line. The "generate" method calls a "nextQuad" Virtual instruments class method which returns the number to be appended to the "q" output variable for the code. "Generate" also adds the new "q" variable to the bind list. The command menu 106 of FIG. 3J is opened by invoking a "bindMenu" Generator instance method and the code command menu 73 of FIG. 3P is opened by calling a "codeMenu" Generator instance method. When the operator selects a line of runMe code in region 86 of the synthesizing window, and a parameter on the bind list in region 88, and then selects the modify command on the bind command menu, or the modify code command on the code menu, a "modifyCode" method is called. The "modifyCode" method changes the quantity to right of the colon on the selected code line to reference the selected bind list variable. The delete command on the bind menu 106 of FIG. 3J initiates a "deleteBind" method which removes a selected parameter from the bind list while a clear command on the bind menu calls a "clearbindList" method to remove all parameters from the bind list. An inspect command on the bind menu invokes an "inspectBindList" menu which in turn calls the system inspect methods to permit the operator to inspect the bind list. The operator can more directly edit the runMe code lines in synthesizing window region 86 by using other code menu commands. These additional code commands and methods permit an operator skilled in programming to develop virtual instrument primitives for carrying out functions not implemented by existing virtual instruments. A delete command invokes a "deleteCode" method which removes a selected line from the code list. An edit command calls an "editCode" method which opens a dialog window similar to window 110 of FIG. 3M containing a selected line of code. An inspect code command invokes the system inspect method through an "inspectCode" method, thereby permitting the operator to inspect the code list. An add code command uses an "addCode" method which opens a dialog window permitting the operator to type in a new code line. The "addCode" method in turn calls an "insertCode:" method which inserts the dialog window code line into the code list just above a selected line, or at the end if no line is selected. A reset code command calls a "resetCode" method which returns the runMe code to its initial state, thereby removing all but the first four and last runMe code lines. A clear command invokes a "clearCode" menu which deletes every line from the code list. The operator selects a compile message command when the code list is complete and this command calls a "compileMessage" method which concentrates the runMe code list to a character string and sends it to the system compiler. The following ParameterBlok instance methods return the value of the parameter attribute indicated by the method name: "in", "name", "out", "type", "value", and "view". The following ParameterBlok methods are invoked to set the value of the parameter attribute indicated by the method name: "in:", "name:", "out:", "type:", "value:", and "view:". A ParameterBlok class method "new" is used to create a new parameter block. In addition to Generator methods discussed above, the Generator class instance methods include additional instance methods employed by the methods described above. The methods "sB", "sC" and "sP" return the currently selected binding parameter on the bind list, the currently selected line of code from the runMe list and the currently selected parameter on the parameter list, respectively. The "sType" and "sView" methods return the currently selected parameter and meter types highlighted in the synthesizer window. A "getBindList" instance method returns the current bind list and an "InstrumentList" class method returns the current instrument list. The class and instance methods "typeList", "viewList", "bindList", "listInstruments" and "parameterList" sort and return the lists suggested by their names. The Generator instance method "codeList" and class method "codeList" both return the runMe code for a selected generator. A "selectedInstrument" method returns the name of an instrument currently selected on the instrument list, while a "selected-Synthesizer" method returns the name of the generator being synthesized. A "setName" method is employed to set an instance variable "instrumentName" to the name of the currently selected instrument while an "instrumentName" method returns the value of the variable. A "selectedBinding" method returns a currently selected line on the bind list. The following methods are utilized when selecting an item from a list: "wakeInstruments:" (when selecting an instrument from the instrument list), "wakeType:" (when selecting a parameter type from the parameter type list of the synthesizing window), "wakeBind": (when selecting a line on the bind list), and "wakeView:" (when selecting a meter from the meter list of the synthesizing window). The class methods "initCode", "initType", and "initView" return the runMe code line, parameter type and meter type currently highlighted in the synthesizing window. The VirtualInstruments class includes instance methods for providing common display messages for the virtual instrument classes created by the generators. In the preferred embodiment of the present invention three types of displays are possible: bargraph, panel meter, and a "list meter". A list meter displays a list of operating mode options for the virtual instrument having more than one operating mode and the operator may select an operating mode from such a list. For instance, a signal generator virtual instrument may include a list meter allowing the operator to select between squarewave, sinewave, or trianglewave signal generator outputs. A list meter is thus a form of menu and is created by invoking a "listMetre:" method. When the operator accesses the list meter menu a "listMetreMenu:" method is involved which responds to the operators selections. A "ParameterMetre" method is invoked to display a bargraph or panel meter and a "display" method is used to update the display of a meter when a virtual instrument parameter value is changed. The method "myParameters:" assigns a current parameter block to an instance variable, wherein "myParameters" indicates the current input parameter values for the instrtument. A "myValue:" method sets the value of a "myValue" instance variable, indicating the value of the virtual instrument output variable while a "myValue" method returns the value of the variable. In addition to the "new" method, the VirtualInstruments class methods include "classKounterIncrement" which returns the value of the number to be appended to the generator name when creating the name for a new virtual instrument instance, "nextQuad" (discussed hereinabove) which returns the number to be appended to the next "q" output variable of a line of synthesized runMe code, "resetQuad" which initializes a counter used by the "nextQuad" method, and "zeroKounter" which initializes a counter used by the "classKounterIncrement" method. Appendix III contains a listing of a new Smalltalk system category "interface-Meters", according to the present invention. The Interface-Meters category includes a new "MeterView" subclass of the existing Smalltalk "View" class for controlling the display of the meters on the virtual frontpanels associated with each virtual instrument, a new "MeterController:" subclass of the existing Smalltalk "MouseMenuController" class for monitoring the cursor position and mouse button operation, and a new "MeterScale" subclass of the existing Smalltalk "Object" class for performing various calculations required by the MeterView when adjusting the display of a meter. FIG. 5A lists the instance method names for the meter controller class. When the operator moves the cursor over a virtual instrument front panel meter displayed on the screen he may invoke a meter command menu such as 102 of FIG. 3I by operating the yellow mouse button. The operator may also invoke the window view command menu 112 of FIG. 3N by operating the blue mouse button and may change the value of the parameter displayed by using the red mouse button. The MeterController subclass methods monitor mouse button operation and cursor movement when the cursor is within the boundaries of a meter portion of a virtual front panel displayed on the screen. These methods send messages to the MeterView subclass indicating the position of the cursor and mouse button operations. The MeterView subclass uses information contained in these messages to adjust meter parameter values. When the cursor is in a meter window, the operator may adjust the meter reading by positioning the cursor over the meter pointer area (on a panel meter) or over the meter bar area (on a bargraph meter), depressing the red button on the mouse and then "dragging" the pointer or the bar to the desired position on the meter. The MeterController subclass methods send messages to the MeterVieww subclass indicating the cursor position and mouse button operations. The MeterView subclass uses information contained in these messages to control the meter display. In the MeterController subclass, the "controlActivity" method determines when the operator has pressed the red mouse button, determines the position of the cursor, and then sends cursor position information to an instance of the MeterView subclass. An "isControlActive" method determines if the meter controller has control and gives precedence to the blue mouse button which opens the view command menu 112 window of FIG. 3N. A "newValueSymbol:" method sets an instance variable (newValueSymbol) to indicate the name of the method of the view to be invoked to send the view the mouse cursor position, while a "newValueSymbol" method returns the value of this variable. A "menuMessageReceiver" method returns the virtual instrument to which this virtual front panel corresponds. A "redButtonMenu:redButtonMessages:" method returns an error message if an attempt is made to set up a menu for the red button, since that button is used to set a graph or a meter. The method structure of the Object subclass MeterScale is depicted in FIG. 5B. Meterscale instance methods calculate the position of a panel meter pointer or the bar on a bargraph meter. A meterScale subclass "LinScale" includes methods for calculating a pointer or bar position on a linear scale while another meterScale subclass "LogScale" includes methods for calculating a pointer or bar position on logarithmic scale. The displacement of an indicating pointer or bar along a meter scale is referenced as a "Scale" number while the magnitude of the parameter is referenced as a "Value" number. The MeterScale subclass includes a "scaleToValue:" method, a "valueToScale:" method, and a "resetConstant" method which all return a message indicating that these methods are a subclass responsibility. A "maxScale" method returns the value of the upper limit of a meter scale displacement while a "maxScale:" method sets the upper limit of the Scale number. Similarly, a "maxValue" and a "MaxValue:" method return and set the value of the corresponding upper Value number limit. The "minScale", "minScale:", "minValue", and "minValue:" methods are provided to return and set the lower limits for the Value and Scale numbers. The LinScale subclass of MeterScale instance methods includes a "scaleToValue:" method for returning the magnitude of a Value number corresponding a selected Scale number and a "valueToScale:" method for returning the magnitude of a Scale number corresponding to a selected Value number. A "conversionConstant" method returns a value of a conversion constant used by the "scaleToValue:" method and "valueToScale:" method. A "resetConstant" method is called to initially set the conversion constant to nil and the conversion constant is recalculated whenever the maximum or minimum value changes (e.g., when a value exceeds the maximum). The LogScale subclass of MeterScale has "conversionConstant", "resetConstant", "scaleToValue:" and "valueToScale:" instance methods which carry out functions similar to those of similarly named LinScale subclass methods but which are adapated to provide the proper conversions for logarithmic scales. The LogScale subclass also includes "maxValue:" and "minValue:" instance methods for setting the maximum and minimum parameter values. The methods override the similarly named methods in the MeterScale subclass. The method structure of the MeterView class is depicted in FIG. 5C. Each instance of a MeterView subclass controls the display of a virtual instrument front panel meter. An "initialize" method, called when a meter is initially created, associates the meter with the current Smalltalk project, selects a pen to be used for drawing the meter, and then calls a "forceFullDisplayNextTime" method which wipes out any data in an image cache. Thus, when the meter is subsequently drawn onto the screen the meter display must be reconstructed from the meter model and not from the cache. (A saved image of the meter face is used in preference to drawing the meter afresh whenever possible, for reasons of efficiency.) An "itemName:" method sets parameters for display of the meter name. A "maxValue" method and a "maxValue:" method return and set the maximum value of the parameter to be displayed on a meter while a "minValue" method and a "minvalue:" method return and set the minimum value of a number to be displayed. A "scale" method and a "scale:" method return and set the scale of the meter. A "display" method of the MeterView subclass is called to initiate the display of a meter. As discussed hereinabove, each parameter of each virtual instrument is associated with two parameter methods, one for returning the value of the parameter and one for setting the value of the parameter. A "valueAccessSymbol:" method sets a variable "valueAccess" to the name of a virtual instrument parameter method to return the value of the parameter. A "valueFromModel" method is called to invoke the parameter method of the virtual instrument to return the value of a parameter. The "valueFromModel" method tests for the need to extend, and extends if needed, the limits of the number which may be displayed by the meter when the value returned exceeds the current range of the meter. A "valueChangeSymbol:" method sets a "valueChange" variable to the name of the virtual instrument parameter method for setting the value of the parameter and a "valueChange" method sends a message to the virtual instrument invoking that parameter method thereby setting the parameter to a new value. When parameter values in a virtual instrument change, a single update message containing the "updateOn" variable as its argument may be sent to each MeterView instance controlling each meter associated with the instrument thereby updating each meter display. An "update:" method updates the meter display either based on the last known value of the parameter or by acquiring a new value from the virtual instrument depending on whether the "selfOrSymbol" argument references the meterview or is equal to an "updateOn" variable. An "updateSymbol:" procedure sets the "updateOn" variable. A single MeterView class procedure, "withScale:", is called to create a new instance of a meter with a scale (either linear or logarithmic) specified by the argument. In order to display the value of a parameter on a meter, it is necessary to convert that value to an equivalent position on the meter. In the case of a bargraph meter the equivalent position is found in terms of horizontal displacement between the maximum and minimum scale positions while in the case of a panel meter the equivalent position is found in terms of an angular displacement along the meter. In the "BarGraphView" subclass of Meterview a "displayView" instance procedure provides the detailed instructions for drawing a bar graph meter and makes use of the appropriate MeterScale procedures to convert parameter values into equivalent meter position. A "newValue:" method changes the parameter value displayed on a meter in response to a message from the meter controller indicating the location of the cursor on the meter when the operator is using the red mouse button to change the meter reading. An "initScale" method is provided to set the initial value of the scale minimum when the meter is initially created. The PanelMeterview subclass of MeterView includes a "displayView" instance method including instructions for drawing a panel meter and an "initScale" instance method which initially sets the minimum and maximum scale positions to -90 degrees and +90 degrees, respectively, thereby specifying a 180 degrees full range scale. A "new Value:" instance method sets the current value of a displayed parameter to the value indicated by the current cursor position on the meter when the operator is using the red button to set the parameter value. Once a virtual instrument class is synthesized according to the method described hereinabove the operator may create instances of the class which may be independently run to instruct the computer to perform a selected sequence of operations. In addition to utilizing a virtual instrument instance as an independent means to control computer operation, the operator may also utilize an instance of a synthesized virtual instrument for synthesizing other virtual instruments. For example, several instances of the synthesized gainmeter described hereinabove may be incorporated into a snythesized "frequency response" virtual instrument for measuring the frequency response of an amplifier wherein each instance of the gainmeter is utilized to measure amplifier gain at a different frequency. The measuredGain outputs of each gainmeter may then be displayed on a group of contiguous bargraph meters to form a frequency response curved. Therefore, the present invention provides a means for an operator to program a computer in a structured fashion by synthesizing a hierarchy of virtual machines with each successive virtual machine incorporating the functions of previously synthesized machines. The invention thus permits an operator not skilled in computer programming to create a virtual machine for performing a complex set of operations by first synthesizing and testing a set of less complex virtual machines for carrying out portions of the complex set of operations and then synthesizing the complex virtual machine based on the less complex machines. While the preferred embodiment of the present invention described hereinabove is adapted to produce software for use in conjunction with a computer-based instrument system, the present invention may be adapted to produce software for other applications including, but not limited to, instrumentation control and data processing applications. Therefore, while a preferred embodiment of the present invention has been shown and described, it will be apparent to those skilled in the art that many changes and modifications may be made without departing from the invention in its broader aspects. The appended claims are consequently intended to cover all such changes and modifications as fall within the true spirit and scope of the invention. ##SPC1##
|
Same subclass Same class Consider this |
||||||||||
