Engee documentation

First steps. Introduction to technical calculations Engee

Page in progress.

If you are just starting your journey with technical calculations, Engee is a great place to be. The platform is specifically designed to help engineers and programmers create complex technical systems and algorithms simply, clearly and conveniently.

Interactive script development environment Engee supports several programming languages: Julia, Python, MATLAB, C/C++, etc., but the main one is Julia - a modern, fast and convenient language for engineering and scientific tasks.

If you haven’t yet chosen a language to learn or are looking for alternatives, here are the advantages that Julia offers:

Advantage Description

Simplicity

Syntax is similar to Python - easy to read and quick to learn.

High performance

Runs at almost the same speed as C, but without the complexities of C/C++.

Powerful maths

Julia "out of the box" supports vectors, matrices, work with numeric data.

Extensibility

Easily connect third-party libraries and work with other languages.

Versatility

Julia is suitable both for simple tasks and for building complex algorithms, simulations and data analysis.

In addition to all these advantages, Engee provides complete and regularly updated Julia documentation in Russian, which will be useful for engineers and programmers with any experience. And for inspiration or case studies, check out Engee Community, where users share their projects, scripts, and ideas.

If you’re just starting your journey with Julia, we recommend checking out the course Welcome to Engee course, which will help you get up to speed with the Engee environment.

For those who are already experienced in technical calculations, examples also provides various scenarios of Julia usage that will help you to understand the capabilities of the language.

Getting started

Engee has everything you need to work with code:

  • File browser file browser 7 - file manager for working with scripts and projects.

  • Command line img 41 1 2 - a command line for advanced users and advanced tasks.

  • Script editor interactive script icon - a script editor with syntax highlighting and autocompletion.

  • Variable window variables article 2 1 - variable panel for analysing and debugging.

Now let’s take a closer look at how exactly code is written and run in Engee. For this purpose we use Script Editor interactive script icon - a convenient tool for step-by-step work with code, visualisations and comments, or a Command Window img 41 1 2 - a more familiar environment for advanced users.

To work with code in Engee even faster and more conveniently, use hotkeys. They allow you to control scripts, run calculations, navigate the interface and save time. A complete list of shortcuts is available in the article Engee hotkeys or by calling the help directly in Engee (combination Shift+?).

Script Editor

Interactive scripts are a special document format in which code, text and graphics are combined into a single working structure. You can open the script editor directly from interface Engee - just click on the interactive script icon icon in the toolbar. To create a script, click + in the script editor and select the desired format:

img36c -> img36c 1

Alternatively, you can click on the File Browser file browser 7 and select CreateScript:

script creation fb

By default, Engee scripts are in ngscript format, but you can work with jl and ipynb format as well:

  • jl is the format of Julia scripts. The script editor supports refactoring and running scripts in this format;

  • ipynb is a universal Python scripting format. The script editor supports all available functionality on a level with ngscript.

An interactive script consists of cells — individual blocks that can be run independently. Cells come in two types:

script editor 1

  • Code - intended for working with code. Such cells can be run one by one, execute only a selected fragment or execute the whole code.

    img52

  • Text - for explanations, formulas and visual design. Markdown, LaTeX and HTML are supported.

    img44

To launch the script, just press the button Save button in the launch panel. All code cells are executed in order. You can also run individual cells or even just a selected code section:

img 49 1

The execution results appear directly below the code and are saved until restarted. If necessary, the output can be collapsed, cleared or hidden with the Limit output colapse button button:

in long hide 1

To structure the script, it is convenient to use headings that form paragraphs. Paragraphs can be collapsed, and navigation through them is performed via the panel Contents content button 1:

in scripts par

You can also use code cell masks in scripts masks script pool 1 - special interactive controls such as sliders, drop-down lists or input fields. They allow you to change code parameters without having to rewrite the code itself.

Working with code cell masks is described in detail in the example Masking code cells of interactive scripts.

Command line

