Creation VSM - Modelos Digitales
Creation VSM - Modelos Digitales
Creation VSM - Modelos Digitales
Visual model.
The visual model of electronic component is its schematic idea and description of its
properties. It includes the figure of element ("housing" and of inscription), conclusions with the
unique names, and also the "script", in which are described the properties of component.
the "housing" of element is created with the aid of 2d- elements (2D graphics line, 2D graphics
Box, and so on). For example, let us draw the simple rectangle:
Let us add conclusions. This is done in the division "Device pin.". Let us take for example
DEFAULT:
Let us establish Origin - point, with the aid of which the component will be equalized along the
reference grid. Let us select in the division "Markers for component origin, etc" ORIGIN and
will establish it to the external end of conclusion Pin1:
Now let us write script. For this let us establish (usually lower than the component)"Text
script". In the opened window let us introduce the following:
And in the last window we finally select Device Category - Miscellaneous, and library
USERDVC. After pressure on button OK our component is placed into the library, and it is
possible to establish it on the schematic diagram. So let us make.
But here is misfortune - with the attempt to neglect the simulation of diagram the
communication about the error jumps out:
SIMULATION LOGS
==============
...
FATAL: [ OD1 ] External model DLL "OURDEV.DLL" not
found. GLE=.0x00000002.
Simulation FAILED Due To Fatal Simulator Errors.
This means that ISIS could not find OURDEV.DLL - library, in which is located our model. The
creation of this library we will study in the following chapter.
Creation Vsm- of model.
For the beginning let us create empty project..DLL - library Win32. Let us include in project the
file of the titles of classes VSM SDK (these files they lie at catalog INCLUDE):
# include "Vsm.hpp"
Let us add two functions:
extern "C" IDSIMMODEL __ declspec (dllexport) *
createdsimmodel (CHAR * device, ILICENCESERVER * ils)
{
ils->.authorize(.model_.key);
Return NULL;
}
extern "C" VOID __ declspec (dllexport)
deletedsimmodel (IDSIMMODEL * model) {}
The first function transfers to our library the name of the device, for creating which ISIS is
caused our of..DLL- ku. This is convenient to use, if our library realizes several different
models. It must cause function ILIccENccESERVER::authorize of the server of licensing and
report to it its key, in the case of success create object and return his address. In our case we
return NULL, since the description of model is not yet prepared. In more detail about the keys
of licensing I will describe more lately.
The second function must remove model from the memory. We it still do not have; therefore it
is possible anything not to make.
Let us compile our model and will look, which will come out. By the way, it is possible to add
way to our..DLL in window System - Set Paths...
Now simulator is scolded by other slightly communication:
ERROR: [ OD1 ] OURDEV.DLL failed to create DSIM
model for primitive type "OURDEVICE '.
Well it is correct, we create no object.
Now small observation. All digital VSM - models are inherited from the abstract class
IDSIMMODEL. Let us create and we class DSOURDEVICE as heir IDSIMMODEL:
In division public we overlap the abstract methods of class, while in division private we have
to be stored references to different internal structures.
Also, let us change function createdsimmodel and deletedsimmodel, since the description
of the model is already prepared:
Addition of functionality.
First let us be determined, that Pin1 and Pin2 we have the entrances, and Pin3 and Pin4 -
outputs.
Let us establish the initial state of outputs in "1". For this let us add the following lines into the
end of function setup:
Pin3->.setstate(.SHI);
Pin4->.setstate(.SHI);
Perekompiliruyem and let us neglect simulation. It is evident that changed the initial state of
our outputs - they were established in "1":
Let us make from our model a generator. For this let us add into the end of function setup the
line
ckt->.setcallback(1000000000000, this, 0x25);
To these we assign, that in 1 second (time it is assigned in the picoseconds) after starting will
be caused function callback with the code of event 0x25.
Also, let us add into function callback:
VOID DSOURDEVIccE::callback (ABSTIME time, EVENTID eventid)
{
if (eventid == 0x25)
{
if (ishigh(.Pin3->.istate()))
Pin3->.setstate(.time, 1, SLO);
Else
Pin3->.setstate(.time, 1, SHI);
ckt->.setcallback(.time + 1000000000000, this, 0x25);
}
}
I.e., if our event is caused, then we change the state of output to the opposite, and we start
timer again for 1 second, after which again will be caused function callback.
Let us compile and will neglect simulation. So there is - model changes the state of leg Pin3
each second.
Now let us try to force our model to read state it is input and to reflect them to the outputs. Let
us agree, which Pin3 will reflect state Pin1, and Pin4 - state Pin2.
For the beginning let us lead functions setup and callback into the initial form. Then let us
add two lines into function simulate:
Pin3->.setstate(.time, 1, Pin1->.istate());
Pin4->.setstate(.time, 1, Pin2->.istate());
I.e., we read the value of state it is input Pin1 and Pin2, and through 1 value of clock
frequency (1 picosecond) relative to current time (time) we establish the state of outputs.
Certainly, in the reality it does not occur such rapid devices, so that it is necessary to assign
the great significances of delays. It is better, if these values are assigned through the
constant. It is still better, if they are be transferred as the parameters of model (against this
later).
And let us fit to our entrances two digital generators. We see what - outputs reflect state it is
input: