CN112365776A - Method for simulating oil flow in hydraulic circuit pipeline based on Unity - Google Patents

Method for simulating oil flow in hydraulic circuit pipeline based on Unity Download PDF

Info

Publication number
CN112365776A
CN112365776A CN202011198457.XA CN202011198457A CN112365776A CN 112365776 A CN112365776 A CN 112365776A CN 202011198457 A CN202011198457 A CN 202011198457A CN 112365776 A CN112365776 A CN 112365776A
Authority
CN
China
Prior art keywords
hydraulic circuit
unity
script
model
oil flow
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011198457.XA
Other languages
Chinese (zh)
Inventor
刘继忠
金颖
旷有涛
李道良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanchang University
Original Assignee
Nanchang University
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 Nanchang University filed Critical Nanchang University
Priority to CN202011198457.XA priority Critical patent/CN112365776A/en
Publication of CN112365776A publication Critical patent/CN112365776A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09BEDUCATIONAL OR DEMONSTRATION APPLIANCES; APPLIANCES FOR TEACHING, OR COMMUNICATING WITH, THE BLIND, DEAF OR MUTE; MODELS; PLANETARIA; GLOBES; MAPS; DIAGRAMS
    • G09B23/00Models for scientific, medical, or mathematical purposes, e.g. full-sized devices for demonstration purposes
    • G09B23/06Models for scientific, medical, or mathematical purposes, e.g. full-sized devices for demonstration purposes for physics
    • G09B23/08Models for scientific, medical, or mathematical purposes, e.g. full-sized devices for demonstration purposes for physics for statics or dynamics
    • G09B23/12Models for scientific, medical, or mathematical purposes, e.g. full-sized devices for demonstration purposes for physics for statics or dynamics of liquids or gases

