Method and system for obtaining linear modelTechnical Field
The invention belongs to the technical field of software simulation modeling, and particularly relates to a method and a system for acquiring a linear model.
Background
Nowadays, early prototype verification of electronic circuit systems is increasingly separated from software simulation links, and simulation can find defects in design in the early stage and can control overall trend of design objects. However, the acquisition of a part of simulation models is always a difficult problem, and some chips (mainly devices such as radio frequency devices and operational amplifiers) do not provide complete model curves, such as only providing amplitude-frequency response curves without phase-frequency response curves, or providing contradiction between amplitude-frequency response curves and phase-frequency response curves, and the models may contain unwanted noise. These incomplete models or models containing erroneous information can lead to unreasonable results in the simulation, misleading the design direction.
The patent discloses a simulation modeling method based on pattern matching recognition, which comprises the steps of obtaining configuration information of drawings in a source file in a first format, wherein the configuration information comprises line segment information and text information, generating a redrawing picture and a mapping table according to the obtained configuration information, wherein the redrawing picture comprises a drawing library formed by line segments, connecting line segments between the drawing libraries, the mapping table comprises mapping relations between text content, the line segments and position coordinates of the line segments, recognizing the drawing library types in the redrawing picture, the attributes of the connecting line segments and the parameter attributes in the mapping table according to a preset characteristic information library, converting the recognized drawing library types, the attributes of the connecting line segments and the parameter attributes into simulation model files, and importing the simulation model files into simulation modeling software to generate an executable simulation model. The disadvantage of this patent is that while effective in providing modeling efficiency, the overall modeling accuracy is generally.
In another example, chinese patent application CN202110115835.1, publication day 2021, 6 and 18, discloses a packaging model for improving DDR simulation accuracy, which includes a resistor R and a transmission line model with an impedance Z and a delay TD, where the resistor R and the transmission line model are connected in series. The invention utilizes the RLC parameters of the existing main chip simulation model to correct, and concatenates the original resistance to obtain the corrected packaging model, and the corrected packaging model simulates a group of data signals of the DDR system to obtain a simulation result which is consistent with the test result. The disadvantage of this patent is that although the accuracy is improved, the process is complex and the cost is high.
Disclosure of Invention
1. Problems to be solved
Aiming at the problems of inaccurate and low efficiency of the existing simulation modeling, the invention provides a method and a system for acquiring a linear model. According to the method, whether the phase frequency curve in the original picture is missing or not is judged through detecting the original picture, if the phase frequency curve is missing, the phase frequency curve is recovered in a reasonable mode, and if the phase frequency curve is not missing, curve sampling is carried out, so that the integrity and the accuracy of final model establishment are ensured, and the problem that the design direction is inaccurate due to the fact that an unreasonable result is brought to simulation in the follow-up process is avoided. The system of the invention executes corresponding functions through each module, has simple structure and easy construction, improves the whole automation degree and greatly improves the working efficiency.
2. Technical proposal
In order to solve the problems, the invention adopts the following technical scheme.
A method of linear model acquisition, comprising the steps of:
S1, obtaining an original picture with an original model curve;
S2, detecting an original picture, and judging whether an original curve in the original picture comprises an amplitude frequency curve and a phase frequency curve at the same time;
S3, if the original curve comprises an amplitude frequency curve and a phase frequency curve at the same time, identifying the original picture to obtain the original curve, sampling points on the original curve, and then creating a complete model;
s4, if the original curve only comprises a phase frequency missing curve of the amplitude-frequency curve, recovering the phase frequency curve to obtain a complete curve, sampling points on the complete curve, and then creating a complete model;
S5, generating the generated complete model into a model format for the recognition of the mainstream simulation tool for subsequent simulation operation.
Still further, the method further includes a preprocessing operation for the original picture before step S2, where the preprocessing operation includes interference removal, noise reduction and sharpening of the original picture.
Furthermore, when the sampling is performed in the step S3 or the step S4, the error between the sampling curve formed by the sampling points and the original curve is used to determine the sampling density.
In step S4, when the energy of the high frequency part becomes non-negligible to the simulation of the system, if the energy of the high frequency part is more than 10%, the phase frequency curve is recovered by using a rational polynomial.
Further, the specific formula of the rational polynomial is as follows:
sij represents the energy transfer coefficient from the j port to the i port, and dij represents a constant term;
pij,n are poles conjugated to each other,And rij,n are mutually conjugated molecular coefficients, tij is a delay constant, and s is a Lawster character.
Furthermore, when an amplitude frequency curve and a phase frequency curve exist at the same time, the two curves are detected, whether the two curves meet the causal corresponding relation is detected, and if the causal corresponding relation is not met, correction processing is carried out.
A system of a method of using a linear model acquisition as claimed in any one of the preceding claims, comprising:
The picture acquisition module is used for acquiring an original picture;
the detection module is used for judging whether the original picture simultaneously comprises an amplitude frequency curve and a phase frequency curve;
the recovery module is used for recovering the phase frequency curve;
The identification module is used for identifying the curve;
the sampling module is used for sampling on the curve;
The creation module is used for creating a complete model;
and the format conversion module is used for carrying out format conversion on the complete model.
Furthermore, the system also comprises an alarm module for monitoring and timely early warning the working state of each module.
3. Advantageous effects
Compared with the prior art, the invention has the beneficial effects that:
(1) According to the method, whether the phase frequency curve in the original picture is missing or not is judged by detecting the original picture, if the phase frequency curve is missing, the phase frequency curve is recovered in a reasonable mode, and if the phase frequency curve is not missing, curve sampling is carried out, so that the completeness and the accuracy of final model establishment are guaranteed, the problem that the design direction is inaccurate due to the fact that an unreasonable result is brought to simulation in the follow-up process is avoided;
(2) In addition, when curve point sampling is carried out, judgment of sampling density degree is carried out through errors, resource waste caused by excessive increase of the calculated amount of sampling is avoided, and inaccurate results are caused by the fact that details are lost easily due to too little sampling, so that judgment of the density degree is carried out reasonably, and the accuracy is ensured while the sampling amount is ensured;
(3) The invention ensures the accuracy of the recovery of the phase frequency curve by recovering different phase frequency curves of different devices, provides an accurate basis for the subsequent modeling, increases and detects whether the two curves meet causal corresponding operation and do not meet the correction when the amplitude frequency curve and the phase frequency curve exist, further avoids the occurrence of the condition that the amplitude frequency curve and the phase frequency curve contain unnecessary noise or have contradiction, further improves the accuracy of the subsequent modeling, and ensures the smoothness and the accuracy of the subsequent simulation process;
(4) The system of the invention executes corresponding functions through each module, has stable work, no mutual influence, simple structure and easy construction, greatly improves the overall automation degree by the arrangement of each module, greatly improves the working efficiency and reduces the investment of labor cost, monitors and early warns the working states of other modules in real time by introducing the alarm module, improves the timeliness of the whole process, ensures that staff can correspondingly adjust in time when the system is damaged, and ensures the working safety and stability of the whole system.
Drawings
FIG. 1 is a schematic diagram of a coordinate system;
FIG. 2 is a schematic flow chart of the present invention;
FIG. 3 is a schematic flow chart of another embodiment of the present invention.
Detailed Description
The invention is further described below in connection with specific embodiments and the accompanying drawings.
It is explained here that, in general, the creation of a device model in an electronic circuit generally depends on a device manufacturer providing a model curve, and when the device manufacturer does not provide the model curve or the model curve is incomplete, the subsequent simulation process cannot be performed accurately, and the present application is based on the explanation in this case.
Example 1
As shown in fig. 1, 2 and 3, a method for obtaining a linear model includes the following steps:
S1, acquiring an original picture with a model original curve, wherein the original picture can be acquired from a device manufacturer or other data manuals, and the original picture contains the original curve of the device model.
And S2, detecting the original picture, judging whether the original curve in the original picture comprises an amplitude frequency curve and a phase frequency curve, and in order to detect the integrity of the original picture, carrying out different follow-up operations according to different conditions of the original picture conveniently, so that the working efficiency is greatly improved.
S3, if the original curve comprises an amplitude frequency curve and a phase frequency curve, namely, a representative original curve is complete, at the moment, the original picture is identified to obtain the original curve, the identification comprises a coordinate of the original curve, generally a rectangular coordinate system, namely, the abscissa of the original curve is identified to obtain physical quantities respectively represented by the abscissa, when the original curve is identified by a false identification mode, the accuracy of identification can be ensured, meanwhile, the points on the original curve are sampled to obtain a plurality of data points, the data points are stored according to a certain format and used for creating a complete model later, specifically, each data point comprises an abscissa value, a certain point on the abscissa or the ordinate is selected after the abscissa is identified, the value of the corresponding ordinate or the abscissa is read out corresponding to the original curve, or the position of the original curve in the original picture is defined as a target area, the original curve in the target area is used for reflecting the information of a specified type parameter, the coordinates of the selected pixel point in the target area are then determined, and the coordinate value of the selected pixel point is also determined based on the coordinate value of the specified type parameter and the coordinate value of the pixel point is also related to the selected pixel value. Of course, since there are many ways of sampling data of an image, it is common in the prior art, and the core creation point of the present application is not involved, so detailed description thereof will not be repeated.
S4, if the original curve only comprises the phase frequency missing curve of the amplitude-frequency curve, recovering the phase frequency curve to obtain a complete curve, sampling points on the complete curve, wherein the specific sampling steps are consistent with those in the step S3, and then creating a complete model. Specifically, the method for recovering the phase frequency curve by utilizing the model of a naturally-occurring device does not necessarily violate the causality principle, and mainly comprises two types, namely, the method for recovering the phase frequency curve by utilizing the principle that the model must meet causality is obtained by Hilbert transformation from the amplitude frequency curve, and the method for recovering the phase frequency curve by utilizing the natural causality polynomial to fit the amplitude frequency, wherein the by-product is the phase frequency curve. Of course, the recovery of the phase frequency curve should be performed in different manners specifically for different situations, so as to ensure the accuracy of recovery. In this embodiment, when the device with more than 90% of energy concentrated at low frequency is recovered by using hilbert transform, the specific formula of hilbert transform is as follows:
Wherein: The method is characterized in that the method comprises the steps of (a) representing a transformed function, x (t) representing an original function, τ being an integral variable, [ H ] representing a Hilbert transform operation function, and recovering a phase frequency curve by adopting a rational polynomial when energy distributed in a high-frequency part becomes inadvisable to simulation of a system, for example, when the energy distributed in the high-frequency part is more than 10%, wherein the specific formula of the rational polynomial is as follows:
sij represents the energy transfer coefficient from the j port to the i port, and dij represents a constant term;
pij,n are poles conjugated to each other,And rij,n are mutually conjugated molecular coefficients, tij is a delay constant, and s is a Lawster character. The step ensures the accuracy of the recovery of the phase frequency curve by recovering different phase frequency curves of different devices, and provides an accurate basis for the subsequent modeling.
And S5, generating a model format for the main stream simulation tool to recognize for the subsequent simulation operation, specifically, generating different complete models according to the fitted object, generating model formats of different formats, such as discrete data points, S parameters, a spice netlist and the like, selecting the S parameters and the spice netlist if the model is a radio frequency device, selecting the spice netlist to describe a transfer function if the model is an operational amplifier or some other linear device system, and specifically analyzing the specific situation.
According to the method, whether the phase frequency curve in the original picture is missing or not is judged through detecting the original picture, if the phase frequency curve is missing, the phase frequency curve is recovered in a reasonable mode, and if the phase frequency curve is not missing, curve sampling is conducted, so that the completeness and accuracy of final model establishment are guaranteed, the problem that the design direction is inaccurate due to the fact that an unreasonable result is brought to simulation in the follow-up process is avoided, the whole method is simple and convenient to operate, different conditions correspond to different operations through the added detection steps, the accuracy of model establishment is guaranteed, meanwhile, the working efficiency is improved, and the problem of inaccuracy of modeling under the condition that the original curve is incomplete in the past is effectively solved. And the method effectively avoids the response scheme when a manufacturer does not provide a model, reduces the dependence on the outside, and has wide application prospect.
Example 2
The method is basically the same as embodiment 1, specifically, the method further includes performing a preprocessing operation on the original picture before step S2, where the preprocessing operation includes interference removal, noise reduction and sharpening on the original picture, and since the original picture may be affected when being uploaded, or shadows or stains in the original picture and various changes of coordinate axes occur in the photographing process, the original picture is subjected to a preprocessing process, and noise reduction is performed on the original picture, so that the calculation amount of the subsequent original picture is reduced, the working efficiency is effectively improved, and error interference is reduced, and then the accuracy of the subsequent operation is improved.
Meanwhile, in this embodiment, when sampling is performed in step S3 or step S4, the error between the sampling curve formed by the sampling points and the original curve is used to determine the sampling density. In order to avoid the problem of inaccurate results caused by too much sampling and loss of details when the calculation amount is increased and the resource waste is caused during sampling, a judgment index of the degree of density is introduced, and the accumulated error representation of a curve formed by sampling points and an original curve is specifically adopted for writingWhen the accumulated error is maintained within a certain range, the sampling quantity can be indicated to meet the requirement, the sampling is not performed any more, and the accuracy is ensured while the sampling quantity is reasonably ensured. Specific range values can be obtained empirically, and are not specifically limited in this embodiment depending on the circumstances.
Furthermore, in this embodiment, a correction process is added, that is, when an amplitude-frequency curve and a phase-frequency curve exist at the same time, the two curves are detected, whether the two curves satisfy the causal correspondence is detected, and if the causal correspondence is not satisfied, correction is performed. At present, the causal correction method of the model mainly comprises the following steps of (1) carrying out detection and correction by utilizing the fact part and the imaginary part of the model to meet the Hilbert transformation, wherein the model has limited bandwidth and cannot strictly meet the Hilbert transformation, and (2) carrying out fitting on the existing curve by utilizing a rational compression technology and utilizing a causal polynomial. The amplitude frequency curve and the phase frequency curve which exist simultaneously are correspondingly detected, so that the occurrence of the situation that the amplitude frequency curve and the phase frequency curve contain unnecessary noise or have contradiction is further avoided, the accuracy of subsequent modeling is further improved, and the smoothness and the accuracy of the subsequent simulation process are ensured.
Example 3
A system using a linear model acquisition method as in any one of embodiments 1-2 above, comprising a picture acquisition module for acquiring an original picture and performing a preprocessing process on the original picture to reduce errors caused by the original picture on subsequent operations, a detection module for judging whether the original picture includes an amplitude frequency curve and a phase frequency curve at the same time, a recovery module for recovering the phase frequency curve, a recognition module for recognizing the curve, wherein the recognition curve is used for recognizing a complete curve, that is, includes the amplitude frequency curve and the phase frequency curve, a sampling module for sampling the complete curve, and a creation module for creating the complete model, and a format conversion module for performing format conversion on the complete model. The system of the invention executes corresponding functions through each module, has stable work, no mutual influence, simple structure and easy construction, greatly improves the overall automation degree by setting each module, greatly improves the working efficiency, reduces the investment of labor cost, ensures the integrity and the accuracy of the final model establishment, and avoids the problem of inaccurate design direction caused by unreasonable results brought to simulation in the follow-up process.
Meanwhile, the system also comprises an alarm module which is used for monitoring and timely early warning the working state of each module, and the working state of each other module is monitored and early warned in real time by the introduction of the alarm module, so that the timeliness of the whole process is improved, the timely corresponding adjustment of staff when the system is damaged is ensured, and the working safety and stability of the whole system are ensured.
The examples of the present invention are merely for describing the preferred embodiments of the present invention, and are not intended to limit the spirit and scope of the present invention, and those skilled in the art should make various changes and modifications to the technical solution of the present invention without departing from the spirit of the present invention.