AHDL IntroductionMODELING LANGUAGE If you have the professional Development Kit, you can add models, which are written in a programming language. This program has to be compiled into a DLL file, which can be retrieved by CASPOC. There are two ways of using modeling language within CASPOC.
Standard Modeling Language
The first one is equal to the previous versions of CASPOC, with the difference that the USER.PAS file has to be compiled into a DLL file. This DLL file is loaded at the same time when retrieving the *.cir, *.stm files. This type of modeling language will be referred to as standard modeling language.
Library Modeling Language
The second possibility is to define a MIMO bock for the block-diagram method in the system file. In this case you can define your own block which you can use in the STM file. We will refer to this type of blocks with the name LibML blocks. Using these LibML blocks you can set up your own library of functions for components, controllers and whatsoever.
In the first paragraphs the standard modeling language is discussed. Use standard modeling language if you define a large controller with a lot of inputs and outputs and a lot of internal variables. The second paragraph discusses the library modeling language
The syntax of both modeling language types is equal. You can interchange both files, but be aware of the fact that the calling convention for a LibML block is slightly different from the standard modeling language file. The LibML block has separate variables for input and for storage. The standard modeling language has only variables for storage, which can be set by ToML blocks.
The number of variables for storage is different for both modeling language types. The standard modeling language has 300 variables for storage. The amount of storage variables in the LibML blocks is limited to 20. Therefore we advise you to use the standard modeling language for large projects and the LibML blocks for defining small controller or component functions.
In the FreeWare and Express version the modeling language is disabled.
STANDARD MODELING LANGUAGE The interface between the Standard Modeling Language and the block diagrams defined by the two blocks ToML and FromML. A parameter indicating a procedure number and an index for a variable in an array called bus[.], are provided by these two blocks.
The input for the Standard Modeling Language is achieved via a ToML block
y ToML i1 p1 p2
The value of i1 is placed in the array variable bus[p2]. The procedure number is defined by p1.
The output from the Standard Modeling Language is achieved via a FromML block.
y FromML p1 p2
After a call to the Standard Modeling Language and executing procedure number p2, the value of bus[p1] is set at the output y of the block FromML.
The Standard Modeling Language is executed if all inputs via the ToML blocks are known, which have the same procedure number as the FromML blocks. If different procedure numbers are defined, the Standard Modeling Language with their ToML and FromML blocks are sorted in the block diagram for the calculation sequence.
LIBRARY MODELING LANGUAGE With Library Modeling Language blocks you can define your own blocks for the block diagram.
The inputs for the Library Modeling Language block are passed through an array called input[.]. The array bus[.] can be used for storing data inside a Library Modeling Language block. The output of the block equals the value assigned to the function declared in the export section of the dll.
The interface between the block diagram and Library Modeling Language blocks is
y LibML FileName FunctionName <Inputs>
FileName is the name of the dll file . The filename has to include the path and the extension .dll. FunctionName is the name of the function declared in the export section of the dll. The value assigned to this function name in the dll is the value at the output of the block LibML. The input is optional and are placed in an array you can access in the dll.
The array bus used for storage of data in the dll can be exported and used in the block diagram using the block bus
y bus i1 p1
The input i1 for this block has to be an output from a LibML block. The value of bus[p1] assigned in that dll file is set at the output of the block bus. The following example calls the function f1 in the file Library/Lib1.dll with inputs in1 and in2.
Ylib LibML Library/Lib1.dll f1 in1 in2
ya Bus Ylib 3
yb Bus Ylib 4
The values assigned to bus and bus are available as ya and yb in the block diagram.
You can include a call to the same Library Modeling Language function many times in the block diagram, where each called LibML block has its own variables
Out1 LibML Library/Lib1.dll f1 ina inb
Out2 LibML Library/Lib1.dll f1 i1 i2