Method and device for generating test case of automatic train protection system based on input and output equivalence class

By using a method based on input and output equivalence classes to generate test cases for the ATP system, combined with STPA and symbolic finite state machine technology, the problem of low efficiency and limitations of the existing ATP system security testing is solved, and high efficiency oriented to security requirements is achieved. Conformance testing.

CN118779241APending Publication Date: 2024-10-15HUAQIAO UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410989781.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The security testing method of the existing ATP system is inefficient and cannot be tested before or during system development. It also lacks a consistency testing method for security requirements, resulting in long and limited testing time.

Method used

An automatic train protection system test case generation method based on input and output equivalence classes is adopted. Unsafe control actions and software safety requirements are analyzed through STPA technology, converted into linear temporal logic formulas, and symbolic finite state machine modeling is used to divide the inputs. Output equivalence classes, generate state coverage, completeness and security requirements test cases, and conduct consistency testing.

Benefits of technology

It achieves consistency testing for security requirements, improves the comprehensiveness and effectiveness of testing, shortens testing time, and enables effective security verification before system development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779241A_ABST
    Figure CN118779241A_ABST
Patent Text Reader

Abstract

The invention discloses an input and output equivalence class-based automatic train protection system test case generation method and device, and the method comprises the steps: carrying out the analysis of an automatic train protection system through employing an STPA technology, and obtaining all levels of unsafe control actions and corresponding software safety requirements; and formalizing the software security requirement generated by the STPA into an LTL formula, and using the LTL formula as an attribute requirement for verification in a test. The automatic train protection system is modeled by adopting a symbolized finite-state machine, and a test case is generated by applying an LTL formula. According to the method, the input expression and the output expression which have continuity and infinite domains are subjected to equivalence class division, the input expression and the output expression are integrated after being subjected to equivalence class division, and the corresponding input equivalence class and the corresponding output equivalence class are combined for testing, so that the testing comprehensiveness and effectiveness are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software testing, and in particular to a method and device for generating test cases for an automatic train protection system based on input-output equivalence classes. Background Art

[0002] With the development of modern cities, the automatic train protection (ATP) system of rail transit plays a vital role in urban transportation. However, the safety of the ATP system has always been one of the focuses of attention, especially its safety is directly related to the safety, efficiency and reliability of train operation.

[0003] Currently, there are very limited security testing methods for ATP systems, and there is still a lack of an efficient and time-saving testing solution. Existing technologies mainly focus on testing the actual system, which is similar to a check mechanism and is usually tested after the system is developed. This post-testing method cannot test the system before or during system development.

[0004] In addition, existing testing algorithms generally adopt the method of exhaustively testing the system state, and the test time is highly dependent on the number of states of the system under test. When the complexity of the system increases, the test time will inevitably increase significantly, making the test process time-consuming and laborious. At the same time, the existing technology also lacks a consistency testing method for security requirements.

[0005] Therefore, the existing security testing methods are not only insufficient in efficiency, but also have certain limitations in the testing phase and testing content. Summary of the invention

[0006] The purpose of this application is to propose a method and device for generating test cases for an automatic train protection system based on input-output equivalence classes in response to the above-mentioned technical problems.

[0007] In a first aspect, the present invention provides a method for generating test cases for an automatic train protection system based on input-output equivalence classes, comprising the following steps:

[0008] The automatic train protection system is analyzed using STPA technology to identify unsafe control actions and software safety requirements. Based on the unsafe control actions, the software safety requirements are converted into linear temporal logic formulas, and the linear temporal logic formulas are converted into atomic propositions to obtain an atomic proposition set.

[0009] The automatic train protection system is modeled by using a symbolic finite state machine to obtain the automatic train protection system model, all the valuation functions of the automatic train protection system are calculated, and the valuation functions are mapped to the atomic proposition sets they satisfy to obtain proposition abstraction;

[0010] Based on the automatic train protection system model, several mutants are constructed and the fault domain is obtained; given an alphabet related to the fault domain, a set of expressions corresponding to input events and output events in the automatic train protection system is constructed and divided into equivalence classes; the transformation of the automatic train protection system model is marked by using the equivalence class to obtain the marked automatic train protection system model, and the marked automatic train protection system model is constructed by the power set method and the determinism is converted to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model;

[0011] Based on the sets of expressions corresponding to input events and output events in the automatic train protection system, the feature set and state coverage set of the automatic train protection system are constructed respectively, and the feature set of propositional abstraction is constructed for propositional abstraction. The state coverage test case is generated according to the feature set and state coverage set of the automatic train protection system; the completeness test case is generated according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system, and the safety requirement test case is generated according to the state coverage set and the feature set of propositional abstraction. The state coverage test case, completeness test case and safety requirement test case are executed on the mutant of the automatic train protection system model in the fault domain for consistency testing. If the consistency test passes, the state coverage test case, completeness test case and safety requirement test case that pass the consistency test are obtained. If not, the fault domain is reconstructed and the above two steps are repeated until the state coverage test case, completeness test case and safety requirement test case pass the consistency test.

[0012] As a preferred embodiment, the automatic train protection system model is expressed as M=(S, s 0 ,R,I,O,D,∑ I ,∑ O ), where S represents the state space, s 0 ∈S represents the initial state, I represents the input event set, O represents the output event set, ∑ I represents the input alphabet, which is a set of input expressions consisting of a finite number of input expressions, each of which is a first-order expression of an input event; ∑ O represents the output alphabet, which is a set of output expressions consisting of a finite number of output expressions, each of which is a first-order expression of an output event; represents a transition relationship; D represents the union of all expression type domains;

[0013] The valuation function σ represents the mapping of each input-output expression v' to its corresponding σ(v'), where the input-output expression v' belongs to Var, Var represents the union of the input event set I and the output event set O, and the set of sequences mapped from Var to D is represented as the assignment function set D Var , the set of assignment functions D Var That is, it is the set of expressions corresponding to the input events and output events in the automatic train protection system, and (D Var ) * represents the set of all finite sequences from Var to D, Denote that the valuation function σ is a model of the input event φ, for each pair (φ, ψ)∈∑ I ×∑ O , ψ represents the output event, s and s' represent the two states before and after the transition, and there is at least one model Where φ∧ψ is the conjunction of input events and output events, and the transformations include symbolic transformation, concrete transformation, and propositional transformation;

[0014] The sign conversion of the automatic train protection system model M is composed of multiple consecutive (φ i ,ψ i ), namely:

[0015] τ=(φ 1 / ψ 1 )...(φ n / ψ n )∈(∑ I ×∑ O ) * ;

[0016] satisfy:

[0017] in, Indicates existence, Indicates any, s i-1 represents the i-1th state, s i represents the i-th state, φ i represents the i-th input event, ψ i represents the i-th output event;

[0018] The specific transformation κ of the automatic train protection system model M is a finite sequence of evaluation functions, namely:

[0019] κ=σ 1 ... n ∈(D Var ) * ;

[0020] If the specific transformation κ makes the automatic train protection system model M have a sign transformation τ=(φ 1 / ψ 1 )...(φ n / ψ n )satisfy Then the specific transformation κ is called the witness of the symbolic transformation τ, using the shorthand notation

[0021] Introduce wrong behavior into the automatic train protection system model M and construct the mutant M';

[0022] A fault domain is defined as a set of mutants in the form of a symbolic finite state machine with the following properties:

[0023] Each mutant M' has at most m≥n states, where n means that the automatic train protection system model M has n distinguishable states, and m means that the mutant of the automatic train protection system model M has at most m distinguishable states;

[0024] Each mutant M' refers to an expression from a set of input events I and a set of output events O;

[0025] Each mutant M' uses the input alphabet ∑ I and output alphabet ∑ O ;

[0026] The alphabet of fault domain D includes the union of the input alphabet, the output alphabet, and the atomic propositions of the linear temporal logic formula to be verified, that is, ∑ = ∑ I ∪∑ O ∪AP.

[0027] As a preferred method, the automatic train protection system is analyzed by using STPA technology to identify unsafe control actions and software safety requirements. Based on the unsafe control actions, the software safety requirements are converted into linear temporal logic formulas, and the linear temporal logic formulas are converted into atomic propositions to obtain an atomic proposition set, which specifically includes:

[0028] Analyze the automatic train protection system to get accidents, analyze the accidents to get hazards, analyze the hazards to get system-level safety constraints, analyze the system-level safety constraints to get unsafe control actions, and analyze the unsafe control actions to get software safety requirements;

[0029] The software safety requirements are converted into linear temporal logic formulas using the following rules:

[0030] Rule 1: When situation S occurs, the automatic train protection system should always provide no control action CA i , converted into a linear temporal logic formula: LTLi =G(S→!(controlAction==CA i )), where G means in the global scope, → means it happens immediately afterwards, ! means it cannot happen, == means to judge whether two are equal, and i means the i-th linear temporal logic formula;

[0031] Rule 2: Before the occurrence of situation S, the automatic train protection system should not provide control action CA too early i , converted into a linear temporal logic formula: LTL i =G(((controlAction==CA i )→S)&! ((controlAction==CA i )∪S)), & represents and, ∪ represents the union;

[0032] Rule 3: After Situation S occurs, the automatic train protection system should not provide control action CA too late i , converted into a linear temporal logic formula: LTL i =G((S→(controlAction==CA i ))&! (S∪(controlAction==CA i )));

[0033] Rule 4: When situation S occurs, the automatic train protection system should immediately provide control action CA i , converted into a linear temporal logic formula: LTL i =G(S→X(controlAction==CA i )), X means providing control action immediately;

[0034] Linear temporal logic formulas are defined by the following grammar: Among them, X represents the next state, U represents until, W represents if until, and F represents a future state. The set η of linear temporal logic formulas is defined as an atomic proposition, denoted by η∈AP, where AP represents the set of atomic propositions, and is represented by symbolic expressions from Var, := represents the definition, and the semantic definition of the set η of linear temporal logic formulas is defined in the proposition transformation π∈(2 AP ) ω Above, where AP should be a superset of the atomic propositions that appear in the set η of linear temporal logic formulas;

[0035] A linear temporal logic formula The set η of is a set P of propositional transformations that satisfies the following conditions:

[0036] Make

[0037] in, \ represents complement, π′ and π" represent two different finite prefixes of proposition transformation π respectively; the set of all atomic propositions constitutes the atomic proposition set AP.

[0038] As a preference, the valuation function is mapped to a set of atomic propositions that it satisfies to obtain propositional abstraction, which specifically includes:

[0039] Assume that the atomic proposition set AP is the set of atomic propositions in Var, and the atomic proposition set AP contains the atomic propositions satisfied by the automatic train protection system model and used to verify the linear temporal logic formula. The proposition abstraction ω will be assigned to the function set D Var Mapped to the set of atomic propositions it satisfies, denoted as:

[0040]

[0041] in, Indicates correspondence;

[0042] Extend the propositional abstraction ω to the set of assignment functions D by recursive definition Var And the specific conversion κ:

[0043] ω∶(D Var ) * →(2 AP ) * , ω(ε)=ε and ω(σ.κ)=ω(σ).ω(κ), where σ∈D Var ,κ∈(D Var ) * .

[0044] As a preferred embodiment, given an alphabet related to the fault domain, a set of expressions corresponding to input events and output events in the automatic train protection system is constructed and divided into equivalence classes; the transformation of the automatic train protection system model is marked by using the equivalence class to obtain the marked automatic train protection system model, and the marked automatic train protection system model is constructed by using the power set method and the determinism is transformed to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model, which specifically includes:

