The vague generalization of vector network analyzer data-switching and the implementation method of parallelization
Technical field
The present invention relates to the vector network analyzer field, relate in particular to the implementation method of vague generalization and the parallelization of vector network analyzer data-switching.
Background technology
Development along with science and technology, the hand-held vector network analyzer has become an important development direction of vector network analyzer, in the hand-held vector network analyzer, be subjected to the restriction of volume and power consumption, its computing velocity all can't be compared with large-scale desk-top vector network analyzer with memory headroom, so how to reduce the limitation of hardware to the impact of measuring accuracy and speed, make the maximizing performance of instrument at limited hardware resource, the problem that must consider when being exploitation hand-held vector network analyzer software in the machine.
The scheme of available data switch technology is as follows:
Design a mapping table, be used to specify the corresponding relation between graphical format and the coordinate conversion function; Then by current graphical format, the function of tabling look-up and obtaining being correlated with is converted to measurement data the logical coordinates point again; Call at last the graphic plotting function, the logical coordinates point is updated on the screen.
Its weak point has 2 points:
First, underaction, compatible low, although using mapping table to be better than, prior art uses the switch-case structure, but still belonging to a kind of program architecture of manual control process---it need to increase judges that statement selects correct coordinate conversion function, because the graphical format of vector network analyzer is very many, and may increase new graphical format at any time, the implementation method of the current techniques underaction that just seems, backward compatible low.
The second, real-time is low, and it is that order is carried out after coordinate conversion that trace is drawn, and has taken the time that data are processed.
Summary of the invention
In view of this, in order to improve software vector and complete machine real-time, the present invention improves the design of data conversion, and a kind of implementation method of vague generalization and parallelization of vector network analyzer data-switching is provided.
The present invention realizes like this, a kind of vague generalization of vector network analyzer data-switching and the implementation method of parallelization, adopt multithreading to carry out data processing and data demonstration, described multithreading comprises scanning thread and drawing thread, in the described scanning thread, transform coordinate by calling Virtual Function, make the coordinate transformation vague generalization of various graphics class, simultaneously, data after the coordinate transformation directly enter the drawing thread, reaching image shows, in described scanning thread, a coordinate conversion Virtual Function is set comes unified interface, make the conversion process vague generalization of the coordinate of data under multiple graphical format, in the figure base class, described Virtual Function is pure virtual function, is used for the IO interface of this function of definition, in the figure base class in the derivative concrete graphics class, characteristic according to figure realizes design accordingly to described Virtual Function, and described realization designs concrete vague generalization mode and is:
Implementation for the polar coordinate system figure is:
The polar coordinate system figure comprises Smith circle diagram and polar plot, and their coordinate conversion mode is identical, the corresponding X coordinate of the real part of the complex data that measurement data is corresponding, and the corresponding Y coordinate of imaginary part, so this function can be realized in polar coordinates figure class;
Implementation for the cartesian coordinate system figure is:
The cartesian coordinate system figure comprises the graphical formats such as logarithm amplitude, linear amplitude, phase place, standing-wave ratio (SWR), under these graphical formats, although the result of coordinate conversion is different, but can possess unified transfer process: at first the frequency values with analyzing spot is mapped to the X coordinate, measured value with analyzing spot is converted to a real number value again, at last this real number value is mapped to the Y coordinate;
It is different because of concrete graphical format to only have measured value to turn real number value in the said process, the present invention with extracting section identical in the cartesian coordinate system figure coordinate transfer process out, use the rank and file's function in the cartesian coordinate system graphics class to realize, Virtual Function is continued to adopt in different places, in cartesian coordinate system, the mode of rank and file's function that the Virtual Function of coordinate conversion can be by successively being decomposed into some cartesian coordinate system graphics class and the combination of a Virtual Function realizes.
In the scanning thread, use the pointer of a figure base class type, in fact this pointer points to current graphical format object, uses the coordinate conversion Virtual Function in this pointer invocation step 1, the raw data that data acquisition is obtained is converted to coordinate data, and it is write the critical section.
The drawing thread regularly reads the coordinate data of critical section, and carries out graphic plotting, and described coordinate data is presented on the screen by graphic plotting.
Further, the present invention is based on hardware platform is ARM920T CPU, and CPU frequency is 200MHz, has 32MB RAM and 32MB FLASH, and software platform is Windows CE4.2 operating system.
Further, graphic plotting in coordinate conversion in the described scanning thread and the described drawing thread is the interface function of graphics class, point to the object of current figure with the type pointer of a figure base class, come the calling interface function by this pointer, according to the character of Virtual Function, the concrete form of function will the graph style by the pointer indication determine in the program runtime.
Further, described scanning thread and drawing thread are two independently processing procedures, and the read-write operation of the coordinate points data that both share is all carried out in the critical section.
Further, described figure base class comprises its derivative polar coordinate system figure and cartesian coordinate system figure, described polar coordinate system figure comprises its derivative polar coordinates and Smith figure, and described cartesian coordinate system figure comprises its derivative logarithm amplitude profile, linear amplitude figure, phase graph, standing-wave ratio (SWR) figure.
The advantage of the vague generalization of vector network analyzer data-switching provided by the invention and the implementation method of parallelization is: process coordinate conversion by Virtual Function, coordinate conversion had unified treatment step under the multiple graphical format of vector network analyzer, if increase new graphical format, also only need new graphics class and the coordinate conversion Virtual Function thereof of design to get final product, needn't change the overall architecture of software, so that programmed control reduces human intervention, promote greatly the maintainable and compatible of software.
Be specifically designed to drafting trace and other mapping operations by creating a drawing thread, it no longer is that order is carried out that coordinate conversion and trace are drawn.The data processing time of complete machine will shorten, thereby has improved real-time.
By the critical section is set coordinate data is protected, because scanning thread and drawing thread all relate to coordinate data, the read-write operation of any coordinate data is all carried out in the critical section, has improved data security.
Description of drawings
Fig. 1 is the multi-thread design schematic diagram of the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization.
Fig. 2 is the general principle of operation figure of coordinate conversion of the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization.
Fig. 3 is the implementation schematic diagram of coordinate conversion Virtual Function under the cartesian coordinate system in the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization.
Fig. 4 is the graphics class structural drawing in the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization.
Fig. 5 is implementation method and the sweep time comparative analysis figure of prior art take millisecond as unit of vague generalization and the parallelization of vector network analyzer data-switching of the present invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
See also Fig. 1, Fig. 2 and Fig. 3, wherein Fig. 1 is the multi-thread design schematic diagram of the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization, Fig. 2 is the general principle of operation figure of coordinate conversion of the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization, and Fig. 3 is the implementation schematic diagram of coordinate conversion Virtual Function under the cartesian coordinate system in the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization.
It is ARM920T CPU that the vague generalization of described vector network analyzer data-switching and the implementation method of parallelization are based on hardware platform, and CPU frequency is 200MHz, has 32MB RAM and 32MBFLASH, and software platform is Windows CE4.2 operating system.
The vague generalization of described vector network analyzer data-switching and the implementation method of parallelization adopt multithreading to carry out the data processing and data show, described multithreading comprises scanning thread and drawing thread, in the described scanning thread, transform coordinate by calling Virtual Function, make the coordinate transformation vague generalization of various graphics class, simultaneously, the data after the coordinate transformation directly enter the drawing thread, reach image and show that its key step is as follows:
Step 1: in described scanning thread, a coordinate conversion Virtual Function is set comes unified interface, make the conversion process vague generalization of the coordinate of data under multiple graphical format, in the figure base class, described Virtual Function is pure virtual function, is used for the IO interface of this function of definition, in the figure base class in the derivative concrete graphics class, characteristic according to figure realizes design accordingly to described Virtual Function, and described realization designs concrete vague generalization mode and is:
Implementation for the polar coordinate system figure is:
The polar coordinate system figure comprises Smith circle diagram and polar plot, and their coordinate conversion mode is identical, the corresponding X coordinate of the real part of the complex data that measurement data is corresponding, and the corresponding Y coordinate of imaginary part, so this function can be realized in polar coordinates figure class;
Implementation for the cartesian coordinate system figure is:
The cartesian coordinate system figure comprises the graphical formats such as logarithm amplitude, linear amplitude, phase place, standing-wave ratio (SWR), under these graphical formats, although the result of coordinate conversion is different, but can possess unified transfer process: at first the frequency values with analyzing spot is mapped to the X coordinate, measured value with analyzing spot is converted to a real number value again, at last this real number value is mapped to the Y coordinate;
It is different because of concrete graphical format to only have measured value to turn real number value in the said process, the present invention with extracting section identical in the cartesian coordinate system figure coordinate transfer process out, use the rank and file's function in the cartesian coordinate system graphics class to realize, Virtual Function is continued to adopt in different places, in cartesian coordinate system, the mode of rank and file's function that the Virtual Function of coordinate conversion can be by successively being decomposed into some cartesian coordinate system graphics class and the combination of a Virtual Function realizes;
Step 2: in the scanning thread, use the pointer of a figure base class type, in fact this pointer points to current graphical format object, uses the coordinate conversion Virtual Function in this pointer invocation step 1, the raw data that data acquisition is obtained is converted to coordinate data, and it is write the critical section;
Step 3: the drawing thread regularly reads the coordinate data of critical section, and carries out graphic plotting, and described coordinate data is presented on the screen by graphic plotting.
Graphic plotting in coordinate conversion in the described scanning thread and the described drawing thread is the interface function of graphics class, point to the object of current figure with the type pointer of a figure base class, come the calling interface function by this pointer, character according to Virtual Function, the concrete form of function will the graph style by the pointer indication determine in the program runtime, described scanning thread and drawing thread are two independently processing procedures, and the read-write operation of the coordinate points data that both share is all carried out in the critical section.
See also Fig. 4, Fig. 4 is the graphics class structural drawing in the implementation method of the vague generalization of vector network analyzer data-switching of the present invention and parallelization.
Described figure base class comprises polar coordinate system figure and cartesian coordinate system figure, and described polar coordinate system figure comprises polar coordinates and Smith figure, and described cartesian coordinate system figure comprises logarithm amplitude profile, linear amplitude figure, phase graph, standing-wave ratio (SWR) figure.
See also Fig. 5, Fig. 5 is vague generalization and the implementation method of parallelization and the comparative analysis sweep time figure take millisecond as unit of prior art of vector network analyzer data-switching of the present invention.
In practical operation, draw in the correlation data to prior art and sweep time of the present invention, number of scan points is fewer, and the lifting of the real-time performance that the present invention brings is more remarkable, has improved the real-time of overall measurement.
In sum, process coordinate conversion by Virtual Function, coordinate conversion had unified treatment step under the multiple graphical format of vector network analyzer, if increase new graphical format, also only need new graphics class and the coordinate conversion Virtual Function thereof of design to get final product, needn't change the overall architecture of software, so that programmed control reduces human intervention, promote greatly the maintainable and compatible of software.
Be specifically designed to drafting trace and other mapping operations by creating a drawing thread, it no longer is that order is carried out that coordinate conversion and trace are drawn.The data processing time of complete machine will shorten, thereby has improved real-time.
By the critical section is set coordinate data is protected, because scanning thread and drawing thread all relate to coordinate data, the read-write operation of any coordinate data is all carried out in the critical section, has improved data security.
The above only is preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.