If you are used to working in a terminal, then. Command Window img 41 1 2 Engee is a great solution. Command Window allows you to not only execute code, but also use shell commands, manage packages, edit files, work with Git, and access help - all from a single window!

The Engee command line supports several modes of operation, each suitable for different tasks:

  • Common mode is the main interface, where commands are executed interactively and displayed immediately.

  • Help mode - allows you to quickly get information about functions and modules. Called with a question mark ?.

  • Shell mode - used to execute operating system commands. Called with the symbol ;.

  • Package Manager mode - allows you to manage Julia packages and dependencies. Called by ].

  • Search Modes - allows you to search the command history. Called with the key combinations Ctrl+R for reverse and Ctrl+S for forward.

  • Text Editor Modes - allows you to edit files directly from the command line. Called from the shell mode using vi, vim and nano commands.

Read more about each mode in the article Command line.

If you are working on Git projects, cloning repositories, making edits and commits, the command line in Engee provides all the tools you need. Read more about it in a separate series of articles at Working with Git.

Moreover, in Engee you can combine both approaches: write code in the script editor and run individual commands or utilities via the command line. This hybrid approach allows you to efficiently solve both small tasks and work on large projects.

Working with Julia

Julia is designed to be simultaneously simple, readable, and very fast. It’s great for engineering and scientific tasks, but its syntax is intuitive - especially for those familiar with Python or MATLAB. Here is an example of a simple code in Julia:

println("Привет, мир!")

println is an inbuilt function to output text to the console. You can run this code directly on the command line or in a script editor.

Julia immediately supports working with numbers, strings, arrays, loops, conditions and functions. For example:

  • Sum of array elements:

    arr = [1, 2, 3, 4, 5]
    println(sum(arr))
  • User-defined function:

    f(x) = x^2 + 2x + 1
    println(f(3))

You can start with basic constructs, gradually plug in packages and use additional language features as needed. See below for more details.

Julia packages

Julia is a language with an active community that develops many useful packages. In Engee you can easily plug in and use Julia packages, extending the functionality to suit your needs. You can learn more about working with packages in the article Working with Julia packages.

Data visualisation

Need to visualise your calculations? In Engee you can create and customise plots directly in code using the Plots package, for more information see Graphing.

Software control of modelling

In Engee you can create and manage models programmatically, using built-in methods and commands. This allows you to automate the model creation process: add blocks, connect them with signal lines, set parameters and properties, and perform other operations. To learn more about software control of modelling, see the article Software control of modelling.

Julia’s main designs

Julia is as user-friendly as possible, but still provides access to the entire performance component of the language. Let’s look at its basic features and constructs below.

Variables and data types

Julia is a dynamically typed language: variables can be declared without specifying a type. Let’s look at an example:

a = 3           # без точки с запятой — результат выводится в консоль
b = 4;          # с точкой с запятой — результат не выводится
c = a + b       # сумма двух переменных
println("Сумма: ", c)  # явный вывод текста и значения

m = n = a ÷ b   # целочисленное деление и множественное присваивание

Integer division (÷) returns only the integer part of the result without remainder. For example, 7 ÷ 3 will return 2.

To enter ÷ use:

  • On Windows/Linux - the Alt key and type 0247 on the numeric keypad;

  • On macOS - press Option (⌥) + /.

Or write \div at the command line and press the key Tab. Other frequently used special characters will also be useful:

  • π - \pi + Tab (the number of pi);

  • - \sqrt + Tab (square root);

  • - \sum + Tab (summation);

  • - \rightarrow + Tab (arrow).

In the code above, variables were not given types, but despite dynamic typing, Julia is a language for computation, which means performance is key. To maximise the performance of Julia, it is highly recommended that you explicitly specify types. For example:

x::Int64 = 42
y::Float64 = 3.14

This allows Julia to perform precise optimisation and avoid unnecessary type conversions at runtime. We recommend that you familiarise yourself with the main Julia types in the following table:

Type (English) Type (Russian) Example

Int

Integer

a = 5

Float64

Fractional number

b = 3.14

Bool

Logical value

is_valid = true

Char

Character (one character)

letter = 'A'

String

Text string

name = "Julia"

Vector

Vector (homogeneous list)

numbers = [1, 2, 3]

Tuple

Tuple (immutable set of values)

data = (1, "hello", true)

A Vector contains elements of the same type (usually numbers), while a Tuple contains values of different types and cannot be changed once created.

Functions

Functions allow you to structure your code and use repetitive logic. Here is an example of a typical function:

function add(a, b)
    return a + b
end

Here we define a add function that takes two arguments and returns their sum. We can write the same function in a shorter form:

add2(a, b) = a + b

And here is how it can be called:

result = add(5, 7)
println("Сумма: ", result)

For more information on functions, see the article Functions.

Conditions and loops

To execute code under certain conditions or to repeat actions, control constructs are used: if, for, while.

Conditional operator:

x = -1

if x > 0
    println("Положительное число")
elseif x == 0
    println("Ноль")
else
    println("Отрицательное число")
end

The for loop performs an action for each value in the range:

for i in 1:5
    println("Итерация ", i)
end

The while loop is executed as long as the condition is true:

n = 3
while n > 0
    println("Осталось: ", n)
    n -= 1
end

For more information, see Basic constructions.

Arrays and vectors

Arrays allow you to store sequences of data, such as measurement results or parameters.

v = [1, 2, 3, 4]
println(v[2])    # доступ ко второму элементу
v[3] = 10        # изменение значения по индексу

For more information, see the article Arrays, vectors and matrices in Engee.

Vectorisation and indexing

Julia allows you to apply operations to the entire array at once, without explicit loops - this is called vectorisation. This is not only convenient, but also fast.

v = [1, 2, 3, 4]
v_squared = v .^ 2         # возведение каждого элемента в квадрат
positive = v .> 2          # логическое сравнение: больше 2
filtered = v[positive]     # выборка элементов по условию

For more information, see the article Vectorisation and logical indexing.

Useful examples

When you have learnt how to work with variables, functions and conditions, it is time to move on to interacting with external data: files, tables, structures. Below are some useful examples that you can easily encounter in different working situations.

Reading and writing files

Sometimes you need to save data to a file or, on the contrary, load it from a file.

open("output.txt", "w") do f # Запись строки в файл
    write(f, "Hello, file!")
end

Here:

  • "output.txt" - file name;

  • "w" - write mode;

  • do f …​ end - special form that automatically closes the file after writing.

Now let’s read the same file:

content = read("output.txt", String) # Чтение содержимого файла
println("Прочитано: ", content)

The read(filename, String) function loads the entire contents as a string.

Working with JSON

JSON (JavaScript Object Notation) is one of the most popular ways to store and exchange data between programs. Julia uses the JSON library to work with it.

using JSON

data = Dict("name" => "Alice", "age" => 30) # Создаем словарь

json_str = JSON.json(data) # Преобразуем словарь в строку в JSON
println(json_str)

parsed = JSON.parse(json_str) # Разбираем JSON обратно в структуру
println(parsed["name"])

Here:

  • Dict is a dictionary (key-value structure);

  • JSON.json(…​) - converts the dictionary or other data into a string in JSON format so that the data can be saved or transferred;

  • JSON.parse(…​) - converts the string back to a dictionary.

Working with tables (CSV and DataFrame)

Tables are one of the most convenient formats for working with data. Julia has a package DataFrames for this purpose:

using DataFrames, CSV

df = DataFrame(Name=["Alice", "Bob"], Age=[30, 25]) # Создаем таблицу

CSV.write("people.csv", df) # Сохраняем в CSV-файл

df2 = CSV.read("people.csv", DataFrame) # Загружаем обратно из файла
println(df2)

Here:

  • DataFrame(…​) - creates a table from columns;

  • CSV.write(…​) - saves the table to the people.csv file;

  • CSV.read(…​) - loads data from the file back into the table.