External data file reading method, custom component and related apparatus for rscad

CN122947386APending Publication Date: 2026-10-20ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611127957.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

这种做法割裂了仿真模型的完整性与参数化能力,无法反映风况变化和桨距角动态调节对推力系数的实时影响

Benefits of technology

[0044]本申请提供的RSCAD的外部数据文件读取方法,在RSCAD平台上首次实现了能够直接解析外部CSV数据文件的二维推力系数查表自定义元件,通过二分搜索发与双线性插值算法,在根源上避免了手动数据录入的低效与误差,同时确保了在风况突变或极端工况下推力系数输出的平滑性与数值鲁棒性,有效防止了仿真中断与转矩冲击;此外,该元件以标准CSV文件为数据接口,建模人员仅需更换数据文件即可适配不同风机型号,无需修改模型底层代码,显著提升了风电机组空气动力学建模的效率、精度与可维护性,并具备向其他二维查表仿真场景推广的通用价值。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This application discloses a method for reading external data files in RSCAD, a custom component, and related devices. The method includes: constructing a custom component in RSCAD, declaring floating-point inputs, outputs, external file enable flags, and CSV filenames in the custom component's definition file; placing the external data file in the simulation working directory, opening the corresponding external data file in the simulation working directory using the custom component based on the declared CSV filename, parsing the external data file, extracting the tip speed ratio list, pitch angle list, and two-dimensional thrust coefficient matrix to form a complete lookup table; using the custom component, performing a binary search for precise matching of the currently input tip speed ratio and pitch angle based on the lookup table, if the match is successful, directly outputting the thrust coefficient; if the match fails, performing bilinear interpolation calculation and outputting the interpolated thrust coefficient. This application effectively improves the efficiency and accuracy of aerodynamic modeling of wind turbine units.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of power system real-time simulation, and in particular to an RSCAD external data file reading method, a custom component and a related apparatus. Background Art

[0002] RSCAD (Real-Time Simulator Computer-Aided Design) is a graphical modeling platform supporting the Real-Time Digital Simulator (RTDS), which is widely used in real-time simulation research in the fields of power systems, new energy power generation systems and the like. RSCAD has a built-in rich library of power system and power electronic components, and provides a CBuilder tool that allows users to custom develop new component models using the C language. In the field of wind power system simulation, researchers have carried out modeling and simulation work for types of units such as doubly-fed induction generators (DFIG) and permanent magnet synchronous generators (PMSG) on the RSCAD platform.

[0003] In the aerodynamic modeling of wind turbines, the thrust coefficient (Ct) is a core parameter connecting the aerodynamic characteristics of the wind rotor and the mechanical power output. There is a complex nonlinear relationship between the thrust coefficient Ct, the tip speed ratio λ, and the pitch angle β. Equipment manufacturers usually provide these parameters in the form of a two-dimensional data table — that is, the corresponding thrust coefficients under different combinations of tip speed ratio and pitch angle are presented in a table manner. In simulation modeling, it is necessary to quickly and accurately retrieve or interpolate the corresponding thrust coefficient value from the data table according to the real-time changing inputs of tip speed ratio and pitch angle.

[0004] At present, the standard component library of RSCAD lacks a general-purpose component that can directly read an external two-dimensional data file and perform high-precision two-dimensional interpolation operation. Although RSCAD provides the CBuilder tool to allow users to customize components, the table lookup components in the existing standard library mainly support one-dimensional table lookup or breakpoint linear interpolation, which is difficult to meet the accurate modeling requirement of the two-dimensional nonlinear function of the thrust coefficient. In the actual engineering of aerodynamic modeling of wind turbines, the existing practices mainly include the following types:

[0005] First, the discrete data table provided by the manufacturer is manually converted into an approximate analytical function expression (such as polynomial fitting), which is then implemented by mathematical operation components in the simulation model. This practice has drawbacks such as the fitting accuracy being limited by the function form, high-order polynomials being prone to Runge's phenomenon which leads to interpolation oscillation, and the need for re-fitting when replacing the wind turbine type.

