Modem test and measurement systems typically consist of various components. These components are generally software modules that are designed to perform specific measurements or sets of measurements. As needed by the system they are activated, perform their assigned tasks, and are then disposed of. The control of test and measurement components through-out their active lives, including any start-up and shutdown tasks is referred to as life-cycle management. Life-cycle management includes the overhead tasks of component creation and component setup, as well as performing its assigned tasks and then any clean-up and shut down processes. In other words, life-cycle management includes control of all aspects of the component from its creation to its disposal. Some mechanism is usually needed to prepare the components for the operations that they are to perform and then to clean up the system after the operations are finished. Traditionally, arranging for overhead functions to perform these setup and clean-up tasks has been left to the writer of that component. Leaving this responsibility fully in the hands of the component developer has resulted in the use of inconsistent mechanisms for this sort of overhead (life-cycle management). As such, the reusability of these components is limited. Further, if users of these components do not adhere to the conventions of each component, there is the risk that a component will not be correctly setup or shut down.
One means by which consistency could be assured is to build the life-cycle management into a base class of an object oriented program that all components used in the system build upon (inherit from). In generic component architectures like Microsoft's .NET framework, classes are permitted only one base class that they inherit from. This feature creates problems for users that wish to use base classes to standardize other aspects of their components. Another aspect of Microsoft .NET components is that they typically construct all the child objects they need in the initial constructor method for the class. However, to be a valid Microsoft .NET component, at least one form of the constructor must have no parameters, which means there is no opportunity to configure the component for the intended use, as might be the case with measurement components, where the exact instrument they are to control needs to be specified by the user of that component.
Current measurement component products such as National Instruments Measurement Studio provide limited aids for writing the construction aspects of those components, forcing the user of those components to understand and use the life-cycle model. Further, they do not break down the life-cycle of components to facilitate optimized usage of the components. Specialized languages like Agilent's VEE and National Instrument's LabView provide construction mechanisms that are not easily controlled or configured from outside those languages, and the resulting components are difficult to use with components built in other languages because LabView and VEE tend to manage their own instruments, making it difficult for components written in other languages to coordinate instrument use.
In a representative embodiment, a system for managing an instance of a software component for performing an operation are disclosed. The system includes a state machine and an interface. The state machine can be created via a request for activation of the instance by an application. The interface specifies conditions under which the state machine and a user of the instance interact. The state machine has a plurality of states, has capability to construct and dynamically configure system resources needed by the instance, has capability to automatically transition between and through states as required, has capability to ensure that the instance is in correct condition when it enters a given state, and has capability to appropriately reconfigure the system resources prior to destruction of the instance.
In another representative embodiment, a method for managing the instance of the software component for performing the operation are disclosed. The method includes requesting activation of the instance by an application, creating a state machine, and defining an interface. The interface specifies conditions under which the state machine and a user of the instance interact. When created the state machine has a plurality of states, has capability to construct and dynamically configure system resources needed by the instance, has capability to automatically transition between and through states as required, has capability to ensure that the instance is in correct condition when it enters a given state, and has capability to appropriately reconfigure the system resources prior to destruction of the instance.
Other aspects and advantages of the representative embodiments presented herein will become apparent from the following detailed description, taken in conjunction with the accompanying drawings.
The accompanying drawings provide visual representations which will be used to more fully describe various representative embodiments and can be used by those skilled in the art to better understand them and their inherent advantages. In these drawings, like reference numerals identify corresponding elements.
As shown in the drawings for purposes of illustration, representative embodiments disclosed herein provide novel systems and methods to manage the life-cycle of a measurement component instance. These systems and methods include a standard defined interface and a state machine. The method does not interfere with the component developer's preferred structure for the measurement component in terms of its set of methods and properties by virtue of the fact that an interface rather than the class definition itself is used to define the life-cycle methods and properties that are associated with the measurement component. The disclosed method provides for an extensible state machine that is associated with present implementations of the life-cycle interface. This state machine allows for the automatic transitioning from one state to another state in order to perform the requested tasks. Further, the state machine will automatically transition through intervening states prior to attaining a specified state. For instance if a measurement component instance needs a child component to perform a particular measurement that has not been created, calling for that measurement automatically results in the creation of that child component and the measurement instance passing through states which assemble the child component and complete configuration tasks prior to performing the measurement. In addition, in representative embodiments invalid operations of the measurement component based on its state can be disallowed.
The state machine implementation of the life-cycle interface is extensible in that changes in allowed states and allowed transitions are easily effected. Such changes occur so that users of the component do not have to be aware of the life-cycle aspect, but simply use the measurement component. The interface is the mechanism used by the user of the component instance to control that instance.
Previous techniques for control of the life-cycle of a test and measurement component have not provided this uniformity and control, nor have they provided for the automatic transitioning from a given state through intervening states to arrive at the correct state for a particular operation provided by the measurement component.
In the following detailed description and in the several figures of the drawings, like elements are identified with like reference numerals.
Characteristics of representative embodiments disclosed herein include: (1) an abstract life-cycle management interface definition that components can implement to advertise that they adhere to the conventions that interface implies without requiring a particular base class be used, (2) a base class containing an extensible state machine which automatically manages the life-cycle of the component, (3) base classes which use an equipment manager to obtain instrument driver objects to make them externally configurable, (4) more reusable measurements due to the component being configurable via an external equipment configuration store utilized by an equipment manager to provide instrument driver objects by name, (5) more reusable tests because creation of child measurement components are isolated in a component manager so the tests are more loosely coupled to those components and users of these tests can configure where and which child components are supplied to the test, (6) late construction of the component which enables configuration before construction of the component, (7) management of setup and cleanup processes for measurement and test components which enables an increased speed of operation, and (8) components which can be written in a variety of languages and used in applications written in the same or a different language.
Advantages of the disclosed representative embodiments include items as follows:
First, users of components don't have to address considerations of the life-cycle of the components. Users can begin using the components immediately as the life-cycle management state machine ensures they are in the correct state on first use. They don't have to worry about the connection to the instrument or the initialization of that instrument to have the measurement work correctly. Similarly, they don't have to worry about correct instrument shutdown after the measurement occurs;
Second, advanced users can configure the components after initially creating them to control the construction details of the component. For example, a user might create a measurement component, then set a property of that component to indicate which instrument that component should control. Thereafter, the component will use the correct driver object associated with the instrument.
Third, users can optimize speed of operation by executing the measurement repeatedly without redundant setup of the instrument involved, deferring instrument cleanup until all similar measurements are complete.
And fourth, component reuse is increased because the test and measurement components in representative embodiments can (a) self-manage their life-cycle without the knowledge of the component user, (b) provide a standardized way that components manage their life-cycle so that advanced users can configure and control them more easily, (c) obtain instrument driver objects by name from a configurable equipment manager, and (d) obtain other child components from a configurable component manager.
In representative embodiments, a standard system and method for managing the life-cycle of a measurement component instance is disclosed. The system comprises the following items:
First, a standard interface definition that components can implement to indicate they adhere to the life-cycle management standard of a representative embodiment.
Second, a state machine implementation that allows for dynamically adding states, defining and facilitating valid state transitions to other states. Each state is a class that indicates what other states it can transition to and implementing methods to make those transitions, when necessary. The underlying state machine manages the list of allowable states, tracks the current state of the component, and utilizes the individual state classes to effect transitions from one state to another, including automatically transitioning across multiple states when requested to transition from the current state to a state more than one state away from the current one. As discussed in the following paragraphs, the implemented state machine has separate states for managing the life-cycle. These states facilitate (a) assembling the child objects (like instrument driver objects) of components (assemble state), (b) setting up the instruments those components use (Setup state), (c) performing the measurement or test operation (Running state), (d) cleaning up instruments after all measurement or test operations are complete (Cleanup state), (e) indicating that an operation is complete (Stopped state), (f) indicating that an operation is paused (Paused state), (g) indicating that an operation error occurred (Error state), and (h) deconstructing the component (Disposing state).
Third, an equipment manager that facilitates specifying by name the instrument and software to use for a particular measurement. This equipment manager (a) creates and manages driver objects for instruments, (b) abstracts to a name the choice of which driver, which instrument, and which driver configuration to use, making measurement code more independent of the specific driver and instrument it utilizes, (c) can be extended to new driver families by creating a new adapter for each new family of drivers, rather than forcing each driver to be wrapped in some standard driver interface, (d) can be extended via adapters to obtain and store configuration information from a variety of storage locations and formats (example: custom XML file, IVI configuration server, or custom database), (e) facilitates multithreaded test and measurement execution by centrally managing locking of instrument driver object resources, and (f) provides a name-based catalog of available instrument drivers and sessions that facilitates writing the code to obtain a named driver object.
Fourth, a component manager that facilitates configuring the child components used by test and measurement components. The component manager (a) creates child component objects based on the type required, obtained from local or remote sources, optionally created in a separate Microsoft .NET application domain, (b) manages loading of user assemblies (DLL's) to permit component object creation and component cataloging, (c) provides a name-based catalog of available components to facilitate writing the code to obtain a component object, and (d) can be extended to other sources of assemblies and components via adapters.
And fifth, measurement component and test component base classes that utilize the state machine to implement an auto-transitioning version of the life-cycle interface. These components also utilize the equipment manager to obtain instrument driver objects and the component manager to obtain child components so that measurement components are more reusable because they can be externally configured regarding these details.
A component manager 225, shown in
An equipment manager 230, shown in
Also shown in
The state machine 205 and the interface 210 interact together to manage the instance 220 of the software component 215 for the purpose of performing an operation 240, as for example, a test or measurement operation. When a user of the component 215 uses interface 210 to interact with the component 215, the state machine 205 ensures the state of component 215 is appropriate for the requested operation, including automatically transitioning component 215 through multiple states if the method called on interface 210 requires a state different from the current state of component 215. The interface 210 specifies the mechanism under which users of the component 215 interact with the component 215. The implementation of interface 210 by component 215 utilizes the state machine 205 to ensure state-safe operation of component 215, i.e., that the component 215 is in the correct state when the user of the component 215 requests a particular operation.
The state machine 205 has a plurality of states which includes an unassembled state 510, also referred to herein as a start state 510, to which state the state machine 205 moves from the disposed condition 505 when the instance 220 is created.
The state of the state machine 205 moves from the unassembled state 510 to an assembled state 520 when information to configure the instance 220 and the information to select and acquire any needed system resources 250, including child components 222, driver instances, as well as other resources 250 becomes collected. System resource information could include, for example, the address of a memory device to be assigned for use by the instance 220 when created.
The state of the state machine 205 moves from the assembled state 520 to a setup state 530 when the instance 220 and any associated system resources become appropriately configured.
The state of the state machine 205 moves from the setup state 530 to a running state 535 when the instance 220 is used for its intended operation 240.
The state of the state machine 205 moves from the running state 535 to a stopped state 545 when performance of the operation 240 has been completed.
And, the state of the state machine 205 moves from the stopped state 545 to a cleaned up state 555 when appropriate condition modification of associated system resources 250 has been completed, wherein the instance 220 can become nonexistent, as indicated by the disposed condition 505 in
If when a request is made to perform the function of a particular state the component instance 220 is not in an adjacent state, the state machine 205 enables first transitioning automatically through any intervening states before reaching that particular state. For example, if the state of the instance 220 is not “setup” when the transition to “running” is requested by measurement component methods or the test component run( ) method but instead if the instance 220 is in the unassembled state 510, transition will first occur from the unassembled state 510 to the assembled state 520, then from the assembled state 520 to the setup state 530, and finally from the setup state 530 to the running state 535 in that order before the operation 240 associated with the run( ) method or measurement method can proceed. In this way, the user is assured that the instance 220 is always in the correct state prior to the performance of any function. The user is freed from activating the assemble and setup steps and only has to specify the desired measurement operation.
Also shown in
Other embodiments of the state machine 205 are also possible. In particular, the various additional paths, as for example, the transition from the assembling state 520 directly to the disposing state 560 is a transition which might not be found in other implementations. The various additional paths shown in
In block 810, the instance 220 is created. Block 825 then transfers control to block 830.
In block 815, the state machine 205 associated with the instance 220 is created by the instance 220. The state machine 205 comprises the start state 510, the assembled state 520, the setup state 530, the running state 535, the stopped state 545, and the cleaned up state 555. When created, the state machine 205 is in the start state 510. Block 815 then transfers control to block 820.
In block 820, the information to configure the instance 220 and the information to select and acquire any needed system resources 250, including child components 222, driver instances, as well as other resources 250 is collected. The state machine 205 moves from the start state 510 to the assembled state 520 when such information has been used to acquire the resources 250 needed by the instance 220. Block 820 then transfers control to block 825.
In block 825, the instance 220 and any associated system resources are setup. The state machine 205 moves from the assembled state 520 to the setup state 530 when the instance 220 and any associated system resources have been appropriately configured. Block 825 then transfers control to block 830.
In block 830, the operation 240 is performed. Performance of the operation 240 could be done only once or many times depending upon system needs. Block 830 then transfers control to block 835.
In block 835 the running of the instance 220 is stopped. The state machine 205 moves from the running state 535 to the stopped state 545 when performance of any and all operations 240 are completed. Block 835 then transfers control to block 840.
In block 840, the associated system resources 250 are cleaned up. The state machine 205 moves to the cleaned up state 555 from the stopped state 545 when such modification has been completed. Block 840 then transfers control to block 845.
In block 845, the instance, as well as the state machine, are disposed of.
As is the case, in many data-processing products, the systems described above maybe implemented as a combination of hardware and software components. Moreover, the functionality required for use of the representative embodiments may be embodied in computer-readable media (such as floppy disks, conventional hard disks, DVD's, CD-ROM's, Flash ROM's, nonvolatile ROM, and RAM) to be used in programming an information-processing apparatus (e.g., the computer 115 comprising the elements shown in
The term “program storage medium” is broadly defined herein to include any kind of computer memory such as, but not limited to, floppy disks, conventional hard disks, DVD's, CD-ROM's, Flash ROM's, nonvolatile ROM, and RAM.
The computer 115 can be capable of running one or more of any commercially available operating system such as DOS, various versions of Microsoft Windows (Windows 95, 98, Me, 2000, NT, XP, or the like), Apple's MAC OS X, UNIX, Linux, or other suitable operating system.
The representative embodiments can be advantageously implemented as an application program for a portable computer system. Such an application program can be written using a variety of programming languages and methodologies including Sun Microsystem's Java, Microsoft's Visual Basic, C/C++, Microsoft's C#, Microsoft's .NET assembler, or any other commercially-available programming tools.
Advantages of the disclosed representative embodiments include the following items: (14) users of components don't have to address considerations of the life-cycle of the components which includes considerations as to insuring that the system is in the correct state on first use (the state machine 205 automatically transitions through any intervening states before attaining the correct state), logical attachment to the instrument, initialization of the instrument, or correct instrument shutdown, (2) users can configure the components after initially creating them to control the construction details of the component, (3) users can optimize speed of operation by executing the measurement repeatedly without redundant setup of the instrument involved, deferring instrument cleanup until all similar measurements are complete, and (4) component reuse is increased.
Test and measurement components utilizing representative embodiments disclosed can (a) self-manage their life-cycle without the knowledge of the component user, (b) provide a standardized way that components manage their life-cycle so that advanced users can configure and control them more easily, (c) obtain instrument driver objects by name from a configurable equipment manager, and (d) obtain other child components from a configurable component manager.
The representative embodiments, which have been described in detail herein, have been presented by way of example and not by way of limitation. It will be understood by those skilled in the art that various changes may be made in the form and details of the described embodiments resulting in equivalent embodiments that remain within the scope of the appended claims.