Simulation method and system for bus terminal equipment in embedded system

By using simulated terminal devices in embedded systems, and by passive reply and active triggering programs to simulate communication between the terminal and the controller, the cost consumption and failure problems caused by a large number of terminal devices during the test are solved, and an efficient test process and cost-reducing effect is achieved.

CN119882691APending Publication Date: 2025-04-25SHENZHEN FANHAI SANJIANG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510061406.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In embedded systems in the field of fire electronics, a large number of terminal equipment are required to cooperate during the test, resulting in high cost and prone to failure.

Method used

Using the simulated terminal equipment, by setting a passive reply program and an active trigger program, the simulated terminal receives external instructions, confirms the source of the instruction, executes the corresponding program, simulates the communication between the terminal and the controller, and realizes the simulation of multiple controller terminal terminals.

Benefits of technology

By simulating the communication between the real terminal and the fire controller, the number of actual terminal equipment is reduced, the time and cost consumption of the connection process is reduced, and at the same time, it is ensured that each terminal of the same type is exactly the same, making it easier to troubleshoot when problems occur.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119882691A_ABST
    Figure CN119882691A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of fire-fighting electronics, in particular to a simulation method for bus terminal equipment in an embedded system, which comprises a simulation terminal. The simulation terminal is provided with a passive reply program and an active trigger program, and the simulation method comprises the steps that the simulation terminal receives an external instruction and confirms that the external instruction is an instruction sent by a user or an instruction sent by a controller; if the instruction is the instruction sent by the user, the simulation terminal executes an active triggering program; performing instruction processing, triggering a corresponding event, sending the event to the controller, receiving an event confirmation command sent by the controller, and feeding back an execution result to the user; after the controller sends an event confirmation command, a user can check whether event reporting succeeds or not on the controller; if the instruction is the instruction sent by the controller, the simulation terminal executes a passive reply program; and executing the general inspection instruction sent by the controller, and feeding back an instruction execution result to the controller. The problems that a large number of terminal control systems are high in cost consumption and prone to faults in the testing process are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of fire protection electronic technology, and more specifically to a simulation method and system for bus terminal equipment in an embedded system. Background Art

[0002] At present, embedded systems are increasingly widely used in the field of fire electronics. Many embedded systems use a series of field buses to connect all terminal devices. There are many types and quantities of such terminal devices, and in the process of testing the controller functions, it is necessary to simulate an environment similar to the field.

[0003] In the prior art, when a controller is functionally tested, a large number of actual terminals are generally prepared according to test requirements and connected to the controller for testing. During the test, a lot of time is required to prepare the terminals and build the environment.

[0004] Regarding the above-mentioned related technologies, in the process of developing and designing fire controllers, a large number of terminals are required for cooperative testing, and some scenarios in the fire protection field are not easy to reproduce. Each terminal has an independent set of hardware. The use of a large number of terminal controllers not only needs to consider the cost consumption of the terminal, but also the problems caused by the failure of some terminals. A terminal simulation method is needed to reduce the terminal equipment during testing. Summary of the invention

[0005] In order to solve the problem that a large number of terminal control systems are costly and prone to failure during testing, the present invention provides a simulation method for bus terminal devices in an embedded system and a simulation system for bus terminal devices in an embedded system in view of the above-mentioned defects of the prior art.

[0006] on the one hand

[0007] The technical solution adopted by the present invention to solve the technical problem is: a simulation method of a bus terminal device in an embedded system, including a simulation terminal; the simulation terminal is provided with a passive reply program and an active trigger program, and the simulation method includes the steps of:

[0008] The simulation terminal receives an external instruction and confirms that the external instruction is an instruction sent by a user or an instruction sent by a controller;

[0009] If it is a command sent by the user, the simulated terminal will execute the active trigger program; process the command, trigger the corresponding event and send it to the controller, receive the event confirmation command sent by the controller, and feedback the execution result to the user; after the controller sends the event confirmation command, the user can check whether the event report is successful on the controller;

[0010] If it is a command sent by the controller, the simulated terminal executes the passive reply program; executes the general inspection command sent by the controller, and feeds back the command execution result to the controller.

[0011] Preferably, the general inspection instruction sent by the execution controller and feeding back the instruction execution result to the controller include:

[0012] Step S01, receiving a data frame sent by a controller, and parsing the data frame according to a communication protocol to obtain valid data;