[0006] Secondly, using breakpoint interpolation elements (such as n-dimensional lookup table elements) in the RSCAD standard library, each data point in the discrete data table is manually entered as the breakpoint parameter of the element. When the data table is large (for example, 20 points for tip speed ratio and 15 points for pitch angle, totaling 300 data points), manual input is extremely tedious and error-prone; when the data table is changed, it is necessary to re-enter each point, making maintenance difficult.

[0007] Third, instead of directly implementing thrust coefficient lookup in RSCAD, the approach uses external offline calculation tools to pre-calculate thrust coefficient curves, which are then embedded into the RSCAD model using simplified models or empirical formulas. This approach disrupts the integrity and parameterization capabilities of the simulation model, failing to reflect the real-time impact of wind condition changes and dynamic pitch angle adjustments on the thrust coefficient.

[0008] The common problems with the above approaches are: low modeling efficiency: data entry or function fitting consumes a lot of manual time; poor accuracy: function fitting or simplification introduces additional approximation errors; poor maintainability: when changing the wind turbine model or updating the data table, the entire modeling work needs to be repeated; and inability to fully utilize the original data provided by the manufacturer: manufacturers usually provide accurate discrete data tables in standard formats such as CSV, but the existing RSCAD modeling process lacks a way to directly utilize these original data files. Summary of the Invention

[0009] To address the aforementioned issues, this application provides a method for reading external data files in RSCAD, a custom component, and related devices.

[0010] In view of this, the first aspect of this application provides a method for reading external data files of RSCAD, including:

[0011] In RSCAD, construct a custom component and declare two floating-point inputs, one floating-point output, an external file enable flag, and a CSV filename in the definition file of the custom component.

[0012] Place the external data file to be read into the simulation working directory. The custom component will automatically read the corresponding thrust coefficient in the external data file based on the input tip speed ratio and blade pitch angle, and output it for use by downstream mechanical or electrical models.

[0013] The process by which the custom element automatically reads the corresponding thrust coefficient from the external data file based on the input tip speed ratio and blade pitch angle includes:

[0014] According to the CSV file name stated in the statement, open the corresponding external data file in the simulation working directory, parse the external data file, extract the tip speed ratio list, blade pitch angle list and two-dimensional thrust coefficient matrix to form a complete lookup table;

[0015] The custom element performs a binary search to accurately match the currently input tip speed ratio and pitch angle based on the lookup table. If the match is successful, the thrust coefficient is directly output. If the match fails, bilinear interpolation is performed to calculate and the interpolated thrust coefficient is output.

[0016] Optionally, parsing the external data file includes:

[0017] Read the first line of the external data file as the header, and parse the data in each cell of the header as a pitch angle array;

[0018] Read each row after the header, parse the first cell of each row as the tip speed ratio, parse the remaining cells as the thrust coefficients of each pitch angle under the tip speed ratio, and store them in a two-dimensional matrix to obtain a two-dimensional thrust coefficient matrix.

[0019] Optionally, the bilinear interpolation calculation process is as follows:

[0020] Locate the left and right neighbor indices of the current input value in the tip speed ratio array and the blade pitch angle array, respectively, to obtain four indices;

[0021] Extract the thrust coefficients at the four indexes in the two-dimensional matrix and calculate the normalized distance factor;

[0022] Based on the normalized distance factor and the four extracted thrust coefficients, bilinear interpolation is performed to obtain the interpolated thrust coefficients.

[0023] Optionally, the method further includes:

[0024] If the currently input tip speed ratio exceeds the range of the tip speed ratio array or the currently input pitch angle exceeds the range of the pitch angle array, then the nearest boundary value is used for interpolation to obtain the thrust coefficient or the thrust coefficient boundary value is directly output.

[0025] A second aspect of this application provides a custom component for reading external data files from RSCAD, comprising:

