A method for determining the sun direction vector based on FPGA design

Through FPGA design combined with adaptive Wiener filtering and multi-threshold segmentation technology, the problem of complex sun direction vector determination methods and high power consumption is solved, and fast and high-precision sun direction vector determination on micro-nano satellites is achieved, which is suitable for micro-nano satellites. Due to the resource limitations of nanosatellites, an accuracy of 0.01° can be achieved.

CN115717882BActive Publication Date: 2024-09-24NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211430326.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-14
Publication Date
2024-09-24
Estimated Expiration
2042-11-14

AI Technical Summary

Technical Problem

The existing methods for determining the sun direction vector are complex, consume a lot of power, and cannot take into account various requirements such as volume, accuracy, and power consumption. Especially in micro-nano satellite applications, there is a lack of effective solutions.

Method used

Using a method based on FPGA design, through adaptive Wiener filtering and multi-threshold segmentation technology, combined with weight method and angular resolution calculation, fast and high-precision determination of the sun direction vector is achieved. Specific steps include image data collection, adaptive Wiener filtering, multi-threshold segmentation and centroid calculation, using the parallel processing capabilities of FPGA and the DividerGenerator IP core to perform division operations to calculate the yaw and pitch angles of the sun direction vector.

Benefits of technology

It realizes the determination of the sun direction vector with simple algorithm, low power consumption, fast running speed and high precision, which is suitable for the resource constraints of micro-nano satellites, and can effectively suppress noise interference, improve the image restoration effect, and achieve an accuracy of 0.01°.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115717882B
    Figure CN115717882B
Patent Text Reader

Abstract

The present invention discloses a method for determining the solar direction vector based on FPGA design, which mainly includes: image acquisition, noise reduction of adaptive Wiener filtering, image multi-threshold segmentation, and calculation of the centroid coordinates of the solar spot by weight method, and finally calculation of the yaw angle and pitch angle of the solar direction vector by using the sensor angular resolution. The method of the present invention is based on FPGA design, has the characteristics of fast processing speed and low power consumption, and can ensure that the obtained direction vector has high accuracy. The method of the present invention has important application value in the field of micro-nano satellite attitude measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of satellite technology, specifically relating to a method for determining the solar direction vector based on FPGA design. Background Technology

[0002] Sun sensors are commonly used photoelectric attitude sensors in space missions. They provide angular feedback between the sun's direction vector and a specific axis on the satellite, used to determine the sun's direction and position relative to the satellite, and to protect onboard sensitive equipment from interference from sunlight. Furthermore, most satellites use solar energy, so it is necessary to ensure that the solar arrays are correctly oriented relative to the sun to obtain the most efficient irradiance.

[0003] Currently, most methods for determining the solar direction vector in China are complex and power-consuming. Analog solar sensors offer low measurement accuracy, while traditional digital solar sensor algorithms are mostly based on C programming languages, resulting in slow processing speeds and only providing a rough estimate of the sun's direction, requiring further determination of azimuth through changes in solar panel voltage. Some high-accuracy methods employ complex algorithms, are large in size, and are generally expensive, failing to balance factors such as size, field of view, accuracy, and overall cost. Currently, there are no patents in China for solar direction vector determination methods based on FPGA design for micro / nano satellites. Summary of the Invention

[0004] To address the aforementioned problems, the present invention aims to provide a solar direction vector determination method based on FPGA design, which solves the problems that existing solar sensor direction vector determination methods are complex and cannot simultaneously address technical issues such as size, accuracy, and power consumption.

[0005] To achieve the objectives outlined above, the technical solution adopted by this invention is as follows:

[0006] A method for determining the solar direction vector based on FPGA design includes the following steps:

[0007] Step 1: The FPGA processing board acquires image data within the field of view from the optical sensor, and the data of each pixel is represented by an eight-bit grayscale value;

[0008] Step 2: Perform adaptive Wiener filtering on the image data acquired in Step 1 to achieve noise reduction;

[0009] Step 3: The filtered pixel grayscale values ​​obtained in Step 2 are segmented into four parts using three thresholds: 150, 180, and 220. The segments are then reassigned values ​​of 0, 1, 2, and 4. Let the image pixel data before segmentation be f(x,y), and the segmented image pixel data be k(x,y).

[0010]

[0011] The number of pixels with gray values ​​greater than a given threshold of 150 in the filtered image is counted, and the count results are output to the centroid calculation module. When the number is less than the set value, it is considered that no sunspot appears in the image acquired within the field of view, and the final solar direction vector is set to 0. If the number is greater than the set value, the sunspot is considered valid, and the calculation continues.

