Sie sind auf Seite 1von 50

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. 11 ANSYS, Inc. Proprietary


Introduction

Overview of VHDL-AMS
Applications:
Battery: Electrochemistry
Heat Exchanger: Fluid, Thermal

2010 ANSYS, Inc. All rights reserved. 2 ANSYS, Inc. Proprietary


What is VHDL-AMS?

Very High Speed Integrated Circuit Hardware


Description Language Analog and Mixed-Signal
Description Description &
& simulation simulation of
of event- analog and
driven mixed signal
systems circuits and
systems
IEEE 1076 IEEE 1076.1
VHDL VHDL-AMS

1993 1999

VHDL-AMS is a strict superset of IEEE Std. 1076

2010 ANSYS, Inc. All rights reserved. 3 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. 4 ANSYS, Inc. Proprietary


VHDL-AMS Model Construct

Entity Architecture
Interface description of a Behavior description
subsystem or physical Can be dataflow, structural,
device procedural, etc
Specifies input and output Modeling can deal with both
ports to the model analog (continuous) and
digital (discrete) domains

Entity In-out ports


input ports
Architecture 1
Architecture 2
output ports
Architecture 3

2010 ANSYS, Inc. All rights reserved. 5 ANSYS, Inc. Proprietary


VHDL-AMS Code for a Resistor

Entity Voltage

Interface description of a subsystem Current


or physical device
p m
Specifies input and output ports to
the model resistor
Resistance value
LIBRARY Ieee;
Temperature
use Ieee.electrical_systems.ALL;
ENTITY vhdl_resistor IS
GENERIC (
resistance : resistance := 1.0e3
The resistor
);
PORT ( model has one
QUANTITY temp : IN real := 300.0; model constant,
TERMINAL p : electrical; one input quantity,
TERMINAL n : electrical and two terminals
);
END ENTITY vhdl_resistor;

2010 ANSYS, Inc. All rights reserved. 6 ANSYS, Inc. Proprietary


VHDL-AMS Code for a Resistor

Architecture
Description of the model and no solving information is required

ARCHITECTURE arch_vhdl_resistor OF vhdl_resistor IS


QUANTITY voltage ACROSS current THROUGH p TO n;
BEGIN
No solving
voltage == current * resistance; information is
needed!!
END ARCHITECTURE arch_vhdl_resistor;

ARCHITECTURE arch_vhdl_resistor OF vhdl_resistor IS


QUANTITY voltage ACROSS current THROUGH p TO n;
BEGIN
A second
voltage == current * resistance * (1.0+1.0e- architecture is
2*(temp-300.0)+1.1e-3*(temp-300.0)**2);
possible!!
END ARCHITECTURE arch_vhdl_resistor;

2010 ANSYS, Inc. All rights reserved. 7 ANSYS, Inc. Proprietary


VHDL-AMS Code for a Capacitor

Entity Architecture
LIBRARY Ieee; ARCHITECTURE arch_cap OF cap IS
use Ieee.electrical_systems.ALL; QUANTITY voltage ACROSS current THROUGH p TO n;
ENTITY cap IS BEGIN
GENERIC (
capacitance : capacitance := 1.0e-3 IF (domain = quiescent_domain) USE
);
PORT ( voltage == init_v;
QUANTITY init_v : IN voltage := 0.0;
TERMINAL p : electrical; ELSE
TERMINAL n : electrical
); current == capacitance * voltage'dot;
END ENTITY cap;
END USE;

END ARCHITECTURE arch_cap;

The capacitor
entity has one
model constant, The model description essentially
one input, and two has two lines, one for initial
terminals condition and one for the
governing equation!!
2010 ANSYS, Inc. All rights reserved. 8 ANSYS, Inc. Proprietary
Open VHDL-AMS Basic Library
PM Motor example

2010 ANSYS, Inc. All rights reserved. 9 ANSYS, Inc. Proprietary


Open VHDL Basic Library

2010 ANSYS, Inc. All rights reserved. 10 ANSYS, Inc. Proprietary


The modeling of side-force by a
tire.
Perpendicular load 380[kgf]

Traction force, Side force [kgf]


Side angle

Slip rate

Diagram of side force of Tire


Vehicle speed
Fs
Vv Slip rate
Side force
Slip
Rotational
Speed of tire v Force of Rack F

Slip angle Gap of a rack and rotational center : R


Load mg Sidewall equivalent radius : Rc

Ref. ISBN 4-381-08855-7

2010 ANSYS, Inc. All rights reserved. 11 ANSYS, Inc. Proprietary


VHDL-AMS code

Translation <> Rotation begin


