A failure tree drawing method and device, computer equipment and medium
By implementing the drawing of the failure tree on the web page, and using the failure tree to draw web pages and JavaScript object simplified music files, the complexity caused by the need to install software in existing tools is solved, and simplified failure tree drawing and cross-platform compatibility are achieved.
Patent Information
- Application Number
- CN202210397606.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-04-15
AI Technical Summary
Existing failure tree analysis tools require the installation of corresponding software, resulting in a poor user experience. Their functions are simple, and they are difficult to learn. Furthermore, due to the different operating systems of different devices, different software needs to be installed, which complicates the process and requires users to have a high level of expertise.
A method and apparatus for drawing a failure tree are provided. The failure tree is drawn on a web page. The web page drawing using the failure tree includes a drawing element display area and a drawing work area. In response to operation instructions, the method detects whether the target drawing element meets the position constraints, updates the drawing failure tree, and stores it as a JavaScript object musical score file.
It enables failure tree analysis on web pages and cross-platform compatibility, simplifies the failure tree drawing process, and reduces the difficulty of analysis.
Smart Images

Figure CN114969858B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to computer data processing technology, and particularly relate to a failure tree drawing method and device, computer equipment and a medium. BACKGROUND
[0002] Failure tree analysis is a top-down deductive failure analysis method, mainly used in the fields of safety engineering and reliability engineering, to understand the causes of system failure and find the best way to reduce risk or confirm the occurrence rate of a safety accident or a specific system failure.
[0003] The traditional failure analysis tools on the market all need to install corresponding software, and the use experience is not good, and the function is relatively simple, and it is difficult to start. Due to the difference of the systems of multiple devices, different software needs to be installed to perform failure tree analysis, and the process is relatively complex, and the user needs a high professional level. SUMMARY
[0004] Embodiments of the present application provide a failure tree drawing method and device, computer equipment and a medium to realize the drawing of the failure tree on the web end and the cross-platform compatibility, and simplify the drawing of the failure tree.
[0005] In a first aspect, embodiments of the present application provide a failure tree drawing method, which includes:
[0006] In response to a failure tree drawing request, a pre-constructed failure tree drawing webpage is acquired for client display, and the failure tree drawing webpage includes a drawing element display area and a drawing work area;
[0007] In response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing work area, it is detected whether the target drawing element meets the restriction condition of the target drawing position;
[0008] If yes, the current drawing failure tree in the drawing work area is updated according to the target drawing element and the target drawing position;
[0009] In response to a drawing completion instruction, the current drawing failure tree in the drawing work area is stored as a JavaScript object score file.
[0010] In a second aspect, embodiments of the present application further provide a failure tree drawing device, which includes:
[0011] A failure tree drawing webpage display module is configured to acquire a pre-constructed failure tree drawing webpage for client display in response to a failure tree drawing request, and the failure tree drawing webpage includes a drawing element display area and a drawing work area.
[0012] a target drawing element detection module, configured to, in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing workspace, detect whether the target drawing element meets a restriction condition of the target drawing position;
[0013] a current drawing fault tree updating module, configured to, if the target drawing element meets the restriction condition of the target drawing position, update a current drawing fault tree in the drawing workspace according to the target drawing element and the target drawing position;
[0014] a current drawing fault tree storage module, configured to, in response to a drawing completion instruction, store the current drawing fault tree in the drawing workspace as a JavaScript object score file.
[0015] In a third aspect, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the drawing method of the fault tree according to any embodiment of the present application when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, having a computer program stored thereon, wherein the computer program is executable on a processor to implement the drawing method of the fault tree according to any embodiment of the present application.
[0017] The technical scheme provided by the embodiment of the present application comprises the following steps: in response to a fault tree drawing request, a pre-constructed fault tree drawing webpage is acquired for client display; in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing workspace, it is detected whether the target drawing element meets a restriction condition of the target drawing position; if yes, a current drawing fault tree in the drawing workspace is updated according to the target drawing element and the target drawing position; and in response to a drawing completion instruction, the current drawing fault tree in the drawing workspace is stored as a JavaScript object score file. The problem that the process is complicated and the analysis is difficult due to the need to install corresponding analysis software in the fault tree analysis process is solved, the analysis of the fault tree on the webpage and the cross-platform compatibility are realized, the drawing of the fault tree is simplified, and thus the difficulty of the fault tree analysis is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1a A flowchart of the drawing method of the fault tree according to the first embodiment of the present application is shown in FIG. 1;
[0019] Figure 1bA structure schematic diagram of a failure tree drawing webpage in the method provided for the first embodiment of the present application;
[0020] Figure 2 A flowchart of another failure tree drawing method provided for the second embodiment of the present application;
[0021] Figure 3 A structure schematic diagram of a failure tree drawing device provided for the third embodiment of the present application;
[0022] Figure 4 A structure schematic diagram of a computer device provided for the fourth embodiment of the present application. DETAILED DESCRIPTION
[0023] The present application will be further described below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, but not all the structures.
[0024] Embodiment one
[0025] Figure 1a A flowchart of a failure tree drawing method provided for the first embodiment of the present application. The present embodiment can be applicable to the case of failure tree drawing analysis on the webpage side. The method of the present embodiment can be executed by a failure tree drawing device, which can be realized by software and / or hardware, and can be configured in a terminal device.
[0026] Correspondingly, the method specifically includes the following steps:
[0027] S110, in response to a failure tree drawing request, obtaining a pre-constructed failure tree drawing webpage for client display.
[0028] Among them, the failure tree drawing webpage includes a drawing element display area and a drawing work area.
[0029] Among them, the failure tree drawing request can be a related request command input by a user on the webpage side, and the failure tree can be drawn by opening the related webpage through the failure tree drawing request. The failure tree drawing webpage can be a network interface capable of failure tree drawing. The drawing element display area can be a drawing element required for drawing the failure tree, and the type of the drawing element can include an event gate type, a logic gate type and a transfer symbol type, etc. The drawing work area can be an area capable of failure tree drawing.
[0030] S120, in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing work area, detecting whether the target drawing element meets the restriction condition of the target drawing position.
[0031] The target drawing element can be an element selected in the drawing element display area, and the type of the drawing element can be various, and can be specifically event gate type, logic gate type, and transition symbol type, etc. The target drawing position can be a fixed position where the target drawing element is placed, and the drawing of the fault tree is performed.
[0032] S130, if yes, updating the current drawing fault tree in the drawing workspace according to the target drawing element and the target drawing position.
[0033] S140, in response to a drawing completion instruction, storing the current drawing fault tree in the drawing workspace as a JavaScript object score file.
[0034] The drawing completion instruction can be a completion instruction sent to the device in response to the completion of the current drawing fault tree. The JavaScript object score file can be a file that can be recognized by JavaScript language, and can be run and displayed on different system terminals.
[0035] The technical scheme provided by the embodiment of the application comprises the following steps: in response to a fault tree drawing request, a pre-constructed fault tree drawing webpage is acquired to be displayed on a client; in response to an operation instruction of dragging a target drawing element in a drawing element display area to a target drawing position in a drawing workspace, it is detected whether the target drawing element meets a restriction condition of the target drawing position; if yes, a current drawing fault tree in the drawing workspace is updated according to the target drawing element and the target drawing position; and in response to a drawing completion instruction, the current drawing fault tree in the drawing workspace is stored as a JavaScript object score file. The problem that the process is complicated and the analysis is difficult due to the need to install corresponding analysis software in the fault tree analysis process is solved, the drawing of the fault tree on the webpage and the cross-platform compatibility are realized, the drawing of the fault tree is simplified, and thus the difficulty of the fault tree analysis is reduced.
[0036] Optionally, the drawing element display area comprises a plurality of types of drawing elements; the types of the drawing elements comprise event gate type, logic gate type, and transition symbol type; the event gate type comprises the following items: top event, intermediate event, external event, conditional event, unexplored event, and bottom event; the logic gate type comprises the following items: AND gate, OR gate, XOR gate, priority AND gate, inhibition gate, and voting gate; and the transition symbol type comprises transition-in gate and transition-out gate.
[0037] The event gate type can be classified according to the type to which the failure tree event belongs, and can include different events. The logic gate type can be connected to different events, and indicates the logical relationship between different events. The transfer symbol type can be a symbol type in which a current event is transferred to another event or other restrictions.
[0038] Specifically, the top event can be the first event in drawing the failure tree. The intermediate event can be an event in the middle of the failure tree when drawing the failure tree. The external event can be an event that is generally expected to occur when drawing the failure tree. The conditional event can be a condition that affects or restricts the logic gate. The unexplored event can be an event whose related information is unknown or has no subsequent effect. The bottom event can be the last event in drawing the failure tree.
[0039] In the embodiment, the top event must be used as the initial starting point for failure analysis when drawing the failure tree.
[0040] For example, the AND gate can be a sum relationship of event A and event B, which jointly act on event C. The OR gate can be an OR relationship of event A and event B, which satisfies the condition that event A or event B can act on event C. The XOR gate can be a condition that event A and event B both satisfy or event A and event B both do not satisfy, which can act on event C. The priority AND gate can be an AND relationship and an OR relationship of event A and event B, when the AND relationship of event A and event B is given priority to act on event C. The inhibit gate can be an event A that inhibits event C from acting. The voting gate can be an output of a specific event type.
[0041] The transfer symbol can be used to connect the input and output of the related failure tree, such as the failure tree of a subsystem and the failure tree of a system.
[0042] Specifically, the transfer-in gate can be used to connect the transfer-in relationship between two failure trees when event A in failure tree T1 is transferred to child failure tree T2. Correspondingly, failure tree T2 here also generates a corresponding transfer-out symbol B, which points to failure tree T1.
[0043] The advantages of such a setting are that by setting multiple types of drawing elements in the drawing element display area, specifically event gate types, logic gate types, and transfer symbol types, the staff can more conveniently and simply use them, thereby simplifying the failure tree drawing operation.
[0044] Optionally, the failure tree drawing webpage further comprises a shortcut operation function display area; the method further comprises: in response to a triggering instruction of a target function control in the shortcut operation function display area, acquiring a target operation method matched with the target function control, and executing the target operation method on the drawing work area.
[0045] The shortcut operation function display area can perform convenient processing operations on the drawing work area. Specifically, the shortcut operation function display area can include operations such as undo, reverse undo, copy, cut, paste, delete, canvas zoom in, and canvas zoom out on the drawing work area. The target function control can be an undo control, a reverse undo control, a copy control, a cut control, a paste control, a delete control, a canvas zoom in control, and a canvas zoom out control. The target operation method can be a specific operation method corresponding to the target function control. Specifically, the undo control can perform an undo operation on the current drawing work area to return to the previous operation.
[0046] For example, assume that the current drawing work area contains events A and B, and event C has been added. The worker should not include event C in the current drawing work area. Therefore, the worker selects a target function control, i.e., an undo control, in the shortcut operation function display area. Then, the undo control acquires a target operation method matched with it and executes the target operation method on the drawing work area. Accordingly, event C is undone, and the current drawing work area contains events A and B.
[0047] This arrangement has the advantage that the worker can perform more convenient and concise operations on the drawing work area, thereby simplifying the failure tree drawing operation.
[0048] Optionally, the failure tree drawing webpage further comprises a work area switching area; the method further comprises: in response to a selection instruction of a target work area in the work area switching area, acquiring storage configuration information matched with the target work area, and displaying a current drawing area in the drawing work area; and storing the current drawing area and the current drawing failure tree according to the storage configuration information.
[0049] The work area switching area can switch between multiple work areas. The target work area can be a current drawing work area to be selected. The storage configuration information can be location information of the target work area to be stored.
[0050] The advantage of the arrangement is that the work area switching area is arranged, so that the worker can quickly switch between multiple drawing work areas and obtain the storage locations of different drawing work areas, making the failure tree drawing more convenient and simple, thereby simplifying the worker's failure tree drawing operation.
[0051] Optionally, the failure tree drawing webpage is written in JavaScript language.
[0052] The JavaScript language can be a lightweight, interpreted or just-in-time compiled programming language with first-class functions. Although it is famous as a scripting language for developing web pages, it is also used in many non-browser environments. JavaScript is a prototype-based, multi-paradigm dynamic scripting language that supports object-oriented, imperative, declarative, and functional programming styles.
[0053] The advantage of the arrangement is that the failure tree drawing webpage is written in JavaScript language, so that the worker can perform failure tree drawing processing on different devices and different systems in the device, without installing the corresponding version of the software in the device for failure tree drawing, making the failure tree drawing more convenient and simple, thereby simplifying the worker's failure tree drawing operation.
[0054] Specific application scenarios
[0055] As shown in Figure 1b The structure of the failure tree drawing webpage is shown in the figure. The failure tree drawing webpage can include a drawing element display area and a drawing work area. Specifically, the drawing element display area can include multiple types of drawing elements, a shortcut operation function display area, and a work area switching area.
[0056] Further, the types of drawing elements can include event gate types, logic gate types, and transfer symbol types. The event gate types can include top events, intermediate events, external events, conditional events, unexplored events, and bottom events; the logic gate types can include AND gates, OR gates, XOR gates, priority AND gates, inhibition gates, and voting gates; and the transfer symbol types can include transfer-in gates and transfer-out gates. The shortcut operation function display area can include shortcut operation keys such as undo, reverse undo, copy, cut, paste, delete, canvas zoom in, and canvas zoom out. The work area switching area can be capable of switching between multiple work areas.
[0057] Correspondingly, the drawn element in the drawing workspace is a top event, and the top event has a branch element which is an OR gate. Then, the OR gate has three branch elements which are all intermediate events. Among them, the left intermediate event has a branch element which is an OR gate, and the OR gate has two branch elements which are both intermediate events, wherein the leftmost one is an unexplored event. The right intermediate event has a branch element which is a bottom event.
[0058] Embodiment Two
[0059] Figure 2 The flow chart of another method for drawing a fault tree provided for embodiment two of the present application. This embodiment is refined based on the above-mentioned embodiments. In this embodiment, the detection of whether the target drawing element meets the restriction condition of the target drawing position is further refined.
[0060] Correspondingly, the method specifically comprises the following steps:
[0061] S210, in response to a fault tree drawing request, obtaining a pre-constructed fault tree drawing webpage for client display.
[0062] S220, in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing workspace, detecting whether there is at least one drawn element in the drawing workspace.
[0063] Among them, the drawn element can be an element that has been completed drawing in the current drawing workspace.
[0064] S230, if yes, obtaining the drawn workspace of each drawn element, and determining a parent drawing element among the drawn elements according to the positional relationship between the drawn workspace and the target drawing position.
[0065] Among them, the parent drawing element can be a re-expanding branch element of one or more elements in the drawn element.
[0066] For example, it is assumed that there is a drawn element in the current drawing workspace, wherein the drawn element includes event A element and event B element, and it is assumed that two branches, event C element and event D element, need to be added to the target drawing position under the event A element. Specifically, the event A element is the parent drawing element.
[0067] In another embodiment included in this embodiment, if there is no drawn element in the drawing workspace, only a top event is allowed to be added to the drawing workspace. After adding the top event, the top event is taken as a drawn element, and the drawing of the fault tree is continued.
[0068] S240, acquire a child drawing element allowed type matched with the parent drawing element.
[0069] The child drawing element allowed type can be a type of child drawing element allowed to be added under the parent drawing element.
[0070] Continuing the previous example, the event A element is the parent drawing element, and two branches need to be added at the target drawing position under the event A element, which are the event C element and the event D element. Among them, the event A is the top event, and if the event C element and the event D element select the top event, it is not allowed, therefore, the event C element and the event D element can be intermediate events.
[0071] S250, if it is determined that the element type of the target drawing element belongs to the child drawing element allowed type, it is determined that the target drawing element meets the restriction condition of the target drawing position.
[0072] S260, if yes, rendering and displaying the target drawing element at the target drawing position in the drawing workspace.
[0073] S270, according to the positional relationship between the parent drawing element and the target drawing element in the drawing workspace, generating an inter-element connection line from the parent drawing element to the target drawing element.
[0074] Specifically, in the failure tree drawing implementation of the drawing workspace, the Flex layout in Cascading Style Sheets (CSS) is used to complete the rendering function of each node in the tree structure. Flex layout, also known as flexbox, is a one-dimensional layout model that provides powerful space distribution and alignment capabilities for flexbox child elements. The pseudo-element in CSS is used to realize the drawing of the inter-element connection line between nodes.
[0075] Further, the zoom function of the canvas is realized based on the d3-zoom library. The zoom behavior realized by d3-zoom is a more flexible abstraction that can well handle the difference behaviors between various browsers and can be applied to SVG (Scalable Vector Graphics), HTML (HyperText Mark-up Language) or Canvas.
[0076] The function of dragging and adding nodes is realized by using react-dnd, and due to the perfect function of this library, the added nodes can be easily limited by corresponding prohibited operations.
[0077] As continued from the previous example, the event A element is the parent drawing element, and two branches need to be added to the target drawing position under the event A element, which are the event C element and the event D element. Therefore, the event C element and the event D element can be added under the target position of the event A element, and the element interconnection from the parent drawing element event A element to the event C element and the event D element is generated.
[0078] S280, in response to the drawing completion instruction, storing the current drawing fault tree in the drawing workspace as a JavaScript object score file.
[0079] The technical scheme provided by the embodiment of the application comprises the following steps: in response to a fault tree drawing request, a pre-constructed fault tree drawing webpage is acquired for client display; in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing workspace, it is detected whether there is at least one drawn element in the drawing workspace; if yes, a drawn workspace of each drawn element is acquired, and a parent drawing element is determined from the drawn elements according to the positional relationship between the drawn workspace and the target drawing position; an allowed type of a child drawing element matched with the parent drawing element is acquired; if it is determined that the element type of the target drawing element belongs to the allowed type of the child drawing element, it is determined that the target drawing element meets the restriction condition of the target drawing position; if yes, the target drawing element is rendered and displayed at the target drawing position in the drawing workspace; according to the positional relationship between the parent drawing element and the target drawing element in the drawing workspace, an element interconnection from the parent drawing element to the target drawing element is generated; and in response to a drawing completion instruction, the current drawing fault tree in the drawing workspace is stored as a JavaScript object score file. In this way, the corresponding restriction rule is set, the fault tree drawing is more accurate, other staff can analyze the fault tree, and the difficulty of fault tree drawing is reduced.
[0080] Embodiment three
[0081] Figure 3 is a structural schematic diagram of a fault tree drawing device provided by the embodiment three of the application. The fault tree drawing device provided by the embodiment of the application can be realized by software and / or hardware, and can be configured in a terminal device. The fault tree drawing device is used to realize the fault tree drawing method in the embodiment of the application. As shown in the figure, the device can specifically comprise: a fault tree drawing webpage display module 310, a target drawing element detection module 320, a current drawing fault tree updating module 330, and a current drawing fault tree storage module 340. Figure 3
[0082] The failure tree drawing webpage display module 310 is configured to, in response to a failure tree drawing request, acquire a pre-constructed failure tree drawing webpage for client display, wherein the failure tree drawing webpage comprises a drawing element display area and a drawing work area.
[0083] The target drawing element detection module 320 is configured to, in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing work area, detect whether the target drawing element meets a restriction condition of the target drawing position.
[0084] The current drawing failure tree updating module 330 is configured to, if it is detected that the target drawing element meets the restriction condition of the target drawing position, update a current drawing failure tree in the drawing work area according to the target drawing element and the target drawing position.
[0085] The current drawing failure tree storage module 340 is configured to, in response to a drawing completion instruction, store the current drawing failure tree in the drawing work area as a JavaScript object score file.
[0086] The technical scheme provided by the embodiments of the present application comprises the following steps: in response to a failure tree drawing request, a pre-constructed failure tree drawing webpage is acquired for client display; in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing work area, it is detected whether the target drawing element meets a restriction condition of the target drawing position; if yes, a current drawing failure tree in the drawing work area is updated according to the target drawing element and the target drawing position; and in response to a drawing completion instruction, the current drawing failure tree in the drawing work area is stored as a JavaScript object score file. The technical scheme solves the problem that the process is complicated and the analysis is difficult due to the need to install corresponding analysis software in the failure tree analysis process, realizes the drawing of the failure tree on the webpage side and the cross-platform compatibility, simplifies the drawing of the failure tree, and thus reduces the difficulty of the failure tree analysis.
[0087] On the basis of the above embodiments, the target drawing element detection module 320 can be specifically configured to: detect whether there is at least one drawn element in the drawing work area; if yes, acquire a drawn work area of each drawn element, and determine a parent drawing element among the drawn elements according to a positional relationship between the drawn work area and the target drawing position; acquire a child drawing element allowed type matched with the parent drawing element; and if it is determined that an element type of the target drawing element belongs to the child drawing element allowed type, it is determined that the target drawing element meets the restriction condition of the target drawing position.
[0088] On the basis of the above-mentioned embodiments, the current failure tree drawing update module 330 can be specifically used for: rendering and displaying the target drawing element at the target drawing position in the drawing workspace; and generating an inter-element connection line from the parent drawing element to the target drawing element according to the positional relationship between the parent drawing element and the target drawing element in the drawing workspace.
[0089] On the basis of the above-mentioned embodiments, the drawing element display area can have a plurality of types of drawing elements; the types of the drawing elements can have: an event gate type, a logic gate type and a transfer symbol type; the event gate type can have a plurality of the following: a top event, an intermediate event, an external event, a conditional event, an unexplored event and a bottom event; the logic gate type can have a plurality of the following: an AND gate, an OR gate, an XOR gate, a priority AND gate, a forbidden gate and a voting gate; and the transfer symbol type includes: a transfer-in gate and a transfer-out gate.
[0090] On the basis of the above-mentioned embodiments, the failure tree drawing webpage can further have: a quick operation function display area.
[0091] The method can be further used for: in response to a triggering instruction of a target function control in the quick operation function display area, acquiring a target operation method matched with the target function control, and executing the target operation method on the drawing workspace.
[0092] On the basis of the above-mentioned embodiments, the failure tree drawing webpage can further have: a workspace switching area.
[0093] The method can be further used for: in response to a selection instruction of a target workspace in the workspace switching area, acquiring storage configuration information matched with the target workspace, and displaying a current drawing area in the drawing workspace; and storing the current drawing area and the current failure tree according to the storage configuration information.
[0094] On the basis of the above-mentioned embodiments, the failure tree drawing webpage can be written using a JavaScript language.
[0095] The above-mentioned failure tree drawing device can execute the failure tree drawing method provided in any embodiment of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0096] Embodiment Four
[0097] Figure 4 Fig. 4 is a structural schematic diagram of a computer device provided in Embodiment Four of the present application. Figure 4As shown, the device includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of processors 410 in the device can be one or more, Figure 4 The processor 410 in the device is taken as an example; the processor 410, the memory 420, the input device 430, and the output device 440 in the device can be connected through a bus or other means, Figure 4 The bus connection is taken as an example.
[0098] The memory 420, as a kind of computer readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules (for example, failure tree drawing webpage display module 310, target drawing element detection module 320, current drawing failure tree updating module 330 and current drawing failure tree storage module 340) corresponding to the drawing method of failure tree in the embodiment of the present application. The processor 410 executes the software programs, instructions and modules stored in the memory 420, thereby performing various functional applications and data processing of the device, i.e. implementing the above-mentioned drawing method of failure tree, which comprises:
[0099] In response to a failure tree drawing request, a pre-constructed failure tree drawing webpage is acquired for client display, wherein the failure tree drawing webpage includes a drawing element display area and a drawing work area; in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing work area, it is detected whether the target drawing element meets the restriction condition of the target drawing position; if yes, the current drawing failure tree in the drawing work area is updated according to the target drawing element and the target drawing position; in response to a drawing completion instruction, the current drawing failure tree in the drawing work area is stored as a JavaScript object score file.
[0100] The memory 420 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory 420 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some examples, the memory 420 can further include a memory remotely arranged with respect to the processor 410, which can be connected to the device through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0101] The input device 430 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 440 can include a display device such as a display screen.
[0102] Embodiment five
[0103] The embodiment five of the present application further provides a computer readable storage medium, computer readable instructions of which are used to execute a failure tree drawing method when executed by a computer processor, the method comprising: in response to a failure tree drawing request, obtaining a pre-constructed failure tree drawing webpage for client display, the failure tree drawing webpage comprising: a drawing element display area and a drawing work area; in response to an operation instruction of dragging a target drawing element in the drawing element display area to a target drawing position in the drawing work area, detecting whether the target drawing element meets a restriction condition of the target drawing position; if yes, updating a current drawing failure tree in the drawing work area according to the target drawing element and the target drawing position; and in response to a drawing completion instruction, storing the current drawing failure tree in the drawing work area as a JavaScript object notation file.
[0104] Of course, the computer readable instructions of the computer readable storage medium provided by the embodiment of the present application are not limited to the method operations described above, but can also execute related operations in the failure tree drawing method provided by any embodiment of the present application.
[0105] From the above description of the embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary universal hardware, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a floppy disk, a read-only memory (ROM), a random access memory (RAM), a FLASH memory, a hard disk, or an optical disc, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.
[0106] It is worth noting that in the above embodiment of the failure tree drawing device, each unit and module included is only divided according to functional logic, but is not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy distinction, and do not limit the protection scope of the present application.
[0107] Note that the above merely describes preferred embodiments of the present application and the principles of the technology applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, modifications and substitutions can be made without departing from the scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A method for drawing a failure tree, characterized in that, include: In response to a failure tree drawing request, a pre-built failure tree drawing webpage is obtained and displayed on the client. The failure tree drawing webpage includes a drawing element display area and a drawing work area. In response to an operation command to drag a target drawing element from the drawing element display area to a target drawing position in the drawing work area, it is detected whether the target drawing element meets the constraint conditions of the target drawing position. If so, then update the current drawing failure tree in the drawing work area according to the target drawing element and the target drawing position; In response to the drawing completion command, the current drawing failure tree in the drawing workspace is stored as a JavaScript object abbreviation file; The step of detecting whether the target drawing element meets the constraint conditions of the target drawing position includes: Detect whether there is at least one drawn element in the drawing work area; If so, the drawn work area of each drawn element is obtained, and the parent drawing element is determined in each drawn element according to the positional relationship between the drawn work area and the target drawing position. Get the allowed types of child drawing elements that match the parent drawing element; If it is determined that the element type of the target drawing element belongs to the allowed type of the sub-drawing element, then it is determined that the target drawing element satisfies the restriction condition of the target drawing position; The step of updating the current drawing failure tree in the drawing workspace based on the target drawing element and the target drawing position includes: At the target drawing position within the drawing work area, the target drawing element is rendered and displayed. Based on the positional relationship between the parent drawing element and the target drawing element within the drawing work area, generate inter-element connections from the parent drawing element to the target drawing element; If it is detected that there is no drawn element in the drawing work area, a top event is added to the drawing work area, and after adding the top event, the top event is identified as a drawn element, and the operation of detecting whether there is at least one drawn element in the drawing work area is returned.
2. The method according to any one of claims 1, characterized in that, The drawing element display area includes multiple types of drawing elements; The types of the drawing elements include: event gate type, logic gate type, and transfer symbol type; The event gate types include the following: top event, intermediate event, external event, conditional event, undiscovered event, and bottom event; The logic gate types include the following: AND gate, OR gate, XOR gate, priority AND gate, disable gate, and voting gate; The transfer symbol types include: transfer entry and transfer exit.
3. The method according to claim 1, characterized in that, The failure tree drawing webpage also includes: a quick operation function display area; The method further includes: In response to a trigger command on a target function control in the quick operation function display area, a target operation method matching the target function control is obtained, and the target operation method is executed for the drawing work area.
4. The method according to claim 1, characterized in that, The failure tree drawing webpage also includes: a work area switching area; The method further includes: In response to a selection instruction for a target work area in the work area switching area, storage configuration information matching the target work area is obtained, and the current drawing area is displayed in the drawing work area; Based on the storage configuration information, the current drawing region and the current drawing failure tree are stored.
5. The method according to claim 1, characterized in that, The failure tree drawing webpage was created using JavaScript.
6. A device for drawing a failure tree, characterized in that, include: The failure tree drawing webpage display module is used to respond to a failure tree drawing request, obtain a pre-built failure tree drawing webpage for client display, and the failure tree drawing webpage includes: a drawing element display area and a drawing work area; The target drawing element detection module is used to detect whether the target drawing element meets the constraint conditions of the target drawing position in response to the operation command of dragging the target drawing element in the drawing element display area to the target drawing position in the drawing work area. The current drawing failure tree update module is used to update the current drawing failure tree in the drawing work area according to the target drawing element and the target drawing position if the target drawing element is detected to meet the restriction conditions of the target drawing position. The current drawing failure tree storage module is used to store the current drawing failure tree in the drawing work area as a JavaScript object abbreviation file in response to the drawing completion command; The target drawing element detection module is configured to: detect whether at least one drawn element exists within the drawing work area; if so, obtain the drawn work area of each drawn element, and determine a parent drawing element among the drawn elements based on the positional relationship between the drawn work area and the target drawing position; obtain the allowed type of child drawing element that matches the parent drawing element; if it is determined that the element type of the target drawing element belongs to the allowed type of child drawing element, then determine that the target drawing element satisfies the restriction conditions of the target drawing position. The current drawing failure tree update module is used to: render and display the target drawing element at the target drawing position within the drawing work area; and generate inter-element connections from the parent drawing element to the target drawing element based on the positional relationship between the parent drawing element and the target drawing element within the drawing work area. If it is detected that there is no drawn element in the drawing work area, a top event is added to the drawing work area, and after adding the top event, the top event is identified as a drawn element, and the operation of detecting whether there is at least one drawn element in the drawing work area is returned.
7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for drawing a failure tree as described in any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method for drawing a failure tree as described in any one of claims 1-5.
Citation Information
Patent Citations
Method and device for drawing canvas
CN113760289A