CN112767799A - Software component packaging method based on electromagnetic experimental equipment - Google Patents

Software component packaging method based on electromagnetic experimental equipment Download PDF

Info

Publication number
CN112767799A
CN112767799A CN202110166891.8A CN202110166891A CN112767799A CN 112767799 A CN112767799 A CN 112767799A CN 202110166891 A CN202110166891 A CN 202110166891A CN 112767799 A CN112767799 A CN 112767799A
Authority
CN
China
Prior art keywords
equipment
packaging
function
software component
series
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
CN202110166891.8A
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.)
Jiangnan University
Original Assignee
Jiangnan 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 Jiangnan University filed Critical Jiangnan University
Priority to CN202110166891.8A priority Critical patent/CN112767799A/en
Publication of CN112767799A publication Critical patent/CN112767799A/en
Pending legal-status Critical Current

Links

Images

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/18Models for scientific, medical, or mathematical purposes, e.g. full-sized devices for demonstration purposes for physics for electricity or magnetism
    • G09B23/181Models for scientific, medical, or mathematical purposes, e.g. full-sized devices for demonstration purposes for physics for electricity or magnetism for electric and magnetic fields; for voltages; for currents

Abstract

The invention discloses a software component packaging method based on electromagnetic experimental equipment, which is based on three-dimensional modeling of the experimental equipment and realizes logic packaging of equipment elements and interactive operation based on the equipment. Firstly, constructing a three-dimensional model of an experimental apparatus, adding basic physical attributes on the outermost layer of a prefabricated body of the apparatus, and establishing a proper VR solution to realize interchangeability of the apparatus; then, the device elements based on two edge series and two terminals are classified and explained, and attribute components and functional logic are added under the electromagnetism engine. Finally, the encapsulation of the assets is quickly achieved using the engine development management framework. The method provides the most basic support for the later software development and architecture.

Description