[0013] Step S02, classify the data frames of various commands sent by the controller according to the number of single query addresses; if it is a group inspection, proceed to step S03, if it is a general inspection, proceed to step S04;

[0014] Step S03, determining whether there is an address in the current inspection group within the simulated address range; if so, proceed to step S031; if not, proceed to step S032;

[0015] Step SO31, set 1 in the group inspection corresponding position, and enter step S05;

[0016] Step S032, set the corresponding bit of the group inspection to 0, and go to step S05;

[0017] Step S04, traverse the configuration structure according to the address keyword to determine whether the current inspection address is within the simulation address range; if so, proceed to step S041, if not, proceed to step S042;

[0018] Step S041, the corresponding address is processed according to the frame command, the data is stored in its data structure, the analog data of the corresponding address is found from the data structure and replied according to the protocol structure, and the program ends;

[0019] Step S042: No reply, the program ends;

[0020] Step S05, determine whether the current group has been searched. If the search is completed, write the search result of the current group into the data structure for reply, and the program ends; if the search is not completed, return to step S03 until all addresses in a group are traversed and the program ends.

[0021] Preferably, the performing instruction processing, triggering a corresponding event and sending it to the controller, receiving an event confirmation command sent by the controller, and feeding back the execution result to the user includes:

[0022] Step S11, receiving a data frame sent by an external communication interface, parsing the data frame according to a set protocol and obtaining valid data;

[0023] Step S12, classify the data frame according to the operation type, if it is determined to be a configuration command, proceed to step S13, if it is determined to be a general command, proceed to step S14;

[0024] Step S13, initialize the data structure of the corresponding address according to the configuration data of the incoming frame, write the data into the flash, and proceed to step S15;

[0025] Step S14, determine whether the address pointed to by the current command is within the simulated address range, if yes, proceed to step S141, if not, the command is invalid and proceed to step S15;

[0026] Step S141, process the corresponding address according to the frame command, and focus on reporting related events through the corresponding address, and enter step S15;

[0027] Step S15, feeding back relevant information to the external communication interface, and the program ends.

[0028] Preferably, a key value is set in the data structure of the simulated terminal, and each terminal data and characteristic data of each terminal are stored.

[0029] Preferably, the terminal data of each type and the characteristic data of each type of terminal in the simulated terminal remain unchanged.

[0030] Preferably, the simulated terminal has basic data, and the basic data includes the number of terminals simulated by the simulated terminal, the terminal type represented by each key value, and the basic status of the terminal represented by each key value.

[0031] Preferably, a flag bit is set in the simulation terminal, and the flag bit is divided into a flag bit owned by the simulation terminal as a whole and a flag bit independently owned by the key value. The flag bit owned by the simulation terminal as a whole includes a reset instruction, a set reset flag, and an instruction to reset the entire simulation terminal. The flag bit independently owned by the key value includes a fire alarm instruction, a fire alarm flag bit of the terminal corresponding to the set key value, and an instruction to report a fire alarm to the corresponding key value terminal.

[0032] on the other hand

[0033] A simulation system for a bus terminal device in an embedded system, used to implement a simulation method for a bus terminal device in an embedded system as claimed in any one of claims 1 to 7, wherein the simulation system comprises a simulation terminal.

[0034] Preferably, the simulation system further comprises a controller.

[0035] The beneficial effects of the present invention are as follows: by simulating the communication between the real terminal and the fire controller, the communication with the controller is achieved by passively replying and actively triggering a certain communication message method. At the same time, due to the use of simulation, one simulation device can correspond to multiple controller terminal terminals, which solves the problem of requiring more terminal auxiliary testing, reduces the time and cost of the connection process, and is sufficient to ensure that each simulated terminal of the same type is exactly the same, making it easier to troubleshoot when problems arise. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work:

[0037] Figure 1 It is a schematic diagram of the post-processing sequence using the simulation terminal in Example 1 of the present invention.

[0038] Figure 2 It is a flowchart of the passive recovery procedure of Example 1 of the present invention.

[0039] Figure 3 It is a flowchart of the active triggering program of Example 1 of the present invention.

[0040] Figure 4 It is a schematic diagram of the existing simulation terminal test.

[0041] Figure 5 This is a schematic diagram of a simulated terminal test according to Embodiment 1 of the present invention.

[0042] Figure 6 It is a schematic diagram of a simulation system of a bus terminal device in an embedded system according to Embodiment 2 of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the following will be described clearly and completely in combination with the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are partial embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.