[0012] Step 4: The image pixel data reassigned in Step 3 is k(x,y), where x and y are the pixel coordinates corresponding to the image pixel value, respectively. The centroid is calculated using the weighted method as follows:

[0013]

[0014]

[0015] Where M×N is the image resolution, and the obtained centroid of the solar spot is used as the mean. The FPGA's DividerGenerator IP core is called to perform a divider operation, and 12 bits of valid data are taken as the centroid coordinates;

[0016] Step 5: Calculate the angular resolution θ using the optical lens parameters and the size of the sensor's photosensitive plane. pixel Calculate the solar direction vector; the centroid coordinates obtained in step 4 are also calculated. Let (u, v) be the center of the pixel plane of the optical sensor, and (u0, v0) be the center of the pixel plane. Then the solar direction vector is calculated as follows:

[0017] α=(u-u0)θ pixel

[0018] β=(v-v0)θ pixel

[0019] Where α is the yaw angle of the solar direction vector and β is the pitch angle of the solar direction vector.

[0020] Further, step 2 specifically involves: performing adaptive Wiener filtering using a Wiener filtering module. The Wiener filtering module consists of three functional modules: a line_buffer module for generating a 3×3 window, a filter3by3 module for sequentially filtering the 3×3 window, and a variance_statistics module for performing noise variance statistics. The specific steps for implementing adaptive Wiener filtering are as follows:

[0021] Step 2.1: The line_bufer module generates 3×3 windows for the entire image sequentially, traverses all pixels in the image one by one, and selects to implement the 3×3 matrix through 4 single-port random access memory (RAM), named ram0, ram1, ram2, and ram3 in sequence;

[0022] For the input image data of the line_bufer module, the rows and columns written to RAM are counted respectively, and the last two digits of the row counter of the written data are used to distinguish four cases: 00, 01, 10, 11 to select the RAM to be written.

[0023] When the fourth row of pixel data begins to be written to ram3, data is simultaneously read from ram0, ram1, and ram2. Similarly, based on the last two digits of the row counter for writing data, four cases are selected to read the RAM. While reading data, the row and column counts of the read data are performed to select the data for the 3×3 window. Data from the three RAMs are read simultaneously for three consecutive clock cycles to obtain the pixel data of nine pixels in a 3×3 window. The line_buffer module outputs these nine pixel data to the filter3by3 module at the same time.

[0024] Step 22: The nine pixel data are a1 to a9. The filter3by3 module calculates the average pixel grayscale value μ within a 3×3 window centered at a4. The calculation formula is as follows:

[0025]

[0026] The FPGA process is converted into multiplication and shift operations, and then modified as follows:

[0027]

[0028] The filer3by3 module calculates the pixel variance σ for each window based on the mean μ. 2 :

[0029]

[0030] Step 2.3: After traversing the entire image, the filer3by3 module outputs all pixel variances to the variance_statistics module. The variance_statistics module calculates the average of all pixel variances for each frame of the image. If the number of frames is less than 10, the average pixel variance of each frame is used as the current noise variance δ2. If the number of frames is greater than or equal to 10, the average pixel variance of ten consecutive frames is used to calculate the average again, which is used as the noise variance of the Wiener filter and is continuously updated.

[0031] Step 2.4: The noise variance is fed to the filer3by3 module for Wiener filtering, resulting in a filtered pixel grayscale value of b4.

[0032]

[0033] Compared with the prior art, the significant advantages of this invention are:

[0034] (1) It has the characteristics of simple and reliable algorithm and low power consumption, which is suitable for the limited on-board resources of micro-nano satellites;

[0035] (2) The FPGA-based design scheme realizes parallel processing of image data, which greatly reduces the storage and retrieval time of image data processing frame by frame and improves the system's operating speed.

[0036] (3) The adaptive Wiener filtering method is used for noise reduction, which can update the noise variance in real time, effectively suppress noise interference, and protect the high-frequency details of the image. It has a good effect on restoring blurred images.

[0037] (4) The multi-threshold segmentation method preserves the key features of the image more completely and reduces the interference of stray light on the determination of the centroid.

[0038] (5) Using the pixel values ​​after threshold segmentation as the weights of the weight method to determine the centroid is not only simple in algorithm and low in computation, but also reduces the influence of most background stray light.

[0039] (6) The solar direction vector calculation method based on the angular resolution of optical sensors is simple, greatly reduces the amount of computation, reduces the occupation of FPGA resources, improves the running speed, and has high accuracy, reaching 0.01°. Attached Figure Description

[0040] Figure 1 This is a flowchart of the solar direction vector determination method based on FPGA design of the present invention.

[0041] Figure 2 This is a hierarchical structure diagram of the Wiener filter module.

[0042] Figure 3 This is a diagram showing the connection relationships between the sub-modules within the Wiener filter module.

[0043] Figure 4 This is a schematic diagram of a 3×3 window for Wiener filtering.

[0044] Figure 5 This is a schematic diagram for calculating the solar direction vector. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0046] The implementation of the present invention will be described in detail below with reference to specific embodiments.

[0047] like Figure 1 As shown, the solar direction vector determination method based on FPGA design of the present invention mainly includes the following steps:

[0048] 1) Since direct sunlight can damage the optical sensor, a neutral density filter needs to be installed at the front of the optical lens to protect the sensor without affecting the processing results. Light passes through the optical lens and falls onto the optical sensor. Controlled via a Serial Peripheral Interface (SPI), the FPGA processing board acquires image data from the optical sensor within the field of view. The data for each pixel is represented by an eight-bit grayscale value.

[0049] 2) Adaptive Wiener filtering is applied to the acquired image data to achieve better noise reduction. Figure 2 This is a hierarchical structure diagram of the Wiener filtering module. The Wiener filtering module consists of three functional modules: the line_buffer module, which generates a 3×3 window; the filter3by3 module, which filters the 3×3 window sequentially; and the variance_statistics module, which performs noise variance statistics. Figure 3 This is a diagram showing the connection relationships between the sub-modules within the Wiener filter module.

[0050] The specific steps to implement adaptive Wiener filtering are as follows:

[0051] a) The line_bufer module generates 3×3 windows sequentially across the entire image, traversing all pixels in the image one by one. Since the Wiener filtering module is computationally complex and requires calculating the noise variance for each window and each frame, to ensure reliability, a 3×3 matrix is ​​implemented using four Simple Dual Port Ram (RAM) memory modules, named ram0, ram1, ram2, and ram3 respectively.

[0052] The input image data for this module, such as Figure 3 In the image_y[7:0], the row and column counts of the data written to RAM are counted respectively, and the last two digits of the row counter of the data written are divided into four cases: 00, 01, 10, 11 to select the RAM to be written.

[0053] When the fourth row of pixel data begins to be written to RAM3, data is simultaneously read from RAM0, RAM1, and RAM2. Similarly, based on the last two digits of the row counter, four cases are identified to select the RAM to read from. Simultaneously, row and column counts are performed to select the data for the 3x3 window. By simultaneously reading data from the three RAMs for three consecutive clock cycles, pixel data for nine pixels within a 3x3 window can be obtained. Figure 3 The line_buffer module outputs these nine valid data items to the filter3by3 module simultaneously, along with the nine img_out[7:0] items.

[0054] b) Figure 4 This is a schematic diagram of a Wiener filter 3×3 window. The 9 pixel data img_out[7:0] are a1 to a9 respectively. The filter3by3 module calculates the average gray value μ of the pixels within the 3×3 window centered at a4. The calculation formula is as follows:

[0055]

[0056] Since performing division directly on an FPGA would consume a lot of resources, it is usually converted into multiplication and shifting operations, and modified as follows:

[0057]

[0058] The filer3by3 module calculates the pixel variance σ for each window based on the mean μ. 2 ,like Figure 3 The formula for calculating o_sigma_2[16:0] is as follows:

[0059]

[0060] c) After traversing the entire image, the filer3by3 module outputs all pixel variances to the variance_statistics module. The variance_statistics module calculates the average of all pixel variances for each frame. If the number of frames in the image is less than 10, the average pixel variance of each frame is used as the current noise variance δ. 2 ,like Figure 3 In delta[7:0], if the number of frames is greater than or equal to 10, the average value of the pixel variance of the ten consecutive frames is used as the noise variance of Wiener filtering and is continuously updated.

[0061] d) Finally, the noise variance is fed to the filer3by3 module for Wiener filtering, resulting in the filtered pixel grayscale value of b4, which is... Figure 3In wienerfilt_img_done[7:0], then

[0062]

[0063] 3) The Wiener-filtered image data wienerfilt_img_done[7:0] is used as the input to the threshold segmentation module, and the output is the re-valued image data after threshold segmentation. The multi-threshold segmentation method is an extension of the single-threshold method, which modifies the image to several specific values. While reducing data complexity, it minimizes the impact of image segmentation on the subsequent algorithm processing results, and the algorithm implementation is relatively simple, thereby reducing the requirements for the hardware processing circuit.