Landscapes

  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Algebra (AREA)
  • Pure & Applied Mathematics (AREA)
  • Educational Administration (AREA)
  • Computational Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Educational Technology (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a Unity-based method for simulating oil flow in a hydraulic circuit pipeline. The method comprises the following steps: carrying out format conversion on the model after modeling through 3ds max software and then importing the model into Unity; optimizing the model and rendering the scene; adding a loop diagram button after the explanation scene is constructed and compiling a script to realize the function; designing a part dragging function; designing a trigger detection function; after the parts are arranged, the parts are placed in sequence to form a hydraulic circuit diagram; controlling the generation of the small balls by using a control script GameManager; through a single-case mode, calling a plurality of variables in the GameManager to control the movement of an oil way; generating two small balls each time, wherein each small ball has an array path; spheremanager script is hung on the small ball and generated in the GameManager, and then the small ball automatically moves according to the two arrays. The invention solves the problems that the hydraulic circuit cannot be three-dimensionally expressed and the motion of the oil in the hydraulic circuit cannot be clearly and visually described.

Description

Method for simulating oil flow in hydraulic circuit pipeline based on Unity
Technical Field
The invention belongs to the technical field of virtual reality teaching, and particularly relates to a Unity-based method for simulating oil flow in a hydraulic circuit pipeline.
Background
Unity is an excellent virtual reality simulation software, and the development of a virtual reality teaching system depends on the virtual reality development software. With this excellent software, developers can develop some rich-content virtual reality applications.
The hydraulic transmission course is one of important courses of mechanical major, and has the problems of insufficient quantity of hydraulic components, poor safety and the like, teachers give lessons to students from several classes, the quantity of hydraulic components in a laboratory is limited, and part of experimental operations have certain dangerousness, but the increase of teachers and a large amount of purchased teaching equipment seriously increase financial burden of colleges and universities, so that the individual requirements of students are difficult to meet.
The hydraulic circuit is an important content in the course of hydraulic transmission, classroom teaching often has certain limitation, students are difficult to understand the oil flowing process in the circuit, and the course is often boring and tasteless. The problem that hydraulic components are damaged and oil can not be simulated to flow in the pipeline often exists in the experiment course again.
At present, the oil motion simulation is made by flash animation, the immersion effect is poor, more simulation is stopped in a two-dimensional space, students cannot visually and vividly learn related contents of hydraulic transmission, the learning interest of the students cannot be attracted, and the difference between the classroom teaching quality improvement and the virtual reality technology is obvious.
Disclosure of Invention
Aiming at the defects and difficulties in the prior art, the invention aims to provide a Unity-based method for simulating the oil flow in a hydraulic circuit pipeline, so as to solve the problems that the conventional oil hydraulic circuit is not intuitive and lacks three-dimensional stereoscopic impression.
The invention is realized by the following technical scheme:
a method for simulating oil flow in a hydraulic circuit pipeline based on Unity comprises two aspects of building a hydraulic circuit and simulating oil movement in the hydraulic circuit.
In a first aspect, a method for building a novel hydraulic circuit is provided, which comprises the following steps:
(1) modeling a loop element by utilizing SolideWorks, and leading out the model into a STEP format;
(2) converting the FBX files into FBX files by using 3ds Max and importing the FBX files into a newly-built Unity3D project;
(3) constructing and rendering a teaching scene in Unity 3D;
(4) adding a loop diagram button after the explanation scene is constructed and compiling a script to realize the function;
(5) after the parts are arranged, the parts are placed in sequence to form a hydraulic circuit diagram;
specifically, the construction and rendering of the scene includes: processing redundant surfaces according to conditions, and reducing the number of the molded surfaces as much as possible so as to reduce the data volume and further realize model optimization; setting different parameters according to different models, and adding lamplight, a map and the like in a scene for rendering; after the model is imported into Unity3D, parameters of Transform are modified, and then courseware scene building is carried out.
Specifically, the scene construction operation includes: newly building Canvas on a Hierarchy interface, and adding Image, Text and Button components on the Canvas; compiling a corresponding script to realize the function of entering a function selection interface after clicking a click enter button; the script is applied to the canvas and then event registration is performed for four buttons in the interface.
Specifically, the functions implemented by the script include:
1) designing a part dragging function, adding a rigid body component on a part with a BoxColder, and adding a script ModelsPosChange;
2) designing a trigger detection function, sending a corresponding object to hide a current object, and displaying another object, wherein the final effect is that when the dragged object touches a corresponding position, a correct model is generated at the position; trigger detection is judged from the Tag.
In a second aspect, a method for simulating oil motion in a novel hydraulic circuit is provided, and the method is realized by simulating slow motion of oil in a pipeline through ball motion, and specifically comprises the following steps:
(1) registering a button event by the lambda expression;
(2) controlling the generation of the small balls by using a control script GameManager;
(3) through a single-case mode, a plurality of variables in the GameManager are called to control the movement of the oil way.
Specifically, the method of controlling the movement of the oil passage is:
1) generating two small balls each time, wherein each small ball has an array path;
2) spheremanager script is hung on each small ball and generated in the GameManager, and then the small balls automatically move according to the two arrays.
Compared with the prior art, the invention has the beneficial effects that:
(1) the immersion type oil motion simulation teaching device has a good immersion effect, the oil simulation hydraulic circuit is more visual, the three-dimensional stereoscopic impression is stronger, students can learn intuitively and vividly, and the teaching quality is greatly improved.
(2) The virtual simulation teaching method reduces financial expenditure and avoids dangerous factors in experimental operation.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In addition, the technical features according to the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments that can be obtained by a person skilled in the art without any inventive step based on the embodiments in the present application belong to the scope of protection of the present application.
In a specific implementation, the method for simulating oil flow in a hydraulic circuit pipeline based on Unity comprises two aspects: constructing a hydraulic circuit and simulating oil motion.
In a first aspect, a hydraulic circuit is constructed.
(1) Modeling the loop element, converting the format, and importing Unity
Three-dimensional modeling was performed using solidworks software, including loop elements such as: gear oil pump, overflow valve, choke valve, hydro-cylinder, pipeline and coupling.
The model built by the SolideWorks software is led into the 3ds Max software, and since the export format of the model built in the SolideWorks is STEP and Unity cannot effectively be compatible with the three-dimensional model with the format, the 3ds Max is used as intermediate software for format conversion. SolideWorks outputs STEP format software, which is imported into 3ds Max and converted therein into FBX format compatible in Unity.
And converting the format of the established three-dimensional model, then importing the three-dimensional model into Unity3D, designing and constructing a scene for the hydraulic circuit by using resources imported into a Unity platform and the model built in the platform, and setting different loader parameters according to different models.
(2) Model optimization and rendering of scenes
And adding lamplight, a map and the like in the scene for rendering.
A GUI page is designed and produced in Unity, a Panel (drawing board component) is newly built, the Panel is named as MainPanel,
this MainPanel is the main bearer for the entire GUI page, on which all the production process is done.
A Button component, a Text component and a Slider component are added on the MainPanel page, accurate and standard naming is carried out on the Button component, the Text component and the Slider component, and the added components can be arranged according to a certain logic sequence.
An Empty component is newly built in the MainPanel, the Empty component is renamed to All, the size of the Empty component is adjusted mainly in the design of hydraulic circuit building and oil movement, and the Empty component is enabled to reach a proper display size.
(3) Adding a loop diagram button after the explanation scene is constructed and compiling a script to realize the function;
four 3D Object cubes were newly created in the empty Object All, and named Cube1, Cube2, Cube3 and Cube4 in this order. The four three-dimensional figures are positioning bodies for subsequently dragging the hydraulic components, so that the subsequent dragging operation and the subsequent recognition dragging action are facilitated.
Firstly, two models which are identical are set for each part, and the parts are directly dragged to a scene interface on a project interface. One of which is boxcroter and the other is absent.
Rigid body components are added on parts with BoxColoder, and a script ModelsPosChange is added, wherein the script has two functions, namely dragging is performed on the first function, and triggering detection is performed on the second function. The dragging function is to move along with the mouse, and a BoxColoder collision body is needed to detect the ray of the corresponding mouse, so that the model without the BoxColoder is always in place.
The trigger detection function is to trigger the corresponding object to hide the current object and display another object, and finally achieve the effect that when the dragged object touches the corresponding position, a correct model is generated at the position. Trigger detection is judged from the Tag.
(5) After the parts are arranged, the parts are placed in sequence to form a hydraulic circuit diagram
Because the position of each hydraulic component is fixed and unique, each component is provided with a corresponding coordinate point and a corresponding locating point, and if the suitable coordinate point is reached, the model can be automatically adsorbed to the locating point.
The hydraulic elements are connected with each other through pipe joints and oil pipes to form a complete throttling and speed regulating circuit. By this time, the work of constructing the hydraulic circuit is completed.
In a second aspect, oil motion is simulated.
After the hydraulic circuit is completed, the next step is to simulate the flow of oil in the pipe.
Since the hydraulic circuit is a three-dimensional pipeline and comprises X, Y, Z coordinates in three directions, the movement of oil in the pipeline can also be referred to as movement in three-dimensional space, and therefore, some key points can be located by adopting a fixed point marking mode, and the movement in three-dimensional space is converted into movement in a two-dimensional plane.
At the corner of the hydraulic element and the pipeline, the coordinate in one direction or even the coordinate in two directions is changed, so that one mark point is taken at the coordinate conversion positions, 24 mark points are taken in total, and only one coordinate axis is changed between every two mark points and the change is carried out along a straight line.
Therefore, the oil in the oil circuit moves slowly in the oil pipe through the small balls, and the method is as follows:
(1) registering a button event using a lambda expression;
(2) the movement of the oil circuit is that a plurality of small balls move slowly, and the generation of the small balls is controlled by using a control script GameManager;
(3) controlling the movement of the oil path.
In the event of the "oil motion" button, the expression of the button is mainly realized through a singleton mode. And a plurality of variables in the oil way are called to control the movement of the oil way, so that button clicking and small ball movement can be highly decoupled and do not interfere with each other. Two small balls are generated each time, each small ball has an array path, a Spheremanager script is hung on each small ball and is generated in a GameManager, and the small balls automatically move according to the two arrays.
In the constant-pressure throttling and speed-regulating loop, the through-flow sectional area of the throttling valve can control the speed of the oil in the oil circuit.
In order to visually represent the working principle of the throttling and speed regulating loop, a brace for controlling the size of the through-flow sectional area of the throttling valve in the throttling and speed regulating loop is additionally arranged, so that the movement speed of oil in an oil way is controlled.
Firstly, adding two UIs in a Main2Panel interface below the original Canvas; the first is Text for displaying the characters of the sliding bar, and the second is a Slider sliding bar for reflecting the change of the oil speed after the flow cross section of the throttle valve is changed. After the two UI objects are added, a script control object is added to realize functions, and the added script is in a Main2Panel manager script on a parent object Main2Panel of the slider.
The product release PC end of this teaching design carries out the product release under the condition that has no problem after the debugging.
First click on the File menu and select the Build Settings menu command. The Add Current button is clicked on to Add the Current scene. And then selecting a PC (personal computer) in Platform (template), then selecting a Windows Platform in a right interface, and finally clicking a Build button to select a folder where the published product is located to realize publishing.
The foregoing merely represents preferred embodiments of the invention, which are described in some detail and detail, and therefore should not be construed as limiting the scope of the invention. It should be noted that, for those skilled in the art, various changes, modifications and substitutions can be made without departing from the spirit of the present invention, and these are all within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (6)

