- This post is about
**drawing the hybrid automaton model of thermostat in LaTeX using TikZ package** and **automata library**. We will learn how to **draw states** corresponding to the **operation modes of the thermostat**. Moreover, we will highlight **transitions between modes** and specify the** initial state of the automaton**.

## Short description

- The
** thermostat model has two operation modes**: Mode 1 and Mode 2. **These modes can be drawn** using the **\node command** with **state** option. The **initial state** of the automaton corresponds to **mode 1 **and **to set it in TikZ we add the option initial and initial text =<label>** to the **corresponding node**. Each node has text which is provided between braces {} and to **get multiline text we add \\ together with align option. **Check the code below for more details!

## TikZ code of hybrid automaton model of thermostat

\documentclass[border=0.2cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,automata}
\begin{document}
\begin{tikzpicture}[
node distance=5cm,
on grid,
thick,
font=\small]
% Mode 1
\node
[
state,
initial,
initial text = {$x_0,q_1$},
fill=orange!20,
align=center,
inner sep=5pt
] (q_0)
{
Mode $1$ \\[10pt]
$\dot{x}=f_1(x)$
};
% Mode 2
\node
[
state,
fill=green!20,
align=center,
inner sep=5pt
] (q_1) [right=of q_0]
{
Mode $2$ \\[10pt]
$\dot{x}=f_2(x)$
};
% Transitions
\path [-latex]
(q_0) edge [bend left=45]
node [above] {$x\in\mathcal{S}_{1,2}$} (q_1)
(q_1) edge [bend left=45]
node [below] {$x\in\mathcal{S}_{2,1}$} (q_0);
\end{tikzpicture}
\end{document}

- If you would to see a detailed tutorial about it, leave me a comment below or reach me via e-mail at admin@latexdraw.com, I will be happy to hear from you!