• No results found

EXAMPLE INDICATOR - AN ACTIVE LIGHT BULB

A good example to start with is a simple indicator such as the active LAMP model. This represents a light bulb as a simple resistive load, where the brightness of the lamp depends upon the voltage across its two terminals. The electrical model has two user parameters - its value, which represents the nominal voltage for the bulb and the load resistance.

The sample file ACTVLAMP.DSN contains all the elements featured in the following discussion.

Creating the Active Symbols

The animation of active components is achieved through the use of multiple ISIS symbols.

Each symbol represents a given brightness of the light bulb, and is given a name comprising a stem (in this case LAMP), an underscore, and the active state which that symbol represents.

There are a few additional points to note about these symbols:

• The symbols do not need to include the component pins - these are drawn automatically for any active state.

• In general, each active symbol must draw on the same pixels on the screen as any other - even if that means that part of it is drawn in the paper colour. For example, the LAMP_0 symbol has its ray lines drawn in the paper colour so that It will correctly overdraw the ray lines from any of the illuminated states. Failure to correctly design the symbols in this way will result in‘graphical debris’

appearing during circuit animation.

• Our own active component graphics assume a dark or black paper colour. This is mainly so that light bulbs, LEDs etc can be clearly seen. A light bulb emitting white light on white paper is invisible.

When the STATE property is out of range, no active symbol is drawn, and the graphics assigned to the basic library part (the device) are displayed instead. This provides a useful way to indicate to the user whether the animation is running or not.

Creating the Library Part (Device)

The next stage of the process is to create the device library part for the active component. This is done in much the same way as for an ordinary electrical model. The LAMP device in ACTIVE.LIB has the following property definitions:

MODFILE Model File STRING HIDDEN LAMP.MDF The LAMP device is also given a default value string of 12V as a sensible default nominal voltage.

The LOAD property is just an ordinary model parameter definition and allows the user to enter a positive, non-zero value for the load resistance directly from the edit component dialogue form. The use of such property definitions is discussed in detail in the ISIS manual.

The MODFILE property specifies that the bulb’s simulator model is to be held in the file LAMP.MDF.

This is no different from the way in which many other parts in the ISIS libraries are modelled.

Extensive discussion of modelling techniques is contained elsewhere in this documentation. Note that in some cases, it may be appropriate that the device corresponds to a simulator primitive such as anRTSWITCHor anRTVPROBE. In such cases, the simulation model would be specified by the

PRIMITIVEproperty.

Having defined the electrical properties, the final stage is to click the Active Model button on the Make Device dialogue form. The following dialogue will appear:

The Name Stem is set to the common part of the sprite symbol names - LAMP in this case, whilst the No of States field is set to the number of sprite symbols. The use of the Bitwise States and Link to DLL

fields will be explained elsewhere.

Creating the Schematic Model

As with the creation of models for ordinary components, the best way to create and test a schematic model is through the use of a test jig. This is a circuit in which the part to be modelled is made into a hierarchical module-component , with the child sheet then be used to contain the model.

Beyond this, the only difference in creating models for active components is that some special simulator primitives can be used to link the model back to its parent component in ISIS.

The schematic model for the active light bulb is shown below:

AVS1

VALUE=0.9*ABS(V(A,B))

R1

<LOAD> V VP1

RTVPROBE MAX=<VALUE>

1

2

The key part of this circuit is theRTVPROBE(Real Time Voltage Probe) VP1. This special simulator primitive measures the voltage across its pins and transmits it to its parent indicator. The MAX property is set to the VALUE property of the parent part (the light bulb component) and determines a scaling and limit on the voltage value.

The resistor R1 models the load resistance (again parameterized from the parent part) whilst the arbitrary control source AVS1 takes the absolute value of the voltage across the resistor and applies it to the voltage probe. This is needed because the bulb must work when connected either way round.

The multiplier of 0.9 means that the bulb will display LAMP_8 at its nominal voltage, enabling the bright white state LAMP_9 to appear only when the bulb is overdriven.

To complete the process of creating the active light bulb, this circuit would be drawn on the child sheet of the test-jig, and then compiled to the model file LAMP.MDF, corresponding with the filename given in the MODFILE property.

Related documents