[0026] The parameter and interface module is configured with a tip speed ratio input interface, a pitch angle input interface, a thrust coefficient output interface, as well as external file enable flags and CSV file name configuration parameters.

[0027] The data loading and parsing module is used to automatically parse external data files based on the user-specified CSV file name, extract the tip speed ratio list, blade pitch angle list, and two-dimensional thrust coefficient matrix, and form a complete lookup table.

[0028] The two-dimensional interpolation and calculation module is used to perform a binary search for precise matching of the currently input tip speed ratio and pitch angle based on the lookup table. If the matching is successful, the thrust coefficient is directly output. If the matching fails, bilinear interpolation calculation is performed and the interpolated thrust coefficient is output.

[0029] Optionally, the data loading and parsing module is specifically used for:

[0030] Open the corresponding external data file in the simulation working directory according to the CSV file name specified by the user;

[0031] Read the first line of the external data file as the header, and parse the data in each cell of the header as a pitch angle array;

[0032] Read each row after the header, parse the first cell of each row as the tip speed ratio, parse the remaining cells as the thrust coefficients of each pitch angle under the tip speed ratio, and store them in a two-dimensional matrix to obtain a two-dimensional thrust coefficient matrix.

[0033] Optionally, the two-dimensional interpolation and calculation module is specifically used for:

[0034] Based on the lookup table, a binary search is performed to accurately match the currently input tip speed ratio and pitch angle. If the match is successful, the thrust coefficient is directly output. If the match fails, the left and right neighbor indices of the current input value are located in the tip speed ratio array and the pitch angle array, respectively, to obtain four indices.

[0035] Extract the thrust coefficients at the four indexes in the two-dimensional matrix and calculate the normalized distance factor;

[0036] Based on the normalized distance factor and the four extracted thrust coefficients, bilinear interpolation is performed to obtain the interpolated thrust coefficients.

[0037] Optionally, the two-dimensional interpolation and calculation module is further used for:

[0038] If the currently input tip speed ratio exceeds the range of the tip speed ratio array or the currently input pitch angle exceeds the range of the pitch angle array, then the nearest boundary value is used for interpolation to obtain the thrust coefficient or the thrust coefficient boundary value is directly output.

[0039] A third aspect of this application provides an electronic device, the device including a processor and a memory;

[0040] The memory is used to store program code and transmit the program code to the processor;

[0041] The processor is used to execute any one of the RSCAD external data file reading methods described in the first aspect according to the instructions in the program code.

[0042] A fourth aspect of this application provides a computer-readable storage medium for storing program code that, when executed by a processor, implements the external data file reading method of RSCAD according to any one of the first aspects.

[0043] As can be seen from the above technical solutions, this application has the following advantages:

[0044] The RSCAD external data file reading method provided in this application is the first in the RSCAD platform to implement a custom component for directly parsing external CSV data files for two-dimensional thrust coefficient lookup. By using a binary search and bilinear interpolation algorithm, it fundamentally avoids the inefficiency and errors of manual data entry, while ensuring the smoothness and numerical robustness of thrust coefficient output under sudden wind changes or extreme operating conditions, effectively preventing simulation interruptions and torque shocks. In addition, this component uses a standard CSV file as the data interface, allowing modelers to adapt to different wind turbine models simply by changing the data file, without modifying the underlying model code. This significantly improves the efficiency, accuracy, and maintainability of wind turbine aerodynamic modeling and has universal value for promotion to other two-dimensional lookup simulation scenarios. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 A flowchart illustrating an external data file reading method for RSCAD provided in this application embodiment;

[0047] Figure 2 The interface and parameter configuration diagram of the custom component in RSCAD provided in the embodiments of this application;

[0048] Figure 3 The diagram shows the operation interface and parameter settings of the self-developed module in RSCAD provided in this application embodiment;

[0049] Figure 4 The core algorithm pseudocode for the custom element provided in the embodiments of this application;

