Development method and device of ship power system control algorithm
By building a graphical configuration integrated development environment and runtime system in the marine power system, and packaging the commonly used control algorithm model as a functional block, the problems of long development cycles and maintenance difficulties in the existing technology are solved, and the effect of simplifying development and improving efficiency is achieved.
Patent Information
- Application Number
- CN202411852061.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, the development process of the ship power system control algorithm is complex, with a long development cycle, slow iteration speed, difficult maintenance, and low code reuse rate.
By building an integrated development environment and runtime system based on graphical configuration and building a custom functional block selection library, the commonly used control algorithm model is encapsulated into functional blocks, simplifying the algorithm development process.
The development process of the ship's power system control algorithm is simplified, the development time and workload is reduced, the development difficulty is reduced, the development efficiency is improved, and the reusable and customizable functional blocks are provided.
Smart Images

Figure CN119781740A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of ship control technology, and in particular to a method and device for developing a ship power system control algorithm. Background Art
[0002] In ship control, the development process of traditional controller software is quite complicated. In addition to high requirements for software coding ability of professionals, it also requires a certain depth of understanding of the control system, the equipment, modules and communication protocols used in the system. Therefore, software development requires high quality of personnel, and the software development cycle is long, the iteration speed is slow, maintenance is difficult, and the code reuse rate is low. In view of the above problems, it is necessary to encapsulate and optimize the integration of algorithm function blocks commonly used in ship control. Summary of the invention
[0003] Purpose of the invention: An embodiment of the present application provides a method for developing a ship power system control algorithm, aiming to overcome the technical problems of long development cycle, slow iteration speed, difficult maintenance, and low code reuse rate in the implementation of ship power system control algorithms in the prior art; another purpose of an embodiment of the present application is to provide a device for developing a ship power system control algorithm.
[0004] Technical solution: A method for developing a control algorithm for a ship power system described in an embodiment of the present application is applied to a ship power system, and the method includes:
[0005] Building a graphical configuration-based integrated development environment and a runtime system, and constructing a custom function block selection library in the graphical configuration-based integrated development environment;
[0006] Analyze the commonly used control algorithm models in the ship power system to obtain the first programming language corresponding to each commonly used control algorithm model;
[0007] Encapsulate the first programming language corresponding to each commonly used control algorithm model into a corresponding function block;
[0008] and adding each function block to the custom function block selection library;
[0009] Configuring the operating system, driver and hardware interface based on the graphical configuration integrated development environment;
[0010] Determining a target control device in the ship power system;
[0011] And in the graphical configuration-based integrated development environment, selecting a business function block corresponding to the control algorithm model of the target control device from the custom function block selection library, and / or custom-generating a business function block corresponding to the control algorithm model of the target control device based on the basic function blocks and / or business function blocks in the custom function block selection library;
[0012] The business function block corresponding to the control algorithm model of the target control device is run in the runtime system.
[0013] In some embodiments, encapsulating the first programming language corresponding to each commonly used control algorithm model into a corresponding function block includes:
[0014] Converting the first programming language corresponding to each commonly used control algorithm model into the second programming language corresponding to each commonly used control algorithm model;
[0015] The second programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding function block.
[0016] In some embodiments, the second programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding function block, including:
[0017] Construct function prototypes corresponding to various commonly used control algorithm models;
[0018] According to the configuration requirements corresponding to each commonly used control algorithm model, the configuration information of the function corresponding to each commonly used control algorithm model is written into the configuration file, and the configuration file is generated into the corresponding text through the corresponding script;
[0019] The corresponding text is copied to the management file of the custom function block, and the code of the corresponding function block is added to the code file.
[0020] In some embodiments, the configuration information includes at least: variables, types, and addresses.
[0021] In some embodiments, the first programming language is C language, and the second programming language is ST language.
[0022] In some embodiments, the commonly used control algorithm models in the ship power system include at least: a diesel engine speed control algorithm model, a motor speed control algorithm model, a maneuvering propulsion speed control algorithm model, a reversing speed control algorithm model, a PID speed control algorithm model, a cab / control room vehicle command control algorithm model, a adjustable pitch propeller control algorithm model, an automatic increase and decrease machine control algorithm model, and a security control algorithm model.
[0023] In some embodiments, the graphical configuration-based integrated development environment includes basic environment, device configuration, variable configuration, logic configuration, task configuration, downloading, debugging and algorithm library.
[0024] In some embodiments, the hardware interface based on the graphical configuration integrated development environment includes: an I / O data communication interface, a communication interface with the graphical configuration integrated development environment, a communication interface with a human-machine interface, and an inter-station communication interface.
[0025] In some embodiments, the basic function blocks include: value conversion function block, positive and negative value conversion function block, analog error value calculation function block, count retention function block, CRC check function block, and check function block, database access function block, bitwise read function block, bitwise write function block, high and low value acquisition function block, CAN message reading function block, CAN message output function block, UDP message reading function block, UDP message output function block, RS485 message reading function block, RS485 message output function block, TCP message reading function block, TCP message output function block, IO acquisition function block and IO output function block.
[0026] In some embodiments, the business function blocks include: an imbalance calculation function block, a current overload judgment function block, an equipment power supply status function block, a DE speed regulation function block, a position conversion function block, a pitch regulating function block, a load balancing function block, an increase and decrease machine control function block, a security control function block and a PID function block.
[0027] In some embodiments, the runtime system is provided with logic operations, I / O data communication, communication with SDMPC, communication with human-machine interface, data redundancy and synchronization, self-test and diagnosis, inter-station communication and IC functions.
[0028] Accordingly, a device for developing a control algorithm for a ship power system according to an embodiment of the present application is applied to a ship power system, and the device includes:
[0029] Building modules for building graphical configuration-based integrated development environment and runtime system;
[0030] A library construction module, used for constructing a custom function block selection library in the graphical configuration-based integrated development environment;
[0031] An analysis module, used for analyzing commonly used control algorithm models in the ship power system to obtain a first programming language corresponding to each commonly used control algorithm model;
[0032] A packaging module, used for packaging the first programming language corresponding to each commonly used control algorithm model into a corresponding function block;
[0033] An adding module, used for adding each function block to the custom function block selection library;
[0034] A configuration module, used to configure the operating system, driver and hardware interface based on the graphical configuration integrated development environment;
[0035] A determination module, used to determine a target control device in the ship power system;
[0036] A business function block generation module, used to select, in the graphical configuration-based integrated development environment, a business function block corresponding to the control algorithm model of the target control device from the custom function block selection library, and / or to custom generate a business function block corresponding to the control algorithm model of the target control device based on basic function blocks and / or business function blocks in the custom function block selection library;
[0037] The running module is used to run the business function block corresponding to the control algorithm model of the target control device in the runtime system.
[0038] Beneficial effect: Compared with the prior art, the development method and device of the ship power system control algorithm of the embodiment of the present application, the development method of the ship power system control algorithm includes: building an integrated development environment and a runtime system based on a graphical configuration, and building a custom function block selection library in the integrated development environment based on a graphical configuration; analyzing the commonly used control algorithm models in the ship power system to obtain the first programming language corresponding to each commonly used control algorithm model; encapsulating the first programming language corresponding to each commonly used control algorithm model into a corresponding function block; and adding each function block to the custom function block selection library; configuring the operating system, driver and hardware interface based on the graphical configuration integrated development environment; determining the target control device in the ship power system; and in the integrated development environment based on the graphical configuration, selecting the business function block corresponding to the control algorithm model of the target control device from the custom function block selection library, and / or, customizing the business function block corresponding to the control algorithm model of the target control device according to the basic function blocks and / or business function blocks in the custom function block selection library; running the business function block corresponding to the control algorithm model of the target control device in the runtime system. It can be seen that this method encapsulates the commonly used control algorithm models in the ship power system into functional blocks by constructing a graphical configuration integrated development environment, which facilitates the design of control algorithms for various control devices in the ship power system through graphics without writing complex codes, simplifies the algorithm development process, reduces development time and workload, reduces development difficulty, improves development efficiency, and provides reusable and customizable functional blocks, thereby improving reusability and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 is a flow chart of a method for developing a ship power system control algorithm provided in an embodiment of the present application;
[0041] Figure 2 It is a principle structure block diagram of a runtime system provided in an embodiment of the present application;
[0042] Figure 3 It is a schematic diagram of an interface based on a graphical configuration integrated development environment provided in an embodiment of the present application;
[0043] Figure 4 It is a schematic diagram of a program editing window provided in an embodiment of the present application;
[0044] Figure 5 It is a flow chart of the external interface of the custom function block provided in the embodiment of the present application;
[0045] Figure 6 It is a functional module diagram based on a graphical configuration integrated development environment provided in an embodiment of the present application;
[0046] Figure 7 It is a functional composition diagram of a runtime system provided in an embodiment of the present application;
[0047] Figure 8 is a schematic diagram of the module relationship of a runtime system provided in an embodiment of the present application;
[0048] Fig. 9 is a schematic diagram of a diesel engine speed control function block provided in an embodiment of the present application;
[0049] Fig.10 It is a principle structural block diagram of a device for developing a ship power system control algorithm provided in an embodiment of the present application.
[0050] Reference numerals:
[0051] 10-Building module; 20-Library building module; 30-Analysis module; 40-Packaging module; 50-Adding module; 60-Configuration module; 70-Confirmation module; 80-Business function block generation module; 90-Running module; 100-Development device for ship power system control algorithm; 1-Menu bar and toolbar; 2-Project browser; 3-Classification library directory; 4-Main editing window; 5-Output window. DETAILED DESCRIPTION
[0052] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0053] It should be understood that although the terms first, second, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.
[0054] Those skilled in the art will appreciate that the drawings are only schematic diagrams of example embodiments and may not be to scale. The modules or processes in the drawings are not necessarily required to implement the present application and therefore cannot be used to limit the scope of protection of the present application.
[0055] Figure 1 This is a flow chart of a method for developing a control algorithm for a ship power system provided in an embodiment of the present application. The method can be applied to a process of graphically developing algorithms for various control devices in a ship power system. The method can be executed by a device for developing a control algorithm for a ship power system, which can be implemented by software and / or hardware, and which can be configured in a processor or controller of a ship power system. Figure 1 , the method comprises the following steps:
[0056] Step 110: Building a graphical configuration-based integrated development environment and a runtime system, and building a custom function block selection library in the graphical configuration-based integrated development environment.
[0057] Figure 2 1 is a schematic diagram of a runtime system provided in an embodiment of the present application. The runtime system is a bridge between the user program and the operating system. Figure 2 The main functions of the runtime system include external communication, task management, memory management, and firmware function block implementation. When the runtime system is running, it will first read the configuration information, including the configuration of the runtime main program and the device configuration file, and then load the user program. At the same time, it obtains the internal information of the user program through the corresponding interface, completes the interaction between the user program and the device, and monitors the user program variables through the corresponding interface, which is convenient for users to monitor the changes of internal variables of the program during debugging.
[0058] Among them, the graphical configuration integrated development environment is a self-developed graphical configuration integrated development environment (Software Development for Multi-Parameter Control basedon Graphic Configuration, SDMPC) that complies with the IEC61131-3 standard.
[0059] Among them, the graphical configuration integrated development environment (IDE) is located at the development layer. The related design of IDE programming development tools includes the architecture and design of IEC61131-3 standard compiler, the selection of editor language, the functional design of debugger, downloader and simulator, monitor, and the corresponding interface design of project management. The specific functions are shown in Table 1.
[0060] Table 1 Modules and functions of IDE programming development tools
[0061]
[0062]
[0063] Among them, based on the software-defined SDMPC integrated development environment, the control algorithm of the automation control system is compiled and downloaded, and the generated logical tasks are run in the target hardware to achieve closed-loop control of field equipment. While having task configuration and equipment configuration, it should also have online debugging and simulation functions. The graphical configuration development environment provides graphical programming and supports MIPS, X86, and ARM three architectures (including multiple series under each architecture) hardware.
[0064] Figure 3 Schematic diagram of the interface of the graphical configuration integrated development environment provided in the embodiment of the present application. Figure 3 The interface of the graphical configuration integrated development environment mainly includes five parts, namely: menu bar and toolbar (Menu&ToolBar) 1, project browser (Project) 2, catalog library directory (Catalog) 3, main editing window (Editor) 4 and output window (Output) 5. Among them, the project browser is used to display the currently created project file. The catalog library directory is used to display the available system built-in libraries, function blocks, etc. The main editing window is the user program editing window. The output window is used to display system output information.
[0065] Among them, the graphical configuration integrated development environment supports BZH hardware communication configuration and integrated automation hardware configuration. BZH hardware communication and integrated automation hardware configuration general hardware IO acquisition and protocol implementation configuration.
[0066] Among them, BZH hardware communication configuration and integrated automation hardware configuration are all independently developed hardware, and most projects will use these types of hardware, and the software runs on these hardware. The operating systems adapted to these hardware may be different, and the runtime system adapts to different hardware operating systems and drivers. The developed IDE environment unifies the programming environment under different operating systems.
[0067] In the equipment configuration function module, you can configure BZH hardware communication configuration (including HT1409, HT1408, HT1407, HT1406, HT140D, HT140C, HT140B, HT140A), as well as comprehensive automation hardware configuration (including thermocouple ZHTHC, thermal resistor ZHRTD, IO ZHIOALL). In the configuration process, the hardware configuration and measurement point configuration are realized by inserting, dragging and other code-free methods. Therefore, it can provide a variety of hardware types for the development of ship power system control algorithms, provide more choices, and thus facilitate algorithm development.
[0068] Among them, the runtime system provides a runtime environment for the controller to execute control strategies. It is an integrated operation platform that integrates algorithm scheduling, operation, I / O data communication, and communication.
[0069] Among them, the custom function block selection library is a custom algorithm library of the graphical configuration integrated development environment IDE, which is used to provide function blocks for the control algorithm design of various control devices in the ship power system, so as to form a graphical control algorithm, thereby simplifying the algorithm opening process and reducing the difficulty of algorithm development.
[0070] Step 120: Analyze the commonly used control algorithm models in the ship power system to obtain the first programming language corresponding to each commonly used control algorithm model.
[0071] Among them, the specific implementation method for analyzing the commonly used control algorithm model in the ship power system can be: based on specific business needs, draw a corresponding control flow chart. For example, for diesel engine speed regulation, a diesel engine speed regulation control flow chart can be drawn according to the specific speed regulation parameters of the diesel engine.
[0072] The first programming language may be C language or the like, and may be set according to actual conditions, and is not specifically limited here.
[0073] In some embodiments, commonly used control algorithm models in ship power systems include at least: diesel engine speed control algorithm model, motor speed control algorithm model, maneuvering propulsion speed control algorithm model, reversing speed control algorithm model, PID speed control algorithm model, cab / control room vehicle command control algorithm model, adjustable pitch propeller control algorithm model, automatic increase and decrease machine control algorithm model, and security control algorithm model.
[0074] Step 130: Encapsulate the first programming language corresponding to each commonly used control algorithm model into a corresponding function block.
[0075] Among them, the first programming language corresponding to the commonly used control algorithm model can be obtained from the programming language corresponding to the existing commonly used control algorithm model. For example, the C code corresponding to the existing or commonly used diesel engine speed control algorithm model in the field is obtained. Specifically, by analyzing the commonly used control algorithm model, the high-level language is encapsulated into a function block, which is run on the underlying operating system, and then the function block is called to execute the function block in a jump manner, so as to realize direct system development through a graphical integrated development environment, and docking test verification on the runtime system.
[0076] Step 140: Add each function block to the custom function block selection library.
[0077] Exemplarily, taking the motor speed control algorithm model as an example, by analyzing the motor speed control algorithm models commonly used in ship power systems, the programming language corresponding to the motor speed control algorithm model edited by the first programming language is encapsulated into corresponding function blocks, and the encapsulated function blocks are stored or added to a custom function block selection library to provide selectable business function blocks and / or basic function blocks for the subsequent graphical design of the control algorithm for controlling the device in a graphical configuration-based integrated development environment.
[0078] Step 150: Configure the operating system, driver and hardware interface based on the graphical configuration integrated development environment.
[0079] Among them, the integrated control module (HT-2304) is installed in the fieldbus 3U cage and is used for various ship power system propulsion control projects. The driver is used to open the interface between the application program and the integrated control module (HT-2304), including AI, AO, DI, DO, PI, CAN, serial port and other interfaces.
[0080] Deploy the bsp.bin file to the board, upload the io.ko kernel module to the board / lib / modules / directory, and install the kernel module using the insmod command. After successful installation, AI, AO, DI, DO, PI, CAN, serial port and other interfaces can be deployed.
[0081] Among them, the operating system based on the graphical configuration integrated development environment is the logic configuration host system SDMPC. Among them, the logic configuration host system SDMPC describes the control algorithm of the field process. After compilation and downloading, the generated logic tasks run in the runtime system to realize the closed-loop control of the field equipment, such as step control, diesel engine speed regulation, etc.
[0082] The hardware is also equipped with a secondary development interface. The secondary development interface includes the configuration of local hardware and remote IO. After configuration, a special XML file is generated and downloaded to the controller. The configuration file includes the number of hardware resources, feature preprocessing and other information. The generated XML can be imported into the development environment and automatically parsed. When the controller is running, the system completes the driving of the hardware module and data reading according to the configuration information.
[0083] In some embodiments, the hardware interface based on the graphical configuration integrated development environment includes: an I / O data communication interface, a communication interface with the graphical configuration integrated development environment, a communication interface with a human-machine interface, and an inter-station communication interface.
[0084] The human-machine interface (HMI) communication interface is used to realize data or file transmission between the controller and the HMI. The inter-station communication interface is used to realize data communication between controller nodes.
[0085] Step 160: Determine the target control device in the ship power system.
[0086] The target control device is a control device in the ship power system that needs to be designed with a control algorithm. For example, assuming that a pitch control algorithm needs to be designed for a pitch control propeller in the current ship power system, the target control device is the pitch control propeller.
[0087] Step 170: In a graphical configuration-based integrated development environment, select a business function block corresponding to the control algorithm model of the target control device from a custom function block selection library, and / or custom-generate a business function block corresponding to the control algorithm model of the target control device based on the basic function blocks and / or business function blocks in the custom function block selection library.
[0088] Among them, the basic function blocks are function blocks corresponding to basic mathematical operations, data reading, data output, etc. The business function blocks are function blocks corresponding to the control algorithms of commonly used control devices in ship power systems.
[0089] Specifically, after determining the target control device in the ship power system, select or generate the business function block corresponding to the target control device in the graphical configuration integrated development environment. The specific implementation process is: if the business function block required by the target control device exists in the custom function block selection library, directly select the corresponding business function block from the custom function block selection library, and the graphical control algorithm based on the target control device can be directly obtained. If the business function block required by the target control device does not exist in the custom function block selection library, the business function block required by the target control device is customized and generated according to the basic function blocks and / or business function blocks in the custom function block selection library, that is, the graphical control algorithm design of the target control device is realized. Thus, the design of the control algorithm of each control device in the ship power system is realized by graphics without writing complex codes, thereby simplifying the algorithm development process, reducing development time and workload, reducing development difficulty, improving development efficiency, and providing reusable and customizable function blocks, thereby improving reusability and flexibility.
[0090] Step 180: Run the business function block corresponding to the control algorithm model of the target control device in the runtime system.
[0091] Exemplarily, the target control device is assumed to be a diesel engine, and it is assumed that a speed control algorithm needs to be designed for the diesel engine. Since the diesel engine speed control algorithm is a commonly used control algorithm model in the ship power system, in the process of developing the ship power system control algorithm, the first programming language corresponding to the diesel engine speed control algorithm model is encapsulated into a corresponding diesel engine speed control function block, and added to the custom function block selection library. Therefore, when it is necessary to design a speed control algorithm for the diesel engine, it is only necessary to select the corresponding diesel engine speed control function block through the custom function block selection library to directly obtain a graphical diesel engine speed control algorithm control model without the need for complex code editing, which can reduce the difficulty of control algorithm development, simplify the development process, reduce the development workload, and improve the efficiency of control algorithm development. In addition, by providing reusable function blocks, the reusability of the algorithm design can be improved, thereby simplifying the development difficulty and improving the development efficiency.
[0092] It should be noted that if the control algorithm design for uncommon control devices in the ship power system is required, for example, new equipment or improved equipment in the ship power system, although there is no corresponding business function block in the custom function block selection library, the business function block corresponding to the control algorithm of the new or improved equipment can be customized and generated by using the basic function blocks and / or other business function blocks involved in the custom function block selection library (for example, if the PID control algorithm is required in the control of the new or improved equipment, the function block corresponding to the PID control algorithm in the custom function block selection library can be directly selected). Thus, by using the basic function blocks and / or other business function blocks in the custom function block selection library, the graphical control algorithm design for the new or improved equipment can be realized without complicated code editing, which can reduce the difficulty of control algorithm development, simplify the development process, reduce the development workload, and improve the efficiency of control algorithm development. And by providing customizable function blocks, the flexibility of algorithm design can be improved.
[0093] In the technical solution of the embodiment of the present application, the working principle of the method for developing the ship power system control algorithm is as follows: Figure 1 First, build an integrated development environment and runtime system based on graphical configuration, and build a custom function block selection library in the integrated development environment based on graphical configuration. Then, analyze the commonly used control algorithm models in the ship power system to obtain the first programming language corresponding to each commonly used control algorithm model. Secondly, encapsulate the first programming language corresponding to each commonly used control algorithm model into a corresponding function block. And add each function block to the custom function block selection library. Secondly, configure the operating system, driver and hardware interface based on the graphical configuration integrated development environment. Determine the target control device in the ship power system. And in the integrated development environment based on graphical configuration, select the business function block corresponding to the control algorithm model of the target control device from the custom function block selection library, and / or, customize the business function block corresponding to the control algorithm model of the target control device according to the basic function blocks and / or business function blocks in the custom function block selection library. Finally, run the business function block corresponding to the control algorithm model of the target control device in the runtime system. It can be seen that this method encapsulates the commonly used control algorithm models in the ship power system into functional blocks by constructing a graphical configuration integrated development environment, which facilitates the design of control algorithms for various control devices in the ship power system through graphics without writing complex codes, simplifies the algorithm development process, reduces development time and workload, reduces development difficulty, improves development efficiency, and provides reusable and customizable functional blocks, thereby improving reusability and flexibility.
[0094] In some embodiments, the first programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding functional block, including: converting the first programming language corresponding to each commonly used control algorithm model into a second programming language corresponding to each commonly used control algorithm model; encapsulating the second programming language corresponding to each commonly used control algorithm model into a corresponding functional block.
[0095] The first programming language is C language, and the second programming language is ST language.
[0096] For example, taking the PID function block as an example, it is a C language code before conversion, and after conversion, it can be directly dragged and used, with clear input and output, which improves programming efficiency. For example, taking the DE speed control (diesel engine speed control module) as an example, the establishment process of the SDMPC function block is explained in detail as follows:
[0097] The first step is to build a prototype.
[0098] Add function prototypes to C:\ProgramData\infoteam\OPENMPC\Openpcs.520\MODULES\SMARTVxW orks\GLOBPORT.INC;
[0099] like:
[0100] GLOBAL_PROTOTYP_BEGIN
[0101] FUNCTION_BLOCK FB_AUTOAJUST_DE function block name;
[0102] VAR_INPUT function block input;
[0103] INPUT_ENGINEORDER:REAL; Target command speed for propulsion DE;
[0104] IINPUT_STEP:REAL; Advance DE hot engine cold engine emergency step length;
[0105] INPUT_THRUSTMODE L:INT;Thrust mode fault;
[0106] END_VAR
[0107] VAR_OUTPUT function block output;
[0108] OUTPUT_DE_SPEED:REAL; output speed command;
[0109] END_VAR
[0110] END_FUNCTION_BLOCK
[0111] GLOBAL_PROTOTYP_END.
[0112] The second step is to establish the corresponding framework in SDMPC.
[0113] Specifically, create an empty project in SDMPC, create a new POU in it, select functionblock as the type, select ST as the IEC language, and write the variable declarations such as INPUT, OUTPUT, etc. corresponding to the function block.
[0114] VAR_INPUT
[0115] INPUT_ENGINEORDER propels the target command speed of DE;
[0116] INPUT_STEP promotes DE hot engine cold engine emergency step length;
[0117] INPUT_THRUSTMODE propulsion mode fault, if the fault is 1, the speed can be reduced but not increased;
[0118] END_VAR
[0119] VAR_OUTPUT
[0120] OUTPUT_DE_SPEED output speed command deceleration defaults to twice the acceleration rate;
[0121] END_VAR.
[0122] The third step is to run makeFbs.bat.
[0123] Specifically, copy makeFbs.bat in the project directory (C:\SDMPCworks in this example).
[0124] Create a .bat file with the following content:
[0125] pause
[0126] cd\
[0127] c:
[0128] cd C:\Program Files(x86)\infoteam\OpenMPC\(OpenMPC installation path)
[0129] ITMake.exe-Y C:\SDMPCworks\TestMyFB\TestMyFB.VAR (add the path of the project created in the previous step here).
[0130] pause
[0131] After executing the .bat file, a .ids file will appear in $GEN$\SIM1 under the created project folder (C:\SDMPCworks\TestMyFB\$GEN$), which contains the property values corresponding to the newly created function block. Step 4: Add the description of the function properties to SMARTVxWorks.ini. Specifically, add the description of the function properties in C:\ProgramData\infoteam\OPENMPC\Openpcs.520\MODULES\SMARTVxWorks.ini (the function block is created based on VxWorks, so select the corresponding ini).
[0132] First, add function attribute description and initialization data.
[0133] Second, enter the function setting declaration (SMARTVxWorks.ini).
[0134] Step 5: Add the function body Oemfb.c to smartplc and modify it. Specifically, add the real function to smartplc and the corresponding runtime path
[0135] C:\LambdaPRO\workspace\DetalOSRuntime\src\SmartPLC\platform.
[0136] For example, add a function in Oemfb.c. The following four variables correspond to the input and output of the function block, which can be obtained from the ids file generated in the third step.
[0137] #define FB_AUTOAJUST_DE_INPUT_ENGINEORDER 0x0c
[0138] #define FB_AUTOAJUST_DE_INPUT_STEP 0x10
[0139] #define FB_AUTOAJUST_DE_INPUT_THRUSTMODE 0x14
[0140] #define FB_AUTOAJUST_DE_OUTPUT_DE_SPEED S 0x08
[0141] And add function description in Oem_fb.h.
[0142] Step 6: Local modification.
[0143] Figure 4 Schematic diagram of a program editing window provided in the embodiment of the present application. Specifically, in the project, select File\New\POU, select Function Block as the POU type, select ST as the language, and in the program editing window (such as Figure 4 ) to implement the desired function, and the function block can be called in the new file.
[0144] In some embodiments, the second programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding functional block, including: constructing a function prototype corresponding to each commonly used control algorithm model; writing the configuration information of the function corresponding to each commonly used control algorithm model into a configuration file according to the configuration requirements corresponding to each commonly used control algorithm model, and generating a corresponding text from the configuration file through a corresponding script; copying the corresponding text into the management file of the custom function block, and adding the code of the corresponding function block to the code file.
[0145] For example, a custom function block is developed based on daily business scenarios in the ship power system to achieve the corresponding requirements. When designing and using the function block, it is necessary to manually build the function prototype corresponding to each commonly used control algorithm model, and write the configuration file for the variables, types, addresses and other information in the function according to the needs of each commonly used control algorithm model. Generate the corresponding text through the corresponding script, and copy the generated text to the management file of the custom function block, and then add the code of the corresponding function block to the code file Oemfb.c to complete the function implementation of the custom function block.
[0146] Figure 5 This is a flow chart of the external interface of the custom function block provided in the embodiment of the present application. Among them, the interface between the custom function block and the IDE is in the form of a function block configuration file, and the interface with the runtime system is a code file. For the specific process, please refer to Figure 5 .
[0147] In some embodiments, the configuration information includes at least: a variable, a type, and an address.
[0148] In addition, the configuration information may also include other configuration information, such as parameter configuration, return value setting, etc., which may be set according to actual conditions and are not specifically limited here.
[0149] Figure 6 is a functional module diagram based on a graphical configuration integrated development environment provided in an embodiment of the present application. Figure 6 The graphical configuration integrated development environment includes basic environment, device configuration, variable configuration, logic configuration, task configuration, downloading, debugging and algorithm library.
[0150] Among them, the basic environment is the Integrated Development Environment (IDE).
[0151] For detailed description and specific uses of IDE environment, device configuration, variable configuration, logic configuration, task configuration, downloading, debugging and algorithm library, please refer to Table 2.
[0152] Table 2 Functional composition of SDMPC software
[0153]
[0154]
[0155] In some embodiments, the basic function blocks include: value conversion function block, positive and negative value conversion function block, analog error value calculation function block, count retention function block, CRC check function block, and check function block, database access function block, bit-by-bit read function block, bit-by-bit write function block, high and low value acquisition function block, CAN message reading function block, CAN message output function block, UDP message reading function block, UDP message output function block, RS485 message reading function block, RS485 message output function block, TCP message reading function block, TCP message output function block, IO acquisition function block and IO output function block.
[0156] For the specific functions of each basic functional block, please refer to Table 3.
[0157] Table 3 Basic functional blocks
[0158]
[0159]
[0160]
[0161] In some embodiments, the business function blocks include: imbalance calculation function block, current overload judgment function block, equipment power supply status function block, DE speed regulation function block, position conversion function block, pitch regulating function block, load balancing function block, increase and decrease machine control function block, security control function block and PID function block.
[0162] Exemplarily, the business function blocks of commonly used control devices in the ship power system include the unbalance calculation function block, the current overload judgment function block, the equipment power supply status function block, the DE speed regulation function block, the position conversion function block, the pitch control function block, the load balancing function block, the increase and decrease machine control function block, the security control function block and the PID function block. In addition, according to the actual situation, such as when the ship power system or the new equipment or the improved equipment is added, the business function blocks corresponding to the new equipment or the improved equipment can be customized through the basic function blocks and / or other business function blocks in the custom function block selection library, and the business function blocks corresponding to the new equipment or the improved equipment are added to the custom function block selection library.
[0163] For example, please refer to Table 4 for the specific implementation functions of the business function blocks of the commonly used control devices in the ship power system.
[0164] Table 4 Business function blocks
[0165]
[0166]
[0167] Figure 7 is a functional composition diagram of a runtime system provided in an embodiment of the present application. Figure 7 ,When running the system is set up with logical operations, I / O data communication, communication with SDMPC, communication with the human-machine interface, data redundancy and synchronization, self-test and diagnosis, inter-station communication and IC functions.
[0168] For the specific uses and descriptions of logical operations, I / O data communication, communication with SDMPC, communication with human-machine interface, data redundancy and synchronization, self-test and diagnosis, inter-station communication, and IC functions, please refer to Table 5.
[0169] Table 5 Functional composition of the runtime system
[0170]
[0171] Figure 8 is a schematic diagram of the module relationship of a runtime system provided in an embodiment of the present application. For example, please refer to Figure 8 The runtime system acts as an intermediate medium between the user and the operating system, provides corresponding communication interfaces to exchange information with the host computer, manages the use of various types of information through variable tables, segment structure design, task management, and I / O driver management, and isolates hardware differences through software definition, so that user code can be applied across platforms and unify executable programs under different processor platforms and operating systems.
[0172] Among them, the communication module is mainly used for the runtime system to interact with other external systems, such as the host computer, external monitor and other applications. Through the communication module, the runtime system can obtain the configuration data and user operation instructions required during use, and at the same time pass information such as changes in variable values in the program to the user. Based on this, it can complete functions such as external communication, program redundancy, version checking, and data management.
[0173] When the runtime system has completed parsing the data obtained from the communication module, it needs to adapt according to the current operating system and hardware type. According to the host computer configuration information, the IEC task is allocated and scheduled, and the corresponding hardware driver is used according to the current situation, and the corresponding firmware function block is loaded at the same time.
[0174] Among them, the IEC tasks are mainly divided into three parts: the first part is mainly the tasks of interacting with the host computer: downloading and uploading user projects, controlling the interpreter. The second part is mainly the core operation tasks: code interpreter execution. The third part is mainly the underlying application part: accessing memory, process data, network, segment management, setting variables, and providing resources for interpreter execution.
[0175] The runtime system selects the driver components that match the corresponding hardware through I / O driver component management based on the current information, maps them to the underlying hardware system, and initializes various components.
[0176] The function blocks provided in the embodiments of the present application can realize the reuse of modules between multiple programs and multiple engineering resources, so a module dictionary of ship types is established, the control algorithm of typical operation scenarios is studied, a control device model (motor, gas engine, diesel engine, etc.) is established, and the algorithm function blocks (maneuvering propulsion speed regulation, reversing speed regulation, PID speed regulation, security module, etc.) are developed simultaneously. The firmware function blocks in the function blocks are used for downloading the middleware of each platform and the corresponding operating system. When used, the firmware function blocks suitable for the target hardware are selected and downloaded to the runtime system. Therefore, the embodiments of the present application can achieve: it can solve the development, testing, and maintenance difficulties caused by different hardware platforms and operating systems, unify the controller software integrated development environment under different platforms, and complete the development of ship power system control software on different platforms. Carry out technical research on custom algorithm libraries, integrate the control logic related to diesel engine power system control commonly used in business into custom algorithm libraries, simplify the development process, and enable engineers to focus on technical innovation in this profession and produce high value-added business content.
[0177] Based on the above advantages, we developed a set of graphical configuration integrated development environment software and a cross-platform runtime system software custom algorithm library, and built a 3000KW unit control device to verify the function, performance and development process of the technical research results, laying a good foundation for the technological breakthroughs and product upgrades of ship propulsion systems, especially diesel engine control.
[0178] Fig. 9 Schematic diagram of a diesel engine speed control function block provided in an embodiment of the present application. Fig. 9 Taking the 3000KW unit control device in the ship power system as an example, the logic used in the business includes: cab / central control room vehicle command, pitch control, automatic increase and decrease, security control, diesel engine speed adjustment, etc. Taking diesel engine speed regulation as an example, the transplantation process of the business algorithm block corresponding to diesel engine speed regulation is as follows: In automatic mode, the speed is adjusted through the main engine bell handle, and the central control console and the driving console are equipped with a composite engine bell handle, acceleration and deceleration buttons, and an emergency mode button for speed regulation operations.
[0179] The main car clock adopts stepped speed regulation and is controlled by the main car clock on the centralized control console and the driving console. The main car clock has five gears for forward driving, three gears for reverse driving, and one gear for idle driving. The speed parameters of each gear can be set according to the car order table.
[0180] The main engine speed at each gear can be fine-tuned, and the fine-tuning range covers the speed regulation area between the two gears. It can be controlled using the "acceleration" and "deceleration" buttons on the remote control component. Press the button once to set the adjustment step as needed.
[0181] When the emergency mode button is pressed successfully, the emergency mode button indicator light will light up. At this time, the operating handle and acceleration / deceleration buttons should adopt the emergency acceleration / deceleration rate and emergency step length.
[0182] When the vehicle is pulled directly from the forward three or above position to the reverse three, or the reverse three position is pushed directly to the forward three or above position, the speed regulation rate of the emergency mode must be executed.
[0183] Calculate the current DE speed command setting value and CPP command setting value. The specific implementation process is as follows:
[0184] enter:
[0185] FB2_AUTO_CALENGINEODER.INPUT_CHENGLING car order;
[0186] FB2_AUTO_CALENGINEODER.INPUT_CURVE joint control curve;
[0187] Output:
[0188] FB2_AUTO_CALENGINEODER.OUT_CAL_VAL outputs the calculated target value;
[0189] Specific usage, for example: by inputting the joint control curve and the vehicle order, calculate the current DE speed. First, create the DE speed control algorithm function block. Then, set the input value, errmode = 0, engineorder = 1100, de_step = 2, and finally, check whether the output value outspeed increases by a step of 2.
[0190] It should be noted that the embodiment of the present application integrates the graphical development language kernel under the relevant domestic hardware and operating system environment on the basis of source code level, improves the C language API encapsulation under the corresponding operating system, and encapsulates it into a library file available for the graphical language.
[0191] The bottom layer supports the BZH hardware, integrated automation hardware modules, edge computing modules and other hardware of our mature applications. Based on the experience of using application software and operating systems, developers choose to build runtime systems on Linux, VxWorks, Dao System, Yihui and Kylin operating systems, and perform hardware configuration and protocol configuration on this basis to localize engineering development and management. Support the research and development of control layer software for defense, marine and application industries.
[0192] Fig.10 This is a principle structure block diagram of a device for developing a control algorithm for a ship power system provided in an embodiment of the present application. Correspondingly, an embodiment of the present application also provides a device for developing a control algorithm for a ship power system, see Fig.10 The development device 100 of the ship power system control algorithm includes: a building module 10, which is used to build a graphical configuration-based integrated development environment and a runtime system; a library building module 20, which is used to build a custom function block selection library in the graphical configuration-based integrated development environment; an analysis module 30, which is used to analyze the commonly used control algorithm models in the ship power system and obtain the first programming language corresponding to each commonly used control algorithm model; an encapsulation module 40, which is used to encapsulate the first programming language corresponding to each commonly used control algorithm model into a corresponding function block; an adding module 50, which is used to add each function block to the custom function block selection library; a configuration module 60, which is used to configure An operating system, driver and hardware interface based on a graphical configuration integrated development environment; a determination module 70, used to determine a target control device in a ship power system; a business function block generation module 80, used to select a business function block corresponding to a control algorithm model of a target control device from a custom function block selection library in a graphical configuration integrated development environment, and / or to custom generate a business function block corresponding to the control algorithm model of a target control device based on basic function blocks and / or business function blocks in the custom function block selection library; an operation module 90, used to run the business function block corresponding to the control algorithm model of the target control device in a runtime system.
[0193] The technical solution of the embodiment of the present application provides a device for developing a control algorithm for a ship power system, and the device for developing a control algorithm for a ship power system includes: a building module for building an integrated development environment and a runtime system based on a graphical configuration; a library building module for building a custom function block selection library in the integrated development environment based on a graphical configuration; an analysis module for analyzing commonly used control algorithm models in ship power systems to obtain a first programming language corresponding to each commonly used control algorithm model; a packaging module for packaging the first programming language corresponding to each commonly used control algorithm model into a corresponding function block; and an adding module for adding each function block to a custom function block selection library. library; configuration module, used to configure the operating system, driver and hardware interface based on the graphical configuration integrated development environment; determination module, used to determine the target control device in the ship power system; business function block generation module, used to select the business function block corresponding to the control algorithm model of the target control device from the custom function block selection library in the graphical configuration integrated development environment, and / or, based on the basic function blocks and / or business function blocks in the custom function block selection library, the business function block corresponding to the control algorithm model of the target control device is customized and generated; operation module, used to run the business function block corresponding to the control algorithm model of the target control device in the runtime system. It can be seen that the device encapsulates the commonly used control algorithm model in the ship power system into function blocks by constructing a graphical configuration integrated development environment, which is convenient for realizing the control algorithm design of each control device in the ship power system through graphics without writing complex codes, simplifying the algorithm development process, reducing development time and workload, reducing development difficulty, improving development efficiency, and providing reusable and customizable function blocks, thereby improving reusability and flexibility.
[0194] In some embodiments, the encapsulation module is also used to: convert the first programming language corresponding to each commonly used control algorithm model into the second programming language corresponding to each commonly used control algorithm model; and encapsulate the second programming language corresponding to each commonly used control algorithm model into a corresponding function block.
[0195] In some embodiments, the encapsulation module is also used to: construct function prototypes corresponding to each commonly used control algorithm model; write the configuration information of the function corresponding to each commonly used control algorithm model into the configuration file according to the configuration requirements corresponding to each commonly used control algorithm model, and generate corresponding text from the configuration file through the corresponding script; copy the corresponding text into the management file of the custom function block, and add the code of the corresponding function block to the code file.
[0196] In some embodiments, the configuration information includes at least: a variable, a type, and an address.
[0197] In some embodiments, the first programming language is C language, and the second programming language is ST language.
[0198] In some embodiments, commonly used control algorithm models in ship power systems include at least: diesel engine speed control algorithm model, motor speed control algorithm model, maneuvering propulsion speed control algorithm model, reversing speed control algorithm model, PID speed control algorithm model, cab / control room vehicle command control algorithm model, adjustable pitch propeller control algorithm model, automatic increase and decrease machine control algorithm model, and security control algorithm model.
[0199] In some embodiments, the graphical configuration-based integrated development environment includes basic environment, device configuration, variable configuration, logic configuration, task configuration, downloading, debugging and algorithm library.
[0200] In some embodiments, the hardware interface based on the graphical configuration integrated development environment includes: an I / O data communication interface, a communication interface with the graphical configuration integrated development environment, a communication interface with a human-machine interface, and an inter-station communication interface.
[0201] In some embodiments, the basic function blocks include: value conversion function block, positive and negative value conversion function block, analog error value calculation function block, count retention function block, CRC check function block, and check function block, database access function block, bit-by-bit read function block, bit-by-bit write function block, high and low value acquisition function block, CAN message reading function block, CAN message output function block, UDP message reading function block, UDP message output function block, RS485 message reading function block, RS485 message output function block, TCP message reading function block, TCP message output function block, IO acquisition function block and IO output function block.
[0202] In some embodiments, the business function blocks include: imbalance calculation function block, current overload judgment function block, equipment power supply status function block, DE speed regulation function block, position conversion function block, pitch regulating function block, load balancing function block, increase and decrease machine control function block, security control function block and PID function block.
[0203] In some embodiments, the runtime system is provided with logic operations, I / O data communication, communication with SDMPC, communication with human-machine interface, data redundancy and synchronization, self-test and diagnosis, inter-station communication, and IC functions.
[0204] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0205] The above is a detailed introduction to the development method and device of the ship power system control algorithm provided in the embodiments of the present application, and the principles and implementation methods of the present application are explained by using specific examples. The description of the above embodiments is only used to help understand the technical solution and its core idea of the present application; ordinary technicians in this field should understand that: they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.
Claims
1. A method for developing a control algorithm for a ship power system, characterized in that: Applied to a ship power system, the method comprises: Building a graphical configuration-based integrated development environment and a runtime system, and constructing a custom function block selection library in the graphical configuration-based integrated development environment; Analyze the commonly used control algorithm models in the ship power system to obtain the first programming language corresponding to each commonly used control algorithm model; Encapsulate the first programming language corresponding to each commonly used control algorithm model into a corresponding function block; and adding each function block to the custom function block selection library; Configuring the operating system, driver and hardware interface based on the graphical configuration integrated development environment; Determining a target control device in the ship power system; And in the graphical configuration-based integrated development environment, selecting a business function block corresponding to the control algorithm model of the target control device from the custom function block selection library, and / or custom-generating a business function block corresponding to the control algorithm model of the target control device based on the basic function blocks and / or business function blocks in the custom function block selection library; The business function block corresponding to the control algorithm model of the target control device is run in the runtime system.
2. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The first programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding function block, including: Converting the first programming language corresponding to each commonly used control algorithm model into the second programming language corresponding to each commonly used control algorithm model; The second programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding function block.
3. The method for developing a control algorithm for a ship power system according to claim 2, characterized in that: The second programming language corresponding to each commonly used control algorithm model is encapsulated into a corresponding function block, including: Construct function prototypes corresponding to various commonly used control algorithm models; According to the configuration requirements corresponding to each commonly used control algorithm model, the configuration information of the function corresponding to each commonly used control algorithm model is written into the configuration file, and the configuration file is generated into the corresponding text through the corresponding script; The corresponding text is copied to the management file of the custom function block, and the code of the corresponding function block is added to the code file.
4. The method for developing a control algorithm for a ship power system according to claim 3, characterized in that: The configuration information at least includes: variables, types and addresses.
5. The method for developing a control algorithm for a ship power system according to claim 2, characterized in that: The first programming language is C language, and the second programming language is ST language.
6. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The commonly used control algorithm models in the ship power system include at least: a diesel engine speed control algorithm model, a motor speed control algorithm model, a maneuvering propulsion speed control algorithm model, a reversing speed control algorithm model, a PID speed control algorithm model, a cab / control room vehicle command control algorithm model, a adjustable pitch propeller control algorithm model, an automatic increase and decrease machine control algorithm model, and a security control algorithm model.
7. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The graphical configuration-based integrated development environment includes basic environment, device configuration, variable configuration, logic configuration, task configuration, downloading, debugging and algorithm library.
8. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The hardware interface based on the graphical configuration integrated development environment includes: an I / O data communication interface, a communication interface with the graphical configuration integrated development environment, a communication interface with a human-machine interface, and an inter-station communication interface.
9. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The basic function blocks include: value conversion function block, positive and negative value conversion function block, analog error value calculation function block, count retention function block, CRC check function block, sum check function block, database access function block, bitwise read function block, bitwise write function block, high and low value acquisition function block, CAN message reading function block, CAN message output function block, UDP message reading function block, UDP message output function block, RS485 message reading function block, RS485 message output function block, TCP message reading function block, TCP message output function block, IO acquisition function block and IO output function block.
10. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The business function blocks include: imbalance calculation function block, current overload judgment function block, equipment power supply status function block, DE speed regulation function block, position conversion function block, pitch adjustment function block, load balancing function block, increase and decrease machine control function block, security control function block and PID function block.
11. The method for developing a control algorithm for a ship power system according to claim 1, characterized in that: The runtime system is provided with logic operation, I / O data communication, communication with SDMPC, communication with human-machine interface, data redundancy and synchronization, self-check and diagnosis, inter-station communication and IC function.
12. A device for developing a control algorithm for a ship power system, characterized in that: Applied to a ship power system, the device comprises: Building modules for building graphical configuration-based integrated development environment and runtime system; A library construction module, used for constructing a custom function block selection library in the graphical configuration-based integrated development environment; An analysis module, used for analyzing commonly used control algorithm models in the ship power system to obtain a first programming language corresponding to each commonly used control algorithm model; A packaging module, used for packaging the first programming language corresponding to each commonly used control algorithm model into a corresponding function block; An adding module, used for adding each function block to the custom function block selection library; A configuration module, used to configure the operating system, driver and hardware interface based on the graphical configuration integrated development environment; A determination module, used to determine a target control device in the ship power system; A business function block generation module, used to select, in the graphical configuration-based integrated development environment, a business function block corresponding to the control algorithm model of the target control device from the custom function block selection library, and / or to custom generate a business function block corresponding to the control algorithm model of the target control device based on basic function blocks and / or business function blocks in the custom function block selection library; The running module is used to run the business function block corresponding to the control algorithm model of the target control device in the runtime system.