CN110166485A - A kind of the scheduling application method and device of agreement - Google Patents

A kind of the scheduling application method and device of agreement Download PDF

Info

Publication number
CN110166485A
CN110166485A CN201910515854.6A CN201910515854A CN110166485A CN 110166485 A CN110166485 A CN 110166485A CN 201910515854 A CN201910515854 A CN 201910515854A CN 110166485 A CN110166485 A CN 110166485A
Authority
CN
China
Prior art keywords
interface
port
data
environment
package
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
CN201910515854.6A
Other languages
Chinese (zh)
Other versions
CN110166485B (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.)
Beijing Jingwei Hirain Tech Co Ltd
Original Assignee
Beijing Jingwei Hirain Tech 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 Beijing Jingwei Hirain Tech Co Ltd filed Critical Beijing Jingwei Hirain Tech Co Ltd
Priority to CN201910515854.6A priority Critical patent/CN110166485B/en
Publication of CN110166485A publication Critical patent/CN110166485A/en
Application granted granted Critical
Publication of CN110166485B publication Critical patent/CN110166485B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The dispatching method and device of agreement provided by the invention construct graphic interface and first from package interface in advance, and first from the scheduling relation information that package interface includes between N number of first protocol interface, and N is more than or equal to 1;Graphic interface is realized based on first environment, and first is realized from package interface, the first protocol interface based on second environment;On this basis, the interface parameter needed for being configured based on graphic interface, and required protocol interface is called from package interface by calling.The present invention realizes the graphical operation called to agreement, while difficulty and error rate when greatly reducing the protocol stack using second environment, reduces the code capacity requirement to practitioner.

Description

