# How to write a take-off program for Samovar

- Link: https://www.samovar-tool.ru/en/2021/03/27/how-to-write-take-off-program-for-samovar/
- Published: 2021-03-27T10:41:00+03:00
- Author: kosoj.diy

**A Samovar take-off program is a text set of commands that describes the controller’s
behavior over time.** Each line specifies a condition (sensor temperature, time,
volume), an action (turn the pump on/off, change the speed, stop the process) and
parameters. Syntax: `T(sensor) (operator) (value) → (action) (parameters)`. Example:`
T2 > 78.5 → PUMP ON 30%` means “when the temperature of sensor 2 exceeds 78.5°C,
turn the pump on at 30% power”. The program runs sequentially, with checkpoints —
the controller does not move to the next line until the condition is met. This makes
it possible to separate fractions precisely: heads (up to 78°C), hearts (78–92°C),
tails (above 92°C). The program is stored in the ESP32’s non-volatile memory and
survives a reboot. It can be edited through the web interface or a Lua script.

### What a take-off program for Samovar is

A take-off program is several lines. Each line describes what Samovar should do 
at a given moment. A line’s running time is determined either by the volume of liquid
the pump has to deliver at the set speed, or by time.

![Samovar take-off program — setting volumes and temperatures](https://i0.wp.com/
www.samovar-tool.ru/wp-content/uploads/2021/11/2021-11-08_16-11-19.png?resize=1024%
2C939&ssl=1)

The simplest take-off program might look like this:

H;250;0.10;1;0.00;120
B;2500;1.00;2;0.00;150T;250;0.10;3;0.00;160

What do these lines mean? Let’s look at the first line in more detail.

We have to tell Samovar what exactly it is drawing off in this line — heads, hearts
or tails. The type of take-off is set by the first (Latin) letter: H — heads (Heads),
B — hearts (Body), T — tails (Tail), and there is one more additional type, P — 
pause (Pause). In the first line we draw off heads.

The second parameter, separated from the take-off type by a semicolon, defines what
volume of liquid has to be drawn off before moving on to the next line. In our case
it is 250 milliliters.

The third parameter, after the semicolon, is the speed at which Samovar should draw
off the given volume, which for the first line in the example is 100 milliliters
per hour, or 0.1 liters per hour.

The fourth parameter defines the container the liquid will be collected into — in
the example, 1.

The fifth parameter is the take-off temperature; it is not used at the moment and
its value does not matter — set it to 0 by default so as not to make a mistake.

And the sixth, last parameter defines what voltage Samovar should set on the regulator
while running this particular line, 120 volts.

If you open the program tab on the main screen, you will see a text field for entering
the program, as well as a short cheat sheet describing what each parameter means.

The Pause program type deserves separate mention. When running a line of type P,
Samovar stops the pump and waits for the time set in that line. All other parameters
are ignored, except the sixth one — voltage. A pause can be used, for example, if
you need to raise (or lower) the regulator voltage by a large amount. Since the 
boiler and the column have quite a lot of inertia, this takes time. How long to 
wait you have to decide yourself, based on your experience. If you set the pause
longer than needed, you can simply press the “Start take-off” button and Samovar
will move on to the next line. If the time was not enough, you can press the “Pause”
button and Samovar will pause the pump. To continue the take-off, you will need 
to press the “Continue take-off” button. Here is what a take-off program line might
look like — wait 120 seconds, set the regulator voltage to 140 volts:

P;120;0;0;0;140

As you can see, controlling Samovar with a program is not hard at all. What is hard
is determining what volume, at what speed and in what proportion to draw off for
your specific conditions. You can of course calculate everything yourself. But there
is an easier way.

![Samovar take-off program — step editor](https://i0.wp.com/www.samovar-tool.ru/
wp-content/uploads/2021/11/2021-11-08_15-19-29.png?resize=979%2C1024&ssl=1)

On the “Program” tab there is a “Calculate program” button; pressing it takes you
to a page with a program calculator, which contains an example of calculating a 
program based on the volume of low wines and its strength. For an accurate calculation
you need to set the expected strength at the column outlet. You can also set the
percentage ratio of heads and tails for your low wines (it depends on the type of
raw material used).

![Samovar take-off program — step parameters](https://i0.wp.com/www.samovar-tool.
ru/wp-content/uploads/2021/11/2021-11-08_15-19-52.png?resize=902%2C1024&ssl=1)

When you downloaded from GitHub the folder with the sketch and the libraries needed
for Samovar to work, you also downloaded the tools folder. This folder has three
files — program_shugar.txt, program_grain.txt, program_fruit.txt — which contain
templates for calculating take-off programs for sugar, fruit and grain. These calculations
can be used as they are by loading them with the “Load program” button, or you can
adjust them as you see fit and save them to another folder so the changes are not
overwritten when Samovar is updated (“Save program” button).

### What if you don’t want a take-off program and would rather control Samovar yourself?

That is possible too. To do this, you can set a single program line and run it. 
For example, this one:

H;99999;0.10;1;0.00;120

In this case Samovar will run this program until it has drawn off 100 liters, and
while it does so, you can control the take-off parameters. You can change the take-
off speed and the regulator voltage. The safety group will work as well.

### Like this:

Like Loading…

### _Related_