[0064] Dividing the grayscale values ​​from 0 to 255 into several different brightness regions using three thresholds of 150, 180, and 220 allows for better differentiation between solar flare areas and background areas, with regions closer to the sun's centroid receiving higher weights. The selection of the three thresholds can be adjusted based on the photoelectric conversion efficiency of different sensors and the attenuation rate of the neutral density filter. Let the image pixel data before segmentation be f(x,y), and the image pixel data after segmentation be f(x,y):

[0065]

[0066] In the captured images of solar flares, the closer a flare is to the Sun's centroid, the brighter it is, resulting in a larger pixel value and a higher weight assigned during thresholding. Since stray light from other stars in the space environment can interfere with the determination of the solar flare's centroid, this interference must be eliminated as much as possible during thresholding. Because the brightness of these stars is much smaller than that of the Sun, their weights are set to 0, reducing the computational load for subsequent centroid calculations. At the edges of the solar flare, stray sunlight can make the image boundaries unclear. Therefore, the edges are divided into two parts during thresholding. This process improves the convergence of the solar flare's center, reduces the interference of stray light on centroid determination, and enhances the accuracy of subsequent calculations.

[0067] Simultaneously, the number of pixels with gray values ​​greater than the given threshold of 150 in the filtered image is counted, and the counting results are output to the centroid calculation module. When the number is less than the set value, it is considered that no sunspot appears in the image acquired within the field of view, and the final solar direction vector is set to 0. If the number is greater than the set value, the sunspot is considered valid, and the calculation continues.

[0068] 4) The reassigned values ​​0, 1, 2, and 4 are used as new image pixel data, denoted as f(x,y), where x and y are the pixel coordinates corresponding to the pixel value, and the centroid is calculated using the weight method.

[0069] The weighted method is relatively simple to calculate, without complex computational processes, making it more suitable for FPGA implementation compared to other algorithms. Its basic idea is to use the grayscale value of each pixel in the solar image as its weight, then multiply each pixel's weight (i.e., grayscale value) by its coordinates. This process is repeated across the entire image from left to right and top to bottom, summing the results for each pixel and calculating the average. The final result is used as the coordinates of the sun's centroid. The calculation expression is as follows:

[0070]

[0071]

[0072] Where M×N is the image resolution, and the obtained centroid of the solar spot is used as the mean. Due to the large amount of computation and limited FPGA resources, performing division directly would consume a lot of resources and result in low accuracy. Therefore, in this invention, the FPGA's Divider Generator IP core is called to perform the division operation, and 12 bits of valid data are used as the centroid coordinates.

[0073] 5) Currently, the most common calculation method in China is to calculate based on geometric relationships using inverse trigonometric functions. The geometric method of inverse trigonometric functions is simple in principle, but due to the limited computing power of FPGA, it is difficult to implement calculations for trigonometric functions and inverse trigonometric functions, and it will consume more resources, leading to increased power consumption.

[0074] This invention utilizes angular resolution to calculate the yaw and pitch angles of the solar vector. Angular resolution refers to the angular offset of each pixel on the sensor plane relative to the center of the photosensitive surface. A schematic diagram of the solar direction vector calculation in this invention is shown below. Figure 5 As shown, the yaw angle and pitch angle of the solar direction vector are represented by α and β, respectively, and their calculation expressions are as follows:

[0075] α=(u-u0)θ pixel

[0076] β=(v-v0)θ pixel

[0077] Where θpixal is the angular resolution, calculated based on the lens parameters used in the experiment and the size of the sensor's photosensitive plane; u and v are the calculated coordinates of the solar spot centroid on the sensor plane, and u0 and b0 are the coordinates of the center position of the sensor plane, respectively.

[0078] Since the angular resolution is a floating-point number, and the calculation result is a signed floating-point number, it needs to be converted to a fixed-point number during calculation and performed step by step. First, u-u0 and v-v0 are calculated, and 11-bit intermediate registers u_u0_0[10:0] and v_v0_0[10:0] are set, containing 1 sign bit and 9 integer bits, with the highest bit being the sign bit. The sign bit is determined by first judging the magnitude of u and u0, and then u-u0 and v-v0 are calculated. The angular resolution is determined according to the lens focal length, and the shift is determined according to the angular resolution. This invention sets the shift to 12 bits.

[0079] The calculation result is used as the final numerical value, which includes 3 integer bits and 12 decimal bits. The highest bit of the intermediate registers u_u0_0[10:0] and v_v0_0[10:0] is used as the sign bit of the final result, that is:

[0080] Yaw angle alpha_0[15:0]={u_u0_0

[10] ,alpha_cal[14:0]}