[0045] For any collection Take the sufficient condition set G' for partitioning the input equivalence classes:

[0046] G'≡g 1 ∧g 2 …∧g n ;

[0047] Among them, g i∈Q(I) represents any input expression from the input alphabet ∑I, i = 1, 2, ..., n, and the sufficient condition means that the input expression can be counted in the equivalence class only when the input expression g occurs;

[0048] For any collection Take a set of inadequate conditions for partitioning equivalence classes

[0049]

[0050] in, is any input expression from the complement of Q(I) ∑\Q(I), and the inadequate condition means an insignificant condition;

[0051] For any collection Take the sufficient condition set E and the inadequate condition set for partitioning the output equivalence class

[0052] E≡e 1 ∧e 2 ...∧e n ;

[0053]

[0054] Among them, e i ∈Q(O) represents the output alphabet ∑ O Any output expression in is any output expression from the complement set ∑\Q(O) of Q(O);

[0055] For any collection Define a new formula, which is a combination of the above input equivalence class and output equivalence class, namely the input-output equivalence class:

[0056]

[0057] According to the above formula, we construct a function with at least one evaluation function σ∈D Var As the set of all formulas ξ of the automatic train protection system model:

[0058]

[0059] Let IO = {io(ξ)|ξ∈P'} denote the set of all equivalence classes;

[0060] Among them, for the equivalence class io(ξ), there exists the following equivalence relation:

[0061]

[0062] Among them, “.” represents the concatenation symbol.

[0063] As a preferred embodiment, based on the set of expressions corresponding to the input events and output events in the automatic train protection system, the feature set and state coverage set of the automatic train protection system are respectively constructed, the feature set of propositional abstraction is constructed for propositional abstraction, and the state coverage test case is generated according to the feature set and state coverage set of the automatic train protection system; the completeness test case is generated according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system, and the safety requirement test case is generated according to the state coverage set and the feature set of propositional abstraction. The mutant of the automatic train protection system model in the fault domain executes the state coverage test case, the completeness test case and the safety requirement test case for consistency testing. If the consistency test passes, the state coverage test case, the completeness test case and the safety requirement test case after passing the consistency test are obtained. If not, the fault domain is reconstructed and the above two steps are repeated until the state coverage test case, the completeness test case and the safety requirement test case pass the consistency test, which specifically includes:

[0064] Starting from the initial state, find the feature set W of the automatic train protection system and the feature set W' of the propositional abstraction. The feature set is a set of finite input sequences that can distinguish any pair of state behaviors. In the automatic train protection system, for any state si and s j , there exists a specific transformation belonging to the feature set W of the automatic train protection system, so that after applying the specific transformation, the state s i and j Produce different output expressions;

[0065] In propositional abstraction, for any state s i and j , there exists a propositional transformation that belongs to the feature set W' of propositional abstraction, so that after applying the propositional transformation, the state s i and j Produce different output expressions;

[0066] Obtain the state coverage set consisting of symbolic transitions τ, and generate state coverage test cases T through the state coverage set V and the feature set W of the automatic train protection system 1 , as shown below:

[0067] T 1 =VW;

[0068] By covering the test case T 1 Select a representative portion of all possible states in the automatic train protection system for verification and testing;

[0069] Generate a completeness test case T using the following formula2 :

[0070]

[0071] Where v∈V represents any transition in the state coverage set V, and w∈W represents any transition in the feature set. It means to traverse all equivalence classes with a sequence length of len, where the value range of len is between 1 and m-n+1;

[0072] Detection status coverage test case T 1 And completeness test case T 2 Whether the following requirements are met: The mutant M' of the automatic train protection system model in the fault domain executes the state coverage test case T 1 And completeness test case T 2 The obtained output is executed with the automatic train protection system model M to cover the test case T 1 And completeness test case T 2 The output obtained is consistent; the mutant M' of the automatic train protection system model executes the state coverage test case T 1 And completeness test case T 2 The state after reaching the state and the automatic train protection system model M executes the state coverage test case T 1 And completeness test case T 2 The state of the later arrival is consistent;

[0073] Generate security requirement test cases T using the following formula 3 :

[0074] T 3 =VW′;

[0075] Pass the security requirement test case T 3 Check whether the propositional abstraction corresponding to the security requirements meets the software security requirements;

[0076] Detection of security requirements test cases T 3 Whether the following requirement is met: The mutant M' of the automatic train protection system model in the fault domain executes the safety requirement test case T 3 The output obtained later satisfies the corresponding linear temporal logic formula;

[0077] Determine the state coverage test case T 1 , completeness test case T 2 and security requirement test cases T 3Check whether all the corresponding requirements are met. If so, it is determined that the consistency test has passed. Otherwise, rebuild the fault domain and repeat the above steps until the state coverage test cases, completeness test cases and safety requirement test cases pass the consistency test, and obtain the state coverage test cases, completeness test cases and safety requirement test cases that have passed the consistency test.

[0078] In a second aspect, the present invention provides a test case generating device for an automatic train protection system based on input-output equivalence classes, comprising:

[0079] An analysis module is configured to analyze the automatic train protection system using the STPA technology, identify unsafe control actions and software safety requirements, convert the software safety requirements into linear temporal logic formulas based on the unsafe control actions, convert the linear temporal logic formulas into atomic propositions, and obtain an atomic proposition set;

[0080] A modeling module is configured to use a symbolic finite state machine to model the automatic train protection system, obtain an automatic train protection system model, calculate all valuation functions of the automatic train protection system, map the valuation functions to a set of atomic propositions satisfied by the valuation functions, and obtain proposition abstraction;

[0081] The equivalence module is configured to construct a number of mutants based on the automatic train protection system model and obtain a fault domain; given an alphabet related to the fault domain, construct a set of expressions corresponding to input events and output events in the automatic train protection system and divide them into equivalence classes; use the equivalence class to mark the transformation of the automatic train protection system model to obtain the marked automatic train protection system model, use the power set construction method to the marked automatic train protection system model and transform the determinism to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model;

[0082] The test module is configured to construct the feature set and state coverage set of the automatic train protection system based on the set of expressions corresponding to the input events and output events in the automatic train protection system, construct the feature set of propositional abstraction for propositional abstraction, generate state coverage test cases according to the feature set and state coverage set of the automatic train protection system; generate completeness test cases according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system, generate safety requirement test cases according to the state coverage set and the feature set of propositional abstraction, execute state coverage test cases, completeness test cases and safety requirement test cases on the mutants of the automatic train protection system model in the fault domain for consistency testing, if the consistency test is passed, the state coverage test cases, completeness test cases and safety requirement test cases that pass the consistency test are obtained, if not, the fault domain is reconstructed and the above two modules are repeated until the state coverage test cases, completeness test cases and safety requirement test cases pass the consistency test.

[0083] In a third aspect, the present invention provides an electronic device comprising one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.

[0084] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.

[0085] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.

[0086] Compared with the prior art, the present invention has the following beneficial effects:

[0087] (1) The test case generation method for the automatic train protection system based on input-output equivalence classes proposed in this invention adopts the STPA technology to conduct an in-depth analysis of the safety requirements of the ATP system. Through a rigorous analysis of the system hierarchy, the unsafe control actions at each level and the corresponding software safety requirements are obtained.

[0088] (2) The test case generation method for the automatic train protection system based on input-output equivalence classes proposed in the present invention further formalizes the software safety requirements generated by STPA into LTL formulas, and uses them as attribute requirements for verification in the test. This step organically combines safety requirements with consistency testing, uses LTL formulas as a "middle bridge", imports safety requirements into the test case generation method, and realizes consistency testing oriented to safety requirements.

[0089] (3) The method for generating test cases for an automatic train protection system based on input-output equivalence classes proposed in the present invention uses a symbolic finite state machine to model the automatic train protection system, and uses LTL formulas to generate test cases. It is worth noting that when generating test cases, this method innovatively divides input expressions and output expressions that are continuous and have infinite domains into equivalence classes. Unlike previous technologies that only divide input events, this method also divides output events, and at the same time, divides the input and output into equivalence classes and then integrates them together, combining the corresponding input equivalence classes and output equivalence classes for testing, thereby improving the comprehensiveness and effectiveness of the test. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0091] Figure 1 A flowchart of a method for generating test cases for an automatic train protection system based on input-output equivalence classes according to an embodiment of the present application;

[0092] Figure 2 A schematic diagram of an automatic train protection system of an automatic train protection system test case generation method based on input-output equivalence classes according to an embodiment of the present application;

[0093] Figure 3 A schematic diagram of a simulation of a symbolic finite state machine of a braking system of an ATP system of a test case generation method for an automatic train protection system based on input-output equivalence classes according to an embodiment of the present application;

[0094] Figure 4 A schematic diagram of a brake system mutant of an ATP system of a test case generation method for an automatic train protection system based on input-output equivalence classes according to an embodiment of the present application;

[0095] Figure 5A schematic diagram of converting a non-deterministic system into a deterministic system in a test case generation method for an automatic train protection system based on input-output equivalence classes in an embodiment of the present application;

[0096] Figure 6 A schematic diagram of a test case generating device for an automatic train protection system based on input-output equivalence classes according to an embodiment of the present application;

[0097] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0098] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0099] Figure 1 A method for generating test cases for an automatic train protection system based on input-output equivalence classes is shown in an embodiment of the present application, comprising the following steps:

[0100] S1, the STPA technology is used to analyze the automatic train protection system, identify unsafe control actions and software safety requirements, convert the software safety requirements into linear temporal logic formulas based on the unsafe control actions, convert the linear temporal logic formulas into atomic propositions, and obtain an atomic proposition set.

[0101] In a specific embodiment, the STPA technology is used to analyze the automatic train protection system, identify unsafe control actions and software safety requirements, convert the software safety requirements into linear temporal logic formulas based on the unsafe control actions, and convert the linear temporal logic formulas into atomic propositions to obtain an atomic proposition set, which specifically includes:

[0102] Analyze the automatic train protection system to get accidents, analyze the accidents to get hazards, analyze the hazards to get system-level safety constraints, analyze the system-level safety constraints to get unsafe control actions, and analyze the unsafe control actions to get software safety requirements;

[0103] The software safety requirements are converted into linear temporal logic formulas using the following rules:

[0104] Rule 1: When situation S occurs, the automatic train protection system should always provide no control action CA i , converted into a linear temporal logic formula: LTL i=G(S→!(controlAction==CA i )), where G means in the global scope, → means it happens immediately afterwards, ! means it cannot happen, == means to judge whether two are equal, and i means the i-th linear temporal logic formula;

[0105] Rule 2: Before the occurrence of situation S, the automatic train protection system should not provide control action CA too early i , converted into a linear temporal logic formula: LTL i =G(((controlAction==CA i )→S)&! ((controlAction==CA i )∪S)), & represents and, ∪ represents the union;

[0106] Rule 3: After Situation S occurs, the automatic train protection system should not provide control action CA too late i , converted into a linear temporal logic formula: LTL i =G((S→(controlAction==CA i ))&! (S∪(controlAction==CA i )));

[0107] Rule 4: When situation S occurs, the automatic train protection system should immediately provide control action CA i , converted into a linear temporal logic formula: LTL i =G(S→X(controlAction==CA i )), X means providing control action immediately;

