von Robert2000 » Do 27. Okt 2022, 23:49
Hallo Stefan,
der Programmablaufplan ist ein alleinstehendes Dokument. Dein Beispiel war genau das, was ich gesucht habe.
Hier ist einmal meine Version:
\documentclass{article}
\usepackage[left=6cm,right=1cm,top=0.5cm,bottom=0cm]{geometry}% nur als Rand-Demo
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc}
% Define block styles
\tikzset{decision/.style = {diamond, draw, fill=yellow!20,
text width=5.3em, text badly centered, node distance=3cm, inner sep=0pt},
block/.style = {rectangle, draw, fill=blue!20,
text width=8em, text centered, rounded corners, minimum height=4em},
line/.style = {draw, -latex'},
cloud/.style = {draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em},
process/.style = {rectangle, draw, fill=green!20,
text width=5em, text centered, rounded corners, minimum height=2em},
every node/.append style = {font=\sffamily}}
\begin{document}%
\pagestyle{empty}%
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [cloud] (init) {Start};
\node [block, below of=init] (time) {END\_TIME = 30s};
\node [decision, below of=time] (timestamp) {monotonic() - timestamp $<$ END\_TIME};
\node [cloud, below of=timestamp, node distance=2.5cm] (init2) {Stop};
\node [block, left of=timestamp, node distance=4.5cm] (passedtime) {passed\_time = (monotonic() - timestamp)*1000};
\node [decision, below of=passedtime, node distance=4.5cm, fill=green!20] (if0) {passed\_time $<=$ 6s};
\node [block, right of=if0, node distance=4.5cm, fill=orange!20] (SAMPLE0) {print(passed\_time, sample\_0)};
\node [decision, below of=if0, node distance=4.0cm, fill=green!20] (elif1) {passed\_time $<=$ 12s};
\node [block, right of=elif1, node distance=4.5cm, fill=orange!20] (SAMPLE1) {print(passed\_time, sample\_1)};
\node [decision, below of=elif1, node distance=4.0cm, fill=green!20] (elif2) {passed\_time $<=$ 18s};
\node [block, right of=elif2, node distance=4.5cm, fill=orange!20] (SAMPLE2) {print(passed\_time, sample\_2)};
\node [decision, below of=elif2, node distance=4.0cm, fill=green!20] (elif3) {passed\_time $<=$ 24s};
\node [block, right of=elif3, node distance=4.5cm, fill=orange!20] (SAMPLE3) {print(passed\_time, sample\_3)};
\node [decision, below of=elif3, node distance=4.0cm, fill=green!20] (elif4) {passed\_time $<=$ 30s};
\node [block, right of=elif4, node distance=4.5cm, fill=orange!20] (SAMPLE4) {print(passed\_time, sample\_4)};
% Draw edges
\path [line] (init) -- (time);
\path [line] (time) -- (timestamp);
\path [line] (timestamp) -- node {yes}(passedtime);
\path [line] (timestamp) -- node {no}(init2);
\path [line] (passedtime) -- (if0);
\path [line] (if0) -- node {yes}(SAMPLE0);
\path [line] (SAMPLE0) -- ++(2.5cm,0cm) |- ($(timestamp.north)!1.0!(timestamp.east)$);
\path [line] (if0) -- node {no}(elif1);
\path [line] (SAMPLE1) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\path [line] (elif1) -- node {yes}(SAMPLE1);
\path [line] (elif1) -- node {no}(elif2);
\path [line] (elif2) -- node {yes}(SAMPLE2);
\path [line] (SAMPLE2) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\path [line] (elif2) -- node {no}(elif3);
\path [line] (elif3) -- node {yes}(SAMPLE3);
\path [line] (SAMPLE3) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\path [line] (elif3) -- node {no}(elif4);
\path [line] (elif4) -- node {yes}(SAMPLE4);
\path [line] (SAMPLE4) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\end{tikzpicture}
\end{document}
Vielen Dank für deine Hilfe.
Beste Grüße
Robert
Hallo Stefan,
der Programmablaufplan ist ein alleinstehendes Dokument. Dein Beispiel war genau das, was ich gesucht habe.
Hier ist einmal meine Version:
[code]\documentclass{article}
\usepackage[left=6cm,right=1cm,top=0.5cm,bottom=0cm]{geometry}% nur als Rand-Demo
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc}
% Define block styles
\tikzset{decision/.style = {diamond, draw, fill=yellow!20,
text width=5.3em, text badly centered, node distance=3cm, inner sep=0pt},
block/.style = {rectangle, draw, fill=blue!20,
text width=8em, text centered, rounded corners, minimum height=4em},
line/.style = {draw, -latex'},
cloud/.style = {draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em},
process/.style = {rectangle, draw, fill=green!20,
text width=5em, text centered, rounded corners, minimum height=2em},
every node/.append style = {font=\sffamily}}
\begin{document}%
\pagestyle{empty}%
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [cloud] (init) {Start};
\node [block, below of=init] (time) {END\_TIME = 30s};
\node [decision, below of=time] (timestamp) {monotonic() - timestamp $<$ END\_TIME};
\node [cloud, below of=timestamp, node distance=2.5cm] (init2) {Stop};
\node [block, left of=timestamp, node distance=4.5cm] (passedtime) {passed\_time = (monotonic() - timestamp)*1000};
\node [decision, below of=passedtime, node distance=4.5cm, fill=green!20] (if0) {passed\_time $<=$ 6s};
\node [block, right of=if0, node distance=4.5cm, fill=orange!20] (SAMPLE0) {print(passed\_time, sample\_0)};
\node [decision, below of=if0, node distance=4.0cm, fill=green!20] (elif1) {passed\_time $<=$ 12s};
\node [block, right of=elif1, node distance=4.5cm, fill=orange!20] (SAMPLE1) {print(passed\_time, sample\_1)};
\node [decision, below of=elif1, node distance=4.0cm, fill=green!20] (elif2) {passed\_time $<=$ 18s};
\node [block, right of=elif2, node distance=4.5cm, fill=orange!20] (SAMPLE2) {print(passed\_time, sample\_2)};
\node [decision, below of=elif2, node distance=4.0cm, fill=green!20] (elif3) {passed\_time $<=$ 24s};
\node [block, right of=elif3, node distance=4.5cm, fill=orange!20] (SAMPLE3) {print(passed\_time, sample\_3)};
\node [decision, below of=elif3, node distance=4.0cm, fill=green!20] (elif4) {passed\_time $<=$ 30s};
\node [block, right of=elif4, node distance=4.5cm, fill=orange!20] (SAMPLE4) {print(passed\_time, sample\_4)};
% Draw edges
\path [line] (init) -- (time);
\path [line] (time) -- (timestamp);
\path [line] (timestamp) -- node {yes}(passedtime);
\path [line] (timestamp) -- node {no}(init2);
\path [line] (passedtime) -- (if0);
\path [line] (if0) -- node {yes}(SAMPLE0);
\path [line] (SAMPLE0) -- ++(2.5cm,0cm) |- ($(timestamp.north)!1.0!(timestamp.east)$);
\path [line] (if0) -- node {no}(elif1);
\path [line] (SAMPLE1) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\path [line] (elif1) -- node {yes}(SAMPLE1);
\path [line] (elif1) -- node {no}(elif2);
\path [line] (elif2) -- node {yes}(SAMPLE2);
\path [line] (SAMPLE2) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\path [line] (elif2) -- node {no}(elif3);
\path [line] (elif3) -- node {yes}(SAMPLE3);
\path [line] (SAMPLE3) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\path [line] (elif3) -- node {no}(elif4);
\path [line] (elif4) -- node {yes}(SAMPLE4);
\path [line] (SAMPLE4) -- ++(2.5cm,0cm) |- ($(timestamp.west)!1.0!(timestamp.east)$);
\end{tikzpicture}
\end{document}[/code]
Vielen Dank für deine Hilfe.
Beste Grüße
Robert