Home    Reference Manuals    Return   

Create a Sine Wave in program TSIM


In program TSIM it is not necessary to model a mechanical system. With a fixed step integrator it is possible to create curves of plain mathematical expressions too.


Download the example

Examine the directory "intro_tutor_1_sine"

Input data for the time simulation program is located in the subdirectory runf.

List the contents in subdirectory runf by, double-clicking on directory runf/ in the subdirectory-field to the left

Open the file runf/sine.tsimf by double-clicking on the file runf/sine.tsimf in the file-field to the right.
Select open->op with the right mouse button


Examine file runf/sine.tsimf

The file runf/sine.tsimf will now be opened in the gensys standard editor NEDIT. In the NEDIT-editor a language mode "GENSYS" has been defined. The editor will therefore highlight valid gensys-commands. You can change the default editor by defining the environment variable: $genedit.


Run the example runf/sine.tsimf

Double-click file runf/sine.tsimf and select open->run with the right mouse button. The execution of program TSIM will now start, using file runf/sine.tsimf as input.


Examination of the results in MP2ASCII

As the screen-shoot above shows, a new file sine.id in directory id has been created. The file id/sine.id is a binary file written in a format named MPdat and cannot directly be viewed in a text-editor. However the id/sine.id-file is associated with the mp2ascii-scripts which translates the results into a readable ASCII-file.
Double-click the name of the file id/sine.id and select open->genrun with the right mouse button.

The checkboxes are:
Full dump of MPdat-file => Writes all results vectors all time steps
Store output in file => Writes the result to file list/sine.list
Write output in matlab-format=> Write the output in matlab m-format

If no checkboxes are checked, only a short dump to a temporary file will be written.

A screen shoot of the output from program MP2ASCII:

Examine the results in postprocessor MPLOT

The first plot generated by program MPLOT will look as:


Close the MPLOT-window before continuing.
Close also the MPLOT terminal window which is running in the background.

Running MPLOT without an initial file

Close the MPLOT-window before continuing.

Running in batch

The programs in GENSYS can also be executed in batch. Is useful when performing parametric studies:

Using Octave

The sin2-variable can also be created in octave, see input data file runf/sine_octave.tsimf. Go to Run the example and do the same exercise again but with file runf/sine_octave.tsimf.


Run a co-simulation using Gensys as server and program octave as client