Model Icons


Instead of drawing diagrams with plain rectangular boxes, you can replace boxes with arbitrary icons or images of meaningful objects. There are three distinct places in the process of modeling and simulation where you may set the icons. Each successive stage overrides any settings of earlier stages.

Stages where icons can be set:

  1. Model Definition - This is when you define a model's behavior in the text-editor. Use DEFAULT_ICON( ) in the model's header area. This becomes truly the default icon for the given model type. This icon will appear automatically and immediately anywhere the model is instantiated, unless overridden by a subsequent properties setting. See Setting Default Icons.

  2. Model Instantiation - This is when you are drawing block-diagrams in the GUI, and you set the properties of a particular model instance. You can use this to give particular instances of a model distinct icons. Set this under a box's properties dialog. See Setting a Specific Object's Icon.

  3. Simulation Run-time - As you run a simulation, models may change their images as the simulation runs. These are controlled by the CSIM_SET_IMAGE_ICON within a model's behavior code. See Changing Icons During Simulation.

The following document is divided into three sections corresponding to the three ways that icons can be set. Please see the appropriate section.

Regardless of the actual size of the source image, the size of the box, or which method you use, CSIM ensures that the image appears the same size as the box you place it on. For example, you can assign the same image to several boxes of differing sizes. The image will be stretched, shrunk, or squeezed accordingly for each box.

Most popular image formats are accepted, including JPEG, GIF, PNG, BMP, TIFF, PPM, etc.. Most platforms have the necessary run-time libraries to display these formats. However, without image-support libraries, only PPM format can be accepted. In such cases, either install the missing libraries, such as from Netpbm, or convert your images to PPM through an image tool, such as Gimp, XV, PhotoShop, or ImageMagick.

A set of useful icon images is provided within CSIM's distribution package under the $CSIM_MODEL_LIBS/icons directory. These images are complimentary. You can use or add your own images. The following table lists the existing images with their file names.

Complimentary images and their file names -

Network Symbols:

host.ppm

host_server.ppm

ids.ppm

ine.ppm

firewall.ppm

bridge.ppm

radio_terminal.ppm

radio_channel.ppm

router.ppm

satelite.ppm

satelite_ground.ppm

switch.ppm

NetworkController.ppm.scz

Server.ppm.scz

csco_router.ppm.scz

Logic Symbols:

andgate.ppm

nandgate.ppm

notgate.ppm

orgate.gif

norgate.ppm

xorgate.gif

xnorgate.ppm

clockgen.ppm

Standard Queuing/Server Symbols:

std_box0.ppm

std_db0.ppm

std_delay0.ppm

std_diam0.ppm

std_diamond0.ppm

std_in0.ppm

std_out0.ppm

std_qserver0.ppm

std_queue0.ppm

std_sink0.ppm

std_src0.ppm
(See: Elements of Queuing Systems)

In some cases icons have been made to look best on the default black screen background. However, for other background colors, such as on white paper print-outs, a second set of the same icons has been provided with reverse colors. Such is the case with the standard queuing icons below.

std_box.ppm

std_db.ppm

std_delay.ppm

std_diam.ppm

std_diamond.ppm

std_in.ppm

std_out.ppm

std_qserver.ppm

std_queue.ppm

std_sink.ppm

std_src.ppm

Another set of icons accompanies the new Analog Circuit library. Under $CSIM_MODEL_LIBS/analog_circuits/images are the following schematic symbols:

resistor.ppm

capacitor.ppm

inductor.ppm

switch.ppm

battery.ppm

diode.ppm

zenior.ppm

SCR.ppm

LED.ppm

photodiode.ppm

transformer.ppm

JFET.ppm

MOSFET.ppm

npn_transistor.ppm

pnp_transistor.ppm


1. Setting Default Icons for a Class:

You can set the default icon for a type of model where you define the model, with the DEFAULT_ICON( ) construct. This is when you define a model's behavior in the text-editor.
Example:
	DEFINE_DEVICE_TYPE:  i486x
	 PORT_LIST( clk, addr, data_io, rw );
	 DEFAULT_ICON( $CSIM_MODEL_LIBS/icons/host.ppm );
	 . . .
Simply name the image file to be rendered whenever a device of this type is snapped down (added to a diagram). This becomes the default icon for the given model type. The icon will appear automatically and immediately anywhere the model is instantiated, unless overridden by a subsequent properties setting.


2. Setting a Specific Object's Icon:

This is when you are drawing block-diagrams in the GUI. Open the properties of a particular object (model instance). Click Attributes. You will see a button marked Icon. Clicking the Icon button under the object's property/attributes dialog will open a file browser to enter an image file's name.

You can use this option to give particular instances of a model distinct icons. Remember this is under a box's properties dialog.


3. Changing Icons During Simulation:

You can change icon-images during simulation run-time with the following built-in routines in your models:

One useful way of using this feature is to illustrate a component going through various state changes, by displaying the component with a different image for each state it is in. For efficiency, you can graphically show your components in various states by preloading images depicting each state into different image variables at start-up. Then change the component's image according to its state.

A set of network-related icon images is provided with every CSIM distribution under csim/model_libs/icons. You can set your boxes to be displayed in the GUI as an arbitrary icon, by naming an image file under the Properties / Attributes / Icon dialog.

The following is a detailed description of the image-display routines: