CN117472382A - Simulator capable of realizing interactive grammar control and simulation method - Google Patents

Simulator capable of realizing interactive grammar control and simulation method Download PDF

Info

Publication number
CN117472382A
CN117472382A CN202311195485.XA CN202311195485A CN117472382A CN 117472382 A CN117472382 A CN 117472382A CN 202311195485 A CN202311195485 A CN 202311195485A CN 117472382 A CN117472382 A CN 117472382A
Authority
CN
China
Prior art keywords
grammar
signal
name
string
instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311195485.XA
Other languages
Chinese (zh)
Inventor
公维学
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
FAW Group Corp
Original Assignee
FAW Group Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by FAW Group Corp filed Critical FAW Group Corp
Priority to CN202311195485.XA priority Critical patent/CN117472382A/en
Publication of CN117472382A publication Critical patent/CN117472382A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a simulator capable of interactively controlling grammar and a simulation method, wherein the simulator comprises the following components: the grammar interface is used for reading the script and checking; the grammar parser is used for parsing the grammar which is qualified in detection; the generator is used for carrying out signal generation instructions item by item on the analysis result generated by the grammar analyzer; the execution module is used for executing the instruction generated by the generator; after the execution module executes the instruction generated by the generator, the intermediate representation of the obtained signal source is formed by { T, S, V }; the synchronizer is used for translating the intermediate representation and converting the intermediate representation of the signal source into a real signal. By adopting standardized definition of grammar, the user of the protocol can be enabled to 'look like accessing the complete communication protocol' in the early stage of project development or in the stage of low maturity of the communication protocol, so that the communication state of the whole vehicle is simulated, and further, the condition of developing a controller software prototype in the early stage of the project is provided.

Description

