Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
M1-EEA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
EEA
M1-EEA
Commits
27813830
Commit
27813830
authored
Mar 05, 2019
by
Pierre-antoine Comby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flow diagram !
parent
328b313a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
352 additions
and
11 deletions
+352
-11
414-Energie_Renouvelable/Cours/chap1.tex
414-Energie_Renouvelable/Cours/chap1.tex
+97
-9
414-Energie_Renouvelable/Cours/main.tex
414-Energie_Renouvelable/Cours/main.tex
+3
-2
414-Energie_Renouvelable/Cours/sankey.tex
414-Energie_Renouvelable/Cours/sankey.tex
+252
-0
No files found.
414-Energie_Renouvelable/Cours/chap1.tex
View file @
27813830
...
...
@@ -302,7 +302,7 @@ Chaque phase du stator possède un couplage magnétique avec les autres phases d
On a les équations suivantes pour le stator:
\begin{align*}
v
_{
as
}
&
= R
_
s i
_{
as
}
(t)+
\deriv
[\Phi_{as}(t)]
{
t
}
\\
\Phi
_{
as
}
(t)
&
= L
_{
s
}
i
_{
as
}
+ M
_
s(i
_{
bs
}
+i
_{
bs
}
)
\\
&
\quad
+M
_
0 (
\cos
(
\theta
)i
_{
ar
}
(t)+
\cos
(
\theta
+
\frac
{
2
\pi
}{
3
}
)i
_{
b
r
}
(t)+
\cos
(
\theta
+
\frac
{
2
\pi
}{
3
}
)i
_{
br
}
(t)+
\cos
(
\theta
-
\frac
{
2
\pi
}{
3
}
)i
_{
cr
}
(t))
\\
\Phi
_{
as
}
(t)
&
= L
_{
s
}
i
_{
as
}
+ M
_
s(i
_{
bs
}
+i
_{
bs
}
)
+M
_
0 (
\cos
(
\theta
)i
_{
a
r
}
(t)+
\cos
(
\theta
+
\frac
{
2
\pi
}{
3
}
)i
_{
br
}
(t)+
\cos
(
\theta
-
\frac
{
2
\pi
}{
3
}
)i
_{
cr
}
(t))
\\
\Phi
_{
as
}
(t)
&
= (L
_
s-M
_
s) i
_{
as
}
(t)+
\frac
{
3M
_
0I
_
r
}{
\sqrt
{
2
}}
\cos
(
\theta
+
\omega
_
rt+
\phi
_
r+
\theta
_
0)
\\
\Phi
_{
as
}
(t)
&
= (L
_
s-M
_
s) i
_{
as
}
(t)+
\frac
{
3M
_
0I
_
r
}{
\sqrt
{
2
}}
\cos
(
\omega
_
st+
\phi
_
s)
\end{align*}
...
...
@@ -318,7 +318,7 @@ On fais les mêmes calculs pour le rotor :
\begin{align*}
v
_{
ar
}
(t)
&
= R
_
ri
_{
ar
}
(t) +
\deriv
[\Phi]
{
t
}
\\
\Phi
_{
ar
}
(t)
&
= (L
_{
r
}
-M
_
r) i
_{
ar
}
+M
_
0(
\cos
(
\theta
)i
_{
as
}
(t)+
\cos
(
\theta
+
\frac
{
2
\pi
}{
3
}
)i
_{
br
}
(t)+
\cos
(
\theta
+
\frac
{
2
\pi
}{
3
}
)i
_{
br
}
(t)+
\cos
(
\theta
-
\frac
{
2
\pi
}{
3
}
)i
_{
cr
}
(t))
\\
\Phi
_{
ar
}
(t)
&
= (L
_{
r
}
-M
_
r) i
_{
ar
}
+M
_
0(
\cos
(
\theta
)i
_{
as
}
(t)+
\cos
(
\theta
+
\frac
{
2
\pi
}{
3
}
)i
_{
br
}
(t)+
\cos
(
\theta
-
\frac
{
2
\pi
}{
3
}
)i
_{
cr
}
(t))
\\
\Phi
_{
ar
}
(t)
&
= (L
_{
r
}
-M
_
r) i
_{
ar
}
+
\frac
{
3M
_
0I
_
s
}{
\sqrt
{
2
}}
\cos
(
\Omega
t-
\omega
_
st+
\theta
_
0-
\phi
_
s)
\\
\Phi
_{
ar
}
(t)
&
= L
_{
rc
}
i
_{
ar
}
+
\frac
{
3M
_
0I
_
s
}{
\sqrt
{
2
}}
\cos
(
\omega
_
rt +
\phi
_
s')
\end{align*}
...
...
@@ -418,7 +418,7 @@ Avec:
\end{circuitikz}
\caption
{
Modèle au synchronisme
}
\end{figure}
On mesur
r
e la puissance active
$
P
_
0
$
et la puissance réactive
$
Q
_
0
$
et les courants
$
I
_{
s
0
}$
et
$
V
_{
s
0
}$
on obtient les équations:
On mesure la puissance active
$
P
_
0
$
et la puissance réactive
$
Q
_
0
$
et les courants
$
I
_{
s
0
}$
et
$
V
_{
s
0
}$
on obtient les équations:
\[
\begin
{
cases
}
...
...
@@ -459,6 +459,94 @@ Dans le modèle équivalent on est a $\omega_s$. Or dans le rotor les courants s
\[
g
=
\frac
{
\omega
_
s
-
\omega
}{
\omega
_
s
}
\]
\begin{figure}
[H]
\centering
\begin{tikzpicture}
[x=1pt,y=1pt]
\begin{sankeydiagram}
[
sankey tot length=90pt,
%
sankey tot quantity=6,
%
sankey min radius=15pt,
%
sankey fill/.style=
{
draw,line width=0pt,
%fill,
white,
}
,
sankey draw/.style=
{
draw=black,
line width=1pt,
line cap=round,
line join=round,
}
,
]
\sankeynodestart
{
6
}{
0
}{
Pa
}{
0,100
}
;
\node
[left]
at (Pa)
{$
P
_
a
=
3
UI
\cos
{
\phi
}$}
;
\sankeyadvance
{
Pa
}{
50pt
}
\sankeyfork
{
Pa
}{
5/Pa2,1/Pjs
}
\sankeyturn
{
Pjs
}{
-90
}
\sankeyadvance
{
Pjs
}{
15pt
}
\sankeynodeend
{
1
}{
-90
}{
Pjs
}{
Pjs
}
\node
[below=1em]
at (Pjs)
{$
p
_{
js
}
=
3
R
_
sI
_
s
^
2
$}
;
\sankeyadvance
{
Pa2
}{
60pt
}
\sankeyfork
{
Pa2
}{
4/Ptr,1/Pfs
}
\sankeyturn
{
Pfs
}{
-90
}
\sankeyadvance
{
Pfs
}{
30pt
}
\sankeynodeend
{
1
}{
-90
}{
Pfs
}{
Pfs
}
\node
[below=1em]
at (Pfs)
{$
p
_{
fs
}$}
;
\sankeyadvance
{
Ptr
}{
60pt
}
\sankeynodeend
{
4
}{
0
}{
Ptr
}{
Ptr
}
\node
[left]
at (Ptr)
{$
P
_{
tr
}
=
C
_{
em
}
\omega
_
s
$}
;
\sankeyadvance
{
Ptr
}{
30pt
}
\sankeyfork
{
Ptr
}{
3/Pr,1/Pjr
}
\sankeyturn
{
Pjr
}{
-90
}
\sankeyadvance
{
Pjr
}{
30pt
}
\sankeynodeend
{
1
}{
-90
}{
Pjr
}{
Pjr
}
\node
[below=1em]
at (Pjr)
{$
p
_{
jr
}
=
gP
_{
tr
}$}
;
\sankeyadvance
{
Pr
}{
70pt
}
\sankeynodeend
{
3
}{
0
}{
Pr
}{
Pr
}
\node
[left]
at (Pr)
{$
P
_
r
=
C
_{
em
}
p
\Omega
$}
;
\sankeyadvance
{
Pr
}{
30pt
}
\sankeyfork
{
Pr
}{
2/Pu,1/Pmec
}
\sankeyturn
{
Pmec
}{
-90
}
\sankeyadvance
{
Pmec
}{
30pt
}
\sankeynodeend
{
1
}{
-90
}{
Pmec
}{
Pmec
}
\node
[below=1em]
at (Pmec)
{$
p
_{
mec
}$}
;
\sankeyadvance
{
Pu
}{
60pt
}
\sankeynodeend
{
2
}{
0
}{
Pu
}{
Pu
}
\node
[right=1em]
at (Pu)
{$
P
_{
u
}$}
;
\draw
[
very thick,
decoration=
{
brace,
mirror,
raise=0.5cm
}
,
decorate
] (-20,0) -- ++ (180,0) node[midway, below=1.5em]
{
Stator
}
;
\draw
[
very thick,
decoration=
{
brace,
mirror,
raise=0.5cm
}
,
decorate
] (170,0) -- ++ (190,0) node[midway, below=1.5em]
{
Rotor
}
;
\end{sankeydiagram}
\end{tikzpicture}
\caption
{
Bilan de puissance
}
\end{figure}
\begin{exemple}
Pour une machine asynchrone , 400V/690V ,1.5kW ,1425 tr/min :
\begin{enumerate}
...
...
@@ -494,7 +582,7 @@ P_e = 3 \frac{R_r'}{g}I_r^2 = C_e \Omega
On en déduit alors le couple électromagnétique.
\emph
{
en négligeant la resistance du stator
}
:
\begin{align*}
C
_{
em
}
&
= 3 p
\frac
{
V
_
s
^
2
}{
\omega
_
s
}
\frac
{
\frac
{
R
_
r'
}{
g
}}{
\left
(
\frac
{
R
_
r'
}{
g
}
\right
)
^
2+(l
_{
fuites
}
\omega
_
s)
^
2
}
\\
&
= 3 p
\frac
{
V
_
s
^
2
}{
\omega
_
s
}
\frac
{
1
}{
\left
(
\frac
{
g(l
_
f
\omega
_
s)
^
2
}{
R
_
r'
}
\right
) +
\frac
{
R
_
r'
}{
g
}}
\\
&
= 3 p
\frac
{
V
_
s
^
2
}{
\omega
_
s
}
\frac
{
1
}{
\left
(
\frac
{
g(l
_
f
\omega
_
s)
^
2
}{
R
_
r'
}
\right
) +
\frac
{
R
_
r'
}{
g
(l
_
f
\omega
_
s)
^
2
}}
\\
&
=
\frac
{
3p
}{
l
_
f
}
\frac
{
V
_
s
^
2
}{
\omega
_
s
^
2
}
\frac
{
1
}{
\left
(
\frac
{
g(l
_
f
\omega
_
s)
^
2
}{
R
_
r'
}
\right
)+
\left
(
\frac
{
R
_
r'
}{
g(l
_
f
\omega
_
s)
^
2
}
\right
)
}
\\
\Aboxed
{&
= 2C
_{
max
}
\frac
{
1
}{
\left
(
\frac
{
g
}{
g
_{
max
}}
\right
)+
\left
(
\frac
{
g
_{
max
}}{
g
}
\right
)
}}
\end{align*}
...
...
@@ -536,7 +624,7 @@ Avec la relation glissement vitesse on a:
\includegraphics
[width=0.7\textwidth]
{
Domaines
_
fonctionnement
_
MAs.png
}
\caption
{
Mode de fonctionnement de la MAS
}
\end{figure}
---
\subsection
{
Alimentation par un onduleur
}
\emph
{
merci wikipédia
}
...
...
@@ -556,7 +644,7 @@ Pour cela, la machine asynchrone est alimentée par un onduleur délivrant une t
On reprend l'équation générale du couple :
:
\[
T
_{
em
}
=
\frac
{
3
p
}{
\mathcal
{
N
}_
r
}
\cdot
\frac
{
V
_
S
^
2
}{
\omega
_
S
^
2
}
\cdot
\frac
{
1
}{
\left
(
\frac
{
g
\mathcal
{
N
}_
r
\omega
_
S
}{
R
_
r
^
*
}
\right
)+
\left
(
\frac
{
R
_
r
^
*
}{
g
\mathcal
{
N
}_
r
\omega
_
S
}
\right
)
}
\,
\]
:
\[
C
_{
em
}
=
\frac
{
3
p
}{
\mathcal
{
N
}_
r
}
\cdot
\frac
{
V
_
S
^
2
}{
\omega
_
S
^
2
}
\cdot
\frac
{
1
}{
\left
(
\frac
{
g
\mathcal
{
N
}_
r
\omega
_
S
}{
R
_
r
^
*
}
\right
)+
\left
(
\frac
{
R
_
r
^
*
}{
g
\mathcal
{
N
}_
r
\omega
_
S
}
\right
)
}
\,
\]
On note
$
C
_{
max
}
$
le couple maximal.
...
...
@@ -572,11 +660,11 @@ On note $ \Phi_s$ la valeur efficace du flux nominal.
Si on garde le rapport
$
\frac
{
V
_
S
}{
\omega
_
S
}$
constant, il est donc possible de déplacer la vitesse à laquelle
$
C
_{
max
}$
est disponible. L'expression du couple devient :
\[
T
_{
em
}
=
\frac
{
2
C
_{
max
}}{
\left
(
\frac
{
g
\mathcal
{
N
}_
r
\omega
_
S
}{
R
_
r
^
*
}
\right
)+
\left
(
\frac
{
R
_
r
^
*
}{
g
\mathcal
{
N
}_
r
\omega
_
S
}
\right
)
}\]
\[
C
_{
em
}
=
\frac
{
2
C
_{
max
}}{
\left
(
\frac
{
g
\mathcal
{
N
}_
r
\omega
_
S
}{
R
_
r
^
*
}
\right
)+
\left
(
\frac
{
R
_
r
^
*
}{
g
\mathcal
{
N
}_
r
\omega
_
S
}
\right
)
}\]
Après un
\emph
{
développement limité
}
au premier ordre de
$
T
_{
em
}$
lorsque
$
g
$
tend vers 0, on obtient :
Après un
\emph
{
développement limité
}
au premier ordre de
$
C
_{
em
}$
lorsque
$
g
$
tend vers 0, on obtient :
\[
T
_{
em
}
=
Cte
\cdot
g
\cdot
\omega
_
S
=
Cte
\cdot
(
\omega
_
S
-
\omega
)
=
Cte
\cdot
(
n
_
S
-
n
)
\,
\]
\[
C
_{
em
}
=
Cte
\cdot
g
\cdot
\omega
_
S
=
Cte
\cdot
(
\omega
_
S
-
\omega
)
=
Cte
\cdot
(
n
_
S
-
n
)
\,
\]
...
...
414-Energie_Renouvelable/Cours/main.tex
View file @
27813830
\documentclass
{
../../cours
}
\documentclass
[openany]
{
../../cours
}
\usepackage
{
../../raccourcis
}
% Mise en page
...
...
@@ -7,6 +7,7 @@
\teacher
{
Anthony Juton
\&
Olivier Villain
\&
Emmanuel Hoang
}
\module
{
414
\\
Production d'électricité
\\
à partir d'énergie renouvelables
}
\renewcommand
{
\vec
}{
\overrightarrow
}
\input
{
sankey.tex
}
\begin{document}
\maketitle
...
...
@@ -20,7 +21,7 @@
\subfile
{
chap3.tex
}
\chapter
{
Physique de la conversion électrovoltaïque
}
\label
{
chap:photov
}
\subfile
{
chap6.tex
}
\chapter
{
Électronique de puissance pour les parcs éoliens connectés au réseau
}
%
\chapter{Électronique de puissance pour les parcs éoliens connectés au réseau}
...
...
414-Energie_Renouvelable/Cours/sankey.tex
0 → 100644
View file @
27813830
\usetikzlibrary
{
calc
}
\usepackage
{
etoolbox
}
\pgfdeclarelayer
{
background
}
\pgfdeclarelayer
{
foreground
}
\pgfdeclarelayer
{
sankeydebug
}
\pgfsetlayers
{
background,main,foreground,sankeydebug
}
\newif\ifsankeydebug
\newenvironment
{
sankeydiagram
}
[1][]
{
\def\sankeyflow
##1##2
{
% sn, en
\path
[sankey fill]
let
\p
1=(##1.north east),
\p
2=(##1.south east),
\n
1=
{
atan2(
\y
1-
\y
2,
\x
1-
\x
2)-90
}
,
\p
3=(##2.north west),
\p
4=(##2.south west),
\n
2=
{
atan2(
\y
3-
\y
4,
\x
3-
\x
4)+90
}
in
(
\p
1) to[out=
\n
1,in=
\n
2] (
\p
3) --
(
\p
4) to[in=
\n
1,out=
\n
2] (
\p
2) -- cycle;
\draw
[sankey draw]
let
\p
1=(##1.north east),
\p
2=(##1.south east),
\n
1=
{
atan2(
\y
1-
\y
2,
\x
1-
\x
2)-90
}
,
\p
3=(##2.north west),
\p
4=(##2.south west),
\n
2=
{
atan2(
\y
3-
\y
4,
\x
3-
\x
4)+90
}
in
(
\p
1) to[out=
\n
1,in=
\n
2] (
\p
3)
(
\p
4) to[in=
\n
1,out=
\n
2] (
\p
2);
}
\tikzset
{
sankey tot length/.store in=
\sankeytotallen
,
sankey tot quantity/.store in=
\sankeytotalqty
,
sankey min radius/.store in=
\sankeyminradius
,
sankey arrow length/.store in=
\sankeyarrowlen
,
sankey debug/.is if=sankeydebug,
sankey debug=false,
sankey flow/.style=
{
to path=
{
\pgfextra
{
\pgfinterruptpath
\edef\sankeystart
{
\tikztostart
}
\edef\sankeytarget
{
\tikztotarget
}
\sankeyflow
{
\sankeystart
}{
\sankeytarget
}
\endpgfinterruptpath
}
}
,
}
,
sankey node/.style=
{
inner sep=0,minimum height=
{
sankeyqtytolen(##1)
}
,
minimum width=0,draw=none,line width=0pt,
}
,
% sankey angle
sankey angle/.store in=
\sankeyangle
,
% sankey default styles
sankey fill/.style=
{
line width=0pt,fill,white
}
,
sankey draw/.style=
{
draw=black,line width=.4pt
}
,
}
\newcommand\sankeynode
[4]
{
%prop,orientation,name,pos
\node
[sankey node=##1,rotate=##2]
(##3) at (##4)
{}
;
\ifsankeydebug
\begin{pgfonlayer}
{
sankeydebug
}
\draw
[red,|-|]
(##3.north west) -- (##3.south west);
\pgfmathsetmacro
{
\len
}{
sankeyqtytolen(##1)/3
}
\draw
[red]
(##3.west)
-- (
$
(
##
3
.west
)!
\len
pt
!
90
:
(
##
3
.south west
)
$
)
node[font=
\tiny
,text=black]
{
##3
}
;
\end{pgfonlayer}
\fi
}
\newcommand\sankeynodestart
[4]
{
%prop,orientation,name,pos
\sankeynode
{
##1
}{
##2
}{
##3
}{
##4
}
\begin{scope}
[shift=
{
(##3)
}
,rotate=##2]
\path
[sankey fill]
(##3.north west) -- ++(-
\sankeyarrowlen
,0)
-- ([xshift=-
\sankeyarrowlen
/6]##3.west)
-- ([xshift=-
\sankeyarrowlen
]##3.south west)
-- (##3.south west) -- cycle;
\path
[sankey draw]
(##3.north west) -- ++(-
\sankeyarrowlen
,0)
-- ([xshift=-
\sankeyarrowlen
/6]##3.west)
-- ([xshift=-
\sankeyarrowlen
]##3.south west)
-- (##3.south west);
\end{scope}
}
\newcommand\sankeynodeend
[4]
{
%prop,orientation,name,pos
\sankeynode
{
##1
}{
##2
}{
##3
}{
##4
}
\begin{scope}
[shift=
{
(##3)
}
,rotate=##2]
\path
[sankey fill]
(##3.north east)
-- ([xshift=
\sankeyarrowlen
]##3.east)
-- (##3.south west) -- cycle;
\path
[sankey draw]
(##3.north east)
-- ([xshift=
\sankeyarrowlen
]##3.east)
-- (##3.south west);
\end{scope}
}
\newcommand\sankeyadvance
[3][]
{
%newname,name,distance
\edef\name
{
##2
}
\ifstrempty
{
##1
}{
\def\newname
{
##2
}
\edef\name
{
##2-old
}
\path
[late options=
{
name=##2,alias=
\name
}
];
}{
\def\newname
{
##1
}
}
\path
let
% sankey node angle
\p
1=(##2.north east),
\p
2=(##2.south east),
\n
1=
{
atan2(
\y
1-
\y
2,
\x
1-
\x
2)-90
}
,
% sankey prop
\p
3=(
$
(
\p
1
)-(
\p
2
)
$
),
\n
2=
{
sankeylentoqty(veclen(
\x
3,
\y
3))
}
,
% next position
\p
4=(
$
(
##
2
.east
)!
##
3
!-
90
:
(
##
2
.north east
)
$
)
in
\pgfextra
{
\pgfmathsetmacro
{
\prop
}{
\n
2
}
\pgfinterruptpath
\sankeynode
{
\prop
}{
\n
1
}{
\newname
}{
\p
4
}
\path
(
\name
) to[sankey flow] (
\newname
);
\endpgfinterruptpath
}
;
}
\newcommand\sankeyturn
[3][]
{
%newname,name,angle
\edef\name
{
##2
}
\ifstrempty
{
##1
}{
\def\newname
{
##2
}
\edef\name
{
##2-old
}
\path
[late options=
{
name=##2,alias=
\name
}
];
}{
\def\newname
{
##1
}
}
\ifnumgreater
{
##3
}{
0
}{
\typeout
{
turn acw: ##3
}
\path
let
% sankey node angle
\p
1=(##2.north east),
\p
2=(##2.south east),
\p
3=(
$
(
\p
1
)!-
\sankeyminradius
!(
\p
2
)
$
),
\n
1=
{
atan2(
\y
1-
\y
2,
\x
1-
\x
2)-90
}
,
% sankey prop
\p
4=(
$
(
\p
1
)-(
\p
2
)
$
),
\n
2=
{
sankeylentoqty(veclen(
\x
4,
\y
4))
}
,
\p
5=(##2.east),
\p
6=(
$
(
\p
3
)!
1
!
##
3
:
(
\p
5
)
$
)
in
\pgfextra
{
\pgfmathsetmacro
{
\prop
}{
\n
2
}
\pgfinterruptpath
% \fill[red] (\p3) circle (2pt);
% \fill[blue](\p6) circle (2pt);
\sankeynode
{
\prop
}{
\n
1+##3
}{
\newname
}{
\p
6
}
\path
(
\name
) to[sankey flow] (
\newname
);
\endpgfinterruptpath
}
;
}{
\typeout
{
turn acw: ##3
}
\path
let
% sankey node angle
\p
1=(##2.south east),
\p
2=(##2.north east),
\p
3=(
$
(
\p
1
)!-
\sankeyminradius
!(
\p
2
)
$
),
\n
1=
{
atan2(
\y
1-
\y
2,
\x
1-
\x
2)+90
}
,
% sankey prop
\p
4=(
$
(
\p
1
)-(
\p
2
)
$
),
\n
2=
{
sankeylentoqty(veclen(
\x
4,
\y
4))
}
,
\p
5=(##2.east),
\p
6=(
$
(
\p
3
)!
1
!
##
3
:
(
\p
5
)
$
)
in
\pgfextra
{
\pgfmathsetmacro
{
\prop
}{
\n
2
}
\pgfinterruptpath
% \fill[red] (\p3) circle (2pt);
% \fill[blue](\p6) circle (2pt);
\sankeynode
{
\prop
}{
\n
1+##3
}{
\newname
}{
\p
6
}
\path
(
\name
) to[sankey flow] (
\newname
);
\endpgfinterruptpath
}
;
}
}
\newcommand\sankeyfork
[2]
{
%name,list of forks
\def\name
{
##1
}
\def\listofforks
{
##2
}
\xdef\sankeytot
{
0
}
\path
let
% sankey node angle
\p
1=(
\name
.north east),
\p
2=(
\name
.south east),
\n
1=
{
atan2(
\y
1-
\y
2,
\x
1-
\x
2)-90
}
,
% sankey prop
\p
4=(
$
(
\p
1
)-(
\p
2
)
$
),
\n
2=
{
sankeylentoqty(veclen(
\x
4,
\y
4))
}
in
\pgfextra
{
\pgfmathsetmacro
{
\iprop
}{
\n
2
}
}
\foreach
\prop
/
\name
[count=\c]
in
\listofforks
{
let
\p
{
start
\name
}
=(
$
(
\p
1
)!
\sankeytot
/
\iprop
!(
\p
2
)
$
),
\n
{
nexttot
}
=
{
\sankeytot
+
\prop
}
,
\p
{
end
\name
}
=(
$
(
\p
1
)!
\n
{
nexttot
}
/
\iprop
!(
\p
2
)
$
),
\p
{
mid
\name
}
=(
$
(
\p
{
start
\name
}
)!
.
5
!(
\p
{
end
\name
}
)
$
)
in
\pgfextra
{
\xdef\sankeytot
{
\n
{
nexttot
}}
\pgfinterruptpath
\sankeynode
{
\prop
}{
\n
1
}{
\name
}{
\p
{
mid
\name
}}
\endpgfinterruptpath
}
}
\pgfextra
{
\pgfmathsetmacro
{
\diff
}{
abs(
\iprop
-
\sankeytot
)
}
\pgfmathtruncatemacro
{
\finish
}{
\diff
<0.01?1:0
}
\ifnumequal
{
\finish
}{
1
}{}{
\message
{
*** Warning: bad sankey fork (maybe)...
}
\message
{
\iprop
-
\sankeytot
}
}
}
;
}
\tikzset
{
% default values,
declare function=
{
sankeyqtytolen(
\qty
)=
\qty
/
\sankeytotalqty*\sankeytotallen
;
sankeylentoqty(
\len
)=
\len
/
\sankeytotallen*\sankeytotalqty
;
}
,
sankey tot length=100pt,
sankey tot quantity=100,
sankey min radius=30pt,
%
sankey arrow length=10pt,
%
% user values
#1
}
}{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment