Electronic load-based output current control method, apparatus, device, and medium
By using multiple timers in the electronic load to collaboratively control the DAC value output, the problem of connection between current waveforms is solved, achieving smooth transition of current waveforms and accurate performance evaluation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN ZHIDE MEASUREMENT & CONTROL TECHNOLOGY CO LTD
- Filing Date
- 2026-04-20
- Publication Date
- 2026-07-21
AI Technical Summary
In the prior art, when electronic loads control the output current, the fixed time reference of the timer causes gaps or overlaps in the connection between current waveforms, resulting in distorted power supply evaluation results.
By pre-setting current parameters, multiple timers are used to collaboratively control the DAC value output, ensuring a smooth transition of the current waveform. This includes starting and stopping timers at specific times to control the rise and fall slopes of the current, thus avoiding current waveform distortion.
This achieves a smooth transition of the current waveform, avoids distortion of power supply evaluation results, and ensures the accuracy of performance evaluation.
Smart Images

Figure CN122064189B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power supply testing technology, and in particular to a method, apparatus, device and medium for controlling the output current based on an electronic load. Background Technology
[0002] An electronic load is a device used to test power supply performance. When testing power supply performance using an electronic load, the CPU typically directly controls the output reference signal of the DAC, and then a hardware current loop controls the output of the electronic load. Because the electronic load is controlled by a hardware current loop, the output signal must change smoothly, and the time interval between two signal cycles should be as short as possible.
[0003] In existing technologies, the timer in the electronic load acts as a "metronome" with a fixed time base. The DMA (Digital Memory Access) automatically moves waveform data from memory to the DAC (Digital Converter) based on this time base, causing the power supply to output the first sloping current. After the DMA completes moving a set of data, it triggers an interrupt and notifies the CPU. Upon receiving the notification, the CPU recalculates and modifies the timer period according to a preset duty cycle, thus changing the speed of the next waveform, and then instructs the DMA to move the next set of data, causing the power supply to output another sloping current. However, determining when data movement is complete and starting the timer also require time. This can cause gaps or overlaps in the connection between the current waveforms output by the power supply due to external factors, leading to distorted power supply evaluation results. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, device, and medium for controlling output current based on electronic load that can avoid evaluation distortion in response to the above-mentioned technical problems.
[0005] A method for controlling the output current based on an electronic load, the method comprising:
[0006] S1. Preset current parameters and determine initial values based on the current parameters; the current parameters include maximum current, minimum current, rising slope, falling slope, current rise and a first duration for maintaining the maximum current;
[0007] S2. When the output current of the power supply under test is the minimum current and remains unchanged, start the first timer;
[0008] S3. When the value of the first timer reaches the initial value, start the second and third timers, stop the first timer and clear it to zero, so that the controller in the electronic load outputs the DAC value and the power supply under test outputs current according to the rising slope.
[0009] S4. When the value of the second timer reaches the first value, the second timer is stopped and cleared to zero so that the power supply under test outputs the maximum current. When it is determined that the DAC value of the controller has been output, the first timer is started and the second value is determined according to the first current value of the third timer. The first value is determined based on the maximum current, the minimum current and the rising slope.
[0010] S5. When the value of the first timer reaches the second value, start the second timer and the third timer, stop the first timer and clear it to zero, so that the controller outputs the DAC value and the power supply under test outputs current according to the falling slope.
[0011] In this application, when the value of the second timer reaches the first value, the second timer is stopped and cleared to enable the power supply under test to output the maximum current. When the DAC value output of the controller is completed, the first timer is started and the second value is determined according to the first current value of the third timer. When the value of the first timer reaches the second value, the second and third timers are started, the first timer is stopped and cleared to enable the controller to output the DAC value, and the power supply under test outputs current with a decreasing slope. This ensures that the duration of the maximum current output by the power supply under test is the desired duration, and that the power supply under test can output current with a decreasing slope within the expected time. This avoids the distortion of the waveform of the alternating current output caused by the electronic load, thereby obtaining a reliable alternating current and avoiding distortion of the performance evaluation results.
[0012] In one embodiment, step S5 is followed by:
[0013] S6. When the value of the second timer reaches the third value, the second timer is stopped and cleared to make the power supply under test output the minimum current. When it is determined that the controller has finished outputting data, the first timer is started and a fourth value is determined according to the second current value of the third timer. The third value is determined based on the maximum current, the minimum current and the falling slope.
[0014] S7. Update the initial value in step S3 to the fourth value, and repeat steps S3, S4, S5, S6 and S7 after updating the initial value to obtain the alternating current output by the power supply under test, and evaluate the performance of the power supply under test through the alternating current.
[0015] In this application, when the value of the second timer reaches the third value in step S6, the second timer is stopped and reset to zero to minimize the current output of the power supply under test. After confirming that the controller's data output is complete, the first timer is started, and a fourth value is determined based on the second current value of the third timer. In step S7, the initial value in step S3 is updated to the fourth value, and steps S3, S4, S5, S6, and S7 are repeated. This allows the power supply under test to output the desired alternating current, thereby enabling the performance of the power supply under test to be evaluated through alternating current.
[0016] In one embodiment, the process of determining the third value in step S6 is as follows:
[0017] Based on the maximum current, the minimum current, and the descent slope, using the formula Calculate the second time required for the current to drop from the maximum current to the minimum current;
[0018] When the second duration exceeds a preset threshold, based on the second duration, using the formula... Calculate the first preset value of the second timer when the current decreases;
[0019] Based on the first predetermined target, through the formula Calculate the third value;
[0020] Where I1 is the maximum current, I0 is the minimum current, k2 is the descent slope, T4_psc2 is the first prescaler, and T f A1 is the maximum count value of the second timer, A2 is the buffer capacity of the controller in the electronic load, and T4_arr2 is the third value.
[0021] In this application, based on the maximum current, minimum current, and descent slope, a formula is used... Calculate the second time required for the current to drop from the maximum to the minimum. If the second time exceeds a preset threshold, based on the second time, use the formula... Calculate the first prescaler of the second timer when the current decreases, and based on the first prescaler, use the formula... Calculate the third value, which can be used to determine the stop time of the second timer. This ensures that the output current of the power supply under test is minimized in time, preventing the waveform of the output current from overlapping or being interrupted, thus ensuring that the performance evaluation of the power supply under test can proceed smoothly.
[0022] In one embodiment, the process of determining the fourth value in step S6 is as follows:
[0023] Determine a second duration required for the current to drop from the maximum current back to the maximum current;
[0024] Based on the second duration, using the formula Calculate the second predetermined target of the third timer when the current decreases;
[0025] When it is determined that the controller in the electronic load has finished outputting data, the second current value of the third timer is obtained, and based on the second predetermined target, the second duration, and the second current value, the formula is used to... Calculate the first delay duration required to determine whether the detection data has been completely output;
[0026] Based on the first delay duration, the current decrease and the third duration of maintaining the minimum current in the current parameters, and the second duration, the formula is used. Calculate the first initial duration;
[0027] Based on the first initial duration, through and Calculate the fourth value;
[0028] Among them, T f The second duration is T9_psc2, the second prescaler is T9_psc2, the third timer's maximum count value is A3, and the second current value is T9_cnt2. d2 For the first delay duration, T y T is the first initial duration. b T3_psc1 is the third duration, T3_arr1 is the fifth prescaler of the first timer, T3_arr1 is the fourth value, and A4 is the maximum count value of the first timer.
[0029] In this application, a second time duration required for the current to drop from the maximum current to the maximum current is determined, and based on this second time duration, a formula is used to... The second prescaler of the third timer is calculated when the current decreases. When the data output of the controller in the electronic load is completed, the second current value of the third timer is obtained. Based on the second prescaler, the second duration, and the second current value, the formula is used to... The calculation determines whether the detection data output is complete, starting with the first delay duration. Based on this first delay duration, the third and second delay durations for current decrease and minimum current maintenance in the current parameters, the calculation is performed using the formula... Calculate the first initial duration, and based on the first initial duration, through... and Calculate the fourth value so that the duration of the minimum output current of the power supply under test is the expected duration, so that the power supply under test can output current at the expected time with a rising slope, and ensure that the waveform of the alternating current output does not have overlap or gaps caused by electronic load, thereby obtaining reliable alternating current and avoiding distortion of performance evaluation results.
[0030] In one embodiment, the process of determining the initial value in step S1 is as follows:
[0031] Based on the maximum current, the minimum current, and the rising slope, using the formula Calculate the fourth time required for the current to rise from the minimum current to the maximum current;
[0032] Based on the fourth duration and the first duration, using the formula Calculate the second initial duration;
[0033] Based on the second initial duration, through and Calculate the initial values;
[0034] Among them, T r For the fourth duration, I1 is the maximum current, I0 is the minimum current, k1 is the rising slope, and T... a For the first duration, T 初 A4 is the second initial duration, T3_psc is the sixth prescaler of the first timer, and T3_arr is the initial value.
[0035] In this application, based on the maximum current, minimum current, and rising slope, a formula is used... Calculate the fourth time interval required for the current to rise from the minimum to the maximum, based on the fourth time interval and the first time interval, using the formula... Calculate the second initial duration, and based on the second initial duration, through... and Calculate the initial value, which will allow you to determine the stop time of the first timer.
[0036] In one embodiment, the process of determining the first value in step S4 includes:
[0037] Based on the maximum current, the minimum current, and the rising slope, calculate the fourth time required for the current to rise from the minimum current to the maximum current.
[0038] When the fourth duration exceeds a preset threshold, based on the fourth duration, the formula is used... Calculate the third prescaler of the second timer as the current rises;
[0039] Based on the aforementioned third pre-target, through the formula Calculate the first value;
[0040] Among them, T4_psc1 is the third predefined target, T rThe fourth duration is defined as follows: A1 is the maximum count value of the second timer, A2 is the buffer capacity of the controller in the electronic load, and T4_arr1 is the first value.
[0041] In this application, a fourth time interval required to rise from the minimum current to the maximum current is calculated based on the maximum current, minimum current, and rising slope. When the fourth time interval exceeds a preset threshold, the formula is used to determine the optimal time interval. Calculate the third prescaler of the second timer when the current rises, and based on the third prescaler, use the formula... Calculate the first value, and then determine the stop time of the second timer based on the first value.
[0042] In one embodiment, the calculation process of the second value in step S2 includes:
[0043] Determine the fourth duration required for the current to rise from the minimum current to the maximum current;
[0044] Based on the aforementioned fourth duration, using the formula Calculate the fourth prescaler of the third timer when the current rises;
[0045] When it is determined that the controller in the electronic load has finished outputting data, the first current value of the third timer is obtained, and based on the fourth precalibrator, the fourth duration, and the first current value, the formula is used to... Calculate the second delay duration from the minimum current to the maximum current;
[0046] Based on the second delay duration, the first duration, and the fourth duration, using the formula Calculate the third initial duration;
[0047] Based on the third initial duration, through and Calculate the second value;
[0048] Among them, T r For the fourth duration, T9_psc1 is the fourth prescaler, A3 is the maximum count value of the third timer, T9_cnt1 is the first current value, T d1 For the second delay duration, T x For the third initial duration, T a T3_psc2 is the seventh prescaler of the first timer, T3_arr2 is the second value, and A4 is the maximum count value of the first timer.
[0049] In this application, a fourth time duration required for the current to rise from the minimum current to the maximum current is determined; based on this fourth time duration, a formula is used... Calculate the fourth prescaler of the third timer when the current rises; when the data output of the controller in the electronic load is completed, obtain the first current value of the third timer, and based on the fourth prescaler, the fourth duration, and the first current value, use the formula... Calculate the second delay duration from the minimum current to the maximum current; based on the second delay duration, the first delay duration, and the fourth delay duration, use the formula... Calculate the third initial duration; based on the third initial duration, through... and Calculate the second value so that the duration of the maximum output current of the power supply under test is the desired duration. This allows the power supply under test to output current at a decreasing slope within the expected time, avoiding overlap or gaps in the waveform of the alternating current caused by the electronic load. This ensures a reliable alternating current and avoids distortion of performance evaluation results.
[0050] An output current control device based on an electronic load is used to perform the above-described method, the device comprising:
[0051] The parameter preset module is used to preset current parameters and determine initial values based on the current parameters; the current parameters include maximum current, minimum current, rising slope, falling slope, current rise and a first duration for maintaining the maximum current;
[0052] The first startup module is used to start the first timer when the output current of the power supply under test is the minimum current and remains unchanged;
[0053] The second startup module is used to start the second and third timers and stop and clear the first timer when the value of the first timer reaches the initial value, so that the controller in the electronic load outputs the DAC value and the power supply under test outputs current according to the rising slope.
[0054] The third startup module is used to stop and clear the second timer when the value of the second timer reaches the first value, so that the power supply under test outputs the maximum current, and to start the first timer and determine the second value according to the first current value of the third timer when it is determined that the DAC value of the controller has been output. The first value is determined based on the maximum current, the minimum current and the rising slope.
[0055] The fourth startup module is used to start the second and third timers, stop the first timer and clear it when the value of the first timer reaches the second value, so that the controller outputs the DAC value and the power supply under test outputs current according to the falling slope.
[0056] A computer device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the method described above.
[0057] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0058] The aforementioned output current control device, equipment, and medium for electronic loads, by stopping and resetting the second timer when the value of the second timer reaches the first value, allows the power supply under test to output the maximum current. Upon completion of the controller's DAC value output, the first timer is started, and the second value is determined based on the first current value of the third timer. When the value of the first timer reaches the second value, the second and third timers are started, and the first timer is stopped and reset, allowing the controller to output the DAC value. This causes the power supply under test to output current with a decreasing slope. This ensures that the duration of the maximum current output by the power supply under test is the desired duration, allowing the power supply under test to output current with a decreasing slope within the expected time. It avoids distortion in the waveform of the alternating current caused by the electronic load, thereby obtaining a reliable alternating current and preventing distortion of performance evaluation results. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating an output current control method based on an electronic load in one embodiment;
[0060] Figure 2 This is a waveform diagram of alternating current in one embodiment;
[0061] Figure 3 This is a schematic diagram illustrating the triggering principle of the first timer, the second timer, and the third timer in one embodiment;
[0062] Figure 4 This is a schematic diagram of the current loop system of an electronic load in one embodiment. Detailed Implementation
[0063] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0064] In one embodiment, such as Figure 1 As shown, an output current control method based on an electronic load is provided, including the following steps:
[0065] S1. Preset current parameters and determine initial values based on current parameters; current parameters include maximum current, minimum current, rising slope, falling slope, current rise and first duration of holding maximum current;
[0066] The current parameter refers to the waveform parameters of the alternating current output by the power supply under test. The alternating current waveform corresponding to the current parameter is a trapezoidal wave. A schematic diagram of the alternating current waveform is shown below. Figure 2 As shown, where I1 is the maximum current, I0 is the minimum current, k2 is the decreasing slope, k1 is the increasing slope, and T... a For the first duration, T b The third duration for the current to decrease and maintain the minimum current is t0, t1, t2, t3, t4 and tx are all time parameters.
[0067] Maximum current refers to the maximum expected output current of the power supply under test, and minimum current refers to the minimum expected output current of the power supply under test.
[0068] The rising slope refers to the rate at which the output current of the power supply under test rises from its minimum current to its maximum current. The falling slope refers to the rate at which the output current of the power supply under test falls from its maximum current to its minimum current.
[0069] When the current parameters are preset, the waveforms of the current rising to the maximum current and the current falling to the minimum current must be smooth, which means that the more output points the DAC (Digital to Analog Converter) has, the better.
[0070] The first duration is the sum of the time required for the current to rise from the minimum current to the maximum current and the time required to keep the maximum current constant.
[0071] Furthermore, the initial values are determined based on the maximum current, minimum current, first duration, and rising slope.
[0072] S2. When the output current of the power supply under test is at its minimum and remains constant, start the first timer;
[0073] The phrase "output current is minimum and constant" means that the current output by the power supply under test is currently at its minimum and will only continue to rise after a period of time.
[0074] The power supply under test (PST) refers to a power supply that requires performance testing. Examples include pre-installed mobile phone power supplies and computer power supplies. An electronic load is connected to the PST.
[0075] Furthermore, when the power supply under test is started, if the current output current of the power supply under test is the minimum current and remains unchanged, then the first timer of the electronic load is started.
[0076] S3. When the value of the first timer reaches the initial value, start the second and third timers, stop the first timer and clear it to zero, so that the controller in the electronic load outputs the DAC value and the power supply under test outputs current according to the rising slope.
[0077] The value of the first timer is the count value of the first timer.
[0078] The current output by the power supply under test is controlled to rise from the minimum current to the maximum current according to the rising slope.
[0079] The second and third timers are started via a synchronization signal TRGI (Trigger Input). Specifically, when the value of the first timer reaches its initial value, the first timer sends a synchronization signal TRGO (Trigger Output) to the second and third timers. The second and third timers start immediately upon receiving the synchronization signal TRGI corresponding to TRGO. The triggering principle diagrams for the first, second, and third timers are shown below. Figure 3 As shown.
[0080] When the second timer is started, it triggers the DMA (Direct Memory Access) controller in the electronic load. The DMA then triggers the SPI (Serial Peripheral Interface) in the electronic load. The SPI outputs a DAC value to the DAC chip in the electronic load. The DAC chip outputs a signal, and the hardware current loop receives the output current signal and drives the power device to make the output current of the power supply under test continuously increase according to the rising slope. The schematic diagram of the current loop system of the electronic load is shown below. Figure 4 As shown.
[0081] In some embodiments, the initialization configurations of the first timer, the second timer, and the third timer are shown in Table 1.
[0082] Table 1 Timer Operating Mode Initialization Configuration
[0083]
[0084] S4. When the value of the second timer reaches the first value, stop the second timer and clear it to make the power supply under test output the maximum current. When the DAC value of the controller is determined to be output, start the first timer and determine the second value according to the first current value of the third timer. The first value is determined based on the maximum current, the minimum current and the rising slope.
[0085] In this process, after the value of the second timer reaches the first value, the current output by the power supply under test remains at its maximum value until the value of the first timer reaches the second value.
[0086] After starting the second timer, the controller begins outputting DAC values. Simultaneously, it continuously checks whether the controller's data output is complete, ensuring that the first timer is started promptly upon confirmation that the DAC value output is finished. The completion of DAC value output can be determined by detecting a flag bit. If the flag bit is detected, the DAC value output is considered complete; otherwise, the detection continues until a flag indicating completion is detected.
[0087] The first current value of the third timer is the count value when the flag bit is detected. After recording the first current value, the third timer is stopped and reset to zero. Stopping and pausing do not turn off the counter.
[0088] The first current value can compensate for the delay caused by the detection flag and the start timer. For example, Figure 2 As shown, at the hardware level, the DAC value is actually transmitted at time t2, at which point the output current of the power supply under test remains at its maximum. However, the software only detects the completion of the DAC value transmission at time tx, and the first timer also only starts counting at time tx. There is a delay of tens of microseconds in between. If the first timer still counts to the preset value before outputting the TRGO signal to start the second and third timers, the timing of the current drop in the power supply under test will not match the expectation. Therefore, it is necessary to determine the timing period of the first timer by using the first current value, that is, to determine the second value, so as to start the second and third timers at the expected time, so that the power supply under test can output current at the expected time according to the falling slope.
[0089] Furthermore, once the controller has finished outputting its DAC value, the third timer stops counting and is reset to zero.
[0090] S5. When the value of the first timer reaches the second value, start the second and third timers, stop the first timer and clear it to zero, so that the controller outputs the DAC value and the power supply under test outputs current according to the falling slope.
[0091] Specifically, when the value of the first timer reaches the second value, the second and third timers are started based on the received TRGI signal. After the second timer starts, the DMA outputs a DAC value to cause the power supply under test to output current at a decreasing slope. When the value of the first timer reaches the second value, the first timer is simultaneously cleared and its counting is paused.
[0092] Make the power supply under test output current according to a decreasing slope, that is, control the power supply under test to reduce the output current from the maximum current to the minimum current according to a decreasing slope.
[0093] The first, second, and third timers are timers within the CPU (Central Processing Unit) of the electronic load. The CPU can be any CPU with at least three timers. For example, the STM32F407.
[0094] In the above-described output current control method based on electronic load, when the value of the second timer reaches the first value, the second timer is stopped and cleared to enable the power supply under test to output the maximum current. When the controller's DAC value output is completed, the first timer is started and the second value is determined based on the first current value of the third timer. When the value of the first timer reaches the second value, the second and third timers are started, the first timer is stopped and cleared to enable the controller to output the DAC value, causing the power supply under test to output current with a decreasing slope. This ensures that the duration of the maximum current output by the power supply under test is the desired duration, allowing the power supply under test to output current with a decreasing slope within the expected time. This avoids distortion in the waveform of the alternating current output caused by the electronic load, thereby obtaining a reliable alternating current and preventing distortion of performance evaluation results.
[0095] In one embodiment, step S5 is followed by:
[0096] S6. When the value of the second timer reaches the third value, stop the second timer and clear it to make the power supply under test output the minimum current. When it is determined that the controller has finished outputting data, start the first timer and determine the fourth value based on the second current value of the third timer. The third value is determined based on the maximum current, the minimum current and the falling slope.
[0097] The value of the second timer refers to the count value. After the value of the second timer reaches the third value, the current output by the power supply under test remains at the minimum current until the value of the first timer reaches the fourth value.
[0098] After starting the second timer, the controller begins outputting DAC values while continuously checking if the controller's data output is complete. Upon detecting completion of transmission, the first timer is started. The second current value of the third timer is the count value at the time the flag bit was detected. After recording the second current value, the third timer is stopped and cleared.
[0099] S7. Update the initial value in step S3 to the fourth value, and repeat steps S3, S4, S5, S6 and S7 after updating the initial value to obtain the alternating current output by the power supply under test, and evaluate the performance of the power supply under test through the alternating current.
[0100] When the performance evaluation results of the power supply under test are obtained, the repetition process from S3 to S7 is stopped.
[0101] In this embodiment, when the value of the second timer reaches the third value in step S6, the second timer is stopped and reset to zero to ensure that the power supply under test outputs the minimum current. After determining that the controller's data output is complete, the first timer is started, and a fourth value is determined based on the second current value of the third timer. In step S7, the initial value in step S3 is updated to the fourth value, and steps S3, S4, S5, S6, and S7 are repeated. This allows the power supply under test to output the desired alternating current, thereby enabling the performance of the power supply under test to be evaluated through alternating current.
[0102] In one embodiment, the process of determining the third value in step S6 is as follows:
[0103] Based on the maximum current, minimum current, and descent slope, using the formula Calculate the second time required for the current to drop from the maximum current to the minimum current;
[0104] When the second duration exceeds a preset threshold, based on the second duration, the formula is used... Calculate the first preset value of the second timer when the current decreases;
[0105] Based on the first predetermined target, through the formula Calculate the third value;
[0106] Where I1 is the maximum current, I0 is the minimum current, k2 is the descent slope, T4_psc2 is the first prescaler, and T f A1 is the maximum count value of the second timer, A2 is the buffer capacity of the controller in the electronic load, and T4_arr2 is the third value. This is for rounding down.
[0107] The preset threshold is determined based on the buffer capacity of the controller in the electronic load. For example, if the buffer capacity of the controller is 2048, then the threshold is 2048 microseconds.
[0108] The unit for maximum and minimum current is ampere. The units for the first, second, third, and fourth durations are units of time. For example, seconds, microseconds, and milliseconds.
[0109] Furthermore, the second timer is a 16-bit counter, and the maximum count value A1 of the second timer is 65535.
[0110] Furthermore, the cache capacity of the controller in the electronic load is 2048.
[0111] Furthermore, when the second duration exceeds a preset threshold, the amount of data that the controller in the electronic load needs to transmit when the current decreases is the controller's buffer capacity.
[0112] In this embodiment, based on the maximum current, minimum current, and descent slope, the formula is used... Calculate the second time required for the current to drop from the maximum to the minimum. If the second time exceeds a preset threshold, based on the second time, use the formula... Calculate the first prescaler of the second timer when the current decreases, and based on the first prescaler, use the formula... Calculate the third value, which can be used to determine the stop time of the second timer. This ensures that the output current of the power supply under test is minimized in time, preventing the waveform of the output current from overlapping or being interrupted due to the electronic load. This ensures that the performance evaluation of the power supply under test can proceed smoothly.
[0113] In one embodiment, if the second duration is less than or equal to a preset threshold, then the first preset value is the first preset value, and the third value is the second preset value. The amount of data that the controller in the electronic load needs to transmit when the current decreases is determined by the second duration. For example, if the first preset value is 0, the third value is 21, and the first duration is 2000 microseconds, then the controller needs to transmit 2000 data items.
[0114] In one embodiment, the process of determining the fourth value in step S6 is as follows:
[0115] Determine the second duration required for the current to drop from the maximum current to the maximum current;
[0116] Based on the second duration, using the formula Calculate the second prescaler of the third timer when the current decreases;
[0117] When the controller in the electronic load has finished outputting data, the second current value of the third timer is obtained, and based on the second prescaler, the second duration, and the second current value, the formula is used to... Calculate the first delay duration required to determine whether the detection data has been completely output;
[0118] Based on the first delay duration, the third duration of current decrease and the second duration of maintaining minimum current in the current parameters, and using the formula... Calculate the first initial duration;
[0119] Based on the first initial duration, through and Calculate the fourth value;
[0120] Among them, T f The second duration is T9_psc2, the second prescaler is T9_psc2, the third timer's maximum count value is A3, and the second current value is T9_cnt2. d2 For the first delay duration, T y T is the first initial duration. b T3_psc1 is the third duration, T3_arr1 is the fifth prescaler of the first timer, T3_arr1 is the fourth value, and A4 is the maximum count value of the first timer.
[0121] The first delay duration is the time from when the controller completes data transmission to when it detects that the data transmission is complete. For example, the DMA transmission is completed at time t2, but the program only detects the completion of the DMA data transmission at time tx. The time difference between these two times is the first delay duration.
[0122] Because the current output by the power supply under test remains at its maximum after the value of the second timer reaches the first value, but the first timer does not realize that the current output by the power supply under test is already at its maximum, it does not start counting immediately after the value of the second timer reaches the first value. If the first timer still triggers the second timer according to the preset value, the time when the power supply under test outputs the maximum current will not match the current parameter, which will cause the current output by the power supply under test to be distorted. Therefore, it is necessary to compensate for the preset value by using the first delay duration, so that the power supply under test can output the decreasing current according to the expected time, ensuring that the waveform of the alternating current output does not have overlap or gaps caused by the electronic load, thereby obtaining a reliable alternating current and avoiding distortion of the performance evaluation results.
[0123] The second prescaler is directly proportional to the second duration. For example, if the second duration is 100ms and the maximum count value of the third timer is 65535, then the second prescaler is approximately 2µs. The shorter the prescaler time of the third timer, the more precise the timing. The smaller the minimum prescaler unit of the third timer, the higher the accuracy. For example, if the minimum prescaler time of the third timer is set to 1.0µs, and the current drop duration is less than 65.5ms, the error in the duty cycle and period time of the entire trapezoidal wave after compensation will be less than 2.0µs.
[0124] Furthermore, based on the maximum current, minimum current, and descent slope, using the formula... Calculate the second time required for the current to drop from the maximum to the minimum. I1 is the maximum current, I0 is the minimum current, k2 is the rate of drop, and T... f This is the second duration.
[0125] Furthermore, the third timer is a 16-bit counter, and its maximum count value A3 is 65535. The cycle period of the third timer is longer than that of the second and fourth timers.
[0126] In this embodiment, by determining the second time required for the current to drop from the maximum current to the maximum current again, and based on the second time, using the formula... The second prescaler of the third timer is calculated when the current decreases. When the data output of the controller in the electronic load is completed, the second current value of the third timer is obtained. Based on the second prescaler, the second duration, and the second current value, the formula is used to... The calculation determines whether the detection data output is complete, starting with the first delay duration. Based on this first delay duration, the third and second delay durations for current decrease and minimum current maintenance in the current parameters, the calculation is performed using the formula... Calculate the first initial duration, and based on the first initial duration, through... and Calculate the fourth value so that the duration of the minimum output current of the power supply under test is the expected duration, so that the power supply under test can output current at the expected time with a rising slope, and ensure that the waveform of the alternating current output does not have overlap or gaps caused by electronic load, thereby obtaining reliable alternating current and avoiding distortion of performance evaluation results.
[0127] In one embodiment, the process of determining the initial value in step S1 is as follows:
[0128] Based on the maximum current, minimum current, and rising slope, using the formula Calculate the fourth time required for the current to rise from the minimum to the maximum.
[0129] Based on the fourth duration and the first duration, using the formula Calculate the second initial duration;
[0130] Based on the second initial duration, through and Calculate the initial values;
[0131] Among them, T r For the fourth duration, I1 is the maximum current, I0 is the minimum current, k1 is the rising slope, and T... a For the first duration, T 初 A4 is the second initial duration, T3_psc is the sixth prescaler of the first timer, and T3_arr is the initial value.
[0132] In this embodiment, based on the maximum current, minimum current, and rising slope, the formula is used. Calculate the fourth time interval required for the current to rise from the minimum to the maximum, based on the fourth time interval and the first time interval, using the formula... Calculate the second initial duration, and based on the second initial duration, through... and Calculate the initial value, which will allow you to determine the stop time of the first timer.
[0133] In one embodiment, the process of determining the first value in step S4 includes:
[0134] Based on the maximum current, minimum current and rise slope, calculate the fourth time required for the current to rise from the minimum current to the maximum current.
[0135] When the fourth duration exceeds a preset threshold, based on the fourth duration, the formula is used... Calculate the third prescaler of the second timer as the current rises;
[0136] Based on the third pre-target, through the formula Calculate the first value;
[0137] Among them, T4_psc1 is the third predefined target, T r The fourth duration is defined as follows: A1 is the maximum count value of the second timer, A2 is the buffer capacity of the controller in the electronic load, and T4_arr1 is the first value.
[0138] Furthermore, based on the maximum current, minimum current, and rising slope, using the formula... Calculate the fourth time required for the current to rise from the minimum to the maximum. I1 is the maximum current, I0 is the minimum current, and k1 is the rise slope.
[0139] Furthermore, when the fourth duration exceeds a preset threshold, the amount of data that the controller in the electronic load needs to transmit when the current rises is the controller's buffer capacity.
[0140] In this embodiment, the fourth time required for the current to rise from the minimum current to the maximum current is calculated based on the maximum current, minimum current, and rising slope. When the fourth time exceeds a preset threshold, the formula is used to calculate the fourth time. Calculate the third prescaler of the second timer when the current rises, and based on the third prescaler, use the formula... Calculate the first value, and then determine the stop time of the second timer based on the first value.
[0141] In one embodiment, if the fourth duration is less than or equal to a preset threshold, then the third preset value is the first preset value, the first value is the second preset value, and the amount of data that the controller in the electronic load needs to transmit when the current rises is determined by the fourth duration. For example, if the third preset value is 0, the first value is 21, and the fourth duration is 2000 microseconds, then the controller needs to transmit 2000 data items.
[0142] In one embodiment, the calculation process of the second value in step S2 includes:
[0143] Determine the fourth time required for the current to rise from the minimum to the maximum.
[0144] Based on the fourth duration, through the formula Calculate the fourth prescaler of the third timer when the current rises;
[0145] When the controller in the electronic load has finished outputting data, the first current value of the third timer is obtained, and based on the fourth precalibrator, the fourth duration, and the first current value, the formula is used to... Calculate the second delay time from the minimum current to the maximum current;
[0146] Based on the second delay duration, the first duration, and the fourth duration, using the formula Calculate the third initial duration;
[0147] Based on the third initial duration, through and Calculate the second value;
[0148] Among them, T r For the fourth duration, T9_psc1 is the fourth prescaler, A3 is the maximum count value of the third timer, T9_cnt1 is the first current value, T d1 For the second delay duration, T x For the third initial duration, T a T3_psc2 is the seventh prescaler of the first timer, T3_arr2 is the second value, and A4 is the maximum count value of the first timer.
[0149] In this embodiment, a fourth time interval is determined, which is required for the current to rise from the minimum to the maximum. Based on this fourth time interval, a formula is used to... Calculate the fourth prescaler of the third timer when the current rises; when the data output of the controller in the electronic load is completed, obtain the first current value of the third timer, and based on the fourth prescaler, the fourth duration, and the first current value, use the formula... Calculate the second delay duration from the minimum current to the maximum current; based on the second delay duration, the first delay duration, and the fourth delay duration, use the formula... Calculate the third initial duration; based on the third initial duration, through... and Calculate the second value so that the duration of the maximum output current of the power supply under test is the desired duration. This allows the power supply under test to output current at a decreasing slope within the expected time, avoiding overlap or gaps in the waveform of the alternating current caused by the electronic load. This ensures a reliable alternating current and avoids distortion of performance evaluation results.
[0150] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0151] Based on the same inventive concept, this application also provides an electronic load-based output current control device for implementing the above-described electronic load-based output current control method. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of one or more electronic load-based output current control device embodiments provided below can be found in the limitations of the electronic load-based output current control method described above, and will not be repeated here.
[0152] In one embodiment, an output current control device based on an electronic load is provided, comprising:
[0153] The parameter preset module is used to preset current parameters and determine initial values based on the current parameters; the current parameters include maximum current, minimum current, rising slope, falling slope, current rise and the first duration of holding the maximum current;
[0154] The first startup module is used to start the first timer when the output current of the power supply under test is at its minimum and constant.
[0155] The second startup module is used to start the second and third timers when the value of the first timer reaches the initial value, stop the first timer and clear it to zero, so that the controller in the electronic load outputs the DAC value and the power supply under test outputs current according to the rising slope.
[0156] The third startup module is used to stop and clear the second timer when the value of the second timer reaches the first value, so that the power supply under test can output the maximum current. When it is determined that the DAC value of the controller has been output, the first timer is started and the second value is determined according to the first current value of the third timer. The first value is determined based on the maximum current, the minimum current and the rising slope.
[0157] The fourth startup module is used to start the second and third timers and stop and clear the first timer when the value of the first timer reaches the second value, so that the controller outputs the DAC value and the power supply under test outputs current according to the falling slope.
[0158] Each module in the aforementioned output current control device based on electronic load can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0159] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0160] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0161] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0162] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0163] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0164] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0165] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for controlling the output current based on an electronic load, characterized in that, The method includes: S1. Preset current parameters and determine initial values based on the current parameters; the current parameters include maximum current, minimum current, rising slope, falling slope, current rise and a first duration for maintaining the maximum current; S2. When the output current of the power supply under test is the minimum current and remains unchanged, start the first timer; S3. When the value of the first timer reaches the initial value, start the second and third timers, stop the first timer and clear it to zero, so that the controller in the electronic load outputs the DAC value and the power supply under test outputs current according to the rising slope. S4. When the value of the second timer reaches the first value, the second timer is stopped and cleared to zero, so that the power supply under test outputs the maximum current. When it is determined that the DAC value output of the controller is completed, the first timer is started and the second value is determined according to the first current value of the third timer. The first value is determined based on the maximum current, the minimum current and the rising slope. The first current value is the count value when the flag bit representing the completion of the DAC value output is detected. S5. When the value of the first timer reaches the second value, start the second timer and the third timer, stop the first timer and clear it to zero, so that the controller outputs the DAC value and the power supply under test outputs current according to the falling slope. The calculation process for the second value in step S2 includes: determining the fourth time duration required for the current to rise from the minimum current to the maximum current; and, based on the fourth time duration, calculating the value using the formula... The fourth prescaler of the third timer is calculated when the current rises; when the data output of the controller in the electronic load is completed, the first current value of the third timer is obtained, and based on the fourth prescaler, the fourth duration, and the first current value, the formula is used to calculate the fourth prescaler. Calculate the second delay duration from the minimum current to the maximum current; based on the second delay duration, the first duration, and the fourth duration, use the formula... Calculate the third initial duration; based on the third initial duration, through... and Calculate the second value; where T r For the fourth duration, T9_psc1 is the fourth prescaler, A3 is the maximum count value of the third timer, T9_cnt1 is the first current value, T d1 This is the second delay duration. T x For the third initial duration, T a T3_psc2 is the seventh prescaler of the first timer, T3_arr2 is the second value, and A4 is the maximum count value of the first timer.
2. The method according to claim 1, characterized in that, Step S5 is followed by: S6. When the value of the second timer reaches the third value, the second timer is stopped and cleared to make the power supply under test output the minimum current. When it is determined that the controller has finished outputting data, the first timer is started and a fourth value is determined according to the second current value of the third timer. The third value is determined based on the maximum current, the minimum current and the falling slope. S7. Update the initial value in step S3 to the fourth value, and repeat steps S3, S4, S5, S6 and S7 after updating the initial value to obtain the alternating current output by the power supply under test, and evaluate the performance of the power supply under test through the alternating current.
3. The method according to claim 2, characterized in that, The process of determining the third value in step S6 is as follows: Based on the maximum current, the minimum current, and the descent slope, using the formula Calculate the second time required for the current to drop from the maximum current to the minimum current; When the second duration exceeds a preset threshold, based on the second duration, using the formula... Calculate the first preset value of the second timer when the current decreases; Based on the first predetermined target, through the formula Calculate the third value; Where I1 is the maximum current, I0 is the minimum current, k2 is the descent slope, T4_psc2 is the first prescaler, and T f A1 is the maximum count value of the second timer, A2 is the buffer capacity of the controller in the electronic load, and T4_arr2 is the third value.
4. The method according to claim 2, characterized in that, The process of determining the fourth value in step S6 is as follows: Determine a second duration required for the current to drop from the maximum current back to the maximum current; Based on the second duration, using the formula Calculate the second predetermined target of the third timer when the current decreases; When it is determined that the controller in the electronic load has finished outputting data, the second current value of the third timer is obtained, and based on the second predetermined target, the second duration, and the second current value, the formula is used to... Calculate the first delay duration required to determine whether the detection data has been completely output; Based on the first delay duration, the current decrease and the third duration of maintaining the minimum current in the current parameters, and the second duration, the formula is used. Calculate the first initial duration; Based on the first initial duration, through and Calculate the fourth value; Among them, T f The second duration is T9_psc2, the second prescaler is T9_psc2, the third timer's maximum count value is A3, and the second current value is T9_cnt2. d2 This is the first delay duration. T y T is the first initial duration. b T3_psc1 is the third duration, T3_arr1 is the fifth prescaler of the first timer, T3_arr1 is the fourth value, and A4 is the maximum count value of the first timer.
5. The method according to claim 1, characterized in that, The process of determining the initial value in step S1 is as follows: Based on the maximum current, the minimum current, and the rising slope, using the formula Calculate the fourth time required for the current to rise from the minimum current to the maximum current; Based on the fourth duration and the first duration, using the formula Calculate the second initial duration; Based on the second initial duration, through and Calculate the initial values; Among them, T r For the fourth duration, I1 is the maximum current, I0 is the minimum current, k1 is the rising slope, and T... a For the first duration, T 初 A4 is the second initial duration, T3_psc is the sixth prescaler of the first timer, and T3_arr is the initial value.
6. The method according to claim 1, characterized in that, The process of determining the first value in step S4 includes: Based on the maximum current, the minimum current, and the rising slope, calculate the fourth time required for the current to rise from the minimum current to the maximum current. When the fourth duration exceeds a preset threshold, based on the fourth duration, the formula is used... Calculate the third prescaler of the second timer as the current rises; Based on the aforementioned third pre-target, through the formula Calculate the first value; Among them, T4_psc1 is the third predefined target, T r The fourth duration is defined as follows: A1 is the maximum count value of the second timer, A2 is the buffer capacity of the controller in the electronic load, and T4_arr1 is the first value.
7. An output current control device based on an electronic load, used to perform the method according to any one of claims 1-6, characterized in that, The device includes: The parameter preset module is used to preset current parameters and determine initial values based on the current parameters; the current parameters include maximum current, minimum current, rising slope, falling slope, current rise and a first duration for maintaining the maximum current; The first startup module is used to start the first timer when the output current of the power supply under test is the minimum current and remains unchanged; The second startup module is used to start the second and third timers and stop and clear the first timer when the value of the first timer reaches the initial value, so that the controller in the electronic load outputs the DAC value and the power supply under test outputs current according to the rising slope. The third startup module is used to stop and clear the second timer when the value of the second timer reaches the first value, so that the power supply under test outputs the maximum current, and to start the first timer and determine the second value according to the first current value of the third timer when it is determined that the DAC value of the controller has been output. The first value is determined based on the maximum current, the minimum current and the rising slope. The fourth startup module is used to start the second and third timers, stop the first timer and clear it when the value of the first timer reaches the second value, so that the controller outputs the DAC value and the power supply under test outputs current according to the falling slope.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.