Real-time compensation circuit applied to signal generating device
By combining the operational conditioning circuit, signal processing unit, and phase detection circuit, and using analog switches and MCU control, the phase deviation of the signal generator is compensated in real time, solving the phase deviation problem in signal processing and achieving signal accuracy and equipment stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- SHANDONG MINGKE ELECTRIC TECH CO LTD
- Filing Date
- 2025-04-28
- Publication Date
- 2026-05-08
AI Technical Summary
The phase deviation generated by the signal generator during signal processing cannot be corrected in real time by software, resulting in unstable operation of the test object and malfunction of the protection device.
It employs an operational conditioning circuit, a signal processing unit, an output conditioning circuit, and a phase detection circuit. Through a combination of a phase compensation circuit and an analog switch, it can detect and compensate for phase deviation in real time. The MCU controls the analog switch to connect different capacitors for phase adjustment.
It achieves phase consistency of the signal, eliminates phase deviation, ensures signal accuracy and stable operation of the equipment, and adapts to complex signal environments and changing working conditions.
Smart Images

Figure CN224216865U_ABST
Abstract
Description
Technical Field
[0001] This utility model belongs to the field of voltage phase compensation technology, and relates to a real-time compensation circuit applied to a signal generating device. Background Technology
[0002] The statements in this section are merely background information related to this utility model and do not necessarily constitute prior art.
[0003] As the proportion of new energy sources in my country's power grid increases, their impact on the stable operation of the power system can no longer be ignored. Voltage dips or surges are problems that power plants are prone to encounter during normal operation. This necessitates that large-scale power plants connected to the grid possess good grid adaptability.
[0004] The voltage phase angle change generated by the signal generator following the output mode is consistent with the characteristics of a real power grid fault. This device can be used to realistically simulate voltage dips and rises during power grid faults, thereby enabling testing and analysis of inverters, SVG, and other test objects. However, the signal generator introduces a certain phase deviation during signal processing, which cannot be corrected in real time by software. This phase deviation may cause instability in the test object and malfunctions of protection devices. Utility Model Content
[0005] The purpose of this invention is to provide a real-time compensation circuit for signal generating devices to eliminate problems caused by phase deviation, ensure equipment operation stability, and improve power grid security.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] This utility model provides a real-time compensation circuit for use in a signal generating device, comprising:
[0008] The system comprises an operational conditioning circuit, a signal processing unit, an output conditioning circuit, and a phase detection circuit. The operational conditioning circuit is connected to the signal processing unit and transmits the conditioned AC voltage signal to the signal processing unit. The signal processing unit is connected to the output conditioning circuit, which in turn is connected to the phase detection circuit. The signal processing unit outputs a follower signal of the AC voltage signal, which, after being amplified by the output conditioning circuit, enters the phase detection circuit. The phase detection circuit is connected to the signal processing unit and compares the AC voltage signal and the follower signal using a comparator to obtain a phase signal. This phase signal is then fed back to the signal processing unit, which generates a control signal that is then fed back to the operational conditioning circuit.
[0009] The operational conditioning circuit includes a phase compensation circuit and a voltage amplification circuit, and the phase compensation circuit includes multiple stages of analog switches connected in parallel.
[0010] Furthermore, the input to the voltage amplifier circuit is the voltage generated at the output of operational amplifier U3A, which is then amplified by the voltage amplifier circuit. In the voltage amplifier circuit, the output of operational amplifier U3A is connected to one end of resistor R22, and the other end of R22 is grounded. Resistor R21 is connected between resistor R18 and the non-inverting input of operational amplifier U3B. Capacitor C5 is connected between the non-inverting input of operational amplifier U3B and the grounded end of resistor R22. One end of resistor R20 is grounded, and the other end of resistor R20 is connected to the inverting input of operational amplifier U3B. Varistor RV3 is connected between the output of operational amplifier U3B and the inverting input of operational amplifier U3B.
[0011] Furthermore, the multi-stage analog switch includes multiple input terminals and multiple output terminals, each of which is connected to a resistor and a capacitor to form branches L1, L2, L3, and L4.
[0012] Furthermore, the phase compensation circuit controls the analog switch to turn on based on the phase deviation calculated by the signal processing unit, so that different capacitors are connected to the circuit.
[0013] Furthermore, the operational conditioning circuit also includes a current transformer T2. The AC voltage signal is input from the input terminal VinN+ of the real-time compensation circuit to resistor R19. The output of resistor R19 is input from port S1 of current transformer T2 and output from port S2 of current transformer T2. Port S4 of current transformer T2 is connected to the negative input terminal of operational amplifier U3A, and port S3 of current transformer T2 is connected to the positive input terminal of operational amplifier U3A. Current transformer T2 is connected in parallel with diodes D3 and D4. Port S4 of current transformer T2 is connected to the anode of diode D3 and the cathode of diode D4, and port S3 of current transformer T2 is connected to the cathode of diode D3 and the anode of diode D4, with the cathode of diode D3 grounded. Port S4 of current transformer T2 is connected to one end of resistor R18 and to analog switch I-in.
[0014] Furthermore, the phase detection circuit includes comparator U4A and comparator U4B. The AC voltage signal enters the positive input terminal of comparator U4A through resistor R24; the negative input terminal is grounded; the output terminal is connected to VDD through resistor R23; VDD is connected to the positive power supply; and VSS is grounded.
[0015] The follow signal enters the positive input terminal of the comparator U4B through resistor R26; the negative input terminal is grounded; the output terminal is connected to VDD through resistor R25; VDD is connected to the positive terminal of the power supply.
[0016] The output of the phase detection circuit is connected to the signal processing unit via an external interrupt.
[0017] Furthermore, the phase detection circuit includes a phase signal processing circuit, which is connected to the signal processing unit.
[0018] Furthermore, the phase signal processing circuit mainly consists of two comparators, U4A and U4B;
[0019] The comparators U4A and U4B process the AC voltage signal and the follower signal respectively, and send the processed signals to the signal processing unit.
[0020] Furthermore, the input terminal of the signal processing unit is connected to the output terminals of comparator U4A and comparator U4B, and the signal processing unit is connected to the output terminal of the phase detection circuit through an external interrupt.
[0021] The technical solution of this utility model has the following beneficial effects:
[0022] (1) The phase compensation circuit of this utility model controls the analog switch to conduct based on the phase deviation calculated by the signal processing unit, so that different capacitors are connected to the circuit. This provides a signal source with the same frequency and phase for voltage drop and rise simulation tests, forming different phase adjustment schemes to ensure that the input and output signals are in phase and achieve phase compensation. Phase compensation effectively eliminates the phase deviation generated during the follow-up output process, avoids signal distortion caused by phase shift, and ensures the accuracy of the signal.
[0023] (2) This utility model achieves automatic phase compensation by controlling the analog switch with MCU. Different capacitors can be connected in real time according to the actual deviation. Compared with the one-time adjustment of manual phase compensation, automatic phase compensation is more flexible and can adapt to various complex signal environments and changing working conditions.
[0024] The advantages of this invention in additional aspects will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0025] The accompanying drawings, which form part of this specification, are used to provide a further understanding of this utility model. The illustrative embodiments of this utility model and their descriptions are used to explain this utility model and do not constitute an improper limitation of this utility model.
[0026] Figure 1 This is a block diagram illustrating the circuit principle of the real-time compensation circuit of this utility model.
[0027] Figure 2This is a schematic diagram of the phase compensation circuit structure of this utility model.
[0028] Figure 3 This is a schematic diagram of the analog switch circuit structure of this utility model.
[0029] Figure 4 This is a schematic diagram of the phase detection circuit structure of this utility model. Detailed Implementation
[0030] It should be noted that the following detailed description is exemplary and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0031] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this utility model.
[0032] Where there is no conflict, the embodiments and features in the embodiments of this utility model can be combined with each other.
[0033] The overall concept proposed by this utility model is as follows:
[0034] The external AC voltage signal is first converted into a suitable signal by the operational conditioning circuit and then enters the signal processing unit. The signal processing unit outputs the signal. Simultaneously, the output signal and the external AC voltage signal enter the phase detection circuit for phase comparison. The signal processing unit determines the phase deviation between the two signals and controls the operational conditioning unit to perform phase compensation accordingly.
[0035] The operational conditioning circuit can process the input signal into the required signal and transmit it to the signal processing unit for further processing. By adding a phase compensation circuit, the operational conditioning circuit can receive the control signal from the signal processing unit (MCU), control the analog switch operation, connect configuration capacitors with different parameters, and complete the real-time phase compensation.
[0036] This utility model discloses a real-time compensation circuit applied to a signal generating device, such as... Figure 1 As shown, it includes:
[0037] The system includes an operational conditioning circuit, a signal processing unit, an output conditioning circuit, and a phase detection circuit. The operational conditioning circuit is connected to the signal processing unit and transmits the conditioned AC voltage signal to the signal processing unit. The signal processing unit is connected to the output conditioning circuit, which in turn is connected to the phase detection circuit. The signal processing unit outputs a follower signal of the AC voltage signal, which, after amplification by the output conditioning circuit, enters the phase detection circuit. The phase detection circuit compares the AC voltage signal and the follower signal using a comparator to obtain a phase signal, which is then fed back to the signal processing unit. The signal processing unit generates a control signal, which is then fed back to the operational conditioning circuit.
[0038] In specific implementation methods, such as Figure 2 As shown, the operational conditioning circuit includes a phase compensation circuit and a voltage amplification circuit. The phase compensation circuit comprises multiple stages of analog switches connected in parallel. Specifically:
[0039] The multi-stage analog switch has four input terminals and four corresponding output terminals. Each input terminal is labeled I-in; the four output terminals are labeled A-out, B-out, C-out, and D-out, respectively.
[0040] Each output terminal forms branches L1, L2, L3, and L4 through a resistor (R14, R15, R16, R17) and a capacitor (C1, C2, C3, C4).
[0041] Preferred, such as Figure 3 As shown, the analog switch, model CD4066BM96, is a four-channel bidirectional analog switch, with each channel independently controllable, commonly used in signal switching circuits. The analog switch switches different signal paths via control signals (MCU K1, K2, K3, K4) to achieve signal input / output switching. The phase compensation circuit controls the CD4066 analog switch to conduct based on the phase deviation calculated by the signal processing unit, allowing different capacitors to be connected to the circuit, ensuring that the input and output signals are in phase, thus achieving phase compensation.
[0042] Furthermore, in the analog switch, SIG A IN / OUT (pin 1): input of L1 branch; SIG A OUT / IN (pin 2): output of L1 branch. SIG B IN / OUT (pin 4): input of L2 branch; SIG B OUT / IN (pin 3): output of L2 branch. SIG C IN / OUT (pin 8): input of L3 branch; SIG C OUT / IN (pin 9): output of L3 branch. SIG DIN / OUT (pin 11): input of L4 branch; SIG D OUT / IN (pin 10): output of L4 branch. CONTROL A (pin 13): control pin of switch A, receiving control signal MCU K1 to control SIG A IN and SIG A OUT to conduct, used in this invention to control the switch of L1 branch. CONTROL B (pin 5): control pin of switch B, receiving control signal MCU K2 to control SIG B IN and SIG B OUT to conduct, used in this invention to control the switch of L2 branch. CONTROL C (Pin 6): Control pin of switch C, receives control signal MCU K3, controls SIG C IN and SIG C OUT to conduct, and is used to control the switch of branch L3 in this invention. CONTROL D (Pin 12): Control pin of switch D, receives control signal MCU K4, controls SIG D IN and SIG D OUT to conduct, and is used to control the switch of branch L4 in this invention. VSS (Pin 7): Ground pin, provides the circuit's reference ground. VDD (Pin 14): Power supply pin, connected to the positive power supply terminal.
[0043] Preferably, the voltage amplification circuit specifically includes: the voltage across resistor R18 is generated at the output terminal (pin 1) of operational amplifier U3A and amplified by the voltage amplification circuit for further processing. In the voltage amplification circuit, the output terminal of operational amplifier U3A is connected to one end of resistor R22, and the other end of R22 is grounded. Resistor R21 is connected between resistor R18 and the non-inverting input terminal of operational amplifier U3B. Capacitor C5 is connected between the non-inverting input terminal of operational amplifier U3B and the grounded terminal of resistor R22. One end of resistor R20 is grounded, and the other end of resistor R20 is connected to the inverting input terminal of operational amplifier U3B. Varistor RV3 is connected between the output terminal and the inverting input terminal of operational amplifier U3B.
[0044] Preferably, the circuit also includes a current transformer T2. An AC voltage signal is input from the input terminal VinN+ of the real-time compensation circuit to resistor R19. The output of resistor R19 is input from port S1 of current transformer T2 and output from port S2 of current transformer T2. Port S4 of current transformer T2 is connected to the negative input terminal of operational amplifier U3A, and port S3 of current transformer T2 is connected to the positive input terminal of operational amplifier U3A. Current transformer T2 is connected in parallel with diodes D3 and D4. Port S4 of current transformer T2 is connected to the anode of diode D3 and the cathode of diode D4, respectively, and port S3 of current transformer T2 is connected to the cathode of diode D3 and the anode of diode D4, respectively. The cathode of diode D3 is grounded. Port S4 of current transformer T2 is connected to one end of resistor R18, and port S4 of current transformer T2 is connected to analog switch I-in.
[0045] In a specific implementation, the operational conditioning circuit also includes a current transformer T2. An AC voltage signal is input from the input terminal VinN+ of the real-time compensation circuit to resistor R19. The output of resistor R19 is input from port S1 of current transformer T2 and output from port S2 of current transformer T2. Port S4 of current transformer T2 is connected to the negative input terminal of operational amplifier U3A, and port S3 of current transformer T2 is connected to the positive input terminal of operational amplifier U3A. Current transformer T2 is connected in parallel with diodes D3 and D4. Port S4 of current transformer T2 is connected to the anode of diode D3 and the cathode of diode D4, respectively, and port S3 of current transformer T2 is connected to the cathode of diode D3 and the anode of diode D4, respectively. The cathode of diode D3 is grounded. Port S4 of current transformer T2 is connected to one end of resistor R18, and port S4 of current transformer T2 is connected to analog switch I-in.
[0046] The working principle of this operational conditioning circuit is as follows: An AC voltage signal is input from the input terminal VinN+ of the real-time compensation circuit to resistor R19. The output of resistor R19 is input from port S1 of current transformer T2 and output from port S2 of current transformer T2. Port S4 of current transformer T2 is connected to the negative input terminal of operational amplifier U3A, and port S3 of current transformer T2 is connected to the positive input terminal of operational amplifier U3A. Current transformer T2 is connected in parallel with diodes D3 and D4. Port S4 of current transformer T2 is connected to the anode of diode D3 and the cathode of diode D4, respectively, and port S3 of current transformer T2 is connected to the cathode of diode D3 and the anode of diode D4, respectively. The cathode of diode D3 is grounded. The S4 port of current transformer T2 is connected to one end of resistor R18. The S4 port of current transformer T2 is also connected to analog switch I-in. Analog switch A-out is connected to capacitor C1, which is connected to one end of resistor R14. Analog switch B-out is connected to capacitor C2, which is connected to one end of resistor R15. Analog switch C-out is connected to capacitor C3, which is connected to one end of resistor R16. Analog switch D-out is connected to capacitor C4, which is connected to one end of resistor R17. The other ends of resistors R14, R15, R16, and R17 are connected to the other end of resistor R18. The output of operational amplifier U3A is connected to the other end of resistor R18 and one end of resistor R22, with the other end of R22 grounded. Resistor R21 is connected between resistor R18 and the non-inverting input of operational amplifier U3B. Capacitor C5 is connected between the non-inverting input of operational amplifier U3B and the grounded end of resistor R22. One end of resistor R20 is grounded, and the other end is connected to the inverting input of operational amplifier U3B. Varistor RV3 is connected between the output and inverting input of operational amplifier U3B.
[0047] Phase compensation is achieved by performing phase calculations between the follow signal and the external input signal, and then analyzing the phase deviation calculation results and generating control signals to control the analog switch action.
[0048] In a specific implementation, the output conditioning circuit includes signal amplification and filtering processes to ensure that the output signal is suitable for subsequent processing or direct use. The output conditioning circuit receives the signal processed by the signal processing unit, amplifies and filters the received signal, outputs an AC voltage signal, and simultaneously sends the signal to the phase detection circuit for further processing. The output conditioning circuit only provides a following signal for phase compensation in this embodiment; the specific output conditioning circuit is existing technology and will not be described in detail in this embodiment.
[0049] In specific implementation methods, such as Figure 4As shown, the phase detection circuit includes a phase signal processing circuit, which is connected to the signal processing unit (MCU). The phase signal processing circuit mainly consists of two comparators (U4A and U4B), model LM293A. The purpose of the circuit is to process the AC voltage signal and the following signal respectively, and then send the processed signals to the signal processing unit (MCU). Specifically:
[0050] Preferably, the AC voltage signal enters the phase signal processing circuit through resistor R24. The other end of resistor R24 is connected to the positive input terminal (pin 3) of comparator U4A, the negative input terminal (pin 2) of comparator U4A is grounded (GND), pin 4 of comparator U4A is connected to VSS, pin 8 of comparator U4A is connected to VDD, and resistor R23 is connected between the output terminal of comparator U4A and VDD.
[0051] The follow signal enters the phase signal processing circuit through resistor R26. The other end of resistor R26 is connected to the positive input terminal (pin 5) of comparator U4B. The negative input terminal (pin 6) of comparator U4B is grounded (GND). The output terminal (pin 7) of comparator U4B is connected to one end of resistor R25. The other end of resistor R25 is connected to VDD.
[0052] The output of the phase detection circuit (i.e., the output of comparator U4BA and the output of comparator U4B) is sent to the signal processing unit (MCU), which outputs control signals (MCU K1, MCU K2, MCU K3, MCU K4).
[0053] Preferably, comparator U4A compares the AC voltage signal with 0, and comparator U4B compares the follower signal with 0, thus completing signal processing. The signal processing unit (MCU) receives the signal from the comparators and calculates the phase deviation via an external interrupt.
[0054] The externally acquired signal enters the non-inverting input terminal 3 of the LM293A comparator U4A through AD out; the follower output signal enters the non-inverting input terminal 5 of the LM293A comparator U4B through DAC out, and the inverting input terminals 2 and 6 are grounded, so that the AC voltage signal and the follower signal are compared with zero in the LM293A comparator, i.e., zero-crossing comparison.
[0055] The AC voltage signal and the following signal respectively enter the phase detection circuit. The LM293A comparator converts the sinusoidal waveform of the signal into a square wave with 0 and 1 values, achieving zero-crossing comparison. The MCU determines the time deviation, calculates the phase deviation, and feeds the calculation result back to the operational conditioning circuit to control the analog switch to achieve phase compensation.
[0056] The signal processing unit (MCU) captures two zero-crossing signals (i.e., the rising edge of a square wave) via an external interrupt pin, and obtains the time of signal change: t1 for the AC voltage signal and t2 for the follower signal. The time difference Δt = |t1 - t2| is then calculated and converted into a phase difference. Phase deviation is generally within 1°.
[0057] Depending on the phase deviation value, the signal processing unit (MCU) controls the CD4066 analog switch to turn on, so that different capacitors are connected to the follower circuit to ensure that the input and output signals are in phase and achieve phase compensation.
[0058] Through phase deviation, the signal processing unit (MCU) outputs control signals MCU K1, MCU K2, MCU K3, and MCU K4. MCU K1, K2, K3, and K4 are respectively connected to ports 13, 5, 6, and 12 of the analog switch CD4066.
[0059] CONTROL A, CONTROL B, CONTROL C, and CONTROL D respectively control the conduction of SIG A IN, SIG A OUT; SIG B IN, SIG B OUT; SIG C IN, SIG C OUT; and SIG D IN, SIG D OUT, thus enabling... Figure 2 Branches L1, L2, L3, and L4 are turned on, and different capacitors are connected to achieve phase deviation compensation. SIGA IN and SIGA OUT are connected. Figure 2 In the L1 branch, when CONTROL A is high (i.e., 1), it controls SIG A IN and SIG A OUT to conduct, meaning the L1 branch is connected and different capacitors are connected. Other branches are the same as L1.
[0060] After each phase compensation is completed, it is necessary to determine whether the phase is within the reasonable range of [0, 0.2]. If it is within the reasonable range, no action is required, and the switch state remains unchanged. If it is outside the range, the switch is activated until the phase is within the reasonable range.
[0061] The required phase adjustments, based on multiple calculations, can be found in Table 1. However, in practice, multiple phase adjustments are necessary to achieve the best results.
[0062] Table 1
[0063]
[0064] In Table 1, 1 represents a high level, indicating that the analog switch port is on and the corresponding capacitor circuit is connected to the circuit to compensate for the phase. 0 represents a low level, indicating that the analog switch port is off and the corresponding capacitor circuit is disconnected from the circuit.
[0065] Working principle of this utility model:
[0066] A portion of the AC voltage signal at the output terminal is processed and output by the operational conditioning circuit. The signal processing unit acquires the signal output from the operational conditioning circuit and follows it. Simultaneously, the following signal enters the output conditioning circuit, which amplifies the signal and outputs the following signal to the phase detection circuit. The other portion of the AC voltage signal is input to the phase detection circuit, which detects the phase between the following signal output from the conditioning circuit and the AC voltage signal, and outputs both phases to the signal processing unit. The signal processing unit determines the phase deviation between the two signals and uses this to control the operational conditioning unit to perform phase compensation. Based on the different phase deviations calculated by the signal processing unit, it controls the analog switch combination to operate, connecting different capacitors to form different phase adjustment schemes, thus achieving phase compensation and providing a synchronous and in-phase signal source for voltage dip and rise simulation tests.
[0067] Although the specific embodiments of the present utility model have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present utility model. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solution of the present utility model are still within the scope of protection of the present utility model.
Claims
1. A real-time compensation circuit applied to a signal generating device, characterized in that, The system includes an operational conditioning circuit, a signal processing unit, an output conditioning circuit, and a phase detection circuit. The operational conditioning circuit is connected to the signal processing unit and transmits the conditioned AC voltage signal to the signal processing unit. The signal processing unit is connected to the output conditioning circuit, which in turn is connected to the phase detection circuit. The signal processing unit outputs a follower signal of the AC voltage signal, which, after being amplified by the output conditioning circuit, enters the phase detection circuit. The phase detection circuit is connected to the signal processing unit and compares the AC voltage signal and the follower signal using a comparator to obtain a phase signal. This phase signal is then fed back to the signal processing unit, which generates a control signal that is then fed back to the operational conditioning circuit. The operational conditioning circuit includes a phase compensation circuit and a voltage amplification circuit, and the phase compensation circuit includes multiple stages of analog switches connected in parallel.
2. The real-time compensation circuit for a signal generating device as described in claim 1, characterized in that, The input to the voltage amplifier circuit is the voltage generated at the output of operational amplifier U3A, which is then amplified by the voltage amplifier circuit. In the voltage amplifier circuit, the output of operational amplifier U3A is connected to one end of resistor R22, and the other end of R22 is grounded. Resistor R21 is connected between resistor R18 and the non-inverting input of operational amplifier U3B. Capacitor C5 is connected between the non-inverting input of operational amplifier U3B and the grounded end of resistor R22. One end of resistor R20 is grounded, and the other end of resistor R20 is connected to the inverting input of operational amplifier U3B. Varistor RV3 is connected between the output of operational amplifier U3B and the inverting input of operational amplifier U3B.
3. The real-time compensation circuit for a signal generating device as described in claim 2, characterized in that, The multi-level analog switch includes multiple input terminals and multiple output terminals. Each output terminal is connected to a resistor and a capacitor to form branches L1, L2, L3, and L4.
4. The real-time compensation circuit for a signal generating device as described in claim 3, characterized in that, The phase compensation circuit controls the analog switch to turn on based on the phase deviation calculated by the signal processing unit, so that different capacitors are connected to the circuit.
5. A real-time compensation circuit for a signal generating device as described in claim 1, characterized in that, The operational conditioning circuit also includes a current transformer T2. An AC voltage signal is input from the input terminal VinN+ of the real-time compensation circuit to a resistor R19. The output of the resistor R19 is input from the S1 port of the current transformer T2 and output from the S2 port of the current transformer T2. The S4 port of the current transformer T2 is connected to the negative input terminal of the operational amplifier U3A, and the S3 port of the current transformer T2 is connected to the positive input terminal of the operational amplifier U3A. The current transformer T2 is connected in parallel with diodes D3 and D4. The S4 port of the current transformer T2 is connected to the anode of diode D3 and the cathode of diode D4, and the S3 port of the current transformer T2 is connected to the cathode of diode D3 and the anode of diode D4, with the cathode of diode D3 grounded. The S4 port of the current transformer T2 is connected to one end of resistor R18 and to the analog switch I-in.
6. The real-time compensation circuit for a signal generating device as described in claim 1, characterized in that, The phase detection circuit includes comparator U4A and comparator U4B. An AC voltage signal enters the positive input terminal of comparator U4A through resistor R24; the negative input terminal is grounded; the output terminal is connected to VDD through resistor R23; VDD is connected to the positive power supply; VSS is grounded. The follow signal enters the positive input terminal of the comparator U4B through resistor R26; the negative input terminal is grounded; the output terminal is connected to VDD through resistor R25; VDD is connected to the positive terminal of the power supply.
7. The real-time compensation circuit for a signal generating device as described in claim 1, characterized in that, The output of the phase detection circuit is connected to the signal processing unit via an external interrupt.
8. The real-time compensation circuit for a signal generating device as described in claim 1, characterized in that, The phase detection circuit includes a phase signal processing circuit, which is connected to the signal processing unit.
9. A real-time compensation circuit for a signal generating device as described in claim 8, characterized in that, The phase signal processing circuit mainly consists of two comparators, U4A and U4B. The comparators U4A and U4B process the AC voltage signal and the follower signal respectively, and send the processed signals to the signal processing unit.
10. A real-time compensation circuit for a signal generating device as described in claim 8, characterized in that, The input terminal of the signal processing unit is connected to the output terminals of comparator U4A and comparator U4B, and the output terminal of the phase detection circuit is connected to the signal processing unit through an external interrupt.