Physical modeling of daily electric appliances for education by Modelica

Modelica is very useful to make physical models in various engineering fields such as mechanical, electrical, thermal, fluid systems, etc. This capability of Modelica is also useful to educate students and engineers about many physical areas using simulation. The authors are posting serialized articles in a technical magazine about physical modeling of daily electric appliances by Modelica to educate readers about both physics and Modelica language in Japan. This paper introduces some examples of physical modeling of various appliances such as electric minicar, dryer and speaker by Modelica.


Introduction
Modelica is an equation based, object-oriented language for efficient modeling of complex, multi domain cyber physical systems described by ordinary differential, difference and algebraic equations. This feature of Modelica language is very useful for not only various industrial applications but also for education about physics and simulation for students and engineers. The authors are posting serialized articles in a technical magazine about physical modeling of daily electric appliances by Modelica to educate readers about both physics and Modelica language in Japan. This paper introduces some examples of physical modeling of various appliances. In section 2, modeling and simulation of a 4x4 electric minicar is described. In section 3, dryer is modeled and simulated. In section 4, modeling about a speaker is introduced.
2 Modeling of 4x4 electric minicar 4x4 electric minicars are a very popular toy in Japan. It consists of body, batteries, motor, gears, drive shafts and tires as shown in Figure 1. The physical model of the electric minicar is assumed as shown in Figure 2. The modeling was done to solve the following questions.
1) What is the maximum speed of the car? 2) How long can this car keep running? Thus, the battery model should consider the effect of voltage drop by the SOC (State Of Charge) change. In the body model running resistances should be considered.
Open circuit voltage: For the simplicity, is assumed to be proportional to the SOC. It will be more precise if the actual table of SOC vs OCV based on measurement will be used.

Modelica code of text-based model
By using the system of equations shown in the section 2.1, Modelica code of the text-based model becomes as below.

MSL-based model
Modelica model of this minicar can be built by using MSL as shown in Figure 3. Here a new class 'calcOCV' was created to model the SOC dependent OCV calculation as shown in the equations (2) and (3). Thanks to the Modelica feature of 'StateSelect' the rigidly coupled inertias of the motor, tire and the vehicle mass can be modeled separately.

Simulation results
To make the students understand both physics and Modelica features, both of the text code model and the MSL model were made and simulated. Figure 4 shows the results for short time range (upper figure) and for long time range (lower figure). In the upper figure, the results of vehicle speed for both the text code model (v) and the MSL model (vehicle.v) are compared. The effect of inertial elements can be seen. Also, as for the answers for the questions above, the results became as follows.
(1) The maximum speed of the car is about 6.1 m/s.
(2) The car can keep running for about 3840 sec. The structure of the target dryer is shown in Figure 5. For each part of the structure, the system of the equations and the model structure were considered as below. About the motor and the circuit, the system of the equations is same as the equations (4) to (6). As for mechanical loss, a damping loss and friction loss are considered as below.  (17) and (18) as shown in Figure 8.
The necessary heat flow to increase the temperature of the air is calculated by the following equation. ℎ = * * * Δ The electric circuit of the power supply using the fullwave rectifier circuit can be modeled as shown in Figure  9. Here switches are ignored. Finally the whole model of the dryer becomes as shown in Figure 10 by combining the component models of the each assembly parts (shown as red dashed rectangular in Figure 6, Figure 7 and Figure 9).    Figure 11 shows one result of the dryer model shown in Figure 10. It is confirmed that the motor voltage is fullwave rectified from the sinusoidal input voltage and the pump speed is controlled according to the motor voltage. Finally, the pipe air flow temperature is raised from 20 degC to about 65 degC.  To model the acoustic characteristics by an analogy of mechanical and electrical system, the equivalent elements shown in Figure 13 are considered [Lenk, 2011]. For the speaker shown in Figure 12, the acoustic resistance and the acoustic mass of the air oscillated by the cone become as below [Lenk, 1995].

Simulation results
Acoustic resistance: Acoustic mass: ( : sound speed of air, : density of air, : cone radius) Above equations are valid when the following condition is met.
Between the mechanical characteristics and the acoustic characteristics of the cone, the following equations hold.

Text code model of the speaker
Considering the equations (20) to (32), the text code model of the speaker becomes as follow.

Speaker model using MSL
To make the MSL based model of the speaker, the system is translated to the integrated mechanical model. From the equations (29) to (32), we obtain the following equation.
By using the equations (24), (25) and (33), the integrated equation as the mechanical region is obtained.
From the equations (21) to (23), we also obtain an equation about electrical system converted to the mechanical model. Here, the inductance of the coil L is ignored for the simplicity.
Finally, from the equations (34) and (35), an integrated equation of the total system as a mechanical expression is obtained as below.
To make a model of the equation (36) based on MSL, the following classes of the mechanical inductance, mechanical mass and mechanical admittance shown in the Figure 13 were made as follows. The icons of each class are shown in Figure 14.   Figure 15. Here the class "mechanicalFlow" converts a scalar input to force output.

Conclusion
Many physical models of daily appliances by Modelica were presented. Once the physical equations were determined, it was very easy and efficient to make the simulation models by Modelica. Both of text code model and MSL based model were developed and simulated. To learn about those physics and also Modelica modeling was very efficient for the education of students and engineers. For some examples such as fluid system of dryer, Modelica was also useful to solve the simultaneous equations for obtaining the design parameters.