system simulation using vhdl-ams: modeling … · © 2010 ansys, inc. all rights reserved. 1 ansys,...
TRANSCRIPT
© 2010 ANSYS, Inc. All rights reserved. 1 ANSYS, Inc. Proprietary© 2010 ANSYS, Inc. All rights reserved. 1 ANSYS, Inc. Proprietary
System Simulation
Using VHDL-AMS:
Modeling Multiple
Physical Domains for
HEV Applications
Xiao Hu
Scott Stanton
Vincent Delafosse
ANSYS Inc.
© 2010 ANSYS, Inc. All rights reserved. 2 ANSYS, Inc. Proprietary
Introduction
• Overview of VHDL-AMS
• Applications:
– Battery: Electrochemistry
– Heat Exchanger: Fluid, Thermal
© 2010 ANSYS, Inc. All rights reserved. 3 ANSYS, Inc. Proprietary
What is VHDL-AMS?
VHDL-AMS is a strict superset of IEEE Std. 1076
Very High Speed Integrated Circuit Hardware
Description Language – Analog and Mixed-Signal
1993 1999
IEEE 1076
VHDL
IEEE 1076.1
VHDL-AMS
Description
& simulation
of event-
driven
systems
Description &
simulation of
analog and
mixed signal
circuits and
systems
© 2010 ANSYS, Inc. All rights reserved. 4 ANSYS, Inc. Proprietary
Why Use VHDL-AMS
• Standard Format Allows Model Portability
– Different engineering groups within same
company
– With Sub-Contractors
– Between different simulators
• Multi-level Modeling
– Different levels of abstraction of model behavior
• Multi-domain Modeling
– Electrical, Thermal, Magnetic, Mechanical, etc
• Mixed-signal Modeling
– Supports analog and digital modeling
© 2010 ANSYS, Inc. All rights reserved. 5 ANSYS, Inc. Proprietary
Architecture 3
Architecture 2
Architecture 1
VHDL-AMS Model Construct
• Entity– Interface description of a
subsystem or physical
device
– Specifies input and output
ports to the model
• Architecture– Behavior description
– Can be dataflow, structural,
procedural, etc
– Modeling can deal with both
analog (continuous) and
digital (discrete) domains
output ports
input ports
In-out ports
Architecture 2
Architecture 1
Entity
© 2010 ANSYS, Inc. All rights reserved. 6 ANSYS, Inc. Proprietary
VHDL-AMS Code for a Resistor
LIBRARY Ieee;
use Ieee.electrical_systems.ALL;
ENTITY vhdl_resistor IS
GENERIC (
resistance : resistance := 1.0e3
);
PORT (
QUANTITY temp : IN real := 300.0;
TERMINAL p : electrical;
TERMINAL n : electrical
);
END ENTITY vhdl_resistor;
• Entity– Interface description of a subsystem
or physical device
– Specifies input and output ports to
the model
The resistor
model has one
model constant,
one input quantity,
and two terminals
resistor
Current
Voltage
p m
Resistance value
Temperature
© 2010 ANSYS, Inc. All rights reserved. 7 ANSYS, Inc. Proprietary
VHDL-AMS Code for a Resistor
ARCHITECTURE arch_vhdl_resistor OF vhdl_resistor IS
QUANTITY voltage ACROSS current THROUGH p TO n;
BEGIN
voltage == current * resistance;
END ARCHITECTURE arch_vhdl_resistor;
• Architecture– Description of the model and no solving information is required
No solving
information is
needed!!
ARCHITECTURE arch_vhdl_resistor OF vhdl_resistor IS
QUANTITY voltage ACROSS current THROUGH p TO n;
BEGIN
voltage == current * resistance * (1.0+1.0e-
2*(temp-300.0)+1.1e-3*(temp-300.0)**2);
END ARCHITECTURE arch_vhdl_resistor;
A second
architecture is
possible!!
© 2010 ANSYS, Inc. All rights reserved. 8 ANSYS, Inc. Proprietary
VHDL-AMS Code for a Capacitor
LIBRARY Ieee;
use Ieee.electrical_systems.ALL;
ENTITY cap IS
GENERIC (
capacitance : capacitance := 1.0e-3
);
PORT (
QUANTITY init_v : IN voltage := 0.0;
TERMINAL p : electrical;
TERMINAL n : electrical
);
END ENTITY cap;
ARCHITECTURE arch_cap OF cap IS
QUANTITY voltage ACROSS current THROUGH p TO n;
BEGIN
IF (domain = quiescent_domain) USE
voltage == init_v;
ELSE
current == capacitance * voltage'dot;
END USE;
END ARCHITECTURE arch_cap;
The capacitor
entity has one
model constant,
one input, and two
terminals
The model description essentially
has two lines, one for initial
condition and one for the
governing equation!!
• Entity • Architecture
© 2010 ANSYS, Inc. All rights reserved. 9 ANSYS, Inc. Proprietary
Open VHDL-AMS Basic Library
PM Motor example
© 2010 ANSYS, Inc. All rights reserved. 10 ANSYS, Inc. Proprietary
Open VHDL Basic Library
© 2010 ANSYS, Inc. All rights reserved. 11 ANSYS, Inc. Proprietary
The modeling of side-force by a
tire.
Slip rate
Side angle
Tra
ction f
orc
e,
Sid
e f
orc
e [
kgf]
Perpendicular load 380[kgf]
Side forceSlip rate
Slip
Vehicle speed
Slip angle
Rotational
Speed of tire
Load
Force of Rack F
Diagram of side force of Tire
Gap of a rack and rotational center : R
Sidewall equivalent radius : Rc
Ref. ISBN 4-381-08855-7
Fs
v
vV
mg
© 2010 ANSYS, Inc. All rights reserved. 12 ANSYS, Inc. Proprietary
VHDL-AMS code
RV
FRT
),(
/)(
SlipF
dt
VVSlip
lookup
vvv
)( FsRTJ
mgFs
begin
T == R * F ;
V == omg * R ;
if(vv'dot < 0.0) use
slip_rate == (vv-ww)/vv ;
else
slip_rate == (ww-vv)/ww ;
end use ;
beta == omg'integ ;
mur == lookup_SideFC(slip_rate, abs(beta)) ;
Fs == mur * mass * 9.8 * sign(beta);
J * omg'dot == (T- Fs*R) ;
end architecture beh ;
Slip rate
• VHDL-AMS model expresses definitional equations directly.
Friction Coeff.
Equations
Translation <> Rotation
© 2010 ANSYS, Inc. All rights reserved. 13 ANSYS, Inc. Proprietary
Nonlinear side force model
-4.20
4.00
0
0 1.00500.00m
TBar.TORQUE [Nm]
SPRING_ROTB2.TORQUE [Nm] -4.20
4.00
0
0 1.00500.00m
トーションバー・トルク TBar.TORQUE [Nm] SPRING_ROTB2.TORQUE [Nm] Motor.mi
-4.20
4.20
0
0 1.00500.00m
トーションバー・トルク TBar.TORQUE [Nm] SPRING_ROTB2.TORQUE [Nm] Motor.mi
-370.00m
370.00m
-200.00m
0
200.00m
0 1.00500.00m
相電流[A]
AM1.I... AM2.I... AM3.I...
-4.20
4.00
0
0 1.00500.00m
トーションバー・トルク TBar.TORQUE [Nm] SPRING_ROTB2.TORQUE [Nm] Motor.mi
-35.00
34.80
-20.00
0
20.00
0 1.00500.00m
タイヤ横力 [kgf]
Steering torque = side force torque
Steering torque reduces as 1/2
• Nonlinear side force mapping.
• Confirm reducing steering force by assist motor.
w/o Power Assist with Assist
Side force of Tire [N]
© 2010 ANSYS, Inc. All rights reserved. 14 ANSYS, Inc. Proprietary
How to Use a VHDL-AMS Model in
Simplorer?
• Drag and drop the
VHDL-AMS model as
if it is built-in.
• Double click to launch
the property window
as if it is built-in.
© 2010 ANSYS, Inc. All rights reserved. 15 ANSYS, Inc. Proprietary
What About PDEs – Boundary Value
Problems?
• Example:
problem solved is described by the following equations:
ENTITY steady_state_boundary_value IS
generic (
phibc: real := 0.0
);
END ENTITY steady_state_boundary_value;
ARCHITECTURE arch_steady_state_boundary_value OF
steady_state_boundary_value IS
quantity phi1,phi2,phi3,phi4,phi5 : real;
constant h : real := 0.25;
BEGIN
phi1 == phibc;
(phi3-phi1)/(2.0*h) == 1.0*h;
(phi4-phi2)/(2.0*h) == 2.0*h;
(phi5-phi3)/(2.0*h) == 3.0*h;
(1.0*phi3-4.0*phi4+3.0*phi5)/(2.0*h) == 4.0*h;
END ARCHITECTURE
arch_steady_state_boundary_value;
• Architecture• Entity
φ1 φ2 φ3 φ4 φ5
h
x=0
L=1.0
1 2 3 4 5
© 2010 ANSYS, Inc. All rights reserved. 16 ANSYS, Inc. Proprietary
What About PDEs – Initial Value
Problems?
• Example:
problem solved is described by the following equations:
ENTITY transient_diffusion IS
generic (
rho: real := 2000.0;
k: real := 2.0;
Cp: real := 1000.0);
END ENTITY transient_diffusion;
IF (domain = quiescent_domain) USE
T1 == 20.0;
T2 == 60.0;
T3 == 100.0;
T4 == 60.0;
T5 == 20.0;
ELSE
rho*Cp*T1'dot == -(N1p - N0p)/h;
rho*Cp*T2'dot == -(N2p - N1p)/h;
rho*Cp*T3'dot == -(N3p - N2p)/h;
rho*Cp*T4'dot == -(N4p - N3p)/h;
rho*Cp*T5'dot == -(N5p - N4p)/h;
END USE
• Architecture (main part)• Entity
© 2010 ANSYS, Inc. All rights reserved. 17 ANSYS, Inc. Proprietary
Newman’s 1d Electrochemistry Model
in Simplorer
Lithium Ion Batteries
• Electrochemical Kinetics
• Solid-State Li Transport
• Electrolytic Li Transport
• Charge Conservation/Transport
• (Thermal) Energy Conservation
Li+
e
Li+
Li+ Li+
LixC6 Lix-Metal-oxidee
Jump
Results from Simplorer Results from Newman
Li
eeee j
F
tcD
t
c
1)(
© 2010 ANSYS, Inc. All rights reserved. 18 ANSYS, Inc. Proprietary
Governing Equations
The governing equations of porous electrode model of
the lithium-ion battery (Electrochemical Systems, 3rd by
John Newman)
v
taj
Fz
ticD
t
c n
00
2 1
ctF
RTi ln1 0
22
s
cs
an
RT
F
RT
Fij
expexp0
12 iI
2iaFjn
A coupled set of
PDEs. The way to
solve them with
VHDL-AMS uses
the same technique
as before.
PDE: initial value
PDE: boundary value
PDE: boundary value
PDE: boundary value
Algebraic
© 2010 ANSYS, Inc. All rights reserved. 19 ANSYS, Inc. Proprietary
VHDL-AMS Implementation: Entity
LIBRARY Ieee;
use Ieee.thermal_systems.all;
use Ieee.fluidic_systems.all;
use Ieee.math_real.ALL;
use Ieee.electrical_systems.ALL;
ENTITY battery IS
generic (
diffD : real := 7.5e-11;
epslonn: real := 0.357;
epslonp: real := 0.444;
epslonfn: real := 0.172;
epslonfp: real := 0.259;
sigman : real := 100.0;
sigmap : real := 3.8;
diffDsn: real := 3.9e-14;
diffDsp: real := 1.0e-13;
kn: real := 2.334e-11;
kp: real := 2.334e-11;
Bruggn: real :=1.5;
Bruggp: real :=1.5;
zp : real := 1.0;
mup: real := 1.0;
sp : real :=-1.0;
n : real := 1.0;
csnmax: real := 26390.0;
cspmax: real := 22860.0;
alfa : real :=0.5;
deltas : real := 52.0e-6;
deltan : real := 100.0e-6;
deltap : real := 183.0e-6;
Rsn : real := 12.5e-6;
Rsp : real := 8.0e-6;
F : real := 96485.3;
T : real := 298.0;
R : real := 8.31;
init_c : real := 2000.0;
init_csn: real := 14870.0;
init_csp: real := 3900.0
);
PORT (
TERMINAL negative : electrical;
TERMINAL positive : electrical
);
END ENTITY battery;
Note that the model has two terminals and
the rest are simply parameters of the model.
© 2010 ANSYS, Inc. All rights reserved. 20 ANSYS, Inc. Proprietary
Entities are Passed to Model
Properties Window
© 2010 ANSYS, Inc. All rights reserved. 21 ANSYS, Inc. Proprietary
VHDL-AMS Implementation:
Architecture
© 2010 ANSYS, Inc. All rights reserved. 22 ANSYS, Inc. Proprietary
Results: Newman 1d Model
Simplorer’s Results
x=0
x=Lp+Ls+Ln
x=Lp+Ls
x=Lp
1/10 C
1/2 C
1 C
2 C
4 C
6 C
8 C
10 C
•Reference: Long Cai, Ralph E. White, Journal of Electrochem. Soc., 156 (3), A154-A161 (2009)
White’s Results
© 2010 ANSYS, Inc. All rights reserved. 23 ANSYS, Inc. Proprietary
Results: Newman 1d Model
Simplorer’s Results White’s Results
•Reference: Long Cai, Ralph E. White, Journal of Electrochem. Soc., 156 (3), A154-A161 (2009)
© 2010 ANSYS, Inc. All rights reserved. 24 ANSYS, Inc. Proprietary
Results: Newman 1d Model
Concentration profiles due
to different temperatures
Discharge curves due to
different temperatures
•Reference: C. R. Pals and J. Newman Journal of Electrochem. Soc., 142 (10), 3274-3281 (1995)
© 2010 ANSYS, Inc. All rights reserved. 25 ANSYS, Inc. Proprietary
Heat Exchanger for IGBT Package
• IGBTs used in high power
devices generate a lot of heat.
– Temperature goes high
– To maintain proper temperature
is thus important
• A thermal model, suitable for
coupling with circuit simulator,
can be implemented in
Simplorer using VHDL-AMS.
© 2010 ANSYS, Inc. All rights reserved. 26 ANSYS, Inc. Proprietary
A Sample Heat Exchanger Model
• Parallel-flow heat exchanger
The above derivation can be found in many heat
transfer text books: Incropera : Fundamentals of
heat and mass transfer
• The real problem is highly three dimensional and
complex.
– 3d flow inside the cooling pipes
– 3d conduction everywhere else
– 1d flow assumption is made
© 2010 ANSYS, Inc. All rights reserved. 27 ANSYS, Inc. Proprietary
Steady State Solution for the
Heat Exchanger Model
• Exact solution exists for steady state under constant
properties
• For
– All SI units above
• Analytical solution
© 2010 ANSYS, Inc. All rights reserved. 28 ANSYS, Inc. Proprietary
Validation against Analytical
Solution
© 2010 ANSYS, Inc. All rights reserved. 29 ANSYS, Inc. Proprietary
Test 1 : Zero Heat Transfer
Coefficient
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00Time [s]
300.00
350.00
400.00
450.00
500.00
550.00
600.00
Y1
[ke
l]
Ansoft LLC Simplorer1XY Plot 2Curve Info
U4.temperatureTR
U5.temperatureTR
Inlet Temperatures Outlet Temperatures
• With zero heat transfer coefficient, the flows in the two pipes are
decoupled. Outlet temperatures should follow inlet temperatures exactly
with delay.
• Numerical diffusion caused slight reduction of amplitude
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00Time [s]
300.00
350.00
400.00
450.00
500.00
550.00
600.00
Y2
[ke
l]
Ansoft LLC Simplorer1XY Plot 1Curve Info
U2_heat_ex.tc100TR
U2_heat_ex.th100TR
© 2010 ANSYS, Inc. All rights reserved. 30 ANSYS, Inc. Proprietary
Test 2 : Positive Heat Transfer
Coefficient
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00Time [s]
300.00
350.00
400.00
450.00
500.00
550.00
600.00
Y1
[ke
l]
Ansoft LLC Simplorer1XY Plot 2Curve Info
U4.temperatureTR
U5.temperatureTR
Inlet Temperatures Outlet Temperatures
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00Time [s]
300.00
350.00
400.00
450.00
500.00
550.00
600.00
Y2
[ke
l]
Ansoft LLC Simplorer1XY Plot 1Curve Info
U2_heat_ex.tc100TR
U2_heat_ex.th100TR
• Mean temperature change is about 50K, which is consistent with the steady state case
• The shape of the temperature curve is preserved (with shift of mean value), which is
the expected behavior for convection equations
• Notice the delay of about 5 sec at the outlet. This amount of delay is corresponding to
the length of 1 meter and convection speed of 0.22 m/s
© 2010 ANSYS, Inc. All rights reserved. 31 ANSYS, Inc. Proprietary
Test 3 : Different Temperature
Oscillation Frequencies
Inlet Temperatures Outlet Temperatures
• Note that the two inlets have different frequencies. This will distort
temperature shape at outlet because the two convection equations are
coupled.
• Mean temperature change is still 50 K as expected.
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00Time [s]
300.00
350.00
400.00
450.00
500.00
550.00
600.00
Y1
[ke
l]
Ansoft LLC Simplorer1XY Plot 2Curve Info
U4.temperatureTR
U5.temperatureTR
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00Time [s]
300.00
350.00
400.00
450.00
500.00
550.00
600.00
Y2
[ke
l]
Ansoft LLC Simplorer1XY Plot 1Curve Info
U2_heat_ex.tc100TR
U2_heat_ex.th100TR
© 2010 ANSYS, Inc. All rights reserved. 32 ANSYS, Inc. Proprietary
DFS of Two Outlet Signals
• As expected, two discrete frequencies are observed for
both outlet temperature signals after a 8-point Discrete
Fourier Series
– DC value not shown due to their rather large values.
© 2010 ANSYS, Inc. All rights reserved. 33 ANSYS, Inc. Proprietary
What is Not Suitable for VHDL-
AMS?
• PDEs in 3D
– Discretization becomes complex without help of a
commercial code.
– It becomes tedious to write discretized equations.
– Efficiency
• If a specialized solver is needed to solve the
governing equations efficiently, then VHDL-
AMS might not be as efficient.
– 1D Euler equation in fluid dynamics
• Flux difference splitting (Roe’s method)
© 2010 ANSYS, Inc. All rights reserved. 34 ANSYS, Inc. Proprietary
Conclusion
• VHDL-AMS is perfect for users to include a customer model in
system level simulations.
• VHDL-AMS programmers only need to write the governing
equations after discretization. Solver and post-processing is
provided by the simulating environment, for instance, Simplorer.
• VHDL-AMS can easily handle devices governed by algebraic,
ODEs, and PDEs in 1D or even 2D.
• VHDL-AMS can NOT replace CFD, FEA, Maxwell, or specialized
solvers.
© 2010 ANSYS, Inc. All rights reserved. 35 ANSYS, Inc. Proprietary
Thank you!!
© 2010 ANSYS, Inc. All rights reserved. 36 ANSYS, Inc. Proprietary
Appendix A
Workshop : Create a RC Circuit
Using VHDL-AMS in Simplorer
© 2010 ANSYS, Inc. All rights reserved. 37 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Start Simplorer V9.
• Right Mouse Button (RMB) on Models, and select Add Definition...
• Change the Name to vhdl_resistor.
• Press the OK button.
© 2010 ANSYS, Inc. All rights reserved. 38 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select VHDL Model Editor>Edit Entry>Terminal.
• Select Library and Package.
• Select electrical_system.ALL
• Do NOT press the OK button yet.
© 2010 ANSYS, Inc. All rights reserved. 39 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select Terminal.
• Add two terminals as shown below by pressing the add button.
• Do NOT press the OK button yet.
© 2010 ANSYS, Inc. All rights reserved. 40 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select Quantity.
• Add one quantity as shown below.
• Do NOT press the OK button yet.
© 2010 ANSYS, Inc. All rights reserved. 41 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select Generic
• Add one generic as shown below.
• Press the OK button.
© 2010 ANSYS, Inc. All rights reserved. 42 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select the vhdl_resistor tab and the entity part of the VHDL-AMS
should look as follows.
• Note that you could have edited the entity directly. But as a
beginner, you may find using the panel easier.
© 2010 ANSYS, Inc. All rights reserved. 43 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select the arch: arch_vhdl_resistor tab.
• For the architecture, we will edit the content directly. The
architecture should look as follows.
© 2010 ANSYS, Inc. All rights reserved. 44 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select VHDL Model Editor>Check Syntax. Syntax check should
give no error in the Message Manager window.
© 2010 ANSYS, Inc. All rights reserved. 45 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Select VHDL Model Editor>Update Project. Import Component
window shows up.
• This window is to create a component out of your model. At this
stage, you just need to click on OK
© 2010 ANSYS, Inc. All rights reserved. 46 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Your model is now part of the project, and ready to be used.
• Double click on the design name.
• This will make the schematic available again. You can now drag
and drop this component on the schematic.
• You can edit the symbol for the component. This part is skipped
here since it is not critical.
© 2010 ANSYS, Inc. All rights reserved. 47 ANSYS, Inc. Proprietary
Create a RC Circuit Using VHDL-AMS in
Simplorer
• Follow the same procedure to create the model for the capacitor.
• You are ready to connect them to create a RC circuit.
© 2010 ANSYS, Inc. All rights reserved. 48 ANSYS, Inc. Proprietary
Appendix B: VHDL-AMS Source Code for
the Boundary Value Problem
---------- VHDLAMS MODEL steady_state_boundary_value ----------
---------- ENTITY DECLARATION steady_state_boundary_value ----------
ENTITY steady_state_boundary_value IS
generic (
phibc: real := 0.0
);
END ENTITY steady_state_boundary_value;
---------- ARCHITECTURE DECLARATION
arch_steady_state_boundary_value ----------
ARCHITECTURE arch_steady_state_boundary_value OF
steady_state_boundary_value IS
quantity phi1, phi2, phi3, phi4, phi5 : real;
constant h : real := 0.25;
BEGIN
phi1 == phibc;
(phi3-phi1)/(2.0*h) == 1.0*h;
(phi4-phi2)/(2.0*h) == 2.0*h;
(phi5-phi3)/(2.0*h) == 3.0*h;
(1.0*phi3-4.0*phi4+3.0*phi5)/(2.0*h) == 4.0*h;
END ARCHITECTURE arch_steady_state_boundary_value;
---------- END VHDLAMS MODEL steady_state_boundary_value ----------
© 2010 ANSYS, Inc. All rights reserved. 49 ANSYS, Inc. Proprietary
Appendix C: VHDL-AMS Source Code for
the Initial Value Problem
---------- VHDLAMS MODEL transient_diffusion ----------
---------- ENTITY DECLARATION transient_diffusion ----------
ENTITY transient_diffusion IS
generic (
rho: real := 2000.0;
k: real := 2.0;
Cp: real := 1000.0
);
END ENTITY transient_diffusion;
© 2010 ANSYS, Inc. All rights reserved. 50 ANSYS, Inc. Proprietary
Appendix C: VHDL-AMS Source Code for
the Initial Value Problem
---------- ARCHITECTURE DECLARATION arch_transient_diffusion ----------
ARCHITECTURE arch_transient_diffusion OF transient_diffusion IS
quantity T1, T2, T3, T4, T5, N0p, N1p, N2p, N3p, N4p, N5p : real;
constant h : real := 2.0e-3;
BEGIN
N0p == -k*(4.0*T1-0.5*(T1+T2))/h;
N1p == -k*(T2-T1)/h;
N2p == -k*(T3-T2)/h;
N3p == -k*(T4-T3)/h;
N4p == -k*(T5-T4)/h;
N5p == -k*(0.5*(T4+T5)-4.0*T5)/h;
IF (domain = quiescent_domain) USE
T1 == 20.0;
T2 == 60.0;
T3 == 100.0;
T4 == 60.0;
T5 == 20.0;
ELSE
rho*Cp*T1'dot == -(N1p - N0p)/h;
rho*Cp*T2'dot == -(N2p - N1p)/h;
rho*Cp*T3'dot == -(N3p - N2p)/h;
rho*Cp*T4'dot == -(N4p - N3p)/h;
rho*Cp*T5'dot == -(N5p - N4p)/h;
END USE;
END ARCHITECTURE arch_transient_diffusion;
---------- END VHDLAMS MODEL transient_diffusion ----------