chap2-gates.tex 1.59 KB
\documentclass[multi={tikzpicture},crop=true,border=5pt]{standalone}

\usepackage[utf8]{inputenc}

\usepackage{verbatim}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,arrows.meta,petri}
\tikzset{
  >=latex,
  every place/.style={minimum size=6mm},
  every transition/.style={minimum size=6mm},
  token distance=6pt,
}

\tikzstyle{trans}=[transition]

\tikzstyle{arc}=[->,rounded corners]

\tikzstyle{state}=[draw=blue!50!gray!50!white,
  fill=blue!70!gray!10!white,
  line width=2pt,
  cloud,cloud puffs=8,
  inner sep=-1pt]

\tikzstyle{fire}=[arrows={-Straight Barb[scale=.6]},
  shorten >=-2pt, shorten <=-1pt,
  draw=blue!50!gray!50!white,
  line width=2pt,
  line cap=round,
  rounded corners]

\tikzstyle{active}=[draw=green!50!gray!50!white,
  fill=green!70!gray!10!white]

\begin{document}

%%FRAME

\begin{tikzpicture}[scale=1.2]
  \node[place,tokens={{ state["low"] }}] (low) at (0,0) {};
  \node[below] at (low.south) {\tiny\textsf{bas}};
  \node[place,tokens={{ state["high"] }}] (high) at (0,2) {};
  \node[above] at (high.north) {\tiny\textsf{haut}};
  \node[trans,{{ active["down"] }}] (down) at (-1,1) {};
  \node[rotate=45] at (down) {\tiny\textsf{baisse}};
  \node[trans,{{ active["up"] }}] (up) at (1,1) {};
  \node[rotate=45] at (up) {\tiny\textsf{lève}};
  \draw[arc] (high) -| (down);
  \draw[arc] (down) |- (low);
  \draw[arc] (low) -| (up);
  \draw[arc] (up) |- (high);
  {% if state["low"] == 1 %}
  \node at (2.5,1) {\includegraphics[width=2cm]{../chap2/low}};
  {% else %}  
  \node at (2.5,1) {\includegraphics[width=2cm]{../chap2/high}};
  {% endif %}
\end{tikzpicture}

%%/FRAME

\end{document}