[0050] Figure 5 The CT parameter table provided for embodiments of this application;

[0051] Figure 6This is a schematic diagram of a custom element for reading external data files from RSCAD, provided as an embodiment of this application. Detailed Implementation

[0052] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0053] For easier understanding, please refer to Figure 1 This application provides a method for constructing an aerodynamic model of a wind turbine, including:

[0054] Step 1: Construct a custom component in RSCAD, declaring two floating-point inputs, one floating-point output, an external file enable flag, and a CSV filename in the custom component;

[0055] In the RSCAD CCB environment, create a new custom component. In the definition file (.h), declare two floating-point inputs (Inp1, Inp2), one floating-point output (Out_r), and two parameters: `externFile` (integer, set to 1 to enable external files) and `File_n` (string, specifying the CSV filename). The interface and parameter configuration of the custom component in RSCAD are as follows: Figure 2 As shown in the diagram. The upper port is the input port for the tip speed ratio (lambda), the lower port is the input port for the pitch angle (beta), and the output port is the thrust coefficient of the wind turbine under the current input conditions. Please refer to... Figure 3 The provided operation interface and parameter settings include whether to use an external file as the output, where externFile determines whether to use an external file, and fileName is the name of the external file, which is stored under the RSCAD model file.

[0056] The custom components in this application include a parameter and interface module, configured with a tip speed ratio input interface, a pitch angle input interface, a thrust coefficient output interface, and external file enable flags and CSV filename configuration parameters; a data loading and parsing module, used during the simulation initialization phase to automatically parse external data files according to user-specified CSV filenames, extracting the tip speed ratio list, pitch angle list, and two-dimensional thrust coefficient matrix to form a complete lookup table; and a two-dimensional interpolation and calculation module, used during the simulation execution phase to perform precise matching lookups or bilinear interpolation calculations on the currently input tip speed ratio and pitch angle based on the lookup table, outputting the thrust coefficient. The code is written in the implementation file (.c) according to the above module division. The pseudocode of the core algorithm of the custom component is as follows: Figure 4 As shown.

[0057] Step 2: Place the external data file to be read into the simulation working directory. The custom component will automatically read the corresponding thrust coefficient from the external data file based on the input tip speed ratio and blade pitch angle and output it.

