If you’ve followed this Analog Modeling series, you know we’ve been talking about a general process for HDL-based modeling of analog behavior. If you’re new to the discussion, or simply want to review what we’ve talked about so far, check these links: Part 1, Part 2, Part 3, Part 4.

In my last post we developed a set of equations describing the relationship between the thermal and electrical properties of an incandescent lamp. Following the process outlined in Part 2, we now need to implement the equations using our modeling language of choice.

I’ve written before about VHDL-AMS, which is the language I will use to complete our incandescent lamp model. I chose VHDL-AMS for several reasons, two of the most important being capability and portability.

VHDL-AMS is very capable, having ample horsepower to model complex device and system behavior across a wide range of technologies. This isn’t to say, however, that the language is complex. In fact, its syntax and semantics are quite straight forward.

VHDL-AMS models are also very portable, a direct result of the language being an IEEE-sponsored industry standard. As long as my models adhere to the standard, I can move them between supporting simulators.

In addition to these language properties, I chose VHDL-AMS for our incandescent lamp model because it’s a major contributing factor to the power and flexibility of SystemVision.

VHDL-AMS models are divided into two sections: an entity and an architecture. The entity defines how the model connects to other elements of a system, and what properties users can adjust to characterize the model’s performance. The architecture describes the model’s function by implementing device equations using VHDL-AMS syntax. From a “which comes first” perspective, it makes the most sense to start model development with the architecture. Once the architecture is complete, the entity easily follows since its structure and content simply support the architecture. With this in mind, let’s work on the architecture.

From Analog Modeling – Par 4 we have the following device equations:

Filament resistance = Rcold x (1.0 + Alpha x (Tfil – Tcold))

Voltage = Current x Filament resistance

Hflow(thermal) = Power(electrical)

Hflow(conductive) = (Tfil – Tamb) / Rth

Hflow(capacitive) = Cth x d(Tfil) / dt

Hflow(radiated) = Ke x (Tfil**4 – Tamb**4)

Hflow(total) = Hflow(conductive) + Hflow(capacitive) + Hflow(radiated)

Let’s first convert these equations to VHDL-AMS syntax (note that some of the elements are renamed to make the equations more compact):

r_temp == r_cold*(1.0 + alpha*(temp_fil – temp_cold_K));

v == i*r_temp;

hflow == v*i;

hflow == cth*temp_fil’dot + ke*SIGN(temp_fil – temp_amb_K)*(temp_fil**4

– temp_amb_K**4) + (temp_fil – temp_amb_K)/rth;

Now let’s define constants and additional analog elements that support these equations. Since Kelvin is the default temperature scale for VHDL-AMS, let’s first define a couple of constants to convert degrees Celsius to Kelvin:

constant temp_amb_K : real := temp_amb + 273.15;

constant temp_cold_K : real := temp_cold + 273.15;

Next, we need to define analog elements, called “quantities” in VHDL-AMS, to help us define items in the equations that vary with time:

quantity v across i through p1 to p2;

quantity r_temp : resistance;

quantity temp_fil : temperature;

quantity hflow : heat_flow;

The first quantity statement defines how the voltage across and current through the lamp relate to the model pins (we will define the pins in the entity). The remaining quantity statements define analog elements that not only support the model equations, but also become waveforms that we can plot after a simulation. For example, once the model is finished we can plot the filament’s resistance and temperature, as well as the total heat flow for the lamp.

These are all of the architecture elements we need to completely describe the operation of our lamp. The only thing left to do is add an architecture wrapper around them:

architecture dyn_therm of Lamp is

constant temp_amb_K : real := temp_amb + 273.18;

constant temp_cold_K : real := temp_cold + 273.18;

quantity v across i through p1 to p2;

quantity r_temp : resistance;

quantity temp_fil : temperature;

quantity hflow : heat_flow;

begin

r_temp == r_cold*(1.0 + alpha*(temp_fil – temp_cold_K));

v == i*r_temp;

hflow == v*i;

hflow == cth*temp_fil’dot + ke*SIGN(temp_fil – temp_amb_K)*(temp_fil**4

– temp_amb_K**4) + (temp_fil – temp_amb_K)/rth;

end architecture dyn_therm;

And that’s it. We now have a complete VHDL-AMS architecture, called “dyn_therm”, describing the relationship between the thermal and electrical properties of an incandescent lamp. While we could have used another modeling language to implement the lamp’s behavior, VHDL-AMS is pretty hard to beat for clarity and ease of coding. In the final post of this series, Analog Modeling – Par 6, we’ll finish the model by adding the VHDL-AMS entity.

## Comments

No one has commented yet on this post. Be the first to comment below.

## Add Your Comment

Please complete the following information to comment or

sign in.