CN111737888B - Function logic dynamic execution method - Google Patents

Function logic dynamic execution method Download PDF

Info

Publication number
CN111737888B
CN111737888B CN202010861043.4A CN202010861043A CN111737888B CN 111737888 B CN111737888 B CN 111737888B CN 202010861043 A CN202010861043 A CN 202010861043A CN 111737888 B CN111737888 B CN 111737888B
Authority
CN
China
Prior art keywords
model
conversion
execution
code
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010861043.4A
Other languages
Chinese (zh)
Other versions
CN111737888A (en
Inventor
余洋
陈超
余翔
许梦宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Guorui Xinwei Software Co ltd
Original Assignee
Nanjing Guorui Xinwei Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Guorui Xinwei Software Co ltd filed Critical Nanjing Guorui Xinwei Software Co ltd
Priority to CN202010861043.4A priority Critical patent/CN111737888B/en
Publication of CN111737888A publication Critical patent/CN111737888A/en
Application granted granted Critical
Publication of CN111737888B publication Critical patent/CN111737888B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/12Geometric CAD characterised by design entry means specially adapted for CAD, e.g. graphical user interfaces [GUI] specially adapted for CAD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Human Computer Interaction (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Architecture (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to a dynamic execution method of functional logic, which belongs to the technical field of intelligent design and comprises the following steps: the method comprises the steps of MSM icon accuracy pre-checking, conversion instruction sending, state highlighting and ES image displaying, resource competition under multi-time conditions, C code execution, Matlab code editing and debugging and code exporting simulation execution. The invention embeds Matlab simulation programs of each part of the system into the system architecture model, and dynamically executes the Matlab simulation programs based on the mode state machine of the system architecture model, thereby ensuring the consistency of the system simulation content and the system architecture design content, enabling the system scheme design and the simulation to be tightly integrated, and effectively improving the system design quality.

Description

Function logic dynamic execution method
Technical Field
The invention relates to a dynamic execution method of functional logic, belonging to the technical field of intelligent design.
Background
In the conventional structural function design or product design, effect/operation verification is performed after the design is completed, and when the verification fails to achieve an expected effect, a program needs to be changed. The process has 2 obvious disadvantages, 1 is that the period of some products or structural designs is very long, when the design is always blindly designed to the end, the verification cannot be carried out, the whole design may be made again, time is wasted, 2 is that the verification is carried out after the design is finished, when the expected effect cannot be obtained, an error link cannot be visually given, a designer needs to carry out self-checking, the workload is very large, the labor hour is wasted easily, and the design progress is seriously influenced. Moreover, if the error occurs in the early stage of design, the content of corresponding adjustment required in the later stage is many, and many ineffective works are added.
Disclosure of Invention
In order to solve the above technical problems, the present invention provides a method for dynamically executing functional logic, in which Matlab simulation programs of each part of a system are embedded in a system architecture model, and a mode state machine based on the system architecture model is used for dynamically executing, so as to ensure the consistency of system simulation content and system architecture design content, and to enable the system scheme design and simulation to be tightly integrated, thereby effectively improving the system design quality, and the specific technical scheme is as follows:
a method for dynamically executing functional logic comprises the following steps
Step 1: checking validity of the MSM graph: if the result is invalid, ending, and if the result is valid, entering the step 2;
step 2: creating an ES graph;
and step 3: dividing and displaying the EditPlay screen;
and 4, step 4: creating and displaying a model, and executing a sending instruction page;
and 5: a command to-be-sent state;
step 6: whether the time countdown instruction triggers: if not, entering step 7, if yes, entering step 10;
and 7: sending an instruction;
and 8: judging whether the command is a valid command: if the instruction is invalid, entering step 9, and if the instruction is valid, entering step 10;
and step 9: recording the instruction to a history record, judging whether the execution quits, if so, ending, and if not, entering the step 5;
step 10: recording the Exit in the source state mode, the converted effect, the entry of the target state mode, the execution activity and the operation activity function of the instruction into an ES graph;
step 11: executing codes in the function, calling a C or Matlab simulation program, and executing the step 9;
step 12: and (5) judging whether the command is automatically sent or not, if so, entering the step 5, and if not, not needing processing.
Further, the step 1: the MSM graph validity is verified specifically as follows: and (3) confirming that each MSM graph or a certain mode/state has one and only one initialization node in an iterative algorithm mode, and each mode/state has at most one conversion without a trigger.
Further, the step 3 specifically includes: during the execution of the model, an ES for showing the execution process is created]Screenario picture screenariodiagrcorrelated, screenable screenariodialogrambyarchitecture (blockaarchitecture ba), and by the split screen technique eclipse utility, build doubleditor (ieditor part,MPart rightMPart, borolan horizontal) creates two canvases in the original display container of the client, loads the MSM graph into the left canvases in the form of left-right layout, loads the ES graph into the right canvases to achieve the effect of synchronous display, and each time the result of instruction execution, the new elements are inserted into the current ES]Scenario, and refreshdiagrampart is refreshed in real time.refresh(ModelContext.selection) Shown in the ES diagram.
Further, the step 4 displays that the model is executed specifically as follows: in the model execution page, the conversion execution dialog. senddistributionmessage () in different objects is selected, if the conversion is effective, the trigger in the conversion, the elements in the entry, execution activity, exit and execution activity/function in the influence and mode state are inserted into the Scenario Diagrampprocesses. execute2 (List) in the ES diagram<DDiagramElement>involvedModelelements, bootean isoEffect), if an invalid translation is sent, only the translation is inserted into the ES graph, and the values of specific swap entry, swap entry element and attribute can be specified, and the translation instruction sent each time will be recorded into ModelContext in the translation history.opeartionList.add(getOperationRecord(DEdge edge))。
Further, the step 4 specifically includes: in the process of executing the model, an execution path is designated by sending a related instruction, a related record in the current state in a model diagram of the mode state machine can highlight Diagram model. initStyle (), the path of the model conversion execution is abstracted into a linked list data structure, a node in the current execution state is highlighted in red, a pointer pointing to the node in the current state and a previous node are highlighted in orange, and when the model continues to execute downwards, the next node is entered, and the highlighting forms of the current node, the previous pointer and the node and other historical pointers and nodes are changed in an iterative algorithm mode.
Further, the step 6 specifically includes: when the triggering condition of the model conversion is a time event, through is timed.sleep(sleepTime) mode, when reaching the specified time, triggering diagrammodelWhen the competition model event is executed, the competition model event is executed by multithreading ExecutorService Executors = Executors.newCachedThreadPool() In the mode of the method, a plurality of timings are started simultaneously, the user firstly triggers to execute a certain conversion, and other event threads forcibly terminate the thread.
Further, the executing of the C code in step 11 specifically includes: when the code in the function is C code, a C code file in a FreemarkerUtit.processTemplateContent (Map <, > root) standard format is generated through a freemarker template, and the related C code is compiled and executed through GCC to generate an exe executable file, a data interaction interface is packaged based on RMI and JNI, input data is read from an incoming function exchange through ModelContextCaller.
Further, the Matlab code editing and debugging in step 11 specifically includes: the model in the SMEX has code-level expression capacity, a function in the model can be embedded into a C or Matlab code, if the Matlab code is edited, a function model object EditWithMatlab Action.run can be right-keyed, the code of the function model object can be edited by a customized Matlab editor, a prompt shortcut key can be used in the editing process, the data of a local file can be synchronized into the function model in real time by monitoring the file availability monitor start () of the state of the local file, a breakpoint is added in the Matlab code, and then the breakpoint debugging is carried out in the executing process.
Further, the instruction sent in step 7 is specifically: code export simulation execution: after a model is selected, traversing the keywords in the model to elements of each level to obtain information of the model elements, storing the traversed model into a Matlab working space through structured storage (struct) for calling in a standby state, and if ports exist in the model reading process, assigning default values of 0 to all the ports;
after the model is successfully read, automatically assigning values to related plug-ins (for logic components, function exchange, exchange items, exchange item elements, including attributes, the component list and the current state are attribute names, and values need to be displayed for attribute values), wherein the assignment statement is to assign a default value to a corresponding control if the next-level model element is not included in the selected model element at the upper level;
when a user selects a certain model element, the lower-level control needs to be assigned, and the assignment statement is that if the upper-level selected model element does not contain the lower-level model element, the corresponding control is assigned with a default value;
meanwhile, as the model and the port need to be read and assigned at any time in the operation process, the model variable and the port variable need to be processed globally,
after a user clicks a sending button, the state machine starts to run, the state machine judges whether to run continuously or not through a global variable smex _ running, the current state is stable, namely the state machine has no dead loop, no running delay conversion exists, and the output-to-output conversion of the current state is not empty, smex _ running is set to be 1, the current state and the output-to-output conversion are updated and judged through while structure loop, the smex _ running is set to be 0 when the state continuous running stops, id matching judgment is carried out according to the sequence of automatic conversion, function exchange and delay conversion in the continuous running process, as the running of the state machine relates to the delay conversion and needs to reflect the current state in real time, the delay part is carried out through tic and toc function collocation with a while structure, the state conversion is judged through the matching of state id and converted sid and tic, and is displayed in real time through drawnnow, and as codes derived from a logic function need to run, and allows the user to perform breakpoint operation, so it is necessary to determine whether to mount the code in the state, to operate the code through the eval function,
and in the process of executing the state machine, assigning values through the global port list, and transmitting numerical values of the ports at the two ends of the function conversion.
The invention has the beneficial effects that:
the invention provides a design simulation environment, a designer can simulate a design structure at any time in the design process, timely verify whether the design is reasonable and can be normally executed, timely find errors, verify the reliability of the design in stages for multiple times in the design process, and avoid working hour waste caused by incapability of running after the design is finished.
Drawings
Figure 1 is a block diagram of the system of the present invention,
FIG. 2 defines the interfaces of the mode state machines of the subsystems,
figure 3 defines an interface of a system architecture scenario,
the current state highlighted interface in the mode state machine of figure 4,
figure 5 selects an external stimulus panel interface diagram,
figure 6 is an interface for selecting the path of the code compiler in the preferences,
figure 7 is an interface for selecting inline code types within the functionality of the system architecture model,
figure 8 embeds an emulated code interface for a corresponding code type in the functionality of the system architecture model,
figure 9 is a current state highlighting the interface,
figure 10 Matlab global simulation results interface,
figure 11 is an interface for selecting the path of the code compiler in the preferences,
figure 12 is an interface for selecting inline code types within the functionality of the system architecture model,
figure 13 is a reminder interface with the input-output port name repeatedly popped up,
figure 14 is a diagram of a mode state machine implementing a button interface,
figure 15 is a functional input port interface that,
figure 16 is a functional output port interface that,
figure 17 interface for the input and output parameter values passing through the construction of Matlab expressions,
figure 18 is a "Guard" code selection interface,
figure 19 is a "Guard" code expression interface,
figure 20 is an interface in which the mode state machine is displayed in a window alongside the ES diagram,
the interface of figure 21 executes a window that,
FIG. 22 ES element insert operation.
Detailed Description
The invention will now be described in further detail with reference to the accompanying drawings and specific implementation procedures.
As shown in fig. 1, the overall process of the present invention is: step 1: checking validity of the MSM graph: if the result is invalid, ending, and if the result is valid, entering the step 2;
step 2: creating an ES graph;
and step 3: dividing and displaying the EditPlay screen;
and 4, step 4: creating and displaying a model, and executing a sending instruction page;
and 5: a command to-be-sent state;
step 6: whether the time countdown instruction triggers: if not, entering step 7, if yes, entering step 10;
and 7: sending an instruction;
and 8: judging whether the command is a valid command: if the instruction is invalid, entering step 9, and if the instruction is valid, entering step 10;
and step 9: recording the instruction to a history record, judging whether the execution quits, if so, ending, and if not, entering the step 5;
step 10: recording the Exit in the source state mode, the converted effect, the entry of the target state mode, the execution activity and the operation activity function of the instruction into an ES graph;
step 11: executing codes in the function, calling a C or Matlab simulation program, and executing the step 9;
step 12: and (5) judging whether the command is automatically sent or not, if so, entering the step 5, and if not, not needing processing.
Through the above process, the partition is verified, and the verification result is divided into a valid command and an invalid command, which are respectively sent or stored as a record.
In the method of the invention, the specific operation process is as follows:
1. MSM icon accuracy pre-verification
The standardization of MSM graph drawing is a precondition for dynamic execution of a model, all MSM graphs to be verified are required to be ensured to be in accordance with the standard, Scenario DiagramRefe. execute () confirms that each MSM graph or each mode/state has one initialization node at most, and each mode/state has one conversion without a trigger.
2. Sending of conversion instruction
In the model execution page, the conversion execution dialog. senddistributionmessage () in different objects can be selected, if the conversion is effective, the trigger in the conversion, the elements in the entry, execution activity, exit and execution activity/function in the influence and mode state are inserted into the script language execution 2 (List) in the ES diagram<DDiagramElement>involvedModelelements, boilean isEffect), if an invalid translation is sent, only the translation is inserted into the ES graph, and the values of specific swap terms, swap term elements, attributes can be specified. Each sent translation instruction will be recorded into the ModelContext in the translation history.opeartionList.add(getOperationRecord(DEdge edge))。
3. State highlighting and ES graph display
In the process of model execution, an execution path can be designated by sending a related instruction, a Diagram model is highlighted in a current state related record in a model diagram of a mode state machine, the execution path of the model conversion is abstracted into a linked list data structure, a node in the current execution state is highlighted in red, a pointer pointing to the node in the current state and a previous node are highlighted in orange, and when the model continues to execute downwards, the next node is entered, the highlighting forms of the current node, the previous pointer and the node and other historical pointers and nodes are changed in an iterative algorithm mode.
Meanwhile, in the model execution process, an [ ES ] for showing the execution process is created]Screenario picture screenariodiagrcorrelated byarchitecture (blockaarchitecture ba) and by split screen technology eclipse utilityitorPart,MPart rightMPart,boolean horizontal ) Two canvases are created in an original display container of a client, an MSM graph is loaded into the left canvases in a left-right layout mode, an ES graph is loaded into the right canvases, the effect of synchronous display is achieved, and each time an instruction execution result, a newly added element can be inserted into the current ES]And (2) a scene graph, and is displayed in an ES graph by real-time refresh RefreshDiagramagction.
4. Resource contention under multi-time conditions
When the triggering condition of the model conversion is a time event, a diagrammodel execution event is triggered when a specified time is reached by a timing thread (sleepTime) mode, when a plurality of time event competition model events are executed, a multithreading ExecutorService execution device = executors.newcachedredthool () mode is used, a plurality of timings are started simultaneously, a person triggers firstly, namely, executes a certain conversion firstly, and other event threads terminate the thread.interrupt () forcibly, so that the next model execution state is entered;
5. execution of C code
When the code in the function is C code, generating a C code file in a FreemarkerUtit.processTemplateContent (Map <, > root) standard format through a freemarker template, and compiling and executing related C code through GCC to generate an exe executable file, packaging a data interaction interface based on RMI and JNI, reading input data from an incoming function exchange through ModelContextCaller. getInput (.), setting output data in the function exchange through ModelContextCaller.setOutput (.), and calling an SMEX-Designer reversely to generate output data so as to realize interactive operation of an SMEX operation environment and C environment data;
6. matlab code editing and debugging
The model in the SMEX has code-level expression capacity, a function in the model can be embedded into a C or Matlab code, if the Matlab code is edited, a function model object EditWithMatlab Action.run can be right-keyed to edit the code of the function model object by a customized Matlab editor, and a prompt shortcut key can be used in the editing process to enable data of a local file to be synchronized into the function model in real time by monitoring the state of the local file in real time, a breakpoint can be added in the Matlab code, and breakpoint debugging can be performed in the re-execution process.
7. Code export emulation execution
After the model is selected, traversing the keywords in the model to the elements of each level to obtain the relevant information (such as name, ID, port, element type, code and the like) of the model elements, and storing the traversed model into matlab working space through structured storage (struct) for calling during running in a state, as shown in the following figure:
Figure 678051DEST_PATH_IMAGE001
Figure 391929DEST_PATH_IMAGE002
if ports exist in the model reading process, all the ports need to be assigned with default values of 0;
and after the model is successfully read, automatically assigning values to the related plug-in (for the logic component, function exchange, exchange items, exchange item elements, including attributes, the component list and the current state are attribute names, and for the attribute values, values need to be displayed), wherein the assignment statement is to assign a default value to the corresponding control if the next-level model element is not included in the selected model element at the upper level.
When a user selects a certain model element, the lower level control needs to be assigned, and the assignment rule is the same as the above.
Meanwhile, in the operation process, the model needs to be read at any time, and the port needs to be read and assigned, so that the model variable and the port variable need to be processed globally.
After a user clicks a sending button, the state machine starts to run, the state machine judges whether to run continuously or not through a global variable smex _ running, the current state is stable (namely the state machine has no dead loop, no running delay conversion exists, and the output-to-output conversion of the current state is not empty), the smex _ running is set to be 1, the current state and the output-to-output conversion are updated and judged through while structure loop, the smex _ running is set to be 0 when the state continuous running stops, the id matching judgment is carried out according to the sequence of automatic conversion, function exchange and delay conversion in the continuous running process, as the running of the state machine relates to the delay conversion and needs to reflect the current state in real time, the delay part is carried out through tic and toc function collocation with a while structure, the state conversion is judged through the matching of state id and the sid of the conversion, and the tic matching is displayed in real time through drawnnow, and as codes derived from a logic function need to run, and the user is allowed to perform breakpoint operation, so that whether the code is mounted in the state needs to be judged, and the code is operated through the eval function.
In the process of executing the state machine, it is necessary to perform value transfer on the two end ports of function conversion, and this function is assigned through a global port list, as shown in the following diagram:
Figure 437246DEST_PATH_IMAGE003
secondly, the specific operation process of the patent on the software interface is given by combining the software interface of the patent:
the method comprises the following steps: constructing a system architecture design model: editing a system architecture design model in the SMEX-Designer, wherein the specific editing process is as follows:
firstly, defining the components of the system: an LAB picture is newly built, and,
secondly, defining the functions born by each subsystem and the interface relation among the functions,
thirdly, defining the mode state machines of the subsystems, including the conversion relation among the mode states and the calling sequence of the functions and the interfaces in the mode states and in the conversion process, as shown in fig. 1:
fourthly, defining a system architecture scenario, that is, under a specific scenario, which functions and interfaces should be called by each subsystem at different times, as shown in fig. 2:
step two: dynamic execution of the system architectural design model itself: the system architecture design model can be dynamically executed in the SMEX-Designer, and the specific execution process is as follows:
first, dynamically executing a mode state machine in a system architecture design model, and highlighting a current state, as shown in fig. 3:
in a second step, the current state is prompted to make state transitions according to rules defined in the model by sending an external stimulus to the mode state machine, the external stimulus panel is shown in figure 4,
thirdly, in the process of current state conversion, different functions and interfaces are called according to a certain sequence, and all the contents are automatically recorded in the form of a scene graph, as shown in figure 2,
and fourthly, comparing the manually defined system architecture scene with the automatically generated scene when the model is dynamically executed, and verifying the system level design.
Step three: the system architecture design model can select a corresponding compiler to dynamically execute according to the embedded code type of the functional function: the system architecture design model embedded with Matlab simulation codes or c + + simulation codes can be dynamically executed in the SMEX-Designer, and the specific execution process is as follows:
in a first step, the path of the code compiler is selected in the preferences, as shown in figure 5,
second, the type of embedded code is selected among the functions of the system architecture model, as shown in fig. 6:
thirdly, embedding simulation codes of corresponding code types of the functions in the functions of the system architecture model, as shown in fig. 7:
step four, dynamically executing a mode state machine in the system architecture design model, and highlighting the current state, as shown in fig. 8:
fifthly, in the process of current state conversion, different functions and interfaces are called according to a certain sequence, and all the contents are automatically recorded in the form of a scene graph, as shown in figure 2,
sixthly, when the system function is called in the dynamic execution process of the system architecture model, the Matlab simulation code embedded in the function is synchronously executed;
seventhly, checking the Matlab overall simulation result, judging whether the Matlab overall simulation result meets expectations or not, and further verifying the system level design, as shown in FIG. 9:
and eighth step, if the function selects other code types, calling the corresponding compiler to execute the function,
step four: code is edited using a code compiler and synchronized with SMEX:
first, a path of a code compiler is selected in a preference, as shown in FIG. 10
In a second step, the type of embedded code is selected among the functions of the system architecture model, as shown in figure 11,
third, right key function, selecting edit code,
and fourthly, calling a corresponding code editor to edit the code.
Thirdly, constraint verification and prompt information of the interface operation of the patent are given below
And (3) input and output port name repeatability verification: in the Matlab code execution functional module, the input and output ports cannot be duplicated, the Diagram Diagram with the right key selects 'model dynamic execution port name verification', and if duplication exists, information shown in FIG. 12 is popped up.
Fourthly, the interface description of the patent is given below
1. getInput obtains attribute value according to function exchange name, exchange item element name and attribute name
Figure 363613DEST_PATH_IMAGE004
2. setting attribute value according to function exchange name, exchange item element name and attribute name by setOutput
Figure 709144DEST_PATH_IMAGE005
3. According to the function name, the function exchange name, the function is searched, and the internal code of the function is executed
Figure 62765DEST_PATH_IMAGE006
Fifthly, the technical implementation process of the patent is given by combining the software interface of the patent
1. The mode state machine executes the button, as shown in figure 13,
2. executing class entry
Figure 126536DEST_PATH_IMAGE008
Figure 856595DEST_PATH_IMAGE010
3. And (3) dynamically executing the model:
1) opening the canvas for compliance checking:
isLogicalDiagram(currentDiagram)||isSystemDiagram(currentDiagram)||isPhysicalDiagram(currentDiagram)||isOADiagram(currentDiagram)
judging whether the canvas is a designated view, if so, continuing execution, and otherwise, reporting an error and not executing;
2) verifying a mode state machine
new ModelValidate(regions,blockArchitecture).validate()
Check class ModelValidate
Checking rules to check the dynamic execution detailed design document;
3) embedding functional model into Matlab model code and realizing synchronization
When the monitoring of the file is opened or closed every time an item is opened or closed, the MatlabSessionsListener class realizes the Stub interface, and the function of monitoring the opening or closing of the Session of the item can be realized
Figure 56632DEST_PATH_IMAGE011
Figure 584084DEST_PATH_IMAGE012
Figure 603992DEST_PATH_IMAGE013
The following code sets the polling time to 1s, snoops the m suffix file
// Polling Interval 1 second
Figure 872163DEST_PATH_IMAGE014
4) Input output processing mechanism-Matlab execution script for building function embedded function
When the system function has the function exchange of input and output, the input and output should be processed in the implementation code of the function. The following is set forth in terms of both input and output.
Input processing
For incoming function swapping, data should be available through the incoming function port. For example, if a system function has inbound function exchange 1, the function input port connected to it is FIP 1, as shown in fig. 14,
output processing
For outgoing function switching, data should be passed through the outgoing functional port assignments. For example, if a system function has functional exchange 1, the function output port connected to it is FOP 1, as shown in fig. 15:
the input-output parameter values are passed through the construction of Matlab expressions,
Figure 926706DEST_PATH_IMAGE015
the flow is shown in fig. 16.
5) "Guard" code expression
In "Guard" of the schema state transition, it should be possible to directly refer to the attribute value of the object to which the schema state machine belongs or the function exchange of input and output, as a variable to use, as shown in fig. 17 and 18,
in this example, "ttt" is the value of the attribute that depends on the "system" object. In this example, a function swap (e.g., functional exchange _ 1) may be directly referred to and used as a variable.
During the dynamic execution of the functional logic: when the model starts to execute, all attribute values contained in the related objects and variables corresponding to all function exchanges are initialized, and the life cycle of the model runs through the whole execution process;
code initialization process:
the method comprises the steps that a component is transmitted into Matlab as a Matlab structure variable, the Diagrnodeon object execution initialization work is carried out in the model execution process, when a certain function is called, the real code is correspondingly compiled and executed, and the debugging of points can be interrupted in a Matlab code editor during execution; in the mode state conversion of the mode state machine, when the corresponding Trigger is received, Guard is also verified, that is, the conversion can only occur when the Guard expression is judged to be true.
6) The mode/state will be highlighted
The initStyle () method of the DiagramModel is called.
7) Creating [ BUILD ] perform verification
Creating a system capability "[ BUILD ] to perform verification" (if the system capability already exists, no repeated creation is needed), creating a scene "Scenario" under the capability, creating an ES graph "[ ES ] Scenario" under the scene, inserting all objects in a corresponding hierarchy into the ES graph, marking the current mode/state of each object on an object life line, and finally displaying a mode state machine in a window side by side with the ES graph, as shown in fig. 19:
calling the screenariodiagrcmdate tool class creates an ES map of Capella.
8) Screen split display
Figure DEST_PATH_IMAGE016
9) Interface execution window
The pop-up model executes a control window for modifying the input variables of the object and transmitting an instruction for mode state transition, as shown in fig. 20,
10) ES element insert operation (as shown in FIG. 21):
the core class is NodeProcess
// insertion status/mode
Figure DEST_PATH_IMAGE017
// insert function node
Figure DEST_PATH_IMAGE018
In light of the foregoing description of the preferred embodiment of the present invention, many modifications and variations will be apparent to those skilled in the art without departing from the spirit and scope of the invention. The technical scope of the present invention is not limited to the content of the specification, and must be determined according to the scope of the claims.

Claims (8)

1. A method for dynamically executing functional logic, comprising: the method comprises the following steps:
step 1: checking validity of the MSM graph: if the result is invalid, ending the process, and if the result is valid, entering the step 2;
step 2: creating an ES graph;
and step 3: dividing and displaying the EditPlay screen;
and 4, step 4: creating and displaying an instruction sending human-computer interaction interface;
and 5: a command to-be-sent state;
step 6: judging whether a time countdown instruction is triggered: if not, entering step 7, if yes, entering step 10;
and 7: sending an instruction, specifically, code export simulation execution: after a model is selected, traversing the keywords in the model for each level element to obtain the information of the model element, storing the traversed model into a Matlab working space through structured storage, and calling the model in a standby state operation mode, wherein if ports exist in the model reading process, all the ports need to be assigned with default values of 0;
after the model is successfully read, automatically assigning values to the related plug-ins, wherein the assignment statement is to assign default values to the corresponding controls if the selected model elements of the upper level do not contain the model elements of the lower level;
when a user selects a certain model element, the lower-level control needs to be assigned, and the assignment statement is that if the upper-level selected model element does not contain the lower-level model element, the corresponding control is assigned with a default value;
meanwhile, as the model and the port need to be read and assigned at any time in the operation process, the model variable and the port variable need to be processed globally,
after a user clicks a sending button, the state machine starts to run, the state machine judges whether the state machine continuously runs or not through a global variable, the current state is stable, namely the state machine does not have dead circulation, the delay conversion in running does not exist, the output-to-output conversion of the current state is not empty, the global variable is set to be 1, the current state and the output-to-output conversion are updated and judged through a while structure cycle, the global variable is set to be 0 when the state continuous running stops, the id matching judgment is carried out according to the sequence of automatic conversion, function exchange and delay conversion in the continuous running process, because the state machine running relates to the delay conversion and needs to reflect the current state in real time, the delay part is carried out through tic and toc functions matched with the while structure, the state conversion is judged through id and sid of conversion, tic matching, and simultaneously displayed through drawnnow in real time, and because codes derived from the logic functions need to run, and the user is allowed to run the breakpoint, so that whether the state machine carries the code or not needs to be judged, the code is run through the eval function,
in the process of executing the state machine, assigning values through the global port list, and transmitting numerical values of the ports at two ends of function conversion;
and 8: judging whether the command is a valid command: if the instruction is invalid, entering step 9, and if the instruction is valid, entering step 10;
and step 9: recording the instruction to a history record, judging whether the execution quits, if so, ending, and if not, entering the step 5;
step 10: recording the Exit in the source state mode, the converted effect, the entry of the target state mode, the execution activity and the operation activity function of the instruction into an ES graph;
step 11: executing codes in the function, calling C or Matlab codes according to the embedded code type, and executing the step 9 and the step 12;
step 12: and (5) judging whether the command is automatically sent or not, if so, entering the step 5, and if not, not needing processing.
2. The method of claim 1, wherein: the step 1: the MSM graph validity is verified specifically as follows: and (3) confirming that each MSM graph or a certain mode/state has one and only one initialization node in an iterative algorithm mode, and each mode/state has at most one conversion without a trigger.
3. The method of claim 1, wherein: the step 3 specifically comprises the following steps: in the execution process of the model, an ES diagram used for showing the execution process is created, two canvases are created in an original showing container of the client through a split screen technology, the MSM diagram is loaded into the left canvases in a left-right layout mode, the ES diagram is loaded into the right canvases, the synchronous showing effect is achieved, and each instruction execution result is that newly added elements are inserted into the current ES diagram and are shown in the ES diagram in a real-time refreshing mode.
4. The method of claim 1, wherein: the step 4 specifically comprises the following steps: in the model execution page, the conversion in different objects is selected, if the conversion is effective, the trigger in the conversion, the elements in the entry, the execution activity, the exit and the operation activity/function in the influence and mode state are inserted into the ES diagram, if the conversion which is ineffective is sent, the conversion is only inserted into the ES diagram, and the specific exchange item, the exchange item element and the value of the attribute can be specified, and the conversion instruction sent each time is recorded into the conversion history.
5. The method of claim 4, wherein: the step 4 sending the model execution page specifically comprises the following steps: in the model execution process, a relevant instruction is sent to designate an execution path, relevant records in the current state in a model diagram of a mode state machine can be highlighted, the path of model conversion execution is abstracted into a linked list data structure, nodes in the current execution state are highlighted in red, a pointer pointing to the node in the current state and a previous node are highlighted in orange, when the model continues to be executed downwards, the next node is entered, and the highlighting forms of the current node, the previous pointer and the node and other historical pointers and nodes are changed in an iterative algorithm mode.
6. The method of claim 1, wherein: the step 6 specifically comprises the following steps: when the triggering condition of the model conversion is a time event, the model execution event is triggered when the specified time is reached by a timing mode, and when a plurality of time events compete for the execution of the model event, a plurality of timings are started simultaneously by a multithreading mode, so that the user firstly triggers to execute a certain conversion, and other event threads are forcibly terminated to enter the next model execution state.
7. The method of claim 1, wherein: the execution of the calling C code in step 11 specifically includes: when the code in the 'function' is C code, C code file with standard format is generated through freemarker template, the relevant C code is compiled and executed through GCC to generate exe executable file, data interaction interface is packaged based on RMI and JNI, input data is read from input-to-function exchange, output data in function exchange is set, reverse callback generates output data through SMEX-Designer, and interaction operation of SMEX operation environment and C environment data is realized.
8. The method of claim 1, wherein: the invoking of the Matlab code in step 11 is specifically: the model in the SMEX has code-level expression capacity, a function in the model is embedded into a Matlab code, if the Matlab code is edited, a function model object is rightkey, the code of the function model object is edited by a customized Matlab editor, a prompt shortcut key is used in the editing process, the data of a local file can be synchronized into the function model in real time by monitoring the state of the local file in real time, a breakpoint is added in the Matlab code, and breakpoint debugging is carried out in the executing process.
CN202010861043.4A 2020-08-25 2020-08-25 Function logic dynamic execution method Active CN111737888B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010861043.4A CN111737888B (en) 2020-08-25 2020-08-25 Function logic dynamic execution method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010861043.4A CN111737888B (en) 2020-08-25 2020-08-25 Function logic dynamic execution method