[0058] Place the external data file to be read (a standard format CSV file, the manufacturer's original data) into the simulation working directory. The custom component will automatically read the corresponding thrust coefficient from the external data file based on the input tip speed ratio and blade pitch angle. The specific process is as follows:

[0059] S21. According to the declared CSV file name, open the corresponding external data file in the simulation working directory, parse the external data file, extract the tip speed ratio list, blade pitch angle list and two-dimensional thrust coefficient matrix to form a complete lookup table;

[0060] During the simulation initialization phase, the custom component reads the user-specified CSV file and parses its structure: the first row (header) stores all discrete values ​​of the blade pitch angle; the first cell of each subsequent row contains the tip speed ratio, and the remaining cells contain the thrust coefficients for each blade pitch angle at that tip speed ratio. Therefore, the data in each cell of the first row of the CSV file is parsed into a blade pitch angle array; the first cell of each subsequent row is parsed as the tip speed ratio, and the remaining cells contain the thrust coefficients for different blade pitch angles at that tip speed ratio, stored in a two-dimensional matrix to obtain a two-dimensional thrust coefficient matrix; the parsed tip speed ratio array, blade pitch angle array, and two-dimensional thrust coefficient matrix are then stored in an internal array to form a complete two-dimensional lookup table. If the CSV file fails to open or the data format is incorrect, an error message is output and initialization terminates.

[0061] Since CSV files are in plain text format, and the numerical precision provided by the manufacturer may reach 6 to 8 decimal places, using the common atof() or sscanf() functions in the C language standard library to convert text to floating-point numbers has the following inherent drawbacks:

[0062] First, the behavior of standard conversion functions depends on the system's locale, and may result in parsing errors in regions that use commas "," as decimal separators. Second, standard functions may accumulate rounding errors when processing extreme values ​​(such as very large exponents or very long mantissas), especially in small signal regions where the thrust coefficient is close to zero; even a small absolute error can cause the interpolation result to deviate from the physical reality. Third, standard functions lack an active detection mechanism for illegal characters. When non-numeric characters are accidentally mixed into a CSV file, the caller cannot distinguish between conversion failure and a value of zero, leading to the silent propagation of erroneous data.

[0063] To address the aforementioned issues, this application incorporates a dedicated floating-point text converter for CSV data parsing within a custom component. During simulation initialization, it precisely converts the numerical text in the CSV file into double-precision floating-point numbers and stores them in a lookup table. The main advantages of this floating-point text converter are as follows:

[0064] Character-by-character state machine parsing: Strictly follows the decimal floating-point number syntax rules, and identifies the plus or minus sign, integer part, fractional part and scientific notation exponent mark in sequence to eliminate illegal characters from the source.

[0065] Integer scaling accumulation method: The integer and fractional parts are accumulated as integer variables, and a single floating-point division is performed only after parsing. This method completely avoids the multiple rounding errors caused by traditional digit-by-digit floating-point accumulation, ensuring that the significant digits achieve 15-17 digits of complete precision under double-precision conditions.

[0066] Exception handling and self-protection: Returns explicit error codes for empty strings and illegal characters; truncates values ​​that exceed the range of double precision representation and outputs warnings; performs precision self-verification after parsing—reverse-formats the result and compares it with the original text to ensure that the conversion deviation does not exceed the preset threshold.

[0067] In this embodiment, the floating-point text converter is called only once during the initialization phase, which does not affect the real-time calculation speed of each simulation step; at the same time, it fundamentally eliminates the accuracy loss in the text parsing process, ensuring that subsequent bilinear interpolation operations are based on a highly reliable numerical benchmark.

[0068] S22. Based on the lookup table, perform precise matching lookup or bilinear interpolation calculation on the currently input tip speed ratio and pitch angle of the custom element, and output the thrust coefficient.

[0069] At each simulation step, a custom component acquires the current input tip speed ratio and pitch angle. A bisection method is then performed in both the tip speed ratio and pitch angle arrays to find precise matching positions, identifying discrete points that match the current input values. If matching points are found in both dimensions, the corresponding thrust coefficient in the two-dimensional matrix is ​​directly output, ending the calculation for this step. Please refer to [reference needed]. Figure 5 Given lambda=3 and beta=5, the thrust coefficient A=0.0856002 can be obtained by looking up the table.

[0070] If no matching point is found in any dimension, the left and right neighbor indices of the current input value are located in the tip speed ratio array and the pitch angle array, respectively, to obtain 4 indices. The thrust coefficients corresponding to these 4 indices in the two-dimensional matrix are extracted, and the normalized distance factors in the tip speed ratio and pitch angle dimensions are calculated respectively. The bilinear interpolation formula is then executed to obtain the interpolated thrust coefficients.

[0071] If the current input value exceeds the array boundary, interpolation is performed using the nearest boundary value or the boundary value is output directly. For example, if the tip speed ratio λ is out of bounds but the blade pitch angle β is within the array (the processing for blade tip speed ratio λ being within the array but blade pitch angle β being out of bounds is similar), if the current input value λ≤λ min (The minimum tip speed ratio in the tip speed ratio array), lock the tip speed ratio to λ. fixed = λ min If the current input value λ ≥ λ max (The maximum tip speed ratio in the tip speed ratio array) is locked to λ. fixed =λ max Locate the left and right neighbor indices j of the pitch angle β (current input value) in the pitch angle array Beta_Array[]. L and j R Calculate the normalization factor:

[0072] ;

[0073] Extracting two points from the boundary row of a 2D matrix: C_left = Ct_Matrix[boundary row index][j L ], C_right = Ct_Matrix[boundary row index][j R Perform one-dimensional linear interpolation: .

[0074] If λ < λ_min and β < β_min, then directly output the boundary point Ct_out = Ct_Matrix[0][0].

[0075] If λ < λ_min but β is much greater than β_max, then directly output the boundary point Ct_out = Ct_Matrix[0][end].

[0076] The thrust coefficient obtained from the above process is output for use in downstream mechanical or electrical models. Specifically, in the RSCAD main circuit diagram, this custom component is connected to the wind speed model, generator model, and converter model.

[0077] During simulation, the wind speed model outputs the wind speed value v at the current step size; based on the wind speed value v and the rotational speed ω fed back by the generator model, the tip speed ratio λ is calculated; the control system outputs the current pitch angle command β; this custom component receives the tip speed ratio λ and the pitch angle β, and outputs the thrust coefficient Ct through binary search and bilinear interpolation. The aerodynamic torque calculation component calculates the aerodynamic torque Tm based on the thrust coefficient Ct and the wind speed value v; the transmission chain model transmits the aerodynamic torque Tm and converts it into mechanical torque acting on the generator rotor, completing the simulation of the conversion from wind energy to aerodynamic energy to mechanical energy; under the drive of this mechanical torque, the generator model calculates the electrical output on the stator / rotor side in combination with the electrical excitation conditions; the converter model converts the variable frequency AC power output from the generator into power frequency AC power with the same frequency and phase as the grid, and feeds it into the grid.

[0078] This application automatically parses and constructs lookup tables for CSV files in a single simulation initialization phase, allowing modelers to import data simply by specifying the filename. This eliminates the tedious manual entry of hundreds of discrete data points and the risk of human error. In each simulation step, a hierarchical calculation strategy combining binary search and bilinear interpolation is employed—direct output for precise matching (with near-zero computational cost), and interpolation completed with only four floating-point multiplications for matching failures. This ensures smoothness of the thrust coefficient surface and high fitting accuracy while fully meeting the hard real-time constraints of real-time simulation. Standardized output ports enable plug-and-play connection of components to downstream transmission chains and generator models, achieving modularity and reusability of the modeling process. The embodiment in this application uses bilinear interpolation to ensure the fitting accuracy of nonlinear characteristics, and binary search to ensure real-time simulation speed. Modelers do not need to process the manufacturer's original data; they only need to place the standard format CSV file in the specified path, greatly simplifying the modeling process. The overall approach is data-driven at its core. It can be adapted to different wind turbine models simply by changing the external CSV file without modifying the underlying code of the model. This significantly improves the construction efficiency, numerical accuracy, simulation speed and maintainability of the aerodynamic model of the wind turbine, and has methodological value for promotion to other two-dimensional lookup table simulation scenarios.

[0079] Please refer to Figure 6 This application provides a custom component for reading external data files from RSCAD, comprising:

[0080] The parameter and interface module is configured with a tip speed ratio input interface, a pitch angle input interface, a thrust coefficient output interface, as well as external file enable flags and CSV file name configuration parameters.

[0081] The data loading and parsing module is used to automatically parse external data files based on the user-specified CSV file name, extract the tip speed ratio list, blade pitch angle list, and two-dimensional thrust coefficient matrix, and form a complete lookup table.

[0082] The two-dimensional interpolation and calculation module is used to perform a binary search for precise matching of the currently input tip speed ratio and pitch angle based on a lookup table. If the match is successful, the thrust coefficient is directly output. If the match fails, bilinear interpolation calculation is performed and the interpolated thrust coefficient is output.

[0083] As a further improvement, the data loading and parsing module is specifically used for:

[0084] Open the corresponding external data file in the simulation working directory based on the CSV file name specified by the user;

[0085] Read the first line of the external data file as the header, and parse the data in each cell of the header as a pitch angle array;

[0086] Read each row after the header, parse the first cell of each row as the tip speed ratio, parse the remaining cells as the thrust coefficients of each pitch angle under the tip speed ratio, and store them in a two-dimensional matrix to obtain a two-dimensional thrust coefficient matrix.

[0087] As a further improvement, the two-dimensional interpolation and calculation module is specifically used for:

[0088] The blade tip speed ratio and blade pitch angle are precisely matched by a binary search based on a lookup table. If the match is successful, the thrust coefficient is directly output. If the match fails, the left and right neighbor indices of the current input value are located in the blade tip speed ratio array and the blade pitch angle array, respectively, resulting in four indices.

[0089] Extract the thrust coefficients at the four indices in the two-dimensional matrix and calculate the normalized distance factor;

[0090] Bilinear interpolation was performed based on the normalized distance factor and the four extracted thrust coefficients to obtain the interpolated thrust coefficients.

[0091] As a further improvement, the two-dimensional interpolation and calculation module is also used for:

[0092] If the currently input tip speed ratio exceeds the range of the tip speed ratio array or the currently input pitch angle exceeds the range of the pitch angle array, then the nearest boundary value is used for interpolation to obtain the thrust coefficient or the thrust coefficient boundary value is directly output.

[0093] This application's embodiment innovatively addresses the functional gap in the RSCAD platform regarding the lack of dedicated two-dimensional data interpolation components for aerodynamic modeling of wind turbines. Through the systematic integration of three major modules—parameter interface, data loading and parsing, and real-time interpolation calculation—modelers only need to specify the CSV filename to automatically complete the parsing of external data files and the construction of lookup tables. This completely eliminates the tedious operations and accuracy losses caused by traditional manual input of breakpoints or function fitting approximations. Furthermore, by placing time-consuming text parsing in the initialization phase and efficient bilinear interpolation in each simulation step, it fully meets the hard real-time constraints of real-time simulation while ensuring the smoothness of the thrust coefficient surface and high fitting accuracy, achieving an optimal balance between modeling efficiency, numerical accuracy, and calculation speed. In addition, this architecture design gives the components excellent data-driven characteristics and versatility; simply replacing the external data file allows adaptation to different wind turbine models without modifying the underlying code. It can also be extended to other two-dimensional nonlinear characteristic lookup table simulation scenarios, demonstrating significant technological advancement and engineering practical value in the field of wind power generation simulation.

[0094] This application also provides an electronic device, which includes a processor and a memory;

[0095] The memory is used to store program code and transfer the program code to the processor;

[0096] The processor is used to execute the RSCAD external data file reading method in the foregoing method embodiments according to the instructions in the program code.

[0097] This application also provides a computer-readable storage medium for storing program code, which, when executed by a processor, implements the RSCAD external data file reading method in the aforementioned method embodiments.

[0098] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0099] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or apparatus.

[0100] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0101] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0102] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0103] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0104] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for executing all or part of the steps of the methods described in the various embodiments of this application through a computer device (which may be a personal computer, server, or network device, etc.). The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0105] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. 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 spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for reading external data files from RSCAD, characterized in that, include: In RSCAD, construct a custom component and declare two floating-point inputs, one floating-point output, an external file enable flag, and a CSV filename in the definition file of the custom component. Place the external data file to be read into the simulation working directory. The custom component will automatically read the corresponding thrust coefficient in the external data file based on the input tip speed ratio and blade pitch angle, and output it for use by downstream mechanical or electrical models. The process by which the custom element automatically reads the corresponding thrust coefficient from the external data file based on the input tip speed ratio and blade pitch angle includes: According to the CSV file name stated in the statement, open the corresponding external data file in the simulation working directory, parse the external data file, extract the tip speed ratio list, blade pitch angle list and two-dimensional thrust coefficient matrix to form a complete lookup table; The custom element performs a binary search to accurately match the currently input tip speed ratio and pitch angle based on the lookup table. If the match is successful, the thrust coefficient is directly output. If the match fails, bilinear interpolation is performed to calculate and the interpolated thrust coefficient is output.