[0108] Linear temporal logic formulas are defined by the following grammar: Among them, X represents the next state, U represents until, W represents if until, and F represents a future state. The set η of linear temporal logic formulas is defined as an atomic proposition, denoted by η∈AP, where AP represents the set of atomic propositions, and is represented by symbolic expressions from Var, := represents the definition, and the semantic definition of the set η of linear temporal logic formulas is defined in the proposition transformation π∈(2 AP ) ω Above, where AP should be a superset of the atomic propositions that appear in the set η of linear temporal logic formulas;

[0109] A linear temporal logic formula The set η of is a set P of propositional transformations that satisfies the following conditions:

[0110] Make

[0111] in, \ represents complement, π′ and π″ represent two different finite prefixes of proposition transformation π respectively; the set of all atomic propositions constitutes the atomic proposition set AP.

[0112] Specifically, STPA (System-Theoretic Process Analysis) is a system safety analysis method proposed by Professor Nancy Leveson of MIT, which aims to address the shortcomings of traditional safety analysis methods in complex systems. STPA is based on system theory and believes that system safety issues are not only caused by component failures, but may also be caused by complex interactions and control defects within the system.

[0113] Basic concepts of STPA:

[0114] System theory perspective: STPA views the system as a whole, emphasizing the interaction and collaboration between components within the system. It focuses on the behavior of the system in a specific environment, rather than just the function and reliability of individual components.

[0115] Cybernetics model: STPA uses cybernetics model to describe the operation of the system, and believes that the system realizes its function through control structure. The control structure includes controller, controlled object, feedback path, etc.

[0116] Safety constraints: STPA prevents accidents by identifying and analyzing the safety constraints of a system. Safety constraints are conditions that a system must meet during operation to ensure its safety.

[0117] The steps of STPA are as follows:

[0118] 1. Define the purpose: Clarify the goals and scope of the system, including the system's functions, environment, and operating conditions.

[0119] 2. Establish a control structure model: Construct a control structure diagram of the system, identify the controller, controlled object, sensor, actuator and their relationships in the system.

[0120] 3. Identify unsafe control behaviors: Identify unsafe control behaviors that may occur during the control process, such as failure to provide control, providing incorrect control, etc.

[0121] 4. Analyze the causes of unsafe control behaviors: Analyze the potential causes of unsafe control behaviors, including control algorithm defects, inaccurate feedback information, system interference, etc.

[0122] The Automatic Train Protection (ATP) system is a key safety system in railway transportation, which aims to ensure the safety of trains during operation through automated means. The main functions of the ATP system include monitoring the speed, position and signal status of the train, and automatically taking braking measures when necessary to prevent accidents such as train overspeeding or collision. Among them, its key function is speed monitoring and control. The main components of the ATP system are: on-board equipment, trackside equipment, central control system and communication network.

[0123] The working principle of the ATP system is to obtain the running status and track information of the train in real time through a series of sensors and communication devices. The on-board equipment receives the signal information sent by the trackside equipment and calculates and judges according to the preset safety rules (such as speed limit, signal status, etc.). If the train is found to be in potential danger, such as speeding or running a red light, the system will automatically take measures to slow down or emergency brake to ensure the safety of the train.

[0124] The communication network uses a radio block center (RBC) to receive information related to other ground equipment and generate a movement authorization (MA) in combination with the information interacted with the on-board equipment. Then, the MA and line description parameters and other information are transmitted to the on-board equipment of the trains in its supervision area through the RBC, so that the trains can run safely on the lines within the jurisdiction of the RBC.

[0125] During the operation of the train, after receiving the MA command, the ATP system combines the train's own speed limit, braking characteristics and other train-related input information with line conditions such as basic line parameters and speed limit parameters to calculate the speed supervision curve in real time, generate the current speed limit, monitor the train's running speed in real time, and give corresponding instructions through the train display. If the actual running speed of the train is close to the current speed limit, the ATP system will give an alarm to remind the driver to slow down; if the speed exceeds the current speed limit, the ATP system will give a braking command to automatically control the train supervision. The working principle of the ATP system is as follows Figure 2 As shown:

[0126] In the ATP system, the speed control function is divided into two braking control modes according to the different human-machine relationships: driver braking priority (human control priority) and equipment braking priority (machine control priority). The human control priority mode is usually used in the ATP system in the non-full monitoring (FS) mode, while the machine control priority mode is exclusively used in the ATP system in the full monitoring mode.

[0127] According to the change of the speed allowed in the area, the speed monitoring area can be divided into the ceiling speed monitoring area (CSM area) and the target speed monitoring area (TSM area). The CSM area refers to the area where the speed is allowed to be constant, while the TSM area refers to the area where the speed is allowed to gradually decrease to a certain speed limit or 0km / h.

[0128] When the train is overspeeding, the control principle of the ATP system is as follows:

[0129] When the train speed exceeds the alarm speed, the sound and light alarm is triggered:

[0130] Regardless of whether the braking control mode is human-controlled or machine-controlled, and whether the train is in the CSM or TSM area, when the train speed exceeds the alarm speed, the ATP system will sound an audible and visual alarm. The audible and visual alarm will continue until the train speed drops below the alarm speed for 2 seconds.

[0131] When the train speed exceeds the braking intervention speed, the braking signal is output:

[0132] Human control priority mode: In the CSM area and TSM area, the braking process of the ATP system is the same. When the train speed exceeds the commonly used braking intervention speed, the ATP system will output the maximum commonly used braking until the train speed drops below the allowed speed. At this time, the driver can press the "allowed relief button" to stop the output of the maximum commonly used braking. If the train speed exceeds the emergency braking intervention speed, the ATP system will trigger the emergency braking until the train stops completely. The emergency braking will be released only after the driver presses the "allowed relief button" again.

[0133] Machine control priority mode: To avoid frequent triggering of the maximum common brake, the TSM area adds weak common brakes and medium common brakes. When the train speed exceeds the weak common brake intervention speed, the medium common brake intervention speed and the maximum common brake intervention speed in turn, the ATP system will output the corresponding brakes in turn. If the train speed continues to increase and exceeds the emergency brake intervention speed, the system will output all levels of common brakes and emergency brakes at the same time. The relief conditions are the same as the human control priority mode. After the driver presses the "Allow Relief Button", all levels of brakes are released together.

[0134] Detailed brake control mechanism:

[0135] The output sequence of weak service brake, medium service brake and maximum service brake is as follows:

[0136] When the train speed exceeds the corresponding intervention speed, the ATP system outputs weak normal braking, medium normal braking and maximum normal braking in sequence.

[0137] When the train speed drops below the maximum common brake intervention speed, the medium common brake intervention speed and the permitted speed, the system will stop these brake outputs in sequence.

[0138] Emergency braking triggering conditions and relief mechanisms:

[0139] If the train still accelerates when the maximum common brake, medium common brake and weak common brake are output at the same time, the ATP system will trigger the emergency brake when the speed exceeds the emergency brake intervention speed. The conditions for relieving the emergency brake are consistent with the human control priority mode. After the driver presses the "allow relief button", all braking measures are released together.

[0140] Through the above control mechanisms, the ATP system can effectively monitor and control the train speed, ensure that the train runs within a safe range, and prevent dangerous situations caused by overspeeding.

[0141] For the ATP system, unsafe control actions can be analyzed in the following parts.

[0142] 1. Analyze accidents, hazards, and system-level safety constraints

[0143] An incident represents a safety-critical problem. For ATP systems, there are four types of incidents:

[0144] A1: Train collision;

[0145] A2: Rear-end collision;

[0146] A3: Emergency braking causes passenger injury;

[0147] A4: Derailment;

[0148] A hazard is a system state that, together with an unsafe control action, leads to an accident. For the above four accidents, the analysis yielded the following four hazards and the accidents they may cause (indicated by numbers):

[0149] H1: Exceeding speed. This may lead to A1, A2, A4 accidents.

[0150] H2: Improper brake control. This may lead to A1, A2, A3, A4 accidents.

[0151] H3: Train position detection error. This may lead to A1, A2 accidents.

[0152] H4: Communication failure. This may lead to A1, A2 accidents.

[0153] From the above hazards, the following three system-level safety constraints (SC) can be derived and linked to the relevant hazards (indicated by numbers). These system-level safety constraints cannot be violated. Once these system-level constraints are violated, accidents may occur.

[0154] SC1: Once the train exceeds the speed limit, it must slow down.

[0155] SC2: When the train is too close to the vehicle ahead, it must slow down.

[0156] SC3: The corresponding braking level should be applied according to the overspeed level.

[0157] 2. Identify unsafe control behaviors

[0158] An unsafe control action (UCA) is a control measure that can lead to danger in certain situations and worst-case scenarios. For the ATP system, 10 unsafe control actions are first identified, as shown in Table 1.

[0159] Table 1 Unsafe control behaviors

[0160]

[0161] 3. Software security requirements

[0162] Loss scenarios describe possible causes of unsafe control actions and hazards. Software safety requirements can be derived directly from unsafe control actions UCA1–UCA10.

[0163] Table 2 Software security requirements

[0164] Serial number Software security requirements 1 In the case of overspeed, the ATP system must issue a deceleration command 2 The ATP system must be able to detect when a train is speeding. 3 The ATP system cannot apply deceleration or emergency braking at will. 4 The ATP system cannot trigger emergency braking at will. 5 The ATP system must be able to trigger emergency braking when necessary. 6 The ATP system must be able to effectively release the brakes 7 The ATP system must report the correct train position. 8 The ATP system must be able to update train location data in real time. 9 The communication between the ATP system and the trackside equipment cannot be interrupted. 10 The communication data between the ATP system and the trackside equipment must not be wrong.

[0165] According to a method for generating linear temporal logic formulas based on unsafe control actions (UCA) and software safety requirements (SSR), the following rules can be summarized to complete the conversion of software safety requirements to linear temporal logic formulas in this step.

[0166] The rules contain the following abbreviations:

[0167] S stands for situation, and CA stands for control action. For example, in Software Safety Requirement-1 (ATP system must issue a deceleration command in the case of overspeed), S stands for overspeed situation, and CA stands for deceleration command.

[0168] Rule 1: When situation S occurs, the system should always provide no control action CA i The conversion formula is: LTL i =G(S→!(controlAction==CA i )).

[0169] Rule 2: Before Situation S occurs, the system should not provide control action CA too early i The conversion formula is: LTL i =G(((controlAction==CA i)→S)&! ((controlAction==CA i )∪S)).

[0170] Rule 3: After situation S occurs, the system should not provide control action CA too late i The conversion formula is: LTL i =G((S→(controlAction==CA i ))&! (S∪(controlAction==CA i ))).

[0171] Rule 4: When situation S occurs, the system should immediately provide control action CA i The conversion formula is: LTL i =G(S→X(controlAction==CA i )).

[0172] For the 10 software security requirements above, we simply list the following transformations to illustrate the process:

[0173] For example, software safety requirement 1 (the ATP system must issue a deceleration command when overspeeding) can be converted to:

[0174] LTL 1 =G((Overspeed→(controlAction==

[0175] Deceleration command))&! (Overspeed situation∪(controlAction==deceleration command))).

[0176] For software safety requirement-5 (the ATP system must be able to trigger emergency braking when necessary.) it can be converted to:

[0177] LTL 5 =G((overspeed→(controlAction==emergency brake))&!(overspeed∪(controlAction==

[0178] Emergency brake))).

[0179] In order to describe the software security requirements of a given SFSM M, the embodiments of the present application use linear temporal logic (LTL) formulas. In the embodiments of the present application, the LTL formula The syntax of is defined by the following grammar: Where η∈AP, AP represents a set of atomic propositions, represented by symbolic expressions from Var.