[0044] Example 1

[0045] The preferred embodiment of the present invention is Figure 1As shown, a simulation method of a bus terminal device in an embedded system includes a simulation terminal 21, and the simulation terminal 21 is provided with a passive reply program and an active trigger program. The simulation method includes the steps of:

[0046] The simulation terminal 21 receives the external instruction and confirms that the external instruction is an instruction sent by the user or an instruction sent by the controller 22;

[0047] If it is a command sent by the user, the simulation terminal 21 executes the active triggering program; processes the command, triggers the corresponding event and sends it to the controller 22, receives the event confirmation command sent by the controller 22, and feeds back the execution result to the user; after the controller 22 sends the event confirmation command, the user can check whether the event reporting is successful on the controller;

[0048] If it is an instruction sent by the controller 22 , the simulation terminal 21 executes a passive reply procedure; executes a general inspection instruction sent by the controller 22 , and feeds back the instruction execution result to the controller 22 .

[0049] Reference Figure 2 , execute the general inspection command sent by the controller 22, and feedback the command execution result to the controller 22, including:

[0050] Step S01, receiving a data frame sent by the controller 22, and parsing the data frame according to the communication protocol to obtain valid data;

[0051] Step S02, classify various commands sent by the controller 22 according to the number of single query addresses; if it is a group inspection, go to step S03, if it is a general inspection, go to step S04; group inspection can speed up reporting and query terminals within a certain address group at the same time; the address range comes from the configuration imported by the user; general inspection is to query the terminal of a certain address;

[0052] Step S03, determining whether there is an address in the current inspection group within the simulated address range; if so, proceed to step S031; if not, proceed to step S032;

[0053] Step SO31, set the corresponding bit of the group inspection to 1, and proceed to step S05; as an optional embodiment, if the first bit of the first group exists, the first bit of the first byte of the reply data frame is set to 1;

[0054] Step S032, set the corresponding bit of the group inspection to 0, and proceed to step S05; as an optional embodiment, if the first bit of the first group does not exist, the first bit of the first byte of the reply data frame is set to 0;

[0055] Step S04, traverse the configuration structure according to the address keyword to determine whether the current inspection address is within the simulation address range; if so, proceed to step S041, if not, proceed to step S042;

[0056] Step S041, process the corresponding address according to the frame command, save the data in its data structure, find the analog data of the corresponding address from the data structure and reply according to the protocol structure, and the program ends; after processing, write the current state into the data structure for the next query;

[0057] Step S042: No reply, the program ends; if the current address does not exist, empty data is replied, indicating that the terminal at the changed address is not connected;

[0058] Step S05, determine whether the current group has been searched. If the search is completed, write the search result of the current group into the data structure for reply. If the search is not completed, return to step S03; it is necessary to find whether all addresses in a group have been traversed, and the program ends.

[0059] Reference Figure 3 , perform instruction processing, trigger corresponding events and send them to the controller 22, receive event confirmation commands sent by the controller 22, and feedback the execution results to the user, including:

[0060] Step S11, receiving a data frame sent by an external communication interface, parsing the data frame according to a set protocol and obtaining valid data; as an optional embodiment, the data frame may be a serial port data frame, a network data frame, etc.;

[0061] Step S12, classify the data frame according to the operation type, if it is determined to be a configuration command, proceed to step S13, if it is determined to be a general command, proceed to step S14;

[0062] The configuration command mainly writes configuration data to the simulation terminal 21, which can be configured as needed. For example, the number, type, and address of terminals can be set arbitrarily without the need to build the coding, installation, and configuration addresses of the real terminal environment; general commands operate on some address terminals of the simulation terminal 21. As an optional embodiment, such as simulating fire alarms, faults, resets, etc., a large number of address terminal event reports can be triggered at the same time to simplify operations. For example, if 10 alarm buttons are pressed and 10 address terminals fail, only one command needs to be sent for control without the need to operate each address terminal one by one.

[0063] Step S13, initialize the data structure of the corresponding address in the simulation terminal 21 according to the configuration data of the incoming frame, write the data into the flash, and enter step S15; it is convenient to continue to use the configuration information after reset and power failure;

[0064] Step S14, determine whether the address pointed to by the current command is within the simulated address range, if so, proceed to step S141, if not, the command is invalid and proceed to step S15; that is, whether the address range pointed to in the command is a subset of the address range of the simulated terminal 21; the command is invalid, that is, the address range is not within the address range of the simulated terminal 21, and naturally the relevant event cannot be triggered;