2. The method for reading external data files of RSCAD according to claim 1, characterized in that, The parsing of the external data file includes: Read the first line of the external data file as the header, and parse the data in each cell of the header as a pitch angle array; Read each row after the header, parse the first cell of each row as the tip speed ratio, parse the remaining cells as the thrust coefficients of each pitch angle under the tip speed ratio, and store them in a two-dimensional matrix to obtain a two-dimensional thrust coefficient matrix.

3. The method for reading external data files of RSCAD according to claim 1, characterized in that, The bilinear interpolation calculation process is as follows: Locate the left and right neighbor indices of the current input value in the tip speed ratio array and the blade pitch angle array, respectively, to obtain four indices; Extract the thrust coefficients at the four indexes in the two-dimensional matrix and calculate the normalized distance factor; Based on the normalized distance factor and the four extracted thrust coefficients, bilinear interpolation is performed to obtain the interpolated thrust coefficients.

4. The method for reading external data files of RSCAD according to claim 3, characterized in that, The method further includes: If the currently input tip speed ratio exceeds the range of the tip speed ratio array or the currently input pitch angle exceeds the range of the pitch angle array, then the nearest boundary value is used for interpolation to obtain the thrust coefficient or the thrust coefficient boundary value is directly output.

5. A custom component for reading external data files from RSCAD, characterized in that, include: The parameter and interface module is configured with a tip speed ratio input interface, a pitch angle input interface, a thrust coefficient output interface, as well as external file enable flags and CSV file name configuration parameters. The data loading and parsing module is used to automatically parse external data files based on the user-specified CSV file name, extract the tip speed ratio list, blade pitch angle list, and two-dimensional thrust coefficient matrix, and form a complete lookup table. The two-dimensional interpolation and calculation module is used to perform a binary search for precise matching of the currently input tip speed ratio and pitch angle based on the lookup table. If the matching is successful, the thrust coefficient is directly output. If the matching fails, bilinear interpolation calculation is performed and the interpolated thrust coefficient is output.

