CN116610467A - Energy controller serial port management method - Google Patents

Energy controller serial port management method Download PDF

Info

Publication number
CN116610467A
CN116610467A CN202310900879.4A CN202310900879A CN116610467A CN 116610467 A CN116610467 A CN 116610467A CN 202310900879 A CN202310900879 A CN 202310900879A CN 116610467 A CN116610467 A CN 116610467A
Authority
CN
China
Prior art keywords
layer
information
data
serial port
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.)
Granted
Application number
CN202310900879.4A
Other languages
Chinese (zh)
Other versions
CN116610467B (en
Inventor
王铁栋
丛培建
徐保国
孙敬科
郑亚男
蒋剑跃
王海龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yantai Dongfang Wisdom Electric Co Ltd
Original Assignee
Yantai Dongfang Wisdom Electric Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Yantai Dongfang Wisdom Electric Co Ltd filed Critical Yantai Dongfang Wisdom Electric Co Ltd
Priority to CN202310900879.4A priority Critical patent/CN116610467B/en
Publication of CN116610467A publication Critical patent/CN116610467A/en
Application granted granted Critical
Publication of CN116610467B publication Critical patent/CN116610467B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a serial port management method of an energy controller, which relates to the field of electric digital data processing and is used for realizing communication between an acquisition APP and serial port equipment, wherein an application layer, a serial port layer and a physical layer are arranged in a system; the acquisition APP is located at an application layer, and the serial device is located at a physical layer; the serial port layer is used for receiving a request of the application layer, calling the serial port driver to complete data interaction with the physical layer according to the content of the request, and then returning data needed by the application layer to the application layer. According to the invention, the serial port equipment of the application layer and the physical layer is decoupled through system layering, so that the number of times that the acquisition APP is interrupted is reduced, the acquisition working efficiency is improved, meanwhile, the adaptation workload of the acquisition APP is reduced, and the development difficulty is reduced.

Description

Energy controller serial port management method
Technical Field
The invention relates to the field of electric digital data processing, in particular to a serial port management method of an energy controller.
Background
The energy controller is a device for collecting and transmitting various bottom layer device data, and needs to be provided with various types of peripheral interfaces, such as 485, bluetooth, carrier waves and the like, and the interfaces are connected with the energy controller main control board in a serial port mode. Besides the physical serial port, part of application programs (APP) in the energy controller can also interact data with the acquisition APP in the energy controller in a virtual serial port mode. The serial ports in the energy controllers are various in types, large in quantity and complex in serial port management work.
The current common serial port management method is to collect APP to call serial port driver program and to read and write physical interface directly. This method has the following drawbacks: (1) Each time a physical serial port receives a byte, an interrupt is generated, the interrupt directly interrupts the flow of collecting the APP, a frame of message length is tens to hundreds of bytes, a large amount of interrupts are triggered each time the message is received, and in the multi-serial port equipment such as an energy controller, a large amount of time is spent for processing the interrupt during the operation of collecting the APP, so that the execution efficiency is quite low. (2) Different serial port driving modes have differences, and the acquisition APP needs to adapt to various serial ports, so that development workload is increased.
Disclosure of Invention
The invention provides an energy controller serial port management method, which aims at: (1) The number of times that the acquisition APP is interrupted is reduced, and the acquisition working efficiency is improved; (2) The adaptation workload of the acquisition APP is reduced, and the development difficulty is reduced.
The technical scheme of the invention is as follows:
the serial port management method of the energy controller is used for realizing communication between the acquisition APP and the serial port equipment, and an application layer, a serial port layer and a physical layer are arranged; the acquisition APP is located at an application layer, and the serial device is located at a physical layer; the serial port layer is used for receiving a request of the application layer, calling the serial port driver to complete data interaction with the physical layer according to the content of the request, and then returning data needed by the application layer to the application layer.
As a further improvement of the energy controller serial port management method: the application layer and the serial port layer interact through information flow, and the serial port layer and the physical layer interact through byte flow.
As a further improvement of the energy controller serial port management method: the information flow comprises constraint information, control information and data information;
the constraint information is used for controlling the communication state between the serial port layer and the physical layer;
the control information is used for controlling the serial port layer to convert the data elements in the data information and the communication messages transmitted by the byte stream;
the data information is used for transmitting data elements, and the data elements are format data used for collecting APP.
As a further improvement of the energy controller serial port management method: the communication between the serial port layer and the physical layer operates in a state machine mode, and the constraint information comprises state jump conditions.
As a further improvement of the energy controller serial port management method: the serial port layer comprises an interface sub-layer, a management sub-layer and a driving sub-layer;
the interface sub-layer comprises a constraint management module, an event processing module and a message forwarding module;
the management sublayer comprises a flow control module, a data buffer module and a message queue module;
the driving sub-layer comprises an RXD data receiving module and a TXD data sending module, and is used for realizing data interaction with the physical layer by calling a serial port driving program;
the constraint management module is used for forwarding constraint information in the information flow to the management sublayer, the event processing module is used for forwarding control information in the information flow to the management sublayer, the message forwarding module is used for forwarding data information in the information flow to the message queue module and also used for sending the data information in the message queue module to the acquisition APP through the information flow;
the flow control module is used for extracting data elements from the data information in the message queue module according to the conversion rule in the control information, and putting the data elements into the data buffer module to form a message; the message in the data buffer module is converted into a data element according to a conversion rule in the control information, and the data element is packaged into data information and stored in the message queue module; and the communication state between the serial port layer and the physical layer is controlled according to the constraint information.
As a further improvement of the energy controller serial port management method: when the acquisition APP sends data to the physical layer, the acquisition APP sends constraint information, control information and data information to the interface sub-layer through an information flow, the constraint management module and the event processing module respectively forward the constraint information and the control information to the management sub-layer, and meanwhile, the message forwarding module forwards the data information to the message queue module; the management sub-layer builds a flow control module according to the constraint information and the control information, then the flow control module extracts data elements from the data information in the message queue module according to the conversion rule in the control information, then the data elements are formed into a message to be put into the data buffer module, and then the flow control module controls the TXD data transmission module of the driving sub-layer to transmit the message in the data buffer module to the physical layer according to the constraint information.
As a further improvement of the energy controller serial port management method: when the acquisition APP receives data from the physical layer, the acquisition APP transmits constraint information and control information to the interface sub-layer through an information flow, and the constraint management module and the event processing module respectively forward the constraint information and the control information to the management sub-layer; the management sub-layer builds a flow control module according to constraint information and control information, then the flow control module controls an RXD data receiving module of the driving sub-layer to store messages sent by the physical layer to a data buffer module according to constraint information, the flow control module converts the messages in the data buffer module into data elements according to a conversion rule in the control information, the data elements are packaged into data information and stored in a message queue module, and then a message forwarding module forwards the data information in the message queue module to an acquisition APP.
As a further improvement of the energy controller serial port management method: before the acquisition APP communicates with the serial port layer, a registration application is put forward to the serial port layer, and after registration is successful, the serial port layer establishes an information flow channel for the registered acquisition APP, so that information flow interaction between the acquisition APP and the serial port layer is realized.
As a further improvement of the energy controller serial port management method: the physical layer also comprises a virtual serial port constructed by the bottom layer APP.
Compared with the prior art, the invention has the following positive effects: (1) According to the invention, through system layering, the serial port equipment of the application layer and the physical layer is decoupled, the serial port driver is called from the original acquisition APP into the serial port driver, the serial port layer is responsible for processing interruption and returning the final complete data to the acquisition APP through information flow, so that the interruption times of the acquisition APP are greatly reduced, and the efficiency of acquisition work is improved; (2) The application layer and the serial port layer realize data interaction through data information, data elements contained in the data information are format data used for collecting the APP, the application layer data organization logic is complied with, the APP is not required to be collected for adaptation, meanwhile, the conversion between the data information and the serial port communication message is automatically completed by the serial port layer, the APP is collected by the application layer only needs to process complete data, the bottom details such as serial port type, serial port drive and message generation are not required to be concerned, and development difficulty is greatly reduced; (3) The byte stream without logic meaning is adopted between the serial port layer and the physical layer for data interaction, so that the dependence on hardware is reduced, and the portability is high.
Drawings
FIG. 1 is a system frame diagram of the present invention;
FIG. 2 is a schematic diagram of a transmission flow;
fig. 3 is a schematic diagram of a receiving process.
Detailed Description
The technical scheme of the invention is described in detail below with reference to the accompanying drawings:
the embodiment discloses an energy controller serial port management method, which is used for realizing communication between an acquisition APP and serial port equipment.
As in fig. 1, the system sets an application layer, a serial layer, and a physical layer. The acquisition APP (which may be a plurality of acquisition-related APPs) is located at the application layer. The serial device is located at the physical layer, and not only comprises 485, carrier wave, bluetooth and other physical devices which communicate with the master control board of the seed energy controller through serial ports, but also comprises a virtual serial port of the bottom APP structure.
The serial port layer is a core of the invention and is used for receiving a request of the application layer, calling a serial port driver to complete data interaction with the physical layer according to the content of the request, and then transmitting the data needed by the application layer back to the application layer.
The application layer and the serial port layer interact through information flow, and the serial port layer and the physical layer interact through byte flow.
The data in the information stream is logically significant data for an application layer, and includes constraint information, control information and data information:
the constraint information is used for controlling the communication state between the serial port layer and the physical layer. The communication between the serial layer and the physical layer operates in the form of a state machine. The constraint information includes state jump conditions, such as ST0 (initialization state), ST1 (reception buffer state), ST2 (frame search state), etc., for the data reception state machine.
The control information comprises a plurality of preset data conversion rules, and is used for controlling the serial port layer to carry out bidirectional conversion between data elements in the data information and communication messages transmitted by byte streams.
The data information is used for transmitting data elements, and the data elements are format data used for collecting APP. Besides data elements in specific formats such as voltage, current, electric energy and the like, the data element identification method also comprises information such as unique data element identification, data time marks, data states and the like.
The serial port layer comprises an interface sub-layer, a management sub-layer and a driving sub-layer.
The interface sub-layer comprises a constraint management module, an event processing module and a message forwarding module.
The management sublayer comprises a flow control module, a data buffer module and a message queue module.
The driving sub-layer comprises an RXD data receiving module and a TXD data sending module, and is used for realizing data interaction with the physical layer by calling a serial port driver.
The constraint management module is used for forwarding constraint information in the information flow to the management sub-layer; the event processing module is used for forwarding control information in the information flow to the management sublayer; the message forwarding module is used for forwarding the data information in the information flow to the message queue module and sending the data information in the message queue module to the acquisition APP through the information flow.
The flow control module is used for extracting data elements from the data information in the message queue module according to the conversion rule in the control information, and putting the data elements into the data buffer module to form a message; the message in the data buffer module is converted into a data element according to a conversion rule in the control information, and the data element is packaged into data information and stored in the message queue module; and the communication state between the serial port layer and the physical layer is controlled according to the constraint information.
Furthermore, the flow control module is also used for carrying out rule judgment on the data information content, such as framing rules, frame length calculation rules and the like.
Preferably, before communicating with the serial port layer, the acquisition APP firstly puts forward a registration application to the serial port layer, and after successful registration, the serial port layer establishes an information flow channel for the registered acquisition APP, so as to realize information flow interaction between the acquisition APP and the serial port layer.
For a complete data transmission or reception process, a plurality of data elements are required, which are included in a plurality of data information. The data information is stored in the message queue module and is converted into serial communication messages through the data element which is an intermediate data form.
As shown in fig. 2, when the acquisition APP sends data to the physical layer, the acquisition APP sends constraint information, control information and data information to the interface sub-layer through an information flow, the constraint management module and the event processing module respectively forward the constraint information and the control information to the management sub-layer, and meanwhile, the message forwarding module forwards the data information to the message queue module; the management sub-layer builds a flow control module according to the constraint information and the control information, then the flow control module extracts data elements from the data information in the message queue module according to the conversion rule in the control information, then the data elements are formed into a message to be put into the data buffer module, and then the flow control module controls the TXD data transmission module of the driving sub-layer to transmit the message in the data buffer module to the physical layer according to the constraint information.
As shown in fig. 3, when the acquisition APP receives data from the physical layer, the acquisition APP transmits constraint information and control information to the interface sub-layer through an information flow, and the constraint management module and the event processing module forward the constraint information and the control information to the management sub-layer respectively; the management sub-layer builds a flow control module according to constraint information and control information, then the flow control module controls an RXD data receiving module of the driving sub-layer to store messages sent by the physical layer to a data buffer module according to constraint information, the flow control module converts the messages in the data buffer module into data elements according to a conversion rule in the control information, the data elements are packaged into data information and stored in a message queue module, and then a message forwarding module forwards the data information in the message queue module to an acquisition APP.

Claims (9)

1. The serial port management method of the energy controller is used for realizing communication between the acquisition APP and the serial port equipment, and is characterized in that: setting an application layer, a serial port layer and a physical layer; the acquisition APP is located at an application layer, and the serial device is located at a physical layer; the serial port layer is used for receiving a request of the application layer, calling the serial port driver to complete data interaction with the physical layer according to the content of the request, and then returning data needed by the application layer to the application layer.
2. The energy controller serial port management method of claim 1, wherein: the application layer and the serial port layer interact through information flow, and the serial port layer and the physical layer interact through byte flow.
3. The energy controller serial port management method of claim 2, wherein: the information flow comprises constraint information, control information and data information;
the constraint information is used for controlling the communication state between the serial port layer and the physical layer;
the control information is used for controlling the serial port layer to convert the data elements in the data information and the communication messages transmitted by the byte stream;
the data information is used for transmitting data elements, and the data elements are format data used for collecting APP.
4. The energy controller serial port management method of claim 3, wherein: the communication between the serial port layer and the physical layer operates in a state machine mode, and the constraint information comprises state jump conditions.
5. The energy controller serial port management method of claim 4, wherein: the serial port layer comprises an interface sub-layer, a management sub-layer and a driving sub-layer;
the interface sub-layer comprises a constraint management module, an event processing module and a message forwarding module;
the management sublayer comprises a flow control module, a data buffer module and a message queue module;
the driving sub-layer comprises an RXD data receiving module and a TXD data sending module, and is used for realizing data interaction with the physical layer by calling a serial port driving program;
the constraint management module is used for forwarding constraint information in the information flow to the management sublayer, the event processing module is used for forwarding control information in the information flow to the management sublayer, the message forwarding module is used for forwarding data information in the information flow to the message queue module and also used for sending the data information in the message queue module to the acquisition APP through the information flow;
the flow control module is used for extracting data elements from the data information in the message queue module according to the conversion rule in the control information, and putting the data elements into the data buffer module to form a message; the message in the data buffer module is converted into a data element according to a conversion rule in the control information, and the data element is packaged into data information and stored in the message queue module; and the communication state between the serial port layer and the physical layer is controlled according to the constraint information.
6. The energy controller serial port management method of claim 5, wherein: when the acquisition APP sends data to the physical layer, the acquisition APP sends constraint information, control information and data information to the interface sub-layer through an information flow, the constraint management module and the event processing module respectively forward the constraint information and the control information to the management sub-layer, and meanwhile, the message forwarding module forwards the data information to the message queue module; the management sub-layer builds a flow control module according to the constraint information and the control information, then the flow control module extracts data elements from the data information in the message queue module according to the conversion rule in the control information, then the data elements are formed into a message to be put into the data buffer module, and then the flow control module controls the TXD data transmission module of the driving sub-layer to transmit the message in the data buffer module to the physical layer according to the constraint information.
7. The energy controller serial port management method of claim 5, wherein: when the acquisition APP receives data from the physical layer, the acquisition APP transmits constraint information and control information to the interface sub-layer through an information flow, and the constraint management module and the event processing module respectively forward the constraint information and the control information to the management sub-layer; the management sub-layer builds a flow control module according to constraint information and control information, then the flow control module controls an RXD data receiving module of the driving sub-layer to store messages sent by the physical layer to a data buffer module according to constraint information, the flow control module converts the messages in the data buffer module into data elements according to a conversion rule in the control information, the data elements are packaged into data information and stored in a message queue module, and then a message forwarding module forwards the data information in the message queue module to an acquisition APP.
8. The energy controller serial port management method according to any one of claims 1 to 7, wherein: before the acquisition APP communicates with the serial port layer, a registration application is put forward to the serial port layer, and after registration is successful, the serial port layer establishes an information flow channel for the registered acquisition APP, so that information flow interaction between the acquisition APP and the serial port layer is realized.
9. The energy controller serial port management method according to any one of claims 1 to 7, wherein: the physical layer also comprises a virtual serial port constructed by the bottom layer APP.
CN202310900879.4A 2023-07-21 2023-07-21 Energy controller serial port management method Active CN116610467B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310900879.4A CN116610467B (en) 2023-07-21 2023-07-21 Energy controller serial port management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310900879.4A CN116610467B (en) 2023-07-21 2023-07-21 Energy controller serial port management method

Publications (2)

Publication Number Publication Date
CN116610467A true CN116610467A (en) 2023-08-18
CN116610467B CN116610467B (en) 2023-10-20

Family

ID=87678697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310900879.4A Active CN116610467B (en) 2023-07-21 2023-07-21 Energy controller serial port management method

Country Status (1)

Country Link
CN (1) CN116610467B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1376985A (en) * 2001-03-23 2002-10-30 中国科学院沈阳自动化研究所 Field bus network controller
CN1617465A (en) * 2003-11-11 2005-05-18 中国科学院沈阳自动化研究所 Bluetooth wireless sensor
US20070047535A1 (en) * 2005-08-31 2007-03-01 Intel Corporation Switching device utilizing flow-control management
CN101572702A (en) * 2009-05-27 2009-11-04 大连理工计算机控制工程有限公司 Method for scheduling high-speed bus master and slave network communication
CN101599971A (en) * 2009-07-17 2009-12-09 中国电力科学研究院 A kind of communication management device of series compensation device and management method thereof
CN106708762A (en) * 2015-11-18 2017-05-24 厦门雅迅网络股份有限公司 Unified management system and method for serial devices in LINUX
CN106802869A (en) * 2017-01-17 2017-06-06 东方网力科技股份有限公司 The driving model and drive system of class serial equipment
CN116500942A (en) * 2023-04-27 2023-07-28 科大智能科技股份有限公司 System, method and storage medium for managing APP control by serial port of mining terminal

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1376985A (en) * 2001-03-23 2002-10-30 中国科学院沈阳自动化研究所 Field bus network controller
CN1617465A (en) * 2003-11-11 2005-05-18 中国科学院沈阳自动化研究所 Bluetooth wireless sensor
US20070047535A1 (en) * 2005-08-31 2007-03-01 Intel Corporation Switching device utilizing flow-control management
CN101572702A (en) * 2009-05-27 2009-11-04 大连理工计算机控制工程有限公司 Method for scheduling high-speed bus master and slave network communication
CN101599971A (en) * 2009-07-17 2009-12-09 中国电力科学研究院 A kind of communication management device of series compensation device and management method thereof
CN106708762A (en) * 2015-11-18 2017-05-24 厦门雅迅网络股份有限公司 Unified management system and method for serial devices in LINUX
CN106802869A (en) * 2017-01-17 2017-06-06 东方网力科技股份有限公司 The driving model and drive system of class serial equipment
CN116500942A (en) * 2023-04-27 2023-07-28 科大智能科技股份有限公司 System, method and storage medium for managing APP control by serial port of mining terminal

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KENICHI KOURAI 等: ""Secure Out-of-Band Remote Management Using Encrypted Virtual Serial Consoles in IaaS Clouds"", 《2015 IEEE TRUSTCOM/BIGDATASE/ISPA》 *
汤少维;: "基于EPM7064的多串口管理系统设计", 现代电子技术, no. 04 *

Also Published As

Publication number Publication date
CN116610467B (en) 2023-10-20

Similar Documents

Publication Publication Date Title
EP1841162B1 (en) Method and system for an os virtualization-aware network interface card
US9703595B2 (en) Multi-core system with central transaction control
CN101572702B (en) Method for scheduling high-speed bus master and slave network communication
CN102070051B (en) Elevator running performance real-time monitoring system
CN102411539B (en) A kind of outer handset equipment on-line adjustment method and system
CN101565866B (en) Rotor spinning machine full automatic joint control method and device thereof
CN109548051A (en) Wireless data transmission of internet of things method and terminal
CN110851252A (en) Protocol conversion equipment and protocol conversion method based on TSN (traffic service network) architecture
CN116610467B (en) Energy controller serial port management method
CN111443659A (en) Remote monitoring control system for numerical control machine tool
CN108319219A (en) The Distributed Control System and the means of communication of locomotive element packaging production line
CN110262989B (en) Multifunctional communication converter and communication method
CN102073344A (en) Blade server management module with wireless module and blade server system
CN102323902B (en) Debugging system with analog audio output device
CN202870525U (en) Networked data acquisition apparatus applied to changing environment
CN103034543A (en) Communication method among multiple software operating environments and method for enabling multiple software operating environments to communicate
CN111586182B (en) Data transmission method and device
CN111930645B (en) TCPIP-based universal USB equipment network transparent transmission system and method
CN210155636U (en) Acquisition control device based on Ethernet interface DCC keyboard
CN113905363B (en) Locomotive emergency radio station portable display system based on wireless mode and implementation method
WO2015013920A1 (en) Data forwarding method, device and system
CN110505136B (en) Layered MODBUS communication system and method
CN116962112B (en) Double-machine full duplex data transparent transmission method based on standard SPI bus connection
CN102591222B (en) Signal processing output method of signal isolation converter
CN116455795A (en) Network message packet capturing method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant