The system and method that sample circuit in circuit board is calibrated automatically
Technical field
The present invention relates to the automatic calibration field of sample circuit in circuit board, it is specifically related to sample in a kind of pair of circuit board
The system and method that circuit is calibrated automatically.
Background technique
Power consumption is a crucial parameter for power supply design even board-level circuit design, usually by using single in circuit
The power sensing of a power rail namely the voltage measurement at sampling resistor both ends, carry out calculating current, to calculate power consumption indirectly.This
A little voltage measurements are carried out using onboard micro-control unit and analog to digital conversion circuit.Sampling electricity in the circuit board being calibrated
Road includes sampling resistor and its circuit for being connected to MCU (Micro Control Unit, micro-control unit), is adopted in usual circuit
Sample resistance both ends connect difference operational amplifying circuit or ADC (Analog-Digital Converter, analog-digital converter), difference amplifier
The voltage analog signal at sampling resistor both ends is converted into digital signal and is sent to MCU by circuit or modulus switching device (ADC).It is logical
The voltage at digitized sampling resistance both ends is crossed, the voltage of power rail and its electric current can be computed where sampling resistor, this
The power consumption of road power supply is also just calculated.But pass through the survey calculation value of sample circuit, often there are gap, mesh with true value
It is preceding also to rarely have the system schema that the circuit for application sample resistance in actual circuit plate is calibrated automatically.
The patent application retrieved at present is mostly using special calibration circuit in entire circuit, to realize that error is mended
It repays, and both for each specific application, the calibration circuit in these patent applications is realized complicated, many kinds of, does not have
There is versatility, increase Material Cost, while new error may also be brought, suitable for application in the electricity of multiple power supply tree networks
On the sample circuit of road plate.
Some schemes use power supply for 1 ampere of constant-current supply, and surveyed sampling resistor resistance is determined by LED light instruction
The deviation situation of value, there is no the tests and calibration that are carried out under different voltages electric current to the sample circuit in circuit board, cannot be right
Sample circuit carries out program upgrading and improves the measurement precision of the voltage and current power consumption in circuit.
Scheme also only passes through the data of two points, using y=kx+b once linear function, obtains calibration parameter, number
Inaccurate according to handling, correlation and fitting degree are not able to satisfy on circuit board that different electrical power road exists in different electrical power tree network
Voltage, electric current and power consumption number under certain loads obtain precise measurement requirement.
The measurement point data chosen in existing automatic calibrating method is on the low side, can only simple computation go out calibration parameter, and it is existing
Other circuits that attached component forms are generallyd use by the calibration of sample circuit in circuit board and carry out error compensation, it is difficult to is full
The calibration accuracy of sample circuit in sufficient circuit board.
Summary of the invention
The purpose of the invention is to overcome the shortcomings of above-mentioned background technique, provide in a kind of pair of circuit board sample circuit from
The system and method for dynamic calibration, can rapidly and accurately complete the upgrading calibration of sample circuit in circuit board, improve circuit
The accuracy that sample circuit is calibrated in plate.
The present invention provides the system that a kind of pair of sample circuit is calibrated automatically, and the sample circuit in circuit board includes microcontroller list
First MCU, sampling resistor, the system include that PC control terminal, programme-controlled dc power, voltage collecting device, DC electronic are negative
It carries, voltage collecting device is connected to the both ends of the sampling resistor of sample circuit, sends PC control for measurement data in real time
Terminal;PC control terminal centralized control calibration process, after preset data times of collection data acquisition,
Data analysis is carried out according to specified algorithm, automatically generates the report of error compensation, the MCU of sample circuit in circuit board is carried out
Program upgrading, completes the calibration of sample circuit.
Based on the above technical solution, the PC control terminal sends program-controlled direct current at the appointed time
Source, voltage collecting device and DC Electronic Loads parameter, and trigger these measuring devices, open primary calibration movement;It is each to survey
The data measured are returned to PC control terminal by the MCU of sample circuit in real time in amount equipment and circuit board.
Based on the above technical solution, the data of each calibration actions are collected and recorded to PC control terminal, choosing
Suitable calibration strategy is taken, error analysis and compensation is carried out, result is updated to the program of the MCU of sample circuit into circuit board
In.
Based on the above technical solution, the PC control terminal is uniformly coordinated, and programme-controlled dc power is arranged
The load of output and DC Electronic Loads, and the voltage at sampling resistor both ends is measured;After the completion of primary connection, host computer
Controlling terminal carries out multiple data acquisition by default, and after the completion of all data acquisitions, PC control terminal provides many algorithms
Carry out data analysis, a key generate multiple format comprising voltage and current value, performance number, error compensation value data sheet, into
The calibration to sample circuit is completed in the upgrading of the MCU program of sample circuit in row circuit board.
Based on the above technical solution, the algorithm that the PC control terminal provides includes once linear, second order
Multinomial, exponential function, rolling average fitting algorithm, PC control terminal make calibration curve and error compensation, and with most
Small square law is basic norm, calculates the related coefficient and mean square error of every kind of algorithm, is made to the fitting degree of algorithms of different
Compare, selects for the most accurate fitting algorithm of sample circuit.
The method that sample circuit in circuit board is calibrated automatically based on above system that the present invention also provides a kind of, including with
Lower step:
PC control terminal, programme-controlled dc power, voltage collecting device and DC Electronic Loads are connected with system bus,
Sampling resistor both ends in the sample circuit of circuit board are connected into voltage collecting device, cable one is terminated into programme-controlled dc power,
Another termination DC Electronic Loads;
Each instrument and equipment is opened, PC control terminal is started, sets relevant parameter;
PC control terminal centralized control calibration process, according to preset data times of collection data acquisition
Afterwards, power consumption number is calculated, data analysis is carried out according to specified algorithm, the report of error compensation is automatically generated, in circuit board
The MCU of sample circuit carries out program upgrading, completes the calibration of sample circuit.
Based on the above technical solution, the process of the data acquisition are as follows:
The pulling load current of the output voltage of PC control terminal control programme-controlled dc power, DC Electronic Loads, according to
Preset data times of collection obtains voltage value, current value, power consumption number from the MCU of sample circuit, from voltage collecting device
Voltage value is read, reads current value from programme-controlled dc power.
Based on the above technical solution, when carrying out data analysis according to specified algorithm, the PC control is whole
The algorithm that end provides includes once linear, second order polynomial, exponential function, rolling average fitting algorithm, PC control terminal
Make calibration curve and error compensation, and using least square method as basic norm, calculate every kind of algorithm related coefficient and
Square error makes comparisons to the fitting degree of algorithms of different, selects for the most accurate fitting algorithm of sample circuit.
Based on the above technical solution, this method is further comprising the steps of: upper when starting PC control terminal
Machine controlling terminal carries out System self-test, sends instructions to each instrument and equipment of connection on the system bus, receives each instrument
The information that device equipment returns, detection system connectivity judge whether whole system is ready to complete.
Based on the above technical solution, when starting PC control terminal, following relevant parameter is set: measurement model
It encloses, resolution ratio, test step-length, up-down stroke selection, cycle-index.
Compared with prior art, advantages of the present invention is as follows:
PC control terminal in the present invention will be in all appts equipment and circuit board to be calibrated by system bus
Sample circuit forms specific loop, connects, one-key start and operation, realizes that the collection of data in calibration process, selection are closed
Suitable algorithm, and for the needs of the sample circuit in actual circuit plate, it obtains calibration curve and error compensation data, generates report
Table carries out error analysis and compensation, extracts corresponding error compensation data table in report, pass through PC control terminal downloads
To the micro-control unit MCU of sample circuit, program upgrading is carried out, rapidly and accurately completes the upgrading school of sample circuit in circuit board
Quasi- work, other circuits that the calibration with sample circuit in available circuit plate generallys use attached component composition carry out error
Compensation is compared, and the present invention is advantageously implemented the accurate measurement of the parameters such as electric current, power, can be improved sample circuit school in circuit board
Quasi- accuracy.
Detailed description of the invention
Fig. 1 is the structural block diagram for the system calibrated automatically in the embodiment of the present invention to sample circuit in circuit board.
Fig. 2 is connection schematic diagram when calibrating in the embodiment of the present invention to sample circuit in circuit board.
Specific embodiment
With reference to the accompanying drawing and specific embodiment the present invention is described in further detail.
Embodiment 1
Shown in Figure 1, the embodiment of the present invention provides the system that sample circuit is calibrated automatically in a kind of pair of circuit board, circuit
Sample circuit in plate includes MCU (Micro Control Unit, micro-control unit), the ADC (Analog- being sequentially connected
Digital Converter, analog-digital converter), sampling resistor, the system include PC control terminal, programme-controlled dc power,
Voltage collecting device, DC Electronic Loads, system circuit are attached networking, voltage collecting device by RS232 or gpib bus
For voltmeter or data collecting card, the both ends of the sampling resistor of sample circuit are connected to, are in real time sent measurement data to upper
Machine controlling terminal.
PC control terminal centralized control calibration process, each time data acquisition are issued by PC control terminal,
Programme-controlled dc power provides suitable Current Voltage, and electronic load provides suitable draw and carries, and voltmeter or data collecting card are real-time
PC control terminal is sent by measurement data.
After PC control terminal is according to preset data times of collection data acquisition, according to specified algorithm
Data analysis is carried out, the report of error compensation is automatically generated, program upgrading is carried out to the MCU of sample circuit in circuit board, is completed
The calibration of sample circuit.
PC control terminal passes through system bus for the sample circuit group in all appts equipment and circuit board to be calibrated
It at specific loop, connects, one-key start and operation, realizes the collection of data in calibration process, select appropriate algorithm, and needle
To the needs of the sample circuit in actual circuit plate, calibration curve and error compensation data are obtained, generate report, carry out error point
Analysis and compensation, extract corresponding error compensation data table in report, arrive sample circuit by PC control terminal downloads
Micro-control unit MCU carries out program upgrading, rapidly and accurately completes the upgrading calibration of sample circuit in circuit board.
Other circuits that calibration with sample circuit in available circuit plate generallys use attached component composition are missed
Difference compensation is compared, and the embodiment of the present invention is advantageously implemented the accurate measurement of the parameters such as electric current, power, can be improved in circuit board and adopts
The accuracy of sample circuit calibration.
Embodiment 2
On the basis of embodiment 1, PC control terminal can be by C language, LabVIEW (virtual instrument exploitation environment)
It is developed Deng in PC machine.PC control terminal sends programme-controlled dc power, data collecting card and electricity at the appointed time
The parameter of son load, and these equipment are triggered simultaneously, open primary calibration movement;Each measuring device and MCU will be measured
Data are returned to PC control terminal by communication network (such as RS232, USB, TCP/IP) in real time.PC control terminal
Most important function is by the data collection and record of each calibration actions, and choosing suitable calibration strategy, (such as various fittings are calculated
Method etc.) error analysis and compensation are carried out, result is updated into the program of MCU.For example, being clicked after connecting relevant device
Software respective selection tests connectivity, and observes corresponding tabs, selects Test Strategy.
Programme-controlled dc power is chosen according to the demand of actual circuit, generally selects the power supply of suitable voltage electric current supply capacity,
Such as: Agilent E3634A (0~25V, 7A/0~50V, 4A).Before the movement of system calibration each time is opened, need
Position machine controlling terminal sends instructions to power settings and determines value.Such as test need to be selected in the case where through-flow 1A in software power supply
1A is clicked or inputted in correspondence space in item card, or clicks test automatically, sets through-flow step-length, program can be set automatically
Determine the output size of programme-controlled dc power.
The digital voltmeter or data collecting card of suitable voltage measurement capability are chosen according to the demand of actual circuit, such as:
Agilent 34970A/34902A module (16channels) has the precision more than 6, and can be by multichannel measurement data
PC control terminal is passed to simultaneously.
According to the demand of actual circuit, the DC Electronic Loads of suitable voltage current draw ability are chosen, such as: Chroma
63640-5 E-load or Faith FT6301A (120V, 30A, 150W) are loaded with this to simulate real work, to calibrate electricity
Sample circuit in the plate of road.
Common measuring instrument equipment supports that (General-Purpose Interface Bus leads to by RS232 or GPIB
With interface bus) agreement, and the postposition interface of two kinds of buses, also factory has been attached to exploitation routine.PC control terminal energy
Turn the system bus such as GPIB cable and test equipment conveniently by USB Hub (USB interface hub), USB RS 232, USB
It is bridged.Driving of the software development based on RS232 and GPIB is controlled, above system bus can be compatible with and completed to instrument and equipment
Control and data collection.
Embodiment 3
On the basis of embodiment 1, PC control terminal is uniformly coordinated, and can disposably set programme-controlled dc power
Output and electronic load load, and the voltage at sampling resistor both ends is measured;After the completion of primary connection, host computer control
Terminal processed can carry out multiple data acquisition by default simultaneously, reduce error probability, improve work efficiency.
After the completion of all data acquisitions, PC control terminal provides many algorithms and selects to carry out data point for user
Analysis, the algorithm that PC control terminal provides includes once linear, second order polynomial, exponential function, rolling average fitting algorithm,
PC control terminal makes calibration curve and error compensation, and using least square method as basic norm, calculates every kind of algorithm
Related coefficient and mean square error, make comparisons to the fitting degree of algorithms of different, select and be most accurately fitted for sample circuit
Algorithm.
One key of PC control terminal generates counting comprising voltage and current value, performance number, error compensation value etc. for multiple format
According to report, user can directly extract data, the upgrading of micro-control unit program in carry out system, complete the school to sample circuit
It is quasi-.Other circuits that calibration with sample circuit in available circuit plate generallys use attached component composition carry out error compensation
It compares, the embodiment of the present invention is advantageously implemented the accurate measurement of the parameters such as electric current, power, can be improved sample circuit in circuit board
The accuracy of calibration.
Embodiment 4
The embodiment of the present invention provides a kind of side calibrated automatically to sample circuit in circuit board based on system in embodiment 1
Method, comprising the following steps:
It is shown in Figure 2, with system bus connection PC control terminal, programme-controlled dc power, voltage collecting device and
Sampling resistor both ends in the sample circuit of circuit board are connected voltage collecting device, cable one are terminated by DC Electronic Loads
Programme-controlled dc power, another termination DC Electronic Loads;
Open each instrument and equipment, start PC control terminal, set following relevant parameter: measurement range, resolution ratio,
Test step-length, up-down stroke selection, cycle-index;
PC control terminal centralized control calibration process, according to preset data times of collection data acquisition
Afterwards, power consumption number is calculated, data analysis is carried out according to specified algorithm, the report of error compensation is automatically generated, in circuit board
The MCU of sample circuit carries out program upgrading, completes the calibration of sample circuit.
PC control terminal passes through system bus for the sample circuit group in all appts equipment and circuit board to be calibrated
It at specific loop, connects, one-key start and operation, realizes the collection of data in calibration process, select appropriate algorithm, and needle
To the needs of the sample circuit in actual circuit plate, calibration curve and error compensation data are obtained, generate report, carry out error point
Analysis and compensation, extract corresponding error compensation data table in report, arrive sample circuit by PC control terminal downloads
Micro-control unit MCU carries out program upgrading, rapidly and accurately completes the upgrading calibration of sample circuit in circuit board, and existing
Other circuits progress error compensation that attached component forms is generallyd use by the calibration of sample circuit in circuit board to compare, this
Inventive embodiments are advantageously implemented the accurate measurement of the parameters such as electric current, power, can be improved what sample circuit in circuit board was calibrated
Accuracy.
Embodiment 5
On the basis of embodiment 4, when starting PC control terminal, PC control terminal carries out System self-test, hair
It send instruction to give each instrument and equipment of connection on the system bus, receives the information that each instrument and equipment returns, detection system
Connectivity, judges whether whole system is ready to complete.
The process of PC control terminal data acquisition are as follows:
The pulling load current of the output voltage of PC control terminal control programme-controlled dc power, DC Electronic Loads, according to
Preset data times of collection obtains voltage value, current value, power consumption number from the MCU of sample circuit, from voltage collecting device
Voltage value is read, reads current value from programme-controlled dc power.
When PC control terminal carries out data analysis according to specified algorithm, the algorithm packet of PC control terminal offer
Include once linear, second order polynomial, exponential function, rolling average fitting algorithm, PC control terminal make calibration curve and
Error compensation, and using least square method as basic norm, the related coefficient and mean square error of every kind of algorithm are calculated, to different calculations
The fitting degree of method is made comparisons, and is selected for the most accurate fitting algorithm of sample circuit.
Embodiment 6
The embodiment of the present invention provides a kind of side calibrated automatically to sample circuit in circuit board based on system in embodiment 1
Method, comprising the following steps:
1) it in actual operation, gets out above-mentioned required equipment and instrument in the way of attached drawing 2, gpib bus is connected
PC control terminal, programme-controlled dc power, data collecting card and DC Electronic Loads are picked up, by the sampling electricity on circuit board
Sampling resistor both ends in road connect data collecting card, while terminating programme-controlled dc power, another termination direct current with cable one
Son load;After opening each instrument and equipment preheating five minutes, starts PC control terminal, click System self-test, program can be sent out
The instrument and equipment for sending instruction to be connected in bus to each receives the information that each instrument and equipment returns, detection system connection
Property, determine whether entire calibration system is ready to complete.Equipment and instrument in Fig. 2 needs to have the performance under specified conditions, meets
The demand of test.
2) PC control terminal is opened, and sets relevant parameter: measurement range, resolution ratio, test step-length, upper undershoot
Journey selection, cycle-index etc.;Such as: when calibrating normal working voltage V, operating current being up to the power supply sample circuit of I, electricity
Measurement range may be set to 0.9V~1.1V to pressure, voltage tester step-length may be set to 0.1V, and testing current range may be set to 0-
1.2I, testing current step-length may be set to 0.2A, select upstroke (i.e. voltage is from low to high, electric current provides from small to large), follow
Ring number is set as 2.
3) PC control terminal starts to control programme-controlled dc power output voltage 0.9V, and sending instruction keeps DC electronic negative
Carrying pulling load current is 0, and PC control terminal obtains voltage value A11, current value B11, power consumption number C11 from the MCU of sample circuit,
Voltage value X11 is read out from data collecting card simultaneously, current value Y11 is read from programme-controlled dc power, calculates power consumption number
Z11。
4) for PC control terminal according to the test of upstroke, sending instruction respectively makes DC Electronic Loads pulling load current
0.2I, 0.4I, 0.6I, 0.8I, 1.0I, 1.2I, respectively from sample circuit MCU obtain voltage value A12 ..., A17, current value
B12 ..., B17, power consumption number C12 ..., C17, read out from data collecting card voltage value X12 ..., X17, and from program-controlled direct current
Power supply read current value Y12 ..., Y17, calculate power consumption number Z12 ..., Z17.
5) for PC control terminal according to the test of upstroke, control programme-controlled dc power exports 1.0V and 1.1V, and divides
Fa Song not instruct makes DC Electronic Loads pulling load current 0.2I, 0.4I, 0.6I, 0.8I, 1.0I, 1.2I, respectively from circuit board
Sample circuit MCU obtain voltage value, current value, power consumption number, be as follows:
Table 1, voltage value, the current value, power consumption number obtained from the sample circuit MCU of circuit board
PC control terminal obtains voltage value, current value, power consumption number from data collecting card and programme-controlled dc power respectively
It is as follows:
Table 2 obtains voltage value, current value, power consumption number from data collecting card
6) after pending data acquisition, PC control terminal chooses different algorithms, such as: once linear, second order are more
Item formula, exponential function, rolling average are fitted scheduling algorithm, make calibration curve and error compensation, and be basic with least square method
Criterion calculates the related coefficient (R of every kind of algorithm2) and mean square error (RMSE) be used as index, to the fitting journey of algorithms of different
Degree is made comparisons, and is selected for this most accurate fitting algorithm of power supply sample circuit all the way, so as to later period accurately voltage and current function
Consumption calculates.
Such as: under the data record that step 5 obtains, by taking voltage value is calibrated as an example, according to once linear functional relation Formula X
=kA+d, X represent the voltage value obtained from data collecting card, and k represents the Monomial coefficient of voltage value calibration, and A is represented from circuit
The voltage value that the sample circuit MCU of plate is obtained, d are the constant term of voltage value calibration, by (A11 ..., A17) under 0.9V voltage,
(X11 ..., X17) two groups of data substitute into operation, parameter k and b are calculated with the criterion of least square method, thus according to relational expression
X '=kA+d, X ' are the voltage value calibrated according to once linear algorithm, (X11 ' ..., X17 ') are obtained, according to related coefficient
R2With the calculation formula of mean square error RMSE, calculates and choose the R that once linear algorithm is fitted1 2With mean square error RMSE1:
Wherein, i indicates the serial number of pendulous frequency.
7) PC control terminal is according to second order polynomial functional relation X=lA2+ mA+n, X are represented from data collecting card
The voltage value of acquisition, l represent the two-term coefficient of voltage value calibration, and A represents the voltage obtained from the sample circuit MCU of circuit board
Value, m represent the Monomial coefficient of voltage value calibration, and n is the constant term of voltage value calibration, by under 0.9V voltage (A11 ...,
A17), (X11 ..., X17) two groups of data substitute into operation, with the criterion of least square method, parameter l, m and n are calculated, according to relationship
Formula X "=lA2+ mA+n obtains the voltage value (X11 " ..., X17 ") calibrated according to second order polynomial functional relation algorithm,
According to coefficient R2With the calculation formula of mean square error RMSE, calculates and choose the correlation that second order polynomial Function Fitting obtains
Coefficients R2 2With mean square error RMSE2。
Wherein, i indicates the serial number of pendulous frequency.
If R2 2Greater than R1 2, RMSE2Less than RMSE1, then the algorithm conduct of description selection second order polynomial functional relation
The fitting of 0.9V voltage is more accurate, sample circuit closer true value after taking this algorithm to carry out error compensation.
8) according to step 6 and step 7, PC control terminal is respectively adopted algorithms of different and relatively show that the road power supply exists
0.9V voltage, current value and the most suitable fitting algorithm of power consumption number and error compensation data.
9) the set program of PC control terminal can calculate the road power supply in 1.0V automatically according to the setting of step 2
With fitting algorithm parameter and error compensation data all under 1.1V.
10) it because the operating voltage of different electrical power circuit and operating current are different on circuit board, is sampled to per power supply all the way
The calibration process of circuit, it is necessary to carry out the parameter setting of step 2, just can guarantee the practical electricity of calibration process covering of its sample circuit
Source operative scenario, the accuracy of the sampling circuit samples after realizing calibration.Meanwhile the software interface of PC control terminal provides
The recommendation setting values of different electrical power circuit different voltages.
11) after the completion of all test jobs, in report option card, the statement form of needs, such as * .txt, * are chosen
.xls, * .pdf etc., and can select to save the position of report.PC control terminal have recorded all test item object times,
Specific test data and error compensation data etc., the structure of report of generation are as follows:
Table 3, all test item object times, specific test data and error compensation data
12) corresponding error compensation data table in report is extracted, PC control terminal downloads to microcontroller list are passed through
First MCU carries out program upgrading, completes calibration.
The embodiment of the present invention is proposed with the selection of a variety of calibration algorithms, data sheet output, multiple sampling resistors simultaneously
Other circuits that the calibration of sample circuit generallys use attached component composition in the method for measurement, with available circuit plate carry out
Error compensation is compared, and the embodiment of the present invention can rapidly and accurately complete the upgrading calibration of sample circuit in circuit board, energy
Working efficiency is significantly improved, the accuracy that the parameters such as electric current, power consumption calculate measurement is increased, improves sample circuit calibration in circuit board
Accuracy.
Those skilled in the art can carry out various modifications to the embodiment of the present invention and modification, if these modifications and change
For type within the scope of the claims in the present invention and its equivalent technologies, then these modifications and variations are also in protection scope of the present invention
Within.
The prior art that the content being not described in detail in specification is known to the skilled person.