Engee documentation
Notebook

Ratio-to-speed converter using command control in cycles

The converter takes the ratio and converts it to speed.

The mathematical model of the converter is an algebraic equation, where the range of positions K = 0 to 1 and corresponds to the speed range v = 45 to 95 km/h. The total velocity is v = 50x + 45, the figure below shows the realised model itself.

image.png

Next, let's connect the auxiliary function to start the model and declare initial states for it.

In [ ]:
function run_model( name_model)
    
    Path = (@__DIR__) * "/" * name_model * ".engee"
    
    if name_model in [m.name for m in engee.get_all_models()] # Проверка условия загрузки модели в ядро
        model = engee.open( name_model ) # Открыть модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
    else
        model = engee.load( Path, force=true ) # Загрузить модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
        engee.close( name_model, force=true ); # Закрыть модель
    end
    sleep(5)
    return model_output
end
Out[0]:
run_model (generic function with 1 method)

Let's set the starting conditions as follows:

In [ ]:
K_arr = 0:0.2:1;

Let's run the model in a cycle changing the value of r.

In [ ]:
v = zeros(size(K_arr,1),1)
K = 0.0;
for i in 1:size(K_arr,1)  
    K = K_arr[i]
    run_model("setspeed") # Запуск модели.
    V = collect(simout["setspeed/V"]);
    v[i,:] = V.value
end 
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%

Display and compare the obtained results, plot the final speed and input coefficients.

In [ ]:
plot(K_arr,v)
Out[0]:

Conclusion

According to the results of the model, we can see that as the coefficient increases, the speed increases accordingly.

Blocks used in example