1. A method for simulating oil flow in a hydraulic circuit pipeline based on Unity is characterized by comprising the following steps:
s1, carrying out three-dimensional modeling, carrying out format conversion on the modeled model through 3ds max software, importing the model into Unity, optimizing the model, and rendering the scene;
s2, adding a loop diagram button and compiling a script to realize functions, including a design part dragging function and a trigger detection function; after the functional parts are arranged, the functional parts are placed in sequence to form a hydraulic circuit diagram;
s3, controlling the generation of the small balls by using a control script; through the single-case mode, a plurality of variables in the single-case mode are called to control the movement of the oil way.
2. The method for simulating oil flow in a pipe of a Unity-based hydraulic circuit according to claim 1, wherein the step S1 specifically comprises:
(1) modeling a loop element by utilizing SolideWorks, and leading out the model into a STEP format;
(2) converting the FBX files into FBX files by using 3ds Max and importing the FBX files into a newly-built Unity3D project;
(3) building a teaching scene in Unity3D, and adding lighting, a map and the like in the scene for rendering;
(4) the model optimization is mainly to process redundant surfaces according to the situation, and reduce the number of the model surfaces as much as possible so as to reduce the data volume.
3. The method for simulating oil flow in a pipe of a Unity-based hydraulic circuit according to claim 1, wherein the step S2 specifically comprises:
adding a loop diagram button and compiling a script to realize a function, and registering an event of the button;
designing a part dragging function, adding a rigid body component on the part, and adding a script to realize the part dragging function;
designing a trigger detection function, sending a corresponding object to hide a current object, and displaying another object;
trigger detection is judged according to the Tag.
4. The method for simulating oil flow in a pipe of a Unity-based hydraulic circuit according to claim 1, wherein the step S3 specifically comprises:
(1) registering a button event by the lambda expression;
(2) controlling the generation of the small balls by the control script;
(3) and calling a plurality of variables in the script to control the movement of the oil way through a singleton mode.
5. The Unity-based method for simulating oil flow in a hydraulic circuit pipe according to claim 4, wherein the specific method for controlling the movement path of the oil way comprises the following steps:
(1) controlling the generation of the small balls by using a control script;
(2) generating two small balls each time, wherein each small ball has an array path;
(3) a new script is hung on the small ball, and the small ball automatically moves according to the two arrays after being generated.
6. The Unity-based method of simulating oil flow in a hydraulic circuit conduit according to claim 2, wherein the Unity-based method comprises a step of measuring the oil flow rate.
CN202011198457.XA 2020-10-31 2020-10-31 Method for simulating oil flow in hydraulic circuit pipeline based on Unity Pending CN112365776A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011198457.XA CN112365776A (en) 2020-10-31 2020-10-31 Method for simulating oil flow in hydraulic circuit pipeline based on Unity

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011198457.XA CN112365776A (en) 2020-10-31 2020-10-31 Method for simulating oil flow in hydraulic circuit pipeline based on Unity