[0180] In the embodiment of the present application, the LTL formula has been obtained in the above. Here, we only need to replace the linear temporal logic formula The set η of can be taken as the atomic proposition.

[0181] LTL formula The semantics of the set η is defined on the infinite sequence set π∈(2 AP ) ω (For any set X, its power set is 2 X ), where AP should be the LTL formula The superset of atomic propositions that appear in the set η of . Here, the transformation that contains software safety requirements is called propositional transformation to distinguish it from symbolic transformation and concrete transformation.

[0182] A safety property P is a set of propositional transformations that satisfies the following conditions:

[0183] Make

[0184] Intuitively, any propositional transformation that violates the safety property P (i.e. ) can be identified by a finite prefix π'<π (the so-called bad prefix) that ensures that any subsequent part of π' will never satisfy the safety property P. The safety property P is precisely those software safety requirements that can be checked on a finite number of transitions, i.e., linear temporal logic formulas. Therefore, this method is a test oriented to security properties. The set of all security properties P constitutes the atomic proposition set AP.

[0185] for Figure 3 The braking system of the automatic train protection system shown in the figure considers two software safety requirements. These two software safety requirements are expressed in natural language as follows:

[0186] R1. As long as the value of x does not exceed v, the application force of any braking intervention should be less than or equal to B1.

[0187] R2. If the applied braking force is greater than or equal to B2-0.1, this situation should be maintained in the next step unless the actual speed drops below vq.

[0188] Expressed in LTL (Linear Temporal Logic) formulas, these software safety requirements can be formalized as the following formulas:

[0189] φ 1 ≡(y≤B1)W(x>v);

[0190]

[0191] According to the definition of operator W, the LTL formula φ1 represents one of the following two cases: either (x > v) never occurs and (y < B1) holds globally for an infinite time in the future; or (x > v) will eventually occur in the future, but (y < B1) holds all the time on the prefix before that.

[0192] Specifically:

[0193] The LTL formula φ 1 is represented by the operator W. As long as x ≤ v, y should remain less than or equal to B1. If x exceeds v, then y must have been less than or equal to B1 all the time before that.

[0194] The LTL formula φ 2 is represented by the operators G and the next-state operator X. If the current y ≥ B2 - 0., then in the next step, y should still remain ≥ B2 - 0.1, unless x drops below v - q.

[0195] These LTL formulas ensure the safety and consistency of the braking system of the automatic train protection system in different states, and guarantee the reasonable distribution and adjustment of braking force under specific conditions.

[0196] The LTL formulas in this application have been derived from the above steps, so they can be directly applied to generate test cases. The LTL formulas automatically converted from software safety requirements are further reduced to the atomic proposition set AP. This atomic proposition set AP is used for the following propositional abstraction and test case generation.

[0197] S2. Model the automatic train protection system using a symbolic finite state machine to obtain the automatic train protection system model, calculate all valuation functions of the automatic train protection system, and map the valuation functions to the atomic proposition set they satisfy to obtain the propositional abstraction.

[0198] In a specific embodiment, the automatic train protection system model is represented as M = (S, s 0 , R, I, O, D, ∑ I , ∑ O ), where S represents the state space, s 0 ∈S represents the initial state, I represents the set of input events, O represents the set of output events, ∑ I represents the input alphabet, and the input alphabet is the set of input expressions, consisting of a finite number of input expressions, and each input expression is a first-order expression of input events; ∑ O represents the output alphabet, and the output alphabet is the set of output expressions, consisting of a finite number of output expressions, and each output expression is a first-order expression of output events; represents the transition relation; D represents the union of all expression type domains;

[0199] The valuation function σ represents the mapping of each input-output expression v' to its corresponding σ(v'), where the input-output expression v' belongs to Var, Var represents the union of the input event set I and the output event set O, and the set of sequences mapped from Var to D is represented as the assignment function set D Var , the set of assignment functions D Var That is, it is the set of expressions corresponding to the input events and output events in the automatic train protection system, and (D Var ) * represents the set of all finite sequences from Var to D, Denote that the valuation function σ is a model of the input event φ, for each pair (φ, ψ)∈∑ I ×∑ O , ψ represents the output event, s and s' represent the two states before and after the transition, and there is at least one model Where φ∧ψ is the conjunction of input events and output events, and the transformations include symbolic transformation, concrete transformation, and propositional transformation;

[0200] The sign conversion of the automatic train protection system model M is composed of multiple consecutive (φ i ,ψ i ), namely:

[0201] τ=(φ 1 / ψ 1 )...(φ n / ψ n )∈(∑ I ×∑ O ) * ;

[0202] satisfy:

[0203] in, Indicates existence, Indicates any, s i-1 represents the i-1th state, s i represents the i-th state, φ i represents the i-th input event, ψ i represents the i-th output event;

[0204] The specific transformation κ of the automatic train protection system model M is a finite sequence of evaluation functions, namely:

[0205] κ=σ 1 ... n ∈(D Var ) * ;

[0206] If the specific transformation κ makes the automatic train protection system model M have a sign transformation τ=(φ 1 / ψ 1 )...(φ n / ψ n ) satisfies (σ 1 Then the specific transformation κ is called the witness of the symbolic transformation τ, using the shorthand notation

[0207] Introduce wrong behavior into the automatic train protection system model M and construct the mutant M';

[0208] A fault domain is defined as a set of mutants in the form of a symbolic finite state machine with the following properties:

[0209] Each mutant M' has at most m≥n states, where n means that the automatic train protection system model M has n distinguishable states, and m means that the mutant of the automatic train protection system model M has at most m distinguishable states;

[0210] Each mutant M' refers to an expression from a set of input events I and a set of output events O;

[0211] Each mutant M' uses the input alphabet ∑ I and output alphabet ∑ O ;

[0212] The alphabet of fault domain D includes the union of the input alphabet, the output alphabet, and the atomic propositions of the linear temporal logic formula to be verified, that is, ∑ = ∑ I ∪∑ O ∪AP.

[0213] In a specific embodiment, the valuation function is mapped to the set of atomic propositions it satisfies to obtain proposition abstraction, which specifically includes:

[0214] Assume that the atomic proposition set AP is the set of atomic propositions in Var, and the atomic proposition set AP contains the atomic propositions satisfied by the automatic train protection system model and used to verify the linear temporal logic formula. The proposition abstraction ω will be assigned to the function set D Var Mapped to the set of atomic propositions it satisfies, denoted as:

[0215]

[0216] in, Indicates correspondence;

[0217] Extend the propositional abstraction ω to the set of assignment functions D by recursive definition Var And the specific conversion κ:

[0218] ω∶(DVar ) * →(2 AP ) * , ω(ε)=ε and ω(σ.κ)=ω(σ).ω(κ), where σ∈D Var ,κ∈(D Var ) * .

[0219] Specifically, the ATP system is modeled according to the symbolic finite state machine definition and prepared before testing. The test case generation process aims to guide the test case generation process for a set of atomic propositions (derived from linear temporal logic formulas) and a symbolic finite state machine (SFSM) as a reference model and as a test object. The reference model may be uncertain. The generated test cases are designed to verify whether the system satisfies each atomic proposition satisfied by the model in each linear temporal logic formula.

[0220] Symbolic finite state machine is a method for modeling systems. It builds a virtual automatic train protection system model in the computer and uses it as a reference model to abstract the state of the ATP system and simulate the response of the real ATP system to various input events. A symbolic finite state machine can be represented as a tuple M = (S, s 0 ,R,I,O,D,∑ I ,∑ O ).

[0221] in:

[0222] The finite set S represents the state space, where s 0 ∈S represents the initial state.

[0223] The finite set I contains the set of input events, and the finite set O contains the set of output events. The input events consist of input variables and input conditions, and the output variables consist of input variables and at least one output variable. Sets I and O must be disjoint, and Var is used to represent the abbreviation of set I∪O.

[0224] The set D represents the union of all expression type domains.

[0225] The input alphabet is the set of input expressions ∑ I , consists of a finite number of input expressions, each of which is a first-order expression of the input event.

[0226] The output alphabet is the set of output expressions ∑ O , consists of a finite number of output expressions; each output expression is a first-order expression of the output event.

[0227] gather Indicates a transition relationship.

[0228] consider Figure 3 The braking system of the automatic train protection system in Figure 1. It describes the braking system in a fictitious ATP system, simulating the braking system deployed in modern vehicles. The input variable x∈[0,400] represents the actual vehicle speed, which should not exceed v=300km / h. As long as the speed limit is not violated, the braking system of the automatic train protection system remains in state s 0 , and the braking is not intervened, and the braking force output y is set to 0. When the vehicle speed exceeds v, the input condition x>v is triggered, and s is executed 0 to 2 The transformation sets the braking force y to y=B2+(xv) / p, where the constants B2=2 and p=100. The applied braking force y is greater than 2 and increases linearly according to the extent to which x exceeds the allowed threshold v. For the physically possible maximum speed x=400 for this type of vehicle, the maximum applied braking force y=3.

[0229] When in state s 2 When the vehicle speed changes, the braking force is adjusted according to the formula y = B2 + (xv) / p. In order to avoid repeated release and activation of the brakes when the vehicle speed changes around v, the braking system of the automatic train protection system is kept in state s when x ≥ vq. 2 , where the constant q = 10. Therefore, when the vehicle decelerates to x = vq, the braking force decreases. When the vehicle speed drops below vq, the braking system releases the brakes (y = 0) and returns to state s 0 .

[0230] When the brake system of the automatic train protection system is in state s 0 When the vehicle speed is equal to v, non-deterministic system response is allowed. The braking system of the automatic train protection system can be maintained in state s 0 Without any braking intervention, or when a low braking force y∈[B0,B1] is applied, the state is switched to s 1 , where B0 = 0.9, B1 = 1.1. In state s 1 When , a non-deterministic braking force in the range [B0, B1] is applied until the vehicle speed exceeds v again or drops below v, which results in s 1 to 0 conversion.

[0231] Figure 3 SFMS BRK=(S BRK ,s 0 , R BRK , I BRK , O BRK , D BRK ,∑ I BRK,∑ O BRK );

[0232] With state space S BRK ={s 0 ,s 1 ,s 2} and the initial state s 0 Its variable symbol is I BRK ={x},O BRK ={y}, type domain D BRK = [0,400], which represents the input range and also covers the reachable output variable range y∈[0,3]. The input alphabet of the braking system of the automatic train protection system can be rewritten as:

[0233] ∑ I BRK ={x∈[0,300],x∈[0,300),x=300,x∈(300,400],x∈[290,400],x∈[0,290)};

[0234] Likewise, the output alphabet can be expressed as:

[0235] ∑ O BRK ={y=0, y∈[0.9,1.1], y=x / 100}.

[0236] The valuation function σ is a function that maps each input-output expression v' to its corresponding σ(v'), where the input-output expression v' belongs to the union Var of the input event set I and the output event set O. Var is an abbreviation for the set of functions that map from Var to D, and (D Var ) * represents the set of all finite sequences from Var to D. For the expression φ of Var, use Denote that σ is a model of φ. In the embodiments of the present application, only well-formed SFSMs are considered, which means that for every pair (φ, ψ)∈∑ I ×∑ O , there is at least one model where φ∧ψ is the conjunction of the input expression and the output expression.