A kind of the scheduling application method and device of agreement
Technical field
The invention belongs to vehicle-mounted ethernet technology field more particularly to the scheduling application methods and device of a kind of agreement.
Background technique
With the development of intelligent driving technology, ethernet technology is based particularly on the middleware Technology of Ethernet in intelligence In driving field using more and more, wherein ZeroMQ is made due to the characteristics such as the high-performance of its own, distribution, cross-platform It shows one's talent in numerous middleware Technologies, is widely used in the research and development of intelligent driving, the processes such as test.
In traditional automotive field, user in the R&D process of intelligent driving control algolithm if necessary to use ZeroMQ protocol stack, it usually needs according to the Open Source Code of ZeroMQ, dispatched by writing corresponding calling logic code and Use ZeroMQ protocol stack.It is developed however, the control algolithm of intelligent driving is typically based on Matlab Simulink, and ZeroMQ Protocol stack is realized based on C Plus Plus code, and Matlab and traditional C/C++ are in grammer (definition of such as pointer, data type Etc.), constraint etc. there is corresponding difference, this result in ZeroMQ protocol stack in orthodox car industry application simultaneously Less friendly, there are ZeroMQ protocol stacks to call complicated error-prone, to practitioner code capacity requirement in use The problems such as high.
To, how to provide one in a kind of environment (such as above-mentioned Matlab environment) to based on another environment (such as Above-mentioned C++ environment) protocol stack realized carry out using solution so that this is realized based on another environment The use process simplicity of protocol stack, close friendization become current technical problem urgently to be resolved.
Summary of the invention
In view of this, the purpose of the present invention is to provide the scheduling application method and device of a kind of agreement, to solve one Existing calling complicated code capacity error-prone, to practitioner when in kind environment using the protocol stack based on another environment It is required that the problems such as high, so that by the calling process simplicity of the protocol stack realized based on another environment, close friendization.
For this purpose, the present invention is disclosed directly below technical solution:
A kind of scheduling application method of agreement, comprising:
Obtain the interface parameter configured in graphic interface;
Based on the interface parameter, call by corresponding process flow first from package interface;
Based on described first from package interface, call with described first from corresponding N number of first protocol interface of package interface;
Wherein, the graphic interface and described first constructs in advance from package interface, and described first from package interface In include scheduling relationship between N number of first protocol interface, N is integer more than or equal to 1;
The graphic interface realizes that described first is based on from package interface and first protocol interface based on first environment Second environment is realized.
The above method, it is preferred that the graphic interface includes: transmission interface for sending data information and for receiving The receiving interface of data information;
The quantity of the transmission interface is at least one, for sending message packet to identical or different port respectively;
The quantity of the receiving interface is at least one, for receiving the Izvestia of identical or different port transmission respectively Text.
The above method, it is preferred that the message packet is in advance according to message format defined in Json document form;
The message format includes message header and message body, and the message header includes that data/address bus type, data are transmitted One of channel and data type are a variety of, and the message body includes timestamp, the nodename, data that message forms the time In tranceive type, the Internet protocol address of node, the port numbers of data transmission, the length of data packet and useful load information It is one or more.
The above method, it is preferred that the graphic interface further include: configuration interface, the configuration interface and the port one One is corresponding;
The configuration interface is for port descriptor needed for generating data information transfer;The port descriptor is described The address information of port descriptor is stored in global memory, so that at least one transmission interface with identical port requirements is total Enjoy use.
The above method, it is preferred that the transmission interface sends message packet, comprising:
The port descriptor is obtained from global memory, alternatively, obtaining the port descriptor from global memory Address information simultaneously obtains the port descriptor based on the address information;
Based on the port descriptor, the message packet is sent to required port using respective protocol.
The above method, it is preferred that the address information that the port descriptor is obtained from global memory, comprising:
The identification information of port descriptor needed for obtaining;
The address information for corresponding to the port descriptor of the identification information, the address information are obtained from global memory Data type be the first data type corresponding to the first environment;
It is the second data type by the data type conversion of the address information, second data type is corresponding to institute State the second data type of second environment.
The above method, it is preferred that the first environment includes Matlab environment, and the second environment includes C++ environment.
A kind of scheduling use device of agreement, comprising:
Acquiring unit, for obtaining the interface parameter configured in graphic interface;
First call unit, for being based on the interface parameter, by corresponding process flow calling first from package interface;
Second call unit, for, from package interface, being called corresponding from package interface with described first based on described first N number of first protocol interface;
Wherein, the graphic interface and described first constructs in advance from package interface, and described first from package interface In include scheduling relationship between N number of first protocol interface, N is integer more than or equal to 1;
The graphic interface realizes that described first is based on second from package interface and the first protocol interface based on first environment Environment is realized.
Above-mentioned apparatus, it is preferred that the graphic interface includes: transmission interface for sending data information and for receiving The receiving interface of data information;
The quantity of the transmission interface is at least one, for sending message packet to identical or different port respectively;
The quantity of the receiving interface is at least one, for receiving the Izvestia of identical or different port transmission respectively Text.
Above-mentioned apparatus, it is preferred that the graphic interface further include: configuration interface, the configuration interface and the port one One is corresponding;
The configuration interface is for port descriptor needed for generating data information transfer;The port descriptor is described The address information of port descriptor is stored in global memory, so that at least one transmission interface with identical port requirements is total Enjoy use.
As it can be seen from the above scheme the scheduling application method and device of agreement provided by the invention, construct figure in advance and connect Mouthful and first from package interface, constructed first from package interface include N number of (integer more than or equal to 1) first protocol interface Between scheduling relation information;The graphic interface realizes that described first from package interface, the first protocol interface based on first environment It is realized based on second environment;On this basis, can based on the form of graphic interface configure needed for each interface parameter, and by pair The calling to required one or more protocol interfaces is realized from the calling of package interface.It can be seen that the present invention realizes To the graphical operation that agreement is called, and realize the complicated scheduling relation information envelope of protocol interface each in predetermined protocol stack It is more succinct from package interface for filling, so that may make need not write in first environment to the original agreement stack of second environment The complicated calling code of each protocol interface, only to the more succinct design for being called code from package interface, significantly The difficulty and error rate used protocol stack is reduced, is reduced to the requirement of the code capacity of practitioner, may make described the The use process of the protocol stack of two environment more simplicity, close friendization.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of the scheduling application method of agreement provided in an embodiment of the present invention;
Fig. 2 is transmission interface provided in an embodiment of the present invention, from each protocol interface of package interface and ZeroMQ protocol stack Between call relation schematic diagram;
Fig. 3 is a kind of message format example of the CAN message information provided in an embodiment of the present invention suitable for automobile industry;
Fig. 4 is the patterned realization process schematic of ZeroMQ protocol stack provided in an embodiment of the present invention;
Fig. 5 is the implementation process schematic diagram that transmission interface provided in an embodiment of the present invention sends message packet;
Fig. 6 (a) is the feelings of port collision caused when multiple transmission interfaces need to send data to the same port simultaneously Condition schematic diagram;
Fig. 6 (b) is that the configuration interface provided in an embodiment of the present invention by creation realizes multiple transmission interfaces simultaneously to same The schematic diagram of a port transmission data;
Fig. 7 is provided in an embodiment of the present invention to assist based on three classes graphic interface of the invention and from package interface to ZeroMQ View interface is called and then uses the schematic illustration of ZeroMQ agreement;
Fig. 8 is a kind of structural schematic diagram of the scheduling use device of agreement provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
The present invention provides the scheduling application methods and device of a kind of agreement, it is intended to solve in automotive field in first environment Protocol stack (the ZeroMQ agreement such as realized based on C++ environment realized based on second environment is used in (such as MATLAB environment) Stack etc., wherein agreement included by ZeroMQ protocol stack and corresponding protocol interface are based on the realization of C++ environment) when it is existing Calling it is complicated it is error-prone, the problems such as high, is required to the code capacity of practitioner so that the use process by protocol stack is succinct Change, close friendization, this method and device are applicable to but are not limited to the vehicle data based on acquisition to the control algolithm of intelligent driving In the application scenarios developed, tested and verified, the scheduling of agreement of the invention will be used by specific embodiment below Method and device is described in detail.
It is a kind of flow chart of the scheduling application method of agreement provided in an embodiment of the present invention, in the present embodiment with reference to Fig. 1 In, as shown in Figure 1, the scheduling application method of the agreement includes following treatment process:
Step 101 obtains the interface parameter configured in graphic interface.
The present embodiment will be mainly with right in Matlab environment (environment commonly used by the control algolithm research and development of intelligent driving) For being scheduled use based on the ZeroMQ protocol stack that C++ environment is realized, the solution of the present invention is illustrated, wherein ZeroMQ refers to a series of interfaces similar to Socket, is mainly used for data transmission.
In order to enable close friendization, the present invention is in advance in first environment by the use process simplicity of the protocol stacks such as ZeroMQ As Matlab environment corresponding software tool (such as Matlab Simulink) in construct multiple figures towards ZeroMQ protocol stack Shape interface S-Function, corresponding to when being transmitted using the ZeroMQ protocol stack to data data receive (reception), (transmission) two types are sent out, the graphic interface includes at least following two:
1) for sending the transmission interface (sfunc_zmqTransmit) of data information
The quantity of the transmission interface is at least one, for sending message packet to identical or different port respectively.
2) receiving interface (sfunc_zmqRcv) of information for receiving data
The quantity of the receiving interface is at least one, for receiving the Izvestia of identical or different port transmission respectively Text.
In specific implementation, each type of graphic interface can construct one or more in advance according to actual needs, described Transmission interface and the receiving interface are respectively provided with multiple interface parameters, so that user is in the process demand for having data information It is configured when (such as to the transmission process demand of data information or reception process demand), wherein the transmission interface (sfunc_zmqTransmit) and each interface parameter provided by the receiving interface (sfunc_zmqRcv) and each interface parameter Associated description information, source-information specifically refer to example provided by following table 1:
Table 1
When user need to use respective graphical interface, required graphic interface can be called based on corresponding operating, is called Graphic interface can be the transmission interface or the receiving interface.
It, can be by user further according to actual needs in the graphic interface called after graphic interface needed for calling The configuration for carrying out interface parameter then can get and match on the transmission interface so that the graphic interface called is transmission interface as an example IP (Internet Protocol, Internet protocol) address, port, transmission timeout parameter, message class in the above-mentioned table 1 set The parameter value of each interface parameters such as type, channel, message id (Identity, identity number), message size, wherein each The mode that Json configuration file specifically can be used in the parameter value of interface parameter carries out configuration acquisition.
The parameter value of acquired each interface parameter can to data information carry out transmission process (as send data information or Receive data information) when use.
Wherein, received data information can be the vehicle data from automobile, the vehicle data may include but It is not limited to CAN data message or Ethernet data message provided by each monitoring part (radar, camera etc.) on automobile, Transmitted data information can be the corresponding control algolithm of exploitation to gained after vehicle data progress relevant treatment Result data.
Step 102 is based on the interface parameter, by corresponding process flow calling first from package interface;Wherein, described Graphic interface and described first constructs in advance from package interface, and described first includes described N number of first from package interface Scheduling relationship between protocol interface, N are the integer more than or equal to 1.
Specifically, the application constructs at least one from package interface in advance, includes: each predetermined protocol from package interface Scheduling relation information between at least one protocol interface of stack, and each the second environment such as C/C++ is based on from package interface Environment is realized;The process flow includes multiple processing links, at least one link needs pair in the multiple processing links What is constructed in advance is called from first in package interface from package interface;Described first from package interface be based on the boundary Face parameter, when handling by corresponding process flow to corresponding link, called needed for the link from package interface.
First protocol interface is the N number of protocol interface for having from package interface corresponding relationship with first.It is described at least one Scheduling relation information between one protocol interface can include but is not limited to described corresponding N number of from package interface with described first Adduction relationship information between protocol interface and/or successively execute order information.The process flow can be data sending processing Process or data receiver process flow, to send data instance, according to the constraint that Matlab is provided, the flow chart of data processing May include graphic interface operation when resource distribution (mdlSetupRuntimeResources), initialization (mdlStart), The output of data information sends resource release when (mdlOutputs), graphic interface operation (mdlCleanRuntimeResources) and terminate (mdlStop) these processing links.
At least one link in above-mentioned each processing links need to by call ZeroQM protocol stack in respective protocol come The processing of the link is realized, for example, resource distribution when above-mentioned graphic interface is run (mdlSetupRuntimeResources) link need to call mq::init () (initialization) in ZeroQM protocol stack and Zmq::bind () (binding) the two agreements API (compile by Application Programming Interface, application program Journey interface) come processing needed for realizing the link;The output of data information, which sends (mdlOutputs) link, need to call ZeroQM Zmq::poll () (waiting-timeout), zmq::encode_header () (header file coding), zmq: in protocol stack: Encode_data () (data encoding), zmq::send () (transmission) these agreements API are come place needed for realizing the link Reason;Resource release (mdlCleanRuntimeResources) link when graphic interface is run need to call mq::close () (closing) agreement API is come processing needed for realizing the link etc..
The control algolithm of intelligent driving is typically based on Matlab Simulink exploitation, and ZeroMQ agreement is based on C++ language Say what code was realized, Matlab and traditional C/C++ are in the grammer definition of such as pointer (, in terms of), constraint side There is corresponding difference in face, this results in application of the ZeroMQ protocol stack in orthodox car industry not too much friendly.Specific table It is existing are as follows: on the one hand, the api interface form (i.e. protocol interface) that ZeroMQ protocol stack provides not necessarily connects convenient for the figure of Matlab Mouth S-Function is called;On the other hand, the graphic interface S-Function of Matlab may call ZeroMQ protocol stack Multiple api interfaces, so that calling process seems cumbersome.
In addition, S-Function, which as the graphic interface under Matlab environment, does not require nothing more than user, is familiar with S-Function Frame from the ease for use of exploitation and can safeguard there is also coding bound and many restrictions of the use aspect of data type Property angle consider, try not to make S-Function excessive modification, based in terms of these, in order to enable in Matlab More convenient succinct to the agreement calling for the ZeroMQ protocol stack realized based on C++ environment under environment, the invention proposes right The protocol interface of ZeroMQ protocol stack carries out technical thought of the further API from encapsulation based on C++ environment, and is specifically based on Logic association between each protocol interface of ZeroMQ protocol stack will be associated with stronger each protocol interface and be packaged as a whole to form one It is a from package interface (from abstract API), and adduction relationship and/or elder generation between each protocol interface are being embodied from package interface The scheduling relation information such as execution sequence afterwards finally obtains and is packaged at least one protocol interface respectively and its dispatches relation information It is multiple from package interface.Specifically, resource distribution when for example, can be by the operation of above-mentioned graphic interface (mdlSetupRuntimeResources) mq::init () and the two agreements of zmq::bind () API called needed for link And its scheduling relation information is packaged as a whole to obtain from package interface zmqServerOn (), and the output of data information is sent (mdlOutputs) zmq::poll (), the zmq::encode_header (), zmq::encode_data called needed for link (), these agreements of zmq::send () API are packaged as a whole to obtain from package interface zmqSend (), and graphic interface is run When resource release (mdlCleanRuntimeResources) link need to call mq::close () this agreement API encapsulation For one from package interface zmqServerOff () etc..
By each protocol interface of ZeroMQ protocol stack be further encapsulated as it is each from package interface on the basis of, when The figure that transmission interface (sfunc_zmqTransmit), receiving interface (sfunc_zmqRcv) etc. are carried out under Matlab environment connects Mouthful design when, it is only necessary to design wherein to accordingly from package interface (based on C++ environment realize) calling code, without Code is called to be designed the complicated of each protocol interface of ZeroMQ protocol stack (realizing based on C++ environment) again;And either The modification of ZeroMQ protocol stack or upgrade, it is only necessary to modify to ZeroMQ own protocol interface and/or to from package interface Correlative code is modified, the code without modifying graphic interface S-Function, as a result, by ZeroMQ protocol stack Protocol interface further from encapsulation advantage it is apparent.
With reference to table 2 below, table 2 shows and manages corresponding to link everywhere in transmission interface (sfunc_zmqTransmit) From package interface, and respectively each protocol interface of the corresponding ZeroQM protocol stack encapsulated of package interface:
Table 2
Specifically, when the processing links that the process flow includes need the corresponding association of invocation protocol stack such as ZeroMQ protocol stack When discussing interface, the present invention does not directly carry out writing and modifying for code to calling process, but calls and correspond to required agreement The first of interface is from package interface, by taking processing links is resource distribution (mdlSetupRuntimeResources) links as an example, Then specifically call the zmqServerOn () from package interface when execution to the link, similarly, if described need to call from encapsulation The corresponding link of interface is that the output of the data information sends (mdlOutputs) link, then specifically adjusts when execution to the link With zmqSend () from package interface, if it is described need to call from the link of package interface be the graphic interface operation when resource (mdlCleanRuntimeResources) link is discharged, then specifically calls the zmqServerOff when execution to the link () is from package interface.
Step 103, based on described first from package interface, call with described first from package interface corresponding N number of first Protocol interface.
Shown in table 2 as above, by first from package interface for zmqServerOn () for, the first protocol interface includes at this time Two, be zmq::init () and zmq::bind () respectively.
First from package interface includes simultaneously scheduling relation information between N number of first protocol interface, with reference to Fig. 2 shows Transmission interface, from the call relation schematic diagram between each protocol interface of package interface and ZeroMQ protocol stack, calling can be passed through The corresponding link need to call first from package interface, to further realize to need to call first from package interface The calling of corresponding each first protocol interface, reference table 2 are sent with the output that the corresponding link is the data information (mdlOutputs) it for, then by the calling to the zmqSend (), can further realize to the ZeroMQ protocol stack Zmq::poll (), zmq::encode_header (), zmq::encode_data (), zmq::send () these agreements The calling of interface, so can based on the calling to these protocol interfaces, realize to required waiting-timeout, header file coding, The use of the agreements such as data encoding, data transmission.
The zmqSend () shown in the above-mentioned table 2 this from package interface for, if not using this from package interface, When carrying out data transmission using transmission interface (sfunc_zmqTransmit), the zmq: for first calling ZeroMQ protocol stack is necessarily needed: Poll () protocol interface, then successively zmq::encode_header (), the zmq::encode_data of invocation protocol stack again The protocol interfaces such as (), zmq::send () successively realize that header file coding, data encoding and data such as send at the processing, it is clear that association The calling for discussing interface is relatively complicated, calls code accordingly more complex, in addition to meeting the characteristic of waiting-timeout, it is also necessary to The decision logic code to event Event is added in the graphic interface S-Function of Matlab, to involve additionally In addition to this size of code calls directly these protocol interfaces in the graphic interface S-Function of Matlab, it is also necessary to scheme The header file of these protocol interfaces is additionally added in shape interface S-Function, this meeting so that graphic interface to the whole of protocol interface The design of a calling process is more complex, and use it is of the invention it is above-mentioned from encapsulation technical thought to each protocol interface of protocol stack into Row is above-mentioned from after encapsulating, and can be good at solving these problems.
Based on above scheme it is found that the present embodiment realizes the graphical operation called to agreement, and realizing will be predetermined The complicated scheduling relation information encapsulation of each protocol interface is in protocol stack in order to more succinct from package interface, to may make It need not be write in first environment and code is called to the complicated of each protocol interface of the original agreement stack of second environment, only to more For the succinct design for being called code from package interface, the difficulty and error used protocol stack is greatly reduced Rate reduces the code capacity requirement to practitioner, may make the use process of the protocol stack of the second environment more simple Clean, close friendization.
In an alternative embodiment of the invention, the transmission interface, specifically will be to be sent when sending message packet Data information is encapsulated as the message packet of predefined format, and sends the message packet.
ZeroMQ protocol stack is top-level protocol stack, relatively more abstract to the definition of message in order to guarantee its universality, not fixed The type of the data field of justice specification and its analysis mode and method, user's self-defining is needed in practical application.Specifically Ground, in practical applications, user only need to define the IP address of message, source port and destination port, it can carry out data Transmitting-receiving, does not standardize the specific business tine of data, and the present invention is in order to enable ZeroMQ message can better adapt to Automobile industry develops common data type, such as CAN message and Ethernet message etc., using Json file to ZeroMQ It is customized that the message of transmission has carried out format.
CAN message would generally be comprising such as properties:
The channel CAN_Channel/CAN: without specification;
CAN_ID/CAN message ID: less than 3 byte (CAN standard frame);
CAN_MSG_DLC/CAN message length: 1 byte;
CAN_DataPayload/CAN message data content: 1~8 byte;
Ethernet message would generally be comprising such as properties:
The channel Eth_Channel/Eth: without specification;
Eth_PDU_ID/PDU message ID:4 byte;
Eth_PDU_Length/PDU message length: 4 bytes;
Eth_PDU_DataPayload/PDU data content: 0~1464 byte.
It according to the above characteristic, is abstracted, can be by ZeroMQ message format definition includes message header and message body.
It, can be by each field of the ZeroMQ message in Json file by taking the general CAN message information of automobile industry as an example It is defined as one of including but not limited to following field or a variety of:
<NodeName>: nodename;
<NodeType>: sending or receives;
<Endpoint>: node IP address;
<Port>: the port numbers of data transmission;
<BusType>: data/address bus type;
<Channel>: the channel of data transmission;
<ID>: data type, CAN data or Ethernet data;
<PayloadSize>: the length of data packet;
<Payload>: useful load information;
<TimeStamp>: the timestamp of message formation time;
Wherein, one of<BusType>,<Channel>and<ID>in above-mentioned each field or a variety of design can be existed In message header, and remaining each field be<NodeName>,<NodeType>,<Endpoint>,<Port>,<PayloadSize>, One of<Payload>and<TimeStamp>or a variety of can be designed in message body, show this hair with reference to Fig. 3, Fig. 3 A kind of message format example defined in bright suitable for the CAN message information of automobile industry.
On the basis of the message packet to ZeroMQ carries out above-mentioned format definition, when handling data information, lead to It, can be based on corresponding association after crossing the self-styled attaching mouth for calling the corresponding link that need to call and realizing the calling to respective protocol interface View handles the data information, such as carries out delay waiting, coded treatment, and is finally encapsulated as processing result above-mentioned The message packet of predefined format, and then send the message packet, for example, will using corresponding control algolithm to vehicle data into Resulting result data is sent to by the predefined format for the result data from current PC machine after row relevant treatment In the PC machine tested, verified etc..
In specific implementation, as shown in figure 4, production Json configuration file (being used for describing Z eroMQ message), production can be passed through Graphic interface S-Function, for protocol stack protocol interface carry out from building of package interface etc., can finally pass through tune With from package interface invocation protocol interface, and then carry out data processing, aloow the message format of ZeroMQ preferably to fit Common communication data format (such as CAN/ Ethernet PDU) requirement with orthodox car industry.
In practical application scene, the quantity of the transmission interface under Matlab environment may be it is multiple, further may be used Can have multiple transmission interfaces needs the case where sending data to the same port simultaneously, as shown in Fig. 6 (a), transmission interface S- The port that it is 1.2.3.4 that function1, which is needed to IP address, port numbers are 1001 sends data Msg1 and data Msg2, and same When transmission interface S-function2 to also need to the IP address be 1.2.3.4, the port that port numbers are 1001 sends data Msg3 and data Msg4 is sending data however, being limited to the Resources Sharing Mechanism of the graphic interface S-function of matlab When, a S-function creates one, and for itself visible porthandle, (port descriptor is a C++ object, is sending out The port descriptor need to be used by sending when data) after, another S-function can not then create identical porthandle again, As a result, when multiple transmission interfaces need to send data to the same port simultaneously, the conflict of port will cause.
In order to solve this problem, it in an alternative embodiment of the invention, additionally provides a kind of for generating data information The configuration interface (sfunc_zmqSetup) of required port descriptor when transmission, that is, the graphic interface constructed in advance It can also include the configuration interface, the configuration interface is likewise provided with multiple configurable interface parameters, illustratively, institute The interface parameter for stating configuration interface can include but is not limited to the parameters such as node IP address, port, with reference to table 3 below, below Table 3 is exemplary to provide the configuration interface and two class interfaces (transmission interface, receiving interface) presented above of the present embodiment Interface parameter and its description information, source-information:
Table 3
Corresponding required port number is identical when the quantity of the configuration interface sends data with each transmission interface, to scheme For 6 (a) example, since transmission interface S-function1 and transmission interface S-function2 correspond to a port, thus As shown in Fig. 6 (b), it can be directed to S-function1, S-function2, create a configuration interface, the configuration created Interface is provided as the function of S-function1, S-function2 creation port descriptor porthandle, and can will be created Porthandle or the address information of the porthandle created deposit in the global memory of Matlab, since configuration connects The address information of the mouth porthandle created the or porthandle created is deposited in the global memory of Matlab, from And the address information of the porthandle or porthandle stored S-function1 and S- for example described for each transmission interface Function2 is visible, and is used for the S-function1 and S-function2 is shared.
Specifically, the port descriptor PortHandle identification information may be defined as IP address and end by required port The character string of slogan composition as shown in Fig. 6 (b), further can write power function such as mxSetData using one on this basis The address information of this PortHandle or this porthandle is written to the global memory (work of Matlab by () function Space memory) in.
In an alternative embodiment of the invention, the transmission interface with reference to shown in Fig. 5 sends the implementation process of message packet Schematic diagram, the transmission interface can specifically realize the transmission to message packet by treatment process below:
Step 501 obtains the port descriptor from global memory, alternatively, obtaining the port from global memory The address information of descriptor simultaneously obtains required port descriptor based on the address information;
Step 502 is based on the port descriptor, using agreement corresponding to respective protocol interface by the message packet It is sent to required port.
When needing to send data information to certain Single port, such as need to utilize transmission interface by the processing result of control algolithm The corresponding message packet of information is sent to another PC machine for being tested the processing result, being verified from current PC machine When port, then required end can be obtained from the global memory of Matlab according to the identification information of the PortHandle of required port Mouth descriptor, alternatively, institute can be obtained from the global memory of Matlab according to the identification information of the PortHandle of required port The address information of the PortHandle needed, and then required PortHandle is obtained based on the address information, on this basis, It can be finally based on the PortHandle, needed for the message packet being sent to using the respective protocol in ZeroMQ protocol stack Port;Wherein, the identification information of the port descriptor can be but not limited to the globally unique identifier of port descriptor.
It should be noted that the data type of the PortHandle address information stored in the global memory of Matlab is Suitable for the first data type of Matlab environment, and the address information of acquired PortHandle is finally for C++ environment What the respective protocol in lower ZeroMQ protocol stack used, thus need to by the data type of the address information of PortHandle, by The first data type conversion assigned in Matlab environment is the second number being matched with C++ environment, using for ZeroMQ agreement According to type.
It shows with reference to Fig. 7, Fig. 7 based on above-mentioned three classes graphic interface provided by the present invention and provided self-styled attaching Mouth is called and then uses the schematic illustration of ZeroMQ agreement to ZeroMQ protocol interface.
Configuration interface of the present embodiment by creation for port descriptor needed for generating data information transfer, and will match The address information for setting port descriptor or port descriptor that interface is created is deposited in the global memory of Matlab, is solved Multiple transmission interfaces need port collision problem when sending data to the same port simultaneously under Matlab environment, can effectively realize Data are sent to the same port simultaneously in multiple transmission interfaces in Matlab environment.
Corresponding to the scheduling application method of above-mentioned agreement, the embodiment of the invention also provides a kind of scheduling of agreement uses Device, the structural schematic diagram of the scheduling use device of the agreement with reference to shown in Fig. 8, the apparatus may include:
Acquiring unit 801, for obtaining the interface parameter configured in graphic interface;
First call unit 802 calls the first self-styled attaching by corresponding process flow for being based on the interface parameter Mouthful;
Second call unit 803, for from package interface, being called based on described first with described first from package interface pair N number of first protocol interface answered;
Wherein, the graphic interface and described first constructs in advance from package interface, and described first from package interface In include scheduling relationship between N number of first protocol interface, N is integer more than or equal to 1;
The graphic interface realizes that described first is based on second from package interface, the first protocol interface based on first environment Environment is realized.
In an optional embodiment of the embodiment of the present invention, the graphic interface includes: for sending data information The receiving interface of transmission interface and for receiving data information;The quantity of the transmission interface be at least one, for respectively to Identical or different port sends message packet;The quantity of the receiving interface be at least one, for receive respectively it is identical or The message packet of different port transmissions.
In an optional embodiment of the embodiment of the present invention, the message packet is in advance according to Json document form institute The message format of definition;
The message format includes message header and message body, and the message header includes that data/address bus type, data are transmitted One of channel, data type are a variety of, and the message body includes timestamp, the nodename, data that message forms the time In tranceive type, the Internet protocol address of node, the port numbers of data transmission, the length of data packet and useful load information It is one or more.
In an optional embodiment of the embodiment of the present invention, the graphic interface further include: configuration interface, the configuration Interface and the port correspond;
The configuration interface is for port descriptor needed for generating data information transfer;The port descriptor is described The address information of port descriptor is stored in global memory, so that at least one transmission interface with identical port requirements is total Enjoy use.
In an optional embodiment of the embodiment of the present invention, the transmission interface sends message packet, comprising:
Required port descriptor is obtained from global memory, alternatively, obtaining required port description from global memory The address information of symbol simultaneously obtains required port descriptor based on the address information;
Based on the port descriptor, the message packet is sent to institute using agreement corresponding to respective protocol interface The port needed.
In an optional embodiment of the embodiment of the present invention, the transmission interface obtains required end from global memory The address information of mouth descriptor, comprising:
Obtain the identification information of the port descriptor;
The address information for corresponding to the port descriptor of the identification information, the address information are obtained from global memory Data type be the first data type corresponding to the first environment;
It is the second data type by the data type conversion of the address information, second data type is corresponding to institute State the second data type of second environment.
For the scheduling use device of agreement disclosed by the embodiments of the present invention, since it is disclosed with each embodiment above Agreement scheduling application method it is corresponding, so be described relatively simple, related similarity refers to each embodiment above The explanation of the scheduling application method part of middle agreement, and will not be described here in detail.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
For convenience of description, it describes to be divided into various modules when system above or device with function or unit describes respectively. Certainly, the function of each unit can be realized in the same or multiple software and or hardware in carrying out the present invention.
As seen through the above description of the embodiments, those skilled in the art can be understood that the present invention can It realizes by means of software and necessary general hardware platform.Based on this understanding, technical solution of the present invention essence On in other words the part that contributes to existing technology can be embodied in the form of software products, the computer software product It can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that a computer equipment (can be personal computer, server or the network equipment etc.) executes the certain of each embodiment or embodiment of the invention Method described in part.
Finally, it is to be noted that, herein, such as first, second, third and fourth or the like relational terms It is only used to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying these There are any actual relationship or orders between entity or operation.Moreover, the terms "include", "comprise" or its is any Other variants are intended to non-exclusive inclusion, so that including the process, method, article or equipment of a series of elements Include not only those elements, but also including other elements that are not explicitly listed, or further includes for this process, side Method, article or the intrinsic element of equipment.In the absence of more restrictions, limited by sentence "including a ..." Element, it is not excluded that there is also other identical elements in the process, method, article or apparatus that includes the element.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (10)

