-
Notifications
You must be signed in to change notification settings - Fork 0
Example 6
The main purpose of VPSYS is system modelling. Here will be described some of the tools that are used for solving of this task.
Element constructor:
&TYPE element_name
In string of declaration you can add some description of the element.
&TYPE element_name: "any description"
Every element type usually contains some parameters. To see it add question mark (it is the main method for getting help in VPSYS).
&TYPE ?
In the same way you can get the current values of parameters.
element_name ?
Setting and changing of values can be performed in dictionary-like style.
&TYPE element: param1=value1, param2=value2 # during construction
element: param1=value3, param2=value4 # for existing element
Long list of parameters can be separated into several strings. In this case every intermediate string must ended with coma.
Every element should also have inputs and outputs (connectors). Arrow is used to connect them.
element1'output1' -> 'input1'element1
Name of connector is enclosed in single quotation marks. If element has only one input or output, their names can be omitted.
element1 -> element2
Chains are also possible.
element1 -> 'inX'element2'outY' -> 'inZ'element3
Use ? to get help about connectors.
Let's create a simple scheme. It will print points of sinusoid. The scheme consists of 2 elements: source creates a sinusoid while sink re-translates the stream to the screen (because of my bad English sink is transformed into sync..).
&SRC a: func = "sin" # source is a generator of sinusoidal signal
&SYNC b # output to the screen by default
a -> b # preform connection
Run 0 ... %p, 0.05 # calculate of 'time' from 0 to 3.14 with step 0.05
Last string is a command for calculation. If 'run' doesn't contain additional parameters, result will be calculated only once for time %tau0 = 0. You can change this variable manually. Some other parameters are also can be omitted.
Run %pi, 0.05 # default start time (0)
Run %pi # default start time and step