Solving the problem of integrating Engee and Euler
We are studying how to organize a computational task that is calculated simultaneously in two systems: the Engee dynamic modeling platform and the Euler software package.
EULER is a software package designed to analyze the operation of mechanical systems, including complex kinematics, large movements, rigid and deformable structural elements, hydraulic, pneumatic and electrical systems, control systems and other components. [1]
Engee.Integration – subsystem of the Engee platform; removes the problem of access to low-level interfaces of the operating system, allowing Engee to be connected to external devices, interfaces, protocols and software environments. [2]
Engee Preparation
To create a computational environment around a model in the Euler software package, it is enough for us to assemble any model and place a block in it. Euler Cosimulation.
Let's open the model that is attached to this example.:
cd(@__DIR__)
engee.open( "example_Euler.engee" )
At the input to the component, the signals are assembled with a bus, a structured signal line in which individual signals have their own names. Let's see where this information, together with other settings, should be specified in the block settings. Euler Cosimulation:
After the block is configured and the path to the example that we will run in the Euler environment is specified, you need to open the Engee program.Integration (Host-Device-Manager), which can be obtained using the following command:
engee.package.install("Engee-Device-Manager")
This program receives and transmits information between Engee (cloud platform) and local resources where the Euler software package is running. For more information about installing and running this program, see [2].
Pair by typing in the program Host-Device-Manager the address given by the previous command, and clicking on the "Connect" button. To transfer the block settings to Euler, click on the "Generate configuration file" button.
The file will appear in the specified folder with the example. Its content corresponds to the block settings:
MODEL_NAME OscillatorExample \
INPUT_SIGNAL_COUNT 3 \
OUTPUT_SIGNAL_COUNT 3 \
MODEL_PARAM_COUNT 3 \
INPUT_SIGNAL_NAMES dX dY dZ \
OUTPUT_SIGNAL_NAMES Fx Fy Fz \
MODEL_PARAM_NAMES Cx Cy Cz \
INIT_MODEL_PARAM 2000 2000 2000 \
DIAGNOSTIC 1
The last diagnostic parameter is responsible for saving the transmitted and received data to a log file for debugging purposes. You will also find this file in the Euler project directory on the target platform after the calculation.
Now that the interface has been installed and the Euler software package has received instructions on the structure of the transmitted data, we will proceed to the configuration of the training project from the standard delivery.
Preparing a task in LOGOS
The project we will be working on is called Pendulum And it's in the catalog. Euler/Samples/Projects/Beginner.
In this project, there are several "sensor" objects that we will use as ports for the input data of the model.
Example
PendulumStrictly speaking, it will not allow us to update any significant parameters of the system, since the settings of the mass, gravity and length of the pendulum are not "brought out" using a sensor or other elements, and the angle of the pendulum is overwritten by the Euler solver. But we will see how the data transfer is reflected in the input value graphs during the simulation process.
Let's create a new "Sensor" for co-simulation with Engee (in previous versions of Euler, this can be done through a sensor for co-simulation with MATLAB/Simulink). The first parameter is to set the name of this sensor, the second is to specify a DLL file that can be obtained from Engee technical support. This DLL file contains functions for interfacing Euler with the program. Host Controller.
In the next field, we will see the parameters for exchanging information with Engee, and below we will be able to configure which model variables will receive values from which parameters of the structure coming from Engee through the communication channel.
Select any available options and click "Accept". Now the code of the Euler project looks like this:
point point1=( 0 [ m ], 0 [ m ], 0 [ m ] );
point point2=( 1 [ m ], -0.8 [ m ], 0 [ m ] );
solid solid1=cylinder( point1, point2, 0.1 [ m ], mass = 1 [ kg ] );
solid solid2=sphere( point2, 0.3 [ m ], mass = 0 [kg] );
body Стойка=body( color = index( 4 ) );
body Маятник=body( color = index( 45 ) );
body Маятник < ( solid1, solid2 );
MIP MIP1=massPoint( point2, 2 [kg] );
body Маятник < ( MIP1 );
joint joint1=rotational( Стойка, Маятник, point1, projectZ );
gravity gravity1=parallel( reverse( projectY ) );
sensor_array engee_connector=simulink( "C:/Users/nkapyrin/Downloads/Engee_Euler.dll", "joint1.gamma [rad],maxRelAVDelta_IIM [ ],maxRelAV_IIM [],",
"sensor1 [ ],sensor2 [ ],sensor3 [ ],", "", 0.01 [s], integrMethod = constRK4: );
set ground = Стойка;
/\///////////////////////////////////////////////////////////////////////////////////
/\ Единицы измерения;
set units = SI;
We have created an object engee_connector The interface of the two calculation platforms is now set up.
Launching a joint settlement
Before calculating in both environments, you need to specify the same simulation time, correlate the integration step (the step in Euler should be less than or equal to the integration step in Engee), and configure the display of graphs.
The procedure for launching a joint calculation is as follows:
- Check that the Host Controller program is still pairing. If the connection is broken or error messages are visible, click Reconnect.
- Run the calculation in Engee and wait for the message in the window
Host Controllerwith a proposal to start the calculation on the Euler side. - Run the calculation on the Euler side.
When using older versions of the Euler package, to restart the calculation, it was necessary to delete the previously created "sensor" (in the project configuration file) and recreate it. If such a problem appears in your workflow, you should update the Euler version.
Conclusion
The integration of Engee and the Euler software package makes it possible to simplify the modeling of the active parts of the mechanism, either transfer part of the calculations to a simplified 1D model, or simply surround the mechanism model with a web interface and provide another powerful mechanism for pre- and post-processing experimental results.