T R F T == R * F ;
V == omg * R ;
V R
if(vv'dot < 0.0) use
Slip rate
slip_rate == (vv-ww)/vv ;
Slip (Vv v ) / Vv
else
Friction Coeff. slip_rate == (ww-vv)/ww ;
end use ;
dt
Flookup( Slip , ) beta == omg'integ ;
mur == lookup_SideFC(slip_rate, abs(beta)) ;
Equations
Fs mg Fs == mur * mass * 9.8 * sign(beta);
J * omg'dot == (T- Fs*R) ;
J (T R Fs )
end architecture beh ;

VHDL-AMS model expresses definitional equations directly.


2010 ANSYS, Inc. All rights reserved. 12 ANSYS, Inc. Proprietary
Nonlinear side force model

Side force of Tire [N]


[kgf]
34.80
20.00

-20.00
-35.00
0 500.00m 1.00

w/o Power Assist with Assist Steering torque reduces as 1/2

Steering torque = side force torque


TBar.TORQUE
TBar.TORQUE [Nm]
[Nm]
4.00 4.004.00 SPRING_ROTB2.TORQUE [Nm]
SPRING_ROTB2.TORQUE [Nm]
Motor.mi
Motor.mi

0 0 0
TBar.TORQUE [Nm]
SPRING_ROTB2.TORQUE [Nm] -4.20
-4.20 -4.20
0 500.00m 1.00
0 500.00m 1.00 0 500.00m 1.00

Nonlinear side force mapping.


Confirm reducing steering force by assist motor.

2010 ANSYS, Inc. All rights reserved. 13 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. 14 ANSYS, Inc. Proprietary


problem solved is described by the following equations:

What About PDEs Boundary Value


Problems?
1 2 3 4 5
Example: 1 2 3 4 5
h
x=0
L=1.0

Entity Architecture
ENTITY steady_state_boundary_value IS ARCHITECTURE arch_steady_state_boundary_value OF
generic ( steady_state_boundary_value IS
phibc: real := 0.0
); quantity phi1,phi2,phi3,phi4,phi5 : real;
END ENTITY steady_state_boundary_value; 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;

2010 ANSYS, Inc. All rights reserved. 15 ANSYS, Inc. Proprietary


problem solved is described by the following equations:

What About PDEs Initial Value


Problems?
Example:

Entity
ENTITY transient_diffusion IS Architecture (main part)
generic ( IF (domain = quiescent_domain) USE
rho: real := 2000.0;
k: real := 2.0; T1 == 20.0;
Cp: real := 1000.0); T2 == 60.0;
END ENTITY transient_diffusion; 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

2010 ANSYS, Inc. All rights reserved. 16 ANSYS, Inc. Proprietary


Newmans 1d Electrochemistry Model
in Simplorer
Lithium Ion Batteries
Li+ Li+
Jump

Li+
Li+
( e ce ) 1 t Li
e De ce j
t
LixC6 F e
Lix-Metal-oxide

Electrochemical Kinetics
Solid-State Li Transport
Charge Conservation/Transport
Electrolytic Li Transport (Thermal) Energy Conservation

Results from Simplorer Results from Newman


2010 ANSYS, Inc. All rights reserved. 17 ANSYS, Inc. Proprietary
Governing Equations

The governing equations of porous electrode model of


the lithium-ion battery (Electrochemical Systems, 3rd by
John Newman)
c
Dc

i2 t0 ajn 1 t0 PDE: initial value
t z F v
A coupled set of
RT
i2 2
F

1 t0 ln c PDEs.
PDE: The wayvalue
boundary to
solve them with
I i2 1 VHDL-AMS uses
PDE: boundary value
the same technique
aFjn i2 as before.
PDE: boundary value

F F
jn i0 exp a s exp c s Algebraic
RT RT
2010 ANSYS, Inc. All rights reserved. 18 ANSYS, Inc. Proprietary
VHDL-AMS Implementation: Entity

LIBRARY Ieee;
use Ieee.thermal_systems.all; csnmax: real := 26390.0;
use Ieee.fluidic_systems.all; cspmax: real := 22860.0;
use Ieee.math_real.ALL;
use Ieee.electrical_systems.ALL; alfa : real :=0.5;
ENTITY battery IS
generic ( deltas : real := 52.0e-6;
deltan : real := 100.0e-6;
diffD : real := 7.5e-11; deltap : real := 183.0e-6;
epslonn: real := 0.357; Rsn : real := 12.5e-6;
epslonp: real := 0.444; Rsp : real := 8.0e-6;
epslonfn: real := 0.172;
epslonfp: real := 0.259; F : real := 96485.3;
sigman : real := 100.0; T : real := 298.0;
sigmap : real := 3.8; R : real := 8.31;
diffDsn: real := 3.9e-14;
diffDsp: real := 1.0e-13; init_c : real := 2000.0;
kn: real := 2.334e-11; init_csn: real := 14870.0;
kp: real := 2.334e-11; init_csp: real := 3900.0
Bruggn: real :=1.5; );
Bruggp: real :=1.5;
PORT (
zp : real := 1.0; TERMINAL negative : electrical;
mup: real := 1.0; TERMINAL positive : electrical
sp : real :=-1.0; );
n : real := 1.0;
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. 19 ANSYS, Inc. Proprietary


Entities are Passed to Model
Properties Window

2010 ANSYS, Inc. All rights reserved. 20 ANSYS, Inc. Proprietary


VHDL-AMS Implementation:
Architecture

2010 ANSYS, Inc. All rights reserved. 21 ANSYS, Inc. Proprietary


Results: Newman 1d Model

x=Lp+Ls+Ln

x=Lp+Ls

x=Lp

x=0

1/10 C
1/2 C
1C
2C
4C
6C
8C
10 C

Simplorers Results Whites Results


Reference:
2010 ANSYS, Inc. Long Cai, Ralph E. White, Journal of Electrochem.
All rights reserved. 22 Soc., 156 (3), A154-A161 (2009) ANSYS, Inc. Proprietary
Results: Newman 1d Model

Simplorers Results Whites Results

Reference:
2010 ANSYS, Inc. Long Cai, Ralph E. White, Journal of Electrochem.
All rights reserved. 23 Soc., 156 (3), A154-A161 (2009) ANSYS, Inc. Proprietary
Results: Newman 1d Model

Concentration profiles due Discharge curves due to


to different temperatures different temperatures

Reference:
2010 ANSYS, Inc. C. R. reserved.
All rights Pals and J. Newman Journal of Electrochem.
24 Soc., 142 (10), 3274-3281 (1995) 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. 25 ANSYS, Inc. Proprietary


A Sample Heat Exchanger Model

The real problem is highly three dimensional and


complex.
3d flow inside the cooling pipes
3d conduction everywhere else
1d flow assumption is made
Parallel-flow heat exchanger

The above derivation can be found in many heat


transfer text books: Incropera : Fundamentals of
heat and mass transfer
2010 ANSYS, Inc. All rights reserved. 26 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. 27 ANSYS, Inc. Proprietary


Validation against Analytical
Solution

2010 ANSYS, Inc. All rights reserved. 28 ANSYS, Inc. Proprietary


Test 1 : Zero Heat Transfer
Coefficient
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
Ansoft LLC XY Plot 2 Simplorer1 Ansoft LLC XY Plot 1 Simplorer1
600.00 600.00
Curve Info Curve Info
U4.temperature U2_heat_ex.tc100
TR TR
U5.temperature U2_heat_ex.th100
TR TR

550.00 550.00

500.00 500.00
Y1 [kel]

Y2 [kel]
450.00 450.00

400.00 400.00

350.00 350.00

300.00 300.00
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00 0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00
Time [s] Time [s]

Inlet Temperatures Outlet Temperatures


2010 ANSYS, Inc. All rights reserved. 29 ANSYS, Inc. Proprietary
Test 2 : Positive Heat Transfer
Coefficient
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
Ansoft LLC XY Plot 2 Simplorer1 Ansoft LLC XY Plot 1 Simplorer1
600.00 600.00
Curve Info Curve Info
U4.temperature U2_heat_ex.tc100
TR TR
U5.temperature U2_heat_ex.th100
TR TR

550.00 550.00

500.00 500.00

Y2 [kel]
Y1 [kel]

450.00 450.00

400.00 400.00

350.00 350.00

300.00 300.00
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00 0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00
Time [s] Time [s]

Inlet Temperatures Outlet Temperatures


2010 ANSYS, Inc. All rights reserved. 30 ANSYS, Inc. Proprietary
Test 3 : Different Temperature
Oscillation Frequencies
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.
Ansoft LLC XY Plot 2 Simplorer1 Ansoft LLC XY Plot 1 Simplorer1
600.00 600.00
Curve Info Curve Info
U4.temperature U2_heat_ex.tc100
TR TR
U5.temperature U2_heat_ex.th100
TR TR

550.00 550.00

500.00 500.00
Y1 [kel]

Y2 [kel]
450.00 450.00

400.00 400.00

350.00 350.00

300.00 300.00
0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00 0.00 2.50 5.00 7.50 10.00 12.50 15.00 17.50 20.00
Time [s] Time [s]

Inlet Temperatures Outlet Temperatures


2010 ANSYS, Inc. All rights reserved. 31 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. 32 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 (Roes method)

2010 ANSYS, Inc. All rights reserved. 33 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. 34 ANSYS, Inc. Proprietary


Thank you!!

2010 ANSYS, Inc. All rights reserved. 35 ANSYS, Inc. Proprietary


Appendix A

Workshop : Create a RC Circuit


Using VHDL-AMS in Simplorer

2010 ANSYS, Inc. All rights reserved. 36 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. 37 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. 38 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. 39 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. 40 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. 41 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. 42 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. 43 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. 44 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. 45 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. 46 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. 47 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. 48 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. 49 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 ----------
2010 ANSYS, Inc. All rights reserved. 50 ANSYS, Inc. Proprietary

Das könnte Ihnen auch gefallen