Visual quick design and verification control teaching experiment system
Technical field
The invention belongs to robotization relevant speciality education experiment technical field, relate to a kind of visual quick design and verification control teaching experiment system.
Background technology
This experimental system is the cover teaching experiment system for relevant industry science specialty research and development such as control class specialty, robot specialty and electromechanical integration.In China's higher education, the robotization specialty is one and has merged control theory and technology, Machine Design, Electronic Design, soft project are the comprehensive branch of learning of one.Now, the talent of the robotization specialty of social demand requires that sturdy theoretical foundation is arranged, stronger practical operative ability, and this just needs the student that the training of good Design Theory and actual exploitation will be arranged in school's stage.And at present, the teaching experiment system of robotization specialty both domestic and external is difficult to satisfy above demand, and an important reasons is exactly the backwardness of teaching experiment system.
Domestic existing automated teaching product is uneven, and function is more single and technology is more backward, can not well up-to-date control technology, computer technology, software engineering etc. be dissolved in the teaching product.Be directed to this situation, domestic a lot of colleges and universities have all begun to introduce external advanced experimental system.Though equipment is all more advanced like this, (there is not the robotization specialty abroad but often these systems meet Chinese robotization course teaching actual conditions, so-called robotization specialty all is under the jurisdiction of a certain specific subject, as machinery, chemical industry etc., and the robotization subject of China is an independently specialty), be difficult to satisfy the experimental teaching demand of undergraduate and graduate.Because these systems generally all compare costliness, have only a few studies to give birth to just operable " valuable capital assets " in addition so become usually.At present both at home and abroad more famous automated teaching product systems mainly contain Canadian Quanser system, the ECP system of the U.S. and the Feedback system of Britain, domestic have Shenzhen consolidate high-tech with etc.But these systems all do not meet the demand of Chinese robotization subject, can not press close to the field research of Chinese robotization subject well, can only finish some fixing experiment or be used for theoretical research, still can not well machinery, electronics be merged mutually with control.As Quanser system, ECP system etc., be widely used in the control specialty of Mechanical Academy abroad, these specialties have Fundamentals of Machine Design preferably usually, can carry out research learning to its machinery and control, therefore are well suited for this specialty.And domestic a lot of school buys it and is used for control teaching, then can only finish the research of some control algolithm, and can not technology such as its machinery, electronics be studied, and has wasted resource to a certain extent.This mainly contains the reason of two aspects: the one, and the improper use of domestic colleges and universities, second important problem is exactly these teaching product are not considered China in design robotization actual conditions, the contact undertighten of each link of product, design of Controller, Machine Design, Electronic Design, software development can not be integrated in the teaching experiment system and close actual course in conjunction with automated teaching, this is the common problem that exists of existing at present teaching product.
In general, the main flow process of exploitation of traditional control system that relates to design of Controller, Machine Design, Electronic Design and software design is made up of following several stages:
(1) the Machine Design stage: in traditional electro-mechanical system design process, the student will at first use 3D Machine Design software (as Solidworks, Pro/E etc.) to design the physical construction of controlled device, and then utilize the kinematics of machinery and dynamics simulation software (as ADAMS), utilize script to write control command and carry out simulation analysis.If the result is feasible, then can carry out machining.
(2) the control algolithm design phase: if the simulation result of the first step is feasible, the controlling models of the system that then begins one's study is set up.This part will be set up the controlling models of controlled device usually according to the physical characteristics of system, utilize simulation analysis software (as Matlab/Simulink, LabView etc.) to carry out numerical simulation then according to the mathematical model of being set up, and control effect analysis by data, design of Controller finishes if simulation result is satisfied.
(3) the controller hardware design phase: this stage mainly is to design actual control system according to the real-time of control algolithm and complexity, as selects single-chip microcomputer or other high-performance processors etc. for use.
(4) the entire system debug phase: after mechanical sample production is finished, connect actual control system and carry out machine debugging, the control algolithm (writing as Matlab/Simulink, LabView etc.) that the student often needs again emulation to be used becomes the executable code of hardware (as the C code) and carries out real system control, and utilizes source code to carry out the control algolithm debugging.
More than 4 stages finished traditional Electromechanical Design and exploitation basically.But,, then can cause a lot of repetitive works if find above-mentioned a certain step design existing problems in the actual design.Such as, if Machine Design has problem, then can cause the mathematical model in second step to rebulid, the program that need do controller simulation experiment and working control algorithm again also needs to write again.In addition, more than four steps related to several subjects knowledge such as machinery, control, electronics, software, the student be difficult to grasp at short notice so many software technical ability (as Solidworks, ADAMS, Simulink, C/C++).Owing to there being above reason, therefore in present institution of higher education's tutoring system, also there is not to provide so comprehensive experiment teaching system.Yet, more than four steps technical ability again exactly society to robotization subject inter-disciplinary talent's primary demand.
Generally, the subject matter of teaching experiment system existence at present has:
(1) in present control algolithm emulation, great majority concentrate on the numerical value aspect of model, promptly only are the numerical result simple displaying.It is not dark that the result of emulation gives student's impression like this, and it is more uninteresting, though some system provides the simulation result three-dimensional visualization at present, but just simply considered three-dimensional visible, and, be not based on the algorithm simulating of physics artificial physical less than the physical characteristics of in the 3D environment, considering controlled device.
(2) present experimental system lacks a close friend, open experimental system operation interface, complicated operation; Not abundant, comprehensively test solution, towards final user's scope little; Extensibility is bad, can't add new experiment solution; The user can't make the experiment solution that meets oneself needs; Lack the related experiment design that meets Chinese robotization relevant speciality teaching practice.
(3) algorithm is set up difficulty, the proof of algorithm difficulty, and algorithm and parameter testing cycle are long, write a large amount of codes by needs and just can finish a control experiment or emulation experiment, and this comes lecture to reduce the efficient of research greatly for some theoretical research persons;
(4) can't carry out hardware-in-the-loop simulation (hardware is at loop simulation) substantially, promptly allow to realize hardware-in-the-loop simulation, also, can't change experimental facilities by experimental actual needs, and can't carry out hardware-in-the-loop simulation whole experiment solutions just at a certain fixing experimental facilities.
(5) each link of experimental system disconnects, and present teaching experiment system can not be integrated into design of Controller, Machine Design, Electronic Design, software development in the software systems, has caused each link to break away from.If the student wants to finish the design of total system, then need to learn by oneself many relevant softwares and professional knowledge.Therefore, these teaching product systems can only finish part experiment (as control algolithm checking, software programming etc.) wherein, and the training (Canadian Quanser system only is used for the research of control theory) of system can't be provided for robotization relevant speciality student.
Therefore, be directed to the problem of above existence, designing a comprehensive experiment teaching system is that Research Significance and actual application value are arranged very much.
Summary of the invention
The present invention is directed to the deficiency and the defective of existing teaching experiment system, proposed a kind of teaching experiment system that constitutes by Machine Design, 3D visual simulating, hardware-in-the-loop simulation, abundant experiment solution.Utilize this tutoring system, can finish Mechatronic Systems associative simulation and Mechatronic Systems rapid shaping and checking apace, the education experiment that is suitable for the robotization relevant speciality uses.
The present invention proposes that the figure/encode that is designed into control algolithm from three-dimensional machinery realizes fast, the technical solution of the full experiment system of the checking of high confidence level 3D simulation algorithm, hardware-in-the-loop simulation proof of algorithm, on-line proof of algorithm in kind.Experimental system mainly comprises: Machine Design subsystem, Integrated Development Environment subsystem, 3D visual simulating subsystem, experiment solution subsystem, motion control subsystem and controlled device subsystem, wherein Machine Design subsystem, 3D visual simulating subsystem, experiment solution subsystem and Integrated Development Environment subsystem have constituted the electromechanical combination analogue system, and experiment solution subsystem, Integrated Development Environment subsystem, motion control subsystem and controlled device subsystem have been formed control system rapid shaping and verification system.
The Machine Design subsystem mainly be to adopt student's wieldy 3D Machine Design software (as Solidworks), can carry out part modeling, parts assembling and final assembly, and can carry out simple motion, dynamics and stress-strain analysis etc., for the 3D emulation based on physical model lays the foundation.
The Integrated Development Environment subsystem mainly comprises following functional module:
A, code editor module are carried out the writing of code, are compiled, debugging and intelligent correction;
B, basic mathematical library module provide the api function of basic mathematical function;
C, control algolithm library module provide control algolithm, comprise pid algorithm, LQR algorithm, ANN (Artificial Neural Network) Control algorithm;
D, encode communication interface module, what encode was provided carries out the Simulation drive interface of communication and the Real Time Drive interface that carries out communication with the hardware system of actual controlled device with virtual 3D controlled device;
The code editor module can be carried out the writing of code, compiled, debugging and intelligent correction etc.The basic mathematical library module mainly provides the api function of basic mathematical function, as matrix operation, and optimized Algorithm etc.The control algolithm library module mainly provides a large amount of control algolithms, as pid algorithm, and LQR algorithm, ANN (Artificial Neural Network) Control algorithm etc.The encode communication interface module mainly provides with virtual 3D controlled device and has carried out the Simulation drive interface of communication and the Real Time Drive interface that carries out communication with the hardware system of actual controlled device.The Integrated Development Environment subsystem mainly provides editing environment, basic mathematical storehouse and the algorithms library of encode (as the C/C++ language), can carry out object experiment in kind and virtual emulation experiment with online and mode off-line.Basic mathematical library module that Integrated Development Environment provides and algorithms library module make things convenient for terminal user's implementation algorithm fast; By the online and off-line experiment of corresponding driving interface realization simulation object and object in kind, program can be directly downloaded to experimental subjects or carry out Long-distance Control; By the quick checking of semi-true object emulation technology implementation algorithm on selected experimental facilities.
3D visual simulating subsystem mainly contains 3D vision render engine module, physical engine module, model online editing module composition.3D vision render engine module, its major function are that to utilize render engine be the vision rending model that virtual controlled device is set up 3D.Physical engine module, its major function are that to utilize physical engine be that virtual controlled device is set up accurate physical computing model.Model online editing module, the real-time edition and the parameter modification of realization realistic model; The major function of 3D visual simulating subsystem provides the visual dummy emulation system of high emulation, and the online editing of 3D model, physical model modeling, the entity parameter that can finish virtual objects adjusted (as length, highly, quality etc.) etc. in real time.The render engine of 3D visual simulating subsystem can be the OpenGL that uses always, OSG or the like, and physical engine can be PhysX, ODE etc.The 3D simulation subsystem can adopt C, C++, and language such as Python are developed in conjunction with corresponding render engine and physical engine, also can adopt the development platform of integrated render engine and physical engine to develop, as Microsoft Robotics Studio etc.3D visual simulating subsystem can directly import general 3D design software (Solidworks, Pro/E etc.) model file, the 3D that is used for render engine plays up, and generates accurate physical model according to model file simultaneously, is used for the dynamics computing of physical engine and generates emulation interface; 3D visual simulating subsystem provides real-time edition that model editing environment and basic physical body realize realistic model and parameter modification and real-time mutual; 3D visual simulating subsystem is adjusted the correlation parameter of 3D analogue system by the access interface of physical engine and render engine, thereby makes the subsystem of 3D visual simulating have higher simulation Credibility and emulation similarity.The virtual emulation experiment of in teaching, using at present, it much is the virtual reality that does not have physical engine, the model that need add system in the compiling procedure of control algolithm comes CONTROLLER DESIGN, this 3D analogue system then is based on real physical engine realization, can represent connection, collision, friction or the like the characteristic of rigid objects well, the emulation similarity is higher than general virtual reality system far away.
By above 4 parts, can finish mechanical system design, model emulation checking and the controller simulation checking of controlled device apace, and the code that is used for simulation study need not any modification just can directly apply to next step system's rapid shaping and checking, has improved research efficient widely.Therefore, when utilizing this experimental system, also can grasp the knowledge of controlled device design and modelling verification and simulating, verifying apace even without the student of very dark Machine Design background, this is that existing teaching product is not available.
Experiment solution subsystem mainly comprises following functional module: extendible experiment case module, algorithm development masterplate module, control tool tank module and graphical communication interface module.Wherein extendible experiment case module provides the main experiment case of the basic course of robotization specialty, has comprised courses such as Automatic Control Theory, modern control theory, computer control system.The user can oneself add the case of other courses on this Open architecture.Algorithm development masterplate module mainly is to provide a masterplate for the user carries out the secondary algorithm exploitation, and the user can make amendment on this masterplate or rebuild the control algolithm of setting up oneself.This algorithm development masterplate can be based on different development languages, as adopting Simulink or Labview etc.The control tool tank module mainly provides extendible control algolithm instrument, as the fuzzy control tool box, and ANN (Artificial Neural Network) Control tool box etc.Graphical, modular algorithm that this experimental system provides are set up environment and have been guaranteed the rapidity of modeling, the intuitive of model, are convenient to the final user and set up model, are convenient to non-modeling user and understand model.Graphical communication interface module mainly provides patterned and virtual 3D controlled device and carries out the Simulation drive interface of communication and the Real Time Drive interface that carries out communication with the hardware system of actual controlled device.The major function of experiment solution subsystem is to provide an experiment case system and patterned secondary development environment for the terminal user.This subsystem adopts open storage organization and experimental implementation interface, experiment solution development environment towards the final user is provided, abundant template, module library and experiment solution is provided, and the terminal user can develop oneself template, module library and experiment solution with this.Patterned Real Time Drive interface is the real-time experimental interface software of experiment solution system, the real-time kernel and the I/O hardware model of it is seamlessly integrated experiment solution subsystem are realized by automatic generation, compiling, connection, download and the execution of control algolithm model to the real-time code of control system.This Real Time Drive interface module can also be carried out real time access and on-line parameter adjustment by corresponding test instrument software to variable according to signal and variable file of parameter generating.
Motion control subsystem has two kinds of implementations: first kind of implementation comprises PC, data collecting card, amplification/driving circuit, sample circuit and controlled device system, wherein, the function of PC carries out for monitoring and control algolithm.Second kind of implementation comprises PC, embedded controller, amplification/driving circuit, sample circuit and controlled device system, and wherein, the PC function is the monitoring control procedure, and embedded controller is carried out real-time control algolithm.When adopting first kind of mode, all control programs all operate on the PC, the real-time of its control system has the real-time control kernel based on PC to guarantee, and when adopting the second way, on PC, utilize the graphic programming environment to set up control algolithm and generate real-time code then automatically and compile, connect, download in the embedded Control then and move.
Experiment solution subsystem, Integrated Development Environment subsystem and motion control subsystem have been formed dynamo-electric rapid shaping and verification system.By this system, can be connected with the employed experimental facilities of terminal user, realize hardware-in-the-loop simulation.When being applied to research experiment, enrich template, module library and experiment solution based on what this experiment solution system provided, foundation and parameter testing that can accelerating algorithm for the final user provides experiment effect intuitively, be convenient to obtain satisfied experimental data.When being applied to education experiment, the abundant experiment solution of relying on this experimental system to provide, for the final user provides an approach of understanding subject knowledge in depth, abstract knowwhy is converted into experimental data and experiment effect intuitively, realize the final purpose of course teaching experiment.That relies on that this experimental system provides enriches template, module library and experiment solution, the final user can be at different experimental facilitiess, correlation parameter and relevant setting the to the different experiment solutions that provides on different templates are adjusted, and also can set up the experiment solution of oneself by the needs according to oneself on the template of choosing.The control information that to test solution of the communication modes that provides of equipment transmits or downloads in the controlling object of specifying on the experimental facilities by experiment, in experiment, experimental facilities is controlled and information feedback, record and comparative experiments data, adjust the parameter of empirical model, final satisfied experimental data and experiment effect, the target of realization research experiment or education experiment of obtaining.
Annexation between each subsystem is described below: the 3D model after the Machine Design subsystem design can save as an assembly file, and this assembly file can generate simulation subsystem 3D model file for emulation usefulness easily by the Import menu of 3D simulation subsystem.The 3D simulation subsystem passes through communication interface with experiment solution subsystem and Integrated Development Environment subsystem---and the Simulation drive interface module is carried out data information exchange.Simultaneously, experiment solution subsystem and Integrated Development Environment subsystem can carry out the physical data message exchange by Real Time Drive interface module and hardware device motion control subsystem.Motion control subsystem is carried out electric signal with controlled device by data line and is connected.
The operational process of total system is as follows: at first utilize the Machine Design subsystem to set up the 3D model, import to 3D visual simulating subsystem then and generate physical model, next selecting patterned programmed environment at the Integrated Development Environment subsystem still is the advanced language programming environment, if higher level lanquage, then utilize the basic mathematical library module and the control algolithm library module that are provided to carry out design of Controller, if the graphic programming environment then utilizes the control tool tank module to finish the design of controller; After design of Controller is finished, select experiment method at experiment solution subsystem, if the virtual objects emulation experiment then selects the Simulation drive interface of graphical communication interface module to carry out the virtual emulation experiment, observe the control effect by the adjustment control parameter; If object experiment in kind then replaces to the Real Time Drive interface with the Simulation drive interface and carries out full-scale investigation, carry out automatic download of code and control in real time and observe the control effect; If effect is dissatisfied, then revise controller and regulate parameter, up to obtaining the Satisfactory Control effect, test till the end.It is characterized in that to utilize earlier virtual objects to carry out the control algolithm design, when algorithm design, adopt to be easy to control the subject personnel graphical programming language of design fast, carry out the virtual emulation experiment.After virtual emulation experiment finishes, can only revise the driving interface of control algolithm, just can realize real-time C language control routine automatic generation, download and control in real time, improved the efficient that control is tested greatly.
The present invention has substantial characteristics and marked improvement, and its superiority is that virtual matter emulation combines with hardware-in-the-loop simulation, and directly virtual emulation object-oriented modeling method is provided fast.Through the algorithm of virtual experimental simulating, verifying, utilize patterned editing environment to replace respective interface modules after, can generate real-time code automatically and compile, connect, download and move automatically.Need not any odd word can directly carry out object in kind and control experiment in real time.When utilizing the teaching of this experimental system, teacher can be arranged in virtual controlled device to the student earlier, allows student's CONTROLLER DESIGN carry out the control algolithm research of electromechanical combination emulation.If the control effect of control algolithm is satisfied, then carry out full-scale investigation again.Guarantee the security of actual experiment so on the one hand, also greatly improved usage ratio of equipment on the other hand, also improved the efficient of research and experiment simultaneously.In addition, student's experiment place and experimental period have also been expanded, the student can do earlier algorithm research at any time on virtual objects, program need not any modification and just can carry out actual physics again in the available time of equipment and test and check the working control effect then, has greatly expanded the notion of traditional experiment.
Description of drawings
Fig. 1 is a system architecture diagram of the present invention,
Fig. 2 is 3D visual simulating subsystem structure figure,
Fig. 3 is Integrated Development Environment subsystem structure figure,
Fig. 4 is experiment solution subsystem structure figure,
Fig. 5 is electromechanical combination simulation flow figure,
Fig. 6 is the rapid prototyping control flow chart,
Fig. 7 is an an example of the present invention: control algolithm figure is set up in graphical encode programming,
Fig. 8 is the overview flow chart of general experimentation of the present invention.
Embodiment
Disclosed by the invention is many multi-form embodiments.That show in the accompanying drawings and what be described in more detail below all is the preferred embodiments of the present invention.Yet following public embodiment is the example of the principle of the invention, is not that the present invention is limited to this embodiment.Fig. 1 is a system architecture diagram of the present invention, framework of the present invention as shown in Figure 1 is made up of with checking two parts Mechatronic Systems associative simulation and Mechatronic Systems rapid shaping, Machine Design subsystem wherein, 3D visual simulating subsystem, experiment solution subsystem and Integrated Development Environment subsystem have constituted the electromechanical combination analogue system, experiment solution subsystem, the Integrated Development Environment subsystem, motion control subsystem and controlled device subsystem have been formed control system rapid shaping and verification system, and the control tool case, control algolithm storehouse and basic mathematical storehouse are the expansion to experiment solution subsystem and Integrated Development Environment subsystem.The Mechatronic Systems associative simulation adopts identical experiment solution subsystem and Integrated Development Environment subsystem with the Mechatronic Systems rapid shaping with verification system as we can see from the figure, emulation just can be used identical Control Software with the actual experiment system under identical platform like this, can solve current emulation and adopt different development platforms with real system, need carry out the problem of the duplication of labour, developer and student can be concerned about more energy in the design and checking of experimental program.
Below in conjunction with specific embodiments of the invention, the present invention is further illustrated.How carrying out controlled device design, the control algolithm design of reversible pendulum system and control experimental verification in real time with the student below is example, and the concrete application process of native system is described.The design of whole reversible pendulum system, exploitation and verify that roughly can be divided into following two stages finishes:
(1) phase one: Machine Design and controlled device virtual emulation stage.As shown in Figure 5, be that the co-simulation process of the Mechatronic Systems of experimental subjects is with the inverted pendulum:
Step 1:
Set up the vision mode of experimental subjects (inverted pendulum) in Machine Design software (as Solidworks, the Pro/E etc.) environment 3, be stored as standard rending model file;
Step 2:
3D simulated environment subsystem generates the dynamics computing that accurate physical model is used for physical engine according to the rending model file, and plays up its vision mode;
Step 3:
The physical engine by 3D visual simulating environment subsystem and the access interface of render engine are adjusted the correlation parameter of virtual prototype (inverted pendulum), make the consistent of its physical characteristics and model machine in kind;
Step 4:
The Simulation drive interface module of design and simulation object (graphical/encode) realizes being connected with the virtual controlled device (inverted pendulum) of 3D visual simulating.
Step 5:
CONTROLLER DESIGN, and utilize graphical programming language (as Simulink) or higher level lanquage (as C/C++) to write control algolithm, whole Mechatronic Systems is carried out associative simulation.Online adjustment controller parameter till controller performance meets design requirement, and can be controlled effect by direct feel in the 3D environment.
So far, the virtual emulation experiment is finished, and has finished the design of Controller based on model.
(2) subordinate phase: control system rapid shaping and Qualify Phase as shown in Figure 6, are that experimental subjects is carried out the quick experiment checking with the inverted pendulum, the steps include:
Step 1:
At first experiment Analysis is selected experiment solution or self-defined experiment algorithm according to the experiment demand; Such as " second-order system closed-loop control " experimental program of selecting in " Automatic Control Theory ", then click the relevant introduction that corresponding directory tree can eject this experiment, comprise experiment purpose, equipment needed thereby, and provide the control program of Demo version.The student can make amendment according to this demonstration program and design the controller of oneself, also can redesign the control algolithm of oneself fully.
Step 2:
Carry out algorithm design according to experimental program, and in Integrated Development Environment or experiment solution, build the experiment algorithm with figure module (or code), and carry out Real Time Drive interface (graphical/encode) system and connect and be provided with, the connection here is provided with the setting that is connected on the connection setting that mainly comprises on the software and the hardware.It mainly is deletion Simulation drive interface module in procedure chart that connection on the software is provided with step, replaces with corresponding Real Time Drive interface (graphical/encode) module then, and corresponding channel number and controlled variable etc. are set, and last save routine gets final product.Connection setting on the hardware comprises that connecting corresponding interface is wired to controlled device and motion control card, as the motor-driven line, and code device signal line etc.; (if before this, carried out the associative simulation of Mechatronic Systems, then needn't carry out the design and the realization of control algolithm, and just the Simulation drive interface in the control algolithm in the co-simulation process had been replaced with the Real Time Drive interface and get final product).
Step 3:
Connect kinetic control system and controlled device in kind, experimental data and curve are also stored in the checking that experimentizes, monitoring, can utilize the oscillograph of Simulink can monitor the change curve of arbitrary parameter here; Unfavorable experimental result is analyzed, and further by online adjustment design of Controller or adjusting controlled variable, till obtaining the Satisfactory Control effect.
Step 4:
If experiment effect reaches designing requirement, illustrate that the design of Machine Design and control algolithm is correct, so just can finalize the design mechanical system and control algolithm, the student can further develop control system actual hardware system.
In sum, utilize the present invention can realize realizing fast and quick design of the electromechanical integration of checking and forming experiment to control system by Machine Design, 3D visual simulating, design of Controller, Machine Design, control algolithm design, virtual experimental and actual experiment etc. seamlessly can be coupled together, reduced the duplication of labour, improved conventional efficient, be very suitable for the experimental teaching of undergraduate and graduate of robotization related discipline and Course Exercise etc., prospect has a very wide range of applications.