1. a kind of scheduling application method of agreement characterized by comprising
Obtain the interface parameter configured in graphic interface;
Based on the interface parameter, call by corresponding process flow first from package interface;
Based on described first from package interface, call with described first from corresponding N number of first protocol interface of package interface;
Wherein, the graphic interface and described first constructs in advance from package interface, and described first wraps from package interface The scheduling relationship between N number of first protocol interface is included, N is the integer more than or equal to 1;
The graphic interface realizes that described first is based on second from package interface and first protocol interface based on first environment Environment is realized.
2. the method according to claim 1, wherein the graphic interface includes: for sending data information The receiving interface of transmission interface and for receiving data information;
The quantity of the transmission interface is at least one, for sending message packet to identical or different port respectively;
The quantity of the receiving interface is at least one, for receiving the message packet of identical or different port transmission respectively.
3. according to the method described in claim 2, it is characterized in that, the message packet is in advance according to Json document form institute The message format of definition;
The message format includes message header and message body, and the message header includes the channel of data/address bus type, data transmission And one of data type or a variety of, the message body include timestamp, nodename, the data transmit-receive that message forms the time One of type, the Internet protocol address of node, port numbers, the length of data packet and the useful load information of data transmission Or it is a variety of.
4. according to the method described in claim 2, it is characterized in that, the graphic interface further include: configuration interface, the configuration Interface and the port correspond;
The configuration interface is for port descriptor needed for generating data information transfer;The port descriptor or the port The address information of descriptor is stored in global memory, is made so that at least one transmission interface with identical port requirements is shared With.
5. according to the method described in claim 4, it is characterized in that, the transmission interface sends message packet, comprising:
The port descriptor is obtained from global memory, alternatively, obtaining the address of the port descriptor from global memory Information simultaneously obtains the port descriptor based on the address information;
Based on the port descriptor, the message packet is sent to required port using corresponding agreement.
6. according to the method described in claim 5, it is characterized in that, described obtain the port descriptor from global memory Address information, comprising:
Obtain the identification information of the port descriptor;
The address information for corresponding to the port descriptor of the identification information, the number of the address information are obtained from global memory According to the first data type that type is corresponding to the first environment;
It is the second data type by the data type conversion of the address information, second data type is corresponding to described the Second data type of two environment.
7. method according to claim 1 or 6, which is characterized in that the first environment includes Matlab environment, and described Two environment include C++ environment.
8. a kind of scheduling use device of agreement characterized by comprising
Acquiring unit, for obtaining the interface parameter configured in graphic interface;
First call unit, for being based on the interface parameter, by corresponding process flow calling first from package interface;
Second call unit, for, from package interface, being called corresponding N number of from package interface with described first based on described first First protocol interface;
Wherein, the graphic interface and described first constructs in advance from package interface, and described first wraps from package interface The scheduling relationship between N number of first protocol interface is included, N is the integer more than or equal to 1;
The graphic interface realizes that described first is based on second from package interface and first protocol interface based on first environment Environment is realized.
9. device according to claim 8, which is characterized in that the graphic interface includes: for sending data information The receiving interface of transmission interface and for receiving data information;
The quantity of the transmission interface is at least one, for sending message packet to identical or different port respectively;
The quantity of the receiving interface is at least one, for receiving the message packet of identical or different port transmission respectively.
10. device according to claim 9, which is characterized in that the graphic interface further include: configuration interface, it is described to match It sets interface and the port corresponds;
The configuration interface is for port descriptor needed for generating data information transfer;The port descriptor or the port The address information of descriptor is stored in global memory, is made so that at least one transmission interface with identical port requirements is shared With.
CN201910515854.6A 2019-06-14 2019-06-14 Protocol scheduling and using method and device Active CN110166485B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910515854.6A CN110166485B (en) 2019-06-14 2019-06-14 Protocol scheduling and using method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910515854.6A CN110166485B (en) 2019-06-14 2019-06-14 Protocol scheduling and using method and device

Publications (2)

Publication Number Publication Date
CN110166485A true CN110166485A (en) 2019-08-23
CN110166485B CN110166485B (en) 2022-07-08

Family

ID=67625207

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910515854.6A Active CN110166485B (en) 2019-06-14 2019-06-14 Protocol scheduling and using method and device

Country Status (1)

Country Link
CN (1) CN110166485B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111711940A (en) * 2020-04-29 2020-09-25 杭州涂鸦信息技术有限公司 Intelligent device data interaction method, intelligent device and storage device
CN112202798A (en) * 2020-10-09 2021-01-08 平安科技(深圳)有限公司 Data protocol conversion method, system, electronic device and storage medium
CN112532492A (en) * 2020-12-08 2021-03-19 航天科技控股集团股份有限公司 CAN virtual message construction method and system for testing automobile instrument

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1471267A (en) * 2002-07-22 2004-01-28 华为技术有限公司 Network protocol measuring method and measuring system thereof
CN103729292A (en) * 2013-12-30 2014-04-16 瑞达信息安全产业股份有限公司 Cross-host cross-platform remote command invoking method and system
CN103809983A (en) * 2014-02-27 2014-05-21 山东超越数控电子有限公司 Method for modifying BIOS SETUP interface
CN104994122A (en) * 2015-05-12 2015-10-21 深圳市微阳信息技术有限公司 Business communication method and system based on JSON data protocol
CN105900063A (en) * 2014-06-26 2016-08-24 郑基雄 Method for scheduling in multiprocessing environment and device therefor
US20180059976A1 (en) * 2016-08-26 2018-03-01 Sandisk Technologies Llc Storage System with Integrated Components and Method for Use Therewith
CN109976834A (en) * 2019-03-29 2019-07-05 上海仁童电子科技有限公司 A kind of protocol stack method for parameter configuration and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1471267A (en) * 2002-07-22 2004-01-28 华为技术有限公司 Network protocol measuring method and measuring system thereof
CN103729292A (en) * 2013-12-30 2014-04-16 瑞达信息安全产业股份有限公司 Cross-host cross-platform remote command invoking method and system
CN103809983A (en) * 2014-02-27 2014-05-21 山东超越数控电子有限公司 Method for modifying BIOS SETUP interface
CN105900063A (en) * 2014-06-26 2016-08-24 郑基雄 Method for scheduling in multiprocessing environment and device therefor
CN104994122A (en) * 2015-05-12 2015-10-21 深圳市微阳信息技术有限公司 Business communication method and system based on JSON data protocol
US20180059976A1 (en) * 2016-08-26 2018-03-01 Sandisk Technologies Llc Storage System with Integrated Components and Method for Use Therewith
CN109976834A (en) * 2019-03-29 2019-07-05 上海仁童电子科技有限公司 A kind of protocol stack method for parameter configuration and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
沈忱: ""Galaxie平台分布式节点通信管理模块的设计与实现"", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
王轶卿: ""网络环境下倒立摆系统控制问题的研究"", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111711940A (en) * 2020-04-29 2020-09-25 杭州涂鸦信息技术有限公司 Intelligent device data interaction method, intelligent device and storage device
CN111711940B (en) * 2020-04-29 2023-10-31 杭州涂鸦信息技术有限公司 Intelligent device data interaction method, intelligent device and storage device
CN112202798A (en) * 2020-10-09 2021-01-08 平安科技(深圳)有限公司 Data protocol conversion method, system, electronic device and storage medium
WO2021189898A1 (en) * 2020-10-09 2021-09-30 平安科技(深圳)有限公司 Protocol conversion method and system for data, and electronic device and storage medium
CN112202798B (en) * 2020-10-09 2022-07-15 平安科技(深圳)有限公司 Data protocol conversion method, system, electronic device and storage medium
CN112532492A (en) * 2020-12-08 2021-03-19 航天科技控股集团股份有限公司 CAN virtual message construction method and system for testing automobile instrument

