Microcontroller-based resolver and differential sine-cosine sensor analog system and control method thereof
Patent Information
- Application Number
- CN202611196117.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-30
AI Technical Summary
第一类是基于专用信号发生器或数据采集卡配合模拟乘法器、放大器和隔离电路的方案,该类方案通常利用外部计算平台生成正弦、余弦参考信号,再与外部激励信号进行模拟调制后输出,由于硬件链路较长,依赖上位机或采集卡,整体成本较高,系统体积较大,且模拟链路中的乘法、放大、隔离等环节受器件离散性影响明显,调试工作量大,稳定性和一致性难以保证;
1、本发明通过示波器预先标定系统全链路固定延迟时间,并采用二阶前向预测算法计算角度超前补偿量,该延迟标定方法直接利用示波器测量外部激励信号与输出信号之间的相位差,无需依赖回读电路即可获得精确的固定延迟参数,相较于现有技术中仅采用固定相位补偿或依赖开环估算的方案,本发明以简化的硬件架构实现了高精度的角度超前补偿,在高速、高角加速度的动态场景下能够显著降低输出信号的角度滞后误差,从而满足高速电机控制器等被测设备对高动态精度的测试需求;
Smart Images

Figure CN123010551A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sensor signal simulation technology, and more specifically, to a microcontroller-based resolver and differential sine / cosine sensor simulation system and its control method. Background Technology
[0002] Rotary transformers (resolvers) and differential sine and cosine sensors are widely used in motor control, servo drive and new energy vehicle fields to provide rotor position and speed information. When performing bench testing, production line testing or fault diagnosis verification on the tested equipment such as motor controllers and resolver digital converters, test equipment that can simulate the sensor output signal is required.
[0003] Currently, simulation schemes for resolvers and differential sine / cosine sensors can be mainly classified into the following categories: The first type is a solution based on a dedicated signal generator or data acquisition card in conjunction with an analog multiplier, amplifier and isolation circuit. This type of solution usually uses an external computing platform to generate sine and cosine reference signals, and then performs analog modulation with the external excitation signal before output. Due to the long hardware link, it depends on the host computer or acquisition card, the overall cost is high and the system size is large. Moreover, the multiplication, amplification and isolation links in the analog link are significantly affected by the discreteness of the components, the debugging workload is large and the stability and consistency are difficult to guarantee. The second category is a digital analog scheme based on a microcontroller or digital signal processor in conjunction with a digital-to-analog converter. This type of scheme generates sine and cosine envelopes through MCU or DSP calculations, and then outputs them to the device under test via DAC. Some schemes can receive external excitation signals as a synchronization reference to reduce the frequency and phase deviation between the output signal and the internal reference of the device under test. However, most existing digital schemes adopt an open-loop control structure and do not consider the end-to-end delay from excitation sampling, digital calculation, digital-to-analog conversion to output conditioning. Under dynamic conditions of high speed and high angular acceleration, the angular lag error of the output signal increases significantly, making it difficult to meet the test accuracy requirements of high-performance motor controllers. The third type is a low-cost solution based on pulse width modulation and filtering. This type of solution has a low threshold for implementation, but the PWM signal needs to be filtered and reconstructed, which can easily introduce phase delay, amplitude attenuation and waveform distortion. In scenarios with high requirements for synchronization, orthogonality and dynamic response speed, it is difficult to balance accuracy and cost. Furthermore, existing resolver simulation solutions are typically designed for a single interface type, making it difficult to be compatible with sensor interfaces that do not have a carrier wave and only output differential sine and cosine envelopes, resulting in insufficient versatility. At the same time, although most solutions can output normal signals, it is not convenient to inject faults such as amplitude mismatch, phase deviation, quadrature error, bias anomaly, and open circuit / short circuit through software configuration, making it difficult to meet the needs of ECU fault diagnosis and fault tolerance limit testing.
[0004] Therefore, how to improve the angle simulation accuracy under dynamic working conditions, achieve accurate compensation for end-to-end delay, and be compatible with multiple sensor interface forms and configurable fault injection while ensuring low system cost and miniaturization has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0005] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a microcontroller-based resolver and differential sine / cosine sensor simulation system and its control method to solve the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: On one hand, the present invention provides a microcontroller-based simulation system for resolver and differential sine / cosine sensors, comprising: The excitation sampling and time reference module is used to receive the external excitation differential signal output by the device under test, establish a global time reference, and mark the excitation sampling time. The input conditioning module, connected to the excitation sampling and time base module, is used to convert the external excitation differential signal into a single-ended excitation sampling signal; The microcontroller core processing unit, connected to the input conditioning module, incorporates a link delay dynamic measurement unit, a prediction compensation calculation unit, and a waveform generation unit. The link delay dynamic measurement unit measures the total link delay time from excitation sampling to analog output in real time. The prediction compensation calculation unit calculates the angle advance compensation amount based on the current target angular velocity, angular acceleration, and total link delay time, and uses this compensation amount to correct the target angle. The waveform generation unit generates sine and cosine reference values based on the compensated angle value, and outputs a carrier-modulated resolver signal or a carrier-free differential sine and cosine envelope signal based on mode selection. The output conditioning module is connected to the core processing unit of the microcontroller and is used to perform amplitude conditioning and bias conditioning on the two generated single-ended sine and cosine analog signals. The differential output module, connected to the output conditioning module, is used to convert the conditioned single-ended signal into a differential sine signal and a differential cosine signal, and to control the output common-mode voltage before sending it to the device under test. The parameter configuration module is connected to the core processing unit of the microcontroller and is used to set test parameters and read system status.
[0007] Preferably, the link delay dynamic measurement unit includes: The sampling time recording subunit is used to record the moment when the excitation signal is sampled by the analog-to-digital converter. ; The output time recording subunit is used to record the timing of the digital-to-analog converter output waveform. ; The readback time recording subunit is used to record the moment when the output signal of the differential output module is sampled by the auxiliary analog-to-digital converter. ; Delayed computation subunit, used to calculate based on , , The preset circuit propagation delay parameters are used to calculate the total fixed delay of the entire link through oscilloscope calibration. ,in To incentivize the time from sampling to analog-to-digital conversion completion, For digital calculation time, For digital-to-analog conversion time, To output conditioning and differential conversion time, this fixed delay time is calibrated and pre-stored in the microcontroller as a fixed parameter for subsequent angle compensation.
[0008] Preferably, the prediction compensation calculation unit uses a second-order forward prediction algorithm to calculate the angle advance compensation amount, the expression of which is: , in, This is the current angle value. The current target angular velocity, The current target angular acceleration, The system's end-to-end fixed delay time; The end-to-end fixed delay time The phase difference between the external excitation signal and the output signal is measured by an oscilloscope and pre-calibrated, and stored in the core processing unit of the microcontroller. The prediction compensation calculation unit performs fixed advance compensation on the target angle according to the pre-calibrated fixed delay time.
[0009] Preferably, the waveform generation unit includes: The mode switching subunit is used to switch between resolver mode and differential sine / cosine mode; In resolver mode, the waveform generation unit modulates the sine reference quantity and cosine reference quantity with the external excitation synchronization signal, and outputs two differential sine modulated signals and differential cosine modulated signals with carriers. In differential sine and cosine mode, the waveform generation unit directly outputs a sine envelope signal and a cosine envelope signal without a carrier wave.
[0010] Preferably, the microcontroller core processing unit further includes a fault injection unit, which is used to inject one or more of the following fault types into the output signal: amplitude mismatch, phase deviation, quadrature error, channel offset anomaly, harmonic superposition, noise superposition, open circuit simulation, short circuit simulation, and misalignment simulation. Furthermore, under fault injection conditions, the link delay dynamic measurement unit and the prediction compensation calculation unit continue to operate normally, and their compensation functions are not affected by fault injection.
[0011] On the other hand, the present invention also provides a control method for a microcontroller-based resolver and differential sine / cosine sensor simulation system, applied to the aforementioned system, comprising the following steps: Step S1: Receive the external excitation differential signal output by the device under test through the excitation sampling and time reference module, establish a global time reference, and mark the excitation sampling time; Step S2: The external excitation differential signal is converted into a single-ended excitation sampling signal through the input conditioning module and sent to the microcontroller core processing unit; Step S3: Measure the fixed delay time of the entire link using the link delay dynamic measurement unit, and use this fixed delay time as a fixed parameter for subsequent angle compensation; Step S4: The prediction compensation calculation unit calculates the angle advance compensation amount based on the current target angular velocity, target angular acceleration and end-link fixed delay time using a forward prediction algorithm to obtain the compensated angle value; Step S5: The waveform generation unit generates sine and cosine reference values based on the compensated angle values, and outputs either a carrier-modulated resolver signal or a carrier-free differential sine and cosine envelope signal according to the mode selection. Step S6: Perform amplitude and bias conditioning on the two generated single-ended sine and cosine analog signals through the output conditioning module; Step S7: Convert the conditioned single-ended signal into a differential sine signal and a differential cosine signal through the differential output module, and send the output common-mode voltage to the device under test after setting it.
[0012] Preferably, the calibration method for the end-to-end fixed delay time in step S3 includes: The phase of the external excitation signal input to the excitation sampling module and the phase of the analog signal output by the differential output module are measured simultaneously using an oscilloscope. The total latency of the entire link is calculated by comparing the phase difference between the two. ,in , To incentivize the time from sampling to analog-to-digital conversion completion, For digital calculation time, For digital-to-analog conversion time, For output conditioning and differential conversion time; The calibrated fixed delay time The parameters are pre-stored in the core processing unit of the microcontroller as fixed parameters for subsequent angle compensation.
[0013] Preferably, the forward prediction algorithm in step S4 is a second-order forward prediction algorithm, and its angle advance compensation calculation expression is as follows: , in, This is the current angle value. The current target angular velocity, The current target angular acceleration, The pre-calibrated and stored end-to-end fixed delay time in step S3; the prediction compensation calculation unit directly uses the calculated... The compensated angle value is used for waveform generation.
[0014] Preferably, the mode selection in step S5 includes: When the resolver mode is selected, the sinusoidal reference quantity and the cosine reference quantity are modulated with the external excitation synchronization signal to output two differential sinusoidal modulation signals and differential cosine modulation signals with carrier waves. When the differential sine and cosine mode is selected, the sine envelope signal and cosine envelope signal without carrier are directly output.
[0015] Preferably, before or during step S5, a fault injection step is further included: performing one or more fault injection operations on the output signal according to the parameter configuration, such as amplitude mismatch, phase deviation, quadrature error, channel offset anomaly, harmonic superposition, noise superposition, open circuit simulation, short circuit simulation, or misalignment simulation, and when performing fault injection, the link delay measurement in step S3 and the prediction compensation calculation in step S4 remain normal and are not affected by fault injection.
[0016] The technical effects and advantages of this invention are as follows: 1. This invention pre-calibrates the fixed delay time of the entire system link using an oscilloscope and calculates the angle lead compensation using a second-order forward prediction algorithm. This delay calibration method directly uses an oscilloscope to measure the phase difference between the external excitation signal and the output signal, and can obtain accurate fixed delay parameters without relying on a readback circuit. Compared with the existing technology that only uses fixed phase compensation or relies on open-loop estimation, this invention achieves high-precision angle lead compensation with a simplified hardware architecture. In dynamic scenarios with high speed and high angular acceleration, it can significantly reduce the angle lag error of the output signal, thereby meeting the high dynamic accuracy test requirements of devices under test such as high-speed motor controllers. 2. This invention obtains the fixed delay time of the entire link through oscilloscope calibration. The delay calibration process is simple and quick. The calibrated fixed delay parameters are pre-stored in the microcontroller. In actual operation, the system directly calls the fixed delay parameters for angle advance compensation. There is no need for complex dynamic closed-loop measurement and real-time update mechanisms, which significantly reduces the system hardware cost and MCU computing overhead. At the same time, it avoids the additional errors and debugging complexity introduced by the readback link, making the system more reliable and maintainable in mass production deployment and field testing scenarios. 3. This invention, through the mode switching subunit in the waveform generation unit, enables free switching between resolver mode and differential sine / cosine mode on the same hardware link, accommodating the testing requirements of different types of sensor interfaces and reducing redundant investment in testing equipment. In addition, the microcontroller core processing unit has a built-in fault injection unit, which can flexibly inject various fault types such as amplitude mismatch, phase deviation, quadrature error, bias anomaly, harmonic superposition, noise superposition, as well as open circuit, short circuit, and misconnection through software configuration. Moreover, the link delay measurement and prediction compensation functions remain independent under fault injection conditions, which facilitates comprehensive verification of the fault diagnosis logic and fault tolerance capability of the device under test, effectively improving the coverage and repeatability of automated testing. Attached Figure Description
[0017] Figure 1 This is an overall system diagram of the present invention.
[0018] Figure 2 This is a block diagram of the link delay dynamic measurement unit of the present invention.
[0019] Figure 3 This is a flowchart of the method of the present invention.
[0020] The attached diagram is labeled as follows: 1. Excitation sampling and time reference module; 2. Input conditioning module; 3. Microcontroller core processing unit; 31. Link delay dynamic measurement unit; 311. Sampling time recording subunit; 312. Output time recording subunit; 313. Readback time recording subunit; 314. Delay calculation subunit; 32. Prediction compensation calculation unit; 33. Waveform generation unit; 34. Fault injection unit; 4. Output conditioning module; 5. Differential output module; 6. Parameter configuration module. Detailed Implementation
[0021] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0022] Example 1 As attached Figure 1-2As shown, the present invention provides a microcontroller-based simulation system for a resolver and differential sine / cosine sensor, comprising: an excitation sampling and time reference module 1, an input conditioning module 2, a microcontroller core processing unit 3, an output conditioning module 4, a differential output module 5, and a parameter configuration module 6.
[0023] In this embodiment: The input of the excitation sampling and time reference module 1 is connected to the excitation output of the device under test (DUT) to receive the external excitation differential signal output by the DUT, establish a global time reference, and mark the excitation sampling time. The output of this module is connected to the input of the input conditioning module 2. The output of the input conditioning module 2 is connected to the analog-to-digital converter input of the microcontroller core processing unit 3. The input conditioning module 2 is used to convert the external excitation differential signal into a single-ended excitation sampling signal to meet the sampling input requirements of the microcontroller. The microcontroller core processing unit 3 has a built-in link delay dynamic measurement unit 31, a prediction compensation calculation unit 32, and a waveform generation unit 33. The link delay dynamic measurement unit 31 is used to obtain the fixed delay time of the entire link from excitation sampling to analog output using an oscilloscope calibration method. The prediction compensation calculation unit 32 is used to calculate the angle advance compensation amount based on the current target angular velocity, target angular acceleration, and fixed delay time of the entire link, and use the compensation amount to correct the target angle. The waveform generation unit 33 is used to generate sine reference amount and cosine reference amount based on the compensated angle value, and output a carrier-modulated resolver signal or a carrier-free differential sine and cosine envelope signal based on mode selection. The digital-to-analog conversion output terminal of the microcontroller core processing unit 3 is connected to the input terminal of the output conditioning module 4. The output terminal of the output conditioning module 4 is connected to the input terminal of the differential output module 5. The output conditioning module 4 is used to perform amplitude conditioning and bias conditioning on the two single-ended sine and cosine analog signals generated by the microcontroller core processing unit 3. The differential output module 5 is connected to the output conditioning module 4. It is used to convert the conditioned single-ended signal into a differential sine signal and a differential cosine signal, and to control the output common-mode voltage before sending it to the device under test. The parameter configuration module 6 is connected to the communication interface of the microcontroller core processing unit 3 and is used to set test parameters and read system status.
[0024] In this embodiment, the link delay dynamic measurement unit 31 is implemented as follows: The link delay dynamic measurement unit 31 includes a sampling time recording subunit 311, an output time recording subunit 312, a readback time recording subunit 313, and a delay calculation subunit 314; Sampling time recording subunit 311 is used to record the time when the excitation signal is sampled by the analog-to-digital converter. ; Output time recording subunit 312 is used to record the timing of the digital-to-analog converter output waveform. ; Readback time recording subunit 313 is used to record the moment when the readback signal of the differential output module 5 is sampled by the auxiliary analog-to-digital converter. ; Delayed calculation subunit 314 is used to calculate based on , , The preset circuit propagation delay parameters are used to calculate the total fixed delay of the entire link through oscilloscope calibration. ,in To incentivize the time from sampling to analog-to-digital conversion completion, For digital calculation time, For digital-to-analog conversion time, To output the conditioning and differential conversion time, this fixed delay time is calibrated and pre-stored in the microcontroller as a fixed parameter for subsequent angle compensation, and is no longer dynamically updated.
[0025] In this embodiment, the specific algorithm of the prediction compensation calculation unit 32 is as follows: Prediction and compensation calculation unit 32 uses a second-order forward prediction algorithm to calculate the angle advance compensation amount, the expression of which is: , in, This is the current angle value. The current target angular velocity, The current target angular acceleration, The system's end-to-end fixed delay time; End-to-end fixed delay time The phase difference between the external excitation signal and the output signal is measured using an oscilloscope for pre-calibration and stored in the microcontroller core processing unit 3. The prediction compensation calculation unit 32 performs fixed advance compensation on the target angle based on the pre-calibrated fixed delay time, directly using the calculated... The compensated angle value is used for proportional-integral closed-loop regulation without relying on the readback signal.
[0026] In this embodiment, the waveform generation unit 33 includes a mode switching subunit for switching between resolver mode and differential sine / cosine mode; In resolver mode, waveform generation unit 33 modulates the sine reference quantity and cosine reference quantity with the external excitation synchronization signal, and outputs two differential sine modulated signals and differential cosine modulated signals with carrier waves. In differential sine and cosine mode, waveform generation unit 33 directly outputs sine envelope signal and cosine envelope signal without carrier wave.
[0027] In this embodiment, the microcontroller core processing unit 3 further includes a fault injection unit 34, which is used to inject one or more of the following fault types into the output signal: amplitude mismatch, phase deviation, quadrature error, channel offset anomaly, harmonic superposition, noise superposition, open circuit simulation, short circuit simulation, and misalignment simulation. During fault injection, the link delay dynamic measurement unit 31 and the prediction compensation calculation unit 32 continue to operate normally, and their compensation functions are not affected by fault injection.
[0028] Example 2 As attached Figure 3 As shown, this embodiment also provides a control method for a microcontroller-based resolver and differential sine / cosine sensor simulation system, applied to the aforementioned system, including the following steps: Step S1: Receive the external excitation differential signal output by the device under test through the excitation sampling and time reference module 1, establish a global time reference, and mark the excitation sampling time; Step S2: The external excitation differential signal is converted into a single-ended excitation sampling signal by the input conditioning module 2 and sent to the microcontroller core processing unit 3; Step S3: Obtain the fixed delay time of the entire link using the link delay dynamic measurement unit 31 with an oscilloscope calibration method, and use this fixed delay time as a fixed parameter for subsequent angle compensation. The specific calibration method includes: The phase of the external excitation signal input to the excitation sampling module and the phase of the analog signal output by the differential output module are measured simultaneously using an oscilloscope. The total latency of the entire link is calculated by comparing the phase difference between the two. ,in, To incentivize the time from sampling to analog-to-digital conversion completion, For digital calculation time, For digital-to-analog conversion time, For output conditioning and differential conversion time; The calibrated fixed delay time The parameters are pre-stored in the core processing unit 3 of the microcontroller as fixed parameters for subsequent angle compensation. Step S4: The prediction compensation calculation unit 32 calculates the angle advance compensation amount using a second-order forward prediction algorithm based on the current target angular velocity, target angular acceleration and the fixed delay time of the entire link calibrated in step S3, and obtains the compensated angle value. Its calculation expression is: , in, This is the current angle value. The current target angular velocity, The current target angular acceleration, The pre-calibrated and stored end-to-end fixed delay time in step S3; the prediction compensation calculation unit 32 directly uses the calculated... The compensated angle value is used for waveform generation, eliminating the need for proportional-integral closed-loop correction. Step S5: The waveform generation unit 33 generates sine reference quantity and cosine reference quantity based on the compensated angle value, and outputs either a carrier-modulated resolver signal or a carrier-free differential sine and cosine envelope signal according to the mode selection. Step S6: The two generated single-ended sine and cosine analog signals are subjected to amplitude and bias conditioning by the output conditioning module 4; Step S7: Convert the conditioned single-ended signal into a differential sine signal and a differential cosine signal through the differential output module, and send the output common-mode voltage to the device under test after setting it.
[0029] Furthermore, before or during step S5, a fault injection step is also included: performing one or more fault injection operations on the output signal according to the parameter configuration, such as amplitude mismatch, phase deviation, quadrature error, channel offset anomaly, harmonic superposition, noise superposition, open circuit simulation, short circuit simulation, or misalignment simulation, and when performing fault injection, the link delay measurement in step S3 and the prediction compensation calculation in step S4 remain normal and are not affected by fault injection.
[0030] In a preferred embodiment, the microcontroller core processing unit 3 preferably uses a microcontroller with a multi-channel high-speed analog-to-digital converter and a dual-channel high-speed digital-to-analog converter, such as the STM32H7 series, but is not limited to this. The input conditioning module 2 preferably uses a combination of a differential acquisition circuit and a single-supply level shifting circuit. The output conditioning module 4 preferably uses two analog conditioning circuits to adjust the amplitude and set the center bias of the sine and cosine channels respectively. The differential output module 5 preferably uses a differential drive circuit with a settable output common-mode voltage. The parameter configuration module 6 can use a serial port, CAN interface, Ethernet interface, or host computer script interface.
[0031] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A microcontroller-based simulation system for resolver and differential sine / cosine sensors, characterized in that: include: The excitation sampling and time reference module (1) is used to receive the external excitation differential signal output by the device under test, establish a global time reference, and mark the excitation sampling time; The input conditioning module (2) is connected to the excitation sampling and time base module (1) and is used to convert the external excitation differential signal into a single-ended excitation sampling signal. The microcontroller core processing unit (3) is connected to the input conditioning module (2) and has a built-in link delay dynamic measurement unit (31), prediction compensation calculation unit (32) and waveform generation unit (33). The link delay dynamic measurement unit (31) is used to measure the full link delay time from excitation sampling to analog output in real time. The prediction compensation calculation unit (32) is used to calculate the angle advance compensation amount based on the current target angular velocity, angular acceleration and full link delay time, and use the compensation amount to correct the target angle. The waveform generation unit (33) is used to generate sine reference amount and cosine reference amount based on the compensated angle value, and output a carrier-modulated resolver signal or a carrier-free differential sine and cosine envelope signal based on mode selection. The output conditioning module (4) is connected to the microcontroller core processing unit (3) and is used to perform amplitude conditioning and bias conditioning on the two generated single-ended sine and cosine analog signals. The differential output module (5) is connected to the output conditioning module (4) and is used to convert the conditioned single-ended signal into a differential sine signal and a differential cosine signal, and to control the output common-mode voltage before sending it to the device under test. The parameter configuration module (6) is connected to the microcontroller core processing unit (3) and is used to set test parameters and read system status.
2. The microcontroller-based resolver and differential sine / cosine sensor simulation system according to claim 1, characterized in that: The link delay dynamic measurement unit (31) includes: The sampling time recording subunit (311) is used to record the time when the excitation signal is sampled by the analog-to-digital converter. ; Output time recording subunit (312) is used to record the timing of the digital-to-analog converter output waveform. ; The readback time recording subunit (313) is used to record the time when the output signal of the differential output module (5) is sampled by the auxiliary analog-to-digital converter. ; Delayed computation subunit (314) is used to calculate based on , , The preset circuit propagation delay parameters are used to calculate the total fixed delay of the entire link through oscilloscope calibration. ,in To incentivize the time from sampling to analog-to-digital conversion completion, For digital calculation time, For digital-to-analog conversion time, To output conditioning and differential conversion time, this fixed delay time is calibrated and pre-stored in the microcontroller as a fixed parameter for subsequent angle compensation.
3. The microcontroller-based resolver and differential sine / cosine sensor simulation system according to claim 1, characterized in that: The prediction compensation calculation unit (32) uses a second-order forward prediction algorithm to calculate the angle advance compensation amount, the expression of which is: , in, This is the current angle value. The current target angular velocity, The current target angular acceleration, The system's end-to-end fixed delay time; The end-to-end fixed delay time The phase difference between the external excitation signal and the output signal is measured by an oscilloscope and pre-calibrated, and stored in the core processing unit (3) of the microcontroller. The prediction compensation calculation unit (32) performs fixed advance compensation on the target angle according to the pre-calibrated fixed delay time.
4. The microcontroller-based resolver and differential sine / cosine sensor simulation system according to claim 1, characterized in that: The waveform generation unit (33) includes: The mode switching subunit is used to switch between resolver mode and differential sine / cosine mode; In resolver mode, the waveform generation unit (33) modulates the sine reference quantity and cosine reference quantity with the external excitation synchronization signal, and outputs two differential sine modulated signals and differential cosine modulated signals with carriers; In differential sine and cosine mode, the waveform generation unit (33) directly outputs a sine envelope signal and a cosine envelope signal without a carrier.
5. The microcontroller-based resolver and differential sine / cosine sensor simulation system according to claim 1, characterized in that: The microcontroller core processing unit (3) further includes a fault injection unit (34), which is used to inject one or more of the following fault types into the output signal: amplitude mismatch, phase deviation, quadrature error, channel offset anomaly, harmonic superposition, noise superposition, open circuit simulation, short circuit simulation, and misalignment simulation. In the fault injection state, the link delay dynamic measurement unit (31) and the prediction compensation calculation unit (32) continue to work normally, and their compensation function is not affected by the fault injection.
6. A control method for a microcontroller-based resolver and differential sine / cosine sensor simulation system, applied to the system described in any one of claims 1-5, characterized in that: Includes the following steps: Step S1: Receive the external excitation differential signal output by the device under test through the excitation sampling and time reference module (1), establish a global time reference, and mark the excitation sampling time; Step S2: The external excitation differential signal is converted into a single-ended excitation sampling signal by the input conditioning module (2) and sent to the microcontroller core processing unit (3). Step S3: Measure the fixed delay time of the entire link through the link delay dynamic measurement unit (31), and use the fixed delay time as the fixed parameter for subsequent angle compensation; Step S4: The prediction compensation calculation unit (32) calculates the angle advance compensation amount based on the current target angular velocity, target angular acceleration and the fixed delay time of the entire link using the forward prediction algorithm, and obtains the compensated angle value; Step S5: The waveform generation unit (33) generates sine reference quantity and cosine reference quantity according to the compensated angle value, and outputs a carrier-modulated resolver signal or a carrier-free differential sine and cosine envelope signal according to the mode selection. Step S6: The two generated single-ended sine and cosine analog signals are subjected to amplitude and bias conditioning by the output conditioning module (4); Step S7: Convert the conditioned single-ended signal into a differential sine signal and a differential cosine signal through the differential output module (5), and send the output common-mode voltage to the device under test after setting it.
7. The method according to claim 6, characterized in that: The calibration method for the end-to-end fixed delay time in step S3 includes: The phase of the external excitation signal input to the excitation sampling module and the phase of the analog signal output by the differential output module are measured simultaneously using an oscilloscope. The total latency of the entire link is calculated by comparing the phase difference between the two. ,in , To incentivize the time from sampling to analog-to-digital conversion completion, For digital calculation time, For digital-to-analog conversion time, For output conditioning and differential conversion time; The calibrated fixed delay time The parameters are pre-stored in the core processing unit of the microcontroller (3) as fixed parameters for subsequent angle compensation.
8. The method according to claim 6, characterized in that: In step S4, the forward prediction algorithm is a second-order forward prediction algorithm, and its angle advance compensation calculation expression is as follows: , in, This is the current angle value. The current target angular velocity, The current target angular acceleration, The pre-calibrated and stored end-to-end fixed delay time in step S3; the prediction compensation calculation unit (32) directly uses the calculated... The compensated angle value is used for waveform generation.
9. The control method according to claim 6, characterized in that: The mode selection in step S5 includes: When the resolver mode is selected, the sinusoidal reference quantity and the cosine reference quantity are modulated with the external excitation synchronization signal to output two differential sinusoidal modulation signals and differential cosine modulation signals with carrier waves. When the differential sine and cosine mode is selected, the sine envelope signal and cosine envelope signal without carrier are directly output.
10. The control method according to claim 6, characterized in that: Before or during step S5, a fault injection step is also included: performing one or more fault injection operations on the output signal according to the parameter configuration, such as amplitude mismatch, phase deviation, quadrature error, channel offset anomaly, harmonic superposition, noise superposition, open circuit simulation, short circuit simulation, or misalignment simulation. When performing fault injection, the link delay measurement in step S3 and the prediction compensation calculation in step S4 remain normal and are not affected by fault injection.