-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsystemdynamics.sty
70 lines (62 loc) · 2.46 KB
/
systemdynamics.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% Systemdynamics package with some useful shortcuts (so far only diagrams)
% Author: Ingmar Vierhaus
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{systemdynamics}[2013/01/13 Custom Package]
\RequirePackage{ifthen}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\usetikzlibrary{shapes, shapes.geometric, arrows, decorations.markings}
\usetikzlibrary{positioning}
\pgfplotsset{compat=newest}
\tikzstyle{stock} = [rectangle, minimum width=2cm, minimum
height=0.5cm,text centered, draw=black, fill=black!01, align=center, inner
ysep=1em] \tikzstyle{sdvariable} = []
\tikzstyle{sdcloud} = [cloud, draw,cloud puffs=8,cloud puff arc=150, aspect=1.5,
scale=0.5, inner ysep=1em, fill=white]
\tikzstyle{arrow} = [thick ,->,>=stealth]
% Styles for the hourglass
\tikzstyle{triangle} = [draw=black, regular polygon, regular
polygon sides=3 ,scale=0.6]
\tikzstyle{border rotated} = [shape border rotate=180]
% Double arrow credits to Dominik Haumann
% http://www.texample.net/tikz/examples/double-arrows/
\tikzstyle{flow} = [thick, decoration={markings,mark=at position
1 with {\arrow[semithick]{open triangle 60}}},
double distance=1.4pt, shorten >= 5.5pt,
preaction = {decorate},
postaction = {draw,line width=1.4pt, white,shorten >= 4.5pt}]
\tikzstyle{sdarrow} = [->, shorten >=2pt]
%Draws a flow between the given nodes
% \flow{startnode}{endnode}{flow label}
\newcommand{\flow}[3] {
\draw[flow] ({#1}) to node[below=0.3cm] {{#3}}
node[thin, triangle, border rotated, above] (testnode) {}
node[thin, triangle, below] {}
({#2});
}
%Draws an ingoing flow (including cloud) for the given node
% \flow{node}{flow label}
\newcommand{\flowIn}[2] {
\node [sdcloud, left=5em of #1] (in_cloud_#1) {};
\draw[flow] (in_cloud_#1) to node[below=0.3cm] (in_#1_down) {{#2}}
node[thin, triangle, border rotated, above] (in_#1_up) {}
node[thin, triangle, below] (in_#1_down_nolabel) {}
({#1});
}
%Draws an outgoing flow (including cloud) for the given node
% \flow{node}{flow label}
\newcommand{\flowOut}[2] {
\node [sdcloud, right=5em of #1] (out_cloud_#1) {};
\draw[flow] ({#1}) to node[below=0.3cm] (out_#1_down) {{#2}}
node[thin, triangle, border rotated, above] (out_#1_up) {}
node[thin, triangle, below] (out_#1_down_nolabel) {}
(out_cloud_#1);
}
%Draws an arrow indication functional dependency
\newcommand{\sdarrow}[3] {
\ifthenelse{\equal{#3}{}}{
\draw[sdarrow] ({#1}) to ({#2});
}{
\draw[sdarrow, #3] ({#1}) to ({#2});
}
}