Also Published As

Publication number Publication date
CN110166485B (en) 2022-07-08

Similar Documents

Publication Publication Date Title
CN110166485A (en) A kind of the scheduling application method and device of agreement
US9667699B2 (en) Method for transmitting data via a CANopen bus
US9575920B2 (en) Method for transmitting a process map via a gateway device
CN106162528B (en) LoRa signal and Bluetooth signal conversion module, conversion method and sender unit
CN103747004A (en) Realizing method of internet of things communication protocol
CN101923485A (en) JACA remote invocation method in CORBA (Common Object Request Breaker Architecture) system
CN105162673A (en) Data transmission interface and method
US20230353425A1 (en) Method, program, medium, and device for interconnecting primary network domain with secondary network domain through gateway device
CN109417533A (en) Send the method and forwarding device of data
US8799350B2 (en) Method and device for establishing network communication compatibility of terminals
CN206922798U (en) A kind of Multi-protocol converter, data transmitting equipment and communication system
CN109962762A (en) A kind of data transmission method, sending device and reception device
CN108809949A (en) The method converted and dispatched between profinet, FF H1, CAN and profibus agreements
CN104253763A (en) Method for realizing data transmission in gateway equipment of ubiquitous network and gateway equipment using method
MXPA05010962A (en) Method of managing communication buffers employing an application framework for a plurality of communication layers and node employing the same.
CN111901384B (en) System, method, electronic device and readable storage medium for processing message
CN102208998B (en) Field programmable gate array (FPGA)-based common object request broker architecture (CORBA) communication device
CN107342920B (en) Internet of things gateway access equipment and data interaction method thereof
CN107872431B (en) Data transmitting and receiving method, device and base station
CN102111441B (en) Multi-channel data service handling system and method
Maharaj et al. Optimising data visualisation in the process control and IIoT environments
KR101660028B1 (en) Method and apparatus for creating bridging component between hla-dds
CN109561443A (en) A kind of information processing method, device, equipment and computer readable storage medium
CN110113193A (en) Data transmission method, system and medium based on hierarchical agent
CN110221998A (en) Collecting method, apparatus and system, computer storage medium

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
CB02 Change of applicant information

Address after: 4 / F, building 1, No.14 Jiuxianqiao Road, Chaoyang District, Beijing 100020

Applicant after: Beijing Jingwei Hengrun Technology Co.,Ltd.

Address before: 8 / F, block B, No. 11, Anxiang Beili, Chaoyang District, Beijing 100101

Applicant before: Beijing Jingwei HiRain Technologies Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant