CN115862352B - Calculation method, system, medium and equipment for solving parallel code sending conflict by random number - Google Patents

Calculation method, system, medium and equipment for solving parallel code sending conflict by random number Download PDF

Info

Publication number
CN115862352B
CN115862352B CN202211483333.5A CN202211483333A CN115862352B CN 115862352 B CN115862352 B CN 115862352B CN 202211483333 A CN202211483333 A CN 202211483333A CN 115862352 B CN115862352 B CN 115862352B
Authority
CN
China
Prior art keywords
check value
traffic light
handheld controller
light lamp
array
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.)
Active
Application number
CN202211483333.5A
Other languages
Chinese (zh)
Other versions
CN115862352A (en
Inventor
顾雾睛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Optraffic Signs Co ltd
Original Assignee
Zhejiang Optraffic Signs Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Optraffic Signs Co ltd filed Critical Zhejiang Optraffic Signs Co ltd
Priority to CN202211483333.5A priority Critical patent/CN115862352B/en
Publication of CN115862352A publication Critical patent/CN115862352A/en
Application granted granted Critical
Publication of CN115862352B publication Critical patent/CN115862352B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Traffic Control Systems (AREA)

Abstract

The application relates to a calculation method, a system, a medium and equipment for solving parallel code sending conflict by a random number, wherein the method comprises the steps of reading an 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 lamp cap according to the check value; and sending the ID to the handheld controller according to the interval time. According to the traffic light lamp holder, the interval time of sending the ID to the handheld controller is controlled, the time of sending the ID to the handheld controller by the plurality of traffic light lamp holders is staggered, and signal blocking caused when the plurality of traffic light lamp holders send signals to the handheld controller can be effectively prevented.

Description

Calculation method, system, medium and equipment for solving parallel code sending conflict by random number
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, a system, a medium, and an apparatus for calculating a parallel code transmission conflict by using a random number.
Background
The traffic signal lamp is a signal lamp for directing traffic to run, is also commonly called a traffic light, and is also a central heart of a traffic system. In order to enhance road traffic management, reduce traffic accidents and improve road use efficiency, traffic lights are usually set up at intersections and other places needing to be controlled, and are controlled by a road traffic signal controller to guide vehicles and pedestrians to pass through safely and orderly, and all traffic participants need to execute 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 is easy to cause traffic accidents on road sections where traffic accidents or road finishing occur, the movable traffic signal lamps appear, and the movable traffic signal lamps can be temporarily applied to road sections where traffic commands are required.
After each traffic light lamp holder of the mobile traffic light is simultaneously started, the mobile traffic light starts to be paired with a handheld controller for controlling each traffic light lamp holder, and because the handheld controller can only receive information of one traffic light lamp holder at the same time, when two traffic light lamp holders send signals to the handheld controller at the same time, signal collision is easy to occur.
Disclosure of Invention
In order to prevent signal collision when a plurality of traffic light heads simultaneously send signals to a handheld controller, the application provides a calculation method, a system, a medium and equipment for solving parallel code sending collision by using random numbers.
In a first aspect of the present application, a calculation method for solving parallel code sending conflict by using a random number is provided, and the calculation method is applied to a traffic light lamp cap, and adopts the following technical scheme:
reading the 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 lamp cap according to the check value;
and sending the ID to the handheld controller according to the interval time.
Through adopting above-mentioned technical scheme, read the ID of traffic light lamp holder, because the ID of each traffic light lamp holder is unique when producing, store ID in the ID array in order to produce the check value, obtain the interval time of traffic light lamp holder according to the check value, this interval time is equivalent to a random number, send ID to handheld controller according to interval time, because the ID of each traffic light lamp holder is different, the check value that generates also is different, thereby the interval time of each traffic light lamp holder is also different, the time of ID will stagger to handheld controller simultaneously to a plurality of traffic light lamp holders, thereby effectively prevent causing signal blocking when a plurality of traffic light lamp holders send the signal to handheld controller simultaneously.
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, CRC-16 is a common error check code, and the lengths of an information field and a check field can be arbitrarily selected.
Optionally, the obtaining the interval time of the traffic light lamp cap according to the check value includes: calculating the interval time 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 the interval time of the traffic light lamp holders is obtained by adding 500, so that the interval time of each traffic light lamp holder is different because the check value of each traffic light lamp holder is different, the pairing time points of a plurality of traffic light lamp holders and the handheld controller are staggered through the time interval of each traffic light lamp holder, and the signal conflict caused when the plurality of traffic light lamp holders send signals to the controller simultaneously is effectively reduced.
Optionally, after the sending the ID to the handheld controller at the interval time, the method further includes: judging whether a response of the handheld controller is received or not in the interval time; if a response is received from the handheld controller, the ID is no longer sent to the handheld controller.
By adopting the technical scheme, whether the traffic light lamp holder receives the response of the handheld controller is judged in the time interval, if the traffic light lamp holder receives the response of the handheld controller, the pairing of the traffic light lamp holder and the handheld controller is successful, the ID is not sent to the handheld controller any more, the ID is not sent to the handheld controller by the traffic light lamp holder which is paired successfully, the sending amount of the ID sent to the handheld controller by the traffic light lamp holder is reduced, and meanwhile, the probability of collision is further reduced.
Optionally, 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 lamp cap according to the check value; until it is determined that a response of the handheld controller is received within the interval.
By adopting the technical scheme, if the traffic light lamp holder does not receive the response of the handheld controller, updating the check value to obtain a new check value, and repeatedly executing the step of obtaining the interval time of the traffic light lamp holder according to the new check value until the traffic light lamp holder receives the response of the handheld controller within the interval time, namely indicating that the pairing of the traffic light lamp holder is successful.
Optionally, the updating the check value includes: adding the last two bytes of the ID array with 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 after no response of the handheld controller is received, the new ID array is regenerated, the check value is updated through the new ID array, after the check value is updated, the time interval of each transmission of the traffic light lamp cap to the handheld controller is different before the response of the handheld controller is not obtained, and the occurrence of conflict 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 by the new check value.
By adopting the technical scheme, after each time a new ID array is generated, 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 traffic light lamp cap and storing the ID into an ID array;
the check value generation module is used 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 lamp cap 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.
Through adopting above-mentioned technical scheme, read the ID of traffic light lamp holder, because the ID of each traffic light lamp holder is unique when producing, store ID in the ID array in order to produce the check value, obtain the interval time of traffic light lamp holder according to the check value, this interval time is equivalent to a random number, send ID to handheld controller according to interval time, because the ID of each traffic light lamp holder is different, the check value that generates also is different, thereby the interval time of each lamp holder is also different, stagger the time that sends ID simultaneously to handheld controller with a plurality of traffic light lamp holders, effectively prevent causing signal blocking when a plurality of traffic light lamp holders send the signal to handheld controller simultaneously.
In a third aspect the present application provides a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-described 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 and the device, the interval time of sending the ID to the handheld controller by the traffic light lamp holders is controlled through calculation, and the time of sending the ID to the handheld controller by the plurality of red and green lamp holders is staggered, so that signal blocking caused when the plurality of lamp holders send signals to the handheld controller at the same time is effectively prevented;
2. if the traffic light lamp holder receives the response of the handheld controller within the time interval, the traffic light lamp holder is successfully paired with the handheld controller, at the moment, the ID is not sent to the handheld controller any more, the traffic light lamp holder successfully paired each time does not send the ID to the handheld controller any more, the sending amount of the ID sent by the traffic light lamp holder to the handheld controller is smaller and smaller, and the probability of signal collision is smaller and smaller;
3. if the traffic light lamp holder 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 the check value is updated through the new ID array, so that the time interval of each transmission of the traffic light lamp holder to the handheld controller is different before the response of the handheld controller is not obtained, and the occurrence 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 that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a calculation method for solving parallel code sending conflict by using a random number according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for calculating a parallel code transmission conflict by using a random number according to an embodiment of the present application;
fig. 3 is a schematic flow chart of an example principle of a calculation method for solving parallel code sending conflict by using a random number according to an embodiment of the present application;
FIG. 4 is a schematic 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.
Reference numerals illustrate: 1. reading an ID module; 2. generating a check value module; 3. calculating an interval time module; 4. an ID module is sent; 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 the technical solutions in the present specification better understood by those skilled in the art, 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 some embodiments of the present application, but not all embodiments.
In the description of embodiments of the present application, words such as "exemplary," "such as" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "illustrative," "such as" or "for example" is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "illustratively," "such as" or "for example," etc., is intended to present related concepts in a concrete fashion.
In the description of the embodiments of the present application, the term "and/or" is merely an association relationship describing an association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a alone, B alone, and both A and B. In addition, unless otherwise indicated, the term "plurality" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating an indicated technical feature. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such 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 is easy to cause traffic accidents on road sections where traffic accidents or road finishing occur, the movable traffic signal lamps appear, and the movable traffic signal lamps can be temporarily applied to road sections where traffic commands are required.
After each traffic light lamp holder of the mobile traffic light is started, the mobile traffic light starts to be paired with the handheld controller for controlling each traffic light lamp holder, and as the handheld controller can only receive information of one traffic light lamp holder at the same time, signal collision is easy to cause when two traffic light lamp holders send signals to the handheld controller at the same time.
The following embodiments may be combined with each other, and may not be described in detail in some embodiments for the same or similar probability or process, and embodiments of the present application will be described below with reference to the accompanying drawings.
In one embodiment, as shown in fig. 1, a flowchart of a method for calculating a random number to resolve parallel code transmission collision is specifically provided. The method is mainly applied to traffic light lamp holders, and the specific method comprises the following steps:
step 101: and reading the ID of the traffic light lamp cap, and storing the ID into an ID array.
In the embodiment of the application, the traffic light lamp cap can be a movable traffic signal lamp. When the traffic light lamp cap is produced, production equipment personnel write the ID of each traffic light lamp cap into the traffic light lamp cap, wherein the ID can be the only ID representing the traffic light lamp cap and can be composed of a plurality of characters.
Specifically, the traffic light lamp cap reads the ID information of the traffic light lamp cap and stores the ID information of the traffic light lamp cap into the ID array. The ID of the traffic light head can be set according to specific situations during production, for example, the traffic light head 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, and is used for checking the correctness of the set of data, in this embodiment of the present application, the check value corresponding to the traffic light cap ID is generated according to CRC-16, where CRC-16 is a cyclic redundancy check, and is a hash function for generating a short fixed bit check code according to the data.
Step 103: and obtaining the interval time of the traffic light lamp cap according to the check value.
Specifically, the check value is divided by 100 and added with 500 to obtain the interval time of the traffic light lamp cap. The interval of the traffic light head in the embodiment of the present application is an interval in milliseconds. Because the ID of each traffic light lamp cap is different when in production, the obtained ID array is also different, and the check value generated according to the ID array is different, so that the interval time of each traffic light lamp cap calculated according to the check value of each traffic light lamp cap is also different.
Step 104: the ID is sent to the handheld controller at intervals.
Specifically, the handheld controller refers to a controller capable of controlling traffic light lamp holders in a certain range. After the interval time of each traffic light lamp holder is calculated, each traffic light lamp holder sends an ID to the handheld controller according to each interval time, and connection is established with the handheld controller. Because the calculated interval time of each traffic light lamp cap is different, the interval time of sending ID to the handheld controller by all traffic light lamp caps within a certain range is different. In the embodiment of the application, the handheld controller can control the traffic light lamp holder connected with the handheld controller within 1.6 km. By calculating the time interval of each traffic light lamp holder, the time of sending IDs to the handheld controller by all the traffic light lamp holders is staggered in a millisecond-level interval time intervention mode, and signal blocking caused when a plurality of traffic light lamp holders send signals to the handheld controller at the same time can be effectively prevented.
Referring to fig. 2, as an alternative embodiment, a method for calculating a random number to resolve parallel code collision further includes:
step 201: and sending the ID to the handheld controller according to the interval time, and judging whether the response of the handheld controller is received or not in the interval time.
Specifically, after each traffic light head is turned on, pairing with the handheld controller is started, and the specific pairing process refers to the steps 101-105, and sends an ID to the handheld controller according to the calculated interval time of each traffic light head. It is determined during the interval whether a response of the handheld controller is received, which may be in the form of a signal.
Step 202: if a response is received from the handheld controller, the ID is no longer sent to the handheld controller.
Specifically, if the traffic light head receives the response of the handheld controller, that is, the traffic light head and the handheld controller are successfully paired, the handheld controller does not send an ID to the handheld controller. And the traffic light lamp caps successfully paired each time do not send the ID to the handheld controller, so that the sending amount of the ID sent by the traffic light lamp caps to the handheld controller is smaller and smaller, and the probability of collision is further reduced.
Step 203: 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 lamp cap according to the check value until the response of the handheld controller is received within the interval time.
Specifically, if no response of the handheld controller is received, adding the last two bytes of the ID array of the traffic light cap with the high 8 bits and the low 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 new check value with the previous check value, dividing the new check value by 100, adding 500 to obtain a new time interval of the traffic light cap, and continuing to determine whether the response of the handheld controller is received by the traffic light cap, so as to cycle until the response of the handheld controller is determined to be received within the time interval, so that all traffic light caps within a certain range can be paired one by one. In the embodiment of the application, the traffic light lamp holder successfully matched with the traffic light lamp holder can be used as the host, the traffic light lamp holder successfully matched with the traffic light lamp holder subsequently can be used as the slave, and in other feasible embodiments, the host 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 to resolve parallel code transmission conflict, further includes:
in one possible embodiment, the traffic light head is connected in wireless communication with the manager terminal device. If the traffic light lamp cap is not successfully matched within the preset times, the traffic light lamp cap is indicated to possibly fail, and the ID of the traffic light lamp cap is sent to the terminal equipment of the manager so that the professional can overhaul. The traffic light lamp cap is provided with a camera which can be used for monitoring the traffic flow of the road section and the running condition of the road surface vehicle. The general traffic light lamp holder is arranged at the crossroad, if the first traffic light lamp holder corresponds to a first road and the second traffic light lamp holder 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 green light time of the first traffic light lamp holder can be increased, and the green light time of the corresponding second traffic light lamp holder can be correspondingly reduced. For example, at an intersection of two roads, in a certain time period of each day, the traffic flow of the first road is always far greater than that of the second road, and then the traffic light duration of the first traffic light lamp cap and the second traffic light lamp cap can be adjusted so as to increase the traffic efficiency of vehicles at the intersection.
Fig. 3 is a schematic flow chart of an example of a method for calculating a parallel code transmission conflict by using a random number according to an embodiment of the present application. The implementation principle of this exemplary embodiment is: the traffic light lamp cap receives and reads the ID written into the traffic light lamp cap during production, stores the ID into a corresponding PL-ID-crc array, generates a crc check value according to the ID group number of each traffic light lamp cap, divides the crc check value by 100, and adds 500 to obtain interval time, and the traffic light lamp cap judges whether the response of the handheld controller is received. If the response of the handheld controller is received within the interval time, the self ID is not sent to the handheld controller, and the traffic light lamp cap is successfully matched with the handheld controller; if no response of the handheld controller is received within the interval time, after the interval time, adding the last two bytes of the PL-ID-crc array with the upper 8 bits and the lower 8 bits of the crc check value to generate a new array, generating a new crc check value according to the new array, returning to continue to execute the step of dividing the new crc check value by 100 and adding 500 to obtain the interval time, and judging whether the response of the handheld controller is received by the traffic light head until the response of the handheld controller is received within the interval time. Through this embodiment of the application, calculate the interval time that control traffic light lamp holder sent ID to handheld controller, stagger the time that a plurality of red green lamp holders sent ID to handheld controller simultaneously, the code time of automatically regulated traffic light lamp holder staggers the pairing moment with handheld controller promptly, effectively prevents to cause signal blocking when a plurality of traffic light lamp holders send the signal to handheld controller simultaneously.
The following are system embodiments of the present application, which may be used to perform method embodiments of the present application. For details not disclosed in the system embodiments of the present application, please refer to the method embodiments of the present application:
referring to fig. 4, a computing system for resolving parallel code transmission conflicts by using random numbers is provided in an embodiment of the present application. A computing system for random number resolution parallel code collision may include: the device comprises an ID reading module 1, a check value generating module 2, a calculation interval time module 3 and a ID sending module 4, wherein:
the reading ID module 1 is used for reading the ID of the traffic light lamp cap and storing the ID into an ID array;
the check value generation module 2 is used 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 lamp cap 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 solving parallel code sending conflict by using a random number, further includes: the device comprises a judging module, a cyclic 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 in the interval time, and if the response of the handheld controller is received, the ID is not sent to the handheld controller;
the circulation execution module is used for updating the check value if no response of the handheld controller is received, and executing the step of obtaining the interval time of the traffic light lamp cap according to the check value until the response of the handheld controller is received within the interval time;
and the check value updating module is used for adding the last two bytes of the ID array with 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.
It should be noted that: in the system provided in the above embodiment, when implementing the functions thereof, only the division of the above functional modules is used as an example, in practical application, the above functional allocation may be implemented by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the system and method embodiments provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the system and method embodiments are detailed in the method embodiments, which are not repeated herein.
The 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 adapted to be loaded by a processor and execute a method for calculating a random number to resolve parallel code conflicts as described in the foregoing embodiment, and the specific execution process may be referred to the specific description of the embodiment shown in fig. 1 to 3, which is not repeated herein
Referring to fig. 5, a schematic structural diagram of an electronic device is provided in an embodiment of the present application. 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, a memory 1005, at least one communication bus 1002.
Wherein the communication bus 1002 is used to enable connected 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.
Wherein the processor 1001 may include one or more processing cores. The processor 1001 connects various parts within the entire server 1000 using various interfaces and lines, and performs various functions of the server 1000 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Alternatively, the processor 1001 may be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 1001 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 1001 and may be implemented by a single chip.
The Memory 1005 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer readable medium (non-transitory computer-readable storage medium). The memory 1005 may be used to store instructions, programs, code, sets of codes, or sets 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 above-described respective method embodiments, etc.; the storage data area may store data or the like referred to in the above respective method embodiments. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 5, an operating system, a network communication module, a user interface module, and an application program of a calculation method of a random number to resolve parallel code transmission conflicts may be included in a memory 1005 as a computer storage medium.
It should be noted that: in the device provided in the above embodiment, when implementing the functions thereof, only the division of the above functional modules is used as an example, in practical application, the above functional allocation may be implemented by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the embodiments of the apparatus and the method provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the embodiments of the method are detailed in the method embodiments, which are not repeated herein.
In the electronic device 1000 shown in fig. 5, the user interface 1003 is mainly used for providing an input interface for a user, and acquiring data input by the user; and processor 1001 may be configured to invoke an application program in memory 1005 that stores a method of calculating a random number to resolve parallel code conflicts, which when executed by one or more processors, causes the electronic device to perform the method as described in one or more of the embodiments above.
An electronic device readable storage medium, wherein the electronic device readable storage medium stores instructions. When executed by one or more processors, cause an electronic device to perform the method as described in one or more of the embodiments above.
It will be clear to a person skilled in the art that the solution of the present application may be implemented by means of software and/or hardware. "Unit" and "module" in this specification refer to software and/or hardware capable of performing a specific function, either alone or in combination with other components, such as Field programmable gate arrays (Field-ProgrammaBLE Gate Array, FPGAs), integrated circuits (Integrated Circuit, ICs), etc.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, such as the division of the units, merely a logical function division, and there may be additional manners of dividing the actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some service interface, device or unit indirect coupling or communication connection, electrical or otherwise.
The units described as separate units may or may not be physically separate, and units shown 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 may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a memory, including several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application. And the aforementioned memory includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be performed by hardware associated with a program that is stored in a computer readable memory, which may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing is merely exemplary embodiments of the present disclosure and is not intended to limit the scope of the present disclosure. That is, equivalent changes and modifications are contemplated by the teachings of this disclosure, which fall 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 adaptations, 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 scope and spirit of the disclosure being indicated by the claims.

Claims (5)

1. The calculation method for solving parallel code sending conflict by using random numbers is characterized by being applied to traffic light lamp holders, and comprises the following steps:
reading the ID of a traffic light lamp cap, and storing the ID into an ID array;
generating a check value corresponding to the ID array according to a CRC-16 algorithm;
calculating the interval time 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;
sending the ID to a handheld controller according to the interval time;
judging whether a response of the handheld controller is received or not in the interval time;
if a response of the handheld controller is received, the ID is not sent to the handheld controller any more;
if the response of the handheld controller is not received, adding the last two bytes in the ID array with the upper 8 bits and the lower 8 bits of the check value to generate a new ID array;
updating the check value according to the new ID array, and executing the step of obtaining the interval time of the traffic light lamp cap according to the check value;
until it is determined that a response of the handheld controller is received within the interval.
2. The method for calculating the random number to solve the parallel code transmission collision according to claim 1, 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 by the new check value.
3. A computing system for random number resolution of parallel code collisions, said system comprising:
the reading ID module (1) is used for reading the ID of the traffic light lamp cap and storing the ID into an ID array;
the check value generation module (2) is used for generating a check value corresponding to the ID array according to a CRC-16 algorithm;
the interval time calculating module (3) is used for calculating the interval time 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;
a transmission ID module (4) for transmitting the ID to the handheld controller at the interval time; judging whether a response of the handheld controller is received or not in the interval time; if a response of the handheld controller is received, the ID is not sent to the handheld controller any more; if the response of the handheld controller is not received, adding the last two bytes in the ID array with the upper 8 bits and the lower 8 bits of the check value to generate a new ID array; updating the check value according to the new ID array, and executing the step of obtaining the interval time of the traffic light lamp cap according to the check value; until it is determined that a response of the handheld controller is received within the interval.
4. A computer readable storage medium storing instructions which, when executed, perform the method steps of any one of claims 1-2.
5. 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-2.
CN202211483333.5A 2022-11-24 2022-11-24 Calculation method, system, medium and equipment for solving parallel code sending conflict by random number Active CN115862352B (en)

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 CN115862352A (en) 2023-03-28
CN115862352B true 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)

