The Design and Implementation of Virtual Physics Experiment System Based on VB and VRML Programming

The paper establish a virtual three-dimensional experimental instrument model by virtual reality modeling language, and a programming language VB is used to design an interactive virtual experiment platform. Its operating interface is similar to the style of Windows. It has the characteristics of friendly interface, experimental phenomena and parameters Association. It is a revolution in the traditional teaching mode of physical experiment. Virtual experiment realizes the simulation of real experiment process, allowing students to operate experiments anywhere and at any time, and has practical use value.


Introduction
In recent years, with the development and deepening of modern education, some achievements have been made in the construction of teaching resources. But in the teaching environment, there is a lack of Virtual Experimental Courseware closely related to the experiment, which affects the normal teaching of experimental courses. Even in some teaching processes, there is a lack of experimental links, the quality of learning is difficult to be guaranteed, and it is impossible to cultivate skilled talents in accordance with the goal of training. Therefore, the resource construction of experimental courses is the focus of the current teaching resource pool construction and it needs our attention.
In the traditional teaching, some methods of experimental video are used in the teaching of experimental courses. The whole learning process is short of interactivity and students have no opportunity to exercise. As a result, students' interest in learning is not high, learning is passive, and the quality of teaching is difficult to guarantee. For the students with experimental conditions, the school provided experimental equipment and teachers' field guidance, but before the experiment, the students did not have a full understanding the whole process of the experiment, the correct operation method, and the standardization of experiment and the effect of experiment. All is not guaranteed.
In order to leave the space for the students to explore, ensure the smooth progress of the experiment, to a certain extent, reduce the workload of experimental teachers, reduce the loss of experimental equipment and improve the quality of experimental teaching, and the virtual experiment of computer simulation is one of the ways to solve this problem.

2
Objective analysis of virtual experiment According to the characteristics of students' learning and the experimental purposes of the course, virtual experiment design should achieve 3 goals. First of all, virtual experiments should have three dimensional effects, so that the experiment is realistic. Secondly, the simulation experiment must involve the operator and realize the human-machine interaction in the experiment process, and the unification of the experimental process and reality. Finally, students can get experimental results and feedback information in time to help and standardize students' operation behavior. 1) Feature 1: the system has real experimental scene and experimental process. In this paper, 3DMAX technology is used for 3D modeling, and the demonstration of laboratory equipment is realized by computer. In the study, the system can improve the students' perceptual knowledge in time, and make the boring learning in the courseware, so that the difficult to understand the problem becomes simple, image, easy to understand and digest.
2) Feature 2: human-computer interaction. Under the simulated virtual experiment conditions, students can observe the experimental phenomena and reflect the experimental process. Taking the virtual simulation experiment designed by the author as an example, the students can operate according to the actual requirements, such as the switch button, the output voltage of the power supply and the resistance of the sliding rheostat, and the students can drag the mouse to measure the current and electrical pressure of the components with the plug of the ammeter and voltmeter.
3) Feature 3: students can get experimental results and give feedback. In order to achieve the effect of the auxiliary experiment teaching, the simulation experiment is required to give the operating instructions according to the operator's different operation. For example, when the operator does not operate according to the operation standard process, the system will display the error information. When learners encounter difficulties in operation, the system will give prompt help hints, which is one of the advantages of computer virtual experiment.