Publications (1)

Publication Number Publication Date
CN112365776A true CN112365776A (en) 2021-02-12

Family

ID=74513243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011198457.XA Pending CN112365776A (en) 2020-10-31 2020-10-31 Method for simulating oil flow in hydraulic circuit pipeline based on Unity

Country Status (1)

Country Link
CN (1) CN112365776A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104704689A (en) * 2012-07-30 2015-06-10 工业研究与发展基金会有限公司 Energy conversion system
CN111538252A (en) * 2020-05-25 2020-08-14 厦门大学 Intelligent home demonstration system applying VR technology

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104704689A (en) * 2012-07-30 2015-06-10 工业研究与发展基金会有限公司 Energy conversion system
CN111538252A (en) * 2020-05-25 2020-08-14 厦门大学 Intelligent home demonstration system applying VR technology

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
朱龙威: "基于VR的液压虚拟实验室的设计及研究", 《中国优秀硕士学位论文全文数据库 (工程科技Ⅱ辑)》 *
栾飞: "基于Unity3D的液压传动虚拟仿真教学系统开发", 《中国优秀硕士学位论文全文数据库 (工程科技Ⅱ辑)》 *

Similar Documents

Publication Publication Date Title
Celani et al. CAD scripting and visual programming languages for implementing computational design concepts: A comparison from a pedagogical point of view
CN105278685B (en) A kind of assisted teaching system and teaching method based on EON
CN107967057B (en) Leap Motion-based virtual assembly teaching method
CN105989623B (en) The implementation method of augmented reality application based on handheld mobile device
CN110942519B (en) Computer assembly virtual experiment system and implementation method thereof
CN112365776A (en) Method for simulating oil flow in hydraulic circuit pipeline based on Unity
Lee et al. Holographic construction of generative landscape design using augmented reality technology
Bowman et al. Virtual-SAP: an immersive tool for visualizing the response of building structures to environmental conditions
CN105825024A (en) Method for implementing cooperative three-dimensional simulation of blasting condensation workshop section of coke-oven plant
Shengyi et al. Research on integrated application of virtual reality technology based on BIM
Pan et al. Virtual Assembly of educational robot parts based on VR technology
Cozzens CATIA V5 Workbook Release V5-6R2013
CN111523161A (en) BIM and Unity 3D-based 3D Internet of things visualization man-machine interaction method
Cherniavskyi et al. Modeling university environment: means and applications for university education
Chen et al. Development and Application of Virtual Assembly Training System of Mine Drilling Rig Based on Unity3D
González-Calleros et al. A structured approach to support 3d user interface development
CN109919815A (en) A method of site operation efficiency is improved using the engineering that actual situation combines
Xiong The Application of Computer Three-dimensional Modelling Technology in Environmental Art Design Major
Scalas et al. A first step towards cage-based deformation in virtual reality
Sheikh et al. Architectural Education with Virtual Reality
Bin et al. Virtual Reality Design of industrial robot teaching based on unity3D
Avani et al. Building Information Modelling and Augmented Reality for building energy systems visualisation
Mannuß et al. From scene graph centered to entity centered virtual environments
Shen et al. Research on key technology of hydraulic transmission simulation system based on Unity3D
Zhang et al. Virtual simulation of glue coating training for industrial robots

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