[0081] Pitch angle beta_0[15:0]={v_v0_0

[10] ,beta_cal[14:0]}

[0082] In this context, alpha_0

[15] and beta_0

[15] are sign bits, alpha_0[14:12] and beta_0[14:12] are integer parts, and alpha_0[11:0] and beta_0[11:0] are fractional parts. Behavioral simulation and experimental testing were performed on this method to verify the accuracy of centroid positioning. The final result has an accuracy of 0.01°.

[0083] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for determining the sun direction vector based on FPGA design, characterized in that: The following steps are involved: Step 1: The FPGA processing board collects image data within the field of view from the optical sensor, and the data of each pixel is represented by an eight-bit grayscale value; Step 2: Perform adaptive Wiener filtering on the image data collected in step 1 to achieve noise reduction effect; Step 3: Perform multi-threshold segmentation on the filtered pixel grayscale values ​​obtained in step 2 according to three thresholds of 150, 180, and 220, divide them into four parts, and reassign them to 0, 1, 2, and 4. Suppose the image pixel data before image segmentation is f(x, y), and the image pixel data after segmentation is k(x, y): The number of pixels whose grayscale value of the filtered image is greater than the given threshold of 150 is counted, and the statistical counting result is output to the centroid calculation module. When the number is less than the set value, it is considered that no sun spot appears in the image collected within the field of view, and the final sun direction vector is set to 0. If the number is greater than the set value, the sun spot is considered valid and the calculation continues; Step 4: The image pixel data reassigned in step 3 is k(x,y), where x and y are the pixel coordinates corresponding to the image pixel data, and the centroid is calculated using the weight method as follows: Where M×N is the image resolution, For the sun spot centroid, call the Divider Generator IP core of FPGA to perform divider operation and take 12 bits of valid data as the centroid coordinates; Step 5: Calculate the angular resolution θ using the optical lens parameters and the size of the sensor's photosensitive surface pixel Calculate the sun direction vector and the center of mass coordinates calculated in step 4 Let (u, v), (u0, v0) be the center of the pixel plane of the optical sensor, then the sun direction vector is calculated as follows: α=(u-u0)θ pixel β=(v-v0)θ pixel Among them, α is the yaw angle of the sun direction vector, and β is the pitch angle of the sun direction vector.

2. The method for determining the sun direction vector based on FPGA design according to claim 1, characterized in that: The step 2 is specifically: using a Wiener filter module to perform adaptive Wiener filtering. The Wiener filter module consists of three functional modules, including a line_buffer module for generating a 3×3 window, a filter3by3 module for filtering the 3×3 window in sequence, and a variance_statistics module for performing noise variance statistics. The specific steps for implementing adaptive Wiener filtering are as follows: Step 2.1: The line_bufer module generates a 3×3 window for the entire image, traverses all pixels in the image one by one, and selects 4 single-port random access memories RAM to implement the 3×3 matrix, named ram0, ram1, ram2, and ram3 respectively; For the input image data of the line_bufer module, the row and column counts of the RAM are written respectively, and the RAM to be written is selected according to the last two digits of the row counter of the written data: 00, 01, 10, 11; When the fourth row of pixel data starts to be written into ram3, data is read from ram0, ram1, and ram2 at the same time. Similarly, the last two bits of the row counter of the written data are divided into four cases, and the RAM to be read is selected. While reading the data, the row and column counts of the read data are performed to select the data of the 3×3 window. The data of the three RAMs are read simultaneously for three consecutive clocks to obtain the pixel data of nine pixels in a 3×3 window. The line_buffer module outputs these nine pixel data to the filter3by3 module at the same time. Step 2.2: The nine pixel data are a1 to a9, and the filter3by3 module calculates the pixel grayscale mean μ in the 3×3 window centered on a4. The calculation formula is as follows: FPGA converts it into multiplication and shift processing and corrects it to the following formula: The filer3by3 module calculates the pixel variance σ of each window based on the mean μ 2 : Step 2.3: After traversing the entire image, the filer3by3 module outputs all pixel variances to the variance_statistics module. The variance_statistics module calculates the average value of all pixel variances for each frame. If the number of image frames is less than 10, the average value of the pixel variance of each frame is used as the current noise variance δ 2 , if the number of frames is greater than or equal to 10 frames, the average value of the pixel variance of ten consecutive frames is used to calculate the average value as the noise variance of the Wiener filter and it is continuously updated; Step 2.4: Give the noise variance to the filer3by3 module for Wiener filtering, and get the pixel grayscale value after filtering as b4.