[0237] The valuation function is a way to model specific input events and corresponding output events in the system. It represents specific input and output events. Figure 3 In the braking system of the automatic train protection system shown in Figure 2, the estimation function σ 1={x→200,y→0.95} is a model of (φ,ψ)=(x=v,y∈[B0,B1]), that is, In this example, no matter what value y takes, as long as it is in the interval [B0, B1], it can be a model of (φ, ψ), that is, σ 2 ={x→200,y→0.96} is also a model where (φ,ψ)=(x=v,y∈[B0,B1]).

[0238] The role of the valuation function is to identify and classify specific input and output events, which guides the generation of symbolic conversion and specific conversion, and provides a basic idea for the subsequent equivalence class division. In this step, all valuation functions in the ATP system will be calculated for subsequent use.

[0239] It is noteworthy that all transitions of the ATP system and its mutants have corresponding models, so these SFSMs are well defined.

[0240] For any set X, use X * To represent a set of finite sequences, use X ω Represents a collection of infinite sequences, which are used to describe test sequences and formulas about safety requirements.

[0241] The symbol transitions of the automatic train protection system model are a finite sequence:

[0242] τ=(φ 1 / ψ 1 )...(φ n / ψ n )∈(∑ I ×∑ O ) * satisfy:

[0243]

[0244] The sign transition consists of multiple consecutive (φ i ,ψ i ) and represents an execution path during the test.

[0245] Use (φ i / ψ i ) represents these predicate pairs, where φ i represents the input, ψ i The symbol transformation set of the automatic train protection system model M is represented by T(M).

[0246] Example:

[0247] Some symbol conversions for the braking system of the automatic train protection system are as follows:

[0248] τ 1 =ε;

[0249] τ 2 =(x≤v / y=0).(x≤v / y=0).(x≤v / y=0).(x≤v / y=0);

[0250] τ 3 =(x=v / y∈[B0,B1]).(x=v / y∈[B0,B1]).(x>v / y=B2+(xv) / c).

[0251] The specific transformation of the automatic train protection system model M is a finite sequence of evaluation functions:

[0252] κ=σ 1 ... n ∈(D Var ) * ;

[0253] If the specific transformation κ makes the automatic train protection system model M have a sign transformation τ=(φ 1 / ψ 1 )...(φ n / ψ n )satisfy Then the specific transformation κ is called the witness of the symbolic transformation τ, using the shorthand notation

[0254] Example:

[0255] For the sign conversion τ 3 , κ3={x→v,y→1.05}.{x→v,y→0.99}.{x→200.5,y→2.005};

[0256] As in the field of system modeling formalism, the behavior (or language) of the automatic train protection system model M is defined by its set of concrete transformations and is expressed as Two SFSMs are (linguistically) equivalent if and only if they have the same set of concrete transitions.

[0257] Propositional abstraction is a method for mapping a model to a set of sets that satisfy a specific set of atomic propositions. This method helps determine which concrete transformations or models are consistent with which LTL formulas. With this method, when testing concrete transformations, you can also verify whether the model satisfies its corresponding LTL formula.

[0258] Assume that AP is a set of atomic propositions in Var. Typically, AP consists of atomic propositions in LTL formulas satisfied by the reference model and used to verify the ATP system, which are composed of software safety requirements derived from the STPA method. The proposition abstraction ω maps the assignment to the set of atomic propositions it satisfies. It is denoted as:

[0259]

[0260] Through recursive definition, the propositional abstraction ω can be extended to assignment sequences and specific transformations:

[0261] ω∶(D Var ) * →(2 AP ) * , ω(ε)=ε and ω(σ.κ)=ω(σ).ω(κ), where σ∈D Var ,κ∈(D Var ) * .

[0262] example:

[0263] The specific transformation κ3={x→v,y→1.05}.{x→v,y→0.99}.{x→200.5,y→2.005} can be abstracted into a propositional transformation through the function ω.

[0264] The defined atomic proposition set AP is:

[0265] y≤B1;

[0266] x>v;

[0267] y ≥ B2-0.1;

[0268] According to these atomic propositions, each state of the concrete transformation κ3 can be abstracted step by step:

[0269] {x→v,y→1.05};

[0270] y≤B1 holds true (because y=1.05≤1.1=B1).

[0271] x>v does not hold (because x=v).

[0272] y≥B2-0.1 does not hold (because y=1.05<1.9=B2-0.1).

[0273] Therefore, the set of atomic propositions corresponding to this state is {y≤B1}.

[0274] {x→v,y→0.99}:

[0275] y≤B1 holds true (because y=0.99≤1.1=B1).

[0276] x>v does not hold (because x=v).

[0277] y≥B2-0.1 does not hold (because y=0.99<1.9=B2-0.1).

[0278] Therefore, the set of atomic propositions corresponding to this state is {y≤B1}.

[0279] {x→200.5,y→2.005}:

[0280] y≤B1 does not hold (because y=2.005>1.1=B1).

[0281] x>v holds true (because x=200.5>v=200).

[0282] y≥B2-0.1 holds true (because y=2.005>1.9=B2-0.1).

[0283] Therefore, the set of atomic propositions corresponding to this state is {x>v,y≥B2-0.1}.

[0284] The abstracted proposition is transformed into:

[0285] ω(κ3)={y≤B1}.{y≤B1}.{x>v,y≥B2-0.1}.

[0286] For an LTL formula φ and a finite propositional transformation π'∈(2 AP ) * , if and only if π' is a bad prefix of φ, use the symbol This means that any infinite propositional transformation prefixed with π' violates the safety property. When any concrete transformation of the automatic train protection system model M cannot be abstracted as a bad prefix of φ through propositional transformation ω (i.e. ), the automatic train protection system model M satisfies the LTL formula φ (written as ).

[0287] S3, construct several mutants based on the automatic train protection system model and obtain the fault domain; given an alphabet related to the fault domain, construct a set of expressions corresponding to input events and output events in the automatic train protection system that are divided into equivalence classes; use equivalence classes to mark the transformation of the automatic train protection system model to obtain the marked automatic train protection system model, use the power set construction method to the marked automatic train protection system model and transform the determinism to obtain an observable automatic train protection system model and an equivalence class set of observable automatic train protection system models.

[0288] In a specific embodiment, given an alphabet related to a fault domain, a set of expressions corresponding to input events and output events in an automatic train protection system is constructed and divided into equivalence classes; the conversion of the automatic train protection system model is marked by using the equivalence class to obtain the marked automatic train protection system model; the marked automatic train protection system model is constructed by a power set method and the determinism is converted to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model, specifically including:

[0289] For any collection Take the sufficient condition set G' for partitioning the input equivalence classes:

[0290] G'≡g 1 ∧g 2 …∧g n ;

[0291] Among them, g i ∈Q(I) represents any input expression from the input alphabet ∑I, i = 1, 2, ..., n, and the sufficient condition means that the input expression can be counted in the equivalence class only when the input expression g occurs;

[0292] For any collection Take a set of inadequate conditions for partitioning equivalence classes

[0293]

[0294] in, is any input expression from the complement of Q(I) ∑\Q(I), and the inadequate condition means an insignificant condition;

[0295] For any collection Take the sufficient condition set E and the inadequate condition set for partitioning the output equivalence class

[0296] E≡e 1 ∧e 2 ...∧e n ;

[0297]

[0298] Among them, e i ∈Q(O) represents the output alphabet ∑ O Any output expression in is any output expression from the complement set ∑\Q(O) of Q(O);

[0299] For any collection Define a new formula, which is a combination of the above input equivalence class and output equivalence class, namely the input-output equivalence class:

[0300]

[0301] According to the above formula, we construct a function with at least one evaluation function σ∈D Var As the set of all formulas ξ of the automatic train protection system model:

[0302]