Software component packaging method based on electromagnetic experimental equipment
Technical Field
The invention belongs to the technical field of interdisciplines combining virtual reality and electromagnetism, and particularly relates to a software component packaging method based on an electromagnetism experimental apparatus.
Background
The encapsulation of experimental equipment software components is a key problem in virtual experimental software of electromagnetism. At present, no virtual physical experiment platform aiming at electromagnetism exists internationally, and the existing virtual platform is complex in technical difficulty and low in universality. The related research and application of the domestic virtual reality technology in the electromagnetism experiment still stay in the initial stage, the research gravity center is biased to the realization of virtual simulation or virtual roaming, and the like, and the interaction sense is not strong.
Disclosure of Invention
The purpose of the invention is as follows: in order to overcome the defects in the prior art, the invention provides a software component packaging method based on an electromagnetic experimental apparatus by researching an electromagnetic virtual experiment. First, a three-dimensional model of the experimental equipment is constructed, and basic physical properties are added to the outermost layer of the prefabricated body of the equipment, and a proper VR solution is established to realize the interchangeability of the equipment. Then, the device elements based on two edge series and two terminals are classified and explained, and attribute components and functional logic are added under the electromagnetism engine. Finally, the encapsulation of the assets is quickly achieved using the engine development management framework. The method provides the most basic support for the later software development and architecture.
The technical scheme is as follows: in order to achieve the purpose, the invention adopts the technical scheme that:
the invention aims to provide a software component packaging method based on an electromagnetic experimental apparatus, which comprises the following steps:
step 1: constructing a three-dimensional model based on the fixture elements using the basic polygons;
step 2: and adding a physical attribute component and functional logic under an electromagnetism engine, namely endowing materials to the three-dimensional model, and realizing the packaging of equipment elements by using an engine development management framework.
Further, in step 1, a three-dimensional model of the device element based on two sides connected in series or two terminals is specifically established.
Further, the two-edge series connection-based equipment element is any one of a dry battery and a sliding rheostat.
Furthermore, the physical attribute components correspondingly added to the equipment elements with two edges connected in series are two edges Edge0 and Edge1 and their respective names; the added function logic is the function value provided by the device element as an input type device, and correspondingly comprises a rated total voltage value provided by a dry battery as a power supply, and the resistance of the slide rheostat is changed by the movement of the slide sheet.
Further, in step 1, specifically, the device component based on the two terminals is any one of a lead, a switch, a voltmeter, an ammeter, a light bulb, and an energized solenoid.
Furthermore, the physical property components correspondingly added to the device elements of the two binding posts are the two binding posts and the names of the two binding posts, and the added function logic is the function characteristics provided by the device elements as input type devices, and correspondingly comprises the following steps: the wire is used for connecting, the switch is used for controlling and communicating, the voltmeter and the ammeter are used for obtaining the deflection angle value and the measuring range of the pointer, the bulb is used for changing the brightness degree, and the electrified solenoid is used for controlling the magnetic pole direction.
The electrified solenoid is analyzed, the magnetic induction lines need to be visualized, the strength of the magnetic field range is controlled through the magnitude of current, the relation between the current and the magnetic field is established, and the magnetic field force of the small magnetic needle in the magnetic field is controlled to deflect correctly in real time, so that the demonstration of physical phenomena is emphasized, and the correlation between the magnetic field direction and the current direction is reflected.
The packaging method of the specific function mainly comprises two steps:
in a first step, the magnetic field characteristics of the energized solenoid are controlled.
And secondly, the small magnetic needle deflects under the action of magnetic field force in a magnetic field.
Further, the specific method for constructing the three-dimensional model in the step 1 is as follows: in Maya, a three-dimensional model is constructed with basic polygons and imported into Unity 3D.
Furthermore, the engine development management framework adopts a singleton mode, is a class independent of an engine, and is convenient for developers to complete the packaging of experimental equipment and the driving of an experimental process. There is one and only one instance in the running process of the whole program. Through the management framework, the engine integrates equipment packaging and experimental process driving together, and the equipment packaging and experimental process driving can be quickly realized. The management framework class mainly comprises the following functions:
the circuit calculates an entry function call (), scripts in the Unity 3D are executed according to the sequence of the default life cycle functions of the system strictly, and the functions are called in real time in Update ();
creating a function Create An Edge () of An equipment element with two binding posts for the equipment, or creating a function Create A Series Conn () of the equipment element with two sides connected in Series for the equipment; according to the characteristics of each equipment, an Edge () object or Series Conn () object is instantiated for the equipment by using an electric Manager; and a detection function Check Connect Event () for detecting whether the character string converted by the connection condition of the equipment is consistent with the experimental circuit diagram, and from the angle of the equipment, if the circuit is connected, the work of the whole experimental process can be driven.
Has the advantages that: compared with the prior art, the software component packaging method based on the electromagnetic experimental equipment has the following advantages that: the process of the packaging equipment used by the invention is mainly reduced according to the principle, some auxiliary teaching tools are added to improve the interest of the experiment, and the difficulty of knowledge understanding is reduced by separating the principle from multiple dimensions. In the process, the convenience of the operation of the experimenter in the virtual laboratory is also emphasized, the experimenter can independently complete the whole experiment after learning the virtual experiment operation for the first time, and the support is provided for the experiment process driving based on the electromagnetism engine.
Drawings
FIG. 1 is a 3D modular view of a dry cell battery with terminals;
fig. 2 is a 3D modeling diagram of a sliding varistor;
FIG. 3 is a 3D modeling diagram of a wire;
FIG. 4 is a view of the connection point of the lead ends and the posts;
FIG. 5 is a 3D modeling diagram of a knife switch;
FIG. 6 is a schematic diagram of the outer package of the voltmeter;
FIG. 7 is a 3D modeling diagram of an ammeter;
FIG. 8 is a schematic diagram of the effect of constructing a bulb particle system;
FIG. 9 is a schematic view of the position of the energized solenoid magnetic field;
FIG. 10 is an experimental detailed design of the energized solenoid;
FIG. 11 shows the experimental results of the energized solenoid, (a) the device is placed on the experimental table, (b) the circuit is connected according to the circuit diagram, (c) the slide plate moves to the position with the maximum resistance, (d) the switch is closed, (e) the magnetic induction line is in the first form, (f) the magnetic induction line is in the second form, (g) the magnetic induction line is in the third form, and (h) the magnetic induction line effect is achieved by changing the current direction;
fig. 12 is the performance of the apparatus in the experiment with (a) the wire connected to the terminal and (b) the knife switch open.
Detailed Description
The invention is further described with reference to the following figures and examples.
Examples
The present invention will be better understood from the following examples. However, those skilled in the art will readily appreciate that the specific experimental conditions and results described in the examples are merely illustrative of the invention and should not, nor should they limit the invention as detailed in the claims.
The invention relates to a software component packaging method based on electromagnetic experimental equipment, which is implemented according to the following steps:
step 1: constructing a three-dimensional model based on the fixture elements using the basic polygons;
step 2: and adding a physical attribute component and functional logic under an electromagnetism engine, namely endowing materials to the three-dimensional model, and realizing the packaging of equipment elements by using an engine development management framework.
Basic idea of three-dimensional modeling: firstly, constructing a three-dimensional model by using basic polygons; then, unfolding the model UV, drawing a map according to the UV, giving materials to the model, and pasting the drawn map; and finally, adding basic physical properties to the outermost layer of the prefabricated bodies of all the equipment models.
The method builds a VR solution with a VRTK plug-in, taking into account the interchangeability of appliances. Corresponding scripts are added on the outermost layer of the equipment element prefabricated body and the specific nodes of the interactive model, and the control of the equipment details is realized. Finally, each device completes the packaging of the specific function according to the functional characteristics of the device.
In addition, the invention uses the engine development management framework to rapidly realize the encapsulation of the equipment. The engine development management framework is an engine-independent electric Manager, and is convenient for developers to complete the packaging of experimental equipment and the driving of an experimental process.
The class adopts a singleton mode, and the whole program has one and only one instance in the running process. The class mainly includes the following functions:
the circuit calculates an entry function;
creating a function of an equipment element with two binding posts for the equipment, creating a function of the equipment element with two edges connected in series for the equipment, and instantiating an edge object or a series object by using a class as the equipment according to the characteristics of each equipment;
and the detection function is used for detecting whether the character string converted by the equipment connection condition is consistent with the experimental circuit diagram or not, and from the angle of the equipment, if the circuit is communicated, the whole experimental process can be driven to work.
The management framework integrates equipment packaging and experimental process driving.
Example 1: and establishing a three-dimensional model based on the equipment elements with two edges connected in series, and adding an attribute component and functional logic under an electromagnetism engine to realize the packaging of the equipment elements.
Example 1.1: a three-dimensional model of a dry cell as a two-sided series connected fixture element is shown in figure 1.
The dry cell is a self-connection of two cells, and belongs to an equipment element with two edges connected in series. When a dry cell is used as a three-dimensional model of a device element with two sides connected in series, the physical properties of the dry cell are as follows: its edges Edge0 and Edge1 are named separately. All the equipment elements have a set of standard character string constant names, a rated voltage value is given, a value to be set can be filled in an attribute panel of the equipment and is used as the voltage of any Edge0/Edge1 of the equipment, namely the total voltage of a circuit; the dry cell has small internal resistance of 0.000001 omega as the resistance of any one side.
The functional logic of the dry battery is as follows: the function of the dry battery is analyzed, and the dry battery is used as a power supply in the circuit and provides a rated total voltage value for the circuit world in which the dry battery is located as an input type device. It is only necessary to take into account some of the characteristics of the apparatus itself and not the relationship between it and another apparatus. The packaging method of the dry battery comprises the following steps: firstly, instantiating an object for a dry cell; then, a rated voltage value is given, and the voltage value of any one side of the voltage value can be set; a small internal resistance is set as the resistance of any one side. And finally, initializing two binding posts of the dry battery through the engine.
Example 1.2: a three-dimensional model of a sliding varistor as a two-sided series connected fixture element is shown in fig. 2.
The physical properties of the sliding varistor are: two edges and their respective names. The maximum resistance value of the slide rheostat is 25 omega, the upper two terminals are initialized to Vertex1, and the lower two terminals are respectively initialized to Vertex0 and Vertex 2.
The functional logic of the slide rheostat is as follows: the function of the slide rheostat is analyzed, whether the movement of the slide sheet can change the resistance of the slide rheostat or not is mainly obtained, the difference of the wire connection modes reflects the difference of the resistance, and if the wrong connection is carried out, the resistance value is 0 or becomes a fixed value resistance.
The slide rheostat can be seen as a two-edge series-connected equipment element by combining an electrical engine, and the packaging method comprises two steps:
in the first step, the movement of the slide rheostat is controlled, and the position of the slide on the metal rod is determined. Firstly, establishing a commission function on drawer Value Changed of the position change of the slide sheet, wherein a variable parameter in the commission function is a float variable which refers to the position of the current slide sheet on the current metal rod and has the size of 0-1; the movement of the slide is a range limited reciprocating motion with a default position in the middle of the metal rod. Enumeration may be used to extend the movement in one direction axis to X, Y, Z, selecting which axis to move in through Switch statements, and assigning the final coordinates to moving objects again. Regardless of the wire connection mode, the movement of the sliding piece on the metal rod is controlled by the operation timing of the handle trigger, and the movement is a reciprocating motion with limited range.
In the second step, the magnitude of the sliding varistor resistance is changed. The state of the circuit is affected by the position of the slider and changes accordingly. First, an object is instantiated for the sliding rheostat, containing its respective named edge and maximum resistance value, initializing three posts. Calling a commission function in the first step, using + and-binding a specific operation method On Resistor Value Changed (float range), dynamically obtaining a new position range in real time, allocating the resistors of two edges Edge0 and Edge1 according to the range, and specifically setting an algorithm pseudo code of the resistance Value of the sliding rheostat as follows:
Figure BDA0002937860810000051
Figure BDA0002937860810000061
example 2: and establishing a three-dimensional model based on equipment elements of the two binding posts, and adding an attribute assembly and functional logic under an electromagnetism engine to realize the packaging of the equipment elements.
Example 2.1: a three-dimensional model of the fixture element with the wire as two posts is shown in fig. 3.
The physical properties of the wire are: firstly, establishing a Rope object Obi Rope, editing Obi Curve, controlling the shape of the Rope, adding two control points at two ends of a wire, then controlling and adjusting parameters such as elasticity coefficient, length, thickness and the like, adding two Obi Pin Constraints at two ends, connecting the Rope and the U-shaped end of the wire into a whole, editing Edit features, setting the characteristics of the joint points on the Rope body, and finally finding an Initialize button in an attribute panel to create the Rope, wherein the Rope is the flexible wire.
The functional logic of the wire is: analyzing the functions of the wires, and finding that the wires are media for communicating the whole circuit; the length of the wire needs to be changed correspondingly along with the movement of the wire end, and the current flow effect after the circuit is connected is displayed on the wire. One example of this is: executing a delegation binding method, namely judging whether the current end is connected or not after the start end or the end is held by hand, if so, changing the stritchingScale parameter of the Obi Rope to be 2, and executing a PushDataToSolver () method; after the start end or the end is put down from the hand, whether the connection exists at the current end or not is judged, if the connection is disconnected, the strotchingScale parameter of the Obi Rope is changed to be 1, and a PushDataToSolver () method is executed; when ontouche () touches the wire end, gravity is added to the wire end, canceling the isKinematic. And finally, setting the flowing effect of the current on the wire, which is to put the real-time dynamic Update in an Update () function. Functionally, the wire only needs to play a connecting role, but from the practical point of view, some humanized functions, such as contact effect, can be added to the wire.
And adding an interactive script of basic physical attributes and a VRTK plug-in unit, a rigid body script and a collision box at the two ends of the start and the end of the lead respectively. Only the interaction script needs to be added to the outermost layer so as to realize the overall control of the equipment.
The packaging method of the specific function mainly comprises four steps:
firstly, establishing the connection relation between the wire end and the terminal post.
The base class of connecting the wire ends and the terminals mainly comprises two attributes: one is a read-only attribute device of the connection state, control the connection state of the wire and the terminal post; the other is the get/set attribute of the circuit data node. Finally, the vertices of the edge where the device is located are initialized by the engine when all devices are packaged. The specific class diagram is shown in fig. 4.
And secondly, finishing the function of the wiring terminal aiming at the connection of the conducting wire.
Bright effect of binding post
The special bright effect is that when the U-shaped end of the wire touches the binding post, a bright prompt is provided on the binding post, and the prompt can make an experimenter understand that the wire can be connected when the experimenter looses his hands. When the conducting wire is connected or leaves the range of the binding post, the light prompt is closed. Interfaces for bright light special effect opening and closing methods are provided, respectively.
② a fixed connecting direction is given when the conducting wire is connected
The wire is connected to the binding post, the end of the wire is fixed and cannot move due to the movement of the equipment, and one binding post can be connected with two wire ends due to the existence of a voltage meter of the measurement type equipment. To solve this problem, when packaging the equipment, two empty objects are established under each terminal model, and the positions and angles of the empty objects are the positions and angles of the leads connected to the terminals.
Third, a flexible lead is created, and the state of the lead end is controlled.
Firstly, a flexible conductor is established
Firstly, a rope object is established, a script is edited to control the shape of the rope, and two control points are added at two ends of a wire. And then controlling and adjusting physical parameters, and adding two point scripts at two ends to connect the rope and the U-shaped end of the wire into a whole. After the characteristics of the joint points on the rope body are set, a flexible wire is created.
Second, a method of adding a commission to the operation of a wire end
Firstly, distinguishing lead ends in a lead end script, wherein one end is a start and the other end is an end; then, establishing an instant entrusting that the lead end is taken on the hand and taken off the hand, and an entrusting when the lead end is touched; finally, the reference that the delegate points to the function is stored. Taken method in Hand during the below wire connected state grabbed event, dropped method from Hand during the below wire connected state ungbbed event, touch wire end method On touch () is directly in the On Hand lever Begin (Hand) method which overwrites the handle interaction. The specific entrusting method comprises the following steps:
Figure BDA0002937860810000081
wire end triggering detection binding post
And detecting the collision occurrence by using a trigger, and acquiring the object in the trigger area.
Wire connected state control
Where events are invoked by which the attributes and state of the wire ends are controlled.
And fourthly, completing the electrical function of the lead according to the engine principle, and controlling the plug-in and the two ends of the lead on the outermost layer from the whole.
Firstly, instantiating an edge object for a wire based on the design principle of an electrical engine, and initializing vertexes of two ends of the wire; then, executing a entrusting and binding method, and adding gravity to the wire end and canceling related attributes when the wire end is touched; and finally setting the flowing effect of the current on the wire.
Example 2.2: the switch is a three-dimensional model of the fixture element for both terminals, and the three-dimensional model of the knife switch is shown in fig. 5.
The physical properties of the switch are: the switch designation, and the small internal resistance, of 0.000001 Ω, are approximately ideal, and the two terminals are initialized.
The functional logic of the switch is as follows: the function of a knife switch in the switch is analyzed, the main performance of the knife switch is embodied in that a knife handle moves, and whether a circuit is connected or not is determined when the switch is in a closed state or an open state. And when the switch is closed quickly and is taken away immediately, the trial touch operation of other circuit elements with abnormal phenomena is observed in the process.
The packaging method of the specific function mainly comprises two steps:
firstly, controlling the movement of a knife handle and judging the state of a switch.
A delegation mechanism OnSwitchChangeState is first established for changing the state of the switch, the parameter being a pool variable, so that this state can be called up at the circuit logic. The state of the switch is a global cool variable, where there are two important operations: firstly, the state GetSwitchState () of the switch can be taken, and the bol variable of the state is directly returned; secondly, change the state of the switch ChangeSwitchState (), state! state, and stores the reference OnSwitchChangState (state) delegated to the function. And then the switch state is judged by utilizing the operation time of the handle trigger. And calculating the movement of the switch knife handle according to the positions of the hand and the knife handle so as to judge the state of the switch.
In the second step, the circuit state is changed correspondingly under the influence of the switch.
Based on the design principle of an electrical engine, an edge object is instantiated for the knife switch, and initialization operation is carried out on two binding posts. The first step of the switch state change request function is then invoked, and the method changes the state of the circuit in the engine by binding a specific operation method, and combines the circuit connection with the switch state, so that the motion state of the switch directly affects the circuit.
Example 2.3: a three-dimensional model of the fixture element with the voltmeter as two posts is shown in fig. 6.
The physical properties of the voltmeter are as follows: the voltmeter is named, and the voltmeter has huge internal resistance, and the size of the voltmeter is 10000000 omega. The function of the voltmeter is analyzed, the voltage condition of the circuit to be measured is fed back mainly through the reading of the pointer in the circuit, and the zero setting operation of the pointer, so the main performance is reflected in the selection of the pointer swing and the voltage measuring range. The function logic of the voltmeter is as follows; and performance characterization of pointer swing and voltage range. And initializing all the terminals, wherein two red terminals are initialized to Vertex0 at the same time, a black terminal is initialized to Vertex1, and judging which terminal is connected after connection, wherein circuit logic calculation is carried out in real time, so that the logic of the circuit calculation is put in an Update () function. A local variable is set, and when one range is selected, the value of the local variable is changed to prevent the next frame from being called again.
The packaging method of the specific function mainly comprises two steps:
in the first step, a binding post connected with a lead is selected.
For a voltmeter fixture element, based on the design principle of the electrical engine, we only need to instantiate an edge object for the fixture. The voltmeter has two red positive terminals as the distinction of measuring range. Initializing all the binding posts, judging which binding post is connected after connection, and calculating the logic of the circuit in real time.
In the second step, the pointer is deflected by a suitable angle.
For the pointer, a random deflection angle is given when the pointer is loaded from the system, and in the Awake () function, two random function operations are used, firstly random in the random. range (0,2) direction, which may be forward deflection or reverse deflection, and then random in the random. range (0,5) deflection angle, and the result of the two random operations is applied to the local Euler Angles (local Euler Angles) of the pointer. Meanwhile, a get/set attribute device of an angle value Turn Degreee is set, the angle value of the pointer can be obtained in the outer-layer encapsulation logic of the voltmeter, and the angle value of the current pointer can be set by adjusting the zero setting knob.
For the zero setting knob, when the handle touches the zero setting knob, the forefinger pulls the button to directly make the local Euler Angles (local Euler Angles) of the pointer equal to Vector3(0,0,0), and the angle value of the pointer is set to be 0, so that the difficulty of equipment interaction is increased if a tool is used to rotate the knob like the reality.
Example 2.4: a three-dimensional model of the fixture element with the ammeter as two posts is shown in fig. 7.
The function of the current meter is analyzed, and mainly the current condition of the circuit to be measured and the zero setting operation of the pointer are fed back through the reading of the pointer in the circuit. Like the voltmeter in step 4.3, the performance is mainly reflected in pointer swing, and the current range is also selected.
Physical properties of the ammeter: instantiating an Edge () object for the fixture, comprising: the ammeter has very small internal resistance and is 0.000001 omega in size.
The functional attributes of the ammeter are as follows: and (4) performance characterization of pointer swing and current measuring range.
The packaging method of the specific function comprises the following steps:
the current value Ampere Values is taken directly from the circuit world of the engine. The ammeter is provided with two red positive terminals, and as the distinction of measuring ranges, all the terminals are initialized at the beginning, the two red terminals are initialized to Vertex0 at the same time, the black terminal is initialized to Vertex1, and after connection, the connected terminals are judged.
The circuit logic calculation is carried out in real time in the Update () function. The code in the Update () function is called every frame, where a local variable is set, and when one of the ranges is selected, the value of the local variable is changed to prevent the next frame from being called again.
For the pointer, a random deflection angle is given when the pointer is loaded from the system, and the result of two times of random is acted on the local Euler Angles (local Euler Angles) of the pointer as the same as a voltmeter; meanwhile, a get/set attribute device of an angle value Turn Degrid is set, the angle value of the pointer can be obtained in the outer-layer encapsulation logic of the ammeter, and the angle value of the current pointer can be set after the zero adjustment knob is adjusted by the knob; for the zero setting knob, when the handle touches the zero setting knob, the index finger pulls the button to directly enable the angle value of the pointer to be 0, and the specific pointer deflects by an algorithm of a proper angle and deflects by the pointer of the voltmeter.
Example 2.5: the bulb acts as a three-dimensional model of the fixture element of the two posts.
The function of the bulb is analyzed, mainly when current passes through the circuit, the light effect of the bulb is vividly presented, and the light effect changes correspondingly along with the change of the current, and the power consumption condition and the light of the bulb in the circuit are different according to the different power specifications of the bulb.
The physical properties of the bulb are: bulb and its name. The functional logic is as follows: the power consumption is changed, and the brightness is changed, namely, the power consumption situation and the brightness in the circuit are different.
The packaging method of the specific function mainly comprises two steps:
firstly, determining the internal resistance of the bulb according to different powers.
Firstly, the specific power of the bulb is determined, and a number is randomly set as the serial number of the bulb electric power array, namely the current power of the bulb. Then, based on the design principle of an electrical engine, only one edge object needs to be instantiated for the equipment, the two wiring posts are initialized, a rated voltage value is given, and the resistance value of the bulb is calculated through the rated voltage and the power.
In the second step, the brightness of the lamp changes with the current.
Firstly, a Particle System (Particle System) of bulb light is constructed, then the current magnitude is calculated in Update (), and the Particle System is controlled to change the brightness of the bulb in real time according to the calculated current magnitude.
Build particle system of bulb light
A new Particle System is added in the System, the Particle System is simulated or stopped through a dialog box at the lower right corner of a scene view, a plurality of setting modules of the Particle System are arranged in the attribute panel, the setting modules are similar to meat and bones of the Particle System, a plurality of parameters such as the emission speed, the shape, the color and the quantity of the particles can be set, and the effect of the set Particle System is shown in fig. 8 (a).
② real-time control particle system
After the particle system is constructed, it is drawn into the bulb preform and placed at the bulb envelope, as shown in fig. 8 (b). The particle system is controlled with associated algorithms to vary bulb variations by varying the particle's emission speed, shape, color, number, etc. according to the specific power.
Example 2.6: the energized solenoid creates a magnetic field around it, which builds a three-dimensional model of the device as a two-terminal device element.
The electrified solenoid is analyzed, the fact that the electrified solenoid generates a magnetic field is considered, magnetic induction lines need to be visualized, the strength of the magnetic field range is controlled through the magnitude of current, the relation between the current and the magnetic field is established, and the magnetic field force of a small magnetic needle in the magnetic field is utilized to conduct real-time and correct deflection, the demonstration of physical phenomena is emphasized, and the fact that the direction of the magnetic field is related to the direction of the current is reflected.
The packaging method of the specific function mainly comprises two steps:
in a first step, the magnetic field characteristics of the energized solenoid are controlled.
Setting magnetic pole of solenoid
The concept of establishing a magnetic pole on a solenoid, and establishing a hollow object at both ends of a wire of a solenoid model as the position of the magnetic pole. The default magnetism is neutral, since the pole direction cannot be determined.
② setting the direction and magnetic field of the magnetic pole
An edge object is instantiated for the fixture and two studs are initialized. And the current of the current circuit is acquired in real time, so that the magnetic pole direction is controlled in real time. If current passes through the magnetic induction line effect can be displayed.
And secondly, the small magnetic needle deflects under the action of magnetic field force in a magnetic field.
Definition of magnetic field position
Magnetic fields are arranged inside and outside the energized solenoid, and the small magnetic needle is subjected to the action of the magnetic force. In the solenoid, the magnetic field is uniformly distributed, the small magnetic needle is acted by constant magnetic field force, a hollow object is established in the solenoid model, and a capsule collision box is added in the magnetic field at the position; and then, judging whether the small magnetic needle is in the magnetic field by using Trigger detection functions of On Trigger Enter () and On Trigger Exit () referred by software. As shown in fig. 9.
② small magnetic needle deflection in magnetic field
And calculating the acting force of the magnetic pole charges and the small magnetic needle, and calculating the stress condition of the small magnetic needle in a magnetic field generated by the energized solenoid by using a particle model. The magnetic poles at the two ends of the solenoid are approximately regarded as point charges, and the small magnetic needle is regarded as a mass point regardless of the size and the shape of the small magnetic needle. The stress of the small magnetic needle in the magnetic field is simplified into the calculation of the coulomb force of two point charges to one mass point.
The deflection of the small magnetic needle is divided into two conditions, namely inside the magnetic field and outside the magnetic field, wherein the magnetic field is uniformly distributed, and only the polarities of the two ends of the solenoid are considered. And (3) outside the magnetic field, calculating the coulomb force of the two magnetic poles to the small magnetic needle, thereby changing the angle of the small magnetic needle.
Fig. 10 is a detailed design diagram of an experiment of the energized solenoid, in the experiment process, along with the change of current, the small diamond magnetic needle moves in different places of a magnetic field, and the rotation of the small diamond magnetic needle is correspondingly changed with the slow motion effect, so that the experiment not only meets the objective fact, but also shows the good performance of the equipment. The sliding rheostat changes the resistance, so that the current in the circuit changes, and the physical model of the external magnetic field of the solenoid also changes. When the direction of the current flowing into the solenoid changes, the direction of the magnetic field is related to the direction of the current flowing around the solenoid, taking care of the change in the orientation of the small magnetic needle.
The results of the experiment performed in the virtual experiment operation with respect to the energized solenoid experiment are shown in fig. 11. The method comprises the following steps of (a) entering an experiment, placing equipment on an experiment table, (b) opening a switch, connecting a circuit according to a circuit diagram, (c) moving a slide rheostat slide sheet to the maximum position, (d) closing the switch, enabling current to flow on a lead, (e) being a first form of a magnetic induction line, (f) being a second form of the magnetic induction line, (g) being a third form of the magnetic induction line, and (h) changing the lead connection direction of a solenoid terminal so as to change the direction of current flowing into the solenoid.
It can be observed from fig. 11(b) that the wire with Obi Rope performs well, the length can be changed freely to adapt to the connection between the equipments, the wire end and the binding post are fixedly connected, and the white hand model is the handle for interaction in the virtual experiment. Comparing fig. 11(c) and fig. 11(d), it can be observed that the direction of the magnetic needle is changed, magnetic field force is generated around the solenoid due to the action of the current, and the white color block on the wire after the switch is closed is the effect of current flow, so that the current flow direction is visualized. Fig. 11(e), 11(f) and 11(g) are different magnetic field patterns, respectively, and can make students at different levels know different knowledge levels. Comparing fig. 11(f) and 11(h), it can be observed that, by changing the direction of the current flowing into the solenoid, the deflection of the small magnetic needle is opposite, and the direction of the generated magnetic field is changed accordingly, which accords with the experimental principle and achieves the purpose of the experiment.
Fig. 12 shows the performance of the apparatus in an experiment in which (a) one end of the wire is connected to the knife switch and the other end is connected to the light bulb, and (b) the knife switch is open. The connection of the lead and the disconnection of the switch are very realistic, the operation in a virtual environment can completely replace the practical experiment operation, and the experiment has good performance.
The above description is only of the preferred embodiments of the present invention, and it should be noted that: it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the invention and these are intended to be within the scope of the invention.

Claims (8)

1. A software component packaging method based on electromagnetic experimental equipment is characterized in that: the method comprises the following steps:
step 1: constructing a three-dimensional model based on the fixture elements using the basic polygons;
step 2: and adding a physical attribute component and functional logic under an electromagnetism engine, namely endowing materials to the three-dimensional model, and realizing the packaging of equipment elements by using an engine development management framework.
2. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 1, wherein: in the step 1, a three-dimensional model of the equipment element based on two sides connected in series or two binding posts is established.
3. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 2, wherein: the two-edge series connection based equipment element comprises any one of a dry battery and a sliding rheostat.
4. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 3, wherein: the physical attribute components correspondingly added to the equipment elements with two edges connected in series are two edges Edge0 and Edge1 and respective names; the added function logic is the function value provided by the device element as an input type device, and correspondingly comprises a rated total voltage value provided by a dry battery as a power supply, and the resistance of the slide rheostat is changed by the movement of the slide sheet.
5. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 2, wherein: the two-terminal based fixture element comprises any one of a lead, a switch, a voltmeter, an ammeter, a lamp bulb and an energized solenoid.
6. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 5, wherein: the physical property component that the equipment component of two terminals corresponds to and adds is two terminals and respective nomenclature, and the functional logic that adds for the equipment component is as the functional characteristic that input type equipment provided, and what correspond includes: the wire is used for connecting, the switch is used for controlling and communicating, the voltmeter and the ammeter are used for obtaining the deflection angle value and the measuring range of the pointer, the bulb is used for changing energy consumption and changing the brightness degree, and the electrified solenoid is used for controlling the magnetic pole direction.
7. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 1, wherein: the specific method for constructing the three-dimensional model in the step 1 comprises the following steps: in Maya, a three-dimensional model is constructed with basic polygons and imported into Unity 3D.
8. The method for packaging a software component based on an electromagnetic experimental apparatus according to claim 1, wherein: the engine development management framework is an Electrical Manager adopting a singleton mode, and the class of the engine development management framework comprises:
the circuit calculates an entry function call ();
creating a function Create An Edge () of An equipment element with two binding posts for the equipment, or creating a function Create A Series Conn () of the equipment element with two sides connected in Series for the equipment;
a detection function Check Connect Event () for detecting whether the character string converted by the equipment connection condition is consistent with the experimental circuit diagram;
the method comprises the following steps that scripts in the Unity 3D are executed according to a default life cycle function sequence of a system, and a circuit is called in real time in Update () to Calculate an entry function call (); then, according to the characteristics of each equipment, An Edge () object or a Series Conn () object is instantiated for the equipment by using a Create An Edge ()/Create A Series Conn () function; and finally, detecting whether the character string converted by the connection condition of the equipment is consistent with the experimental circuit diagram through a detection function Check Connect Event (), and driving the work of the whole experimental flow if the circuit is connected.
CN202110166891.8A 2021-02-07 2021-02-07 Software component packaging method based on electromagnetic experimental equipment Pending CN112767799A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110166891.8A CN112767799A (en) 2021-02-07 2021-02-07 Software component packaging method based on electromagnetic experimental equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110166891.8A CN112767799A (en) 2021-02-07 2021-02-07 Software component packaging method based on electromagnetic experimental equipment