Simulator capable of realizing interactive grammar control and simulation method
Technical Field
One or more embodiments of the present disclosure relate to the field of automotive technology, and in particular, to an interactive grammar-controllable simulator and a simulation method.
Background
In the field of automobile research and development and production, a plurality of controllers are mounted on commercial vehicles, passenger vehicles or non-road special vehicles; the controllers are connected into a complete network structure.
On the network, each node completes the cooperation between the controllers by sending and receiving data. The controller receives data generated by the external sensor and the controller, and performs recognition, filtration and processing calculation on the data to finally obtain a result which is significant to the local area and use the result.
The amount of external data, the complexity of the architecture, depends on the protocol details agreed between the controllers.
These protocols are not usually at the same time and can be fully described in the early stages of the development of the project. With the penetration of the project, the protocol is continuously modified and optimized, and for a protocol user (a data receiver), the protocol adaptation is required to be continuously carried out; and the project cannot use the whole protocol to develop the internal data processing in the early stage.
The protocol details required by different controllers are different due to different vehicle types. There is no universal solution to solve the problem of the toggle on the protocol. The next development can only be driven by inter-team coordination with a large number of verbal contracts.
Disclosure of Invention
In view of this, it is an object of one or more embodiments of the present disclosure to provide an interactive grammar-controllable simulator and simulation method for facilitating the development of software by a developer.
In a first aspect, an interactive grammar controllable simulator is provided, the interactive grammar controllable simulator comprising:
the grammar interface is used for reading the script and carrying out grammar checking, path detection and recursion detection on the read script;
the grammar parser is used for parsing the grammar qualified by the grammar interface;
the generator is used for carrying out signal generation instructions on the analysis results generated by the grammar analyzer item by item;
the execution module is used for executing the instruction generated by the generator; after the execution module executes the instruction generated by the generator, the intermediate representation of the signal source is obtained, and the intermediate representation of the signal source is formed by { T, S, V }; wherein T is a tick, S is a signal ID, and V is a corresponding signal value;
and the synchronizer is used for translating the intermediate representation according to the set simulation environment and converting the intermediate representation into a real signal.
In the above technical solution, by adopting standardized definition of grammar, the user of the protocol can "look like accessing the complete communication protocol" in the early stage of the project development or in the stage of the low maturity of the communication protocol, thereby simulating the communication state of the whole vehicle and further having the condition of developing the software prototype of the controller in the early stage of the project.
In a specific embodiment, the syntax parser is specifically configured to perform redundancy removal on the syntax checked by the syntax interface; splitting the instruction statement according to the token, and determining the instruction category according to the type indicator; element splitting of a single instruction statement is carried out according to the instruction category, and splitting parameters are recorded; and performing type checking, value checking, number checking and semantic filtering on all split data, and finally obtaining a naive instruction sequence after grammar and semantic processing are completed.
In a specific embodiment, the system further comprises a global context storage module for organizing the lookup table data structure.
In a specific embodiment, the system further comprises a GUI module for receiving user input and interaction and converting the user input into interactive command form for transmission to the grammar interface.
In a specific embodiment, the device further comprises an adapter through which the synchronizer transmits the converted real signal to an external signal receiver.
In a second aspect, there is provided a simulation method of interactive grammar control, the simulation method comprising the steps of:
reading the script through a grammar interface and carrying out grammar checking, path detection and recursion detection on the read script;
analyzing the grammar qualified by the grammar interface through a grammar analyzer;
carrying out signal generation instructions item by item on the analysis result generated by the grammar analyzer through a generator;
executing the instruction generated by the generator through an execution module; after the instruction generated by the generator is executed, the intermediate representation of the signal source is obtained, and the intermediate representation of the signal source is formed by { T, S, V }; wherein T is a tick, S is a signal ID, and V is a corresponding signal value;
and translating the intermediate representation according to the set simulation environment through a synchronizer, and converting the intermediate representation into a real signal.
In the above technical solution, by adopting standardized definition of grammar, the user of the protocol can "look like accessing the complete communication protocol" in the early stage of the project development or in the stage of the low maturity of the communication protocol, thereby simulating the communication state of the whole vehicle and further having the condition of developing the software prototype of the controller in the early stage of the project.
In a specific implementation manner, the grammar interface analyzes the grammar qualified by detection; the method specifically comprises the following steps:
redundancy removal is performed on the checked grammar;
splitting the instruction statement according to the token, and determining the instruction category according to the type indicator;
element splitting of a single instruction statement is carried out according to the instruction category, and splitting parameters are recorded;
and performing type checking, value checking, number checking and semantic filtering on all split data, and finally obtaining a naive instruction sequence after grammar and semantic processing are completed.
In a specific embodiment, the method further comprises:
and receiving user input and interaction, converting the user input into an interactive command form, and transmitting the interactive command form to a grammar interface for script reading.
In a specific embodiment, the method further comprises:
the real signal is transmitted to an external signal receiver through a converter.
In a specific embodiment, the grammar interface receives grammars satisfying:
the grammar use environment has context characteristics, and commands can be separated by semicolon; the grammar includes at least: assignment: the following is carried out { name-string, value-string }, wherein name-string is a signal name and value-string is a signal value;
cycle: @ { name-string, interval }; wherein, name-string is the signal name, interval is the trigger period (0 represents only once sent);
and (3) transmitting: { name-string }; wherein name-string is the signal name;
pause: 11 { name-string, period }; wherein, name-string is the signal name, period is the pause time;
stopping: 1 $ { name-string };
a file: # { file-path }; wherein, the file-path is a file path;
flow: cmd1; cmd2; cmd3; … ….
In a third aspect, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the interactive grammar controlled simulation method as described in any one of the preceding claims when the program is executed by the processor.
In a fourth aspect, a non-transitory computer readable storage medium is provided, the non-transitory computer readable storage medium storing computer instructions for causing the computer to perform any of the interactive grammar controlled simulation methods described above.
In a fifth aspect, there is also provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any one of the possible designs of the third aspect and the third aspect of the present application.
In addition, the technical effects of any of the possible design manners in the third aspect to the fifth aspect may be referred to as effects of different design manners in the method section, and are not described herein.
Drawings
For a clearer description of one or more embodiments of the present description or of the solutions of the prior art, the drawings that are necessary for the description of the embodiments or of the prior art will be briefly described, it being apparent that the drawings in the description below are only one or more embodiments of the present description, from which other drawings can be obtained, without inventive effort, for a person skilled in the art.
FIG. 1 is a schematic diagram of a usage scenario of a simulator according to an embodiment of the present application;
FIG. 2 is a schematic diagram of another usage scenario of a simulator provided in an embodiment of the present application;
FIG. 3 is a block diagram of a simulator according to an embodiment of the present application;
FIG. 4 is a flow chart of a simulation method provided in an embodiment of the present application;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of promoting an understanding of the principles and advantages of the disclosure, reference will now be made to the embodiments illustrated in the drawings and specific language will be used to describe the same.
It is noted that unless otherwise defined, technical or scientific terms used in one or more embodiments of the present disclosure should be taken in a general sense as understood by one of ordinary skill in the art to which the present disclosure pertains. The use of the terms "first," "second," and the like in one or more embodiments of the present description does not denote any order, quantity, or importance, but rather the terms "first," "second," and the like are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that elements or items preceding the word are included in the element or item listed after the word and equivalents thereof, but does not exclude other elements or items. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", etc. are used merely to indicate relative positional relationships, which may also be changed when the absolute position of the object to be described is changed.
The technical carriers involved in payment in the embodiments of the present disclosure may include, for example, near field communication (Near Field Communication, NFC), WIFI, 3G/4G/5G, POS machine card swiping technology, two-dimensional code scanning technology, bar code scanning technology, bluetooth, infrared, short message (Short Message Service, SMS), multimedia message (Multimedia Message Service, MMS), and the like.
In order to facilitate understanding of the interactive grammar control simulator provided in the embodiments of the present application, an application scenario thereof is first described. The simulator capable of interactively controlling grammar is applied to the field of automobiles and is used for assisting a user in developing software. The amount of external data, the complexity of the architecture, depends on the protocol details agreed between the controllers. These protocols are not usually at the same time and can be fully described in the early stages of the development of the project. With the penetration of the project, the protocol is continuously modified and optimized, and for a protocol user (a data receiver), the protocol adaptation is required to be continuously carried out; and the project cannot use the whole protocol to develop the internal data processing in the early stage. Therefore, the embodiment of the application provides an interactive grammar control simulator, which is used for enabling a user of a protocol to 'look like accessing a complete communication protocol' in the initial stage of project development or in the stage of low maturity of the communication protocol, so that the communication state of the whole vehicle is simulated, and further, the simulator has the condition of developing a controller software prototype in the initial stage of the project. For ease of understanding, the following detailed description is provided in connection with the accompanying drawings.
In order to facilitate understanding of the simulator provided in the embodiments of the present application, first, a scenario in which the simulator is applied will be described. Referring to fig. 1, a simulator provided in an embodiment of the present application includes a kernel for performing signal processing and simulation. The simulator may also include a GUI module for receiving user input and interaction when information interaction is performed. Of course, other modules may be employed in addition to the GUI module. When in signal connection with the outside, connection can be made through an Adapter (Adapter) to communicate with the external signal receiver. Thus completing the input and output of the signal.
When the interaction is specifically performed, firstly, the GUI module receives user input and interaction, converts the user input and interaction into an interactive command form and transmits the interactive command form to a grammar interface (CMD-IF) in a Core. A synchronizer (synchronizer) in the Core communicates with the external signal receiver by calling an Adapter.
Referring to fig. 2, when internal information transmission is employed, all the constituent parts are in the same program. ModuleA is a data simulation module, and ModuleB and ModuleC are data real recipients. The ModuleA transmits the control command conforming to the grammar to the kernel one by one or once through a grammar interface (CMD-IF). The kernel checks the control command to simulate and sends the simulation result to the internal communication agent COMM. The COMM forwards the data to ModuleB and ModuleC, and the whole process of program simulation is completed.
In the case of signal simulation, the simulation is mainly performed by Core. Referring to fig. 3, fig. 3 is a block diagram illustrating a structure of an interactive grammar controllable simulator according to an embodiment of the present application, where the interactive grammar controllable simulator includes a grammar interface (COM-IF), a grammar Parser (Parser), a Generator (Generator), an execution module (workbench), and a synchronizer (synchronizer).
The grammar interface is used for reading the script and carrying out grammar checking, path detection and recursion detection on the read script; the grammar parser is used for parsing the grammar qualified by the grammar interface detection; the generator is used for carrying out signal generation instructions item by item on the analysis result generated by the grammar analyzer; the execution module is used for executing the instruction generated by the generator; after the execution module executes the instruction generated by the generator, the intermediate representation of the signal source is obtained, and the intermediate representation of the signal source is formed by { T, S, V }; wherein T is a tick, S is a signal ID, and V is a corresponding signal value; and the synchronizer is used for translating the intermediate representation and converting the intermediate representation of the signal source into a real signal. The construction and application of the various parts will now be described in detail with reference to the specific drawings.
CMD-IF is a grammar interface responsible for grammar checking, prompting, recursion detection, path detection, script reading. For preliminary processing of the script. When information interaction is carried out, external information is transmitted to the grammar interface, and preliminary processing is carried out through the grammar interface. As an alternative, the simulator further comprises a GUI module for receiving user input and interactions and for converting the user input into interactive command form for delivery to the grammar interface. I.e., the GUI accepts user input and interactions, converts them into interactive command form, and passes them to the CMD-IF in the kernel. The design of CMD-IF determines that the interactive grammar can be flexibly changed so as to be suitable for different use scenes.
Wherein the syntax of CMD-IF reception satisfies the following definition: the grammar use environment has context features, i.e. the environment variables remain valid after the end of a single statement. The grammar does not support recursive use cases to avoid loop referencing. And the commands may be separated by a semicolon.
By way of example, the syntax referred to in the embodiments of the present application may include the following examples: assignment: the following is carried out { name-string, value-string }, where name-string is the signal name and value-string is the signal value. The assignment is used to set a certain analog signal value.
Cycle: @ { name-string, interval }; wherein name-string is the signal name and interval is the trigger period (0 represents only one transmission). The period is used for setting a certain analog signal generation period.
And (3) transmitting: { name-string }. name-string is the signal name. The transmission is used to start transmitting a certain analog signal.
Pause: 11 { name-string, period }; wherein name-string is the signal name and period is the pause duration. The pause is used to pause the transmission of an analog signal and resume after a certain time.
Stopping: 1 $ { name-string }; stop to stop sending some analog signal.
A file: # { file-path }; wherein the file-path is a file path. The file is used to open a script file and execute commands in the script.
Flow: cmd1; cmd2; cmd3; … …. For executing the command stream in the write order at the same time.
When inputting the grammar to the COM-IF interface, the user or other device will input according to the above-set grammar format.
Parser is a grammar Parser responsible for parsing the legal grammar filtered by CMD-IF in stripes. In the case of specific parsing, different parsing such as semantic parsing and grammar parsing may be included. Based on the definition of grammar above, the definition of grammar is based on the design concept of command input. Therefore, conventional processes performed in conventional syntax analysis, semantic tree generation, and the like, as performed by procedural object-oriented compilers, are not applicable in the present design. In view of the requirement of the script file expanding function, the grammar checking is performed by using a mode matching mode based on the grammar design form of the design in the embodiment of the application.
When semantic analysis is carried out, the grammar analyzer is particularly used for removing redundancy of grammar checked by the grammar interface; splitting the instruction statement according to the token, and determining the instruction category according to the type indicator; element splitting of a single instruction statement is carried out according to the instruction category, and splitting parameters are recorded; and performing type checking, value checking, number checking and semantic filtering on all split data, and finally obtaining a naive instruction sequence after grammar and semantic processing are completed. The specific functions described above can be divided into the following steps:
step0: initializing analysis data;
redundant text removal, preliminary grammar checking (initializing data to single text strings).
Step1: splitting a compound CMD instruction;
splitting instruction sentences according to the token, and determining instruction categories according to the type indicators;
step2: splitting instruction parameters;
splitting elements of a single instruction statement according to the instruction category, and recording and splitting parameters;
step3: loading a script file;
if the single instruction is a script loading instruction, the script content is additionally loaded and inserted into the original instruction sequence, and the process is the same as the steps 0, step1 and Step 2. Before insertion, the operations such as parameter splitting and inspection are performed in the same manner.
Step4: rechecking parameters;
and carrying out post-processing on all split data, and carrying out type checking, value checking, number checking and semantic filtering. And finally obtaining a naive instruction sequence after grammar and semantic processing are completed, and performing intermediate simple conversion on the work task to be distributed.
The Generator is used as a Generator and is used for carrying out signal generation instructions on analysis results generated by the grammar analyzer item by item; that is, the Generator generates "signal generation instructions" item by item from the semantic analysis result obtained from the Parser.
The number of the workbench as an execution module can be 1 or more, and the workbench is responsible for executing signal generation instructions provided by the Generator. The specific implementation mode is as follows: after the execution module executes the instruction generated by the generator, the middle of the obtained signal source represents IR, and the middle of the signal source represents IR which is formed by { T, S, V }; where T is the tick (minimum time precision of tick, e.g. 5 ms.), S is the signal ID, and V is the corresponding signal value. In the embodiment of the application, IR is a signal representation that converts a signal generation instruction formed after parsing into a unified format. And is composed of triples { T, S, V }; so that different inputs can be converted into a unified signal for input to the synchronizer for simulation.
Synchroniuser acts as a synchronizer to provide a simulated environment. When in use, the intermediate representation can be translated according to the set simulation environment, the intermediate representation is converted into a real signal (changed into a real signal form in the actual engineering), and the synchronization problem when multiple signals occur can be solved.
As can be seen from the above description, in the embodiment of the present application, by adopting standardized definition of grammar, a user of a protocol can "look like accessing a complete communication protocol" in an early stage of development of a project or in a stage of low maturity of the communication protocol, so as to simulate a communication state of a whole vehicle, and further provide conditions for initial development of a controller software prototype of the project.
In addition, the simulator also comprises a global context storage module LUT used for organizing the lookup table data structure. When each module operates, the global context storage module is used for storing the operation data of each module so as to judge whether the operation logic of each module is normal or not according to the stored data.
In order to facilitate understanding of the simulator provided by the embodiment of the application, the embodiment of the application also provides a simulation method.
Referring to fig. 4, the present application further provides an interactive grammar control simulation method, which includes the following steps:
step 001: reading the script through a grammar interface and carrying out grammar checking, path detection and recursion detection on the read script;
specifically, user input and interaction are received first, and the user input is converted into an interactive command form and transmitted to a grammar interface for script reading. Such as through a GUI module or other interaction module.
In addition, the received grammar satisfies the following definition:
the grammar use environment has context features, i.e. the environment variables remain valid after the end of a single statement. The grammar does not support recursive use cases to avoid loop referencing. And the commands may be separated by a semicolon.
By way of example, the syntax referred to in the embodiments of the present application may include the following examples: assignment: the following is carried out { name-string, value-string }, where name-string is the signal name and value-string is the signal value. The assignment is used to set a certain analog signal value.
Cycle: @ { name-string, interval }; wherein name-string is the signal name and interval is the trigger period (0 represents only one transmission). The period is used for setting a certain analog signal generation period.
And (3) transmitting: { name-string }. name-string is the signal name. The transmission is used to start transmitting a certain analog signal.
Pause: 11 { name-string, period }; wherein name-string is the signal name and period is the pause duration. The pause is used to pause the transmission of an analog signal and resume after a certain time.
Stopping: 1 $ { name-string }; stop to stop sending some analog signal.
A file: # { file-path }; wherein the file-path is a file path. The file is used to open a script file and execute commands in the script.
Flow: cmd1; cmd2; cmd3; … …. For executing the command stream in the write order at the same time.
Step 002: analyzing the grammar qualified by the grammar interface through a grammar analyzer;
specifically, based on the definition of grammar above, the definition of grammar is based on the design concept of command input. Therefore, conventional processes performed in conventional syntax analysis, semantic tree generation, and the like, as performed by procedural object-oriented compilers, are not applicable in the present design. In view of the requirement of the script file expanding function, the grammar checking is performed by using a mode matching mode based on the grammar design form of the design in the embodiment of the application.
When semantic analysis is carried out, the grammar analyzer is particularly used for removing redundancy of grammar checked by the grammar interface; splitting the instruction statement according to the token, and determining the instruction category according to the type indicator; element splitting of a single instruction statement is carried out according to the instruction category, and splitting parameters are recorded; and performing type checking, value checking, number checking and semantic filtering on all split data, and finally obtaining a naive instruction sequence after grammar and semantic processing are completed. The specific functions described above can be divided into the following steps:
step0: initializing analysis data;
redundant text removal, preliminary grammar checking (initializing data to single text strings).
Step1: splitting a compound CMD instruction;
splitting instruction sentences according to the token, and determining instruction categories according to the type indicators;
step2: splitting instruction parameters;
splitting elements of a single instruction statement according to the instruction category, and recording and splitting parameters;
step3: loading a script file;
if the single instruction is a script loading instruction, the script content is additionally loaded and inserted into the original instruction sequence, and the process is the same as the steps 0, step1 and Step 2. Before insertion, the operations such as parameter splitting and inspection are performed in the same manner.
Step4: rechecking parameters;
and carrying out post-processing on all split data, and carrying out type checking, value checking, number checking and semantic filtering. And finally obtaining a naive instruction sequence after grammar and semantic processing are completed, and performing intermediate simple conversion on the work task to be distributed.
Step 003: carrying out signal generation instructions item by item on the analysis result generated by the grammar analyzer through a generator;
step 004: executing the instruction generated by the generator through an execution module; after the instruction generated by the generator is executed, the intermediate representation of the signal source is obtained, and the intermediate representation of the signal source is formed by { T, S, V }; wherein T is a tick, S is a signal ID, and V is a corresponding signal value;
specifically, after the execution module executes the instruction generated by the generator, the intermediate representation IR of the obtained signal source is formed by { T, S, V }; where T is the tick (minimum time precision of tick, e.g. 5 ms.), S is the signal ID, and V is the corresponding signal value. In the embodiment of the application, IR is a signal representation that converts a signal generation instruction formed after parsing into a unified format. And is composed of triples { T, S, V }; so that different inputs can be converted into a unified signal for input to the synchronizer for simulation.
Step 005: and translating the intermediate representation according to the set simulation environment through a synchronizer, and converting the intermediate representation into a real signal.
Specifically, the Synchronizer acts as a synchronizer to provide a simulation environment. When in use, the intermediate representation can be translated according to the set simulation environment, the intermediate representation is converted into a real signal (changed into a real signal form in the actual engineering), and the synchronization problem when multiple signals occur can be solved.
After conversion to a true signal, the true signal may be sent to an external signal recipient through a converter. To output the simulation result.
In the above technical solution, by adopting standardized definition of grammar, the user of the protocol can "look like accessing the complete communication protocol" in the early stage of the project development or in the stage of the low maturity of the communication protocol, thereby simulating the communication state of the whole vehicle and further having the condition of developing the software prototype of the controller in the early stage of the project.
As can be seen from the above description, the embodiment of the present application develops a software with interactive grammar parsing capability, and further performs standardized definition on grammar, so that a user of the protocol can "look like accessing a complete communication protocol" at an early stage of development of the project or at a stage of low maturity of the communication protocol, thereby simulating a communication state of the whole vehicle, and further having a condition of initially developing a software prototype of the controller of the project. The embodiment of the application can solve the paradox that each controller faces the 'that when the controller is not connected with other controllers to send data, the controller cannot process the data and generate new data to send to the other controllers' through the interactive grammar scheme. Based on this scheme, it can be extended to include: independent automation programs, independent GUI programs, embedded automation modules, embedded interaction modules, and the like. The application scenes are more, and the platform is crossed.
The embodiment of the application provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, and is characterized in that the processor executes the program to realize the interactive grammar control simulation method according to any one of the above.
Embodiments of the present application provide a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform any of the interactive grammar controlled simulation methods described above.
Embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any one of the possible designs of the third aspect and the third aspect of the present application.
It should be noted that the methods of one or more embodiments of the present description may be performed by a single device, such as a computer or server. The method of the embodiment can also be applied to a distributed scene, and is completed by mutually matching a plurality of devices. In the case of such a distributed scenario, one of the devices may perform only one or more steps of the methods of one or more embodiments of the present description, the devices interacting with each other to accomplish the methods.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, the functions of each module may be implemented in one or more pieces of software and/or hardware when implementing one or more embodiments of the present description.
The device of the foregoing embodiment is configured to implement the corresponding method in the foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Fig. 5 shows a more specific hardware architecture of an electronic device according to this embodiment, where the device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 implement communication connections therebetween within the device via a bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), static storage device, dynamic storage device, or the like. Memory 1020 may store an operating system and other application programs, and when the embodiments of the present disclosure are implemented in software or firmware, the associated program code is stored in memory 1020 and executed by processor 1010.
The input/output interface 1030 is used to connect with an input/output module for inputting and outputting information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
Communication interface 1040 is used to connect communication modules (not shown) to enable communication interactions of the present device with other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
Bus 1050 includes a path for transferring information between components of the device (e.g., processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).
It should be noted that although the above-described device only shows processor 1010, memory 1020, input/output interface 1030, communication interface 1040, and bus 1050, in an implementation, the device may include other components necessary to achieve proper operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The computer readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be used to implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device.
Those of ordinary skill in the art will appreciate that: the discussion of any of the embodiments above is merely exemplary and is not intended to suggest that the scope of the disclosure, including the claims, is limited to these examples; combinations of features of the above embodiments or in different embodiments are also possible within the spirit of the present disclosure, steps may be implemented in any order, and there are many other variations of the different aspects of one or more embodiments described above which are not provided in detail for the sake of brevity.
Additionally, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures, in order to simplify the illustration and discussion, and so as not to obscure one or more embodiments of the present description. Furthermore, the apparatus may be shown in block diagram form in order to avoid obscuring the one or more embodiments of the present description, and also in view of the fact that specifics with respect to implementation of such block diagram apparatus are highly dependent upon the platform within which the one or more embodiments of the present description are to be implemented (i.e., such specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the disclosure, it should be apparent to one skilled in the art that one or more embodiments of the disclosure can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative in nature and not as restrictive.
While the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of those embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
The present disclosure is intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Any omissions, modifications, equivalents, improvements, and the like, which are within the spirit and principles of the one or more embodiments of the disclosure, are therefore intended to be included within the scope of the disclosure.

Claims (10)

1. An interactive grammar-controllable simulator, comprising:
the grammar interface is used for reading the script and carrying out grammar checking, path detection and recursion detection on the read script;
the grammar parser is used for parsing the grammar qualified by the grammar interface;
the generator is used for carrying out signal generation instructions on the analysis results generated by the grammar analyzer item by item;
the execution module is used for executing the instruction generated by the generator; after the execution module executes the instruction generated by the generator, the intermediate representation of the signal source is obtained, and the intermediate representation of the signal source is formed by { T, S, V }; wherein T is a tick, S is a signal ID, and V is a corresponding signal value;
and the synchronizer is used for translating the intermediate representation according to the set simulation environment and converting the intermediate representation into a real signal.
2. The interactive grammar controllable simulator of claim 1, wherein the grammar parser is operable in particular for redundancy removal of the grammar interface check; splitting the instruction statement according to the token, and determining the instruction category according to the type indicator; element splitting of a single instruction statement is carried out according to the instruction category, and splitting parameters are recorded; and performing type checking, value checking, number checking and semantic filtering on all split data, and finally obtaining a naive instruction sequence after grammar and semantic processing are completed.
3. The interactive grammar controllable simulator of claim 2, further comprising a global context storage module to organize the look-up table data structure.
4. The interactive grammar controlled simulator of claim 3, further comprising a GUI module for receiving user input and interactions and converting the user input into interactive command form for delivery to the grammar interface.
5. The interactive grammar controllable simulator of claim 4, further comprising an adapter through which the synchronizer transmits the converted real signal to an external signal recipient.
6. A method of interactive grammar control simulation comprising the steps of:
reading the script through a grammar interface and carrying out grammar checking, path detection and recursion detection on the read script;
analyzing the grammar qualified by the grammar interface through a grammar analyzer;
carrying out signal generation instructions item by item on the analysis result generated by the grammar analyzer through a generator;
executing the instruction generated by the generator through an execution module; after the instruction generated by the generator is executed, the intermediate representation of the signal source is obtained, and the intermediate representation of the signal source is formed by { T, S, V }; wherein T is a tick, S is a signal ID, and V is a corresponding signal value;
and translating the intermediate representation according to the set simulation environment through a synchronizer, and converting the intermediate representation into a real signal.
7. The interactive grammar control simulation method according to claim 6, wherein the grammar parser parses the grammar qualified by the grammar interface; the method specifically comprises the following steps:
redundancy removal is performed on the checked grammar;
splitting the instruction statement according to the token, and determining the instruction category according to the type indicator;
element splitting of a single instruction statement is carried out according to the instruction category, and splitting parameters are recorded;
and performing type checking, value checking, number checking and semantic filtering on all split data, and finally obtaining a naive instruction sequence after grammar and semantic processing are completed.
8. The interactive grammar controlled simulation method of claim 6, further comprising:
and receiving user input and interaction, converting the user input into an interactive command form, and transmitting the interactive command form to a grammar interface for script reading.
9. The interactive grammar controlled simulation method of claim 6, further comprising:
the real signal is transmitted to an external signal receiver through a converter.
10. The interactive grammar-controllable simulation method of claim 6, wherein the grammar interface receives grammars satisfying:
the grammar use environment has context characteristics, and commands can be separated by semicolon; the grammar includes at least: assignment: the following is carried out { name-string, value-string }, wherein name-string is a signal name and value-string is a signal value;
cycle: @ { name-string, interval }; wherein, name-string is the signal name, interval is the trigger period (0 represents only once sent);
and (3) transmitting: { name-string }; wherein name-string is the signal name;
pause: 11 { name-string, period }; wherein, name-string is the signal name, period is the pause time;
stopping: 1 $ { name-string };
a file: # { file-path }; wherein, the file-path is a file path;
flow: cmd1; cmd2; cmd3; … ….
CN202311195485.XA 2023-09-15 2023-09-15 Simulator capable of realizing interactive grammar control and simulation method Pending CN117472382A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311195485.XA CN117472382A (en) 2023-09-15 2023-09-15 Simulator capable of realizing interactive grammar control and simulation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311195485.XA CN117472382A (en) 2023-09-15 2023-09-15 Simulator capable of realizing interactive grammar control and simulation method

Publications (1)

Publication Number Publication Date
CN117472382A true CN117472382A (en) 2024-01-30

Family

ID=89632001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311195485.XA Pending CN117472382A (en) 2023-09-15 2023-09-15 Simulator capable of realizing interactive grammar control and simulation method

Country Status (1)

Country Link
CN (1) CN117472382A (en)

Similar Documents

Publication Publication Date Title
US20230367559A1 (en) Development environment for real-time dataflow programming language
CN108717393B (en) Application program testing method and mobile terminal
CN110704594A (en) Task type dialogue interaction processing method and device based on artificial intelligence
CN107832059B (en) Code static analysis method and device based on Makefile
US20230004775A1 (en) Method for implementing a hardware accelerator of a neural network
CN109255209A (en) A kind of data processing method, device, equipment and storage medium
CN113900958A (en) Test case script generation method, system, medium and electronic device
CN114780100B (en) Compiling method, electronic device and storage medium
CN115757100A (en) Automated testing framework facing user interface, method, equipment and medium
CN114707444B (en) Method for compiling verification system, electronic device and storage medium
CN112181417B (en) Front-end research and development configuration device and method
CN114327185A (en) Vehicle screen control method and device, medium and electronic equipment
CN112860587A (en) UI automatic test method and device
CN107092474B (en) Program development method, ETL processing method and device
CN117472382A (en) Simulator capable of realizing interactive grammar control and simulation method
CN110968339B (en) Method and device for front-end building tool and electronic equipment
KR101487192B1 (en) Server apparatus and method for providing service related to autosar
CN112506871B (en) Automated task management and log management method, system, electronic device and medium
CN114912397A (en) Programmable logic device, prototype verification system, method, apparatus, and storage medium
CN115437913A (en) Software in-loop testing method, device, system and storage medium
CN113220345A (en) Instruction block processing method, device, equipment and storage medium
CN115314413B (en) CAN signal testing method and device
CN113553040B (en) Registration realization method, device, equipment and medium for visible and spoken identification function
CN111857664B (en) Application development method, device, equipment and storage medium
CN117421251B (en) Method and system for debugging user interface of embedded terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination