A kind of system and information flow visual simulation system and method based on model
Technical field
The invention belongs to software development and emulation field, being specifically related to a kind of system and information flow based on model canDepending on changing analogue system and method.
Background technology
Along with the develop rapidly of computer technology and improving constantly of mankind's demand, the function of software becomes increasingly complex, rightThe safety and stability of software requires also increasingly stringent. And the competition in market and different clients' individual demand make softwareConstruction cycle constantly shorten, this has proposed strict demand to development& testing work of software. Software development mainly wraps at presentDraw together demand analysis, software development and software test three phases. Need to write a large amount of source codes at software development phase, butBe, traditional manual coding mode not only wastes time and energy, and the reliability of code can not ensure, developer need to be by a large amount ofEnergy put into uninteresting code write in instead of in the frame design and logical design of software, this greatly reduces softwareDevelopment efficiency.
At present, the approach that improves development phase efficiency is to use code recycling technology and code Auto,The use threshold of existing code reuse and Auto is higher, and layman is difficult to operation and needs in useA large amount of human configuration and intervention. In the system testing stage, present case is that nearly all System Integration Test is all blackBox test (only know that whether Output rusults is correct, the operation road of code is but known nothing in footpath), cannot in test processDirectly obtain the operating path of program, also cannot directly obtain some information in program operation process. So, once occur surveyingTest result does not meet situation with desired value, will spend definite wrong position of a large amount of time, and this has increased reparation greatlyThe time that software defect is required. Meanwhile, whether due to traditional test, can only to measure result correct, ties for operating path mistakeFruit but by chance correct situation cannot distinguish, hide some dangers for to the correctness of software. In addition software development environment and test wrapper,The separation in border has also increased the time cost of software development.
But, in conjunction with the design philosophy of soft project, to consider from the angle of model, it is excellent that it is directly perceived, reusable that model has etc.Point. In field of software development, system model is made up of different component model parts, and it is a certain that component model refers to that some can completeThe set of the code of Elementary Function, by different component models being spliced, combines, arranges relevant parameter, just can be long-pending as takingWood equally builds a system model. Afterwards, under orderly standard operation, system model can be translated into and can moveSimulation code.
A system model need to comprise different component models, and a component model also can be contained in difference simultaneouslySystem model in, this provides condition for multiplexing (being the recycling of code) of member. Performance using model as systemMode, not only directly perceived, but also can be used as the carrier that system when operation shows information, this is conducive in System Integration TestLocation mistake, in addition, the system based on model can make developer being mainly dropped in as possible in the design of system andNot during uninteresting code is write, improved the quality of the software of designing.
Summary of the invention
For the advantage of the deficiency existing in existing software development process and model tormulation method, the present invention aims to provideSystem based on model and information flow visual simulation system and a method, will be conducive to improve software development and softwareThe efficiency of test job and quality.
For realizing above-mentioned technical purpose, reach above-mentioned technique effect, the present invention is achieved through the following technical solutions:
System based on model and an information flow visual simulation system, comprise component model library module, system modelBuild module, information display module, simulation code generation module, code compilation module and operation control module.
Described component model library module is built module with described system model and is connected, and described system model is built module and connectedBe connected respectively described simulation code generation module and described generation with described information display module and described simulation code generation moduleCode collector connect, described code compilation module is connected with described information display module, described operation control module respectively withDescribed system model is built module, described information display module, described simulation code generation module and described code compilation moduleConnect.
Described component model library module, it act as:
1) all component model and the information of each component model in management component model library;
2) interpolation of management component model, amendment and deletion;
3) ensure correctness and the security of all component models, for described system model is built module and described simulation code is rawBecome the work of module to provide support.
Described system model is built module, and it act as:
1) component model in described component model storehouse is built into system model, in this process, described system model is builtModule allly operates relevant information to building system model by recording, for the work of described simulation code generation module providesHold;
2) according to recorded information, the correctness of system model is checked, ensure carrying out smoothly of code generation work;
3) described system model build module generate system model be artificial intelligence show carrier.
Described information display module, it act as:
Together with building module with described system model for user provides a visual Modeling interface, described information display moduleAll information in modeling and simulation process are presented on this Modeling interface by certain rule, watch and enter for userThe corresponding operation of row.
Described Modeling interface possesses following three functions:
1) show the dynamic process of modeling and the structure of system model, its concrete manifestation form is:
All component models in described component model storehouse will be presented at the form of tree type in described Modeling interface for userSelect; Utilize described system model to build module while building system model user, on described Modeling interface, can show and be draggedThe relevant parameters of system model, component model and system model after component model, the assembling moving;
2) show the flow process of artificial intelligence on system model, its concrete manifestation form is:
On described Modeling interface, can demonstrate the system model of having put up, that reads according to described information display module is imitativeTrue data, can carry out real-time demonstration on the system model of building, and reaches to allow the real-time demonstration of operating path of simulation codeEffect on system model;
3) help described system model to build the correctness of module check system model, its concrete manifestation form is: user is passableFrom described Modeling interface, whether the structure of observing system model is correct intuitively, whether has isolated component model, parameterWhether correctly configure.
Described simulation code generation module, it act as:
1) utilize the code of component model, build at described system model that module records with build system model operationUnder the guide of relevant information, this system model is translated as to the system code that can move and (uses the actual C code of component modelThe position that replaces counterpart member model in system model, forms mutual incoherent code sheet, then by opening up between component modelThe parameter configuration of flutterring structural information, component model and system model is reflected in generated code sheet, by these mutually notRelevant code sheet connects into an entirety, the system code that can move);
2) by the system code that just generated of scanning, obtain between component model connected in system code (be code sheet itBetween) position of function call and relevant variable information, and (some have the complementary of specific use to insert probe in these positionsCode) generate simulation code;
3) test case of user's input is inserted in generated simulation code, generates final simulation code.
Described code compilation module, it act as: simulation code compiling, chain that described simulation code generation module is generatedBe connected into and can move simulated program.
Described operation control module, it act as:
1) dispatch other modules, coordinate the work between modules;
2) control the operation of simulated program and stop;
3) obtain the information that also storage emulation program middle probe is dished out and control artificial intelligence;
4) undertaken alternately by Modeling interface and user, receive user's instruction.
Further, described system model build that module records to be to build the information that system model manipulation is relevant to compriseTopological structure relation, component model and system mould between type, the component model of the component model comprising in system modelThe parameter configuration of type.
Further, the effect of described probe is information and the control of relevant variable when obtaining simulated program and moving to hereinProcessing procedure order running status herein, but can not exert an influence to the operation logic of former code and result.
Further, the particular content that described operation control module is dispatched other modules comprises controls described emulation generationCode generation module generates simulation code, controls described code compilation module and generates simulated program, the information that probe is dished out and controlArtificial intelligence processed passes to described information display module, and is shown on the system model of Modeling interface.
System based on model and an information flow visual simulating method, comprise the following steps:
Step 0) according to user's request, determine software function;
Information display module orderly showing of form with structure tree by component models all in component model storehouse described in step 1)Be shown on Modeling interface, the function that user is required according to software, selects the component model that need to use;
Step 2) build at described system model under the support of module and described information display module, user is by required component modelBe dragged and dropped into Modeling interface, and operate on it, the component model of choosing is built into system model;
Step 3) user according to demand, is configured the relevant parameter of component model and system model on Modeling interface, andOn Modeling interface, form final system model design sketch;
Described in step 4), system model is built module and can be recorded all information of building in system model process, comprises component diesThe parameter configuration of topological structure, component model and system model between type type, component model;
Step 5) is under the scheduling of described operation control module, and described simulation code generation module is according to system described in step 4The actual C code of the information of model buildings module records and component model, translates into system model the system code that can move,Then in the system code obtaining, insert probe, generate simulation code;
Described in step 6), operation control module receives the test case of user's input, and calls described simulation code generation module and incite somebody to actionDescribed test case is inserted in the simulation code that step 5 generates, and generates final simulation code;
Step 7), under the scheduling of described operation control module, is called described code compilation module to the emulation generating in step 6Code compiles, the simulated program that generation can move;
Described in step 8), operation control module is received beginning emulation command;
The simulated program generating in operation control module control step 7 described in step 9) brings into operation;
Step 10) is in the time that simulated program runs to the probe location inserting in step 5, and simulated program can be to described operation control mouldPiece sends the request that continues operation, and enters wait state;
Described in step 11), operation control module reads the variable information that probe is dished out after receiving request immediately, and to these variableesInformation is done following processing:
1) variable information is sent to described system model build module, and control described information display module simultaneously these are becomeAmount information is presented at the relevant position of Modeling interface;
2) obtain associated two component models and interface thereof according to variable information, and control described information simultaneously and show mouldPiece by the line between these two component models and interface thereof on Modeling interface with highlighted demonstration;
3) these variable informations are recorded to file and preserve, so that follow-up use;
Described in step 12), operation control module is handled after the work in step 11, immediately in return phase 10 in wait for shapeThe request command that the simulated program of state sends, makes it continue operation;
Step 13) repeating step 10 is to step 12, until whole simulated program end of run; Follow if there is the actual running resultsThe inconsistent situation of expected results, can be by observing the operating path of the simulation code showing on Modeling interface and at each structureAlso correct the variable information problem identificatioin position at part model place;
Step 14) repeating step 6, to step 13, is tested all test cases;
Step 15) finishes.
The invention has the beneficial effects as follows:
The present invention is dissolved into the thought of model in the development process of software, has proposed a kind of new software development and test sideMethod, has improved traditional software development model, has improved development efficiency; The present invention is based on reusable component model, employing is takenThe mode of building blocks is built system model, has reduced to a great extent the size of code of hand-coding, will establish developer's work weightThe heart is transferred on logic and principle design, and what promoted system can designed capacity; The present invention adopts the visual side of artificial intelligenceFormula shows the variable information of the operational process of program and transmission, by white traditional Black-box Testing box, has improved systemThe checking ability of design.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to better understand technological means of the present invention,And can be implemented according to the content of description, below with preferred embodiment of the present invention and coordinate accompanying drawing describe in detail. ThisBright detailed description of the invention is provided in detail by following examples and accompanying drawing thereof.
Brief description of the drawings
Accompanying drawing described herein is used to provide a further understanding of the present invention, forms the application's a part, thisBright schematic description and description is used for explaining the present invention, does not form inappropriate limitation of the present invention. In the accompanying drawings:
Fig. 1 is system framework figure of the present invention;
Fig. 2 is operational flow diagram of the present invention;
Fig. 3 is the logic chart of operation control module control simulated program operation of the present invention;
Fig. 4 is the structural representation that is presented at a system model on Modeling interface;
Fig. 5 is simulated program first operating path of the system model shown in Fig. 4;
Fig. 6 is simulated program second operating path of the system model shown in Fig. 4;
Fig. 7 is simulated program the 3rd operating path of the system model shown in Fig. 4;
Fig. 8 is simulated program the 4th operating path of the system model shown in Fig. 4;
Fig. 9 is simulated program the 5th operating path of the system model shown in Fig. 4;
Figure 10 is simulated program the 6th operating path of the system model shown in Fig. 4.
Number in the figure explanation: 1, component model library module; 2, system model is built module; 3, information display module; 4, imitativeTrue code generation module; 5, code compilation module; 6, operation control module.
Detailed description of the invention
Below with reference to the accompanying drawings and in conjunction with the embodiments, describe the present invention in detail.
Shown in Figure 1, a kind of system and information flow visual simulation system based on model, comprises component modelLibrary module 1, system model are built module 2, information display module 3, simulation code generation module 4, code compilation module 5 and operationControl module 6.
Described component model library module 1 is built module 2 with described system model and is connected, and described system model is built module 2Connect and be connected with described information display module 3 and described simulation code generation module 4 respectively, described simulation code generation module 4Be connected with described code compilation module 5, described code compilation module 5 is connected with described information display module 3, described operation controlModule 6 is built module 2, described information display module 3, described simulation code generation module 4 and institute with described system model respectivelyStating code compilation module 5 connects.
The Main Function of described component model library module 1 is component model and each structure all in management component model libraryThe information of part model, by component model with the form of functional unit present to user for. Component model storehouse is by reading structureThe information of part model, obtain interface that code provides outside component model, need interface that external member model provides andThe information such as the parameter of interface, offer user by the information of acquisition and are configured. Described component model library module 1 is gone back management componentInterpolation, amendment and the deletion of model, as reflecting between the icon of the name of establishment component model, component model and component model informationPenetrate relationship type. Described component model library module 1 is also managed all members and mapping relations, ensures the correct of all component modelsProperty and security, for system model build with simulation code generate provide support.
The effect that described system model is built module 2 be together with described information display module 3 for user provide one canDepending on the Modeling interface of change, and the component model in described component model storehouse is built into system model on this Modeling interface.Its specific implementation is: described system model is built module 2 and defined the mode of operation to component model, realizes component modelThe selection operation of component model and drag and drop copy operation in storehouse, realize the line operation between component model pel, realizes buildingThe parameter configuration operation of model and system model.
In this process, it is also all to build system model operation relevant by recording that described system model is built module 2Information, as the topological structure relation between the type of the component model being comprised in system model, component model, component model andThe parameter configuration of system model etc., for the work of described simulation code generation module 4 provides support; Meanwhile, described inSystem model is built module 2 and also can, according to recorded information, the correctness of system model be checked, ensures that code generatesCarrying out smoothly of work; It is the carrier that artificial intelligence shows that described system model is built the system model that module 2 generates, described systemThe output information of system model buildings module 2 is the file of system model and register system model relevant information.
The effect of described information display module 3 be build module 2 with described system model together with for user provide one canDepending on the Modeling interface of change, and all information in modeling and simulation process are presented to this Modeling interface by certain ruleUpper, watch and operate accordingly for user.
Described Modeling interface possesses following three functions:
1) show the dynamic process of modeling and the structure of system model, its concrete manifestation form is: in described component model storehouseAll component models are selected for user being presented at the form of tree type in described Modeling interface; Build at described system modelWhen module 2 is built system model, on described Modeling interface, can show system model after the component model that dragged, assembling,The parameters that component model is relevant with system model;
2) show the flow process of artificial intelligence on system model, its concrete manifestation form is: can be aobvious on described Modeling interfaceThe system model of having put up is shown, the emulated data reading according to described information display module 3, the system mould of buildingIn type, can carry out real-time demonstration, reach allow the operating path of simulation code real-time be presented at the effect on system model;
3) help described system model to build the correctness of module 2 check system models, its concrete manifestation form is: user is passableFrom described Modeling interface, whether the structure of observing system model is correct intuitively, whether has isolated component model, parameterWhether correctly configure.
The effect of described simulation code generation module 4 is that system model is translated as to simulation code. Its specific implementationBe described simulation code generation module 4 first by resolve described system model build module 2 that record with build system modelOperate relevant information, obtain type, name, topology information, the interface interchange information of all component models wherein and connectMouth configuration information, the code of recycling component model, is translated as the system code that can move by system model and (uses memberThe actual C code of model replaces the position of counterpart member model in system model, forms mutual incoherent code sheet, then by structureThe parameter configuration of topology information, component model and system model between part model is reflected to generated code sheetIn, these mutual incoherent code sheets are connected into an entirety, the system code that can move); Then by scanning justGenerate system code, obtain (being between code sheet) function call between component model connected in system code position andRelevant variable information, and generate emulation generation at these positions insertion probes (some have the complementary code of specific use)Code; Finally, the test case of user's input is inserted in generated simulation code, generates final simulation code.
The effect of described probe be the information of relevant variable when obtaining program and moving to herein and control program hereinRunning status, but can not exert an influence to the operation logic of former code and result.
The effect of described code compilation module 5 is simulation code compiling, chains that described simulation code generation module 4 is generatedBe connected into and can move simulated program.
The effect of described operation control module 6 is other modules of scheduling, coordinates the work between modules, comprisesControl described simulation code generation module 4 and generate simulation code, control described code compilation module 5 and generate simulated program, controlThe operation of simulated program with stop, the information of obtain, storage emulation program middle probe being dished out and control artificial intelligence, and by theseInformation passes to described information display module 3, is shown, by Modeling interface and user on the system model of Modeling interfaceCarry out alternately, receiving user's instruction.
Wherein the most important thing is to control the operation of simulated program and stop and obtaining artificial intelligence and at system model figureUpper demonstration. Shown in Figure 3, it is as follows that it realizes principle: insert spy when simulated program runs to described simulation code generation module 4, simulated program can also send the request that continues operation, described operation to described operation control module 6 by operation suspension when the position of pinFirst control module 6 determines the position that request is sent after receiving request, then reads the information that probe is dished out, and passes through resolving informationThe information such as member name, interface name and the interface parameters that acquisition generation component model interface calls, then send these informationShow to described information display module 3, make corresponding member and line highlighted. Complete described operation control after these workModule 6 is replied request the agreement continuation operation that simulated program sends, and simulated program is received and replied the downward operation of rear continuation, if againThe inferior probe that runs into repeats said process.
Shown in Fig. 4-10, Fig. 4 represents a system model of having put up on Modeling interface, this system modelFormed by 8 component models; Fig. 5 represents that the simulated program of this system model brings into operation, and the system model on Modeling interface is defeatedEnter to hold highlighted; Fig. 6 represents in the time that simulated program moves to member 1, and system model input and member 1 are all highlighted; Fig. 7 represents to work asWhen simulated program moves to the probe location between member 1 and member 2, system model input, member 1, member 2 and betweenLine all highlighted; Fig. 8 represents in the time that simulated program moves to the probe location between member 2 and member 7, system model inputEnd, member 1, member 2, member 7 and between line all highlighted; Fig. 9 represents to move to member 7 and member 8 when simulated programBetween probe location time, system model input, member 1, member 2, member 7, member 8 and between line all highlighted;Figure 10 represents to move when complete when simulated program, system model input, member 1, member 2, member 7, member 8, system modelOutput and between line all highlighted.
Use different test cases to test simulation code, if simulation result is inconsistent with expected results,Can be by the operating path of simulated program and the variable information problem identificatioin position of each Nodes on observation Modeling interface alsoCorrect. In visual mode, system model is tested, can greatly be improved efficiency and the quality of System Integration Test.
Shown in Figure 2, a kind of system and information flow visual simulating method based on model, comprises following stepRapid:
Step 0) according to user's request, determine software function;
Information display module 3 orderly showing of form with structure tree by component models all in component model storehouse described in step 1)Be shown on Modeling interface, the function that user is required according to software, selects the component model that need to use;
Step 2) build at described system model under the support of module 2 and described information display module 3, user is by required component diesType is dragged and dropped into Modeling interface, and operates on it, and the component model of choosing is built into system model;
Step 3) user according to demand, is configured the relevant parameter of component model and system model on Modeling interface, andOn Modeling interface, form final system model design sketch;
Described in step 4), system model is built module 2 and can be recorded all information of building in system model process, comprises memberThe parameter configuration of topological structure, component model and system model between types of models, component model;
Step 5) is under the scheduling of described operation control module 6, and described simulation code generation module 4 is according to described in step 4 beingThe information that system model buildings module 2 records and the actual C code of component model, translate into system model the system generation that can moveCode then inserts probe in the system code obtaining, and generates simulation code;
Described in step 6), operation control module 6 receives the test case of user's input, and calls described simulation code generation module 4Described test case is inserted in the simulation code that step 5 generates, generates final simulation code;
Step 7), under the scheduling of described operation control module 6, is called described code compilation module 5 imitative to what generate in step 6True code compiles, the simulated program that generation can move;
Described in step 8), operation control module 6 is received beginning emulation command;
Described in step 9), operation control module 6 is controlled in step 7 simulated program generating and is brought into operation;
Step 10) is in the time that simulated program runs to the probe location inserting in step 5, and simulated program can be to described operation control mouldPiece 6 sends the request that continues operation, and enters wait state;
Described in step 11), operation control module 6 reads the variable information that probe is dished out after receiving request immediately, and to these variableesInformation is done following processing:
1) variable information is sent to described system model build module 2, and control described information display module 3 by these simultaneouslyVariable information is presented at the relevant position of Modeling interface;
2) obtain associated two component models and interface thereof according to variable information, and control described information simultaneously and show mouldPiece 3 by the line between these two component models and interface thereof on Modeling interface with highlighted demonstration;
3) these variable informations are recorded to file and preserve, so that follow-up use;
Described in step 12), operation control module 6 is handled after the work in step 11, immediately in return phase 10 in wait for shapeThe request command that the simulated program of state sends, makes it continue operation;
Step 13) repeating step 10 is to step 12, until whole simulated program end of run; Follow if there is the actual running resultsThe inconsistent situation of expected results, can be by observing the operating path of the simulated program showing on Modeling interface and at each structureAlso correct the variable information problem identificatioin position at part model place;
Step 14) repeating step 6, to step 13, is tested all test cases;
Step 15) finishes.
Above-described embodiment is just to allow in this area for technical conceive of the present invention and feature being described, its objective isThose of ordinary skill can be understood content of the present invention and implement according to this, can not limit the scope of the invention with this. AllBe equivalent variation or the modification that the essence of the content according to the present invention has been done, all should be encompassed in protection scope of the present invention.