CN115862352A - Computing method, system, medium and device for solving parallel code sending conflict by random number - Google Patents
Computing method, system, medium and device for solving parallel code sending conflict by random number Download PDFInfo
- Publication number
- CN115862352A CN115862352A CN202211483333.5A CN202211483333A CN115862352A CN 115862352 A CN115862352 A CN 115862352A CN 202211483333 A CN202211483333 A CN 202211483333A CN 115862352 A CN115862352 A CN 115862352A
- Authority
- CN
- China
- Prior art keywords
- check value
- traffic light
- handheld controller
- array
- interval time
- 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
Links
- 238000004364 calculation method Methods 0.000 title claims abstract description 10
- 238000000034 method Methods 0.000 claims abstract description 48
- 230000004044 response Effects 0.000 claims description 34
- 230000015654 memory Effects 0.000 claims description 25
- 230000005540 biological transmission Effects 0.000 claims description 11
- 238000004422 calculation algorithm Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 2
- 230000006870 function Effects 0.000 description 14
- 238000004891 communication Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 8
- 238000004519 manufacturing process Methods 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 206010039203 Road traffic accident Diseases 0.000 description 5
- 238000012795 verification Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003203 everyday effect Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000002035 prolonged effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
Images
Abstract
The application relates to a computing method, a system, a medium and equipment for solving parallel code sending conflict by random numbers, wherein the method comprises the steps of reading ID of a traffic light lamp cap and storing the ID into an ID array; generating a check value according to the ID array; obtaining the interval time of the traffic light head according to the check value; and sending the ID to the handheld controller according to the interval time. According to the method and the device, the interval time of the traffic light lamp heads for sending the IDs to the handheld controller is controlled, the time of sending the IDs to the handheld controller by the traffic light lamp heads is staggered, and signal blockage caused when the traffic light lamp heads send signals to the handheld controller at the same time can be effectively prevented.
Description
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method, a system, a medium, and a device for calculating a parallel code transmission conflict for random numbers.
Background
The traffic signal lamp is a signal lamp for directing traffic operation, is also commonly called traffic light, and is also a central heart of a traffic system. In order to enhance road traffic management, reduce the occurrence of traffic accidents and improve the road utilization efficiency, traffic lights are usually set at intersections and other places requiring control, and are controlled by a road traffic signal controller to guide vehicles and pedestrians to safely and orderly pass, and all traffic participants need to execute the control according to regulations.
With the rapid development of urban construction and traffic industry, the technical requirements on the traffic safety information display system are higher and higher. Most of the current traffic information display systems are fixedly arranged. Because no traffic command easily causes traffic accidents on road sections with traffic accidents or road finishing, the movable traffic signal lamp appears and can be temporarily applied to road sections needing traffic command.
After the traffic light heads of the mobile traffic lights are simultaneously started, the mobile traffic lights start to be paired with the handheld controller for controlling the traffic light heads, and because the handheld controller can only receive the information of one traffic light head at the same time, when the two traffic light heads simultaneously send signals to the handheld controller, signal collision is easily caused.
Disclosure of Invention
In order to prevent signal collision when a plurality of traffic light lamp heads simultaneously transmit signals to a handheld controller, the application provides a calculation method, a system, a medium and equipment for solving parallel code transmission collision by random numbers.
In a first aspect of the present application, a method for calculating a random number to solve a parallel code-sending conflict is provided, which is applied to a traffic light head, and adopts the following technical scheme:
reading the ID of the traffic light head, and storing the ID into an ID array;
generating a check value according to the ID array;
obtaining the interval time of the traffic light head according to the check value;
and sending the ID to the handheld controller according to the interval time.
By adopting the technical scheme, the IDs of the traffic light lamp heads are read, the IDs of the traffic light lamp heads are unique during production, the IDs are stored in the ID array to generate a check value, the interval time of the traffic light lamp heads is obtained according to the check value, the interval time is equivalent to a random number, the IDs are sent to the handheld controller according to the interval time, the generated check values are different due to different IDs of the traffic light lamp heads, the interval time of each traffic light lamp head is also different, the time for sending the IDs to the handheld controller by the traffic light lamp heads at the same time is staggered, and therefore signal blockage caused when the traffic light lamp heads send signals to the handheld controller at the same time is effectively prevented.
Optionally, generating a corresponding check value according to the ID array includes: and generating a check value corresponding to the ID array according to a CRC-16 algorithm.
By adopting the technical scheme, the CRC-16 is a common error check code, and the lengths of the information field and the check field can be selected at will.
Optionally, the obtaining of the interval time of the traffic light head according to the check value includes: and calculating the interval time of the check value according to a preset formula, wherein the preset formula is B = A/100+500, B represents the interval time, and A represents the check value.
By adopting the technical scheme, the check value is divided by 100, and 500 is added to obtain the interval time of the traffic light heads, the interval time of each traffic light head is different because the check value of each traffic light head is different, the time intervals of the traffic light heads are different, the pairing time points of a plurality of traffic light heads and the handheld controller are staggered through the time intervals of the traffic light heads, and the signal collision caused when the traffic light heads send signals to the controller at the same time is effectively reduced.
Optionally, after sending the ID to the handheld controller according to the interval time, the method further includes: judging whether a response of the handheld controller is received or not in the interval time; and if the response of the handheld controller is received, the ID is not sent to the handheld controller any more.
By adopting the technical scheme, whether the traffic light lamp cap receives the response of the handheld controller or not is judged within the time interval, if the response of the handheld controller is received, the traffic light lamp cap and the handheld controller are successfully matched, the ID is not sent to the handheld controller any more, and every traffic light lamp cap which is successfully matched does not send the ID to the handheld controller any more, so that the sending amount of the ID sent by the traffic light lamp cap to the handheld controller is less and less, and the probability of collision is further reduced.
Optionally, the method further includes: if the response of the handheld controller is not received, updating the check value, and executing the step of obtaining the interval time of the traffic light head according to the check value; until it is determined within the interval that a response of the handheld controller is received.
By adopting the technical scheme, if the traffic light lamp head does not receive the response of the handheld controller, the check value is updated to obtain a new check value, the step of obtaining the interval time of the traffic light lamp head according to the new check value is repeatedly executed according to the new check value until the traffic light lamp head receives the response of the handheld controller in the interval time, and the successful pairing of the traffic light lamp head is indicated.
Optionally, the updating the check value includes: adding the last two bytes of the ID array to the upper 8 bits and the lower 8 bits of the check value to generate a new ID array; and updating the check value according to the new ID array.
By adopting the technical scheme, the last two bytes of the ID array are added with the high 8 bits and the low 8 bits of the check value to obtain a new ID array, so that the new ID array is regenerated after the response to the handheld controller is not received, the check value is updated through the new ID array, and after the check value is updated, the time interval of sending the traffic light lamp head to the handheld controller every time is different before the traffic light lamp head does not respond to the handheld controller, and the occurrence of collision can be further reduced.
Optionally, the updating the check value according to the new ID array includes: and generating a new check value corresponding to the ID array according to a CRC-16 algorithm, and replacing the check value with the new check value.
By adopting the technical scheme, after a new ID array is generated each time, a new check value corresponding to the ID array is generated according to the CRC-16 algorithm, and the obtained new check value is replaced by the previous check value, so that the check value is updated.
In a second aspect of the present application, there is provided a computing system for random number resolution of parallel code transmission collisions, the system comprising:
the reading ID module is used for reading the ID of the lamp cap of the traffic light and storing the ID into an ID array;
a check value generating module for generating a check value according to the ID array;
the interval time calculating module is used for obtaining the interval time of the traffic light head according to the check value;
and the ID sending module is used for sending the ID to the handheld controller according to the interval time.
By adopting the technical scheme, the IDs of the traffic light lamp heads are read, the IDs of the traffic light lamp heads are unique during production, the IDs are stored in the ID array to generate a check value, the interval time of the traffic light lamp heads is obtained according to the check value, the interval time is equivalent to a random number, the IDs are sent to the handheld controller according to the interval time, the generated check values are different due to different IDs of the traffic light lamp heads, the interval time of each lamp head is also different, the time for sending the IDs to the handheld controller by the multiple traffic light lamp heads is staggered, and signal blockage caused when the multiple traffic light lamp heads send signals to the handheld controller simultaneously is effectively prevented.
In a third aspect of the present application, a computer storage medium is provided that stores a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect of the present application, there is provided an electronic device comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
In summary, the present application includes at least one of the following beneficial technical effects:
1. according to the method, the interval time of sending the IDs to the handheld controller by the traffic light lamp caps is controlled through calculation, the time of sending the IDs to the handheld controller by the traffic light lamp caps at the same time is staggered, and signal blockage caused when the traffic light lamp caps send signals to the handheld controller at the same time is effectively prevented;
2. if the traffic light lamp cap receives the response of the handheld controller within the time interval, the traffic light lamp cap and the handheld controller are successfully matched, at the moment, the ID is not sent to the handheld controller any more, the traffic light lamp cap which is successfully matched does not send the ID to the handheld controller any more, the sending amount of the ID sent by the traffic light lamp cap to the handheld controller is less and less, and the probability of signal collision is smaller and less;
3. if the traffic light lamp head does not receive the response of the handheld controller in the time interval, the last two bytes in the ID array are added with the high 8 bits and the low 8 bits of the check value to obtain a new ID array, and then the check value is updated through the new ID array, so that the time interval sent to the handheld controller by the traffic light lamp head is different every time before the response of the handheld controller is not obtained, and the probability of signal collision is further reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a method for calculating a random number to resolve a parallel code-sending conflict according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another calculation method for resolving parallel code transmission collisions by using random numbers according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating an exemplary schematic flowchart of a computing method for resolving a parallel code transmission conflict by using a random number according to an embodiment of the present application;
FIG. 4 is a block diagram of a computing system for resolving parallel code transmission conflicts with random numbers according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Description of reference numerals: 1. reading the ID module; 2. a check value generation module; 3. a calculating interval time module; 4. an ID sending module; 1000. an electronic device; 1001. a processor; 1002. a communication bus; 1003. a user interface; 1004. a network interface; 1005. a memory.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
In the description of the embodiments of the present application, the words "exemplary," "for example," or "for instance" are used to indicate instances, or illustrations. Any embodiment or design described herein as "exemplary," "e.g.," or "e.g.," is not to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the words "exemplary," "such as," or "for example" are intended to present relevant concepts in a concrete fashion.
In the description of the embodiments of the present application, the term "and/or" is only one kind of association relationship describing an associated object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, B exists alone, and A and B exist at the same time. In addition, the term "plurality" means two or more unless otherwise specified. For example, the plurality of systems refers to two or more systems, and the plurality of screen terminals refers to two or more screen terminals. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicit indication of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
With the rapid development of urban construction and traffic industry, the technical requirements on the traffic safety information display system are higher and higher. Most of the current traffic information display systems are fixedly arranged. Because no traffic command easily causes traffic accidents on road sections with traffic accidents or road finishing, the movable traffic signal lamp appears and can be temporarily applied to road sections needing traffic command.
After the lamp heads of the traffic lights are turned on, the traffic lights are matched with the handheld controller for controlling the lamp heads of the traffic lights, and because the handheld controller can only receive the information of one traffic light lamp head at the same time, when the two traffic light lamp heads simultaneously send signals to the handheld controller, signal collision is easily caused.
The following detailed description is provided to the technical solutions of the present application and how to solve the above technical problems with the technical solutions of the present application in combination with specific embodiments, and the following embodiments may be combined with each other, and are not repeated in some embodiments for the same or similar probabilities or processes, and the embodiments of the present application will be described below with reference to the accompanying drawings.
In one embodiment, as shown in fig. 1, a flow chart of a computing method for resolving parallel code sending collision by using a random number is specifically provided. The method is mainly applied to traffic light heads, and the specific method comprises the following steps:
step 101: and reading the ID of the lamp cap of the traffic light, and storing the ID into an ID array.
In the embodiment of the application, the traffic light head can be a movable traffic signal light. When the traffic light head is produced, production equipment personnel write the ID of each traffic light head into the traffic light head, wherein the ID can be the ID which only represents the traffic light head and can be composed of a plurality of characters.
Specifically, the traffic light head reads the ID information of the traffic light head and stores the ID information of the traffic light head into an ID array. The ID of the traffic light head can be set according to specific conditions during production, for example, the ID can be composed of 12 characters, an array is generated by the characters, and the array is stored in the ID array.
Step 102: and generating a check value according to the ID array.
Specifically, the check value is obtained through a certain operation to check the correctness of the group of data, in the embodiment of the application, the check value corresponding to the traffic light head ID is generated according to CRC-16, and CRC-16 is a cyclic redundancy check and is a hash function for generating a short fixed-number check code according to data.
Step 103: and obtaining the interval time of the traffic light head according to the verification value.
Specifically, the verification value is divided by 100, and then 500 is added to obtain the interval time of the lamp cap of the traffic light. The time interval of the traffic light head in the embodiment of the application is one time interval in milliseconds. Because the IDs set during production of each traffic light head are different, the obtained ID arrays are also different, and the check values generated according to the ID arrays are different, so that the interval time of each traffic light head calculated according to the check values of each traffic light head is also different.
Step 104: and sending the ID to the handheld controller according to the interval time.
Specifically, the handheld controller is a controller capable of controlling the lamp head of the traffic light within a certain range. And after the interval time of each traffic light head is calculated, each traffic light head sends an ID to the handheld controller according to each interval time and establishes connection with the handheld controller. Because the calculated interval time of each traffic light head is different, the interval time of all traffic light heads in a certain range transmitting IDs to the handheld controller is different. In the embodiment of the application, the handheld controller can control the traffic light head connected with the handheld controller within 1.6 kilometers. By calculating the time interval of each traffic light head and staggering the time of sending the ID to the handheld controller by all the traffic light heads in a millisecond interval time intervention mode, the signal blockage caused when a plurality of traffic light heads send signals to the handheld controller at the same time can be effectively prevented.
Referring to fig. 2, on the basis of the foregoing embodiments, as an optional embodiment, a method for calculating a random number solution for a parallel code sending collision further includes:
step 201: and sending the ID to the handheld controller according to the interval time, and judging whether the response to the handheld controller is received or not in the interval time.
Specifically, after each traffic light head is turned on, the traffic light head starts to be paired with the handheld controller, and the specific pairing process refers to the steps 101 to 105, and sends the ID to the handheld controller according to the calculated interval time of each traffic light head. A determination is made during the interval as to whether a response, which may be in the form of a signal, is received to the handheld controller.
Step 202: if a response to the handheld controller is received, the ID is no longer sent to the handheld controller.
Specifically, if the traffic light head receives a response to the handheld controller, that is, the traffic light head and the handheld controller are successfully paired, the handheld controller does not send the ID to the handheld controller any more. And the traffic light head which is successfully paired at each time does not send the ID to the handheld controller any more, so that the sending amount of the ID sent by the traffic light head to the handheld controller is less and less, and the probability of collision is further reduced.
Step 203: and if the response to the handheld controller is not received, updating the check value, and executing the step of obtaining the interval time of the traffic light head according to the check value until the response to the handheld controller is determined to be received in the interval time.
Specifically, if no response to the handheld controller is received, adding the last two bytes of the ID array of the traffic light head to the upper 8 bits and the lower 8 bits of the check value to generate a new ID array, generating a new check value corresponding to the new ID array according to the CRC-16 algorithm, replacing the previous check value with the new check value, dividing the new check value by 100, adding 500 to obtain a new time interval of the traffic light head, and continuing to judge whether to receive the response to the handheld controller by the traffic light head until the response to the handheld controller is determined within the interval time, i.e., all traffic light heads within a certain range can be completely paired one by one. In the embodiment of the application, the traffic light head successfully matched first can be used as a master, the traffic light head successfully matched subsequently can be used as a slave, and in other feasible embodiments, the master and the slave can be selected by a user.
On the basis of the foregoing embodiments, as an optional embodiment, a method for calculating a random number solution to a parallel code-sending collision further includes:
in one possible embodiment, the traffic light head is in wireless communication with the manager terminal device. And if the traffic light head is not successfully matched within the preset times, indicating that the traffic light head is possible to have a fault, and sending the ID of the traffic light head to the terminal equipment of a manager so that a professional can carry out maintenance. The traffic light head is provided with a camera which can be used for monitoring the traffic flow of the road section and the running condition of vehicles on the road surface. The general traffic light lamp heads are arranged at the crossroad, if the first traffic light lamp head corresponds to a first road and the second traffic light lamp head corresponds to a second road, if the traffic flow of the first road is monitored to be far greater than the traffic flow of the second road in a certain time period, the duration of increasing the green light of the first traffic light lamp head can be prolonged, and therefore the duration of corresponding to the green light of the second traffic light lamp head can be correspondingly reduced. For example, at an intersection of two roads, in a certain time period every day, the traffic flow of the first road is always far greater than the traffic flow of the second road, and then the time lengths of the traffic lights of the first traffic light head and the second traffic light head can be adjusted to increase the traffic efficiency of vehicles at the intersection.
Fig. 3 is a schematic flowchart illustrating an exemplary process of a method for calculating a solution to a parallel code-sending conflict by using a random number according to an embodiment of the present application. The implementation principle of the exemplary embodiment is as follows: and when the traffic light lamp cap receives and reads the ID written in the traffic light lamp cap during production, the ID is stored in a corresponding PL-ID-crc array, the ID of each traffic light lamp cap is different, a crc check value is generated according to the number of the ID groups of each traffic light lamp cap, the crc check value is divided by 100, and the interval time is obtained by adding 500, and the traffic light lamp cap judges whether the response of the handheld controller is received. If the response to the handheld controller is received within the interval time, the self ID is not sent to the handheld controller any more, and the traffic light head and the handheld controller are successfully matched; if no response to the handheld controller is received in the interval time, after the interval time, adding the last two bytes of the PL-ID-crc array to the upper 8 bits and the lower 8 bits of the crc value to generate a new array, generating a new crc value according to the new array, returning to continuously execute the step of dividing the new crc value by 100 and adding 500 to obtain the interval time, and judging whether the response to the handheld controller is received by the traffic light head until the response to the handheld controller is received in the interval time. According to the embodiment of the application, the interval time of sending the ID to the handheld controller by the traffic light lamp cap is calculated and controlled, the time of sending the ID to the handheld controller by the traffic light lamp caps is staggered, namely the code sending time of the traffic light lamp caps is automatically adjusted to stagger the matching time point with the handheld controller, and signal blockage is effectively prevented when the traffic light lamp caps send signals to the handheld controller simultaneously.
The following are embodiments of the system of the present application that may be used to perform embodiments of the method of the present application. For details not disclosed in the embodiments of the system of the present application, please refer to the embodiments of the method of the present application:
referring to fig. 4, a computing system for resolving parallel code transmission conflicts with random numbers is provided in the embodiments of the present application. A computing system for random number resolution parallel code transmission collisions may include: reading an ID module 1, generating a check value module 2, calculating an interval time module 3, and sending an ID module 4, wherein:
the reading ID module 1 is used for reading the ID of the lamp cap of the traffic light and storing the ID into an ID array;
a check value generating module 2, configured to generate a check value according to the ID array;
the interval time calculating module 3 is used for obtaining the interval time of the traffic light head according to the check value;
and the ID sending module 4 is used for sending the ID to the handheld controller according to the interval time.
On the basis of the foregoing embodiments, as an optional embodiment, a computing system for resolving parallel code sending collisions by using random numbers further includes: the device comprises a judgment module, a cycle execution module and a check value updating module.
The judging module is used for judging whether the response of the handheld controller is received or not within the interval time, and if the response of the handheld controller is received, the ID is not sent to the handheld controller any more;
the cycle execution module is used for updating the check value if the response of the handheld controller is not received, and executing the step of obtaining the interval time of the traffic light head according to the check value until the response of the handheld controller is determined to be received in the interval time;
and the verification value updating module is used for adding the last two bytes of the ID array to the upper 8 bits and the lower 8 bits of the verification value to generate a new ID array, and updating the verification value according to the new ID array.
It should be noted that: in the system provided in the above embodiment, when the functions of the system are implemented, only the division of the functional modules is illustrated, and in practical application, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to implement all or part of the functions described above. In addition, the system and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments in detail and are not described herein again.
An embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are suitable for being loaded by a processor and executing the method for calculating a random number to solve a parallel code sending conflict according to the foregoing embodiments, and a specific execution process may refer to specific descriptions of the embodiments shown in fig. 1 to fig. 3, which is not described herein again
Please refer to fig. 5, which is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 5, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, memory 1005, at least one communication bus 1002.
Wherein a communication bus 1002 is used to enable connective communication between these components.
The user interface 1003 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 1003 may further include a standard wired interface and a wireless interface.
The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
The Memory 1005 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable medium. The memory 1005 may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The memory 1005 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 5, a memory 1005, which is a computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an application program of a calculation method for resolving a parallel code transmission conflict with a random number.
It should be noted that: in the above embodiment, when the device implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
In the electronic device 1000 shown in fig. 5, the user interface 1003 is mainly used as an interface for providing input for a user, and acquiring data input by the user; and the processor 1001 may be configured to invoke an application program stored in the memory 1005 that stores a random number computation method for resolving parallel code transmission collisions, which when executed by the one or more processors, causes the electronic device to perform the method as described in one or more of the above embodiments.
An electronic device readable storage medium having instructions stored thereon. When executed by one or more processors, cause an electronic device to perform a method as described in one or more of the above embodiments.
It is clear to a person skilled in the art that the solution of the present application can be implemented by means of software and/or hardware. The "unit" and "module" in this specification refer to software and/or hardware that can perform a specific function independently or in cooperation with other components, where the hardware may be, for example, a Field-ProgrammaBLE Gate Array (FPGA), an Integrated Circuit (IC), or the like.
It should be noted that for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art will recognize that the embodiments described in this specification are preferred embodiments and that acts or modules referred to are not necessarily required for this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some service interfaces, devices or units, and may be an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned memory comprises: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program, which is stored in a computer-readable memory, and the memory may include: flash disks, read-Only memories (ROMs), random Access Memories (RAMs), magnetic or optical disks, and the like.
The above description is merely an exemplary embodiment of the present disclosure, and the scope of the present disclosure is not limited thereto. That is, all equivalent changes and modifications made in accordance with the teachings of the present disclosure are intended to be included within the scope of the present disclosure. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
Claims (10)
1. A calculation method for solving parallel code sending conflict by random numbers is characterized by being applied to traffic light heads, and comprises the following steps:
reading the ID of the lamp cap of the traffic light, and storing the ID into an ID array;
generating a check value according to the ID array;
obtaining the interval time of the traffic light head according to the check value;
and sending the ID to the handheld controller according to the interval time.
2. The method of claim 1, wherein generating the corresponding check value according to the ID array comprises:
and generating a check value corresponding to the ID array according to a CRC-16 algorithm.
3. The method for calculating the solution of the parallel code-sending conflict by the random number according to claim 1, wherein the obtaining of the interval time of the traffic light head according to the check value comprises:
and calculating the interval time of the check value according to a preset formula, wherein the preset formula is B = A/100+500, B represents the interval time, and A represents the check value.
4. The method of claim 1, wherein after sending the ID to the handheld controller at the interval, the method further comprises:
judging whether a response of the handheld controller is received or not in the interval time;
and if the response of the handheld controller is received, the ID is not sent to the handheld controller any more.
5. The method of claim 4, wherein the method further comprises:
if the response of the handheld controller is not received, updating the check value, and executing the step of obtaining the interval time of the traffic light head according to the check value;
until it is determined within the interval that a response of the handheld controller is received.
6. The method of claim 5, wherein the updating the check value comprises:
adding the last two bytes in the ID array to the upper 8 bits and the lower 8 bits of the check value to generate a new ID array;
and updating the check value according to the new ID array.
7. The method of claim 6, wherein the updating the check value according to the new ID array comprises:
and generating a new check value corresponding to the new ID array according to a CRC-16 algorithm, and replacing the check value with the new check value.
8. A system for computing random number resolution in parallel code transmission collisions, the system comprising:
the reading ID module (1) is used for reading the ID of the lamp cap of the traffic light and storing the ID into an ID array;
a check value generating module (2) for generating a check value according to the ID array;
the interval time calculating module (3) is used for obtaining the interval time of the traffic light head according to the check value;
and the ID sending module (4) is used for sending the ID to the handheld controller according to the interval time.
9. A computer-readable storage medium storing instructions that, when executed, perform the method steps of any of claims 1~7.
10. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1~7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211483333.5A CN115862352B (en) | 2022-11-24 | 2022-11-24 | Calculation method, system, medium and equipment for solving parallel code sending conflict by random number |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211483333.5A CN115862352B (en) | 2022-11-24 | 2022-11-24 | Calculation method, system, medium and equipment for solving parallel code sending conflict by random number |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115862352A true CN115862352A (en) | 2023-03-28 |
CN115862352B CN115862352B (en) | 2024-02-27 |
Family
ID=85665990
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211483333.5A Active CN115862352B (en) | 2022-11-24 | 2022-11-24 | Calculation method, system, medium and equipment for solving parallel code sending conflict by random number |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115862352B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6104333A (en) * | 1996-12-19 | 2000-08-15 | Micron Technology, Inc. | Methods of processing wireless communication, methods of processing radio frequency communication, and related systems |
CN1463097A (en) * | 2003-05-13 | 2003-12-24 | 武汉汉网高技术有限公司 | Random access method utilized in orthographic frequency division multiple access (OFDM) system |
CN101394334A (en) * | 2007-09-19 | 2009-03-25 | 北京中电华大电子设计有限责任公司 | Data packet scheduling transmitting device used for WLAN |
CN107466072A (en) * | 2017-07-21 | 2017-12-12 | 哈尔滨工程大学 | Multichannel parallel negotiations MAC protocol implementation method based on geographical location information |
CN114158117A (en) * | 2020-09-08 | 2022-03-08 | 普天信息技术有限公司 | Timing advance adjusting method, device, equipment and storage medium |
CN114600379A (en) * | 2019-04-11 | 2022-06-07 | 奈克赛特公司 | Wireless dual-mode identification tag |
-
2022
- 2022-11-24 CN CN202211483333.5A patent/CN115862352B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6104333A (en) * | 1996-12-19 | 2000-08-15 | Micron Technology, Inc. | Methods of processing wireless communication, methods of processing radio frequency communication, and related systems |
CN1463097A (en) * | 2003-05-13 | 2003-12-24 | 武汉汉网高技术有限公司 | Random access method utilized in orthographic frequency division multiple access (OFDM) system |
CN101394334A (en) * | 2007-09-19 | 2009-03-25 | 北京中电华大电子设计有限责任公司 | Data packet scheduling transmitting device used for WLAN |
CN107466072A (en) * | 2017-07-21 | 2017-12-12 | 哈尔滨工程大学 | Multichannel parallel negotiations MAC protocol implementation method based on geographical location information |
CN114600379A (en) * | 2019-04-11 | 2022-06-07 | 奈克赛特公司 | Wireless dual-mode identification tag |
CN114158117A (en) * | 2020-09-08 | 2022-03-08 | 普天信息技术有限公司 | Timing advance adjusting method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115862352B (en) | 2024-02-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3985639B1 (en) | Vehicle control method, apparatus, electronic device and vehicle | |
CN110535639A (en) | Block chain assets disposition method and relevant device based on more asset models | |
CN110930131A (en) | Vehicle maintenance method, device, equipment and medium | |
CN110956799B (en) | Traffic information processing method and device | |
CN111106989B (en) | Vehicle CAN bus protocol determining method and device | |
CN113872840A (en) | CAN data acquisition and transmission method, device and vehicle-mounted terminal | |
CN110083666B (en) | Server device, information collection system, information collection method, and recording medium | |
CN115862352B (en) | Calculation method, system, medium and equipment for solving parallel code sending conflict by random number | |
CN110046161A (en) | Method for writing data and device, storage medium, electronic equipment | |
CN114125941B (en) | Data packetizing method and device, electronic equipment and storage medium | |
CN108513357B (en) | Method and equipment for avoiding resource collision in motorcade | |
CN113793490B (en) | Pressure testing method and device for electronic fence, storage medium and terminal | |
CN115145241A (en) | SOA service-based remote diagnosis method for vehicle-end CAN node and storage medium | |
CN111196292B (en) | Train position drawing method, device, equipment and computer readable storage medium | |
CN113590943A (en) | Gas station recommendation method, system, electronic device and medium | |
CN109379211B (en) | Network monitoring method and device, server and storage medium | |
CN109410582B (en) | Traffic condition analysis method and terminal equipment | |
CN113672176A (en) | Data reading method, system, equipment and computer readable storage medium | |
CN112671853A (en) | Road condition information prompting method, device and equipment | |
CN113919511A (en) | Federal learning method and device | |
CN115973225A (en) | Method, device and medium for identifying rail transit vehicle reconnection mode | |
CN114758715B (en) | Method, device and equipment for lighting hard disk fault lamp and readable storage medium | |
CN114710479B (en) | Fault diagnosis method, device and system | |
CN114900390B (en) | Data transmission method, device, electronic equipment and storage medium | |
CN113411770B (en) | Method, device and equipment for selecting periodic resources and 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |