Engee documentation
Notebook

Simulation of parachute opening algorithm

In this demonstration, we will build a parachute model for the Curiosity rover. It's a third-generation rover designed to explore Gale Crater on Mars as part of NASA's Mars Science Laboratory mission.

The rover is an autonomous chemical laboratory several times larger and heavier than the previous Spirit and Opportunity rovers. The parachute for it, as for many other vehicles, was used with the the following algorithms that open automatically based on altitude, as well as determining its velocity.

The parachute deploys over an altitude range of 6,500 to 17000 м.

This example shows two variants of this algorithm. of this algorithm. In the first case we use blocks from basic library of blocks, and in the second case we use engee function. Below is the implementation of these two algorithms.

image.png

Auxiliary function declarations

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)

Comparison of model results

In [ ]:
run_model("mars_para_block")
run_model("mars_para_julia")

out_block = collect(out_block)
out_julia = collect(out_julia)

out_time = out_block.time
out_block = out_block.value
out_julia = out_julia.value

A = plot(out_time, out_block)
plot!(out_time, out_julia)
xlabel!("Time")
ylabel!("State")

B = plot(out_block-out_julia, label="error")

plot(A,B)
WorkspaceArray("data_arr_1")
Building...
Progress 5%
Progress 24%
Progress 41%
Progress 57%
Progress 77%
Progress 94%
Progress 100%
Progress 100%
Building...
Progress 0%
Progress 7%
Progress 27%
Progress 44%
Progress 66%
Progress 87%
Progress 100%
Progress 100%
Out[0]:

Conclusion

As we can see in the graphs, the systems work in the same way, and the moment of of parachute release coincides for both implementations of the algorithm, which indicates that the logic implemented is identical.