[0303] Let IO = {io(ξ)|ξ∈P'} denote the set of all equivalence classes;

[0304] Among them, for the equivalence class io(ξ), there exists the following equivalence relation:

[0305]

[0306] Among them, “.” represents the concatenation symbol.

[0307] Specifically, a mutant is usually a variant created by introducing errors or faults into the reference model. These mutants are used to evaluate the fault tolerance of the system and whether the system can correctly detect, handle or prevent these errors and faults.

[0308] The erroneous behavior of the system under test is captured by a finite set of mutant SFSMs, whose behavior may deviate from the reference model SFSM, including:

[0309] incorrect or changing input conditions;

[0310] Wrong or changed output expressions;

[0311] transmission failures, including extra, lost, or unexpected conversions;

[0312] Additional or missing status.

[0313] In order to treat mutants and reference models in the same context, embodiments of the present application require:

[0314] Incorrect input conditions are also included in the input alphabet ∑I, and incorrect output expressions are also included in the output alphabet ∑O. Figure 3 The corresponding mutants in Figure 4 As shown, this mutant contains two errors, as indicated by the transitions highlighted in red.

[0315] In black box testing, the purpose of introducing fault domains is to limit the possible erroneous behaviors of the system, so as to ensure that the test cases can effectively cover various situations of the system. By defining fault domains, testers can design test cases more specifically to verify the system's processing capabilities under various fault conditions. Fault domains are built on the basis of mutants. Because the fault domain needs to contain multiple mutants, it is necessary to verify whether the system can still run and handle correctly when facing various abnormal situations.

[0316] A fault domain is defined as a set of SFSMs (Finite State Machines) with the following properties:

[0317] Each mutant M' has at most m ≥ n states.

[0318] Each mutant M' refers to an expression from a set I of input events and a set O of output events.

[0319] Each mutant M' uses the input expression (∑ I ) and the output expression (∑ O ).

[0320] LTL formulas use a set of atomic propositions AP, where the free variables come from the union of the input event set and the output event set (I∪O).

[0321] The alphabet of the fault domain D consists of the union of all input expressions, output expressions, and atomic propositions of the LTL formula to be verified, i.e., ∑ = ∑ I ∪∑ O ∪AP.

[0322] The potential fault systems captured by the fault domain are represented by SFSMs M'∈D, which represent the real behavior with at most m distinguishable states and are mutants of the automatic train protection system model M. Therefore, the mutant M' may perform transmission faults and use input expressions and output expressions that are never used by the reference model. In addition, the mutant M' may use input expressions and output expressions in the alphabet of the reference model and have arbitrary state transitions. To actually construct the fault domain D, all input expressions and output expressions appearing in the reference model can be collected and mutations of all potential input expressions and output expressions that are expected to appear in the faulty implementation can be added.

[0323] By defining the fault domain, testers can better design test cases to ensure the robustness and reliability of the system under various fault conditions. This approach helps to fully cover the system's exception handling capabilities and ensure that the system can correctly respond to various possible failures in actual operation.

[0324] In the reference model, the SFSM ( is required to be observable. This means that for any particular concrete transition κ∈L(M), the target state reached when the concrete transition κ is applied from the initial state s0 is uniquely determined. Specifically, during the test, the specific transition κ for this test is already known in advance. By observing its output events, it is possible to determine which input events the system has executed and accurately determine which state the system has reached.

[0325] Observability is crucial in the methods of the embodiments of the present application, especially when testing in a black box testing environment. Since it is impossible to directly observe and identify the current internal state of the system, it is necessary to rely on observability to infer the state of the system. However, since the system may make mistakes when performing tests, it is necessary to accurately know the test results and whether the test state reached meets the software safety requirements. This requires that the system must be observable.

[0326] In addition, the feature set also requires the system to be observable. This is because in a black box testing environment, in order to ensure the safety and correctness of the system in various situations, it is necessary to be able to infer the internal state of the system through externally observed output events in order to verify whether the system has reached the expected safety state.

[0327] Therefore, observability is not only to ensure effective testing and verification, but also an important prerequisite for ensuring the security and reliability of the system in a black box environment.

[0328] However, the ATP system in this method is unobservable and a non-deterministic system, so it needs to be converted into an observable system.

[0329] By checking that the states start from the same state s but end at different target states s 1 ≠s 2 All conversion pairs and Nondeterminism can be detected: if the first-order expression φ 1 ∧φ 2 ∧ψ 1 ∧ψ 2 There is at least one solution σ∈D Var , using the input value of σ in state s and observing the output value of σ cannot determine whether s has been reached. 1 Or s 2 , since it is impossible to tell from observing σ which transition has triggered.

[0330] For example: Figure 5 In s 0 When the state has the input event x=v, it can be transformed into s 1state, it can also loop once and still reach its own state. This kind of system is called a non-deterministic system. So before testing, it needs to be converted into a deterministic system. Use the following method:

[0331] In the embodiment of the present application, the power set construction method is applied to the marked automatic train protection system model to obtain an observable automatic train protection system model. It can be seen that for the non-deterministic system NFA, in s 0 If an input event x=v occurs in the state, an uncertain transition may occur: it may transition to s 1 The state may also be in s 0 In order to convert this non-deterministic system NFA into a deterministic system DFA, the power set construction method is used to analyze s 0 The state transition results in a new state {s 0 ,s 1}. In this way, when s 0 When an input event x=v occurs, the state will be transferred to {s 0 ,s 1}, and it becomes a deterministic system. Then, the deterministic system DFA can be completed according to other transition conditions of the non-deterministic system NFA.

[0332] Since testing conceptually requires control systems with infinite input and output domains (such as real numbers for speed and braking force in a braking system), it is usually not possible to apply a test strategy that enumerates all possible input interface values ​​and checks every possible output interface value of the system under test (SUT) (the testing time is too long). Therefore, it is necessary to partition the input / output domain into finite subsets, called equivalence classes, such that two members of the same class satisfy the following conditions:

[0333] When appearing in the same state, they are guaranteed to perform the same transition and have the same input expressions and output expressions.

[0334] Exactly satisfies the same subset of atomic propositions that appear in the LTL formula being verified.

[0335] Since the system under test (SUT) may use incorrect input expressions, it is not sufficient to use only a subset of the input expressions appearing in the reference model as input classes. The derivation of equivalence classes relies on the complete input and output alphabets of the fault domain and the atomic propositions appearing in the LTL formulas to be verified. Given the alphabet Σ associated with the fault domain Σ I ∪Σ O ∪AP, the assignment function set D Var Divide into equivalence classes, the steps are as follows:

[0336] 1. Let ∑ = ∑ I ∪∑O ∪AP is the set of all expressions that appear in the input expressions, output expressions, and LTL specifications.

[0337] 2. For any set Take the sufficient condition set G' for partitioning the input equivalence classes:

[0338] G'≡g 1 ∧g 2 ...∧g n ;

[0339] where g i ∈Q(I), represents any expression from the input alphabet ∑I. The sufficient condition here means that only when the input expression g occurs, the input expression can be counted in the equivalence class. For example: the speed is less than 300km / h. Here g can be any input expression with a speed less than 300.

[0340] 3. For any set Take a set of inadequate conditions for partitioning equivalence classes

[0341]

[0342] in From the complement of Q(I)∑\Q(I), i=1,2,…,n, different from g, this is a non-sufficient condition, indicating an insignificant condition. As shown in the above example: when the speed is less than 300km / h. For this equivalence class, only the speed information in the input expression is concerned, and other information (such as train position, train acceleration, etc.) is ignored. This unconcerned information belongs to middle.

[0343] 4. Similar to the above method of dividing input equivalence classes, there are two formulas to divide output equivalence classes. For any set Take the sufficient condition set E and the inadequate condition set for partitioning the output equivalence class

[0344] E≡e 1 ∧e 2 ...∧e n ;

[0345]

[0346] 5. For any collection Define a new formula, which is a combination of the above input equivalence class and output equivalence class, namely the input-output equivalence class:

[0347]

[0348] 6. According to the above formula, construct at least one valuation function σ∈D Var The set of all formulas ξ as a model:

[0349]

[0350] 7. For each ξ∈P', define an equivalence class io(ξ):

[0351]

[0352] 8. Let IO = {io(ξ)|ξ∈P′} represent the set of all equivalence classes.

[0353] For the equivalence class io(ξ), the following relation holds:

[0354]

[0355] This is an equivalence relation. In short, when the two evaluation functions are subsets of the alphabet They are equivalent only if they have the same expressions in the model. Two classes io(ξ) with Q≠Q' Q )、io(ξ Q ') are disjoint, since any expression e in Q\Q' must be represented by io(ξ Q ) in each σ (i.e. ) satisfies, and io(ξ Q Any σ' in ') needs to satisfy vice versa.

[0356] For the braking system in the embodiment of the present application, there is ∑ as shown in the following table:

[0357] Table 3∑ Table

[0358]

[0359] According to ∑ in Table 3 and the above steps of dividing equivalence classes, the embodiment of the present application divides a total of 38 equivalence classes. The following Table 4 briefly lists several equivalence classes:

[0360] Table 4 Equivalence classes

[0361]

[0362] The equivalence classes of the braking system of the example automatic train protection system and its related fault domains (Table 2) calculated according to Table 3 are listed in Table 4. As a specific calculation example, consider the equivalence class io34 using the formula (see the definition of gi, ej, ak in Table 2):

[0363]

[0364]

[0365] Therefore, the equivalence class contains the following assignment function: io34 = {σ∈(R≥0){x,y}|σ(x)∈(300,400]∧σ(y)=σ(x) / 100}; using simplified symbolic representation: io34 = (x∈(300,400]) / (y=x / 400); so far all equivalence classes have been found.

[0366] Let class io(Ψ) represent any equivalence class after equivalence class division, so the conversion at this time should be expressed as: and

[0367] Therefore, it is necessary to transform determinism based on equivalence classes. At the same time, a deterministic system is an observable system, so this step also completes the transformation from unobservable to observable. After the transformation, there should be:

[0368] and

[0369] All have different labels io(Ψ 1 )≠io(Ψ 2 ). Since the equivalence class D Var Divided into different classes, there is no Therefore, the mutant M' is observable as a SFSM.

[0370] S4, based on the set of expressions corresponding to the input events and output events in the automatic train protection system, construct the feature set and state coverage set of the automatic train protection system respectively, construct the feature set of propositional abstraction for propositional abstraction, generate state coverage test cases according to the feature set and state coverage set of the automatic train protection system; generate completeness test cases according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system, generate safety requirement test cases according to the state coverage set and the feature set of propositional abstraction, execute state coverage test cases, completeness test cases and safety requirement test cases on the mutants of the automatic train protection system model in the fault domain for consistency testing, if the consistency test passes, obtain the state coverage test cases, completeness test cases and safety requirement test cases after passing the consistency test, if not, rebuild the fault domain and repeat the above two steps until the state coverage test cases, completeness test cases and safety requirement test cases pass the consistency test.

[0371] In a specific embodiment, S4 specifically includes:

[0372] Triggering from the initial state, find the feature set W of the automatic train protection system and the feature set W' of the propositional abstraction. The feature set is a set of finite input sequences that can distinguish any pair of state behaviors. In the automatic train protection system, for any state s i and j , there exists a specific transformation belonging to the feature set W of the automatic train protection system, so that after applying the specific transformation, the state s i and j Produce different output expressions;

[0373] In propositional abstraction, for any state s i and j , there exists a propositional transformation that belongs to the feature set W' of propositional abstraction, so that after applying the propositional transformation, the state s i and j Produce different output expressions;

[0374] Obtain the state coverage set consisting of symbolic transitions τ, and generate state coverage test cases T through the state coverage set V and the feature set W of the automatic train protection system 1 , as shown below:

[0375] T 1 =VW;

[0376] By covering the test case T 1 Select a representative portion of all possible states in the automatic train protection system for verification and testing;

[0377] Generate a completeness test case T using the following formula 2 :

[0378]

[0379] Where v∈V represents any transition in the state coverage set V, and w∈W represents any transition in the feature set. It means to traverse all equivalence classes with a sequence length of len, where the value range of len is between 1 and m-n+1;

[0380] Detection status coverage test case T 1 And completeness test case T 2 Whether the following requirements are met: The mutant M' of the automatic train protection system model in the fault domain executes the state coverage test case T 1 And completeness test case T 2 The obtained output is executed with the automatic train protection system model M to cover the test case T 1 And completeness test case T 2The output obtained is consistent; the mutant M' of the automatic train protection system model executes the state coverage test case T 1 And completeness test case T 2 The state after reaching the state and the automatic train protection system model M executes the state coverage test case T 1 And completeness test case T 2 The state of the later arrival is consistent;

[0381] Generate security requirement test cases T using the following formula 3 :

[0382] T 3 =VW′;

[0383] Pass the security requirement test case T 3 Check whether the propositional abstraction corresponding to the security requirements meets the software security requirements;

[0384] Detection of security requirements test cases T 3 Whether the following requirement is met: The mutant M' of the automatic train protection system model in the fault domain executes the safety requirement test case T 3 The output obtained later satisfies the corresponding linear temporal logic formula;

[0385] Determine the state coverage test case T 1 , completeness test case T 2 and security requirement test cases T 3 Check whether all the corresponding requirements are met. If so, it is determined that the consistency test has passed. Otherwise, rebuild the fault domain and repeat the above steps until the state coverage test cases, completeness test cases and safety requirement test cases pass the consistency test, and obtain the state coverage test cases, completeness test cases and safety requirement test cases that have passed the consistency test.

[0386] As we all know, in black box testing, we don’t know what state the system under test is in. In order to distinguish the different states of the system under test and determine whether the current test has reached the desired target state (observability can do this) and whether it starts from the desired original state (this can only be done by distinguishing transformations), we need to use a feature set W to distinguish different states.

[0387] The feature set W is a set of finite input sequences that can distinguish any pair of state behaviors. In other words, for any state s i and j , there exists a specific transition x belonging to W, so that after applying the specific transition x, the state s i and j produces different output.

[0388] For example: Figure 3In the system, starting from the initial state s0, it is not known what state the system has reached after a series of input events. At this time, it is necessary to execute the feature set, and a series of x < v can be executed in the current state and the output can be checked to identify what state it is currently in.

[0389] In this step, the feature set W of the automatic train protection system is obtained.

[0390] For proposition abstraction, the corresponding feature set W' of proposition abstraction also needs to be identified. Similarly, it is a set of finite input sequences that can distinguish any pair of state behaviors. Only the feature set W of the automatic train protection system contains specific transitions, while the feature set W' of proposition abstraction contains proposition transitions.

[0391] The state coverage set V refers to, in testing, in order to verify whether the behavior of the system conforms to specific properties or requirements, a set of representative states selected from a part of all possible states in the system is used for verification and testing. This set is composed of symbolic transitions. The states included in this set are comprehensive enough to ensure that all key functions and behaviors of the system are covered, thereby improving the efficiency and effectiveness of testing. In short, the state coverage set V ensures that the system can reach every state. Of course, the empty transition ε is included in the state coverage set because it can reach the initial state.

[0392] Before testing, it should be detected whether the system under test can reach every state. Therefore, first execute the state coverage set V to verify whether the system under test can reach every state.

[0393] At the same time, the testing requirements not only require reaching every state, but also require that after executing specific transitions, the system can reach a unified state. This is where the feature set of the automatic train protection system is used to identify which state the system under test has reached. Therefore, the state coverage test cases to be tested in this step are:

[0394] T 1 = V.W.

[0395] Use the following formula to generate complete test cases:

[0396]

[0397] Among them, v ∈ V represents any transition in the state coverage set V, and w ∈ W represents any transition in the feature set of the automatic train protection system.

[0398] The complete test cases for this step are based on equivalence classes. As can be seen from the above formula, the set T 2 The main focus in In the actual test, the representative specific conversions in the equivalence class divided by the equivalence class are used for actual testing. This not only ensures a significant reduction in the number of test cases, but also ensures the completeness of the test. At the same time, according to the test purpose, we can choose which equivalence class to test according to the needs. For example: if we only want to test the reaction of the ATP system when overspeeding, we only need to test the input and output equivalence class related to overspeeding. There is no need to test the entire system. This further reduces the time used for testing.

[0399] The purpose of this step is to detect whether failures will occur in each state of the system under test and in the transitions in each equivalence class.

[0400] Completeness test case T 2 It ensures that in each state case reached, each applicable input / output condition in the equivalence class is executed, without executing all input and output conditions, which also ensures completeness. If the system under test passes all completeness test cases, then the system under test has no output faults.

[0401] Use the following security requirement test cases to detect whether the proposition abstraction corresponding to the security requirement meets the software security requirements:

[0402] T 3 =VW′;

[0403] The feature set here is a feature set W' for propositional abstraction. In the above content, the embodiment method of the present application further associates propositional abstraction with atomic propositions representing security requirements, and detecting these propositional abstractions is a test oriented to security requirements.

[0404] A system not only has output failures, but also transmission failures. The purpose of this step is to detect whether there are transmission failures in the system. If the system under test passes the test of the safety requirement test case, it means that there are no transmission failures in the system under test.

[0405] In order to ensure the safety of the ATP system, it needs to be rigorously analyzed and tested. A common method is to use the STPA (System Safety Analysis) technique to identify software safety requirements. STPA is a systematic method that aims to evaluate the safety of a system by identifying and analyzing the control structure, functions, and failure modes of the system, and to generate corresponding software safety requirements. Based on the STPA analysis, detailed safety requirements can be obtained.

[0406] Next, the identified software safety requirements can be converted into formal logic formulas, such as linear temporal logic (LTL) formulas. LTL formulas are a commonly used formal specification language that can describe the temporal properties of a system, such as safety, liveness, and completeness. By converting software safety requirements into LTL formulas, the safety requirements of the system can be expressed more clearly, and a formal basis for subsequent testing can be provided.

[0407] Once the LTL formula is obtained, the symbolic finite state machine (SFSM) model can be used to generate test cases. In this process, each LTL formula can be regarded as a test property, and then the SFSM model is used to check whether the system satisfies these properties. By symbolically modeling the state space of the system, test cases can be effectively generated to verify whether the system meets the safety requirements.

[0408] When generating test cases, the method proposed in the embodiment of the present application pioneered the equivalence classification of input expressions and output expressions with continuity and infinite domain. In the previous technology, most of them only divided the input events, and there was no effective method to divide the output events of the continuous infinite domain. The ATP system for which the method proposed in the embodiment of the present application is directed is a system with continuous input and output variables. The input variable is a series of continuous speed variables with infinite domain, for example, it can take [0,300], representing any value between 0 and 300. The output variable of the ATP system is a continuous braking variable with infinite domain. For software, the ATP system will apply corresponding braking force according to the level of overspeed, and the size of this braking force is also a digital variable in the computer, so it is very necessary to divide the output events of the ATP system. The method proposed in the embodiment of the present application divides the input and output into equivalence classes, and then integrates them together, and combines the corresponding input equivalence classes and output equivalence classes together for testing. This method not only improves the coverage of test cases, but also effectively verifies the safety and reliability of the system under various actual operating conditions.

[0409] Finally, to ensure the consistency of the system, the generated test cases need to be tested for consistency. This means testing the software safety requirements of each part of the system and ensuring that the system's behavior under different conditions meets the software safety requirements. By conducting a comprehensive consistency test on the system, potential security issues can be discovered and resolved in a timely manner, thereby improving the security and reliability of the system.

[0410] Further references Figure 6As an implementation of the methods shown in the above figures, the present application provides an embodiment of a test case generation device for an automatic train protection system based on input-output equivalence classes. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0411] The embodiment of the present application provides a test case generation device for an automatic train protection system based on input-output equivalence classes, comprising:

[0412] The analysis module 1 is configured to analyze the automatic train protection system by using the STPA technology, identify unsafe control actions and software safety requirements, convert the software safety requirements into linear temporal logic formulas based on the unsafe control actions, convert the linear temporal logic formulas into atomic propositions, and obtain an atomic proposition set;

[0413] Modeling module 2 is configured to use a symbolic finite state machine to model the automatic train protection system, obtain an automatic train protection system model, calculate all valuation functions of the automatic train protection system, map the valuation functions to a set of atomic propositions satisfied by the valuation functions, and obtain proposition abstraction;

[0414] The equivalence module 3 is configured to construct a number of mutants based on the automatic train protection system model and obtain a fault domain; given an alphabet related to the fault domain, construct a set of expressions corresponding to input events and output events in the automatic train protection system and divide them into equivalence classes; use the equivalence class to mark the transformation of the automatic train protection system model to obtain the marked automatic train protection system model, use the power set construction method to the marked automatic train protection system model and transform the determinism to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model;

[0415] Test module 4 is configured to construct the feature set and state coverage set of the automatic train protection system based on the set of expressions corresponding to the input events and output events in the automatic train protection system, construct the feature set of propositional abstraction for propositional abstraction, and generate state coverage test cases according to the feature set and state coverage set of the automatic train protection system; generate completeness test cases according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system, generate safety requirement test cases according to the state coverage set and the feature set of propositional abstraction, execute state coverage test cases, completeness test cases and safety requirement test cases on the mutants of the automatic train protection system model in the fault domain for consistency testing, if the consistency test is passed, the state coverage test cases, completeness test cases and safety requirement test cases that pass the consistency test are obtained, if not, the fault domain is reconstructed and the above two modules are repeated until the state coverage test cases, completeness test cases and safety requirement test cases pass the consistency test.

[0416] Figure 7 Schematic diagram of the hardware structure of the electronic device provided by the embodiment of the present invention. Figure 7 As shown, the electronic device of this embodiment includes: a processor 701 and a memory 702; wherein the memory 702 is used to store computer-executable instructions; the processor 701 is used to execute the computer-executable instructions stored in the memory to implement the various steps performed by the electronic device in the above embodiment. For details, please refer to the relevant description in the above method embodiment.

[0417] Optionally, the memory 702 may be independent or integrated with the processor 701 .

[0418] When the memory 702 is independently provided, the electronic device further includes a bus 703 for connecting the memory 702 and the processor 701 .

[0419] The embodiment of the present invention further provides a computer storage medium, in which computer execution instructions are stored. When the processor 701 executes the computer execution instructions, the above method is implemented.

[0420] The embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is executed by the processor 701, the above method is implemented.

[0421] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0422] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0423] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned module-composed unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0424] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor 701 to perform some steps of the methods of various embodiments of the present application.

[0425] It should be understood that the processor 701 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or the processor 701 may be any conventional processor 701, etc. The steps of the method disclosed in the invention may be directly embodied in the execution of the hardware processor 701, or may be executed by a combination of hardware and software modules in the processor 701.

[0426] The memory 702 may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk, or an optical disk.

[0427] The bus 703 may be an Industry Standard Architecture (ISA), a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 703 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus 703 in the drawings of the present application is not limited to only one bus 703 or one type of bus 703.

[0428] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0429] An exemplary storage medium is coupled to the processor 701, so that the processor 701 can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor 701. The processor 701 and the storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as ASIC). Of course, the processor 701 and the storage medium can also exist as discrete components in an electronic device or a main control device.

[0430] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0431] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A test case generation method for automatic train protection system based on input-output equivalence classes, It is characterized in that The following steps are involved: The automatic train protection system is analyzed by using STPA technology to identify unsafe control actions and software safety requirements, and the software safety requirements are converted into linear temporal logic formulas based on the unsafe control actions, and the linear temporal logic formulas are converted into atomic propositions to obtain an atomic proposition set; The automatic train protection system is modeled by using a symbolic finite state machine to obtain an automatic train protection system model, all valuation functions of the automatic train protection system are calculated, and the valuation functions are mapped to a set of atomic propositions satisfied by the valuation functions to obtain proposition abstraction; Based on the automatic train protection system model, several mutants are constructed and a fault domain is obtained; given an alphabet related to the fault domain, a set of expressions corresponding to input events and output events in the automatic train protection system is constructed and divided into equivalence classes; the transformation of the automatic train protection system model is marked by using the equivalence class to obtain a marked automatic train protection system model, and the marked automatic train protection system model is constructed by a power set construction method and converted to certainty to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model; Based on the sets of expressions corresponding to the input events and output events in the automatic train protection system, the feature set and the state coverage set of the automatic train protection system are respectively constructed, the feature set of the propositional abstraction is constructed for the propositional abstraction, and the state coverage test case is generated according to the feature set and the state coverage set of the automatic train protection system; A completeness test case is generated according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system; a safety requirement test case is generated according to the state coverage set and the feature set of the propositional abstraction; the mutant of the automatic train protection system model in the fault domain executes the state coverage test case, completeness test case and safety requirement test case to perform a consistency test; if the consistency test is passed, the state coverage test case, completeness test case and safety requirement test case that have passed the consistency test are obtained; if not, the fault domain is reconstructed and the above two steps are repeated until the state coverage test case, completeness test case and safety requirement test case pass the consistency test.

2. The method for generating test cases for an automatic train protection system based on input-output equivalence classes according to claim 1, It is characterized in that The automatic train protection system model is expressed as M=(S, s 0 , R, I, O, D, ∑ I ,∑ O ), where S represents the state space, s 0 ∈S represents the initial state, I represents the input event set, O represents the output event set, ∑ I represents an input alphabet, which is a set of input expressions, consisting of a finite number of input expressions, each of which is a first-order expression of an input event; ∑ O represents an output alphabet, wherein the output alphabet is a set of output expressions, consisting of a finite number of output expressions, each of which is a first-order expression of an output event; represents a transition relationship; D represents the union of all expression type domains; The valuation function σ represents mapping each input-output expression v' to its corresponding σ(v'), where the input-output expression v' belongs to Var, Var represents the union of the input event set I and the output event set O, and the sequence set mapped from Var to D is represented as the assignment function set D Var , the assignment function set D Var That is, it is a set of expressions corresponding to the input events and output events in the automatic train protection system, and (D Var ) * represents the set of all finite sequences from Var to D, Denote that the valuation function σ is a model of the input event φ, for each pair (φ, ψ)∈∑ I ×∑ O , ψ represents the output event, s and s' represent the two states before and after the transition, and there is at least one model Where φ∧ψ is the conjunction of the input event and the output event, and the transformation includes symbolic transformation, concrete transformation and propositional transformation; The symbol transformation τ of the automatic train protection system model M is composed of multiple consecutive (φ i ,ψ i ), namely: τ=(φ 1 / ψ 1 )...(φ n / ψ n )∈(∑ I ×∑ O ) * ; satisfy: in, Indicates existence, Indicates any, s i-1 represents the i-1th state, s i represents the i-th state, φ i represents the i-th input event, ψ i represents the i-th output event; The specific transformation κ of the automatic train protection system model M is a finite sequence of evaluation functions, namely: k = s 1 ...s n ∈(D Var ) * ; If the specific transformation κ makes the automatic train protection system model M have a sign transformation τ=(φ 1 / ψ 1 )...(φ n / ψ n )satisfy Then the specific transformation κ is called the witness of the symbolic transformation τ, using the shorthand notation Introducing an erroneous behavior into the automatic train protection system model M to construct the mutant M'; The fault domain is defined as a set of mutants in the form of a symbolic finite state machine with the following properties: Each mutant M' has at most m≥n states, wherein n represents that the automatic train protection system model M has n distinguishable states, and m represents that the mutant of the automatic train protection system model M has at most m distinguishable states; Each mutant M' refers to an expression from a set of input events I and a set of output events O; Each mutant M' uses the input alphabet ∑ I and output alphabet ∑ O ; The alphabet of the fault domain D includes the union of the input alphabet, the output alphabet and the atomic propositions of the linear temporal logic formula to be verified, that is, ∑=∑ I ∪∑ O ∪AP.