[0065] Step S141, according to the frame command, the corresponding address is processed, and the corresponding address on the simulation terminal 21 focuses on reporting the relevant events, and then proceeds to step S15; as an optional embodiment, if the triggering of a fire alarm or a fault is manifested in setting certain flags in the software, after the software processes, the corresponding address terminal on the simulation terminal 21 will report the relevant events;

[0066] Step S15, reply relevant information to the external communication interface, and the program ends.

[0067] Key values ​​are set in the data structure of the simulated terminal 21, and each terminal data and characteristic data of each terminal are saved. When there are many simulated terminals, they can be searched according to the key values ​​to improve software efficiency. In addition to the key values, each terminal and the characteristics of each terminal need to be saved, and the data used to distinguish different terminal types remains unchanged.

[0068] The external communication interface can transmit basic data to the simulation terminal 21, and the basic data includes the number of terminals simulated by the simulation terminal 21, the terminal type represented by each key value, and the basic state of the terminal represented by each key value. As an optional embodiment, the external communication interface of the simulation terminal 21 can be selected according to hardware resources, such as serial port, CAN, RS485, and its communication protocol has no specific requirements, so long as a large amount of initialization data and a single trigger command can be correctly and quickly transmitted to the simulation terminal 21.

[0069] Flags are set in the simulation terminal 21, and the flags are divided into flags owned by the simulation terminal 21 as a whole and flags owned independently by key values. The flags owned by the simulation terminal 21 as a whole include reset instructions, setting reset flags, and resetting the entire simulation terminal 21 flag. The flags owned independently by key values ​​include fire alarm instructions, setting the fire alarm flag of the terminal corresponding to the key value, and the corresponding key value terminal reporting fire alarm instructions.

[0070] Reference Figure 4 and Figure 5, an actual simulation terminal 21 can simulate N terminals (determined by software design, controller 22, hardware, etc.), and the terminal types may also be different (determined by the initial configuration data input). Different terminal types may have different processing procedures and reporting methods when reporting fire alarms, faults, etc. Therefore, this situation should be comprehensively considered during software design, leaving room for expansion to gradually increase the terminal types supported by the simulation terminal 21. The simulation terminal 21 simulates different actual terminals through passive response programs and active trigger programs.

[0071] In addition to being applicable to simulating terminal terminals in the fire protection field, this method can also be applied to terminal simulation under similar communication modes (1 host corresponds to N terminals, and the host only inquires a certain terminal at a time).

[0072] During the test, the controller 22 actively queries the simulation terminal 21, and the simulation terminal 21 passively feedbacks the status; and the simulation terminal 21 actively reports the current status, triggering the controller 22 to enter a certain processing flow, and displays the execution results for the user to review, thereby realizing the communication simulation between the controller 22 and the simulation terminal 21; the simulation terminal 21 processes the data to realize that one simulation terminal 21 corresponds to multiple controller 22 terminal terminals, thereby solving the problem of high cost and prone to failure of a large number of terminal control systems during the test process.

[0073] Example 2

[0074] Reference Figure 6 , a simulation system of a bus terminal device in an embedded system, used to implement a simulation method of a bus terminal device in any embedded system as in Example 1, the simulation system 2 of the bus terminal device in the embedded system includes a simulation terminal 21 and a controller 22.

[0075] The implementation principle of a simulation method for a bus terminal device in an embedded system in an embodiment of the present application is as follows: simulating the communication between the controller 22 and the terminal terminal, which is mainly divided into the controller 22 actively inquiring the simulation terminal 21, and the simulation terminal 21 passively reporting the status; and the simulation terminal 21 actively reporting the current status, triggering the controller 22 to enter a certain processing flow; by simulating the communication between the real terminal and the fire controller 22, passively replying and actively triggering a certain communication message method, the communication with the controller 22 is realized. At the same time, due to the use of simulation, one simulation device can correspond to multiple controller 22 terminal terminals, which solves the problem of requiring more terminal auxiliary testing, reduces the time and cost consumption of the connection process, and is sufficient to ensure that each terminal of the same type being simulated is exactly the same, so that problems are easier to troubleshoot.

[0076] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.

Claims

