.Model Database Parameters.

When you create your own models you also specify parameters for these models. If you would like to use the model with various parameter sets, the .Model database is a very simple solution. You can provide different parameters sets by assigning only the .Model database name.

Parameters are usually defined in "CON" blocks, but it is more convenient to store them in a database. In this section we will discuss how to use the .Model database to create user specific models.

Suppose we would need 2 parameters to create the offset:


Open the commands editor by selecting "Tools/Commands Editor"

<br>Click to close the image

and add the following line:

.model offset user a=2 b=3

.model offset user a=2 b=3

The model "offset" must be of the type "user" if we want to have access to a and b.

Create a block diagram as shown below

<br>Click to close the image

In the block "MPAR1" define "a" in the edit field "Text1" and "offset" in the "text2" edit field

<br>Click to close the image

A default value can be defined at p1 in case the parameter a in the offset model is not found. In the block MPAR2 define "b" in the edit field "Text1" and "offset" in the "text2" edit field. Also a default value can be specified at p1.

The inputs of both MPAR block can be left undefined. Running the simulation with Tscreen=10s and a stepsize dt=10ms gives the results as shown below

<br>Click to close the image

Suppose we want to create another offset, we could change the values in the .model line. We can also add more offset models and select them by modelname. Add the following lines in the command editor:

.model offset1 user a=1 b=3
.model offset2 user a=2 b=3
.model offset3 user a=3 b=4

Adding a "MNAME" block to the block diagram as shown below

<br>Click to close the image

Starting the simulation with Tscreen=10 and dt=10ms gives the offset specified by model offset3. By changing the model name in the "text1" edit field in the block"MNAME", changes the user model.

© 2021 CASPOC, All rights reserved. Home   |   Terms and Conditions   |   Legal   |   Export Compliance   |   Privacy Policy   |   Site Map