The first steps. Creating a simple model
Engee allows you to first simulate a system and then simulate its dynamic behavior. The basic methods discussed in this example for creating a simple model are also applicable to more complex models.
As an example, consider a simplified model of equidistant motion of a car. A signal corresponding to the position of the accelerator pedal will be sent to the input, and a graph of the vehicle’s movement will be obtained at the output, representing the dependence of the distance traveled on time.
Let’s make the following assumptions:
-
If the accelerator pedal is pressed, the car accelerates.;
-
If the accelerator pedal is released, the car is moving by inertia.
The equidistant motion of the car in this case can be described by the formula:
,
where:
-
— the position of the car at the moment of time ;
-
— the position of the car at the initial moment of time ;
-
— the speed of the car at the initial moment of time ;
-
— Accelerate the car when the accelerator pedal is pressed.
Selecting and configuring ad blocks
To create a new model, click in navigation bars. When the system is started for the first time, a new model is created automatically.
Let’s design a model with the specified conditions using blocks. The Engee block is an element of the model that implements the mathematical relationship between its input and output.
The finished model is shown in the figure.
Let’s take a closer look at the selection and configuration of the model blocks.
The example uses blocks from the library subsections. Basic:
Subsection name and block name | The block icon | The block’s task | The object of the simulation |
---|---|---|---|
Sources: Pulse Generator |
Generates rectangular pulses. |
The position of the accelerator pedal. |
|
Mathematics: Gain |
Multiplies the input signal by a constant value. |
The value of vehicle acceleration when the accelerator pedal is pressed. |
|
Continuous: Second-Order Integrator |
Integrates the input signal twice. |
Calculating the position depending on the position of the accelerator pedal and the set acceleration. |
|
Receivers: Terminator |
The service block. |
Closes the exits of the blocks. |
To add blocks to the model:
-
Drag them from block libraries
click on the canvas with the left mouse button.
-
Or double-click on the canvas with the left mouse button to open the block search bar.
The block name search works even if the keyboard layout is set incorrectly. |
You can read more about working with blocks on canvas in the article Building a model.
You can run models with unconnected blocks and lines on the canvas. This is convenient for debugging models and conducting virtual tests, and also reduces the routine when developing multivariate models. |
After adding the block, its parameters are configured by default. To view and change the block parameters, double-click on the desired block with the left mouse button, or right-click on the block and select Parameters.
For our example, we will set in the block Gain for the Gain parameter, the value is 2
, this value will correspond to the acceleration value of the car when the accelerator pedal is pressed. We will leave the settings for the parameters of the remaining blocks by default.
Output signal from the block Pulse Generator simulates the position of the accelerator pedal. The default values of the block parameters correspond to the following operating mode: the signal period is 10 seconds, the output signal has a value of 1
during the first 0.5 seconds of the period (the accelerator pedal is pressed and the car is accelerating), the remaining part of the period the output signal has a value of 0
(the accelerator pedal is released, the car is moving by inertia, gradually slowing down). The output signal is shown in the figure.
To display the simulation results on a graph, click on the output signal of the x
block. Second-Order Integrator and select "Log" from the context menu. This signal will output the value of the linear motion of the car. For a clearer understanding of the operation of the model, you can also record the signal at the output of the unit. Pulse Generator, which will correspond to the position of the accelerator pedal, and the output signal of the dx
block Second-Order Integrator, which will match the speed of the car.
Engee allows you to change some parameters during the simulation. To find out which parameters can be changed, open the help for the required block. If the block parameter has the attribute "Tunable", then its value can be changed right during the simulation. |
Launching the model
In the Main menu of the workspace, in the field for setting the simulation time, specify the required simulation time in seconds, for example, 30. After that, you can start the simulation.
To launch the model, click Start . The current simulation status can be seen in the status bar.:
More information about the settings and the launch of the model can be found at the link Setting up and launching the model.
The visualization window opens automatically. The graph will show the preset state of the accelerator pedal and the calculated speed and linear movement of the car during the simulation time.
For clarity, we will display the values of the signals on different graphs.
For more information about working with signal visualization, see the article Signal visualization.
After analyzing the results obtained, you can return to the original model and change the parameters of the blocks (for example, gas pedal position settings) and perform a simulation with other model parameters.
More information about model-based design in Engee can be found at the links:
Saving and opening a saved model
To save the model, right-click on the model, and then click:
-
Save as for a new (not saved in the file browser) model.
-
Save or Save as for a previously created model.
Next, you can change the model name in the file browser. To rename a model, right-click on the desired model, and then click Rename. Enter a new model name and press Enter.
To open an existing model, click File Browser . The file browser window opens, find the desired model in it and double-click on it with the left mouse button. The model will appear in the Navigation Bar.