1. A method for simulating a bus terminal device in an embedded system, characterized in that: It includes a simulation terminal; the simulation terminal is provided with a passive reply program and an active trigger program, and the simulation method includes the steps of: The simulation terminal receives an external instruction and confirms that the external instruction is an instruction sent by a user or an instruction sent by a controller; If it is a command sent by the user, the simulated terminal executes the active trigger program: it processes the command, triggers the corresponding event and sends it to the controller, receives the event confirmation command sent by the controller, and feeds back the execution result to the user; after the controller sends the event confirmation command, the user can check whether the event report is successful on the controller; If it is a command sent by the controller, the simulated terminal executes a passive reply program: executes the general inspection command sent by the controller, and feeds back the command execution result to the controller.

2. The method for simulating a bus terminal device in an embedded system according to claim 1, characterized in that: The general inspection command sent by the execution controller and the feedback of the command execution result to the controller include: Step S01, receiving a data frame sent by a controller, and parsing the data frame according to a communication protocol to obtain valid data; Step S02, classify the data frames of various commands sent by the controller according to the number of single query addresses; if it is a group inspection, proceed to step S03, if it is a general inspection, proceed to step S04; Step S03, determining whether there is an address in the current inspection group within the simulated address range; if so, proceed to step S031; if not, proceed to step S032; Step SO31, set 1 in the group inspection corresponding position, and enter step S05; Step S032, set the corresponding bit of the group inspection to 0, and go to step S05; Step S04, traverse the configuration structure according to the address keyword to determine whether the current inspection address is within the simulation address range; if so, proceed to step S041, if not, proceed to step S042; Step S041, the corresponding address is processed according to the frame command, the data is stored in its data structure, the analog data of the corresponding address is found from the data structure and replied according to the protocol structure, and the program ends; Step S042: No reply, the program ends; Step S05, determine whether the current group has been searched. If the search is completed, write the search result of the current group into the data structure for reply, and the program ends; if the search is not completed, return to step S03 until all addresses in a group are traversed and the program ends.

3. The method for simulating a bus terminal device in an embedded system according to claim 1, characterized in that: The processing of the command, triggering the corresponding event and sending it to the controller, receiving the event confirmation command sent by the controller, and feeding back the execution result to the user include: Step S11, receiving a data frame sent by an external communication interface, parsing the data frame according to a set protocol and obtaining valid data; Step S12, classify the data frame according to the operation type, if it is determined to be a configuration command, proceed to step S13, if it is determined to be a general command, proceed to step S14; Step S13, initialize the data structure of the corresponding address according to the configuration data of the incoming frame, write the data into the flash, and proceed to step S15; Step S14, determine whether the address pointed to by the current command is within the simulated address range, if yes, proceed to step S141, if not, the command is invalid and proceed to step S15; Step S141, process the corresponding address according to the frame command, and focus on reporting related events through the corresponding address, and enter step S15; Step S15, feeding back relevant information to the external communication interface, and the program ends.

4. A method for simulating a bus terminal device in an embedded system according to any one of claims 2-3, characterized in that: The data structure of the simulated terminal is set with key values, and stores each terminal data and characteristic data of each terminal.

5. The method for simulating a bus terminal device in an embedded system according to claim 4, characterized in that: The terminal data of each type and the characteristic data of each type of terminal in the simulated terminal remain unchanged.

6. The method for simulating a bus terminal device in an embedded system according to claim 4, characterized in that: The simulated terminal has basic data, and the basic data includes the number of terminals simulated by the simulated terminal, the terminal type represented by each key value, and the basic status of the terminal represented by each key value.

7. The method for simulating a bus terminal device in an embedded system according to claim 1, characterized in that: A flag bit is set in the simulation terminal, and the flag bit is divided into a flag bit owned by the simulation terminal as a whole and a flag bit independently owned by the key value. The flag bit owned by the simulation terminal as a whole includes a reset instruction, a set reset flag, and an instruction to reset the entire simulation terminal. The flag bit independently owned by the key value includes a fire alarm instruction, a fire alarm flag bit of the terminal corresponding to the set key value, and an instruction to report a fire alarm to the corresponding key value terminal.

8. A bus terminal device simulation system in an embedded system, used to implement the bus terminal device simulation method in an embedded system as claimed in any one of claims 1 to 7, characterized in that: The simulation system includes a simulation terminal.

9. The bus terminal device simulation system in an embedded system according to claim 8, characterized in that: The simulation system also includes a controller.