Publications (1)

Publication Number Publication Date
CN112767799A true CN112767799A (en) 2021-05-07

Family

ID=75705178

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110166891.8A Pending CN112767799A (en) 2021-02-07 2021-02-07 Software component packaging method based on electromagnetic experimental equipment

Country Status (1)

Country Link
CN (1) CN112767799A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211273A (en) * 2006-12-25 2008-07-02 上海科泰世纪科技有限公司 Method for automatic creation for Singleton mode in component programming
CN102509485A (en) * 2011-11-17 2012-06-20 北京联合大学 Method for building virtual experiment information representation model
CN103164545A (en) * 2011-12-09 2013-06-19 北京邮电大学 Visual editing method of virtual electronic components
CN103530898A (en) * 2013-01-06 2014-01-22 Tcl集团股份有限公司 Animation processing method and system based on 3D real-time rendering
CN103617120A (en) * 2013-12-05 2014-03-05 北京奇虎科技有限公司 Unit testing method and device
CN109814848A (en) * 2019-02-21 2019-05-28 广州卓远虚拟现实科技有限公司 A kind of general dynamic engine of virtual reality
CN110428684A (en) * 2019-07-19 2019-11-08 暨南大学 The Physical Experiment artificial intelligence automotive engine system and working method of virtual reality
CN111524221A (en) * 2020-03-24 2020-08-11 常州工学院 Virtual simulation experiment manufacturing system based on Unity platform
CN111897461A (en) * 2020-07-09 2020-11-06 北京国发天元信息技术有限公司 Internet-based interactive virtual experiment implementation method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211273A (en) * 2006-12-25 2008-07-02 上海科泰世纪科技有限公司 Method for automatic creation for Singleton mode in component programming
CN102509485A (en) * 2011-11-17 2012-06-20 北京联合大学 Method for building virtual experiment information representation model
CN103164545A (en) * 2011-12-09 2013-06-19 北京邮电大学 Visual editing method of virtual electronic components
CN103530898A (en) * 2013-01-06 2014-01-22 Tcl集团股份有限公司 Animation processing method and system based on 3D real-time rendering
CN103617120A (en) * 2013-12-05 2014-03-05 北京奇虎科技有限公司 Unit testing method and device
CN109814848A (en) * 2019-02-21 2019-05-28 广州卓远虚拟现实科技有限公司 A kind of general dynamic engine of virtual reality
CN110428684A (en) * 2019-07-19 2019-11-08 暨南大学 The Physical Experiment artificial intelligence automotive engine system and working method of virtual reality
CN111524221A (en) * 2020-03-24 2020-08-11 常州工学院 Virtual simulation experiment manufacturing system based on Unity platform
CN111897461A (en) * 2020-07-09 2020-11-06 北京国发天元信息技术有限公司 Internet-based interactive virtual experiment implementation method

Similar Documents

Publication Publication Date Title
CN109784293A (en) Multi-class targets method for checking object, device, electronic equipment, storage medium
CN105159754B (en) In-circuit emulation method and device based on business intelligence cloud platform
CN110244851A (en) Electric power skills training householder method and system based on virtual reality technology
CN110910703A (en) Virtual simulation intelligent electrician wiring teaching training system
CN106872901B (en) KiBaM- fractional order equivalent circuit comprehensive characteristics battery model and parameter identification method
Gomes et al. Gelsight simulation for sim2real learning
CN112767799A (en) Software component packaging method based on electromagnetic experimental equipment
Harel et al. Reactive animation
CN103278788B (en) A kind of Hall plate simulation model
Sanchez Polyomino–Reconsidering Serial Repetition in Combinatorics
Kögler Simulation and visualization of agents in 3d environments
Zhu et al. Design and Implementation of Digital Circuit Virtual Simulation Experimental System Based on Serious Games
Svajger et al. Discovering electricity by computer-based experiments
Dahlberg Electricity in a 2D mechanicssimulator for education
CN112840390B (en) Fast, efficient real-time electromagnetic system emulator that dynamically accepts user input
CN104572250B (en) A kind of method for realizing intelligent electric energy meter and calibration equipment emulation
Adamo-Villani et al. A photorealistic 3d virtual laboratory for undergraduate instruction in microcontroller technology
Zhang et al. Implementation and verification of a virtual testing system based on ROS and unity for computer vision algorithms
You et al. Component-Based Virtual Instrument in Network 3D Virtual Experiment
Qu et al. Virtual maintenance system for a certain equipment based on unity3d
Li et al. Design of VR Experimental System Based on Leap Motion Gesture Recognition
CN103678806B (en) A kind of incense coil spring model simulating torsional deformation of flexible body
CN117541713A (en) Variable element universe scene building method and system based on illusion engine
US20070129918A1 (en) Apparatus and method for expressing wetting and drying on surface of 3D object for visual effects
CN106847028B (en) A kind of physical electronic experiment instrument

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