CN201638083U - A hardware-in-the-loop simulation system for ship motion control - Google Patents
A hardware-in-the-loop simulation system for ship motion control Download PDFInfo
- Publication number
- CN201638083U CN201638083U CN2009202483294U CN200920248329U CN201638083U CN 201638083 U CN201638083 U CN 201638083U CN 2009202483294 U CN2009202483294 U CN 2009202483294U CN 200920248329 U CN200920248329 U CN 200920248329U CN 201638083 U CN201638083 U CN 201638083U
- Authority
- CN
- China
- Prior art keywords
- ship
- ship motion
- control
- simulation system
- module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 230000033001 locomotion Effects 0.000 title claims abstract description 136
- 238000004088 simulation Methods 0.000 title claims abstract description 67
- 230000006854 communication Effects 0.000 claims abstract description 47
- 238000004891 communication Methods 0.000 claims abstract description 42
- 238000012544 monitoring process Methods 0.000 claims abstract description 36
- 238000013461 design Methods 0.000 claims description 14
- 238000000034 method Methods 0.000 abstract description 22
- 230000006870 function Effects 0.000 description 15
- 230000008569 process Effects 0.000 description 12
- 238000013178 mathematical model Methods 0.000 description 10
- 230000004044 response Effects 0.000 description 10
- 238000011161 development Methods 0.000 description 6
- 230000018109 developmental process Effects 0.000 description 6
- 238000000926 separation method Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 238000002474 experimental method Methods 0.000 description 4
- 238000011160 research Methods 0.000 description 4
- VIEYMVWPECAOCY-UHFFFAOYSA-N 7-amino-4-(chloromethyl)chromen-2-one Chemical compound ClCC1=CC(=O)OC2=CC(N)=CC=C21 VIEYMVWPECAOCY-UHFFFAOYSA-N 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000008140 language development Effects 0.000 description 2
- 238000005316 response function Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005094 computer simulation Methods 0.000 description 1
- 238000012938 design process Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000033772 system development Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本实用新型公开了一种船舶运动控制硬件在环仿真系统,包括船舶运动控制器、船舶运动仿真系统和远程控制与监测系统,所述船舶运动仿真系统和船舶运动控制器之间通过串口通信接口实现数据的相互连接,船舶运动控制器和远程控制与监测系统之间通过以太网通信接口实现数据的相互连接。本实用新型的工作方法包括通过船舶运动仿真系统输入船型选择、实船参数及海况参数;通过远程控制与监测系统发送舵角参数;船舶运动控制器计算出航向;船舶运动仿真系统与船舶运动控制器形成闭环控制等。利用本实用新型,使用者可任意进行船型选择和实船参数设置,并可以选择其中任意算法模块进行船舶运动控制的仿真实验,实现了船舶状态实时监控的目的。
The utility model discloses a hardware-in-the-loop simulation system for ship motion control, which comprises a ship motion controller, a ship motion simulation system, and a remote control and monitoring system. The ship motion simulation system and the ship motion controller are connected through a serial port communication interface. Realize the mutual connection of data, and realize the mutual connection of data between the ship motion controller and the remote control and monitoring system through the Ethernet communication interface. The working method of the utility model includes inputting ship type selection, actual ship parameters and sea state parameters through the ship motion simulation system; sending rudder angle parameters through the remote control and monitoring system; calculating the heading by the ship motion controller; The device forms a closed-loop control, etc. Utilizing the utility model, the user can arbitrarily select the ship type and set the actual ship parameters, and can select any algorithm module among them to carry out the simulation experiment of the ship motion control, thereby realizing the purpose of real-time monitoring of the ship state.
Description
技术领域technical field
本实用新型涉及一种在环仿真系统,特别是一种船舶运动控制硬件在环仿真系统。The utility model relates to an in-the-loop simulation system, in particular to a ship motion control hardware-in-the-loop simulation system.
背景技术Background technique
船舶运动控制是一个极为复杂的控制过程,高智能化船舶的基本要求是船舶航运自动化,船舶航向自动控制系统亦简称为自动舵,是高智能化船舶不可缺少的重要设备,它的性能直接影响着船舶航行的经济性和安全性。自动舵的控制技术水平与控制理论发展水平相一致,它伴随着自动控制理论和技术的发展而发展。目前神经网络控制、模糊控制、混合智能控制等先进的控制算法为设计高水平的船舶运动控制器提供了新的契机。但是在实际船舶上验证这些先进的控制算法面临很多困难:首先想要在实际船舶上做研究就必须办理包括海员证在内的各种烦杂手续;其次船舶在海上正常运行时也不太可能让研究人员根据研究的内容改动各种装置的参数;若自行租用船舶,需要大量的人力物力来支持,在现有的条件下无法实现。Ship motion control is an extremely complex control process. The basic requirement of high-intelligence ships is ship navigation automation. The automatic ship course control system, also referred to as autopilot, is an indispensable and important equipment for high-intelligence ships. Its performance directly affects The economy and safety of the ship's navigation. The control technology level of autopilot is consistent with the development level of control theory, and it develops along with the development of automatic control theory and technology. At present, advanced control algorithms such as neural network control, fuzzy control, and hybrid intelligent control provide new opportunities for designing high-level ship motion controllers. However, there are many difficulties in verifying these advanced control algorithms on actual ships: First, if you want to do research on actual ships, you must go through various complicated procedures including seaman's certificates; Researchers change the parameters of various devices according to the content of the research; if they rent ships by themselves, a lot of manpower and material resources are needed to support them, which cannot be realized under the existing conditions.
硬件在环仿真方法是将物理模型和数学模型联合在一起进行试验的一种方法,它将实际系统的一部分设备和计算机相互连接,用数学仿真的方式对其中不存在或不便于实验的部分系统进行仿真,同时保证整个系统实时运转。该仿真技术综合了物理仿真和数学仿真两者的优点,充分利用计算机建模的简易性,减少了费用,便于对系统的模型部分进行灵活快捷的仿真、变更,保证了在实现改变参数的同时就可详细观察系统性能的变化。该仿真技术在机械、电子、航天航空和武器研制等领域已得到了广泛应用,尤其是在控制系统的设计过程中,由于系统功能日益丰富,设计难度日益加大,利用硬件在环仿真作为整个系统的开发平台则可以预先逐步检验控制系统设计的合理性和可靠性,从而大大提高控制系统的研制质量,减小研制风险和提高设计成功率。但船舶运动控制硬件在环仿真系统目前尚处在研制阶段,没有成型的产品。The hardware-in-the-loop simulation method is a method that combines the physical model and the mathematical model to conduct experiments. It connects part of the equipment and the computer in the actual system, and uses mathematical simulation to test the part of the system that does not exist or is not convenient for experiments. Run simulations while keeping the entire system running in real time. This simulation technology combines the advantages of physical simulation and mathematical simulation, makes full use of the simplicity of computer modeling, reduces costs, facilitates flexible and quick simulation and change of the model part of the system, and ensures that parameters can be changed while changing parameters. Changes in system performance can be observed in detail. This simulation technology has been widely used in the fields of machinery, electronics, aerospace, and weapon development, especially in the design process of the control system. Due to the increasingly rich system functions and the increasing difficulty of design, the use of hardware-in-the-loop simulation as the overall The system development platform can check the rationality and reliability of the control system design step by step in advance, thereby greatly improving the development quality of the control system, reducing development risks and increasing the success rate of design. However, the hardware-in-the-loop simulation system for ship motion control is still in the development stage, and there is no finished product.
发明内容Contents of the invention
为解决现有技术存在的上述问题,本实用新型的目的是设计一种可以实现船型选择、实船参数设置、船舶运动控制算法选择和船舶状态实时监控的船舶运动控制硬件在环仿真系统。In order to solve the above problems in the prior art, the purpose of this utility model is to design a ship motion control hardware-in-the-loop simulation system that can realize ship type selection, real ship parameter setting, ship motion control algorithm selection and ship state real-time monitoring.
为了实现上述目的,本实用新型的技术方案如下:一种船舶运动控制硬件在环仿真系统包括船舶运动控制器、船舶运动仿真系统和远程控制与监测系统,所述船舶运动仿真系统和船舶运动控制器之间通过串口通信接口实现数据的相互连接,船舶运动控制器和远程控制与监测系统之间通过以太网通信接口实现数据的相互连接;所述的船舶运动仿真系统提供船型选择,使用者可根据需要自行输入不同船型、实船参数及海况参数,如船舶长度、吃水深度、方形系数、风浪强度、风浪方向等;所述的船舶运动控制器包含了智能PID、多模态智能控制、模糊CMAC控制、混合智能控制等多种控制算法模块,操作者可以选择其中任意算法模块进行船舶运动控制的仿真实验;所述的远程控制与监测系统可向船舶运动控制器发送航向命令,设置控制器参数,并对船舶运动仿真系统的响应情况进行监测。In order to achieve the above object, the technical solution of the utility model is as follows: a ship motion control hardware-in-the-loop simulation system includes a ship motion controller, a ship motion simulation system and a remote control and monitoring system, the ship motion simulation system and ship motion control The mutual connection of data is realized through the serial port communication interface between the devices, and the mutual connection of data is realized through the Ethernet communication interface between the ship motion controller and the remote control and monitoring system; the described ship motion simulation system provides ship type selection, and the user can Input different ship types, actual ship parameters and sea state parameters according to the needs, such as ship length, draft, square coefficient, wind and wave strength, wind and wave direction, etc.; the ship motion controller includes intelligent PID, multi-mode intelligent control, fuzzy CMAC control, hybrid intelligent control and other control algorithm modules, the operator can choose any algorithm module to carry out the simulation experiment of ship motion control; the remote control and monitoring system can send heading commands to the ship motion controller, set the controller parameters, and monitor the response of the ship motion simulation system.
本实用新型所述的船型选择包括大型集装箱船和油轮两种船型选择。The ship type selection described in the utility model includes two kinds of ship type selections of a large container ship and an oil tanker.
本实用新型所述的船舶运动控制器包括主程序模块、船舶运动控制与通信模块、以太网模块、控制参数接收与船舶运动状态发送模块和显示模块,所述的主程序模块是船舶运动控制器软件的核心,负责任务调度;船舶运动控制与通信模块负责与船舶运动仿真系统的通信任务;以太网模块负责底层的基于TCP/IP的通信任务;控制参数接收与船舶运动状态发送模块负责与远程控制与监测系统的通信任务;显示模块负责显示船舶的舵角和航向。The ship motion controller described in the utility model includes a main program module, a ship motion control and communication module, an Ethernet module, a control parameter receiving and ship motion state sending module and a display module, and the main program module is a ship motion controller The core of the software is responsible for task scheduling; the ship motion control and communication module is responsible for the communication tasks with the ship motion simulation system; the Ethernet module is responsible for the underlying TCP/IP-based communication tasks; the control parameter receiving and ship motion status sending module is responsible for communicating with the remote The communication task of the control and monitoring system; the display module is responsible for displaying the rudder angle and heading of the ship.
本实用新型所述的串口通信接口使用WinAPI进行串口通信程序设计,采用事件驱动方式的编程方法,即当串口接收缓冲区收到数据时,自动执行接收程序,对缓冲区中的数据进行相应处理。The serial port communication interface described in the utility model uses WinAPI to carry out the serial port communication program design, and adopts the programming method of the event-driven mode, that is, when the serial port receiving buffer receives data, the receiving program is automatically executed, and the data in the buffer is processed accordingly .
本实用新型所述的船舶运动控制器、船舶运动仿真系统和远程控制与监测系统的软件采用Visual C++语言开发。The software of the ship motion controller, ship motion simulation system and remote control and monitoring system described in the utility model adopts Visual C++ language development.
本实用新型所述的船舶运动仿真系统包括响应型和分离型两种船舶运动数学模型,所述的响应型数学模型为非线性二阶Nomoto模型,所述的分离型数学模型包括三自由度MMG模型和四自由度的平野模型。The ship motion simulation system described in the utility model includes two kinds of ship motion mathematical models of response type and separation type. The response type mathematical model is a nonlinear second-order Nomoto model, and the separation type mathematical model includes three degrees of freedom MMG model and a four-degree-of-freedom Hirano model.
本实用新型所述的船舶运动控制器的核心模块是SST公司的8位微处理器SST89E516RD,所述的串行通信接口采用MAXIM公司生产的MAX232芯片设计,所述的以太网通信接口采用台湾Realtek公司生产的10Mb/s以太网控制器RTL8019AS设计。The core module of the ship motion controller described in the utility model is the 8-bit microprocessor SST89E516RD of SST Company, the described serial communication interface adopts the MAX232 chip design produced by MAXIM Company, and the described Ethernet communication interface adopts Taiwan Realtek Design of 10Mb/s Ethernet controller RTL8019AS produced by the company.
与现有技术相比,本实用新型具有以下有益效果:Compared with the prior art, the utility model has the following beneficial effects:
1、由于本实用新型的船舶运动仿真系统船舶运动仿真系统提供大型集装箱船和油轮两种船型选择,使用者可根据需要自行输入不同船型、实船参数及海况参数,实现了根据使用者要求进行船型选择和实船参数设置的目的。1. Since the ship motion simulation system of the utility model provides two types of ship types: large container ship and oil tanker, the user can input different ship types, real ship parameters and sea state parameters according to the needs, realizing the realization of The purpose of ship type selection and actual ship parameter setting.
2、由于本实用新型的船舶运动控制器包含了智能PID、多模态智能控制,模糊CMAC控制,混合智能控制等多种控制算法模块,操作者可以选择其中任意算法模块进行船舶运动控制的仿真实验。2. Since the ship motion controller of the present invention includes various control algorithm modules such as intelligent PID, multi-modal intelligent control, fuzzy CMAC control, hybrid intelligent control, etc., the operator can choose any algorithm module among them to simulate the ship motion control experiment.
3、由于本实用新型的远程控制与监测系统可向舶运动控制器发送航向命令,设置控制器参数,并对船舶运动仿真系统的响应情况进行监测等功能,实现了船舶状态实时监控的目的。3. Since the remote control and monitoring system of the present invention can send heading commands to the ship motion controller, set controller parameters, and monitor the response of the ship motion simulation system, the purpose of real-time monitoring of ship status is realized.
4、由于本实用新型能实现对虚拟船舶的运动控制,同时给控制算法等理论研究者提供一种实际的算法验证平台,也可作为船舶控制系统仿真的科研设备提供给博士、硕士研究生和教师使用。针对在实际船舶上验证控制算法面临众多的困难,本实用新型为在实验室环境进行船舶运动控制器和控制算法的研究提供一个有效的仿真平台,对加速先进控制理论在船舶控制领域的应用具有重要意义。4. Since the utility model can realize the motion control of the virtual ship, it also provides a practical algorithm verification platform for theoretical researchers such as control algorithms, and can also be used as a scientific research equipment for ship control system simulation for doctors, postgraduates and teachers use. Aiming at the many difficulties in verifying the control algorithm on the actual ship, the utility model provides an effective simulation platform for the research of the ship motion controller and control algorithm in the laboratory environment, and has the advantages of accelerating the application of advanced control theory in the field of ship control. Significance.
附图说明Description of drawings
本实用新型仅有附图1张,其中:The utility model only has 1 accompanying drawing, wherein:
图1是种船舶运动控制硬件在环仿真系统的组成结构框图。Figure 1 is a structural block diagram of a hardware-in-the-loop simulation system for ship motion control.
图中:1、船舶运动仿真系统,2、船舶运动控制器,3、远程控制与监测系统,4、串口通信接口,5、以太网通信接口。In the figure: 1. Ship motion simulation system, 2. Ship motion controller, 3. Remote control and monitoring system, 4. Serial communication interface, 5. Ethernet communication interface.
具体实施方式Detailed ways
下面结合附图对本实用新型进行进一步地描述。如图1所示,一种船舶运动控制硬件在环仿真系统包括船舶运动控制器2、船舶运动仿真系统1和远程控制与监测系统3,所述船舶运动仿真系统1和船舶运动控制器2之间通过串口通信接口4实现数据的相互连接,船舶运动控制器2和远程控制与监测系统3之间通过以太网通信接口5实现数据的相互连接;所述的船舶运动仿真系统1提供船型选择,使用者可根据需要自行输入不同船型、实船参数及海况参数,如船舶长度、吃水深度、方形系数、风浪强度、风浪方向等;所述的船舶运动控制器2包含了智能PID、多模态智能控制、模糊CMAC控制、混合智能控制等多种控制算法模块,操作者可以选择其中任意算法模块进行船舶运动控制的仿真实验;所述的远程控制与监测系统3可向船舶运动控制器2发送航向命令,设置控制器参数,并对船舶运动仿真系统1的响应情况进行监测。所述的船型选择包括大型集装箱船和油轮两种船型选择。所述的船舶运动控制器2包括主程序模块、船舶运动控制与通信模块、以太网模块、控制参数接收与船舶运动状态发送模块和显示模块,所述的主程序模块是船舶运动控制器2软件的核心,负责任务调度;船舶运动控制与通信模块负责与船舶运动仿真系统1的通信任务;以太网模块负责底层的基于TCP/IP的通信任务;控制参数接收与船舶运动状态发送模块负责与远程控制与监测系统3的通信任务;显示模块负责显示船舶的舵角和航向。所述的串口通信接口4使用WinAPI进行串口通信程序设计,采用事件驱动方式的编程方法,即当串口接收缓冲区收到数据时,自动执行接收程序,对缓冲区中的数据进行相应处理。所述的船舶运动控制器2、船舶运动仿真系统1和远程控制与监测系统3的软件采用Visual C++语言开发。所述的船舶运动仿真系统1包括响应型和分离型两种船舶运动数学模型,所述的响应型数学模型为非线性二阶Nomoto模型,所述的分离型数学模型包括三自由度MMG模型和四自由度的平野模型。所述的船舶运动控制器2的核心模块是SST公司的8位微处理器SST89E516RD,所述的串行通信接口采用MAXIM公司生产的MAX232芯片设计,所述的以太网通信接口5采用台湾Realtek公司生产的10Mb/s以太网控制器RTL8019AS设计。Below in conjunction with accompanying drawing, the utility model is further described. As shown in Figure 1, a hardware-in-the-loop simulation system for ship motion control includes a
本实用新型的工作方法包括以下步骤:Working method of the present utility model comprises the following steps:
A、根据实验需要,通过船舶运动仿真系统1输入船型、实船参数及海况参数,如船舶长度、吃水深度、方形系数、风浪强度、风浪方向等;A. According to the needs of the experiment, input the ship type, actual ship parameters and sea state parameters, such as ship length, draft, square coefficient, wind and wave intensity, wind and wave direction, etc., through the ship
B、远程控制与监测系统3通过以太网通信接口5把舵角参数发送给船舶运动控制器2;B. The remote control and
C、船舶运动控制器2接收到舵角参数后调用控制函数对数据进行处理,然后把计算出的航向通过串口通信接口4发送给船舶运动仿真系统1;C. The
D、船舶运动仿真系统1根据选择的船舶运动数学模型与船舶运动控制器2形成闭环控制,并显示船舶运动航迹;远程控制与监测系统3同时对船舶运动模型的状态进行实时监测,绘制航向和舵角曲线,并显示出船舶运动模型当前的航向和舵角值。D. The ship
本实用新型所述的船舶运动仿真系统1与船舶运动控制器2还可形成开环控制,通过船舶运动控制器2的按键向船舶运动仿真系统1发送舵角,控制其航迹,模拟手动操舵。The ship
为便于理解本实用新型,下面对各分系统的工作原理进行进一步描述:For the convenience of understanding the utility model, the working principle of each subsystem is further described below:
1、船舶运动仿真系统1的工作原理1. Working principle of ship
船舶运动仿真系统1是船舶运动控制器2的被控对象,该系统提供船舶运动数学模型用于对象仿真,对船舶运动控制器2输入的控制量(即舵角)进行响应,输出航向,并在系统屏幕上显示出船舶运动的航迹。The ship
船舶运动仿真系统1与船舶运动控制器2之间的通信是通过串口通信接口4完成的。该系统使用WinAPI进行串口通信程序设计,采用事件驱动方式的编程方法,即当串口接收缓冲区收到数据时,自动执行接收程序,对缓冲区中的数据进行相应处理,这样可以提高程序的执行效率。这种方法的工作原理是建立一个事件线程,它监视串口的事件,当有事件发生时,它向主线程发送一个Windows消息,主线程在消息响应函数中处理已发生的事件。程序设计中用到的API函数的具体使用可以参考有关WinAPI串口编程的书籍或者是MSDN。另外,串口通信接口4中使用与船舶运动控制器2串口通信程序中相同的通信协议。The communication between the ship
船舶运动仿真系统1将模型分为响应型模型和分离型模型两种,其中响应型模型为非线性二阶Nomoto模型;分离型模型包括三自由度MMG模型和四自由度的平野模型。船舶运动仿真系统1提供参数输入界面,可输入船舶模型的参数,并对风力、风向、航速等进行设定。船舶运动仿真系统1中带有5446TEU系列集装箱的COSCO Shanghai号和3万吨油轮的实船数据供用户使用。The ship
2、船舶运动控制器2工作原理2. Working principle of
船舶运动控制器2是整个系统的硬件环节,各种控制算法可以以程序的形式在船舶运动控制器2里实现,船舶运动控制器2接收远程控制与监测系统3发送的控制参数,对船舶运动仿真系统1提供的船舶运动数学模型进行控制,以达到验证控制算法的目的。船舶运动控制器2以SST公司的8位微处理器SST89E516RD为核心,采用MAXIM公司生产的MAX232芯片设计串行通信4接口,实现与船舶运动仿真系统1的数据交互,构成船舶运动闭环控制;以太网接口5采用台湾Realtek公司生产的10Mb/s以太网控制器RTL8019AS进行设计,用于船舶运动控制器2和远程控制与监测系统3进行数据交互。The
3、远程控制与监测系统3的工作原理3. Working principle of remote control and
远程控制与监测系统3用于向船舶运动控制器2发送航向命令,并设置船舶运动控制器参数,并对船舶运动仿真系统1的响应情况进行监测。远程控制与监测系统3包括航向、舵角监测部分,实时对船舶运动仿真系统1的舵角和航向进行监测,并画出航向和舵角的监测曲线;远程控制与监测系统3还包括参数设置部分,可以对船舶运动控制器2的参数进行设置,同时把航向发送给船舶运动控制器2。远程控制与监测系统3能实时显示船舶运动模型当前的舵角和航向,并可显示远程控制与监测系统3与船舶运动控制器2的连接状态,通知用户网络连接成功与否。The remote control and
远程控制与监测系统3通过以太网通信接口5与船舶运动控制器2进行数据连接,使用Microsoft VC++6.0的Winsock进行网络编程。Windows Sockets是Microsoft Windows的网络程序设计接口,是连接应用程序与网络驱动程序的桥梁,Sockets在应用程序中创建,通过绑定操作与驱动程序建立关系,此后,应用程序送给Sockets的数据,由Sockets交给驱动程序向网络上发送出去。计算机从网络上收到与该Sockets绑定的IP地址和端口号相关的数据后,由驱动程序交给Sockets,应用程序便可从该Sockets中提取接收到的数据。网络应用程序就是这样通过Sockets进行数据的发送与接收的。The remote control and
在TCP/IP网络应用中,通信的两个进程间相互作用的主要模式是客户机/服务器模式,即客户向服务器提出请求,服务器接收到请求后,提供相应的服务。本设计采用的就是这种模式,即船舶运动控制器2为客户机,远程控制与监测系统3为服务器。本设计中使用的套接字(Sockets)为流式套接字(SOCK_STREAM),它提供面向连接、可靠的数据传输服务,数据无差错、无重复的发送,且按发送顺序接收。流式套接字是基于TCP协议实现的。流式套接字的服务进程客户进程在通信前必须创建各自的套接字并建立连接,然后才能对相应的套接字进行“读”、“写”操作,实现数据的传输。本服务进程具体编程步骤如下:In TCP/IP network applications, the main mode of interaction between two communication processes is the client/server mode, that is, the client makes a request to the server, and the server provides corresponding services after receiving the request. This design adopts this mode, that is, the
(1)创建套接字,服务进程总是先于客户进程启动,服务进程首先调用socket函数创建一个套接字。(1) To create a socket, the service process is always started before the client process, and the service process first calls the socket function to create a socket.
(2)将套接字绑定到一个本地地址和端口号上,以便在网络上标识该套接字。这个过程是通过调用bind函数来完成的。(2) Bind the socket to a local address and port number to identify the socket on the network. This process is done by calling the bind function.
(3)将套接字设为监听模式,准备接收客户端的连接请求。将一个套接字设置为监听模式的是listen函数。(3) Set the socket to the listening mode, ready to receive the connection request from the client. It is the listen function that sets a socket into listening mode.
(4)进入监听状态之后,通过调用accept函数使套接字做好接收客户连接的准备。此时客户可以向服务器端发出连接请求,当连接请求到来后,accept函数会生成一个新的套接字与客户套接字建立连接,并向客户端返回接收信号。至于原来那个监听套接字,它仍然用于接收其他客户机连接,而且仍处于监听模式。(4) After entering the listening state, the socket is ready to receive client connections by calling the accept function. At this time, the client can send a connection request to the server. When the connection request arrives, the accept function will generate a new socket to establish a connection with the client socket, and return a receiving signal to the client. As for the original listening socket, it is still used to receive other client connections and is still in listening mode.
(5)一旦客户机的套接字收到来自服务器的接收信号,则表示客户机与服务器已实现连接,可以进行数据传输了。与客户进行通信需要用到两个函数:send函数和recv函数。send函数通过一个已建立连接的套接字发送数据,recv函数从一个已连接的套接字接收数据,在此需要注意一点的是:当服务器接收数据时,如果数据没有到来,recv函数会阻塞,从而导致程序暂停运行。为了解决这个问题本设计将接收数据的操作放置在一个单独的线程中完成,以便顺利的进行数据的接收。并且在该线程中,当接收到数据后就给主线程发送一个消息,在消息响应函数中对接收到的数据进行处理。(5) Once the client's socket receives the receiving signal from the server, it means that the client and the server have been connected, and data transmission can be performed. Communicating with customers requires two functions: the send function and the recv function. The send function sends data through a socket with an established connection, and the recv function receives data from a connected socket. One thing to note here is that when the server receives data, if the data does not arrive, the recv function will block , causing the program to halt. In order to solve this problem, this design places the operation of receiving data in a separate thread to complete the data reception smoothly. And in this thread, when data is received, a message is sent to the main thread, and the received data is processed in the message response function.
(6)通信完毕后返回,等待另一客户请求。(6) Return after the communication is completed, and wait for another client request.
(7)关闭套接字。一旦任务完成,就必须关掉连接以释放套接字占用的所有资源,通常调用closesocket函数来完成此操作。(7) Close the socket. Once the task is complete, the connection must be closed to release any resources occupied by the socket, usually by calling the closesocket function.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009202483294U CN201638083U (en) | 2009-11-20 | 2009-11-20 | A hardware-in-the-loop simulation system for ship motion control |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009202483294U CN201638083U (en) | 2009-11-20 | 2009-11-20 | A hardware-in-the-loop simulation system for ship motion control |
Publications (1)
Publication Number | Publication Date |
---|---|
CN201638083U true CN201638083U (en) | 2010-11-17 |
Family
ID=43082587
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009202483294U Expired - Fee Related CN201638083U (en) | 2009-11-20 | 2009-11-20 | A hardware-in-the-loop simulation system for ship motion control |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN201638083U (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103309236A (en) * | 2013-05-24 | 2013-09-18 | 大连海事大学 | A hardware-in-the-loop simulation system for marine dual diesel engine propulsion control |
CN105843042A (en) * | 2016-04-11 | 2016-08-10 | 大连海事大学 | A portable ship autopilot detection system |
CN107092199A (en) * | 2017-06-05 | 2017-08-25 | 南京航空航天大学 | Ship motion controller emulation platform and ship motion controller method |
-
2009
- 2009-11-20 CN CN2009202483294U patent/CN201638083U/en not_active Expired - Fee Related
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103309236A (en) * | 2013-05-24 | 2013-09-18 | 大连海事大学 | A hardware-in-the-loop simulation system for marine dual diesel engine propulsion control |
CN103309236B (en) * | 2013-05-24 | 2015-08-12 | 大连海事大学 | A hardware-in-the-loop simulation system for marine dual diesel engine propulsion control |
CN105843042A (en) * | 2016-04-11 | 2016-08-10 | 大连海事大学 | A portable ship autopilot detection system |
CN107092199A (en) * | 2017-06-05 | 2017-08-25 | 南京航空航天大学 | Ship motion controller emulation platform and ship motion controller method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101713998B (en) | Hardware in-loop simulation system for controlling ship motion and working method thereof | |
CN107734042B (en) | Low-cost remote debugging system and method | |
CN107901039B (en) | Python-based desktop-level robot offline programming simulation system | |
CN114102590B (en) | An industrial robot simulation method, system and application | |
CN113156834B (en) | Development method of semi-physical simulation flight simulation system | |
CN104699122A (en) | A robot motion control system | |
CN106060058A (en) | Internet-based industrial robot remote control method | |
CN104842356B (en) | A multi-palletizing robot teaching method based on distributed computing and machine vision | |
CN201638083U (en) | A hardware-in-the-loop simulation system for ship motion control | |
CN107703775B (en) | Rigid-flexible-liquid coupling complex spacecraft simulation system and method | |
Duan et al. | A digital twin–driven monitoring framework for dual-robot collaborative manipulation | |
CN111300412A (en) | A method of controlling robots based on Unreal Engine | |
CN105511295A (en) | STKX component-based satellite vision real-time simulation system and method thereof | |
Shi et al. | A versatile experimental platform for tactile internet: Design guidelines and practical implementation | |
CN115401696A (en) | Data/model hybrid-driven robot remote driving method | |
US20210229286A1 (en) | Cyber-physical system-based remote control framework for robots | |
Tran et al. | Application of Mixed Reality in Industrial and Collaborative Robot Control | |
CN109001986B (en) | Networked flexible mechanical arm control simulation platform and working method thereof | |
CN104615009A (en) | Flexible arm system two-dimensional vibration control method | |
CN106774178A (en) | A kind of automation control system and method, plant equipment | |
CN101908089A (en) | Real-time interactive method of mechanical-hydraulic linkage simulation parameters | |
Shen et al. | Virtual simulation of communication between KUKA robot and PLC | |
CN113618723A (en) | Ship small-erection auxiliary assembly system based on augmented reality | |
CN115062448A (en) | A digital twin collaborative experiment system and method based on cloud collaboration | |
CN202548562U (en) | PLC (Programmable Logic Controller) experiment system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20101117 Termination date: 20111120 |