Arc detection interruption timing adjustment method, arc detection method, and photovoltaic system
By adjusting the timing relationship between the timer interrupt and the ADC interrupt, the problem of abnormal arc detection values in the photovoltaic system was solved, the accuracy and stability of the detection results were achieved, and the detection point offset and false alarm faults were avoided.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAMEN KEHUA DIGITAL ENERGY TECH CO LTD
- Filing Date
- 2024-12-17
- Publication Date
- 2026-05-15
AI Technical Summary
The abnormal arc detection value in the existing photovoltaic system may be due to the excessive number of timer interrupt tasks, which prolongs the ADC interrupt cycle, causing detection point offset and false alarm faults.
Adjust the timing relationship between timer interrupts and ADC interrupts, reschedule some timer interrupt tasks to be executed after the ADC interrupt, and when inserting timer interrupts during the arcing parameter acquisition phase, adjust their trigger positions to be between adjacent ADC interrupts to optimize the detection process.
The abnormal situations of the detection values during the arc detection process have been optimized to ensure the accuracy and stability of the detection results and avoid the problem of prolonged ADC interrupt cycle caused by timer interrupt.
Smart Images

Figure CN119921671B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of arc detection technology, and in particular to an interruption timing adjustment method for arc detection, an arc detection method, and a photovoltaic system. Background Technology
[0002] In the present technology, many electrical system fires are mainly caused by electric arcs. To improve the safety of electrical systems, existing electrical systems are usually equipped with arc detection devices to detect arcs in the DC side electrical signals of the electrical system.
[0003] A photovoltaic (PV) system comprises solar photovoltaic panels, PV cables, and PV inverters. It utilizes exposed solar panels to collect solar energy and convert it into electricity, thus generating power. However, an electric arc on the DC side of a PV system can easily cause a fire. In related technologies, arc fault detection technology primarily detects the occurrence of an arc fault by analyzing the differences in time-frequency domain characteristics of parameters before and after the fault occurred. If the sampling period or sampled values used for arc fault analysis are deviated, the analysis results can easily be inaccurate, leading to false alarms. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this application discloses an interruption timing adjustment method for arc detection, an arc detection method, and a photovoltaic system to optimize the problem of abnormal detection values during the arc detection process.
[0005] According to a first aspect of the embodiments of this application, an interrupt timing adjustment method for arc detection is provided. The method includes: determining the timing of a first number of digital-to-analog converter (ADC) interrupts to be activated at a first frequency, wherein the ADC interrupts are used to acquire sampled data after ADC conversion of the arc parameters; determining the timing of a timer interrupt activated at a second frequency, wherein the first frequency is at least twice the second frequency; and, based on the relative relationship between the timing of the timer interrupts and the timing of the ADC interrupts, rescheduling at least one task executed in the timer interrupts to be executed in at least one ADC interrupt after the timer interrupts have ended, so as to avoid the ADC interrupts immediately following the triggering of the timer interrupts being delayed.
[0006] According to a second aspect of the embodiments of this application, an arc detection method is provided, the method comprising: executing the ADC interrupt and the timer interrupt according to the timing adjusted by any method of this application; and performing arc detection algorithm processing on the sampled data obtained through the ADC interrupt.
[0007] According to a third aspect of the embodiments of this application, a photovoltaic system is provided, comprising: a sampling device for collecting arcing parameters in the system; and a processor for executing the steps of any arcing detection method of this application.
[0008] The technical solution provided in this application embodiment may include the following beneficial effects: Based on the relative relationship between the timing of the timer interrupt and the timing of the ADC interrupt, this application will schedule at least one of the tasks executed in the timer interrupt to be executed in at least one ADC interrupt after the timer interrupt ends, thereby avoiding the lengthening of the ADC interrupt cycle due to the excessive execution time of the timer interrupt, thus optimizing the abnormal detection value during the arc detection process.
[0009] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0010] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0011] Figure 1 This is a structural diagram of a photovoltaic system according to an exemplary embodiment of this application.
[0012] Figure 2 This is a flowchart illustrating an interruption timing adjustment method for arc detection according to an exemplary embodiment of this application.
[0013] Figure 3 This is a timing diagram illustrating, according to an exemplary embodiment of the present application, the scheduling of a task executed in a Time0 interrupt to be executed in a subsequent ADC interrupt.
[0014] Figure 4 This is an arc detection method illustrated according to an exemplary embodiment of this application.
[0015] Figure 5 This is a diagram illustrating the relative relationship between the trigger position of the delayed Time0 interrupt and the trigger positions of two adjacent ADC interrupts, according to an exemplary embodiment of this application. Detailed Implementation
[0016] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0017] Figure 1 This is a structural diagram of a photovoltaic system according to an exemplary embodiment of this application. Figure 1 As shown, the photovoltaic system 100 includes a photovoltaic panel PV 101, a current transformer CT 102, a photovoltaic inverter 103, and a power grid 104. The photovoltaic panel 101 converts received solar energy into electrical energy and outputs photovoltaic current through the photoelectric effect. The CT 102 monitors the current changes in the photovoltaic system 100 in real time, controlling the magnitude and direction of the current to ensure the safe operation of the photovoltaic system 100. The photovoltaic inverter 103 converts the DC current output from the photovoltaic panel 101 into AC current and outputs it to the power grid 104. The photovoltaic inverter 103 also uses an arc-detection plate to sample and detect arc-detection parameters such as the photovoltaic current monitored by the CT 102 to determine whether arcing has occurred in the photovoltaic system 100. The arc-detection plate is a circuit board capable of arc detection. It can be integrated into products such as photovoltaic inverters as part of the equipment to achieve arc detection, or it can be used independently outside the equipment to achieve arc detection.
[0018] In some embodiments, the arc detection process may include an arc parameter acquisition stage and an arc algorithm processing stage. In the arc parameter acquisition stage, the processor of the arc plate acquires sampled data after A / D conversion of the arc parameters monitored by CT 102 through a series of ADC interrupts. In the arc algorithm processing stage, the acquired arc parameters are processed using an arc algorithm to obtain the arc detection result. More specifically, after completing the initialization procedure, the arc plate performs the following processing to acquire the arc parameters and complete the arc detection:
[0019] 1) Enter the arcing parameter sampling stage, enable ADC interrupt, and complete the sampling of arcing parameters at 1024 sampling points through 1024 ADC interrupts.
[0020] 2) Disable ADC interrupt, process the collected arcing parameters using the arcing algorithm, and determine whether arcing has occurred.
[0021] 3) Repeat steps 1) and 2) above to perform the next round of arc-drawing parameter detection.
[0022] In related technologies, after upgrading the arc-pulling board's program on a cloud platform with technologies such as ARM (Advanced RISC Machine), DCAC (DC-to-AC), DC-CDC (DC-to-DC), or ARC (Advanced Renewable Computing), abnormal arc-pulling detection values appeared. Normally, the arc-pulling value is less than 200, and the arc-pulling threshold is set at 400. However, after the arc-pulling board program upgrade, the arc-pulling detection value fluctuated significantly, even reaching 3900.
[0023] To address the aforementioned issues, the inventors analyzed and tested the photovoltaic system from various aspects, including hardware, software, structure, grounding, load, and battery pack. They discovered that the abnormal arc detection values after upgrading the arc-pulling plate program were likely caused by excessive tasks executed in the timer interrupt, which prolonged the ADC interrupt cycle and led to detection point shifts. Therefore, the inventors of this application propose a solution to relocate some tasks from the timer interrupt in the arc-pulling plate program to subsequent ADC interrupts.
[0024] Figure 2 This is a flowchart illustrating an interruption timing adjustment method for arc detection according to an exemplary embodiment of this application. The following will be combined with... Figure 2 The steps shown are explained.
[0025] In step 11, the timing of a first number of digital-to-analog converter (ADC) interrupts to be activated at a first frequency is determined.
[0026] Here, the first frequency can be 250kHz, with a corresponding period of 4µs, meaning the interval between the trigger times of two adjacent ADC interrupts is 4µs. The first frequency can also be other values that meet the requirements of arc detection, such as 220kHz or 280kHz. The first number is typically 1024 times, but can also be other numbers that meet the detection accuracy, such as 512 times. In short, both the first frequency and the first number can be reasonably set based on the detection requirements and are not limited to the values exemplified above in this application. The ADC interrupt is used to obtain the sampled data after ADC conversion of the arc parameters. In some embodiments, the processor of the arc plate enables the ADC interrupt at the first frequency to obtain the photovoltaic current output by the photovoltaic panel 101 as sampled data. The following explanation uses a first frequency of 250kHz as an example.
[0027] In step 12, the timing of a timer interrupt enabled at a second frequency is determined, wherein the first frequency is at least twice the second frequency, to ensure that after the timer interrupt, at least one ADC interrupt can accept the dispatched task.
[0028] In some embodiments, the arc-drawing plate system program includes timer interrupts such as Time0 interrupts. Time0 interrupts can generate a time base signal in the system program with a period of 2ms, meaning there is a 2ms interval between the trigger times of two adjacent Time0 interrupts. It is understood that while the processor is acquiring sampled data using the ADC interrupt, the Time0 interrupt is also continuously running in the system program at a second frequency, performing tasks such as inter-chip communication. The second frequency is typically lower than the first frequency, for example, it could be 500Hz, 450Hz, 400Hz, etc.
[0029] Since the period of each ADC interrupt is approximately 4µs, a round of ADC interrupts (1024 interrupts) may take about 4.1ms. Therefore, at least two Time0 interrupts will be inserted during the entire process of an ADC interrupt round from start to stop. If the execution time of one of the inserted Time0 interrupts is too long, delaying the triggering time of the immediately following ADC interrupt, the extended ADC interrupt period may cause detection point offset and abnormal arcing parameter detection. For example, performing a communication reception task to read the FIFO within a Time0 interrupt will result in a longer execution time of the timer interrupt, which may delay the triggering time of the next ADC interrupt, with the interval between the triggering times of adjacent ADC interrupts exceeding 4µs. Time data from testing the arcing board in actual operation shows that an excessively long execution time of the Time0 interrupt may cause the interval between the triggering times of two adjacent ADC interrupts to reach 4.7µs.
[0030] In step 13, based on the relative relationship between the timing of the timer interrupt and the timing of the ADC interrupt, at least one of the tasks executed in the timer interrupt is rescheduled to be executed in at least one ADC interrupt after the timer interrupt ends.
[0031] In embodiments of this application, rescheduling at least one task executed in a timer interrupt to at least one ADC interrupt after the timer interrupt ends includes: determining, based on the timing of the Time0 interrupt and the timing of the ADC interrupt, whether the execution of each Time0 interrupt causes the period of the Mth ADC interrupt to be lengthened, wherein the trigger time of the Time0 interrupt is after the trigger time of the Mth ADC interrupt and before the trigger time of the (M+1)th ADC interrupt. The period of the Mth ADC interrupt is lengthened specifically, the trigger time of the Time0 interrupt is within the period of the Mth ADC interrupt, and the end time of the Time0 interrupt is after the predetermined trigger time of the (M+1)th ADC interrupt, where M is a natural number greater than or equal to 1. If the period of the Mth ADC interrupt is lengthened due to the Time0 interrupt, at least one task executed in the corresponding Time0 interrupt is rescheduling to at least one ADC interrupt after the Time0 interrupt ends.
[0032] As mentioned earlier, during each round of ADC interrupt detection, 2-3 Time0 interrupts may be inserted. If the trigger position of a Time0 interrupt is close to the subsequent ADC interrupt, or if too many tasks are executed or the execution time is too long in a Time0 interrupt, the trigger time of the ADC interrupt immediately following the Time0 interrupt will be postponed. In this case, the ADC interrupt cycle is lengthened. Therefore, it is necessary to determine whether the execution of each Time0 interrupt will cause the cycle of a certain ADC interrupt in that round (e.g., the Mth ADC interrupt) to be lengthened based on the relative relationship between the timing of ADC interrupts and the timing of Time0 interrupts. If the cycle of an ADC interrupt is lengthened, part of the tasks of the Time0 interrupt should be reassigned to the subsequent ADC interrupt for execution.
[0033] The following steps S1301-S1306 further illustrate the specific process of task allocation during an interrupt.
[0034] In step S1301, the trigger time of the Mth ADC interrupt is obtained. The period of the Mth ADC interrupt is lengthened due to the insertion of the Time0 interrupt.
[0035] In some embodiments, the Mth ADC interrupt with an extended cycle is determined by the trigger time and execution duration of the Time0 interrupt. The execution period of the Time0 interrupt in terms of timing can be obtained based on its trigger time and execution duration. If the trigger time of any ADC interrupt in this round falls within the execution period of the Time0 interrupt, it means that the execution of the Time0 interrupt will delay the triggering of that ADC interrupt. The ADC interrupt immediately preceding this one is then the Mth ADC interrupt. The trigger time of this Mth interrupt is used for subsequent task scheduling.
[0036] In step S1302, based on the trigger time of the Mth ADC interrupt and the period of the ADC interrupt, the first end time of the Time0 interrupt after the task is allocated is determined, wherein the duration from the trigger time of the Mth ADC interrupt to the first end time of the Time0 interrupt after the task is allocated is not greater than the period of the ADC interrupt. Here, the period of the ADC interrupt is determined based on the first frequency.
[0037] Understandably, if the Time0 interrupt ends before the (M+1)th ADC interrupt is triggered, the period of the Mth ADC interrupt will not be extended. Therefore, the first end time of the Time0 interrupt is determined based on this condition, ensuring that the execution of the Time0 interrupt does not exceed the period of the Mth ADC interrupt. Preferably, there is a certain time margin between the first end time and the trigger time of the (M+1)th ADC interrupt, such as 0.8µs or 1µs.
[0038] In step S1303, the second end time of the Time0 interrupt before the task is scheduled is obtained, and the minimum execution time of the task to be scheduled from the Time0 interrupt is determined based on the first end time and the second end time.
[0039] Before allocating tasks, the second end time of the Time0 interrupt is located after the scheduled trigger time of the (M+1)th ADC interrupt. Therefore, a portion of the tasks needs to be allocated from the Time0 interrupt so that the first end time of the Time0 interrupt ends before the trigger time of the (M+1)th ADC interrupt. That is, the execution duration of the allocated tasks cannot be less than the time difference between the second and first end times. This ensures that, during actual operation, the Time0 interrupt after task allocation will not prolong the ADC interrupt cycle.
[0040] In step S1304, a first task is determined based on the minimum execution time, wherein the execution time of the first task is not less than the minimum execution time.
[0041] After obtaining the minimum execution duration, it is necessary to select the first task with an execution duration greater than or equal to the minimum execution duration from the tasks executed in the Time0 interrupt. If the execution duration of the first task allocated is less than the minimum execution duration, it may still lengthen the ADC interrupt cycle of the Time0 interrupt after the task is allocated. Therefore, the allocated tasks cannot be selected arbitrarily; it is necessary to confirm whether their execution durations meet the requirements.
[0042] In step S1305, based on the execution duration of the allocated task, a second number of ADC interrupts required to complete the task is determined, and a second task to be completed by each of the second number of ADC interrupts is determined, wherein the first task includes the second task, and the execution duration of the second number of ADC interrupts allocated the second task is not greater than the period of the ADC interrupt.
[0043] Since the first task allocated needs to be executed in the ADC interrupt following the Time0 interrupt, and the ADC interrupt cycle cannot be lengthened due to task allocation, the first task may need to be allocated to multiple ADC interrupts to ensure the ADC interrupt cycle remains normal while completing the task. Therefore, based on the size of the first task allocated, it is allocated to a second number of ADC interrupts for execution. This second number ensures that the cycle of the ADC interrupt receiving the task allocation is not lengthened. After determining the second number, the second task allocated to each ADC interrupt can be further determined. The ADC interrupt receiving the task allocation needs to complete the second task allocated from the Time0 interrupt as well as its original task of acquiring sampling data. Therefore, the execution time of the ADC interrupt receiving the task allocation needs to be limited to no more than the ADC interrupt cycle, i.e., no more than 4µs. Preferably, it can be 3.2µs or 3.8µs, etc.
[0044] In step S1306, starting from the M+1th ADC interrupt immediately following the Time0 interrupt, the task dispatched from the Time0 interrupt is executed in the second number of ADC interrupts.
[0045] After the adjustment of steps S1301-S1306, the execution time of the Time0 interrupt is shortened, and its end time is timed apart from the trigger time of the subsequent ADC interrupt, so it will not affect the subsequent ADC interrupt from triggering according to the predetermined cycle. Figure 3 This is a timing diagram illustrating, according to an exemplary embodiment of this application, the rescheduling of a task executed in a Time0 interrupt to a subsequent ADC interrupt. For example... Figure 3As shown, after reassigning some tasks from the Time0 interrupt, the maximum execution time of the Time0 interrupt is shortened to 0.63us. Normally, the maximum execution time of an ADC interrupt is 1.33us. Since the Nth ADC interrupt immediately preceding this Time0 interrupt is executing normally, and the Time0 interrupt starts approximately 0.76us after the Nth ADC interrupt ends, there is still a margin of (4us - 1.33us - 0.63us - 0.76us =) 1.28us between the execution interval of the N+1th ADC interrupt and the time between the Nth and N+1th ADC interrupts. In other words, the trigger and end times of the Time0 interrupt are both within the execution interval between the Nth and N+1th ADC interrupts, and will not interfere with the ADC interrupts, thus preventing abnormal arc detection.
[0046] Correspondingly, the ADC interrupts following the Time0 interrupt are prolonged because they are reassigned to tasks originally executed during the Time0 interrupt. Since the interval between the trigger times of two adjacent ADC interrupts cannot exceed 4µs, the execution duration of ADC interrupts with reassigned tasks is also limited. Tasks need to be reassigned to multiple ADC interrupts to shorten the execution duration of the Time0 interrupt to a suitable length. The N+1th ADC interrupt immediately following the Time0 interrupt, and subsequent ADC interrupts, may be prolonged. For example, the maximum execution duration of the first ADC interrupt after the Time0 interrupt, i.e., the N+1th ADC interrupt, will reach 3.2µs, and the execution duration of subsequent ADC interrupts will also be prolonged, even reaching 3.85µs, until the last ADC interrupt with reassigned tasks finishes execution, at which point the ADC interrupts return to their normal execution duration.
[0047] As described above, according to the embodiments of this application, when the execution time of the Time0 interrupt is too long, causing the ADC interrupt cycle to be lengthened, some tasks in the Time0 interrupt are reassigned to subsequent ADC interrupts for execution. This shortens the execution time of the Time0 interrupt, allowing it to end before the next ADC interrupt is triggered, thus avoiding arc detection anomalies caused by the lengthened ADC interrupt cycle. Furthermore, the tasks reassigned from the Time0 interrupt are distributed to multiple ADC interrupts for execution, ensuring that the execution time of the ADC interrupts that receive task reassignment does not exceed the ADC interrupt cycle.
[0048] It should be noted that since the Time0 interrupt period is 2ms, there may be hundreds of ADC interrupts between two adjacent Time0 interrupts. Therefore, there is no need to worry about a new Time0 interrupt requiring task reassignment before the last ADC task being reassigned completes. In other words, there will be enough ADC interrupts after a Time0 interrupt to accept task reassignment, and there will be no situation where a new Time0 interrupt is adjacent to a previously extended ADC interrupt.
[0049] During the arc-drawing algorithm processing phase following the completion of the arc-drawing parameter acquisition phase, the Time0 interrupt continues to execute at the second frequency. Since there is no data acquisition task during this phase, in some embodiments, the ADC interrupt is disabled during the arc-drawing algorithm processing phase.
[0050] In other embodiments, the ADC interrupt is not completely disabled during the arcing algorithm processing phase. For example, at least one ADC interrupt is initiated after the Time0 interrupt, and some tasks executed in the Time0 interrupt are reassigned to the ADC interrupt initiated after the Time0 interrupt ends.
[0051] The number of ADC interrupts initiated is determined based on the size of the allocated task. In some embodiments, during the arcing algorithm processing, after each Time0 interrupt is executed, the number of ADC interrupts required to complete the allocated task is determined based on the size of the task allocated from the Time0 interrupt. Based on the determined number of ADC interrupts, the corresponding ADC interrupt is initiated. The execution frequency of the ADC interrupts can be a first frequency or other suitable frequency required by the system task, without limitation.
[0052] The arc-pulling algorithm processing phase typically lasts about 5.2ms. During this period, according to the Time0 interrupt cycle, there may be 2 to 3 Time0 interrupts. After each Time0 interrupt is completed, a certain number of ADC interrupts are started to execute the tasks allocated from the Time0 interrupt.
[0053] By handling the task allocation described above, we can avoid excessive execution time caused by too many or too large tasks interrupted by Time0. By shortening the execution time of Time0 interrupts, we can keep the time interval between ADC interrupts within 4µs, thereby optimizing the arc detection anomaly caused by this.
[0054] Figure 4 This is an arc detection method illustrated according to an exemplary embodiment of this application. For example... Figure 4 As shown, the detection method includes the following steps:
[0055] In step 41, the ADC interrupt and the timer interrupt are executed according to the timing adjusted by the method described in this application.
[0056] As mentioned earlier, based on the relative timing of the Time0 interrupt and the ADC interrupt, at least one task executed in the Time0 interrupt will be reassigned to at least one ADC interrupt after the Time0 interrupt ends. After this reassignment, the ADC interrupt cycle returns to its normal duration before the program upgrade, and correspondingly, the abnormal arc detection value is optimized. Therefore, after timing adjustment, the ADC interrupt and Time0 interrupt are executed, entering the arc parameter acquisition phase.
[0057] In step 42, the sampled data obtained through the ADC interrupt is processed by the arcing algorithm.
[0058] After sampling the arcing parameters in step 41, the process enters the arcing algorithm processing stage, where the sampled data obtained through the ADC interrupt is processed using the arcing algorithm. In some embodiments, the arcing algorithm processing may include: performing a Fourier transform on the current parameter to obtain the spectrum corresponding to the current parameter; taking the modulus of the amplitude at each frequency point in the spectrum to obtain the characteristic value of the arcing; and determining whether an arcing has occurred based on the characteristic value of the arcing and a set arcing threshold.
[0059] Since the task in the timer interrupt is allocated according to the timing adjustment method of this application, the arc detection method described in this application will not result in abnormal arc detection values even if the arc board program is upgraded.
[0060] Furthermore, the inventors discovered during their research that, during the "upgrade startup" process, a timer interrupt might be inserted midway through the ADC interrupt acquisition of arcing parameters, causing discontinuous sampling of the arcing parameters and potentially leading to abnormal arcing detection values. Therefore, the inventors of this application propose a solution to adjust the timing of the timer interrupt in the arcing board program to between two adjacent ADC interrupts.
[0061] According to an exemplary embodiment of this application, before a certain round of ADC interrupts is initiated, the timing of the ADC interrupts and the timing of the Time0 interrupts for that round are determined. Based on the relative timing relationship between the two, the trigger position of the Time0 interrupt, which may cause interference, is adjusted to be between two adjacent ADC interrupts to avoid interference from the Time0 interrupts on the ADC interrupts. This prevents discontinuous current sampling caused by the insertion of timer interrupts during ADC interrupt execution, thereby optimizing the handling of abnormal detection values during arc detection.
[0062] Here, the Time0 interrupt that interferes with the ADC interrupt is a Time0 interrupt that overlaps with the ADC interrupt in timing. For example, the trigger position of this Time0 interrupt may be before, after, or both of the trigger positions of an ADC interrupt; that is, any trigger position that causes the Time0 interrupt and an ADC interrupt to have a synchronized execution duration. For another example, if the priority of the ADC interrupt is defined as higher than that of the Time0 interrupt, then the trigger position of the Time0 interrupt is before the ADC interrupt is triggered.
[0063] In some embodiments, based on the relative relationship between the timing of the timer interrupt and the timing of the ADC interrupt, the trigger position of the timer interrupt is adjusted to be between two adjacent ADC interrupts. This includes: determining, based on the timing of the Time0 interrupt and the timing of the ADC interrupts, whether each inserted Time0 interrupt interferes with a certain ADC interrupt in timing during the current round of ADC interrupts, for example, interfering with the Nth ADC interrupt, where N is a natural number greater than or equal to 1. If interference exists, the processor delays the triggering of the Time0 interrupt, so that each Time0 interrupt runs between the Nth ADC interrupt and the (N+1)th ADC interrupt. Preferably, the trigger position of the Time0 interrupt is delayed to the interval after the Nth ADC interrupt ends and before the (N+1)th ADC interrupt is triggered.
[0064] By determining the triggering location of all Time0 interrupts that occur during a round of ADC interrupts, and delaying the triggering of Time0 interrupts that may interfere with a certain ADC interrupt to the interval between two adjacent ADC interrupts, the impact of Time0 interrupts on ADC interrupts can be better prevented.
[0065] Figure 5 This is a diagram illustrating the relative positions of the delayed Time0 interrupt trigger position and the trigger positions of two adjacent ADC interrupts, according to an exemplary embodiment of this application. See also... Figure 5The ADC interrupt cycle is 4µs, and the execution time of each ADC interrupt is approximately 0.8µs. Therefore, the interval between the end of the Nth ADC interrupt and the triggering of the (N+1)th ADC interrupt is approximately 3.2µs. Using the desired triggering position of the Time0 interrupt as the control target, preferably, the control target is set to 0.8µs after the end of the Nth ADC interrupt. If the execution time of the Time0 interrupt is 1.6µs, then the (N+1)th ADC interrupt will trigger 0.8µs after the end of the Time0 interrupt. At this time, the Time0 interrupt triggers 0.8µs after the end of the Nth ADC interrupt and ends 0.8µs before the triggering of the (N+1)th ADC interrupt, its execution time being exactly in the middle of the interval between the Nth and N+1th ADC interrupts. In other words, controlling the Time0 interrupt to trigger 1.6µs later than the triggering position of the Nth ADC interrupt will present... Figure 3 The timing relationship is shown.
[0066] Therefore, the delayed triggering time of the Time0 interrupt can be determined based on the expected position of the Time0 interrupt delay trigger. In some embodiments, since the clock periods of the Time0 interrupt and the ADC interrupt are the same, both being 60MHz, delaying the triggering of the corresponding Time0 interrupt, so that the Time0 interrupt runs between the Nth ADC interrupt and the (N+1)th ADC interrupt, can include:
[0067] Get the first clock cycle number temp1 from the current trigger position of the Time0 interrupt; get the second clock cycle number temp2 from the trigger position of the Nth ADC interrupt; then (temp2-temp1) is the number of clock cycles required to adjust the Time0 interrupt to trigger simultaneously with the Nth ADC interrupt. The value of N is determined by dividing temp1 by the ADC interrupt cycle, thus determining the trigger position of the Nth ADC interrupt.
[0068] If we determine the number of clock cycles temp3, which is the third clock cycle from the trigger position of the Nth ADC interrupt to the desired trigger position of the Time0 interrupt, then (temp2-temp1+temp3) is the number of clock cycles required to delay the Time0 interrupt to the desired trigger position. Preferably, temp3 is not less than the execution duration of the Nth ADC interrupt, which ensures that the delayed Time0 interrupt is triggered after the Nth ADC interrupt has finished executing, rather than during the execution process.
[0069] The above calculation method can be used to determine the number of clock cycles that the Time0 interrupt is delayed, ensuring that the trigger time of the Time0 interrupt is located in the interval between the two ADC interrupts.
[0070] like Figure 5 As shown, if the control target is that the Time0 interrupt is triggered 1.6us later than the Nth ADC interrupt, the Time0 interrupt needs to be delayed by (temp2-temp1+temp3) clock cycles. Therefore, the theoretical value of temp3 is 96 clock cycles, corresponding to 1.6us. However, during the process of obtaining temp1 and temp2, when assigning values to TIM.all, the program runs synchronously, and both EPwm1Regs.TBCTR and TIM.all are decreasing or increasing. Therefore, temp3 cannot be directly obtained using the theoretical value and needs to be obtained through actual measurement using waveform debugging.
[0071] In some embodiments, the debugging process can be as follows: First, a value assignment test is performed on temp3 over 110 clock cycles. The test result shows that the Time0 interrupt starts 1.4us after the ADC interrupt ends. Then, a value assignment test is performed on temp3 over 170 clock cycles. The test result shows that the Time0 interrupt starts 2.36us after the ADC interrupt ends. The test results conform to the theoretical relationship that 60 clock cycles correspond to 1us.
[0072] Based on the previous test results showing that temp3 takes 110 clock cycles and the Time0 interrupt starts 1.4us after the ADC interrupt ends, if the expected triggering position of the Time0 interrupt is 0.8us after the ADC interrupt ends (i.e., 0.6us earlier than 1.4us), then the theoretical test value for temp3 is 110 - 60 * 0.6us = 74 clock cycles. Therefore, the theoretical test value for temp3 is 74 clock cycles. In actual tests with temp4 = 44 or 74, the Time0 interrupt starts 0.88us after the ADC interrupt ends, indicating that a certain interrupt jump time is required before the Time0 interrupt starts.
[0073] Therefore, based on the test results, the theoretical value of temp3 corresponding to delaying the Time0 interrupt to the desired trigger position is determined. This theoretical value is set as temp3, and the calculation result of (temp2-temp1+temp3) is determined as the number of clock cycles required to delay the Time0 interrupt to the desired position. By delaying the Time0 interrupt based on this number of clock cycles, the number of clock cycles for the Time0 interrupt delay can be adjusted according to the actual state of program execution in the system. This allows the Time0 interrupt to be triggered during the interval between two adjacent ADC interrupts under the actual state of system program execution.
[0074] Therefore, based on the relative relationship between the timing of the Time0 interrupt and the timing of the ADC interrupt, the trigger position of the Time0 interrupt in the timing is adjusted to be between two adjacent ADC interrupts. This avoids the current sampling discontinuity caused by the insertion of the Time0 interrupt during the execution of the ADC interrupt, thereby optimizing the abnormal detection value during the arc detection process.
[0075] In addition to the reasons mentioned above, the abnormal arc detection may also be caused by the fact that the time interval between the first ADC interrupt and the second ADC interrupt is random after entering the arc parameter acquisition stage, which may lead to abnormal sampling data of the first ADC.
[0076] As mentioned earlier, the arcing detection process is cyclical. After one round of arcing parameter sampling, the sampled arcing parameters are processed by the arcing algorithm to determine whether an arc has occurred. Then, a new round of arcing parameter sampling begins, and arcing detection is continuously performed in the photovoltaic system. During the cyclic execution of arcing detection, the triggering and termination of the ADC interrupt are controlled by setting the ADC interrupt register in the arcing plate circuit.
[0077] In some embodiments, the ADC interrupt register has an enable bit and a trigger bit. Setting the enable bit in the ADC interrupt register enables or disables the interrupt line, allowing the ADC interrupt to be triggered. Setting the trigger bit in the interrupt register directly triggers the ADC interrupt, causing the processor to respond to the interrupt request. Each round of ADC interrupts is enabled based on the setting of the enable bit, and the trigger bit is repeatedly set at 4µs intervals, causing the ADC interrupt to be periodically triggered at 4µs intervals after being enabled, forming a process of sampling arcing parameters at multiple sampling points at a frequency of 250kHz. After completing a predetermined number of ADC interrupts, such as 1024, the enable bit is cleared, and the ADC interrupt for that round is disabled.
[0078] In the system program, the interrupt register enable bit is only set after the previous round of arcing algorithm processing ends and a new round of arcing parameter sampling begins. Since the processing time of the previous round of arcing algorithm is determined by the task completion status in the system program (usually around 5.2ms), the actual processing time of each round of arcing algorithm processing is unpredictable. Therefore, the ADC interrupt enable time cannot be predetermined, and consequently, the trigger time of the first ADC interrupt is unpredictable. However, the trigger bit in the interrupt register is repeatedly set at predetermined time intervals, thereby triggering subsequent ADC interrupts. In other words, from the second ADC interrupt to the 1024th ADC interrupt, the trigger time is fixed. Therefore, in each round of arcing parameter sampling, the interval between the trigger times of the first and second ADC interrupts is uncontrollable. This can also lead to abnormal arcing detection.
[0079] Based on this, in the embodiments of this application, after collecting the arcing parameters at preset time intervals using a data sampling device such as a current sensor, the first collected arcing parameter is discarded and not included in the sampling data group. Starting from the second arcing parameter, the collection of 1024 arcing parameters in this round is performed, that is, one more sampling of arcing parameters is performed thereafter. This can further optimize the abnormal situation of arcing detection. In some embodiments, after enabling the ADC interrupt, the ADC interrupt is executed 1025 times and then the round of ADC interrupts is turned off. The sampling data obtained from the 2nd to the 1025th ADC interrupts in this round of ADC interrupts are used for data processing in the arcing algorithm processing stage, and the arcing result is judged.
[0080] After adjusting the arc detection process according to the above-described manner in the embodiments of this application, the arc detection process is simulated and tested. The detection results of the simulation test are compared with the detection results before the above-described adjustment to verify the optimization effect after adjustment. The data comparison before and after adjustment is described in detail below.
[0081] After improvements were made according to the method described in the embodiments of this application, the timing relationship between the ADC interrupt and the Time0 interrupt was detected. Table 1 records the relevant time data of the ADC interrupt and the Time0 interrupt in the detection.
[0082] Table 1
[0083]
[0084] As can be seen from the data recorded in Table 1, after implementing the timing adjustment method of this application embodiment, the sampling period of the ADC interrupt of the arc-pulling plate after the program upgrade is 4µs, which is basically the same as the expected sampling period and meets the requirements for the ADC interrupt sampling period. This proves that the timing adjustment method of this application embodiment can indeed optimize the abnormal situation of the arc-pulling detection results.
[0085] The timing adjustment method and arc detection method disclosed in this application during the arcing parameter sampling process can be used in arcing detection of photovoltaic systems. In an embodiment of this application, the photovoltaic system includes: a sampling device for collecting arcing parameters in the system; and a processor for executing the steps of any of the arcing detection methods disclosed in this application.
[0086] It should be understood that the phrases "some embodiments," "one embodiment," or "an embodiment" throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0087] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0088] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for adjusting the interruption timing of arc detection, characterized in that, The method includes: Determine the timing of a first number of digital-to-analog converter (ADC) interrupts to be activated at a first frequency, wherein the ADC interrupts are used to acquire sampled data after ADC conversion using arcing parameters; Determine the timing of a timer interrupt that is enabled at a second frequency, wherein the first frequency is at least twice the second frequency; Based on the relative relationship between the timing of the timer interrupt and the timing of the ADC interrupt, at least one of the tasks executed in the timer interrupt will be scheduled to be executed in at least one ADC interrupt after the timer interrupt ends, so as to avoid the ADC interrupt that is immediately after the timer interrupt is triggered being delayed. The step of scheduling at least one task executed in the timer interrupt to be executed in at least one ADC interrupt after the timer interrupt has ended, based on the relative relationship between the timing of the timer interrupt and the timing of the ADC interrupt, includes: Based on the timing of the timer interrupt and the timing of the ADC interrupt, determine whether the execution of the timer interrupt causes the period of the Mth ADC interrupt to be lengthened, wherein the trigger time of the timer interrupt is after the trigger time of the Mth ADC interrupt and before the trigger time of the (M+1)th ADC interrupt, and M is a natural number greater than or equal to 1. If the cycle of the Mth ADC interrupt is lengthened due to the timer interrupt, at least one of the tasks executed in the corresponding timer interrupt will be rescheduled to at least one ADC interrupt after the timer interrupt ends.
2. The method according to claim 1, characterized in that, The task that would be executed in the corresponding timer interrupt is scheduled to be executed in at least one ADC interrupt after the timer interrupt has ended, including: Obtain the trigger time of the Mth ADC interrupt; Based on the trigger time of the Mth ADC interrupt and the period of the ADC interrupt, the first end time of the timer interrupt after the task is assigned is determined, wherein the duration from the trigger time of the Mth ADC interrupt to the first end time of the timer interrupt after the task is assigned is not greater than the period of the ADC interrupt, and the period of the ADC interrupt is determined based on the first frequency.
3. The method according to claim 2, characterized in that, The rescheduling of at least one task, which would be executed in the corresponding timer interrupt, to be executed in at least one ADC interrupt after the timer interrupt has ended, further includes: Obtain the second end time of the timer interrupt before the task is scheduled; Based on the first end time and the second end time, determine the minimum execution duration of the task that needs to be allocated from the timer interrupt; Based on the minimum execution time, a first task is determined, wherein the execution time of the first task is not less than the minimum execution time.
4. The method according to claim 3, characterized in that, The rescheduling of at least one task, which would be executed in the corresponding timer interrupt, to be executed in at least one ADC interrupt after the timer interrupt has ended, further includes: Based on the execution duration of the first task allocated, determine the second number of ADC interrupts required to complete the task; Determine the second task to be completed for each of the second number of ADC interrupts, wherein the first task includes the second task, and the execution duration of the second number of ADC interrupts assigned the second task is not greater than the period of the ADC interrupt. Starting from the (M+1)th ADC interrupt immediately following the timer interrupt, the second task dispatched from the timer interrupt is executed in the second consecutive number of ADC interrupts.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Based on the relative relationship between the timing of the timer interrupt and the timing of the ADC interrupt, the trigger position of the timer interrupt in the timing sequence is adjusted to be between two adjacent ADC interrupts.
6. A method for detecting arcing, characterized in that, The method further includes: The timing is adjusted according to the method of any one of claims 1 to 5, and the ADC interrupt and the timer interrupt are executed; and The sampled data obtained through the ADC interrupt is processed using an arc-pull algorithm.
7. The method according to claim 6, characterized in that, The method further includes: disabling the ADC interrupt during the arc-drawing algorithm processing; or During the arc-pulling algorithm processing, at least one ADC interrupt is executed after the timer interrupt, and at least one of the tasks executed in the timer interrupt is reassigned to the at least one ADC interrupt for execution.
8. The method according to any one of claims 6 to 7, characterized in that, The method further includes: The arc-drawing parameters are collected at preset time intervals using a data acquisition device; Discard the first collected arcing parameter; and Starting with the second arc-drawing parameter, the first number of arc-drawing parameters are collected.
9. A photovoltaic system, characterized in that, include: A sampling device for collecting arcing parameters in the system; A processor for performing the steps of the arc detection method according to any one of claims 6 to 8.