Structure design of virtual experiment system
The system structure part is realized by VB and VRML, which mainly includes the experiment scheme module, the virtual instrument library module, the performance library module, the parameter module, the virtual scene module and the data processing modules. The modules are connected by the dynamic data exchange (DDE), and the principle block diagram is shown in Figure 1. The function of the main module is briefly introduced as follows: (1) virtual instrument library module, the main function of the module is to store the static VRML file (VR entity) of the experimental instrument and sample, the control button corresponding to the VR entity, the script definition (script), the time detector and the contact detector, the position interpolator and the corresponding routing information.
(2) The performance library module, the main function of the module is to store the performance parameters of different devices in different experimental environments, such as temperature, humidity, heat treatment state, and the corresponding tensile properties (time, load, displacement, etc.). The values of these parameters are real data collected during the stretching experiment, and the system can provide interfaces to be imported and replenish at any time.
(3) Virtual simulation module, which consists of virtual scene and VB console, whose main function is to select the required experimental instrument and the sample VR entity to form a virtual scene. The VB console reads the control button description, script definition, time detector and contact detection from the instrument library and the performance library respectively from the instrument library and the performance library, the device, location interpolator and corresponding routing information, as well as the performance parameters corresponding to the virtual sample. Then, these data are processed to create interactive virtual experiment scenes.
The development process of virtual experiment is divided into the following steps: 1, this paper analyzes the experimental principles, experimental instruments, experimental contents and experimental objectives of junior high school physics experiments, and makes a detailed analysis of the psychological and cognitive structure of the students at this stage.
2, the paper constructs the scene of virtual experiment and makes the virtual experiment instrument needed in the experiment.
3, we set up interactive operations in experiments to achieve experimental interaction. 4, we set up the correlation between the parameters in the experiment. 5, the author tests the virtual experiment and debug and optimize the virtual experiment.
6, we compile and publish virtual experiments. Figure 2 is a flowchart for virtual experiment development:

VR model
The 3D models designed in this paper should include geometric models and physical models. The geometric model is mainly composed of shape, appearance, position, material and texture. It only reflects the static characteristics of the virtual object, and the physical model mainly shows the dynamic characteristics of the virtual object, such as speed, acceleration, displacement and deformation.
There are two methods for geometric modeling. First, the source code is stored as a *.wrl format file, second, we make a three-dimensional model by third party modeling software (such as: 3D MAX, Maya), and then the *.wrl file will be send into VRML, edit their position and relationship with the virtual reality world, thus forming a unified whole.
The establishment of the physical model requires the Script of VRML, the TimeSensor node, the space location node and the space sensor, and the TimeSensor sends out the clock information in a specific period. The Script script automatically calculates the new physical properties of the object according to the values of the moving features of the objects at that time. For example, speed, acceleration, displacement, deformation, etc..

The method of accessing database by VRML
VRML can access the database through the embedded JavaScript language, which is encapsulated in the URL domain of the Script node. The scripting language operates the database through the "DataBase. SqlTable" and "DataBase.Sqlconsor" events, and then automatically changes the obtained data to the type of its own support. The program implements the hybrid programming of VRML and JavaScript. Declaring and inserting JavaScript scripts in the URL domain of the Script node, connecting and manipulating the database in the script, will get the format that the data is encapsulated as VRML support, and then the Script node is passed to the input interface domain of the other nodes. The program snippets are as follows: DEF example script { url "JavaScript: this.database.connect (databasetype, servername, username, password, databasename) RecordSet=this.database.execute (select * from databasetable where….) Variable_ changed=RecordSet"} In this way, other nodes can directly call data from the output interface.

Development of interactive virtual scene
The system stores the interactive virtual scene into the virtual instrument library. When a user selects a virtual instrument, a sample, or a measurement tool, the program retrieves the VRML files (.Wrl format) and the corresponding attribute information of these models from the virtual model library, and then uses the Group group nodes, the Transform group nodes, and the Inline group nodes to organize them. thus forming the virtual experiment scenario needed, its process is shown in Figure  3. For example, the vernier calipers and sample files containing dynamic information should be stored as Vernier.wrl and Sample.wrl respectively. When the user selects the vernier caliper and the tensile test sample, the system reads the two model files from the virtual scene library and their corresponding attribute information. After obtaining this information, the background program will automatically organize and transform the model files in order to form a unified and coordinated virtual experiment scene, so that the vernier caliper will dynamically measure the diameter of the sample. If different samples are selected, the system can read out different sample model scenes from the library, and the diameter of the selected specimen can be measured.
As shown in Figure 4, a vernier caliper measures the diameter of the virtual scene.

Conclusions
The virtual simulation experiment system based on VB and VRML provides a vivid 3D virtual scene. The interactive operation platform designed in this paper has strong interaction, operability and openness. The user can select the equipment to make up the virtual 3D scene for the experiment and provide a powerful online communication and answer module. The system makes up for the weakness of visibility and interaction in traditional simulation experiments, and widens the application field of virtual reality.