Method for realizing smart city network
Technical Field
The invention relates to an implementation method, in particular to an implementation method of a smart city network.
Background
Communication between nodes in the smart city network is realized through forwarding and routing of intermediate nodes, and therefore, one of key technologies to be solved for realizing the smart city network is to reduce data transmission delay so as to enable users to quickly acquire network services. With the development of smart city network technology, smart city networks will become a mode of providing services for future networks.
At present, the implementation mode of the smart city network is realized through broadcasting, so that both delay and cost are large, and the network service performance is reduced. Therefore, how to reduce the delay and cost of providing services by the smart city network becomes a hot issue of research in recent years.
Disclosure of Invention
The purpose of the invention is as follows: the invention aims to solve the technical problem of providing a method for realizing a smart city network aiming at the defects of the prior art.
The technical scheme is as follows: the invention discloses a method for realizing a smart city network, wherein the network comprises equipment and a router; each router is provided with more than two interfaces, and the interfaces are divided into more than two downstream interfaces and more than two upstream interfaces; configuring an interface for a device;
the upstream interface of one router is connected with the upstream interface of another router, and the downstream interface of the router is connected with a device; the interface of the equipment is connected with the downstream interface of a router; one interface is uniquely identified by one interface ID, and the interface with the interface ID of x is marked as an interface x;
one type of data is uniquely identified by a name, and if a device has access to one type of data, the device is referred to as a consumer of that type of data; if a device has the right to generate a type of data, the device is called a provider of the type of data;
all devices realize communication by adopting communication messages, wherein the communication messages comprise three fields, namely a name field, a command field and a data field, and the format of the communication messages is as follows: name, command, data; the command field value is selected from CONSUMER, PROVIDER, PUSH, PULL or NULL; the method comprises the following steps of taking CONSUMER as a CONSUMER, PROVIDER as a PROVIDER, PUSH as PUSH data and PULL as acquisition data;
the router stores a consumer forwarding table, and a consumer forwarding table item comprises an interface ID domain, a name domain and a life cycle domain;
on the condition that device D1 is a consumer of data DA1, data DA1 being uniquely identified by name NA1, device D1 periodically performs the following operations to maintain a consumer forwarding table:
step 101: starting;
step 102: the device D1 sends a communication message with a name field value of NA1, a command field value of concumer, and a data field value of null;
step 103: after the router receives the communication message from the interface x1, according to the command domain value of the communication message, the router checks the consumer forwarding table, if there is a consumer forwarding table entry, the name domain value of the consumer forwarding table entry is equal to the name domain value of the communication message, the interface ID domain value is equal to x1, the life cycle is greater than the absolute value of the difference between the maximum life cycle M1 and the threshold TH1, execute step 110, otherwise execute step 104; the maximum life cycle M1 is greater than the threshold TH 1; for example, the value of M1 is 1s, the value of the threshold TH1 is 50ms, the smaller the threshold TH1 is, the higher the update frequency of the forwarding table entry of the consumer is;
step 104: the router receiving the communication message from interface x1 looks up the consumer forwarding table, if there is a consumer forwarding entry whose name field value is equal to the communication message's name field value and interface ID field value is equal to x1, then go to step 105, otherwise go to step 106;
step 105: the router receiving the communication message from interface x1 looks up the consumer forwarding table, selects a consumer forwarding table entry whose name field value is equal to the name field value of the communication message and interface ID field value is equal to x1, sets the life cycle of the consumer forwarding table entry to the maximum value, and executes step 107;
step 106: the router receiving the communication message from the interface x1 creates a consumer forwarding entry, the name field value of the consumer forwarding entry is equal to the name field value of the communication message, the interface ID field value is equal to x1, and the life cycle is set to the maximum value;
step 107: the router receiving the communication message from the interface x1 determines whether it receives the communication message from the downstream interface, if so, executes step 108, otherwise, executes step 109;
step 108: the router which receives the communication message from the interface x1 forwards the communication message from each upstream interface, and executes step 103;
step 109: the router which receives the communication message from the interface x1 forwards the communication message from each upstream interface except the interface x1, and executes step 103;
step 110: and (6) ending.
The consumer establishes the consumer forwarding table entry through the process so as to establish a routing path from each router to the consumer, and the router only processes the first received communication message in the process, so that the performance of the routing path from the router to the consumer is ensured to be optimal; in addition, the above process controls the update frequency of the consumer forwarding table entry through the threshold TH1, thereby ensuring the validity and real-time performance of the consumer forwarding table entry.
In the method of the invention, a router stores a provider forwarding table, and a provider forwarding table item comprises an interface ID domain, a name domain and a life cycle domain;
on the condition that device D2 is the provider of data DA1, data DA1 being uniquely identified by name NA1, device D2 periodically performs the following operations to maintain the provider forwarding table:
step 201: starting;
step 202: the device D2 sends a communication message with a name field value of NA1, a command field value of PROVIDER, and a data field value of null;
step 203: after the router receives the communication message from the interface x2, according to the command domain value of the communication message, the router checks a provider forwarding table, if a provider forwarding table exists, the name domain value of the provider forwarding table is equal to the name domain value of the communication message, the interface ID domain value is equal to x2, the life cycle is greater than the absolute value of the difference between the maximum life cycle M1 and the threshold TH1, then step 210 is executed, otherwise step 204 is executed; the maximum life cycle M1 is greater than the threshold TH 1; for example, the value of M1 is 1s, the value of the threshold TH1 is 50ms, the smaller the threshold TH1 is, the higher the update frequency of the provider forwarding table entry is;
step 204: the router receiving the communication message from interface x2 looks up the provider forwarding table, if there is a provider forwarding entry with a name field equal to the name field of the communication message and an interface ID field equal to x2, go to step 205, otherwise go to step 206;
step 205: the router receiving the communication message from interface x2 looks up the provider forwarding table, selects a provider forwarding table entry whose name field value is equal to the name field value of the communication message and interface ID field value is equal to x2, sets the lifetime of the provider forwarding table entry to the maximum value, and executes step 207;
step 206: a router receiving a communication message from interface x2 creates a provider forwarding entry having a name field equal to the name field of the communication message, an interface ID field equal to x2, and a lifetime set to a maximum value;
step 207: the router which receives the communication message from the interface x2 judges whether the router receives the communication message from the downstream interface, if so, the step 208 is executed, otherwise, the step 209 is executed;
step 208: the router receiving the communication message from the interface x2 forwards the communication message from each upstream interface, and executes step 203;
step 209: the router that received the communication message from the interface x2 forwards the communication message from each upstream interface except the interface x2, executing step 203;
step 210: and (6) ending.
The provider establishes the provider forwarding table entry through the above process so as to establish a routing path from each router to itself, and since the above process controls the update frequency of the provider forwarding table entry through the threshold TH1, the effectiveness and real-time performance of the provider forwarding table entry are ensured; meanwhile, in the process, the router only processes the first received communication message, so that the performance of a routing path from the router to a provider is ensured to be optimal, and the data communication performance is improved.
In the method, a consumer stores a data table, and each data table item comprises a name field, a numerical value field and a life cycle field;
the provider saves a data table, and each data table item comprises a name field, a numerical value field and a life cycle field;
the router stores a data table, and each data table item comprises a name field, a numerical value field and a life cycle field;
the maximum length of the data table is L1; l1 is a data table length whose value is related to the resource capabilities of the router or provider, and is typically set to 100 MB;
under the condition that the device D2 is the provider of the data DA2 and the data DA2 is uniquely identified by the name NA2, after the device D2 generates the data DA2, the data DA2 is pushed by the following procedure:
step 301: starting;
step 302: the device D2 creates a data table entry with a name field equal to NA2, a value field equal to data DA2, and a lifecycle set to the maximum lifecycle; the device D2 sends a communication message with a name field of NA2, a command field of PUSH, and a data field of DA 2;
step 303: judging whether the communication message is received by the device or the router, if so, executing step 308, otherwise, executing step 304;
step 304: after receiving the communication message, the router checks the data table, if the current length of the data table is greater than the absolute value of the difference between the maximum length L1 of the data table and the length of the data DA2, then step 305 is executed, otherwise step 306 is executed;
step 305: the router receiving the communication message selects the data table entry with the minimum life cycle, deletes the selected data table entry, and executes step 304;
step 306: the router receiving the communication message creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value is equal to the data field value of the communication message, and the life cycle is set as the maximum life cycle;
step 307: the router receiving the communication message selects all the consumer forwarding entries having a name domain equal to the name domain of the communication message, and for each selected consumer forwarding entry, the router forwards the communication message from the interface identified by the interface ID of the consumer forwarding entry, and step 303 is executed;
step 308: after receiving the communication message, the device creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value is equal to the data field value of the communication message, and the life cycle is set as the maximum life cycle;
step 309: and (6) ending.
The provider generates data and then pushes the generated data to the consumer authorized to acquire the data through the process, the process pushes the data to the consumer through the consumer forwarding table, and the consumer forwarding table saves the optimal routing path reaching the consumer, so that the cost and delay of data pushing are greatly reduced. In addition, if the data table has no space for storing the latest data, the process saves the latest data by deleting the old data, thereby ensuring the real-time property and the validity of the data.
In the method of the invention, a router stores a return table, and a return table item comprises a name domain, an interface ID domain and a life cycle domain;
the data DA1 is uniquely identified by a name NA1, and if the one-hop data transmission delay of the network is equal to or less than the threshold TH2, the device D3 acquires the data DA1 by: the threshold TH2 is 8-10 ms;
step 401: starting;
step 402: the device D3 sends a communication message, the name of the communication message is NA1, the command field value is PULL, and the data field value is null;
step 403: judging whether the device or the router receives the communication message, if the device or the router receives the communication message, executing step 414, otherwise executing step 404;
step 404: after receiving the communication message from the interface y1, the router determines whether the data field value of the communication message is empty, if yes, step 405 is executed, otherwise step 411 is executed;
step 405: the router receiving the communication message from interface y1 looks at the return table, if there is a return entry whose name field value is equal to the name field value of the communication message and interface ID is equal to y1, then step 403 is executed, otherwise step 406 is executed;
step 406: the router receiving the communication message from interface y1 looks at the return table, if there is a return entry whose name field value is equal to the name field value of the communication message, then step 407 is executed, otherwise step 408 is executed;
step 407: the router receiving the communication message from the interface y1 creates a return entry, the interface ID of which is equal to y1, the name field value is equal to the name field value of the communication message, and the life cycle is set to the maximum value, and executes step 403;
step 408: a router receiving a communication message from interface y1 creates a return entry with an interface ID equal to y1, a name field equal to the communication message name field, and a lifetime set to a maximum value; the router checks the data table, if a data table entry exists, the name field value of the data table entry is equal to the name of the communication message, then step 409 is executed, otherwise step 410 is executed;
step 409: the router receiving the communication message from interface y1 selects a data entry having a name field value equal to the name of the communication message; the router constructs a communication message, the name of the communication message is equal to the name field value of the data table item, the command field value is PULL, and the data field value is equal to the value field value of the data table item; the router selects all the return table entries whose name domain values are equal to the name domain values of the data table entries, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 403;
step 410: the router receiving the communication message from interface y1 selects a provider forwarding entry having a name field equal to the name of the communication message, sends the communication message from the interface identified by the interface ID of the provider forwarding entry, and performs step 403;
step 411: the router receiving the communication message from the interface y1 views the data table; if the length of the data table is greater than the absolute value of the difference between the maximum length of the data table L1 and the length of the data field value of the communication message, then step 412 is executed, otherwise step 413 is executed;
step 412: the router receiving the communication message from the interface y1 selects the data entry with the minimum life cycle, deletes the selected data entry, and executes step 411;
step 413: a router receiving a communication message from interface y1 creates a data entry having a name field value equal to the name field value of the communication message, a value field value equal to the data field value of the communication message, and a lifetime set to the maximum lifetime; the router selects all the return table entries whose name domain values are equal to the name domain values of the created data table entries, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 403;
step 414: after receiving the communication message, the device checks whether the data field value of the communication message is empty, if so, executes step 415, otherwise, executes step 416;
step 415: the equipment receiving the communication message selects a data table item, and the name field value of the data table item is equal to the name of the communication message; the device sends a communication message, the name of the communication message is equal to the name field value of the data entry, the command field value is PULL, the data field value is equal to the value field value of the data entry, go to step 403;
step 416: the method comprises the steps that a device receiving a communication message creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value of the data table entry is equal to the data field value of the communication message, and the life cycle is set to be the maximum life cycle;
step 417: and (6) ending.
The consumer obtains the required data through the process, the process can return the data to the consumer through the return table without establishing a route, and meanwhile, request aggregation is realized through the return table, namely more than two consumers obtain the required data through one-time data communication process, so that the data communication delay and cost are greatly reduced; in addition, the router can directly provide data required by the consumer through the data table, so that the data communication delay and cost are further reduced; in addition, if the data table has no space for storing the latest data, the process saves the latest data by deleting the old data, thereby ensuring the real-time property and the validity of the data.
In the method of the invention, the data DA1 is uniquely identified by a name NA1, if the one-hop data transmission delay of the network is greater than a threshold TH2, the threshold TH2 is in the range of 8-10ms, and the device D3 acquires the data DA1 through the following processes:
step 501: starting;
step 502: the device D3 sends a communication message, the name of the communication message is NA1, the command field value is PULL, and the data field value is null;
step 503: judging whether the device or the router receives the communication message, if so, executing step 516, otherwise, executing step 504;
step 504: after receiving the communication message from the interface z1, the router determines whether the data field value of the communication message is empty, if yes, step 505 is executed, otherwise step 511 is executed;
step 505: the router receiving the communication message from interface z1 looks at the return table, if there is a return entry whose name field value equals the name field value of the communication message and interface ID equals z1, then step 503 is executed, otherwise step 506 is executed;
step 506: the router receiving the communication message from interface z1 looks at the return table, if there is a return entry whose name field value is equal to the name field value of the communication message, then go to step 507, otherwise go to step 508;
step 507: the router receiving the communication message from interface z1 creates a return entry with interface ID equal to z1, name field equal to the name field of the communication message, and lifetime set to the maximum, performs step 503;
step 508: a router receiving a communication message from interface z1 creates a return entry with an interface ID equal to z1, a name field equal to the communication message name field, and a lifetime set to a maximum value; the router checks the data table, if there is a data table entry whose name field value is equal to the name of the communication message, then go to step 509, otherwise go to step 510;
step 509: a router receiving a communication message from interface z1 selects a data entry having a name field value equal to the name of the communication message; the router constructs a communication message, the name of the communication message is equal to the name field value of the data table item, the command field value is PULL, and the data field value is equal to the value field value of the data table item; the router selects all the return table entries whose name domain values are equal to the name domain values of the data table entries, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 503;
step 510: the router receiving the communication message from interface z1 selects a provider forwarding entry having a name field equal to the name of the communication message, sends the communication message from the interface identified by the interface ID of the provider forwarding entry, and performs step 503;
step 511: the router receiving the communication message from the interface z1 views the data table; if the length of the data table is greater than the absolute value of the difference between the maximum length of the data table L1 and the length of the data field value of the communication message, execute step 512, otherwise execute step 513;
step 512: the router receiving the communication message from the interface z1 selects the data table entry with the minimum life cycle, deletes the selected data table entry, and executes step 511;
step 513: a router receiving a communication message from interface z1 creates a data entry having a name field value equal to the name field value of the communication message, a value field value equal to the data field value of the communication message, and a lifetime set to the maximum lifetime; the router selects all return table entries with the name domain values equal to the name domain values of the created data table entries, if the number of the selected return table entries is 0, step 515 is executed, otherwise step 514 is executed;
step 514: the router receiving the communication message from interface z1 selects all the return table entries whose name domain values are equal to the name domain value of the communication message, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 503;
step 515: a router receiving a communication message from interface z1 selects all consumer forwarding entries having a name field equal to the name field of the communication message, sends the communication message from the interface identified by the interface ID of the consumer forwarding entry for each selected consumer forwarding entry, and performs step 503;
step 516: after receiving the communication message, the device determines whether the data field value of the communication message is empty, if yes, step 517 is executed, otherwise step 518 is executed;
517: the equipment receiving the communication message selects a data table item, and the name field value of the data table item is equal to the name of the communication message; the device sends a communication message, the name of the communication message is equal to the name field value of the data entry, the command field value is PULL, the data field value is equal to the value field value of the data entry, and step 503 is executed;
step 518: the method comprises the steps that a device receiving a communication message creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value of the data table entry is equal to the data field value of the communication message, and the life cycle is set to be the maximum life cycle;
step 519: and (6) ending.
The consumers acquire the required data through the process, the process realizes request aggregation through the return table, namely more than two consumers acquire the required data through one-time data communication process, and the return table can return the data to the consumers without establishing a route, so that the data communication delay and cost are greatly reduced; if the routing can not be carried out according to the returned table item because of overlarge transmission delay, the process pushes the data to the consumer through the consumer forwarding table, thereby ensuring the robustness and stability of data communication; in addition, the router can directly provide data required by the consumer through the data table, so that the data communication delay and cost are further reduced; in addition, if the data table has no space for storing the latest data, the process saves the latest data by deleting the old data, thereby ensuring the real-time property and the validity of the data.
Has the advantages that: the invention provides a method for realizing a smart city network. The invention can be applied to various fields such as traffic road condition detection and control, agricultural engineering and the like, and has wide application prospect.
Drawings
The foregoing and/or other advantages of the invention will become further apparent from the following detailed description of the invention when taken in conjunction with the accompanying drawings.
FIG. 1 is a schematic diagram illustrating a process for maintaining a customer forwarding table according to the present invention.
Fig. 2 is a schematic diagram illustrating a flow of maintaining a provider forwarding table according to the present invention.
Fig. 3 is a schematic diagram of a data pushing process according to the present invention.
Fig. 4 is a schematic diagram of a data acquisition process according to the present invention.
Fig. 5 is a schematic diagram of a data communication process according to the present invention.
The specific implementation mode is as follows:
the invention provides a method for realizing a smart city network. The invention can be applied to various fields such as traffic road condition detection and control, agricultural engineering and the like, and has wide application prospect.
FIG. 1 is a schematic diagram illustrating a process for maintaining a customer forwarding table according to the present invention. The network comprises a device and a router; each router is provided with more than two interfaces, and the interfaces are divided into more than two downstream interfaces and more than two upstream interfaces; configuring an interface for a device;
the upstream interface of one router is connected with the upstream interface of another router, and the downstream interface of the router is connected with a device; the interface of the equipment is connected with the downstream interface of a router; one interface is uniquely identified by one interface ID, and the interface with the interface ID of x is marked as an interface x;
one type of data is uniquely identified by a name, and if a device has access to one type of data, the device is referred to as a consumer of that type of data; if a device has the right to generate a type of data, the device is called a provider of the type of data;
all devices realize communication by adopting communication messages, wherein the communication messages comprise three fields, namely a name field, a command field and a data field, and the format of the communication messages is as follows: name, command, data; the command field value is selected from CONSUMER, PROVIDER, PUSH, PULL or NULL; the method comprises the following steps of taking CONSUMER as a CONSUMER, PROVIDER as a PROVIDER, PUSH as PUSH data and PULL as acquisition data;
the router stores a consumer forwarding table, and a consumer forwarding table item comprises an interface ID domain, a name domain and a life cycle domain;
on the condition that device D1 is a consumer of data DA1, data DA1 being uniquely identified by name NA1, device D1 periodically performs the following operations to maintain a consumer forwarding table:
step 101: starting;
step 102: the device D1 sends a communication message with a name field value of NA1, a command field value of concumer, and a data field value of null;
step 103: after the router receives the communication message from the interface x1, according to the command domain value of the communication message, the router checks the consumer forwarding table, if there is a consumer forwarding table entry, the name domain value of the consumer forwarding table entry is equal to the name domain value of the communication message, the interface ID domain value is equal to x1, the life cycle is greater than the absolute value of the difference between the maximum life cycle M1 and the threshold TH1, execute step 110, otherwise execute step 104; the maximum life cycle M1 is greater than the threshold TH 1; for example, the value of M1 is 1s, the value of the threshold TH1 is 50ms, the smaller the threshold TH1 is, the higher the update frequency of the forwarding table entry of the consumer is;
step 104: the router receiving the communication message from interface x1 looks up the consumer forwarding table, if there is a consumer forwarding entry whose name field value is equal to the communication message's name field value and interface ID field value is equal to x1, then go to step 105, otherwise go to step 106;
step 105: the router receiving the communication message from interface x1 looks up the consumer forwarding table, selects a consumer forwarding table entry whose name field value is equal to the name field value of the communication message and interface ID field value is equal to x1, sets the life cycle of the consumer forwarding table entry to the maximum value, and executes step 107;
step 106: the router receiving the communication message from the interface x1 creates a consumer forwarding entry, the name field value of the consumer forwarding entry is equal to the name field value of the communication message, the interface ID field value is equal to x1, and the life cycle is set to the maximum value;
step 107: the router receiving the communication message from the interface x1 determines whether it receives the communication message from the downstream interface, if so, executes step 108, otherwise, executes step 109;
step 108: the router which receives the communication message from the interface x1 forwards the communication message from each upstream interface, and executes step 103;
step 109: the router which receives the communication message from the interface x1 forwards the communication message from each upstream interface except the interface x1, and executes step 103;
step 110: and (6) ending.
The consumer establishes the consumer forwarding table entry through the process so as to establish a routing path from each router to the consumer, and the router only processes the first received communication message in the process, so that the performance of the routing path from the router to the consumer is ensured to be optimal; in addition, the above process controls the update frequency of the consumer forwarding table entry through the threshold TH1, thereby ensuring the validity and real-time performance of the consumer forwarding table entry.
Fig. 2 is a schematic diagram illustrating a flow of maintaining a provider forwarding table according to the present invention. The router stores a provider forwarding table, wherein a provider forwarding table item comprises an interface ID domain, a name domain and a life cycle domain;
on the condition that device D2 is the provider of data DA1, data DA1 being uniquely identified by name NA1, device D2 periodically performs the following operations to maintain the provider forwarding table:
step 201: starting;
step 202: the device D2 sends a communication message with a name field value of NA1, a command field value of PROVIDER, and a data field value of null;
step 203: after the router receives the communication message from the interface x2, according to the command domain value of the communication message, the router checks a provider forwarding table, if a provider forwarding table exists, the name domain value of the provider forwarding table is equal to the name domain value of the communication message, the interface ID domain value is equal to x2, the life cycle is greater than the absolute value of the difference between the maximum life cycle M1 and the threshold TH1, then step 210 is executed, otherwise step 204 is executed; the maximum life cycle M1 is greater than the threshold TH 1; for example, the value of M1 is 1s, the value of the threshold TH1 is 50ms, the smaller the threshold TH1 is, the higher the update frequency of the provider forwarding table entry is;
step 204: the router receiving the communication message from interface x2 looks up the provider forwarding table, if there is a provider forwarding entry with a name field equal to the name field of the communication message and an interface ID field equal to x2, go to step 205, otherwise go to step 206;
step 205: the router receiving the communication message from interface x2 looks up the provider forwarding table, selects a provider forwarding table entry whose name field value is equal to the name field value of the communication message and interface ID field value is equal to x2, sets the lifetime of the provider forwarding table entry to the maximum value, and executes step 207;
step 206: a router receiving a communication message from interface x2 creates a provider forwarding entry having a name field equal to the name field of the communication message, an interface ID field equal to x2, and a lifetime set to a maximum value;
step 207: the router which receives the communication message from the interface x2 judges whether the router receives the communication message from the downstream interface, if so, the step 208 is executed, otherwise, the step 209 is executed;
step 208: the router receiving the communication message from the interface x2 forwards the communication message from each upstream interface, and executes step 203;
step 209: the router that received the communication message from the interface x2 forwards the communication message from each upstream interface except the interface x2, executing step 203;
step 210: and (6) ending.
The provider establishes the provider forwarding table entry through the above process so as to establish a routing path from each router to itself, and since the above process controls the update frequency of the provider forwarding table entry through the threshold TH1, the effectiveness and real-time performance of the provider forwarding table entry are ensured; meanwhile, in the process, the router only processes the first received communication message, so that the performance of a routing path from the router to a provider is ensured to be optimal, and the data communication performance is improved.
Fig. 3 is a schematic diagram of a data pushing process according to the present invention. The consumer saves a data table, and each data table item comprises a name field, a numerical value field and a life cycle field;
the provider saves a data table, and each data table item comprises a name field, a numerical value field and a life cycle field;
the router stores a data table, and each data table item comprises a name field, a numerical value field and a life cycle field;
the maximum length of the data table is L1; l1 is a data table length whose value is related to the resource capabilities of the router or provider, and is typically set to 100 MB;
under the condition that the device D2 is the provider of the data DA2 and the data DA2 is uniquely identified by the name NA2, after the device D2 generates the data DA2, the data DA2 is pushed by the following procedure:
step 301: starting;
step 302: the device D2 creates a data table entry with a name field equal to NA2, a value field equal to data DA2, and a lifecycle set to the maximum lifecycle; the device D2 sends a communication message with a name field of NA2, a command field of PUSH, and a data field of DA 2;
step 303: judging whether the communication message is received by the device or the router, if so, executing step 308, otherwise, executing step 304;
step 304: after receiving the communication message, the router checks the data table, if the current length of the data table is greater than the absolute value of the difference between the maximum length L1 of the data table and the length of the data DA2, then step 305 is executed, otherwise step 306 is executed;
step 305: the router receiving the communication message selects the data table entry with the minimum life cycle, deletes the selected data table entry, and executes step 304;
step 306: the router receiving the communication message creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value is equal to the data field value of the communication message, and the life cycle is set as the maximum life cycle;
step 307: the router receiving the communication message selects all the consumer forwarding entries having a name domain equal to the name domain of the communication message, and for each selected consumer forwarding entry, the router forwards the communication message from the interface identified by the interface ID of the consumer forwarding entry, and step 303 is executed;
step 308: after receiving the communication message, the device creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value is equal to the data field value of the communication message, and the life cycle is set as the maximum life cycle;
step 309: and (6) ending.
The provider generates data and then pushes the generated data to the consumer authorized to acquire the data through the process, the process pushes the data to the consumer through the consumer forwarding table, and the consumer forwarding table saves the optimal routing path reaching the consumer, so that the cost and delay of data pushing are greatly reduced. In addition, if the data table has no space for storing the latest data, the process saves the latest data by deleting the old data, thereby ensuring the real-time property and the validity of the data.
Fig. 4 is a schematic diagram of a data acquisition process according to the present invention. The router stores a return table, wherein one return table item comprises a name domain, an interface ID domain and a life cycle domain;
the data DA1 is uniquely identified by a name NA1, and if the one-hop data transmission delay of the network is equal to or less than the threshold TH2, the device D3 acquires the data DA1 by: the threshold TH2 is 8-10 ms;
step 401: starting;
step 402: the device D3 sends a communication message, the name of the communication message is NA1, the command field value is PULL, and the data field value is null;
step 403: judging whether the device or the router receives the communication message, if the device or the router receives the communication message, executing step 414, otherwise executing step 404;
step 404: after receiving the communication message from the interface y1, the router determines whether the data field value of the communication message is empty, if yes, step 405 is executed, otherwise step 411 is executed;
step 405: the router receiving the communication message from interface y1 looks at the return table, if there is a return entry whose name field value is equal to the name field value of the communication message and interface ID is equal to y1, then step 403 is executed, otherwise step 406 is executed;
step 406: the router receiving the communication message from interface y1 looks at the return table, if there is a return entry whose name field value is equal to the name field value of the communication message, then step 407 is executed, otherwise step 408 is executed;
step 407: the router receiving the communication message from the interface y1 creates a return entry, the interface ID of which is equal to y1, the name field value is equal to the name field value of the communication message, and the life cycle is set to the maximum value, and executes step 403;
step 408: a router receiving a communication message from interface y1 creates a return entry with an interface ID equal to y1, a name field equal to the communication message name field, and a lifetime set to a maximum value; the router checks the data table, if a data table entry exists, the name field value of the data table entry is equal to the name of the communication message, then step 409 is executed, otherwise step 410 is executed;
step 409: the router receiving the communication message from interface y1 selects a data entry having a name field value equal to the name of the communication message; the router constructs a communication message, the name of the communication message is equal to the name field value of the data table item, the command field value is PULL, and the data field value is equal to the value field value of the data table item; the router selects all the return table entries whose name domain values are equal to the name domain values of the data table entries, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 403;
step 410: the router receiving the communication message from interface y1 selects a provider forwarding entry having a name field equal to the name of the communication message, sends the communication message from the interface identified by the interface ID of the provider forwarding entry, and performs step 403;
step 411: the router receiving the communication message from the interface y1 views the data table; if the length of the data table is greater than the absolute value of the difference between the maximum length of the data table L1 and the length of the data field value of the communication message, then step 412 is executed, otherwise step 413 is executed;
step 412: the router receiving the communication message from the interface y1 selects the data entry with the minimum life cycle, deletes the selected data entry, and executes step 411;
step 413: a router receiving a communication message from interface y1 creates a data entry having a name field value equal to the name field value of the communication message, a value field value equal to the data field value of the communication message, and a lifetime set to the maximum lifetime; the router selects all the return table entries whose name domain values are equal to the name domain values of the created data table entries, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 403;
step 414: after receiving the communication message, the device checks whether the data field value of the communication message is empty, if so, executes step 415, otherwise, executes step 416;
step 415: the equipment receiving the communication message selects a data table item, and the name field value of the data table item is equal to the name of the communication message; the device sends a communication message, the name of the communication message is equal to the name field value of the data entry, the command field value is PULL, the data field value is equal to the value field value of the data entry, go to step 403;
step 416: the method comprises the steps that a device receiving a communication message creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value of the data table entry is equal to the data field value of the communication message, and the life cycle is set to be the maximum life cycle;
step 417: and (6) ending.
The consumer obtains the required data through the process, the process can return the data to the consumer through the return table without establishing a route, and meanwhile, request aggregation is realized through the return table, namely more than two consumers obtain the required data through one-time data communication process, so that the data communication delay and cost are greatly reduced; in addition, the router can directly provide data required by the consumer through the data table, so that the data communication delay and cost are further reduced; in addition, if the data table has no space for storing the latest data, the process saves the latest data by deleting the old data, thereby ensuring the real-time property and the validity of the data.
Fig. 5 is a schematic diagram of a data communication process according to the present invention. The data DA1 is uniquely identified by a name NA1, and if the one-hop data transmission delay of the network is greater than a threshold TH2 and the threshold TH2 is in the range of 8-10ms, the device D3 acquires the data DA1 through the following processes:
step 501: starting;
step 502: the device D3 sends a communication message, the name of the communication message is NA1, the command field value is PULL, and the data field value is null;
step 503: judging whether the device or the router receives the communication message, if so, executing step 516, otherwise, executing step 504;
step 504: after receiving the communication message from the interface z1, the router determines whether the data field value of the communication message is empty, if yes, step 505 is executed, otherwise step 511 is executed;
step 505: the router receiving the communication message from interface z1 looks at the return table, if there is a return entry whose name field value equals the name field value of the communication message and interface ID equals z1, then step 503 is executed, otherwise step 506 is executed;
step 506: the router receiving the communication message from interface z1 looks at the return table, if there is a return entry whose name field value is equal to the name field value of the communication message, then go to step 507, otherwise go to step 508;
step 507: the router receiving the communication message from interface z1 creates a return entry with interface ID equal to z1, name field equal to the name field of the communication message, and lifetime set to the maximum, performs step 503;
step 508: a router receiving a communication message from interface z1 creates a return entry with an interface ID equal to z1, a name field equal to the communication message name field, and a lifetime set to a maximum value; the router checks the data table, if there is a data table entry whose name field value is equal to the name of the communication message, then go to step 509, otherwise go to step 510;
step 509: a router receiving a communication message from interface z1 selects a data entry having a name field value equal to the name of the communication message; the router constructs a communication message, the name of the communication message is equal to the name field value of the data table item, the command field value is PULL, and the data field value is equal to the value field value of the data table item; the router selects all the return table entries whose name domain values are equal to the name domain values of the data table entries, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 503;
step 510: the router receiving the communication message from interface z1 selects a provider forwarding entry having a name field equal to the name of the communication message, sends the communication message from the interface identified by the interface ID of the provider forwarding entry, and performs step 503;
step 511: the router receiving the communication message from the interface z1 views the data table; if the length of the data table is greater than the absolute value of the difference between the maximum length of the data table L1 and the length of the data field value of the communication message, execute step 512, otherwise execute step 513;
step 512: the router receiving the communication message from the interface z1 selects the data table entry with the minimum life cycle, deletes the selected data table entry, and executes step 511;
step 513: a router receiving a communication message from interface z1 creates a data entry having a name field value equal to the name field value of the communication message, a value field value equal to the data field value of the communication message, and a lifetime set to the maximum lifetime; the router selects all return table entries with the name domain values equal to the name domain values of the created data table entries, if the number of the selected return table entries is 0, step 515 is executed, otherwise step 514 is executed;
step 514: the router receiving the communication message from interface z1 selects all the return table entries whose name domain values are equal to the name domain value of the communication message, and for each selected return table entry, the router sends the communication message from the interface identified by the interface ID of the return table entry, deletes the return table entry, and executes step 503;
step 515: a router receiving a communication message from interface z1 selects all consumer forwarding entries having a name field equal to the name field of the communication message, sends the communication message from the interface identified by the interface ID of the consumer forwarding entry for each selected consumer forwarding entry, and performs step 503;
step 516: after receiving the communication message, the device determines whether the data field value of the communication message is empty, if yes, step 517 is executed, otherwise step 518 is executed;
517: the equipment receiving the communication message selects a data table item, and the name field value of the data table item is equal to the name of the communication message; the device sends a communication message, the name of the communication message is equal to the name field value of the data entry, the command field value is PULL, the data field value is equal to the value field value of the data entry, and step 503 is executed;
step 518: the method comprises the steps that a device receiving a communication message creates a data table entry, the name field value of the data table entry is equal to the name field value of the communication message, the numerical value field value of the data table entry is equal to the data field value of the communication message, and the life cycle is set to be the maximum life cycle;
step 519: and (6) ending.
The consumers acquire the required data through the process, the process realizes request aggregation through the return table, namely more than two consumers acquire the required data through one-time data communication process, and the return table can return the data to the consumers without establishing a route, so that the data communication delay and cost are greatly reduced; if the routing can not be carried out according to the returned table item because of overlarge transmission delay, the process pushes the data to the consumer through the consumer forwarding table, thereby ensuring the robustness and stability of data communication; in addition, the router can directly provide data required by the consumer through the data table, so that the data communication delay and cost are further reduced; in addition, if the data table has no space for storing the latest data, the process saves the latest data by deleting the old data, thereby ensuring the real-time property and the validity of the data.
Example 1
Based on the simulation parameters in table 1, the embodiment simulates the implementation method of the smart city network in the present invention, and the performance analysis is as follows: when the one-hop delay is increased, the data communication delay is increased, and when the one-hop delay is decreased, the data communication delay is decreased, and the data communication average delay is 2047 s.
TABLE 1 simulation parameters
The invention provides a concept of a method for implementing a smart city network, and a number of methods and ways for implementing the technical solution are provided, the above description is only a preferred embodiment of the invention, it should be noted that, for those skilled in the art, a number of improvements and embellishments can be made without departing from the principle of the invention, and these improvements and embellishments should also be regarded as the protection scope of the invention. The components not specified in this embodiment can be implemented by the prior art.