Phase voltage dynamic calculation method and device, electronic equipment and storage medium
Through the method of dynamically calculating the phase voltage, data is processed while collecting and processing, the problem that static calculation cannot meet the transient and steady-state response requirements of the generator set is solved, and the rapid response to the generator set voltage regulator plate is achieved.
Patent Information
- Application Number
- CN202411265340.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-02-07
AI Technical Summary
The static calculation of phase voltage cannot meet the time index requirements of the generator set voltage regulator plate for transient and steady-state response.
The dynamic calculation method is adopted to collect instantaneous phase voltage data by configuring the sampling frequency and completing interrupts using DMA transmission, and process data while collecting, establishing a queue to detect and process data in real time, and calculate the phase voltage value.
It realizes rapid response to the voltage regulation function of the generator set voltage regulating plate, and meets the time response indicators of the generator set transient response test and steady-state response test.
Smart Images

Figure CN119396753A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology for a generator set controller, and in particular to a method, a device, an electronic device and a storage medium for dynamically calculating a phase voltage. Background Art
[0002] At present, the static calculation method is usually used to calculate the phase voltage of the generator set. The process of static calculation of phase voltage is: collect data, stop collecting, calculate, and restart collecting. This method collects the phase voltage once in about 200ms at the fastest, which is more than enough for the occasions where the phase voltage is refreshed and displayed in seconds. However, for the occasions such as the generator set voltage regulating board that have time index requirements for transient response and steady-state response, the static collection method can no longer meet the requirements. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method, device, electronic device and storage medium for dynamic calculation of phase voltage, which solves the problem of time taken for static calculation of phase voltage, collects data and processes data calculation results at the same time, and realizes a rapid response to the voltage regulation function of the voltage regulator board of the generator set, so as to meet the time response indicators of the transient response test and steady-state response test of the generator set.
[0004] According to one aspect of the present invention, a method for dynamically calculating phase voltage is provided, the method comprising:
[0005] Configure the sampling frequency and use the DMA transmission completion interrupt method to collect the instantaneous data of the phase voltage. Each time an interrupt is generated, a phase voltage instantaneous data is collected;
[0006] Establish a queue, the queue includes a write pointer and a read pointer, the write pointer indicates the number of data in the queue, and the value of the write pointer increases by 1 each time a data is written, and the read pointer indicates the number of data in the queue, and the value of the read pointer increases by 1 each time a data is read; each time an interrupt is generated, the collected phase voltage instantaneous data is written into the subscript data group of the write pointer and the value of the write pointer increases by 1;
[0007] Check in real time whether the write pointer is greater than the read pointer. If so, read out the instantaneous data of the phase voltage in the data group corresponding to the write pointer, add 1 to the value of the read pointer, and compare the sizes of the write pointer and the read pointer again until they are the same. After determining that the instantaneous data of the phase voltage for a complete sinusoidal wave cycle has been read out, calculate the phase voltage value using the instantaneous data of the phase voltage for that cycle, and then use the instantaneous data of the phase voltage for the second half of the previous cycle as the instantaneous data of the phase voltage for the first half of the next cycle. Calculate the phase voltage value once each complete cycle of the instantaneous data of the phase voltage is obtained.
[0008] Further, the step of determining and reading out instantaneous phase voltage data of a complete cycle includes:
[0009] The state machine is used to record the points of the sine wave where the instantaneous data of the phase voltage is read out, until the points where the instantaneous data of the phase voltage is read out form a complete cycle.
[0010] Further, the point of the sine wave where the read phase voltage instantaneous data is located using a state machine includes:
[0011] A state machine is used to represent three zero crossing points in one cycle of the phase voltage sine wave. A state machine value of 0 represents the first zero crossing point, a state machine value of 1 represents the second zero crossing point, and a state machine value of 3 represents the third zero crossing point. Three zero crossing points represent one cycle.
[0012] Further, after determining and reading the instantaneous phase voltage data of a complete sinusoidal wave cycle, the phase voltage value is calculated using the instantaneous phase voltage data of the cycle, and the instantaneous phase voltage data of the second half of the previous cycle is used as the instantaneous phase voltage data of the first half of the next cycle. The phase voltage value is calculated once each time the instantaneous phase voltage data of a complete cycle is obtained, including:
[0013] When the value of the state machine is 0, the XOR operation is used to compare whether the XOR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the first zero crossing point. This is used as the start of data calculation, and the value of the state machine is set to 1 and the number of phase voltage instantaneous data when the state machine is 1 is set to zero;
[0014] When the state machine value is 1, the exclusive OR operation is continued to be used to compare whether the exclusive OR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the second zero crossing point. The data between the first zero crossing point and the second zero crossing point is the phase voltage instantaneous data of the first half cycle and the number of data in the first half cycle nCount[0] is recorded. The square sum dbHalfSum of the phase voltage instantaneous data of the first half cycle is calculated, and the value of the state machine is set to 2.
[0015] When the state machine value is stage 2, continue to use XOR operation to compare the XOR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out to see if it is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the third zero-crossing point. The data between the second zero-crossing point and the third zero-crossing point is the phase voltage instantaneous data of the second half cycle and the number of data in the second half cycle nCount[1] is recorded. The square sum dbSum of the phase voltage instantaneous data of the second half cycle is calculated, and the phase voltage value of this cycle is calculated:
[0016]
[0017] The subsequent state machine is maintained in stage 2, and the instantaneous phase voltage data of the second half of the previous cycle is used as the instantaneous phase voltage data of the first half of the current cycle. The exclusive OR operation is continued to be used to compare whether the exclusive OR value of the previous read-out phase voltage instantaneous data and the currently read-out phase voltage instantaneous data is less than 0. If it is less than 0, the point where the currently read-out phase voltage instantaneous data is located is the third zero-crossing point, and the data between the previous third zero-crossing point and the third zero-crossing point is the instantaneous phase voltage data of the second half of the cycle and the number of data in the second half of the cycle is recorded, and the phase voltage value of the cycle is calculated. The step is repeated to continuously obtain the phase voltage value.
[0018] Furthermore, the sampling frequency is an ADC sampling frequency.
[0019] Furthermore, the method further comprises:
[0020] Data overflow management: if the difference between the write pointer and the read pointer is greater than or equal to 2, an alarm will be issued.
[0021] According to another aspect of the present invention, there is provided a phase voltage dynamic calculation device, comprising:
[0022] The data acquisition module is used to configure the sampling frequency and collect the instantaneous data of the phase voltage by using the DMA transmission completion interrupt method. Each time an interrupt is generated, one instantaneous data of the phase voltage is collected;
[0023] The data receiving module is used to establish a queue. The queue includes a write pointer and a read pointer. The write pointer indicates the number of data in the queue. The value of the write pointer increases by 1 each time a data is written. The read pointer indicates the number of data in the queue. The value of the read pointer increases by 1 each time a data is read. Each time an interrupt is generated, the collected phase voltage instantaneous data is written into the subscript data group of the write pointer and the value of the write pointer increases by 1.
[0024] The data processing module is used to detect in real time whether the write pointer is greater than the read pointer. If it is greater, the instantaneous data of the phase voltage in the subscript data group corresponding to the write pointer is read out, the value of the read pointer is increased by 1, and the sizes of the write pointer and the read pointer are compared again until the two are the same; after determining that the instantaneous data of the phase voltage of a complete sinusoidal wave cycle is read out, the phase voltage value is calculated using the instantaneous data of the phase voltage of the cycle, and the instantaneous data of the phase voltage of the second half of the previous cycle is used as the instantaneous data of the phase voltage of the first half of the next cycle. The phase voltage value is calculated once each complete cycle of the instantaneous data of the phase voltage is obtained.
[0025] Furthermore, it also includes a data overflow management module, which is used to issue an alarm when the difference between the write pointer and the read pointer is greater than or equal to 2.
[0026] According to another aspect of the present invention, there is provided an electronic device, comprising:
[0027] Processor; and
[0028] Memory for storing programs,
[0029] The program includes instructions, which, when executed by the processor, enable the processor to execute the above-mentioned phase voltage dynamic calculation method.
[0030] According to another aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned phase voltage dynamic calculation method.
[0031] One or more technical solutions provided in the embodiments of the present application can achieve the following technical effects:
[0032] The problem of time required for static calculation of phase voltage is solved. Data is collected and calculated at the same time, so that a rapid response to the voltage regulation function of the voltage regulator of the generator set can be achieved to meet the time response indicators of the transient response test and steady-state response test of the generator set. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Further details, features and advantages of the invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0034] Figure 1 A flow chart of a method for dynamically calculating phase voltage according to an exemplary embodiment of the present invention is shown;
[0035] Figure 2 A flow chart of a method for dynamically calculating phase voltage according to a specific example of the present invention is shown;
[0036] Figure 3 A schematic block diagram of a phase voltage dynamic calculation device according to an exemplary embodiment of the present invention is shown;
[0037] Figure 4 A block diagram of an exemplary electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0038] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0039] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0040] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0041] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0042] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0043] Aspects of the present invention are described below with reference to the accompanying drawings.
[0044] like Figure 1 As shown, an exemplary embodiment of the present invention provides a phase voltage dynamic calculation method, comprising the following steps:
[0045] S1. Configure the sampling frequency and use DMA (Data Memory Access) transmission completion interruption to collect the instantaneous data of the phase voltage. Each time an interruption is generated, one phase voltage instantaneous data is collected.
[0046] The DMA transmission completion interrupt method is used to collect the instantaneous data of the phase voltage, which does not occupy the CPU and improves the collection speed. There is no need to stop the collection and then perform calculations, and data processing can be performed while collecting.
[0047] Optionally, the sampling frequency is an ADC (Analog-to-digital converter) sampling frequency. The ADC is used to convert a continuous signal in analog form into a discrete signal in digital form, thereby further improving the data acquisition speed.
[0048] S2. Establish a queue. The queue includes a write pointer and a read pointer. The write pointer indicates the number of data in the queue. The value of the write pointer increases by 1 each time a data is written. The read pointer indicates the number of data in the queue. The value of the read pointer increases by 1 each time a data is read. Each time an interruption occurs, the collected phase voltage instantaneous data is written into the subscript data group of the write pointer and the value of the write pointer increases by 1.
[0049] S3. Check in real time whether the write pointer is greater than the read pointer. If so, read out the instantaneous data of the phase voltage in the data group corresponding to the write pointer, add 1 to the value of the read pointer, and compare the sizes of the write pointer and the read pointer again until they are the same size, indicating that there is no new data in the queue that needs to be processed; after determining that the instantaneous data of the phase voltage of a complete sinusoidal wave cycle has been read out, calculate the phase voltage value using the instantaneous data of the phase voltage of the cycle, and then use the instantaneous data of the phase voltage of the second half of the previous cycle as the instantaneous data of the phase voltage of the first half of the next cycle. Calculate the phase voltage value once each complete cycle of the phase voltage instantaneous data is obtained, and repeat this cycle to continuously calculate the phase voltage value.
[0050] Starting from the second cycle, only half a cycle of data needs to be collected to calculate a phase voltage value. Obtaining a phase voltage value only requires half the time of the phase voltage sine wave frequency, which improves calculation efficiency and achieves rapid response to the voltage regulation function of the generator set voltage regulator to meet the time response indicators of the generator set transient response test and steady-state response test.
[0051] Optionally, a state machine is used to record the points of the sine wave where the instantaneous data of the phase voltage is read, until the points where the instantaneous data of the phase voltage is read form a complete cycle.
[0052] Furthermore, a state machine is used to represent three zero crossings in one cycle of the phase voltage sine wave. A state machine value of 0 represents the first zero crossing, a state machine value of 1 represents the second zero crossing, and a state machine value of 3 represents the third zero crossing. Three zero crossings represent one cycle.
[0053] Furthermore, when the value of the state machine is 0, the XOR operation is used to compare whether the XOR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the first zero crossing point. This is used as the start of data calculation, and the value of the state machine is set to 1 and the number of phase voltage instantaneous data when the state machine is 1 is set to zero; when the value of the state machine is 1, the XOR operation is continued to be used to compare whether the XOR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the second zero crossing point, and the data between the first zero crossing point and the second zero crossing point is the phase of the first half cycle. The voltage instantaneous data is recorded and the number of data in the first half cycle nCount[0] is recorded. The square sum dbHalfSum of the phase voltage instantaneous data in the first half cycle is calculated, and the value of the state machine is set to 2. When the value of the state machine is 2, the XOR operation is continued to be used to compare whether the XOR value of the previously read phase voltage instantaneous data and the currently read phase voltage instantaneous data is less than 0. If it is less than 0, the point where the currently read phase voltage instantaneous data is located is the third zero crossing point. The data between the second zero crossing point and the third zero crossing point is the phase voltage instantaneous data of the second half cycle and the number of data in the second half cycle nCount[1] is recorded. The square sum dbSum of the phase voltage instantaneous data of the second half cycle is calculated, and the phase voltage value of this cycle is calculated:
[0054]
[0055] The subsequent state machine is maintained in stage 2, and the instantaneous phase voltage data of the second half of the previous cycle is used as the instantaneous phase voltage data of the first half of the current cycle. The XOR operation is continued to compare whether the XOR value of the instantaneous phase voltage data of the previous readout and the instantaneous phase voltage data of the current readout is less than 0. If it is less than 0, the point where the instantaneous phase voltage data of the current readout is located is the third zero-crossing point, and the data between the last third zero-crossing point and the third zero-crossing point is the instantaneous phase voltage data of the second half of the cycle and the number of data of the second half of the cycle is recorded. The phase voltage value of the cycle is calculated, and the steps are repeated to continuously obtain the phase voltage value. That is, the instantaneous phase voltage data of the second half of the first cycle is used as the instantaneous phase voltage data of the first half of the second cycle. It is only necessary to collect the instantaneous phase voltage data of the second half of the second cycle to calculate the instantaneous phase voltage data of the second cycle. The instantaneous phase voltage data of the second half of the second cycle is used as the instantaneous phase voltage data of the first half of the third cycle, and so on, which greatly improves the efficiency of data calculation.
[0056] Optionally, if the sampling frequency is the ADC sampling frequency, the waveform is usually reduced by a certain coefficient through a mutual inductor or resistor to adapt to the sampling range of the ADC, and the collected phase voltage instantaneous data becomes reduced data. When calculating the phase voltage value, the collected phase voltage instantaneous data is first divided by the reduction coefficient to obtain the actual phase voltage instantaneous value, and then the actual phase voltage instantaneous value is substituted into the formula to calculate the root mean square to obtain the actual phase voltage instantaneous value.
[0057] Optionally, the method of the present application also includes S3', data overflow management, if the difference between the write pointer and the read pointer is greater than or equal to 2, an alarm prompt is issued. Normally, the write pointer should be 1 greater than or equal to the read pointer. If the write pointer is 1 greater than the read pointer, it indicates that new data has been written to the queue and the read pointer needs to read it out; if the write pointer is the same as the read pointer, it indicates that the read pointer has just completed the new data reading process. If the write pointer is 2 or more greater than the read pointer, it means that the speed at which data is written to the queue is faster than the speed at which it is read out, which will result in the data not being processed in time, and part of the data in the queue will be overwritten by the new data, resulting in the calculated phase voltage value being smaller. Therefore, data overflow management is added, and after the alarm prompt is issued, you can choose to adjust the sampling frequency and sampling period, and then perform steps S1-S3 after adjustment to improve the calculation accuracy.
[0058] As a specific example, Figure 2 As shown, the phase voltage dynamic calculation method specifically includes the following steps:
[0059] By configuring the ADC sampling frequency to 9MHz, the sampling time to 239.5 cycles and enabling the ADC's DMA, it can be calculated that the sampling time required to simultaneously sample the three phase voltages is 84us, that is, a DMA transfer completion interrupt is generated every 84us. For 50HZ, 238 points can be sampled in one cycle, and the phase voltage value can be accurately calculated.
[0060] Define a data structure for data processing, that is, simulate a queue.
[0061]
[0062] Among them, SAMPLE_DATA_SIZE is the size of the queue, ulWrite is the write pointer, which indicates the number of data in the queue, that is, the value increases by 1 each time data is written, and ulRead is the read pointer, which indicates the number of data in the queue, that is, the value increases by 1 each time data is read. Every time a DMA interrupt (84us) is generated, data will be received once and stored in the shortdata array with ulWrite as the subscript. At the same time, the ulWrite value increases by 1 to update the size of the queue value.
[0063] In the main program, it is always judged whether the ulWrite value is greater than the ulRead value. If it is greater, it means that new data has entered the queue, so the data will be processed, and the ulRead value will be increased by 1 to update the queue value size.
[0064]
[0065] A virtual state machine is created to represent the three zero-crossing points in one cycle of the phase voltage sine wave. Status represents the value of the state machine. A value of 0 represents the first zero-crossing point, a value of 1 represents the second zero-crossing point, and a value of 2 represents the third zero-crossing point. Three zero-crossing points can represent one cycle and also obtain a phase voltage value. nVlaue is the temporary value of the data in the queue, dbHalfSum is the sum of the squares of the values in the first half of the cycle of the sine wave, and dbSum is the sum of the squares of the values in the second half of the cycle of the sine wave. nCount[0] in the nCount[2] array is the number of data read out when the state machine is 1, and nCount[1] is the number of data read out when the state machine is 2.
[0066] When the value of the state machine is 0, the XOR operation is used to compare whether the XOR value of the previous data read out in the queue and the current data read out is less than 0. If it is less than 0, the current data read out is the zero crossing point of the sine wave, that is, the first zero crossing point. This is used as the start of data calculation, nCount[0] is set to 0, and the value of the state machine is set to 1.
[0067] When the state machine value is 1, the XOR operation is continued to be used to compare whether the XOR value of the previous data read out in the queue and the current data read out is less than 0. If it is less than 0, the point on the sine wave where the current data is read out is the zero crossing point of the sine wave when the state machine is 1, that is, the second zero crossing point, which is equivalent to the first half cycle of the sine wave. In this process (that is, in the first half cycle), each time a data is read out, the square value of the instantaneous data of the phase voltage is calculated and accumulated to dbHalfSum and nCount[0] is increased by 1. At this point, the value of the state machine is set to 2, and nCount[1] is set to 0;
[0068] When the state machine value is 2, the XOR operation is continued to be used to compare whether the XOR value of the previous data read out in the queue and the current data read out is less than 0. If it is less than 0, the point on the sine wave where the current data is read out is the zero crossing point of the sine wave when the state machine is 2, that is, the third zero crossing point, which is equivalent to the second half cycle of the sine wave. In this process (that is, in the first half cycle), each time a data is read out, the square value of the instantaneous data of the phase voltage is calculated and accumulated to dbSum and nCount[1] is increased by 1. At this point, we have obtained the number of instantaneous data read out of the phase voltage of a cycle of the sine wave, and then calculated the phase voltage value:
[0069]
[0070] In order to increase the calculation frequency of the phase voltage value, the second half cycle of the previous waveform is used as the first half cycle of the next waveform. In this way, only half a cycle of sinusoidal wave data needs to be collected to obtain the data of the entire cycle and perform a phase voltage calculation.
[0071] Therefore, the state of the state machine will be kept at the state machine value 2 stage, and the accumulated value dbSum of the square value of the second half cycle is assigned to dbHalfSum, and nCount[1] is assigned to nCount[0] as the accumulated value of the first half cycle of the new calculation. The XOR operation is continued to be used to compare whether the XOR value of the previous read data and the current read data in the queue is less than 0. When it is less than 0, it is the zero crossing point of the sine wave when the state machine is 2, that is, the data of the second half cycle of the sine wave is obtained. In the second half cycle, each phase voltage instantaneous data is read out and the square value of the phase voltage instantaneous data is calculated and accumulated to dbSum, and nCount[1] is increased by 1 to obtain a new phase voltage value. The phase voltage value can be obtained continuously by analogy.
[0072] Based on the above, it can be known that obtaining the value of a phase voltage only requires half the time of the phase voltage sine wave frequency. Taking 50 Hz as an example, the phase voltage value can be updated once in 10 ms.
[0073] The exemplary embodiment of the present invention further provides a phase voltage dynamic calculation device 1100, such as Figure 3 As shown, including:
[0074] The data acquisition module 1101 is used to configure the sampling frequency and collect the instantaneous data of the phase voltage by using the DMA transmission completion interrupt method. Each time an interrupt is generated, one instantaneous data of the phase voltage is collected;
[0075] The data receiving module 1102 is used to establish a queue. The queue includes a write pointer and a read pointer. The write pointer indicates the number of data in the queue. The value of the write pointer increases by 1 each time a data is written. The read pointer indicates the number of data in the queue. The value of the read pointer increases by 1 each time a data is read. Each time an interrupt is generated, the collected phase voltage instantaneous data is written into the subscript data group of the write pointer and the value of the write pointer increases by 1.
[0076] The data processing module 1103 is used to detect in real time whether the write pointer is greater than the read pointer. If so, the instantaneous data of the phase voltage in the subscript data group corresponding to the write pointer is read out, the value of the read pointer is increased by 1, and the sizes of the write pointer and the read pointer are compared again until the two are the same. After determining that the instantaneous data of the phase voltage of a complete sinusoidal wave cycle is read out, the phase voltage value is calculated using the instantaneous data of the phase voltage of the cycle, and the instantaneous data of the phase voltage of the second half of the previous cycle is used as the instantaneous data of the phase voltage of the first half of the next cycle. The phase voltage value is calculated once each complete cycle of the instantaneous data of the phase voltage is obtained.
[0077] Furthermore, it also includes a data overflow management module 1104, which is used to issue an alarm when the difference between the write pointer and the read pointer is greater than or equal to 2.
[0078] For the convenience of description, the above devices are described in terms of functions and are divided into various modules. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0079] It should be noted that: the generator set controller history record reading device provided in the above embodiment only uses the division of the above functional modules as an example when reading the generator set controller history record. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the generator set controller history record reading device provided in the above embodiment and the phase voltage dynamic calculation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0080] The exemplary embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device executes the phase voltage dynamic calculation method according to the embodiment of the present invention.
[0081] An exemplary embodiment of the present invention further provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a phase voltage dynamic calculation method according to an embodiment of the present invention.
[0082] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform a method according to an embodiment of the present invention.
[0083] refer to Figure 4 , a block diagram of an electronic device 800 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0084] like Figure 4 As shown, the electronic device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in a ROM (read-only memory) 1202 or a computer program loaded from a storage unit 1208 to a RAM (random access memory) 1203. In the RAM 1203, various programs and data required for the operation of the electronic device 1200 can also be stored. The computing unit 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An I / O interface (input / output) 1205 is also connected to the bus 1204.
[0085] A plurality of components in the electronic device 1200 are connected to the I / O interface 1205, including: an input unit 1206, an output unit 1207, a storage unit 1208, and a communication unit 1209. The input unit 1206 may be any type of device capable of inputting information to the electronic device 1200, and the input unit 1206 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 1207 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1204 may include, but is not limited to, a disk, an optical disk. The communication unit 1209 allows the electronic device 1200 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0086] The computing unit 1201 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1201 performs the various methods and processes described above. For example, in some embodiments, the phase voltage dynamic calculation method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1200 via the ROM 1202 and / or the communication unit 1209. In some embodiments, the computing unit 1201 may be configured to perform the phase voltage dynamic calculation method in any other appropriate manner (e.g., by means of firmware).
[0087] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0088] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0089] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0090] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0091] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0092] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
Claims
1. A phase voltage dynamic calculation method, characterized in that: The method comprises: Configure the sampling frequency and use the DMA transmission completion interrupt method to collect the instantaneous data of the phase voltage. Each time an interrupt is generated, a phase voltage instantaneous data is collected; Establish a queue, the queue includes a write pointer and a read pointer, the write pointer indicates the number of data in the queue, and the value of the write pointer increases by 1 each time a data is written, and the read pointer indicates the number of data in the queue, and the value of the read pointer increases by 1 each time a data is read; each time an interrupt is generated, the collected phase voltage instantaneous data is written into the subscript data group of the write pointer and the value of the write pointer increases by 1; Check in real time whether the write pointer is greater than the read pointer. If so, read out the instantaneous data of the phase voltage in the data group corresponding to the write pointer, add 1 to the value of the read pointer, and compare the sizes of the write pointer and the read pointer again until they are the same. After determining that the instantaneous data of the phase voltage for a complete sinusoidal wave cycle has been read out, calculate the phase voltage value using the instantaneous data of the phase voltage for that cycle, and then use the instantaneous data of the phase voltage for the second half of the previous cycle as the instantaneous data of the phase voltage for the first half of the next cycle. Calculate the phase voltage value once each complete cycle of the instantaneous data of the phase voltage is obtained.
2. The phase voltage dynamic calculation method according to claim 1, characterized in that: The step of determining and reading out instantaneous phase voltage data of a complete cycle comprises: The state machine is used to record the points of the sine wave where the instantaneous data of the phase voltage is read out, until the points where the instantaneous data of the phase voltage is read out form a complete cycle.
3. The phase voltage dynamic calculation method according to claim 2, characterized in that: The point of the sine wave where the instantaneous data of the phase voltage read out is recorded by the state machine includes: A state machine is used to represent three zero crossing points in one cycle of the phase voltage sine wave. A state machine value of 0 represents the first zero crossing point, a state machine value of 1 represents the second zero crossing point, and a state machine value of 3 represents the third zero crossing point. Three zero crossing points represent one cycle.
4. The phase voltage dynamic calculation method according to claim 3 is characterized in that: After determining to read out the instantaneous phase voltage data of a complete sine wave cycle, the phase voltage value is calculated using the instantaneous phase voltage data of the cycle, and the instantaneous phase voltage data of the second half cycle of the previous cycle is used as the instantaneous phase voltage data of the first half cycle of the next cycle. The phase voltage value is calculated once each time the instantaneous phase voltage data of a complete cycle is obtained, including: When the value of the state machine is 0, the XOR operation is used to compare whether the XOR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the first zero crossing point. This is used as the start of data calculation, and the value of the state machine is set to 1 and the number of phase voltage instantaneous data when the state machine is 1 is set to zero; When the state machine value is 1, the exclusive OR operation is continued to be used to compare whether the exclusive OR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the second zero crossing point. The data between the first zero crossing point and the second zero crossing point is the phase voltage instantaneous data of the first half cycle and the number of data in the first half cycle nCount[0] is recorded. The square sum dbHalfSum of the phase voltage instantaneous data of the first half cycle is calculated, and the value of the state machine is set to 2. When the state machine value is stage 2, continue to use XOR operation to compare the XOR value of the previous phase voltage instantaneous data read out and the current phase voltage instantaneous data read out to see if it is less than 0. If it is less than 0, the point where the current phase voltage instantaneous data is located is the third zero-crossing point. The data between the second zero-crossing point and the third zero-crossing point is the phase voltage instantaneous data of the second half cycle and the number of data in the second half cycle nCount[1] is recorded. The square sum dbSum of the phase voltage instantaneous data of the second half cycle is calculated, and the phase voltage value of this cycle is calculated: The subsequent state machine is maintained in stage 2, and the instantaneous phase voltage data of the second half of the previous cycle is used as the instantaneous phase voltage data of the first half of the current cycle. The exclusive OR operation is continued to be used to compare whether the exclusive OR value of the previous read-out phase voltage instantaneous data and the currently read-out phase voltage instantaneous data is less than 0. If it is less than 0, the point where the currently read-out phase voltage instantaneous data is located is the third zero-crossing point, and the data between the previous third zero-crossing point and the third zero-crossing point is the instantaneous phase voltage data of the second half of the cycle and the number of data in the second half of the cycle is recorded, and the phase voltage value of the cycle is calculated. The step is repeated to continuously obtain the phase voltage value.
5. The method for dynamic calculation of phase voltage according to any one of claims 1 to 4, characterized in that: The sampling frequency is the ADC sampling frequency.
6. The method for dynamic calculation of phase voltage according to any one of claims 1 to 4, characterized in that: The method further comprises: Data overflow management: if the difference between the write pointer and the read pointer is greater than or equal to 2, an alarm will be issued.
7. A phase voltage dynamic calculation device, characterized in that: include: The data acquisition module is used to configure the sampling frequency and collect the instantaneous data of the phase voltage by using the DMA transmission completion interrupt method. Each time an interrupt is generated, one instantaneous data of the phase voltage is collected; The data receiving module is used to establish a queue. The queue includes a write pointer and a read pointer. The write pointer indicates the number of data in the queue. The value of the write pointer increases by 1 each time a data is written. The read pointer indicates the number of data in the queue. The value of the read pointer increases by 1 each time a data is read. Each time an interrupt is generated, the collected phase voltage instantaneous data is written into the subscript data group of the write pointer and the value of the write pointer increases by 1. The data processing module is used to detect in real time whether the write pointer is greater than the read pointer. If it is greater, the instantaneous data of the phase voltage in the subscript data group corresponding to the write pointer is read out, the value of the read pointer is increased by 1, and the sizes of the write pointer and the read pointer are compared again until the two are the same; after determining that the instantaneous data of the phase voltage of a complete sinusoidal wave cycle is read out, the phase voltage value is calculated using the instantaneous data of the phase voltage of the cycle, and the instantaneous data of the phase voltage of the second half of the previous cycle is used as the instantaneous data of the phase voltage of the first half of the next cycle. The phase voltage value is calculated once each complete cycle of the instantaneous data of the phase voltage is obtained.
8. The phase voltage dynamic calculation device according to claim 7, characterized in that: It also includes a data overflow management module, which is used to issue an alarm when the difference between the write pointer and the read pointer is greater than or equal to 2.
9. An electronic device, characterized in that: include: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-6.