3. The method for generating test cases for an automatic train protection system based on input-output equivalence classes according to claim 2, It is characterized in that The automatic train protection system is analyzed by using STPA technology to identify unsafe control actions and software safety requirements, and the software safety requirements are converted into linear temporal logic formulas based on the unsafe control actions, and the linear temporal logic formulas are converted into atomic propositions to obtain an atomic proposition set, which specifically includes: Analyzing the automatic train protection system to obtain an accident, analyzing the accident to obtain a hazard, analyzing the hazard to obtain a system-level safety constraint, analyzing the system-level safety constraint to obtain an unsafe control action, and analyzing the unsafe control action to obtain a software safety requirement; The software safety requirements are converted into linear temporal logic formulas using the following rules: Rule 1: When situation S occurs, the automatic train protection system should always provide no control action CA i , converted into a linear temporal logic formula: LTL i =G(S→!(controlAction==CA i )), where G means in the global scope, → means it happens immediately afterwards, ! means it cannot happen, == means to judge whether two are equal, and i means the i-th linear temporal logic formula; Rule 2: Before the occurrence of situation S, the automatic train protection system should not provide control action CA too early i , converted into a linear temporal logic formula: LTL i =G(((controlAction==CA i )→S)&! ((controlAction==CA i )∪S)), & represents and, ∪ represents the union; Rule 3: After the occurrence of situation S, the automatic train protection system should not provide control action CA too late i , converted into a linear temporal logic formula: LTL i =G((S→(controlAction==CA i ))&! (S∪(controlAction==CA i ))); Rule 4: When situation S occurs, the automatic train protection system shall immediately provide control action CA i , converted into a linear temporal logic formula: LTL i =G(S→X(controlAction==CA i )), X means providing control action immediately; The linear temporal logic formula is defined by the following grammar: Among them, X represents the next state, U represents until, W represents if until, and F represents a future state. The set η of linear temporal logic formulas is defined as an atomic proposition, denoted by η∈AP, where AP represents an atomic proposition set, and is represented by a symbolic expression from Var, := represents a definition, and the semantic definition of the set η of linear temporal logic formulas is defined in the proposition transformation π∈(2 AP ) ω Above, where AP should be a superset of the atomic propositions that appear in the set η of linear temporal logic formulas; A linear temporal logic formula The set η of is a set P of propositional transformations that satisfies the following conditions: in, \ represents complement, π′ and π″ represent two different finite prefixes of proposition transformation π respectively; the set of all atomic propositions constitutes the atomic proposition set AP.

4. The method for generating test cases for an automatic train protection system based on input-output equivalence classes according to claim 2, It is characterized in that Map the valuation function to the set of atomic propositions it satisfies to obtain proposition abstraction, which specifically includes: Assume that the atomic proposition set AP is the atomic proposition set in Var, the atomic proposition set AP contains the atomic propositions satisfied by the automatic train protection system model and used to verify the linear temporal logic formula, and the proposition abstraction ω assigns the function set D Var Mapped to the set of atomic propositions it satisfies, denoted as: in, Indicates correspondence; Extend the propositional abstraction ω to the set of assignment functions D by recursive definition Var And the specific conversion κ: ω(ε)=ε and ω(σ.κ)=ω(σ).ω(κ), where σ∈D Var ,κ∈ (D Var ) * 。 5. The method for generating test cases for an automatic train protection system based on input-output equivalence classes according to claim 2, It is characterized in that The given alphabet associated with the fault domain is constructed to divide the set of expressions corresponding to the input events and output events in the automatic train protection system into equivalence classes; the equivalence classes are used to mark the transformation of the automatic train protection system model to obtain the marked automatic train protection system model, and the power set construction method is used for the marked automatic train protection system model and the certainty is converted to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model, specifically including: For any collection Take the sufficient condition set G' for partitioning the input equivalence classes: G’≡g 1 ∧g 2 …∧g n ; Among them, g i ∈Q(I) represents any input expression from the input alphabet ∑I, i = 1, 2, ..., n, and the sufficient condition means that the input expression can be counted in the equivalence class only when the input expression g occurs; For any collection Take a set of inadequate conditions for partitioning equivalence classes in, is any input expression from the complement of Q(I) ∑\Q(I), and the inadequate condition means an insignificant condition; For any collection Take the sufficient condition set E and the inadequate condition set for partitioning the output equivalence class E≡e 1 ∧e 2 …∧e n ; Among them, e i ∈Q(O) represents the output alphabet ∑ O Any output expression in is any output expression from the complement set ∑\Q(O) of Q(O); For any collection Define a new formula, which is a combination of the above input equivalence class and output equivalence class, namely the input-output equivalence class: According to the above formula, we construct a function with at least one valuation function σ∈D Var As the set of all formulas ξ of the automatic train protection system model: Let IO = {io(ξ)|ξ∈P'} denote the set of all equivalence classes; Among them, for the equivalence class io(ξ), there exists the following equivalence relation: Among them, "." represents the concatenation symbol.

6. The method for generating test cases for an automatic train protection system based on input-output equivalence classes according to claim 5, It is characterized in that Based on the sets of expressions corresponding to the input events and output events in the automatic train protection system, the feature set and the state coverage set of the automatic train protection system are respectively constructed, the feature set of the propositional abstraction is constructed for the propositional abstraction, and the state coverage test case is generated according to the feature set and the state coverage set of the automatic train protection system; Generate completeness test cases according to the feature set, state coverage set and equivalence class set of the automatic train protection system model, generate safety requirement test cases according to the state coverage set and the feature set of the propositional abstraction, execute the state coverage test cases, completeness test cases and safety requirement test cases on the mutant of the automatic train protection system model in the fault domain to perform consistency test, if the consistency test is passed, obtain the state coverage test cases, completeness test cases and safety requirement test cases after passing the consistency test, if not, reconstruct the fault domain and repeat the above two steps until the state coverage test cases, completeness test cases and safety requirement test cases pass the consistency test, specifically including: Starting from the initial state, find the feature set W of the automatic train protection system and the feature set W' of the propositional abstraction. The feature set is a set of finite input sequences that can distinguish any pair of state behaviors. In the automatic train protection system, for any state s i and j , there exists a specific transformation belonging to the feature set W of the automatic train protection system, so that after applying the specific transformation, the state s i and j Produce different output expressions; In the propositional abstraction, for any state s i and j , there exists a propositional transformation that belongs to the feature set W' of the propositional abstraction, so that after applying the propositional transformation, the state s i and j Produce different output expressions; Obtain a state coverage set consisting of symbol transitions τ, and generate a state coverage test case T through the state coverage set V and the feature set W of the automatic train protection system 1 , as shown below: T 1 =V.W; The test case T is covered by 1 Selecting a portion of representative states of all possible states in the automatic train protection system for verification and testing; Use the following formula to generate completeness test case T 2 : Where v∈V represents any transition in the state cover set V, and w∈W represents any transition in the feature set. It means to traverse all equivalence classes with a sequence length of len, where the value range of len is between 1 and m-n+1; Detect the state coverage test case T 1 And completeness test case T 2 Whether the following requirement is met: the mutant M' of the automatic train protection system model in the fault domain executes the state coverage test case T 1 And completeness test case T 2 The output obtained is to execute the state coverage test case T with the automatic train protection system model M 1 And completeness test case T 2 The output obtained is consistent; the mutant M' of the automatic train protection system model executes the state coverage test case T 1 And completeness test case T 2 The state reached after the automatic train protection system model M executes the state coverage test case T 1 And completeness test case T 2 The state of the later arrival is consistent; Generate security requirement test cases T using the following formula 3 : T 3 =V.W′; Pass the security requirement test case T 3 Check whether the propositional abstraction corresponding to the security requirement meets the software security requirement; Detect the security requirement test case T 3 Whether the following requirement is met: the mutant M' of the automatic train protection system model in the fault domain executes the safety requirement test case T 3 The output obtained later satisfies the corresponding linear temporal logic formula; Determine the state coverage test case T 1 , completeness test case T 2 and security requirement test cases T 3 Check whether all the corresponding requirements are met. If so, it is determined that the consistency test has passed. Otherwise, the fault domain is rebuilt and the above steps are repeated until the state coverage test case, completeness test case and safety requirement test case pass the consistency test, and the state coverage test case, completeness test case and safety requirement test case that have passed the consistency test are obtained.

7. A test case generation device for an automatic train protection system based on input-output equivalence classes, It is characterized in that include: An analysis module is configured to analyze the automatic train protection system using the STPA technology, identify unsafe control actions and software safety requirements, convert the software safety requirements into linear temporal logic formulas based on the unsafe control actions, convert the linear temporal logic formulas into atomic propositions, and obtain an atomic proposition set; A modeling module is configured to use a symbolic finite state machine to model the automatic train protection system to obtain an automatic train protection system model, calculate all valuation functions of the automatic train protection system, map the valuation functions to a set of atomic propositions satisfied by the valuation functions, and obtain proposition abstraction; An equivalence module is configured to construct a number of mutants based on the automatic train protection system model and obtain a fault domain; given an alphabet related to the fault domain, construct a set of expressions corresponding to input events and output events in the automatic train protection system and divide them into equivalence classes; use the equivalence class to mark the transformation of the automatic train protection system model to obtain the marked automatic train protection system model, use the power set construction method to the marked automatic train protection system model and convert the determinism to obtain an observable automatic train protection system model and an equivalence class set of the observable automatic train protection system model; A test module is configured to construct a feature set and a state coverage set of the automatic train protection system based on a set of expressions corresponding to input events and output events in the automatic train protection system, respectively, construct the feature set of the propositional abstraction for the propositional abstraction, and generate a state coverage test case according to the feature set and the state coverage set of the automatic train protection system; A completeness test case is generated according to the feature set, state coverage set and equivalence class set of the observable automatic train protection system model of the automatic train protection system; a safety requirement test case is generated according to the state coverage set and the feature set of the propositional abstraction; the mutant of the automatic train protection system model in the fault domain executes the state coverage test case, completeness test case and safety requirement test case to perform a consistency test; if the consistency test is passed, the state coverage test case, completeness test case and safety requirement test case that have passed the consistency test are obtained; if not, the fault domain is reconstructed and the above two modules are repeated until the state coverage test case, completeness test case and safety requirement test case pass the consistency test.

8. An electronic device, include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.