6. The custom element for reading external data files of RSCAD according to claim 5, characterized in that, The data loading and parsing module is specifically used for: Open the corresponding external data file in the simulation working directory according to the CSV file name specified by the user; Read the first line of the external data file as the header, and parse the data in each cell of the header as a pitch angle array; Read each row after the header, parse the first cell of each row as the tip speed ratio, parse the remaining cells as the thrust coefficients of each pitch angle under the tip speed ratio, and store them in a two-dimensional matrix to obtain a two-dimensional thrust coefficient matrix.

7. The custom element for reading external data files of RSCAD according to claim 6, characterized in that, The two-dimensional interpolation and calculation module is specifically used for: Based on the lookup table, a binary search is performed to accurately match the currently input tip speed ratio and pitch angle. If the match is successful, the thrust coefficient is directly output. If the match fails, the left and right neighbor indices of the current input value are located in the tip speed ratio array and the pitch angle array, respectively, to obtain four indices. Extract the thrust coefficients at the four indexes in the two-dimensional matrix and calculate the normalized distance factor; Based on the normalized distance factor and the four extracted thrust coefficients, bilinear interpolation is performed to obtain the interpolated thrust coefficients.

8. The custom element for reading external data files of RSCAD according to claim 5, characterized in that, The two-dimensional interpolation and calculation module is also used for: If the currently input tip speed ratio exceeds the range of the tip speed ratio array or the currently input pitch angle exceeds the range of the pitch angle array, then the nearest boundary value is used for interpolation to obtain the thrust coefficient or the thrust coefficient boundary value is directly output.

9. An electronic device, characterized in that, The device includes a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the RSCAD external data file reading method according to any one of claims 1-4, based on the instructions in the program code.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program code, which, when executed by a processor, implements the RSCAD external data file reading method according to any one of claims 1-4.