A kind of judgment method of alternating current detection unit failure
Technical field
The present invention relates to electrical quantity detection field, especially a kind of judgment method of alternating current detection unit failure.
Background technique
Positive and negative alternate AC characteristic is presented in the voltage or electric current for exchanging electricity output, by detection unit detect its voltage or
Current parameters also have the same AC characteristic of family, if detection unit fails, typically exhibit DC characteristic, i.e. detection unit
The voltage value or current value of output will keep positive value or negative value or 0 output, that is, lose positive and negative alternate AC characteristic.Uninterrupted electricity
In normal operating conditions, output is alternating current for source or inverter, production testing must be carried out before product export, between detection not
Whether power-off source or inverter are qualified, and whether one of important parameter seeks to detect its output normal.Common practice is
Whether there is AC characteristic using the current or voltage that current detecting unit or voltage detection unit detect its output.But such as
Fruit in the detection process, because detection unit itself is damaged but do not found in time, may cause testing result fault, influence just
Really judgement.Hall sensor because the features such as its structure is simple, small in size, linear convergent rate, is widely used in electrical quantity detection,
But the damage of Hall sensor is not easy to be found again.The present invention uses a kind of judgment method of alternating current detection unit failure,
It can be used for detecting whether Hall sensor damages.
Summary of the invention
The purpose of the present invention is to provide a kind of judgment methods of alternating current detection unit failure, to overcome in the prior art
Existing defect.
To achieve the above object, the technical scheme is that a kind of judgment method of alternating current detection unit failure, is pressed
It is realized according to following steps:
Step S1: the timing Ts voltage value exported to an alternating current detection unit or current value sample;It is adopted each
After sample value is compared with an a reference value, the sampled value is converted into binary digit code 1 or 0, and by the binary digit code
Step-by-step is stored in a storage unit;Judge to sample A sampled value in the period altogether one, and the judgement period A*Ts is not less than institute
State the cycle T of alternating current;
Step S2: binary digit code 1 and 0 number in the storage unit is read and counts in step-by-step, is denoted as B and C respectively;
Step S3: B, C are compared with a threshold value respectively, or will | B-C | it is compared with the threshold value;As at least B or C
Any one of be less than the threshold value or | B-C | be greater than threshold value, be then judged as alternating current detection unit failure;Wherein, | B-C | be
The absolute value of the difference of B and C.
It in an embodiment of the present invention, in the step S1, will when the sampled value is more than or equal to a reference value
The sampled value is converted to binary digit code 1;When the sampled value is less than a reference value, the sampled value is converted to two
System position code 0.
In an embodiment of the present invention, a reference value is 0.
In an embodiment of the present invention, in step sl, a reference value includes first reference value and the second a reference value;Institute
Stating storage unit includes the first storage unit and the second storage unit;
By each sampled value compared with the first reference value, when the sampled value is more than or equal to the first reference value,
The sampled value is converted into binary digit code 1;When the sampled value is less than the first reference value, which is converted to two
System position code 0, and by after conversion binary digit code 1 or 0 step-by-step store to first storage unit;
By each sampled value compared with the second a reference value, when the sampled value is more than or equal to second a reference value, by this
Sampled value is converted to binary digit code 1;When the sampled value is less than second a reference value, which is converted into binary system
Position code 0, and by after conversion binary digit code 1 or 0 step-by-step store to second storage unit;
In the step S2, step-by-step is read, and counts first storage unit and second storage unit respectively
Middle binary digit code 1 and 0 number, and the number of binary digit code 1 is denoted as B1 and B2 respectively, by the number of binary digit code 0
It is denoted as C1 and C2 respectively;Wherein, B1 is the number of binary digit code 1 in the first storage unit, and C1 is two in the first storage unit
The number of system position code 0, B2 are the number of binary digit code 1 in the second storage unit, and C2 is binary system in the second storage unit
The number of position code 0;
In the step S3, B1, C1, B2, C2 are compared with threshold value respectively, or | B1-C2 | compared with threshold value
Compared with;When at least any one of B1 or C2 be less than threshold value or | B1-C2 | when being greater than threshold value, be then judged as the alternating current detection unit
Failure;Wherein, | B1-C2 | it is the absolute value of the difference of B1 and C2.
In an embodiment of the present invention, the first reference value has no more than the voltage of alternating current detection unit output
The 5% of valid value or current effective value, second a reference value not less than the alternating current voltage virtual value or current effective value-
5%。
In an embodiment of the present invention, as (K+0.5) * T > A*Ts >=K*T, the threshold value is K*T/ (2*Ts) -3;
As (K+1) * T > A*Ts >=(K+0.5) * T, the threshold value is A-K*T/ (2*Ts) -3;
Wherein, K is positive integer, and K >=1.
In an embodiment of the present invention, number of samples A=32 or A=64 in one judgement period.
In an embodiment of the present invention, the timing Ts=1ms.
In an embodiment of the present invention, the alternating current detection unit is Hall AC current sensor.
Compared to the prior art, the invention has the following advantages:
(1) judgment method of alternating current detection unit proposed by the invention failure, timing sampling obtain sampled value, and will
Sampled value is converted to binary digit code 1 or 0, and step-by-step access, a byte includes 8 positions, is equivalent to and can store 8 samplings
Value, greatly reduces the occupancy of memory space;And then network bandwidth can be saved, realize compact access.
(2) in computer field, storage variable needs to occupy different byte numbers, data according to different data types
Type usually has the Byte byte type of 1 byte, the Boolean Boolean type of 2 bytes or integer integer type, 4 bytes
Long long, double double-precision floating point type of 8 bytes etc., the byte number that the present invention is occupied according to the data type of definition
It determines and obtains 32 sampled values, the corresponding variable for being stored as 4 bytes, i.e., one judges that the period only saves as 1 or 2
Long long variable can store whole sampled values, and memory space is made full use of to guarantee enough number of samples again simultaneously;And
Judge that the period is greater than the period for being detected alternating current, it is ensured that the data of sampling are effective.
(3) present invention determines by the number of statistics binary digit code 1 or 0 and judges to exchange electricity output in the period in positive value
Or the number of negative value, determine whether output is presented DC characteristic according to number, judgment method is simple and effective.
(4) if exchange electricity output is normal, theoretically 1 and 0 number should be equal, if output is direct current,
Theoretically sampled value should be continuously positive value or negative value or 0, but in practical applications, the electric current that DC characteristic may be presented can also
Situations such as capable of having mutation, spike, causes sampled result in a series of positive value including negative value etc., and the present invention is by representing just
0) 1(of value and represents the 0(of negative value or number 1) is compared with threshold value respectively, true according to its relationship between threshold value
Whether fixed output loses AC characteristic, and threshold value is according to judge that the frequency in period and detected alternating current rationally determines with one
Fixed fault tolerant workspace, judging result are more reasonable accurate.
(5) the present invention also provides by first reference value and the second a reference value by sampled value be divided into positive value, negative value and
Opposite 0 value, is compared and is converted into binary digit code respectively at first reference value and the second a reference value for each sampled value, adopt
It is stored respectively with 2 32 storage units, the feelings of positive value, negative value and opposite 0 value can be read from 2 32 storage units
Condition can more accurately judge sampled value in the distribution situation of positive value and negative value.
Detailed description of the invention
Fig. 1 is the flow chart of embodiment one in the present invention.
Fig. 2 is the flow chart of embodiment two in the present invention.
Fig. 3 is Ts=1ms in the present invention, threshold value distribution map of the frequency in 45Hz to 65Hz.
Specific embodiment
With reference to the accompanying drawing, technical solution of the present invention is specifically described.
Embodiment one
The present invention provides a kind of judgment method of alternating current detection unit failure, as shown in Figure 1, real in accordance with the following steps
It is existing:
Step S1: the timing Ts voltage value exported to an alternating current detection unit or current value sample;It is adopted each
After sample value is compared with an a reference value, sampled value is converted into binary digit code 1 or 0, and binary digit code step-by-step is stored
In a storage unit;Judge to sample A sampled value in the period altogether one, and judges that period A*Ts is not less than the week of the alternating current
Phase T;
Step S2: step-by-step is read and binary digit code 1 and 0 number in statistics storage unit, is denoted as B and C respectively;
Step S3: B, C are compared with a threshold value respectively, or will | B-C | it is compared with the threshold value;As at least B or C
Any one of be less than the threshold value or | B-C | be greater than threshold value, then be judged as alternating current detection unit fail;Wherein, | B-C | it is B and C
Absolute value of the difference.
Further, in the present embodiment, in step sl, when sampled value is more than or equal to a reference value, sampled value is turned
It is changed to binary digit code 1;When sampled value is less than a reference value, sampled value is converted into binary digit code 0, and a reference value
It is 0.
Further, in the present embodiment,
As (K+0.5) * T > A*Ts >=K*T, threshold value is K*T/ (2*Ts) -3;
As (K+1) * T > A*Ts >=(K+0.5) * T, threshold value is A-K*T/ (2*Ts) -3;
Wherein, K is positive integer, and K >=1.
In the present embodiment, threshold value is fallen between half and the number of samples of a cycle, as shown in Figure 3, it is contemplated that inspection
There can be the error of 1~2 point during survey, therefore subtract 3, so as not to it is misjudged.
Further, in the present embodiment, number of samples A=32 or A=64 judged in the period.In the present embodiment
In, storage unit can store 32 data (4 bytes), select A=32, the variable for allowing for storage is 32, similarly
64 (8 bytes) can also be used
Further, in the present embodiment, timing Ts=1ms.
Further, in the present embodiment, alternating current detection unit is Hall AC current sensor.
Further, the rated frequency of China's AC network is 50Hz, and the output frequency of uninterruptible power supply and inverter is logical
It is often distributed in this range, there is certain representativeness.As shown in Fig. 3 and the following table 1, for Ts=1ms in the present invention, frequency exists
The threshold value of 45Hz to 65Hz is distributed.
Table 1
Embodiment two
The present invention provides a kind of judgment method of alternating current detection unit failure, as shown in Fig. 2, real in accordance with the following steps
It is existing:
Step S1: the timing Ts voltage value exported to an alternating current detection unit or current value sample;It is adopted each
After sample value is compared with an a reference value, sampled value is converted into binary digit code 1 or 0, and binary digit code step-by-step is stored
In a storage unit;Judge to sample A sampled value in the period altogether one, and judges that period A*Ts is not less than the week of the alternating current
Phase T;
Step S2: step-by-step is read and binary digit code 1 and 0 number in statistics storage unit, is denoted as B and C respectively;
Step S3: B, C are compared with a threshold value respectively, or will | B-C | it is compared with the threshold value;As at least B or C
Any one of be less than the threshold value or | B-C | be greater than threshold value, then be judged as alternating current detection unit fail;Wherein, | B-C | it is B and C
Absolute value of the difference.
Further, in the present embodiment, in step sl, a reference value includes first reference value and the second a reference value;It deposits
Storage unit includes the first storage unit and the second storage unit;
By each sampled value compared with the first reference value, when the sampled value is more than or equal to the first reference value,
The sampled value is converted into binary digit code 1;When the sampled value is less than the first reference value, which is converted to two
System position code 0, and by after conversion binary digit code 1 or 0 step-by-step store to first storage unit;
By each sampled value compared with the second a reference value, when the sampled value is more than or equal to second a reference value, by this
Sampled value is converted to binary digit code 1;When the sampled value is less than second a reference value, which is converted into binary system
Position code 0, and by after conversion binary digit code 1 or 0 step-by-step store to second storage unit;
In step s 2, step-by-step is read, and is counted two in first storage unit and second storage unit respectively
System position 1 and 0 number of code, and the number of binary digit code 1 is denoted as B1 and B2 respectively, the number of binary digit code 0 is distinguished
It is denoted as C1 and C2;Wherein, B1 is the number of binary digit code 1 in the first storage unit, and C1 is binary system in the first storage unit
The number of position code 0, B2 are the number of binary digit code 1 in the second storage unit, and C2 is binary digit code 0 in the second storage unit
Number;
In step s3, B1, C1, B2, C2 are compared with threshold value respectively, or | B1-C2 | it is compared with threshold value;When
At least any one of B1 or C2 be less than threshold value or | B1-C2 | when being greater than threshold value, be then judged as alternating current detection unit failure;
Wherein, | B1-C2 | it is the absolute value of the difference of B1 and C2.
Further, in the present embodiment, the first reference value is not more than the electricity of alternating current detection unit output
It is pressed with the 5% of valid value or current effective value, second a reference value is not less than the alternating current voltage virtual value or current effective value
- 5%.
Further, in the present embodiment,
As (K+0.5) * T > A*Ts >=K*T, threshold value is K*T/ (2*Ts) -3;
As (K+1) * T > A*Ts >=(K+0.5) * T, threshold value is A-K*T/ (2*Ts) -3;
Wherein, K is positive integer, and K >=1.
In the present embodiment, threshold value is fallen between half and the number of samples of a cycle, as shown in Figure 3, it is contemplated that inspection
There can be the error of 1~2 point during survey, therefore subtract 3, so as not to it is misjudged.
Further, in the present embodiment, number of samples A=32 or A=64 judged in the period.In the present embodiment
In, storage unit can store 32 data (4 bytes), select A=32, the variable for allowing for storage is 32, similarly
64 (8 bytes) can also be used
Further, in the present embodiment, timing Ts=1ms.
Further, in the present embodiment, alternating current detection unit is Hall AC current sensor.
Further, the rated frequency of China's AC network is 50Hz, and the output frequency of uninterruptible power supply and inverter is logical
It is often distributed in this range, there is certain representativeness.As shown in Fig. 3 and table 1, for Ts=1ms in the present invention, frequency exists
The threshold value of 45Hz to 65Hz is distributed.
Embodiment three
In the single-phase detection that Hall fails in UPS, tradition is by judging that the virtual value of the sum of three-phase inversion electric current exceeds
A certain threshold value is often confined to three-phase three wire system, for three-phase four come the method for detecting the failure of Hall AC current sensor
Line or monophase system are invalid.Conventional method can only often judge that Hall AC current sensor fails, and can not specifically navigate to
Which phase Hall AC current sensor failure.
Further, it is no matter unloaded or be fully loaded with and can show AC characteristic to work normally lower inverter current by UPS, suddenly
The inverter current that your failure case down-sampling obtains more shows DC characteristic.Based on above feature extraction, in this reality
It applies in example, first reference value and the second a reference value are identified as 3A and -3A, and sample rate current is divided be positive area (> 3A), minus zone
(< -3A) and 0th area (between -3A to 3A), it is nearest that the variable in 1ms task using two 32 records sample rate current respectively
The area 32ms Nei Zheng and minus zone residence time, by judging that sample rate current is default less than one in positive area or minus zone residence time
Threshold value can detect above-mentioned Hall failure case.
Further, in the present embodiment, for sampling signal frequency 45Hz to 65Hz Hall abatement detecting method,
Wherein, the minimum time that positive area is operated in the sinusoidal signal 32ms time of 45Hz to 46.875Hz frequency band is 1 to 1.5
Between period, preset threshold A can be determined as the time of 0.5 sinusoidal cycles.Sine of the 46.875Hz to 62.5 Hz frequency bands
Signal operates in positive area minimum time in the 32ms time is between 1.5 to 2 periods, and preset threshold A can be determined as
32ms subtracts the time of 1 sinusoidal cycles.Positive area is operated in the sinusoidal signal 32ms time of 62.5 Hz to 65Hz frequency bands
Minimum time is between 2 to 2.5 periods, and preset threshold A can be determined as the time of 1 sinusoidal cycles.
Further, it is contemplated that detection scheme executes the error that can have 1~2 point in 1ms task, therefore by threshold value
A point is determined as 8.In this embodiment, two kinds of Hall failure cases (fault value falls in positive area and 0th area) and failure inspection are simulated
Furthermore survey and two processes of fault recovery select the corresponding sine wave freuqency of minimum time minimum point in Fig. 3 in simulation example
47Hz.When Hall failure, which causes to detect signal, becomes DC characteristic situation by AC characteristic, detection that the present embodiment is proposed
Method can fast and effeciently detected.
The above are preferred embodiments of the present invention, all any changes made according to the technical solution of the present invention, and generated function is made
When with range without departing from technical solution of the present invention, all belong to the scope of protection of the present invention.