* Cited by examiner, † Cited by third party
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
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
CN115862352A (en) 2023-03-28

Similar Documents

Publication Publication Date Title
CN108829613B (en) Data storage method and storage device
CN110930131A (en) Vehicle maintenance method, device, equipment and medium
CN110191437B (en) Emergency vehicle authentication method and related equipment
EP2919120A1 (en) Memory monitoring method and related device
CN111106989B (en) Vehicle CAN bus protocol determining method and device
CN112100090A (en) Data access request processing method, device, medium and memory mapping controller
CN112078628A (en) Train linkage control method and device
CN115862352B (en) Calculation method, system, medium and equipment for solving parallel code sending conflict by random number
CN110083666B (en) Server device, information collection system, information collection method, and recording medium
CN110956799A (en) Traffic information processing method and device
CN111106987A (en) CAN message sending method, device, storage medium and electronic equipment
CN109816993B (en) Method for identifying vehicle rapid acceleration behavior and related equipment
CN106488563A (en) A kind of resource selection method and device
CN108986256B (en) Train running recording method and device
CN110046161A (en) Method for writing data and device, storage medium, electronic equipment
CN108513357B (en) Method and equipment for avoiding resource collision in motorcade
CN112948812B (en) Verification code distribution method, computing device and storage medium
CN112804115B (en) Method, device and equipment for detecting abnormity of virtual network function
CN109857469B (en) Display screen control method and related product
CN113919511A (en) Federal learning method and device
CN104348906B (en) Data agreement method and device in a kind of distributed system
CN112363828A (en) Memory fragment management method and device, vehicle-mounted system and vehicle
CN106559835A (en) A kind of car networking communication means and device
CN114338730B (en) Block chain consensus method and system for Internet of vehicles communication scene
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