Method, device and equipment for obtaining wind energy simulation data and storage medium
Patent Information
- Application Number
- CN202211129076.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-09-16
AI Technical Summary
[0004]在采用上述方法时,由于得到分块编号以后继续计算落入查询范围的像元坐标集的步骤需要耗费较多的时间,并且得到分块编号以后读取分块的风能仿真数据所需的输入或输出(input/output,I/O)操作又会占据很长时间,导致获取风能仿真数据耗费的时间较多
Smart Images

Figure CN117762321B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, equipment and storage medium for acquiring wind energy simulation data. Background Technology
[0002] Raster data is a data organization method that represents the distribution of spatial features or phenomena in the form of a two-dimensional matrix. Each unit of the matrix is called a cell, and each cell represents an information value. In a scenario where the server provides a query service for wind energy simulation data to the client, the server can use raster data to store global wind energy simulation data. When the client initiates a query request to retrieve wind energy simulation data within a certain range, the server can retrieve the wind energy simulation data corresponding to the query range and return it to the client.
[0003] In related technologies, when the server obtains raster data, it first determines the block number where the required wind energy simulation data is located, then calculates the set of cell coordinates within the block that fall within the query range, then reads the wind energy simulation data of the block from the disk, and then obtains the wind energy simulation data corresponding to the set of cell coordinates from the wind energy simulation data of the block.
[0004] When using the above method, the step of calculating the set of cell coordinates falling within the query range after obtaining the block number takes a lot of time, and the input or output (I / O) operations required to read the wind energy simulation data of the block after obtaining the block number also take a long time, resulting in a lot of time spent obtaining wind energy simulation data. Summary of the Invention
[0005] This application provides a method, apparatus, equipment, and storage medium for acquiring wind energy simulation data, which can improve the speed of acquiring wind energy simulation data. The technical solution is as follows.
[0006] Firstly, a method for acquiring wind energy simulation data is provided, the method including:
[0007] The first block number is determined by the first thread. The first block is one or more blocks in the raster dataset that hit the query range. The raster dataset represents wind energy simulation data from around the world.
[0008] The second thread reads the wind energy simulation data of the first block into the buffer of the second thread based on the number of the first block. At the same time, the first thread determines the set of cell coordinates within the first block that fall within the query range. A cell represents the wind energy simulation data of a geographical area.
[0009] The first thread obtains target wind energy simulation data from the buffer of the second thread based on the cell coordinate set. The target wind energy simulation data includes the wind energy simulation data corresponding to the cell coordinate set in the wind energy simulation data of the first block.
[0010] According to the method provided in the first aspect, after the first thread determines the number of the first block, while the second thread reads the wind energy simulation data of the first block, the first thread determines the set of cell coordinates within the first block that fall within the query range. Based on the set of cell coordinates, the target wind energy simulation data is obtained from the buffer of the second thread. Since the data has already been read into the buffer when the first thread determines the set of cell coordinates, the time for the first thread to read the wind energy simulation data of the first block after completing the calculation of the set of cell coordinates is saved, thus improving the speed of obtaining wind energy simulation data.
[0011] In some implementations, determining the set of cell coordinates within the first block that fall within the query range includes:
[0012] Determine the outer rectangle of the query range;
[0013] Determine the latitude and longitude coordinates of the first pixel in the circumscribed rectangle;
[0014] If the latitude and longitude coordinates of the first pixel are within the query range, convert the latitude and longitude coordinates of the first pixel to coordinates in the spatial coordinate system of the wind energy simulation data of the first block;
[0015] Based on the transformed coordinates, determine the coordinates of the first pixel within the first block.
[0016] In some implementations, after obtaining the target wind energy simulation data from the buffer of the second thread, the method further includes:
[0017] The status of the wind energy simulation data in the first block is marked as read, and the lifetime of the wind energy simulation data in the first block is decreased according to the set time interval.
[0018] When the lifetime of the first block is 0, the wind energy simulation data of the first block is deleted from the buffer of the second thread.
[0019] In some implementations, the method further includes, before retrieving the target wind energy simulation data from the buffer of the second thread:
[0020] The status of the wind energy simulation data in the first block is marked as unread, and the lifetime of the wind energy simulation data in the first block is incremented.
[0021] In some implementations, the method further includes, before determining the number of the first block via the first thread:
[0022] Divide the raster dataset into multiple blocks;
[0023] Store each block in the multiple blocks sequentially according to the pixel order.
[0024] In some implementations, the method further includes, before determining the number of the first block via the first thread:
[0025] The first thread listens for query requests from clients via sockets, with the query request indicating the query range of wind energy simulation data.
[0026] After obtaining the target wind energy simulation data from the buffer of the second thread, the method also includes:
[0027] The first thread sends the target wind energy simulation data to the client via a socket.
[0028] Secondly, a device for acquiring wind energy simulation data is provided, the device comprising:
[0029] The determination module is used to determine the number of the first block through the first thread. The first block is one or more blocks in the raster dataset that hit the query range. The raster dataset represents wind energy simulation data from around the world.
[0030] The reading module is used to read the wind energy simulation data of the first block into the buffer of the second thread based on the number of the first block;
[0031] The determination module is also used to determine the set of cell coordinates within the query range in the first block through the first thread while the reading module is reading the wind energy simulation data. A cell represents the wind energy simulation data of a geographical area.
[0032] The acquisition module is used to acquire target wind energy simulation data from the buffer of the second thread based on the cell coordinate set through the first thread. The target wind energy simulation data includes the wind energy simulation data corresponding to the cell coordinate set in the wind energy simulation data of the first block.
[0033] In some implementations, a determining module is used to determine the circumscribed rectangle of the query range; determine the latitude and longitude coordinates of the first pixel in the circumscribed rectangle; if the latitude and longitude coordinates of the first pixel are within the query range, convert the latitude and longitude coordinates of the first pixel into coordinates in the spatial coordinate system where the wind energy simulation data of the first block is located; and determine the coordinates of the first pixel within the first block based on the converted coordinates.
[0034] In some embodiments, the apparatus further includes:
[0035] The marking module is used to mark the status of the first block of wind energy simulation data as read;
[0036] The lifetime update module is used to decrease the lifetime of the wind energy simulation data in the first block according to a set time interval.
[0037] The deletion module is used to delete the wind energy simulation data of the first block from the buffer of the second thread when the lifetime of the first block is 0.
[0038] In some implementations, the marking module is also used to mark the status of the wind energy simulation data of the first block as unread;
[0039] The lifetime update module is also used to increment the lifetime of the wind energy simulation data in the first block.
[0040] In some embodiments, the apparatus further includes:
[0041] The partitioning module is used to divide a raster dataset into multiple partitions;
[0042] The storage module is used to store each block in multiple blocks sequentially according to the order of the pixels.
[0043] In some embodiments, the apparatus further includes:
[0044] The listening module is used to listen for query requests from clients via the first thread, based on the socket. The query request indicates the query range of wind energy simulation data.
[0045] The sending module is used to send target wind energy simulation data to the client via a socket through the first thread.
[0046] Thirdly, a computer device is provided, comprising: a processor coupled to a memory, the memory storing at least one computer program instruction, the at least one computer program instruction being loaded and executed by the processor to enable the computer device to implement the method of the first aspect or any alternative method of the first aspect.
[0047] Fourthly, a computer-readable storage medium is provided, wherein at least one instruction is stored therein, which, when executed on a computer, causes the computer to perform a method as described in the first aspect or any alternative method of the first aspect. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating a method for acquiring wind energy simulation data provided in an embodiment of this application;
[0049] Figure 2 This is a schematic diagram of a raster dataset provided in an embodiment of this application;
[0050] Figure 3 This is a schematic diagram of block data provided in an embodiment of this application;
[0051] Figure 4 This is a schematic diagram of block data provided in an embodiment of this application;
[0052] Figure 5 This is a flowchart illustrating a method for acquiring wind energy simulation data provided in an embodiment of this application;
[0053] Figure 6 This is a schematic diagram of the structure of a wind energy simulation data acquisition device 600 provided in an embodiment of this application;
[0054] Figure 7 This is a schematic diagram of the structure of a computer device 700 provided in an embodiment of this application. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0056] The following explains some terms and concepts involved in the embodiments of this application.
[0057] Memory: Short for computer main memory, including read-only memory (ROM) and random access memory (RAM). In this example, it is random access memory.
[0058] Band Interleaved by Pixel (BIP): This means that the first pixel of the first band is saved first, then the first pixel of the second band is saved, and so on.
[0059] GeoTiff: Tag Image File Format (TIFF). Image files are commonly used in graphic image processing. GeoTiff is an extension of the TIFF format. It defines some GeoTags (geographic tags) on the basis of TIFF, thereby defining and storing various coordinate systems, ellipsoidal datums, projection information, etc., so that image data and geographic data are stored in the same image file. It is a commonly used raster data format in geographic information systems.
[0060] The Environment for Visualizing Images (NEVI) is a remote sensing image processing platform developed by Exelis Visual Information Solutions, Inc. in the United States. It is developed using Interactive Data Language (IDL) and is a mainstream software platform for remote sensing image processing.
[0061] Raster data: A data organization method that represents the distribution of spatial features or phenomena in the form of a two-dimensional matrix. Each unit of the matrix is called a cell, and each cell represents an information value.
[0062] Band: In remote sensing technology, the electromagnetic spectrum is usually divided into multiple bands according to the response range of the remote sensor. Each band corresponds to a two-dimensional matrix, and multiple bands constitute a raster data file. In this patent, the term refers to the bands in the raster data file.
[0063] Socket: A socket is an abstraction of the endpoint for bidirectional communication between application processes on different hosts in a network. It can be seen as the endpoint in the communication connection between two network applications. It is the application programming interface (API) for inter-process communication in a network environment.
[0064] The inventors of this application discovered that during the process of querying wind energy simulation data requested by the client, the server's steps in determining the set of cell coordinates falling within the query range involve coordinate transformation and clipping calculations, which are time-consuming. Furthermore, the server's steps in reading the segmented wind energy simulation data involve disk I / O operations, which also consume considerable time. Therefore, if the steps of determining the set of cell coordinates falling within the query range and reading the segmented wind energy simulation data from the disk are performed serially—for example, by having thread A first calculate the segment number, then thread A determine the file to be read based on the segment number, then thread A calculate the set of cell coordinates falling within the query range, then thread A reads the segmented wind energy simulation data based on the segment number, and finally thread A obtains the wind energy simulation data corresponding to the set of cell coordinates from the read segmented wind energy simulation data—the time consumed is on the order of minutes, which is clearly time-consuming and affects the efficiency of data querying.
[0065] Based on this, some embodiments of this application provide a method for acquiring wind energy simulation data in parallel using dual threads. One thread is responsible for determining the set of cell coordinates falling within the query range, while another thread is responsible for reading the wind energy simulation data in blocks. This separates computational operations from disk I / O operations, supporting parallel execution of computational and disk I / O operations, thus significantly saving time in acquiring wind energy simulation data. For example, after thread A calculates the required block number, thread B reads the wind energy simulation data for that block. Once thread A has completed calculating the set of cell coordinates falling within the query range, it can use the calculated cell coordinates from thread A and the block-read wind energy simulation data from thread B to return the wind energy simulation data within the query range, saving the time thread A spends waiting for data to be read after calculating the set of cell coordinates falling within the query range.
[0066] The method flow of the embodiments of this application is illustrated below.
[0067] Figure 1 This is a flowchart of a method for acquiring wind energy simulation data provided in an embodiment of this application. Figure 1 The method shown includes the following steps S101 to S103.
[0068] Step S101: The computer device determines the number of the first block through the first thread.
[0069] The computer equipment, such as a server, is used to provide clients with a service to query wind energy simulation data. The first chunk is one or more chunks in the raster dataset that match the query range. The raster dataset represents global wind energy simulation data. Wind energy simulation data includes, for example, at least one of wind speed, wind direction, temperature, emissivity, or roughness. Figure 2 This is a specific example of a raster dataset. Figure 2 Each rectangle in the table represents a block. The query range can be represented, for example, by querying a polygon. For another example, please refer to... Figure 3 , Figure 3 The query polygon 32 is a specific example of the query range. The query polygon 32 hits four blocks: block 33-1, block 33-2, block 33-3, and block 33-4. The first block is, for example, any one or more of the blocks 33-1, 33-2, 33-3, and 33-4.
[0070] Step S102: The computer device reads the wind energy simulation data of the first block into the buffer of the second thread based on the number of the first block through the second thread. At the same time, the first thread determines the set of cell coordinates within the first block that fall within the query range. Each cell represents the wind energy simulation data of a geographical area.
[0071] In some implementations, after determining the number of the first block through a first thread, the computer device also generates a notification message through the first thread. The notification message instructs the reading of wind energy simulation data for the first block. The computer device sends the notification message to a second thread through the first thread. The second thread receives the notification message and, in response, reads the wind energy simulation data for the first block.
[0072] In some implementations, the process of determining the pixel coordinate set includes: the computer device determining the circumscribed rectangle of the query range through a first thread; the computer device determining the latitude and longitude coordinates of the first pixel in the circumscribed rectangle through the first thread; if the latitude and longitude coordinates of the first pixel are within the query range, the computer device converting the latitude and longitude coordinates of the first pixel into coordinates in the spatial coordinate system of the wind energy simulation data of the first block through the first thread; and the computer device determining the coordinates of the first pixel within the first block based on the converted coordinates through the first thread.
[0073] According to the above implementation method, since the coordinate transformation of pixels falling within the query range is based on the latitude and longitude coordinates of the pixels, it can achieve the effect of cropping. Only the data falling within the query range in the raster dataset needs to be transformed and the data acquired. There is no need to transform and acquire the data for raster data that is concentrated outside the query range. This enables on-demand and real-time acquisition of raster datasets and improves the efficiency of data acquisition.
[0074] Step S103: The computer device obtains target wind energy simulation data from the buffer of the second thread based on the cell coordinate set through the first thread.
[0075] The target wind energy simulation data refers to the wind energy simulation data within the query range. Specifically, the target wind energy simulation data includes the wind energy simulation data corresponding to the cell coordinate set in the first block of wind energy simulation data.
[0076] The method provided in this embodiment determines the number of the first block by the first thread, and while the second thread reads the wind energy simulation data of the first block, the first thread determines the set of cell coordinates within the first block that fall within the query range. Based on the set of cell coordinates, the target wind energy simulation data is obtained from the buffer of the second thread. Since the data has already been read into the buffer when the first thread determines the set of cell coordinates, the time for the first thread to read the wind energy simulation data of the first block after completing the set of cell coordinates is saved. Therefore, the speed of obtaining wind energy simulation data is improved, and the efficiency of obtaining wind energy simulation data is improved.
[0077] In some implementations, after obtaining the target wind energy simulation data from the buffer of the second thread, the method further includes: marking the status of the wind energy simulation data of the first block as read, and decreasing the lifetime of the wind energy simulation data of the first block according to a set time interval; when the lifetime of the first block is 0, deleting the wind energy simulation data of the first block from the buffer of the second thread.
[0078] According to the above implementation method, the memory space occupied by the read blocks can be released in a timely manner, saving the storage pressure caused by storing wind energy simulation data.
[0079] In some implementations, before retrieving the target wind energy simulation data from the buffer of the second thread, the method further includes: marking the state of the wind energy simulation data of the first block as unread and incrementing the lifetime of the wind energy simulation data of the first block.
[0080] According to the above implementation method, by increasing the lifetime of the wind energy simulation data that hits the query range, it helps to extend the time that the frequently accessed wind energy simulation data is cached in memory, thereby reducing the number of hard disk reads and improving the efficiency of obtaining wind energy simulation data.
[0081] In some implementations, after the second thread reads the first block, the first block is marked as unread; after the first thread retrieves the first block from the second thread's data buffer, the first block is marked as read. The lifetime of the first block is decremented at set time intervals until its lifetime reaches 0, at which point the first block is deleted. During the decrementing of the first block's lifetime, if a third thread accesses the first block, its status is remarked as unread, and its lifetime is restored to its initial value. This implementation extends the lifetime of frequently accessed blocks, allowing them to reside in memory and saving time required for subsequent accesses.
[0082] In some implementations, the computer device performs Figure 1 Prior to the method shown, a step of storing the raster dataset in blocks is also performed. The block storage step includes steps (1) to (2).
[0083] Step (1) The computer device divides the raster dataset into multiple blocks.
[0084] For example, a computer device divides a raster dataset into M rows and N columns according to a set width, resulting in M*N blocks. For instance, the computer device might use a 30° x 30° size to divide the raster dataset into 6 rows and 12 columns, such as... Figure 2 As shown.
[0085] Step (2) The computer device stores each block in the multiple blocks in the order of the pixels.
[0086] For example, a computer device stores each block as a file. The file name is Global_Var_M_N, where Var represents the variable identifier, M represents the block line number, and N represents the block column number. For example, the computer device may use GeoTIFF or ENVI file formats to store the file corresponding to each block. Alternatively, the computer device may store the file corresponding to each block in BIP order.
[0087] According to the above implementation method, by storing the raster dataset representing global wind energy simulation data in blocks, the low storage efficiency caused by storing global wind energy simulation data in a single file is avoided, thereby improving the efficiency of storing wind energy simulation data.
[0088] In some implementations, the computer device provides a query service for wind energy simulation data based on a socket. For example, before step S101, the computer device listens for query requests from clients via a first thread using a socket. After listening to the client's query request via the first thread, the computer device obtains the query range from the query request via the first thread, and determines the number of the first block based on the query range. The query request indicates that wind energy simulation data within the query range be queried. The query request is, for example, a Hypertext Transfer Protocol (HTTP) request. Accordingly, after obtaining the target wind energy simulation data from the buffer of a second thread, the computer device sends the target wind energy simulation data to the client via a socket using the first thread. For example, the computer device sends an HTTP response to the client, the HTTP response including the target wind energy simulation data. The aforementioned client is, for example, an application client, such as a simulation application client for atmospheric flow simulation, wind farm simulation, or fine-grained wind resource assessment.
[0089] Figure 5 This is a flowchart of a method for acquiring wind energy simulation data provided in an embodiment of this application. Figure 5 The method shown is as described above. Figure 1 A specific example of the method shown. Figure 5 The method shown includes the following steps S501 to S512.
[0090] Step S501: The computer device starts the first thread. The first thread is used to listen for client query requests via socket, for example, refer to... Figure 5The first thread listens for query requests from client 1, client 2, and so on, from client N. In some implementations, the first thread includes multiple sub-threads. Each sub-thread interacts with a client. For example, the first thread includes a first sub-thread and a second sub-thread. The first sub-thread receives query requests from the first client and sends the wind energy simulation data requested by the first client to the first client. The second sub-thread receives query requests from the second client and sends the wind energy simulation data requested by the second client to the second client.
[0091] Step S502: The computer device starts the second thread. The second thread is used to read the file containing wind energy simulation data and manage the wind energy simulation data in the cache.
[0092] Step S503: When the first thread receives a query request, it generates a query polygon C based on the latitude and longitude range carried in the query request, and generates the circumscribed rectangle S of the query polygon C. For example, please refer to... Figure 3 , Figure 3 The query polygon 32 is a specific example of a query polygon, and the circumscribed rectangle 31 is the circumscribed rectangle of the query polygon 32.
[0093] Step S504: The first thread calculates the row and column numbers of the blocks hit by the circumscribed rectangle S, based on the circumscribed rectangle S, to obtain the block list L. Taking it as an example that the circumscribed rectangle S hits K blocks, the block list L = {(R1, C1), (R2, C2), ..., (R... k C k )}.
[0094] Step S505: The first thread notifies the second thread to read the wind energy simulation data of the corresponding block based on the block list L.
[0095] Step S506: The first thread, based on the block list L, calculates the set of pixel coordinates P(R) of each block that falls into the query polygon. i C i )={(r,c)}, where R i For block line numbers, C i Let i be the column number of the block, i be the index number in the block list L, and r, c be the block (R). i C i Pixel coordinates within )
[0096] The specific operation for calculating the set of cell coordinates falling into the query polygon in each block in step S506 is as follows (1) to (5).
[0097] Step (1) The first thread calculates the maximum x-coordinate (Xmax), maximum y-coordinate (Ymax), minimum x-coordinate (Xmin), and minimum y-coordinate (Ymin) of the pixel coordinate set of the query polygon, and constructs the circumscribed rectangle E based on these four coordinate values. For example, please refer to... Figure 4 , Figure 4 The circumscribed rectangle 31 is a specific example of the circumscribed rectangle E, based on... Figure 4 The maximum and minimum x-coordinates of polygon 32 are found, the minimum and maximum y-coordinates of polygon 32 are found, and the circumscribed rectangle 31 is formed.
[0098] Step (2) The first thread calculates the number of rows m and the number of columns n of the result image Img according to the resolution Res specified in the input interface. Wherein, the number of rows m = (Ymax - Ymin) / Res, and the number of columns n = (Xmax - Xmin) / Res.
[0099] Step (3) The first thread traverses the result image Img pixel by pixel and calculates the latitude and longitude coordinates (x,y) of the current pixel (i,j), where x=Xmin+j*Res,y=Ymax-j*Res;
[0100] Step (4) The first thread determines whether the cell is within the query polygon C based on its latitude and longitude coordinates. If the cell is not within the query polygon, the first thread assigns the cell's value to the fill value F.
[0101] Step (5) If the cell is within the query polygon, the first thread converts the latitude and longitude coordinates (x, y) to coordinates (x', y') in the spatial coordinate system of the raster dataset, and then calculates the corresponding block coordinates (R) based on the coordinates (x', y'). x C y This process determines the corresponding block, and then retrieves the pixel value V from the corresponding block from thread B using a resampling method (such as nearest neighbor or bilinear interpolation). Figure 4 As shown.
[0102] In step S507, the first thread retrieves the required target wind energy simulation data from the buffer of the second thread based on the block list L and the corresponding cell coordinate set P, and sends the target wind energy simulation data to the client via a socket. Specifically, the target wind energy simulation data required in step S507 is the wind energy simulation data corresponding to the cell coordinate set falling into the query polygon calculated in step S506.
[0103] In step S508, when the second thread receives the notification from step S505, the second thread checks whether the wind energy simulation data corresponding to the block list L already exists in the buffer.
[0104] Step S509: Following step S508, when the wind energy simulation data of each block in the block list L already exists in the buffer of the second thread, the second thread increases the lifetime of the wind energy simulation data of each block in the block list L and marks the wind energy simulation data of each block in the block list L as unread.
[0105] Step S510: According to step S508, when the second thread's buffer does not contain or lacks wind energy simulation data corresponding to block list L, the second thread reads the file containing the block according to the block number, increases the lifetime of each block corresponding to block list L in the buffer, and marks the wind energy simulation data of the block as unread.
[0106] Step S511: Following step S507, after the first thread reads the required wind energy simulation data from one or more blocks in the buffer of the second thread, the status of the wind energy simulation data of that block is marked as read.
[0107] Step S512: When the status of a certain block of wind energy simulation data cached in the second thread is "read", the lifetime of the block of wind energy simulation data begins to decrease at a certain time interval until the lifetime of the block is 0, and then the wind energy simulation data corresponding to the block is deleted.
[0108] Repeat steps S503-S512 to provide a service for querying wind energy simulation data.
[0109] The method provided in this embodiment takes into account that querying raster data under arbitrary polygons requires coordinate transformation and clipping calculations, which are time-consuming operations. In addition, disk I / O operations also consume a lot of time. If run serially, the time taken is on the order of minutes. By adopting this embodiment, disk I / O operations and calculation operations are executed concurrently, and high-frequency access data is cached in memory. This reduces the time for querying and obtaining global-scale raster data through the WEB port from minutes to seconds. The data response and acquisition time can fully meet the application requirements of online real-time flow field simulation and wind farm simulation.
[0110] Figure 6 This is a schematic diagram of a wind energy simulation data acquisition device 600 provided in an embodiment of this application. The device 600 includes:
[0111] The determination module 601 is used to determine the number of the first block through the first thread. The first block is one or more blocks in the raster dataset that hit the query range. The raster dataset represents wind energy simulation data from around the world.
[0112] The reading module 602 is used to read the wind energy simulation data of the first block into the buffer of the second thread based on the number of the first block;
[0113] The determination module 601 is also used to determine the set of cell coordinates within the query range in the first block through the first thread while the reading module 602 is reading the wind energy simulation data. A cell represents the wind energy simulation data of a geographical area.
[0114] The acquisition module 603 is used to acquire target wind energy simulation data from the buffer of the second thread based on the cell coordinate set through the first thread. The target wind energy simulation data includes the wind energy simulation data corresponding to the cell coordinate set in the wind energy simulation data of the first block.
[0115] In some implementations, the determining module 601 is used to determine the circumscribed rectangle of the query range; determine the latitude and longitude coordinates of the first pixel in the circumscribed rectangle; if the latitude and longitude coordinates of the first pixel are within the query range, convert the latitude and longitude coordinates of the first pixel into coordinates in the spatial coordinate system where the wind energy simulation data of the first block is located; and determine the coordinates of the first pixel in the first block based on the converted coordinates.
[0116] In some embodiments, the apparatus further includes:
[0117] The marking module is used to mark the status of the first block of wind energy simulation data as read;
[0118] The lifetime update module is used to decrease the lifetime of the wind energy simulation data in the first block according to a set time interval.
[0119] The deletion module is used to delete the wind energy simulation data of the first block from the buffer of the second thread when the lifetime of the first block is 0.
[0120] In some implementations, the marking module is also used to mark the status of the wind energy simulation data of the first block as unread;
[0121] The lifetime update module is also used to increment the lifetime of the wind energy simulation data in the first block.
[0122] In some embodiments, the apparatus further includes:
[0123] The partitioning module is used to divide a raster dataset into multiple partitions;
[0124] The storage module is used to store each block in multiple blocks sequentially according to the order of the pixels.
[0125] In some embodiments, the apparatus further includes:
[0126] The listening module is used to listen for query requests from clients via the first thread, based on the socket. The query request indicates the query range of wind energy simulation data.
[0127] The sending module is used to send target wind energy simulation data to the client via a socket through the first thread.
[0128] Figure 7 This is a schematic diagram of the structure of a computer device 700 provided in an embodiment of this application. The computer device 700 includes a processor 701 and a memory 702. The memory 702 stores computer program instructions, and the processor 701 executes the computer program instructions to implement the above-mentioned... Figure 1 The steps in the method shown in the embodiment.
[0129] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0130] A references B, which means that A is the same as B or A is a simple variation of B.
[0131] The terms "first" and "second," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order of objects, and should not be construed as indicating or implying relative importance. For example, "first thread" and "second thread" are used to distinguish different threads, not to describe a specific order of threads, and should not be construed as the first thread being more important than the second thread.
[0132] The information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the wind energy simulation data involved in this application were all obtained under full authorization.
[0133] In this application, unless otherwise stated, "at least one" means one or more, and "multiple" means two or more. For example, multiple blocks refer to two or more blocks.
[0134] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. When implemented in software, they can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).
[0135] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for acquiring wind energy simulation data, characterized in that, The method includes: The first block number is determined by the first thread. The first block is one or more blocks in the raster dataset that hit the query range. The raster dataset represents wind energy simulation data from around the world. A notification message is generated through the first thread, and the notification message is used to indicate the reading of the wind energy simulation data of the first block; The notification message is sent from the first thread to the second thread; The second thread receives the notification message and, in response to the notification message, reads the wind energy simulation data of the first block into the buffer of the second thread based on the number of the first block. At the same time, the first thread determines the set of cell coordinates within the first block that fall within the query range. The cell represents the wind energy simulation data of a geographical area. The first thread obtains target wind energy simulation data from the buffer of the second thread based on the pixel coordinate set. The target wind energy simulation data includes the wind energy simulation data in the first block that corresponds to the pixel coordinate set.
2. The method according to claim 1, characterized in that, Determining the set of pixel coordinates within the first block that fall within the query range includes: Determine the outer rectangle of the query range; Determine the latitude and longitude coordinates of the first pixel in the circumscribed rectangle; If the latitude and longitude coordinates of the first pixel are within the query range, convert the latitude and longitude coordinates of the first pixel into coordinates in the spatial coordinate system where the wind energy simulation data of the first block is located. Based on the transformed coordinates, determine the coordinates of the first pixel within the first block.
3. The method according to claim 1, characterized in that, After obtaining the target wind energy simulation data from the buffer of the second thread, the method further includes: The status of the wind energy simulation data in the first block is marked as read, and the lifetime of the wind energy simulation data in the first block is decreased according to the set time interval. When the lifetime of the first block is 0, the wind energy simulation data of the first block is deleted from the buffer of the second thread.
4. The method according to claim 3, characterized in that, Before obtaining the target wind energy simulation data from the buffer of the second thread, the method further includes: The status of the wind energy simulation data in the first block is marked as unread, and the lifetime of the wind energy simulation data in the first block is incremented.
5. The method according to claim 1, characterized in that, Before determining the number of the first block through the first thread, the method further includes: The raster dataset is divided into multiple blocks; Each of the plurality of blocks is stored sequentially in the order of the pixels.
6. The method according to claim 1, characterized in that, Before determining the number of the first block through the first thread, the method further includes: The first thread listens for query requests from clients based on sockets, the query requests indicating a query for wind energy simulation data within the query range; After obtaining the target wind energy simulation data from the buffer of the second thread, the method further includes: The first thread sends the target wind energy simulation data to the client via a socket.
7. A device for acquiring wind energy simulation data, characterized in that, The device includes: The determination module is used to determine the number of the first block through the first thread. The first block is one or more blocks in the raster dataset that hit the query range. The raster dataset represents global wind energy simulation data. The sending module is configured to generate a notification message through the first thread, the notification message being used to indicate the reading of wind energy simulation data of the first block; and to send the notification message to the second thread through the first thread. The reading module is used to receive the notification message through the second thread, and the second thread reads the wind energy simulation data of the first block into the buffer of the second thread based on the number of the first block; The determining module is also used to determine, through the first thread, the set of pixel coordinates within the first block that fall within the query range while the reading module reads the wind energy simulation data, wherein the pixel represents the wind energy simulation data of a geographical area; The acquisition module is used to acquire target wind energy simulation data from the buffer of the second thread based on the pixel coordinate set by the first thread. The target wind energy simulation data includes the wind energy simulation data corresponding to the pixel coordinate set in the wind energy simulation data of the first block.
8. The apparatus according to claim 7, characterized in that, The determining module is used to determine the outer rectangle of the query range; determine the latitude and longitude coordinates of the first pixel in the outer rectangle; if the latitude and longitude coordinates of the first pixel are within the query range, convert the latitude and longitude coordinates of the first pixel into coordinates in the spatial coordinate system where the wind energy simulation data of the first block is located; and determine the coordinates of the first pixel in the first block based on the converted coordinates.
9. The apparatus according to claim 7, characterized in that, The device further includes: The marking module is used to mark the status of the wind energy simulation data of the first block as read; The lifespan update module is used to decrease the lifespan of the wind energy simulation data in the first block according to a set time interval. The deletion module is used to delete the wind energy simulation data of the first block from the buffer of the second thread when the lifetime of the first block is 0.
10. The apparatus according to claim 9, characterized in that, The marking module is also used to mark the status of the wind energy simulation data of the first block as unread; The lifetime update module is also used to increment the lifetime of the wind energy simulation data of the first block.
11. The apparatus according to claim 7, characterized in that, The device further includes: The segmentation module is used to divide the raster dataset into multiple segments; A storage module is used to store each of the plurality of blocks sequentially in the order of the pixels.
12. The apparatus according to claim 7, characterized in that, The device further includes: The listening module is used to listen for query requests from clients via the first thread, based on a socket, wherein the query request indicates a query for wind energy simulation data within the query range; The sending module is further configured to send the target wind energy simulation data to the client via the first thread using a socket.
13. A computer device, characterized in that, The computer device includes: a processor coupled to a memory, the memory storing at least one computer program instruction, the at least one computer program instruction being loaded and executed by the processor to enable the computer device to implement the method of any one of claims 1-6.
14. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which, when executed on a computer, causes the computer to perform the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Hardware memory management unit simulation
US20080282056A1