Publications (2)

Publication Number Publication Date
CN111737888A CN111737888A (en) 2020-10-02
CN111737888B true CN111737888B (en) 2020-12-04

Family

ID=72658838

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010861043.4A Active CN111737888B (en) 2020-08-25 2020-08-25 Function logic dynamic execution method

Country Status (1)

Country Link
CN (1) CN111737888B (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488568B (en) * 2013-09-30 2016-03-02 南京航空航天大学 A kind of embedded software credible attribute modeling and verification method
CN106125573B (en) * 2016-06-22 2019-05-10 陕西宝成航空仪表有限责任公司 Aircraft nose wheel Servo Control box design method based on graphical model
CN111209203B (en) * 2020-01-06 2022-03-08 上海丰蕾信息科技有限公司 Model verification method based on source code

Also Published As

Publication number Publication date
CN111737888A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
US10235265B2 (en) Sequentially constructive model of computation
EP0634032B1 (en) Global process control information system and method
Baldassari et al. PROTOB: An object oriented methodology for developing discrete event dynamic systems
Jiang et al. From stateflow simulation to verified implementation: A verification approach and a real-time train controller design
Apvrille et al. A new UML profile for real-time system formal design and validation
Pang et al. Automatic model generation of IEC 61499 function block using net condition/event systems
CN111737888B (en) Function logic dynamic execution method
Olsen Jr et al. Research directions for user interface software tools
Palanque et al. Towards an integrated proposal for Interactive Systems design based on TLIM and ICO
Grabe et al. Credo methodology: Modeling and analyzing a peer-to-peer system in credo
Borshchev et al. Systems modeling, simulation and analysis using COVERS active objects
MacDonald et al. Pattern-based object-oriented parallel programming
Goldman Distributed algorithm simulation using input/output automata
Pomberger et al. The Role of Prototyping in Software Development.
Dotti et al. Verifying object-based graph grammars: An assume-guarantee approach
Martins Integrating real-time UML models with schedulability analysis
Puchol et al. Integrated design tools for hard real-time systems
Lee et al. UML-based modeling and multi-threaded simulation for hybrid dynamic systems
Rüegg et al. Interactive transformations for visual models.
Budde et al. Complex reactive control with simple synchronous models
Sciammarella et al. Modelling analysis and implementation of distributed probabilistic timed actors using theatre
Klehmet et al. TIPPtool: timed processes and performability evaluation
Auguston et al. Synthesis of monitors for real-time analysis of reactive systems
Liu et al. A Petri net-based distributed debugger
Walch et al. Visualization and performance analysis of formally specified communication protocols

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information

Inventor after: Yu Yang

Inventor after: Lv Chengyue

Inventor after: Chen Chao

Inventor after: Yu Xiang

Inventor after: Xu Mengyu

Inventor before: Yu Yang

Inventor before: Chen Chao

Inventor before: Yu Xiang

Inventor before: Xu Mengyu

CB03 Change of inventor or designer information