From 64c469678f271ccea0c84025496510bc39734862 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paris.fr>
Date: Mon, 15 May 2023 16:26:19 +0200
Subject: [PATCH] Adding multichat AI

---
 doc/diplodocus_tutorial/build/Tutorial.aux | 152 ++++++-----
 doc/diplodocus_tutorial/build/Tutorial.log | 299 +++++++++++++--------
 doc/diplodocus_tutorial/build/Tutorial.out |  26 +-
 doc/diplodocus_tutorial/build/Tutorial.toc |  38 +--
 modeling/SysMLSec/AliceAndBobHW.xml        |  98 +++----
 src/main/java/myutil/AIInterface.java      |  59 +++-
 src/main/java/ui/window/JFrameAI.java      | 134 +++++----
 7 files changed, 475 insertions(+), 331 deletions(-)

diff --git a/doc/diplodocus_tutorial/build/Tutorial.aux b/doc/diplodocus_tutorial/build/Tutorial.aux
index 1ec3078d56..39b7789edb 100644
--- a/doc/diplodocus_tutorial/build/Tutorial.aux
+++ b/doc/diplodocus_tutorial/build/Tutorial.aux
@@ -346,84 +346,102 @@
 \newlabel{fig:RGTree}{{105}{83}{Selecting a reachability graph previously generated}{figure.1.105}{}}
 \@writefile{lof}{\contentsline {figure}{\numberline {106}{\ignorespaces Minimization window}}{83}{figure.1.106}\protected@file@percent }
 \newlabel{fig:RGMinimizationWindow}{{106}{83}{Minimization window}{figure.1.106}{}}
-\citation{BlanchetJCS08}
 \@writefile{lof}{\contentsline {figure}{\numberline {107}{\ignorespaces Accessing to the minimized RG}}{84}{figure.1.107}\protected@file@percent }
 \newlabel{fig:RGMinimizedTree}{{107}{84}{Accessing to the minimized RG}{figure.1.107}{}}
-\@writefile{toc}{\contentsline {subsubsection}{Post-mapping formal verification with ProVerif}{84}{section*.13}\protected@file@percent }
 \@writefile{lof}{\contentsline {figure}{\numberline {108}{\ignorespaces Minimized RG}}{85}{figure.1.108}\protected@file@percent }
 \newlabel{fig:RGMinimized}{{108}{85}{Minimized RG}{figure.1.108}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {109}{\ignorespaces The button and window to launch security verification with ProVerif.}}{86}{figure.1.109}\protected@file@percent }
-\newlabel{fig:ProVerifWindow}{{109}{86}{The button and window to launch security verification with ProVerif}{figure.1.109}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {110}{\ignorespaces ProVerif verification results window.}}{86}{figure.1.110}\protected@file@percent }
-\newlabel{fig:ProVerifWindowRes}{{110}{86}{ProVerif verification results window}{figure.1.110}{}}
 \citation{Gonzalez13}
-\@writefile{toc}{\contentsline {section}{\numberline {9}Automatic Code Generation for Rapid Protoyping}{87}{section.1.9}\protected@file@percent }
-\newlabel{sec:CodeGen}{{9}{87}{Automatic Code Generation for Rapid Protoyping}{section.1.9}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {111}{\ignorespaces The step of realizing a design solution, that is described in this section, in the context of the $\Psi $-chart design approach}}{87}{figure.1.111}\protected@file@percent }
-\newlabel{fig:PsiChartReal}{{111}{87}{The step of realizing a design solution, that is described in this section, in the context of the $\Psi $-chart design approach}{figure.1.111}{}}
-\@writefile{toc}{\contentsline {subsubsection}{The compilation process}{87}{section*.14}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{\numberline {9}Automatic Code Generation for Rapid Protoyping}{86}{section.1.9}\protected@file@percent }
+\newlabel{sec:CodeGen}{{9}{86}{Automatic Code Generation for Rapid Protoyping}{section.1.9}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {109}{\ignorespaces The step of realizing a design solution, that is described in this section, in the context of the $\Psi $-chart design approach}}{86}{figure.1.109}\protected@file@percent }
+\newlabel{fig:PsiChartReal}{{109}{86}{The step of realizing a design solution, that is described in this section, in the context of the $\Psi $-chart design approach}{figure.1.109}{}}
+\@writefile{toc}{\contentsline {subsubsection}{The compilation process}{86}{section*.13}\protected@file@percent }
 \citation{Ousterhout96,Dabek02}
 \citation{Lee06}
-\@writefile{lof}{\contentsline {figure}{\numberline {112}{\ignorespaces An overview of the two-step compilation process to generate the executable control code}}{88}{figure.1.112}\protected@file@percent }
-\newlabel{fig:CodeGen}{{112}{88}{An overview of the two-step compilation process to generate the executable control code}{figure.1.112}{}}
-\@writefile{toc}{\contentsline {subsubsection}{Scheduling of operations}{88}{section*.15}\protected@file@percent }
-\@writefile{toc}{\contentsline {subsubsection}{Memory allocation}{88}{section*.16}\protected@file@percent }
-\@writefile{toc}{\contentsline {subsubsection}{Portability of the code-generation approach}{88}{section*.17}\protected@file@percent }
-\@writefile{toc}{\contentsline {subsection}{\numberline {9.1}Generating the code for the ZigBee transmitter}{89}{subsection.1.9.1}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {113}{\ignorespaces Mark the source output channel as \texttt  {prex}}}{89}{figure.1.113}\protected@file@percent }
-\newlabel{fig:Prex}{{113}{89}{Mark the source output channel as \texttt {prex}}{figure.1.113}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {114}{\ignorespaces Mark the sink input channel as \texttt  {postex}}}{90}{figure.1.114}\protected@file@percent }
-\newlabel{fig:Postex}{{114}{90}{Mark the sink input channel as \texttt {postex}}{figure.1.114}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {115}{\ignorespaces The button to start the process of code generation for rapid prototyping}}{91}{figure.1.115}\protected@file@percent }
-\newlabel{fig:CCodeGenButton}{{115}{91}{The button to start the process of code generation for rapid prototyping}{figure.1.115}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {116}{\ignorespaces Starting the C code generation for rapid prototyping}}{91}{figure.1.116}\protected@file@percent }
-\newlabel{fig:CCodeGen1}{{116}{91}{Starting the C code generation for rapid prototyping}{figure.1.116}{}}
-\@writefile{loa}{\contentsline {algorithm}{\numberline {1}{\ignorespaces The pseudo-code of the Synchronous-Data-Flow (SDF) scheduler}}{92}{algorithm.1}\protected@file@percent }
-\newlabel{algo:Scheduler}{{1}{92}{Generating the code for the ZigBee transmitter}{algorithm.1}{}}
-\newlabel{lst:FftMEC}{{1.1}{93}{Example of Model Extension Construct for a Fast Fourier Transform for the Front End Processor (FEP) of EMBB}{lstlisting.1.1}{}}
-\@writefile{lol}{\contentsline {lstlisting}{\numberline {1.1}Example of Model Extension Construct for a Fast Fourier Transform for the Front End Processor (FEP) of EMBB}{93}{lstlisting.1.1}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {117}{\ignorespaces Compiling the C code that has been automatically generated in Fig.\nobreakspace  {}\ref  {fig:CCodeGen1}}}{94}{figure.1.117}\protected@file@percent }
-\newlabel{fig:CCodeGen2}{{117}{94}{Compiling the C code that has been automatically generated in Fig.~\ref {fig:CCodeGen1}}{figure.1.117}{}}
-\@writefile{toc}{\contentsline {section}{\numberline {10}Analysis of security properties}{94}{section.1.10}\protected@file@percent }
-\newlabel{sec:Security}{{10}{94}{Analysis of security properties}{section.1.10}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {118}{\ignorespaces Simple secured message exchange architecture}}{94}{figure.1.118}\protected@file@percent }
-\newlabel{fig:sampleArch}{{118}{94}{Simple secured message exchange architecture}{figure.1.118}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {10.1}Symmetric Encryption}{94}{subsection.1.10.1}\protected@file@percent }
-\newlabel{sec:symenc}{{10.1}{94}{Symmetric Encryption}{subsection.1.10.1}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {119}{\ignorespaces Simple secured message exchange}}{95}{figure.1.119}\protected@file@percent }
-\newlabel{fig:sampleComp}{{119}{95}{Simple secured message exchange}{figure.1.119}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {10.2}Nonces}{95}{subsection.1.10.2}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {120}{\ignorespaces Message exchange with nonce}}{95}{figure.1.120}\protected@file@percent }
-\newlabel{fig:nonce}{{120}{95}{Message exchange with nonce}{figure.1.120}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {10.3}Key exchange}{95}{subsection.1.10.3}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {121}{\ignorespaces Key exchange architecture with mapped keys}}{96}{figure.1.121}\protected@file@percent }
-\newlabel{fig:keyArch}{{121}{96}{Key exchange architecture with mapped keys}{figure.1.121}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {122}{\ignorespaces Key exchange protocol}}{96}{figure.1.122}\protected@file@percent }
-\newlabel{fig:keyComp}{{122}{96}{Key exchange protocol}{figure.1.122}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {10.4}MAC}{96}{subsection.1.10.4}\protected@file@percent }
-\@writefile{toc}{\contentsline {subsection}{\numberline {10.5}Automated Security Generation}{96}{subsection.1.10.5}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {123}{\ignorespaces MAC verification protocol}}{97}{figure.1.123}\protected@file@percent }
-\newlabel{fig:macComp}{{123}{97}{MAC verification protocol}{figure.1.123}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {124}{\ignorespaces Button and window for Automatic Security Generation}}{97}{figure.1.124}\protected@file@percent }
-\newlabel{fig:autosec}{{124}{97}{Button and window for Automatic Security Generation}{figure.1.124}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {125}{\ignorespaces Application model for Security Generation Example}}{98}{figure.1.125}\protected@file@percent }
-\newlabel{fig:autogenexample}{{125}{98}{Application model for Security Generation Example}{figure.1.125}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {126}{\ignorespaces Unsecured vs Secured Application Models with Automatic Generation}}{98}{figure.1.126}\protected@file@percent }
-\newlabel{fig:autogenres}{{126}{98}{Unsecured vs Secured Application Models with Automatic Generation}{figure.1.126}{}}
-\@writefile{toc}{\contentsline {section}{\numberline {11}Conclusion}{99}{section.1.11}\protected@file@percent }
-\newlabel{sec:Conclusion}{{11}{99}{Conclusion}{section.1.11}{}}
-\@writefile{toc}{\contentsline {section}{\numberline {1.A}Formal description of Communication Patterns}{100}{section.a.1.A}\protected@file@percent }
-\newlabel{app:FormalCP}{{1.A}{100}{Formal description of Communication Patterns}{section.a.1.A}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {110}{\ignorespaces An overview of the two-step compilation process to generate the executable control code}}{87}{figure.1.110}\protected@file@percent }
+\newlabel{fig:CodeGen}{{110}{87}{An overview of the two-step compilation process to generate the executable control code}{figure.1.110}{}}
+\@writefile{toc}{\contentsline {subsubsection}{Scheduling of operations}{87}{section*.14}\protected@file@percent }
+\@writefile{toc}{\contentsline {subsubsection}{Memory allocation}{87}{section*.15}\protected@file@percent }
+\@writefile{toc}{\contentsline {subsubsection}{Portability of the code-generation approach}{87}{section*.16}\protected@file@percent }
+\@writefile{toc}{\contentsline {subsection}{\numberline {9.1}Generating the code for the ZigBee transmitter}{88}{subsection.1.9.1}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {111}{\ignorespaces Mark the source output channel as \texttt  {prex}}}{88}{figure.1.111}\protected@file@percent }
+\newlabel{fig:Prex}{{111}{88}{Mark the source output channel as \texttt {prex}}{figure.1.111}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {112}{\ignorespaces Mark the sink input channel as \texttt  {postex}}}{89}{figure.1.112}\protected@file@percent }
+\newlabel{fig:Postex}{{112}{89}{Mark the sink input channel as \texttt {postex}}{figure.1.112}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {113}{\ignorespaces The button to start the process of code generation for rapid prototyping}}{90}{figure.1.113}\protected@file@percent }
+\newlabel{fig:CCodeGenButton}{{113}{90}{The button to start the process of code generation for rapid prototyping}{figure.1.113}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {114}{\ignorespaces Starting the C code generation for rapid prototyping}}{90}{figure.1.114}\protected@file@percent }
+\newlabel{fig:CCodeGen1}{{114}{90}{Starting the C code generation for rapid prototyping}{figure.1.114}{}}
+\@writefile{loa}{\contentsline {algorithm}{\numberline {1}{\ignorespaces The pseudo-code of the Synchronous-Data-Flow (SDF) scheduler}}{91}{algorithm.1}\protected@file@percent }
+\newlabel{algo:Scheduler}{{1}{91}{Generating the code for the ZigBee transmitter}{algorithm.1}{}}
+\newlabel{lst:FftMEC}{{1.1}{92}{Example of Model Extension Construct for a Fast Fourier Transform for the Front End Processor (FEP) of EMBB}{lstlisting.1.1}{}}
+\@writefile{lol}{\contentsline {lstlisting}{\numberline {1.1}Example of Model Extension Construct for a Fast Fourier Transform for the Front End Processor (FEP) of EMBB}{92}{lstlisting.1.1}\protected@file@percent }
+\citation{BlanchetJCS08}
+\@writefile{lof}{\contentsline {figure}{\numberline {115}{\ignorespaces Compiling the C code that has been automatically generated in Fig.\nobreakspace  {}\ref  {fig:CCodeGen1}}}{93}{figure.1.115}\protected@file@percent }
+\newlabel{fig:CCodeGen2}{{115}{93}{Compiling the C code that has been automatically generated in Fig.~\ref {fig:CCodeGen1}}{figure.1.115}{}}
+\@writefile{toc}{\contentsline {section}{\numberline {10}Analysis of security properties}{93}{section.1.10}\protected@file@percent }
+\newlabel{sec:Security}{{10}{93}{Analysis of security properties}{section.1.10}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {10.1}Post-mapping formal verification with ProVerif}{93}{subsection.1.10.1}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {116}{\ignorespaces The button and window to launch security verification with ProVerif.}}{94}{figure.1.116}\protected@file@percent }
+\newlabel{fig:ProVerifWindow}{{116}{94}{The button and window to launch security verification with ProVerif}{figure.1.116}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {117}{\ignorespaces ProVerif verification results window.}}{94}{figure.1.117}\protected@file@percent }
+\newlabel{fig:ProVerifWindowRes}{{117}{94}{ProVerif verification results window}{figure.1.117}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {10.2}Symmetric Encryption}{95}{subsection.1.10.2}\protected@file@percent }
+\newlabel{sec:symenc}{{10.2}{95}{Symmetric Encryption}{subsection.1.10.2}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {118}{\ignorespaces Simple secured message exchange}}{95}{figure.1.118}\protected@file@percent }
+\newlabel{fig:sampleComp}{{118}{95}{Simple secured message exchange}{figure.1.118}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {119}{\ignorespaces Simple secured message exchange architecture}}{95}{figure.1.119}\protected@file@percent }
+\newlabel{fig:sampleArch}{{119}{95}{Simple secured message exchange architecture}{figure.1.119}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {10.3}Nonces}{95}{subsection.1.10.3}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {120}{\ignorespaces Cryptographic configuration for the security symmetric encryption 'sym'}}{96}{figure.1.120}\protected@file@percent }
+\newlabel{fig:sampleSecConfig}{{120}{96}{Cryptographic configuration for the security symmetric encryption 'sym'}{figure.1.120}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {121}{\ignorespaces Message exchange with nonce}}{96}{figure.1.121}\protected@file@percent }
+\newlabel{fig:nonce}{{121}{96}{Message exchange with nonce}{figure.1.121}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {10.4}Key exchange}{96}{subsection.1.10.4}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {122}{\ignorespaces Architecture of secured message exchange with nonce}}{97}{figure.1.122}\protected@file@percent }
+\newlabel{fig:nonceArch}{{122}{97}{Architecture of secured message exchange with nonce}{figure.1.122}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {123}{\ignorespaces Cryptographic configuration for the security pattern nonce 'n'}}{97}{figure.1.123}\protected@file@percent }
+\newlabel{fig:nonceSecConfig-n}{{123}{97}{Cryptographic configuration for the security pattern nonce 'n'}{figure.1.123}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {124}{\ignorespaces Cryptographic configuration for the security symmetric encryption 'symN'}}{98}{figure.1.124}\protected@file@percent }
+\newlabel{fig:nonceSecConfig-symN}{{124}{98}{Cryptographic configuration for the security symmetric encryption 'symN'}{figure.1.124}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {125}{\ignorespaces Key exchange protocol}}{98}{figure.1.125}\protected@file@percent }
+\newlabel{fig:keyComp}{{125}{98}{Key exchange protocol}{figure.1.125}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {126}{\ignorespaces Key exchange architecture with mapped keys}}{99}{figure.1.126}\protected@file@percent }
+\newlabel{fig:keyArch}{{126}{99}{Key exchange architecture with mapped keys}{figure.1.126}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {127}{\ignorespaces Cryptographic configuration for the security asymmetric encryption 'aenc'}}{99}{figure.1.127}\protected@file@percent }
+\newlabel{fig:keySecConfig-aenc}{{127}{99}{Cryptographic configuration for the security asymmetric encryption 'aenc'}{figure.1.127}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {10.5}MAC}{100}{subsection.1.10.5}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {128}{\ignorespaces MAC verification protocol}}{100}{figure.1.128}\protected@file@percent }
+\newlabel{fig:macComp}{{128}{100}{MAC verification protocol}{figure.1.128}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {129}{\ignorespaces Architecture of secured message exchange with MAC}}{100}{figure.1.129}\protected@file@percent }
+\newlabel{fig:macArch}{{129}{100}{Architecture of secured message exchange with MAC}{figure.1.129}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {10.6}Automated Security Generation}{100}{subsection.1.10.6}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {130}{\ignorespaces Cryptographic configuration for the security pattern MAC 'mac'}}{101}{figure.1.130}\protected@file@percent }
+\newlabel{fig:macSecConfig}{{130}{101}{Cryptographic configuration for the security pattern MAC 'mac'}{figure.1.130}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {131}{\ignorespaces Button and window for Automatic Security Generation}}{101}{figure.1.131}\protected@file@percent }
+\newlabel{fig:autosec}{{131}{101}{Button and window for Automatic Security Generation}{figure.1.131}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {132}{\ignorespaces Application model for security generation example}}{102}{figure.1.132}\protected@file@percent }
+\newlabel{fig:autogenexample}{{132}{102}{Application model for security generation example}{figure.1.132}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {133}{\ignorespaces Initial architecture of the security generation example}}{102}{figure.1.133}\protected@file@percent }
+\newlabel{fig:ArchAutogenexample}{{133}{102}{Initial architecture of the security generation example}{figure.1.133}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {134}{\ignorespaces Secured Application Models with Automatic Generation}}{102}{figure.1.134}\protected@file@percent }
+\newlabel{fig:autogenres}{{134}{102}{Secured Application Models with Automatic Generation}{figure.1.134}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {135}{\ignorespaces Auto generated architecture for the secured model}}{103}{figure.1.135}\protected@file@percent }
+\newlabel{fig:ArchAutogenres}{{135}{103}{Auto generated architecture for the secured model}{figure.1.135}{}}
+\@writefile{toc}{\contentsline {section}{\numberline {11}Conclusion}{103}{section.1.11}\protected@file@percent }
+\newlabel{sec:Conclusion}{{11}{103}{Conclusion}{section.1.11}{}}
+\@writefile{toc}{\contentsline {section}{\numberline {1.A}Formal description of Communication Patterns}{104}{section.a.1.A}\protected@file@percent }
+\newlabel{app:FormalCP}{{1.A}{104}{Formal description of Communication Patterns}{section.a.1.A}{}}
 \citation{Apvrille06,Apvrille08}
 \citation{Knorreck11}
 \citation{EnriciThesis}
 \citation{Jaber2011}
-\@writefile{toc}{\contentsline {section}{\numberline {1.B}TTool/DIPLODOCUS' simulation semantics}{103}{section.a.1.B}\protected@file@percent }
-\newlabel{app:SimuSemantics}{{1.B}{103}{TTool/DIPLODOCUS' simulation semantics}{section.a.1.B}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.B.1}Functionality}{103}{subsection.a.1.B.1}\protected@file@percent }
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.B.2}Platform}{103}{subsection.a.1.B.2}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{\numberline {1.B}TTool/DIPLODOCUS' simulation semantics}{107}{section.a.1.B}\protected@file@percent }
+\newlabel{app:SimuSemantics}{{1.B}{107}{TTool/DIPLODOCUS' simulation semantics}{section.a.1.B}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {1.B.1}Functionality}{107}{subsection.a.1.B.1}\protected@file@percent }
+\@writefile{toc}{\contentsline {subsection}{\numberline {1.B.2}Platform}{107}{subsection.a.1.B.2}\protected@file@percent }
 \citation{Jaber2011}
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.B.3}Mapping}{104}{subsection.a.1.B.3}\protected@file@percent }
+\@writefile{toc}{\contentsline {subsection}{\numberline {1.B.3}Mapping}{108}{subsection.a.1.B.3}\protected@file@percent }
 \bibcite{Schmidt}{1}
 \bibcite{TToolWebSite}{2}
 \bibcite{Knorreck09}{3}
@@ -452,4 +470,4 @@
 \bibcite{Waseem09}{26}
 \bibcite{Zedboard}{27}
 \bibcite{BlanchetJCS08}{28}
-\gdef \@abspage@last{106}
+\gdef \@abspage@last{110}
diff --git a/doc/diplodocus_tutorial/build/Tutorial.log b/doc/diplodocus_tutorial/build/Tutorial.log
index c9e84f0224..b1b7cd950f 100644
--- a/doc/diplodocus_tutorial/build/Tutorial.log
+++ b/doc/diplodocus_tutorial/build/Tutorial.log
@@ -1,4 +1,4 @@
-This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/MacPorts 2022.62882_2) (preloaded format=pdflatex 2023.4.30)  15 MAY 2023 09:04
+This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/MacPorts 2022.62882_2) (preloaded format=pdflatex 2023.4.30)  15 MAY 2023 09:33
 entering extended mode
  restricted \write18 enabled.
  %&-line parsing enabled.
@@ -1656,180 +1656,249 @@ File: figures/RGMinimized.png Graphic file (type png)
 <use figures/RGMinimized.png>
 Package pdftex.def Info: figures/RGMinimized.png  used on input line 3142.
 (pdftex.def)             Requested size: 507.03091pt x 426.16049pt.
-[83 <./figures/RGTree.png> <./figures/RGMinimizationWindow.png>]
-<figures/securityStuff/ProVerifWindow.png, id=2681, 559.08875pt x 466.74374pt>
-File: figures/securityStuff/ProVerifWindow.png Graphic file (type png)
-<use figures/securityStuff/ProVerifWindow.png>
-Package pdftex.def Info: figures/securityStuff/ProVerifWindow.png  used on inpu
-t line 3203.
-(pdftex.def)             Requested size: 332.8941pt x 277.91895pt.
-<figures/securityStuff/ProVerifWindowRes.png, id=2682, 509.905pt x 462.72874pt>
-
-File: figures/securityStuff/ProVerifWindowRes.png Graphic file (type png)
-<use figures/securityStuff/ProVerifWindowRes.png>
-Package pdftex.def Info: figures/securityStuff/ProVerifWindowRes.png  used on i
-nput line 3210.
-(pdftex.def)             Requested size: 307.29288pt x 278.875pt.
-[84 <./figures/RGMinimizedTree.png>] [85 <./figures/RGMinimized.png>] [86 <./fi
-gures/securityStuff/ProVerifWindow.png> <./figures/securityStuff/ProVerifWindow
-Res.png>]
-<figures/PsiChartReal.pdf, id=2702, 1043.9pt x 1316.92pt>
+[83 <./figures/RGTree.png> <./figures/RGMinimizationWindow.png>] [84 <./figures
+/RGMinimizedTree.png>] [85 <./figures/RGMinimized.png>]
+<figures/PsiChartReal.pdf, id=2686, 1043.9pt x 1316.92pt>
 File: figures/PsiChartReal.pdf Graphic file (type pdf)
 <use figures/PsiChartReal.pdf>
-Package pdftex.def Info: figures/PsiChartReal.pdf  used on input line 3225.
+Package pdftex.def Info: figures/PsiChartReal.pdf  used on input line 3193.
 (pdftex.def)             Requested size: 1043.89745pt x 1316.9168pt.
 
 Package hyperref Warning: Difference (2) between bookmark levels is greater 
-(hyperref)                than one, level fixed on input line 3260.
+(hyperref)                than one, level fixed on input line 3228.
 
-<figures/ModelCompiler.pdf, id=2713, 2184.16pt x 762.85pt>
+<figures/ModelCompiler.pdf, id=2697, 2184.16pt x 762.85pt>
 File: figures/ModelCompiler.pdf Graphic file (type pdf)
 <use figures/ModelCompiler.pdf>
-Package pdftex.def Info: figures/ModelCompiler.pdf  used on input line 3287.
+Package pdftex.def Info: figures/ModelCompiler.pdf  used on input line 3255.
 (pdftex.def)             Requested size: 409.72124pt x 143.09222pt.
-[87 <./figures/PsiChartReal.pdf>] [88 <./figures/ModelCompiler.pdf>]
-<figures/screenshot/Prex.png, id=2865, 346.29375pt x 728.7225pt>
+[86 <./figures/PsiChartReal.pdf>] [87 <./figures/ModelCompiler.pdf>]
+<figures/screenshot/Prex.png, id=2849, 346.29375pt x 728.7225pt>
 File: figures/screenshot/Prex.png Graphic file (type png)
 <use figures/screenshot/Prex.png>
-Package pdftex.def Info: figures/screenshot/Prex.png  used on input line 3336.
+Package pdftex.def Info: figures/screenshot/Prex.png  used on input line 3304.
 (pdftex.def)             Requested size: 179.25548pt x 377.2255pt.
-<figures/screenshot/Postex.png, id=2866, 349.305pt x 698.61pt>
+<figures/screenshot/Postex.png, id=2850, 349.305pt x 698.61pt>
 File: figures/screenshot/Postex.png Graphic file (type png)
 <use figures/screenshot/Postex.png>
-Package pdftex.def Info: figures/screenshot/Postex.png  used on input line 3344
+Package pdftex.def Info: figures/screenshot/Postex.png  used on input line 3312
 .
 (pdftex.def)             Requested size: 179.25548pt x 358.51431pt.
-<figures/screenshot/CCodeGenButton.pdf, id=2868, 1096.89806pt x 616.70403pt>
+<figures/screenshot/CCodeGenButton.pdf, id=2852, 1096.89806pt x 616.70403pt>
 File: figures/screenshot/CCodeGenButton.pdf Graphic file (type pdf)
 <use figures/screenshot/CCodeGenButton.pdf>
 Package pdftex.def Info: figures/screenshot/CCodeGenButton.pdf  used on input l
-ine 3354.
+ine 3322.
 (pdftex.def)             Requested size: 512.1496pt x 287.94067pt.
-<figures/screenshot/CCodeGen1.png, id=2870, 1371.1225pt x 770.88pt>
+<figures/screenshot/CCodeGen1.png, id=2854, 1371.1225pt x 770.88pt>
 File: figures/screenshot/CCodeGen1.png Graphic file (type png)
 <use figures/screenshot/CCodeGen1.png>
 Package pdftex.def Info: figures/screenshot/CCodeGen1.png  used on input line 3
-366.
+334.
 (pdftex.def)             Requested size: 512.1496pt x 287.95007pt.
-[89 <./figures/screenshot/Prex.png>] [90 <./figures/screenshot/Postex.png>] [91
+[88 <./figures/screenshot/Prex.png>] [89 <./figures/screenshot/Postex.png>] [90
  <./figures/screenshot/CCodeGenButton.pdf> <./figures/screenshot/CCodeGen1.png>
 ]
 Package hyperref Info: bookmark level for unknown algorithm defaults to 0 on in
-put line 3398.
-<figures/screenshot/CCodeGen2.png, id=2899, 1371.1225pt x 770.88pt>
+put line 3366.
+<figures/screenshot/CCodeGen2.png, id=2882, 1371.1225pt x 770.88pt>
 File: figures/screenshot/CCodeGen2.png Graphic file (type png)
 <use figures/screenshot/CCodeGen2.png>
 Package pdftex.def Info: figures/screenshot/CCodeGen2.png  used on input line 3
-419.
+387.
 (pdftex.def)             Requested size: 512.1496pt x 287.95007pt.
 
-Underfull \hbox (badness 10000) in paragraph at lines 3430--3433
+Underfull \hbox (badness 10000) in paragraph at lines 3398--3401
 
  []
 
 Package hyperref Info: bookmark level for unknown lstlisting defaults to 0 on i
-nput line 3464.
-[92] [93]
-Underfull \hbox (badness 10000) in paragraph at lines 3528--3531
+nput line 3432.
+[91] [92]
+Underfull \hbox (badness 10000) in paragraph at lines 3497--3500
 
  []
 
-<figures/securityStuff/sampleArch.pdf, id=2972, 935.495pt x 249.93375pt>
-File: figures/securityStuff/sampleArch.pdf Graphic file (type pdf)
-<use figures/securityStuff/sampleArch.pdf>
-Package pdftex.def Info: figures/securityStuff/sampleArch.pdf  used on input li
-ne 3540.
-(pdftex.def)             Requested size: 358.50314pt x 95.78049pt.
-<figures/securityStuff/sampleComp.pdf, id=2975, 786.94pt x 219.82124pt>
+<figures/securityStuff/ProVerifWindow.png, id=2961, 559.08875pt x 466.74374pt>
+File: figures/securityStuff/ProVerifWindow.png Graphic file (type png)
+<use figures/securityStuff/ProVerifWindow.png>
+Package pdftex.def Info: figures/securityStuff/ProVerifWindow.png  used on inpu
+t line 3527.
+(pdftex.def)             Requested size: 332.8941pt x 277.91895pt.
+<figures/securityStuff/ProVerifWindowRes.png, id=2962, 509.905pt x 462.72874pt>
+
+File: figures/securityStuff/ProVerifWindowRes.png Graphic file (type png)
+<use figures/securityStuff/ProVerifWindowRes.png>
+Package pdftex.def Info: figures/securityStuff/ProVerifWindowRes.png  used on i
+nput line 3534.
+(pdftex.def)             Requested size: 307.29288pt x 278.875pt.
+[93 <./figures/screenshot/CCodeGen2.png>] [94 <./figures/securityStuff/ProVerif
+Window.png> <./figures/securityStuff/ProVerifWindowRes.png>]
+<figures/securityStuff/sampleComp.pdf, id=2979, 786.94pt x 219.82124pt>
 File: figures/securityStuff/sampleComp.pdf Graphic file (type pdf)
 <use figures/securityStuff/sampleComp.pdf>
 Package pdftex.def Info: figures/securityStuff/sampleComp.pdf  used on input li
-ne 3559.
+ne 3561.
 (pdftex.def)             Requested size: 358.50314pt x 100.14291pt.
-[94 <./figures/screenshot/CCodeGen2.png> <./figures/securityStuff/sampleArch.pd
-f>]
-<figures/securityStuff/alice_bob_nonce_ad_alice-svg.pdf, id=2984, 106.3975pt x 
-198.7425pt>
-File: figures/securityStuff/alice_bob_nonce_ad_alice-svg.pdf Graphic file (type
- pdf)
-<use figures/securityStuff/alice_bob_nonce_ad_alice-svg.pdf>
-Package pdftex.def Info: figures/securityStuff/alice_bob_nonce_ad_alice-svg.pdf
-  used on input line 3581.
-(pdftex.def)             Requested size: 76.8193pt x 143.50084pt.
-<figures/securityStuff/fv_alice_bob_nonce-svg.pdf, id=2985, 397.485pt x 138.517
-5pt>
-File: figures/securityStuff/fv_alice_bob_nonce-svg.pdf Graphic file (type pdf)
-<use figures/securityStuff/fv_alice_bob_nonce-svg.pdf>
-Package pdftex.def Info: figures/securityStuff/fv_alice_bob_nonce-svg.pdf  used
- on input line 3582.
-(pdftex.def)             Requested size: 307.29288pt x 107.08997pt.
-<figures/securityStuff/alice_bob_nonce_ad_bob-svg.pdf, id=2986, 111.41624pt x 2
-42.9075pt>
-File: figures/securityStuff/alice_bob_nonce_ad_bob-svg.pdf Graphic file (type p
-df)
-<use figures/securityStuff/alice_bob_nonce_ad_bob-svg.pdf>
-Package pdftex.def Info: figures/securityStuff/alice_bob_nonce_ad_bob-svg.pdf  
-used on input line 3583.
-(pdftex.def)             Requested size: 76.8193pt x 167.48032pt.
-<figures/securityStuff/keyArch.pdf, id=2989, 937.5025pt x 245.91875pt>
-File: figures/securityStuff/keyArch.pdf Graphic file (type pdf)
-<use figures/securityStuff/keyArch.pdf>
-Package pdftex.def Info: figures/securityStuff/keyArch.pdf  used on input line 
-3601.
-(pdftex.def)             Requested size: 358.50314pt x 94.03922pt.
-<figures/securityStuff/keyComp.pdf, id=2990, 871.255pt x 333.245pt>
+<figures/securityStuff/arch_alice_bob_sym.pdf, id=2980, 573.93425pt x 217.33199
+pt>
+File: figures/securityStuff/arch_alice_bob_sym.pdf Graphic file (type pdf)
+<use figures/securityStuff/arch_alice_bob_sym.pdf>
+Package pdftex.def Info: figures/securityStuff/arch_alice_bob_sym.pdf  used on 
+input line 3567.
+(pdftex.def)             Requested size: 409.72124pt x 155.15572pt.
+<figures/securityStuff/encrypt-config-symmetric.png, id=2981, 652.4375pt x 451.
+6875pt>
+File: figures/securityStuff/encrypt-config-symmetric.png Graphic file (type png
+)
+<use figures/securityStuff/encrypt-config-symmetric.png>
+Package pdftex.def Info: figures/securityStuff/encrypt-config-symmetric.png  us
+ed on input line 3573.
+(pdftex.def)             Requested size: 358.50314pt x 248.20145pt.
+<figures/securityStuff/fv_alice_bob_nonce.pdf, id=2986, 523.84134pt x 226.22015
+pt>
+File: figures/securityStuff/fv_alice_bob_nonce.pdf Graphic file (type pdf)
+<use figures/securityStuff/fv_alice_bob_nonce.pdf>
+Package pdftex.def Info: figures/securityStuff/fv_alice_bob_nonce.pdf  used on 
+input line 3599.
+(pdftex.def)             Requested size: 409.72124pt x 176.94463pt.
+[95 <./figures/securityStuff/sampleComp.pdf> <./figures/securityStuff/arch_alic
+e_bob_sym.pdf>]
+<figures/securityStuff/arch_alice_bob_nonce.pdf, id=3790, 510.69803pt x 248.197
+3pt>
+File: figures/securityStuff/arch_alice_bob_nonce.pdf Graphic file (type pdf)
+<use figures/securityStuff/arch_alice_bob_nonce.pdf>
+Package pdftex.def Info: figures/securityStuff/arch_alice_bob_nonce.pdf  used o
+n input line 3606.
+(pdftex.def)             Requested size: 409.72124pt x 199.12616pt.
+<figures/securityStuff/encrypt-config-nonce-n.png, id=3791, 652.4375pt x 451.68
+75pt>
+File: figures/securityStuff/encrypt-config-nonce-n.png Graphic file (type png)
+<use figures/securityStuff/encrypt-config-nonce-n.png>
+Package pdftex.def Info: figures/securityStuff/encrypt-config-nonce-n.png  used
+ on input line 3612.
+(pdftex.def)             Requested size: 358.50314pt x 248.20145pt.
+<figures/securityStuff/encrypt-config-nonce-symN.png, id=3792, 652.4375pt x 451
+.6875pt>
+File: figures/securityStuff/encrypt-config-nonce-symN.png Graphic file (type pn
+g)
+<use figures/securityStuff/encrypt-config-nonce-symN.png>
+Package pdftex.def Info: figures/securityStuff/encrypt-config-nonce-symN.png  u
+sed on input line 3618.
+(pdftex.def)             Requested size: 358.50314pt x 248.20145pt.
+[96 <./figures/securityStuff/encrypt-config-symmetric.png> <./figures/securityS
+tuff/fv_alice_bob_nonce.pdf>] [97 <./figures/securityStuff/arch_alice_bob_nonce
+.pdf> <./figures/securityStuff/encrypt-config-nonce-n.png>]
+<figures/securityStuff/keyComp.pdf, id=4754, 871.255pt x 333.245pt>
 File: figures/securityStuff/keyComp.pdf Graphic file (type pdf)
 <use figures/securityStuff/keyComp.pdf>
 Package pdftex.def Info: figures/securityStuff/keyComp.pdf  used on input line 
-3609.
+3641.
 (pdftex.def)             Requested size: 409.72124pt x 156.71161pt.
-[95 <./figures/securityStuff/sampleComp.pdf> <./figures/securityStuff/alice_bob
-_nonce_ad_alice-svg.pdf> <./figures/securityStuff/fv_alice_bob_nonce-svg.pdf> <
-./figures/securityStuff/alice_bob_nonce_ad_bob-svg.pdf>]
-<figures/securityStuff/macComp.pdf, id=3052, 787.94376pt x 212.795pt>
+<figures/securityStuff/arch_alice_bob_keyExchange.pdf, id=4755, 514.46207pt x 2
+22.60167pt>
+File: figures/securityStuff/arch_alice_bob_keyExchange.pdf Graphic file (type p
+df)
+<use figures/securityStuff/arch_alice_bob_keyExchange.pdf>
+Package pdftex.def Info: figures/securityStuff/arch_alice_bob_keyExchange.pdf  
+used on input line 3647.
+(pdftex.def)             Requested size: 358.50314pt x 155.1238pt.
+<figures/securityStuff/encrypt-config-keyexchange-aenc.png, id=4756, 652.4375pt
+ x 451.6875pt>
+File: figures/securityStuff/encrypt-config-keyexchange-aenc.png Graphic file (t
+ype png)
+<use figures/securityStuff/encrypt-config-keyexchange-aenc.png>
+Package pdftex.def Info: figures/securityStuff/encrypt-config-keyexchange-aenc.
+png  used on input line 3653.
+(pdftex.def)             Requested size: 358.50314pt x 248.20145pt.
+
+Underfull \vbox (badness 10000) has occurred while \output is active []
+
+[98 <./figures/securityStuff/encrypt-config-nonce-symN.png> <./figures/security
+Stuff/keyComp.pdf>] [99 <./figures/securityStuff/arch_alice_bob_keyExchange.pdf
+> <./figures/securityStuff/encrypt-config-keyexchange-aenc.png>]
+<figures/securityStuff/macComp.pdf, id=5567, 787.94376pt x 212.795pt>
 File: figures/securityStuff/macComp.pdf Graphic file (type pdf)
 <use figures/securityStuff/macComp.pdf>
 Package pdftex.def Info: figures/securityStuff/macComp.pdf  used on input line 
-3635.
+3678.
 (pdftex.def)             Requested size: 358.50314pt x 96.81862pt.
-<figures/securityStuff/autoSec.png, id=3053, 655.44875pt x 639.38875pt>
+<figures/securityStuff/arch_alice_bob_mac.pdf, id=5568, 510.69803pt x 222.60167
+pt>
+File: figures/securityStuff/arch_alice_bob_mac.pdf Graphic file (type pdf)
+<use figures/securityStuff/arch_alice_bob_mac.pdf>
+Package pdftex.def Info: figures/securityStuff/arch_alice_bob_mac.pdf  used on 
+input line 3684.
+(pdftex.def)             Requested size: 358.50314pt x 156.26506pt.
+<figures/securityStuff/encrypt-config-mac.png, id=5569, 652.4375pt x 451.6875pt
+>
+File: figures/securityStuff/encrypt-config-mac.png Graphic file (type png)
+<use figures/securityStuff/encrypt-config-mac.png>
+Package pdftex.def Info: figures/securityStuff/encrypt-config-mac.png  used on 
+input line 3690.
+(pdftex.def)             Requested size: 358.50314pt x 248.20145pt.
+<figures/securityStuff/autoSec.png, id=5570, 655.44875pt x 639.38875pt>
 File: figures/securityStuff/autoSec.png Graphic file (type png)
 <use figures/securityStuff/autoSec.png>
 Package pdftex.def Info: figures/securityStuff/autoSec.png  used on input line 
-3647.
+3702.
 (pdftex.def)             Requested size: 358.50314pt x 349.72339pt.
-[96 <./figures/securityStuff/keyArch.pdf> <./figures/securityStuff/keyComp.pdf>
-] [97 <./figures/securityStuff/macComp.pdf> <./figures/securityStuff/autoSec.pn
-g>]
-<figures/securityStuff/secComp.pdf, id=3076, 282.12746pt x 73.23029pt>
+<figures/securityStuff/secComp.pdf, id=5576, 282.12746pt x 73.23029pt>
 File: figures/securityStuff/secComp.pdf Graphic file (type pdf)
 <use figures/securityStuff/secComp.pdf>
 Package pdftex.def Info: figures/securityStuff/secComp.pdf  used on input line 
-3659.
+3713.
 (pdftex.def)             Requested size: 256.0748pt x 66.46756pt.
-<figures/securityStuff/secCompRes.pdf, id=3077, 473.14725pt x 245.10815pt>
-File: figures/securityStuff/secCompRes.pdf Graphic file (type pdf)
-<use figures/securityStuff/secCompRes.pdf>
-Package pdftex.def Info: figures/securityStuff/secCompRes.pdf  used on input li
-ne 3667.
-(pdftex.def)             Requested size: 409.72124pt x 212.25873pt.
-[98 <./figures/securityStuff/secComp.pdf> <./figures/securityStuff/secCompRes.p
-df
-
-pdfTeX warning: /opt/local/bin/pdflatex (file ./figures/securityStuff/secCompRe
-s.pdf): PDF inclusion: multiple pdfs with page group included in a single page
->] [99] [100] [101] [102] [103] [104] [105] [106] (build/Tutorial.aux)
+<figures/securityStuff/arch_alice_bob_sampleAuto.pdf, id=5577, 533.28238pt x 22
+0.34323pt>
+File: figures/securityStuff/arch_alice_bob_sampleAuto.pdf Graphic file (type pd
+f)
+<use figures/securityStuff/arch_alice_bob_sampleAuto.pdf>
+Package pdftex.def Info: figures/securityStuff/arch_alice_bob_sampleAuto.pdf  u
+sed on input line 3719.
+(pdftex.def)             Requested size: 409.72124pt x 169.29832pt.
+<figures/securityStuff/fv_alice_bob_Autononce_with_ad.pdf, id=5578, 696.59416pt
+ x 241.27641pt>
+File: figures/securityStuff/fv_alice_bob_Autononce_with_ad.pdf Graphic file (ty
+pe pdf)
+<use figures/securityStuff/fv_alice_bob_Autononce_with_ad.pdf>
+Package pdftex.def Info: figures/securityStuff/fv_alice_bob_Autononce_with_ad.p
+df  used on input line 3726.
+(pdftex.def)             Requested size: 460.9315pt x 159.65526pt.
+<figures/securityStuff/arch_alice_bob_Autononce.pdf, id=5579, 578.45113pt x 243
+.68042pt>
+File: figures/securityStuff/arch_alice_bob_Autononce.pdf Graphic file (type pdf
+)
+<use figures/securityStuff/arch_alice_bob_Autononce.pdf>
+Package pdftex.def Info: figures/securityStuff/arch_alice_bob_Autononce.pdf  us
+ed on input line 3732.
+(pdftex.def)             Requested size: 409.72124pt x 172.60158pt.
+[100 <./figures/securityStuff/macComp.pdf> <./figures/securityStuff/arch_alice_
+bob_mac.pdf>] [101 <./figures/securityStuff/encrypt-config-mac.png> <./figures/
+securityStuff/autoSec.png>] [102 <./figures/securityStuff/secComp.pdf> <./figur
+es/securityStuff/arch_alice_bob_sampleAuto.pdf
+
+pdfTeX warning: /opt/local/bin/pdflatex (file ./figures/securityStuff/arch_alic
+e_bob_sampleAuto.pdf): PDF inclusion: multiple pdfs with page group included in
+ a single page
+> <./figures/securityStuff/fv_alice_bob_Autononce_with_ad.pdf
+
+pdfTeX warning: /opt/local/bin/pdflatex (file ./figures/securityStuff/fv_alice_
+bob_Autononce_with_ad.pdf): PDF inclusion: multiple pdfs with page group includ
+ed in a single page
+>] [103 <./figures/securityStuff/arch_alice_bob_Autononce.pdf>] [104] [105] [10
+6] [107] [108] [109] [110] (build/Tutorial.aux)
 
 LaTeX Font Warning: Some font shapes were not available, defaults substituted.
 
 Package rerunfilecheck Info: File `Tutorial.out' has not changed.
-(rerunfilecheck)             Checksum: 6BBF8DE0DDB8BC43A86DEA0130CA0D4B;11289.
+(rerunfilecheck)             Checksum: 87CD6A49C327E4499089BDC5EEF2C5B1;11291.
  ) 
 Here is how much of TeX's memory you used:
- 15193 strings out of 479309
- 247990 string characters out of 5867802
- 1624210 words of memory out of 5000000
- 32292 multiletter control sequences out of 15000+600000
+ 15264 strings out of 479309
+ 251080 string characters out of 5867802
+ 1624011 words of memory out of 5000000
+ 32343 multiletter control sequences out of 15000+600000
  476630 words of font info for 55 fonts, out of 8000000 for 9000
  475 hyphenation exceptions out of 8191
  60i,21n,63p,655b,1469s stack positions out of 10000i,1000n,20000p,200000b,200000s
@@ -1861,10 +1930,10 @@ ublic/amsfonts/cm/cmtt8.pfb></opt/local/share/texmf-texlive/fonts/type1/public/
 amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm-sup
 er/sfrm0500.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm-super/sfr
 m1000.pfb>
-Output written on build/Tutorial.pdf (106 pages, 7792319 bytes).
+Output written on build/Tutorial.pdf (110 pages, 8457183 bytes).
 PDF statistics:
- 3391 PDF objects out of 3580 (max. 8388607)
- 2592 compressed objects within 26 object streams
- 598 named destinations out of 1000 (max. 500000)
- 1060 words of extra memory for PDF output out of 10000 (max. 10000000)
+ 8890 PDF objects out of 8907 (max. 8388607)
+ 6140 compressed objects within 62 object streams
+ 611 named destinations out of 1000 (max. 500000)
+ 1095 words of extra memory for PDF output out of 10000 (max. 10000000)
 
diff --git a/doc/diplodocus_tutorial/build/Tutorial.out b/doc/diplodocus_tutorial/build/Tutorial.out
index 57e6a3261b..a4fa1803d5 100644
--- a/doc/diplodocus_tutorial/build/Tutorial.out
+++ b/doc/diplodocus_tutorial/build/Tutorial.out
@@ -27,19 +27,19 @@
 \BOOKMARK [3][-]{section*.10}{\376\377\000P\000r\000e\000-\000m\000a\000p\000p\000i\000n\000g\000\040\000f\000o\000r\000m\000a\000l\000\040\000v\000e\000r\000i\000f\000i\000c\000a\000t\000i\000o\000n\000\040\000w\000i\000t\000h\000\040\000U\000P\000P\000A\000A\000L}{subsection.1.8.2}% 27
 \BOOKMARK [3][-]{section*.11}{\376\377\000P\000o\000s\000t\000-\000m\000a\000p\000p\000i\000n\000g\000\040\000f\000o\000r\000m\000a\000l\000\040\000V\000e\000r\000i\000f\000i\000c\000a\000t\000i\000o\000n\000\040\000w\000i\000t\000h\000\040\000t\000h\000e\000\040\000T\000T\000o\000o\000l\000\040\000v\000e\000r\000i\000f\000i\000e\000r\000\040\000a\000n\000d\000\040\000s\000i\000m\000u\000l\000a\000t\000o\000r\000\040\000e\000n\000g\000i\000n\000e}{subsection.1.8.2}% 28
 \BOOKMARK [3][-]{section*.12}{\376\377\000E\000x\000a\000m\000p\000l\000e\000\040\000o\000f\000\040\000p\000o\000s\000t\000-\000m\000a\000p\000p\000i\000n\000g\000\040\000f\000o\000r\000m\000a\000l\000\040\000v\000e\000r\000i\000f\000i\000c\000a\000t\000i\000o\000n}{subsection.1.8.2}% 29
-\BOOKMARK [3][-]{section*.13}{\376\377\000P\000o\000s\000t\000-\000m\000a\000p\000p\000i\000n\000g\000\040\000f\000o\000r\000m\000a\000l\000\040\000v\000e\000r\000i\000f\000i\000c\000a\000t\000i\000o\000n\000\040\000w\000i\000t\000h\000\040\000P\000r\000o\000V\000e\000r\000i\000f}{subsection.1.8.2}% 30
-\BOOKMARK [1][-]{section.1.9}{\376\377\000A\000u\000t\000o\000m\000a\000t\000i\000c\000\040\000C\000o\000d\000e\000\040\000G\000e\000n\000e\000r\000a\000t\000i\000o\000n\000\040\000f\000o\000r\000\040\000R\000a\000p\000i\000d\000\040\000P\000r\000o\000t\000o\000y\000p\000i\000n\000g}{chapter.1}% 31
-\BOOKMARK [2][-]{section*.14}{\376\377\000T\000h\000e\000\040\000c\000o\000m\000p\000i\000l\000a\000t\000i\000o\000n\000\040\000p\000r\000o\000c\000e\000s\000s}{section.1.9}% 32
-\BOOKMARK [3][-]{section*.15}{\376\377\000S\000c\000h\000e\000d\000u\000l\000i\000n\000g\000\040\000o\000f\000\040\000o\000p\000e\000r\000a\000t\000i\000o\000n\000s}{section*.14}% 33
-\BOOKMARK [3][-]{section*.16}{\376\377\000M\000e\000m\000o\000r\000y\000\040\000a\000l\000l\000o\000c\000a\000t\000i\000o\000n}{section*.14}% 34
-\BOOKMARK [3][-]{section*.17}{\376\377\000P\000o\000r\000t\000a\000b\000i\000l\000i\000t\000y\000\040\000o\000f\000\040\000t\000h\000e\000\040\000c\000o\000d\000e\000-\000g\000e\000n\000e\000r\000a\000t\000i\000o\000n\000\040\000a\000p\000p\000r\000o\000a\000c\000h}{section*.14}% 35
-\BOOKMARK [2][-]{subsection.1.9.1}{\376\377\000G\000e\000n\000e\000r\000a\000t\000i\000n\000g\000\040\000t\000h\000e\000\040\000c\000o\000d\000e\000\040\000f\000o\000r\000\040\000t\000h\000e\000\040\000Z\000i\000g\000B\000e\000e\000\040\000t\000r\000a\000n\000s\000m\000i\000t\000t\000e\000r}{section.1.9}% 36
-\BOOKMARK [1][-]{section.1.10}{\376\377\000A\000n\000a\000l\000y\000s\000i\000s\000\040\000o\000f\000\040\000s\000e\000c\000u\000r\000i\000t\000y\000\040\000p\000r\000o\000p\000e\000r\000t\000i\000e\000s}{chapter.1}% 37
-\BOOKMARK [2][-]{subsection.1.10.1}{\376\377\000S\000y\000m\000m\000e\000t\000r\000i\000c\000\040\000E\000n\000c\000r\000y\000p\000t\000i\000o\000n}{section.1.10}% 38
-\BOOKMARK [2][-]{subsection.1.10.2}{\376\377\000N\000o\000n\000c\000e\000s}{section.1.10}% 39
-\BOOKMARK [2][-]{subsection.1.10.3}{\376\377\000K\000e\000y\000\040\000e\000x\000c\000h\000a\000n\000g\000e}{section.1.10}% 40
-\BOOKMARK [2][-]{subsection.1.10.4}{\376\377\000M\000A\000C}{section.1.10}% 41
-\BOOKMARK [2][-]{subsection.1.10.5}{\376\377\000A\000u\000t\000o\000m\000a\000t\000e\000d\000\040\000S\000e\000c\000u\000r\000i\000t\000y\000\040\000G\000e\000n\000e\000r\000a\000t\000i\000o\000n}{section.1.10}% 42
+\BOOKMARK [1][-]{section.1.9}{\376\377\000A\000u\000t\000o\000m\000a\000t\000i\000c\000\040\000C\000o\000d\000e\000\040\000G\000e\000n\000e\000r\000a\000t\000i\000o\000n\000\040\000f\000o\000r\000\040\000R\000a\000p\000i\000d\000\040\000P\000r\000o\000t\000o\000y\000p\000i\000n\000g}{chapter.1}% 30
+\BOOKMARK [2][-]{section*.13}{\376\377\000T\000h\000e\000\040\000c\000o\000m\000p\000i\000l\000a\000t\000i\000o\000n\000\040\000p\000r\000o\000c\000e\000s\000s}{section.1.9}% 31
+\BOOKMARK [3][-]{section*.14}{\376\377\000S\000c\000h\000e\000d\000u\000l\000i\000n\000g\000\040\000o\000f\000\040\000o\000p\000e\000r\000a\000t\000i\000o\000n\000s}{section*.13}% 32
+\BOOKMARK [3][-]{section*.15}{\376\377\000M\000e\000m\000o\000r\000y\000\040\000a\000l\000l\000o\000c\000a\000t\000i\000o\000n}{section*.13}% 33
+\BOOKMARK [3][-]{section*.16}{\376\377\000P\000o\000r\000t\000a\000b\000i\000l\000i\000t\000y\000\040\000o\000f\000\040\000t\000h\000e\000\040\000c\000o\000d\000e\000-\000g\000e\000n\000e\000r\000a\000t\000i\000o\000n\000\040\000a\000p\000p\000r\000o\000a\000c\000h}{section*.13}% 34
+\BOOKMARK [2][-]{subsection.1.9.1}{\376\377\000G\000e\000n\000e\000r\000a\000t\000i\000n\000g\000\040\000t\000h\000e\000\040\000c\000o\000d\000e\000\040\000f\000o\000r\000\040\000t\000h\000e\000\040\000Z\000i\000g\000B\000e\000e\000\040\000t\000r\000a\000n\000s\000m\000i\000t\000t\000e\000r}{section.1.9}% 35
+\BOOKMARK [1][-]{section.1.10}{\376\377\000A\000n\000a\000l\000y\000s\000i\000s\000\040\000o\000f\000\040\000s\000e\000c\000u\000r\000i\000t\000y\000\040\000p\000r\000o\000p\000e\000r\000t\000i\000e\000s}{chapter.1}% 36
+\BOOKMARK [2][-]{subsection.1.10.1}{\376\377\000P\000o\000s\000t\000-\000m\000a\000p\000p\000i\000n\000g\000\040\000f\000o\000r\000m\000a\000l\000\040\000v\000e\000r\000i\000f\000i\000c\000a\000t\000i\000o\000n\000\040\000w\000i\000t\000h\000\040\000P\000r\000o\000V\000e\000r\000i\000f}{section.1.10}% 37
+\BOOKMARK [2][-]{subsection.1.10.2}{\376\377\000S\000y\000m\000m\000e\000t\000r\000i\000c\000\040\000E\000n\000c\000r\000y\000p\000t\000i\000o\000n}{section.1.10}% 38
+\BOOKMARK [2][-]{subsection.1.10.3}{\376\377\000N\000o\000n\000c\000e\000s}{section.1.10}% 39
+\BOOKMARK [2][-]{subsection.1.10.4}{\376\377\000K\000e\000y\000\040\000e\000x\000c\000h\000a\000n\000g\000e}{section.1.10}% 40
+\BOOKMARK [2][-]{subsection.1.10.5}{\376\377\000M\000A\000C}{section.1.10}% 41
+\BOOKMARK [2][-]{subsection.1.10.6}{\376\377\000A\000u\000t\000o\000m\000a\000t\000e\000d\000\040\000S\000e\000c\000u\000r\000i\000t\000y\000\040\000G\000e\000n\000e\000r\000a\000t\000i\000o\000n}{section.1.10}% 42
 \BOOKMARK [1][-]{section.1.11}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{chapter.1}% 43
 \BOOKMARK [1][-]{section.a.1.A}{\376\377\000F\000o\000r\000m\000a\000l\000\040\000d\000e\000s\000c\000r\000i\000p\000t\000i\000o\000n\000\040\000o\000f\000\040\000C\000o\000m\000m\000u\000n\000i\000c\000a\000t\000i\000o\000n\000\040\000P\000a\000t\000t\000e\000r\000n\000s}{chapter.1}% 44
 \BOOKMARK [1][-]{section.a.1.B}{\376\377\000T\000T\000o\000o\000l\000/\000D\000I\000P\000L\000O\000D\000O\000C\000U\000S\000'\000\040\000s\000i\000m\000u\000l\000a\000t\000i\000o\000n\000\040\000s\000e\000m\000a\000n\000t\000i\000c\000s}{chapter.1}% 45
diff --git a/doc/diplodocus_tutorial/build/Tutorial.toc b/doc/diplodocus_tutorial/build/Tutorial.toc
index 043b512614..1e6d9ce097 100644
--- a/doc/diplodocus_tutorial/build/Tutorial.toc
+++ b/doc/diplodocus_tutorial/build/Tutorial.toc
@@ -29,22 +29,22 @@
 \contentsline {subsubsection}{Pre-mapping formal verification with UPPAAL}{80}{section*.10}%
 \contentsline {subsubsection}{Post-mapping formal Verification with the TTool verifier and simulator engine}{80}{section*.11}%
 \contentsline {subsubsection}{Example of post-mapping formal verification}{81}{section*.12}%
-\contentsline {subsubsection}{Post-mapping formal verification with ProVerif}{84}{section*.13}%
-\contentsline {section}{\numberline {9}Automatic Code Generation for Rapid Protoyping}{87}{section.1.9}%
-\contentsline {subsubsection}{The compilation process}{87}{section*.14}%
-\contentsline {subsubsection}{Scheduling of operations}{88}{section*.15}%
-\contentsline {subsubsection}{Memory allocation}{88}{section*.16}%
-\contentsline {subsubsection}{Portability of the code-generation approach}{88}{section*.17}%
-\contentsline {subsection}{\numberline {9.1}Generating the code for the ZigBee transmitter}{89}{subsection.1.9.1}%
-\contentsline {section}{\numberline {10}Analysis of security properties}{94}{section.1.10}%
-\contentsline {subsection}{\numberline {10.1}Symmetric Encryption}{94}{subsection.1.10.1}%
-\contentsline {subsection}{\numberline {10.2}Nonces}{95}{subsection.1.10.2}%
-\contentsline {subsection}{\numberline {10.3}Key exchange}{95}{subsection.1.10.3}%
-\contentsline {subsection}{\numberline {10.4}MAC}{96}{subsection.1.10.4}%
-\contentsline {subsection}{\numberline {10.5}Automated Security Generation}{96}{subsection.1.10.5}%
-\contentsline {section}{\numberline {11}Conclusion}{99}{section.1.11}%
-\contentsline {section}{\numberline {1.A}Formal description of Communication Patterns}{100}{section.a.1.A}%
-\contentsline {section}{\numberline {1.B}TTool/DIPLODOCUS' simulation semantics}{103}{section.a.1.B}%
-\contentsline {subsection}{\numberline {1.B.1}Functionality}{103}{subsection.a.1.B.1}%
-\contentsline {subsection}{\numberline {1.B.2}Platform}{103}{subsection.a.1.B.2}%
-\contentsline {subsection}{\numberline {1.B.3}Mapping}{104}{subsection.a.1.B.3}%
+\contentsline {section}{\numberline {9}Automatic Code Generation for Rapid Protoyping}{86}{section.1.9}%
+\contentsline {subsubsection}{The compilation process}{86}{section*.13}%
+\contentsline {subsubsection}{Scheduling of operations}{87}{section*.14}%
+\contentsline {subsubsection}{Memory allocation}{87}{section*.15}%
+\contentsline {subsubsection}{Portability of the code-generation approach}{87}{section*.16}%
+\contentsline {subsection}{\numberline {9.1}Generating the code for the ZigBee transmitter}{88}{subsection.1.9.1}%
+\contentsline {section}{\numberline {10}Analysis of security properties}{93}{section.1.10}%
+\contentsline {subsection}{\numberline {10.1}Post-mapping formal verification with ProVerif}{93}{subsection.1.10.1}%
+\contentsline {subsection}{\numberline {10.2}Symmetric Encryption}{95}{subsection.1.10.2}%
+\contentsline {subsection}{\numberline {10.3}Nonces}{95}{subsection.1.10.3}%
+\contentsline {subsection}{\numberline {10.4}Key exchange}{96}{subsection.1.10.4}%
+\contentsline {subsection}{\numberline {10.5}MAC}{100}{subsection.1.10.5}%
+\contentsline {subsection}{\numberline {10.6}Automated Security Generation}{100}{subsection.1.10.6}%
+\contentsline {section}{\numberline {11}Conclusion}{103}{section.1.11}%
+\contentsline {section}{\numberline {1.A}Formal description of Communication Patterns}{104}{section.a.1.A}%
+\contentsline {section}{\numberline {1.B}TTool/DIPLODOCUS' simulation semantics}{107}{section.a.1.B}%
+\contentsline {subsection}{\numberline {1.B.1}Functionality}{107}{subsection.a.1.B.1}%
+\contentsline {subsection}{\numberline {1.B.2}Platform}{107}{subsection.a.1.B.2}%
+\contentsline {subsection}{\numberline {1.B.3}Mapping}{108}{subsection.a.1.B.3}%
diff --git a/modeling/SysMLSec/AliceAndBobHW.xml b/modeling/SysMLSec/AliceAndBobHW.xml
index dc454d68ad..10983f1464 100644
--- a/modeling/SysMLSec/AliceAndBobHW.xml
+++ b/modeling/SysMLSec/AliceAndBobHW.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="true" ACTIVATE_PENALTIES="true" UPDATE_INFORMATION_DIPLO_SIM="true" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="0" LAST_SELECTED_SUB_TAB="0">
+<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="true" ACTIVATE_PENALTIES="true" UPDATE_INFORMATION_DIPLO_SIM="true" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="1" LAST_SELECTED_SUB_TAB="0">
 
 <Modeling type="TML Component Design" nameTab="SymmetricExchange" tabs="TML Component Task Diagram$Bob$Alice" >
 <TMLComponentTaskDiagramPanel name="TML Component Task Diagram" minX="10" maxX="2500" minY="10" maxY="1500" channels="true" events="true" requests="true" considerExecOperators="true" considerTimingOperators="true" zoom="1.0" >
@@ -42,7 +42,7 @@
 <new d="false" />
 <TGConnectingPoint num="0" id="2" />
 <extraparam>
-<Prop commName="comm" commType="0" origin="false" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="uint_16" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="true" checkWeakAuthStatus="2" checkStrongAuthStatus="0" vc="0" />
+<Prop commName="comm" commType="0" origin="false" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="uint_16" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="true" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
@@ -80,7 +80,7 @@
 <new d="false" />
 <TGConnectingPoint num="0" id="13" />
 <extraparam>
-<Prop commName="comm" commType="0" origin="true" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="uint_16" associatedEvent="" checkConf="true" checkConfStatus="2" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
+<Prop commName="comm" commType="0" origin="true" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="uint_16" associatedEvent="" checkConf="true" checkConfStatus="1" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
@@ -465,9 +465,9 @@
 <SUBCOMPONENT type="1103" id="115" index="19" uid="88fb09e0-aa10-49a5-b9e0-2cf522d4c2c4" >
 <father id="140" num="0" />
 <cdparam x="438" y="370" />
-<sizeparam width="205" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<sizeparam width="192" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="8" minY="0" maxY="63" />
+<cdrectangleparam minX="0" maxX="21" minY="0" maxY="63" />
 <infoparam name="TGComponent" value="SymmetricExchange::comm" />
 <new d="false" />
 <TGConnectingPoint num="0" id="107" />
@@ -747,9 +747,9 @@
 <SUBCOMPONENT type="1101" id="292" index="22" uid="afa83252-307c-453d-86f8-150040931796" >
 <father id="317" num="0" />
 <cdparam x="165" y="189" />
-<sizeparam width="197" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<sizeparam width="184" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="7" minY="0" maxY="60" />
+<cdrectangleparam minX="0" maxX="20" minY="0" maxY="60" />
 <infoparam name="TGComponent" value="SymmetricExchange::Alice" />
 <new d="false" />
 <TGConnectingPoint num="0" id="284" />
@@ -804,9 +804,9 @@
 <SUBCOMPONENT type="1101" id="326" index="23" uid="04f1465b-0758-46b2-950a-d97160166d7d" >
 <father id="351" num="0" />
 <cdparam x="725" y="192" />
-<sizeparam width="192" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<sizeparam width="179" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="8" minY="0" maxY="60" />
+<cdrectangleparam minX="0" maxX="21" minY="0" maxY="60" />
 <infoparam name="TGComponent" value="SymmetricExchange::Bob" />
 <new d="false" />
 <TGConnectingPoint num="0" id="318" />
@@ -862,8 +862,8 @@
 <cdparam x="578" y="303" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="Connector between ports" />
-<P1  x="590" y="318" id="371" />
-<P2  x="659" y="318" id="358" />
+<P1  x="577" y="306" id="369" />
+<P2  x="671" y="306" id="356" />
 <AutomaticDrawing  data="true" />
 <new d="false" />
 </CONNECTOR>
@@ -871,8 +871,8 @@
 <cdparam x="578" y="246" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="Connector between ports" />
-<P1  x="590" y="275" id="369" />
-<P2  x="659" y="275" id="356" />
+<P1  x="577" y="263" id="371" />
+<P2  x="671" y="263" id="358" />
 <AutomaticDrawing  data="true" />
 <new d="false" />
 </CONNECTOR>
@@ -895,17 +895,17 @@
 <Data isAttacker="No" daemon="false" periodic="false" periodValue="" unit="ns" Operation="" />
 </extraparam>
 </COMPONENT>
-<SUBCOMPONENT type="1203" id="357" index="4" uid="88d5d3ae-02e6-45d4-939c-f4e23df82248" >
+<SUBCOMPONENT type="1203" id="357" index="4" uid="b6a9696d-2351-4e1d-889e-8e28ef415911" >
 <father id="368" num="0" />
-<cdparam x="659" y="263" />
+<cdparam x="659" y="306" />
 <sizeparam width="25" height="25" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="-12" maxX="147" minY="-12" maxY="108" />
-<infoparam name="Primitive port" value="Channel comm" />
+<infoparam name="Primitive port" value="Channel nonce_ch" />
 <new d="false" />
 <TGConnectingPoint num="0" id="356" />
 <extraparam>
-<Prop commName="comm" commType="0" origin="false" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="null" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="true" checkWeakAuthStatus="2" checkStrongAuthStatus="2" vc="0" />
+<Prop commName="nonce_ch" commType="0" origin="true" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="int16_t" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
@@ -913,17 +913,17 @@
 <Type type="0" typeOther="" />
 </extraparam>
 </SUBCOMPONENT>
-<SUBCOMPONENT type="1203" id="359" index="5" uid="b6a9696d-2351-4e1d-889e-8e28ef415911" >
+<SUBCOMPONENT type="1203" id="359" index="5" uid="88d5d3ae-02e6-45d4-939c-f4e23df82248" >
 <father id="368" num="1" />
-<cdparam x="659" y="306" />
+<cdparam x="659" y="263" />
 <sizeparam width="25" height="25" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="-12" maxX="147" minY="-12" maxY="108" />
-<infoparam name="Primitive port" value="Channel nonce_ch" />
+<infoparam name="Primitive port" value="Channel comm" />
 <new d="false" />
 <TGConnectingPoint num="0" id="358" />
 <extraparam>
-<Prop commName="nonce_ch" commType="0" origin="true" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="int16_t" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
+<Prop commName="comm" commType="0" origin="false" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="null" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="true" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
@@ -951,17 +951,17 @@
 <Data isAttacker="No" daemon="false" periodic="false" periodValue="" unit="" Operation="" />
 </extraparam>
 </COMPONENT>
-<SUBCOMPONENT type="1203" id="370" index="6" uid="4b3c553b-8c45-4729-8a22-92683c78ab19" >
+<SUBCOMPONENT type="1203" id="370" index="6" uid="3a57071f-7f06-425a-a0a5-d6c487afbd10" >
 <father id="381" num="0" />
-<cdparam x="565" y="263" />
+<cdparam x="565" y="306" />
 <sizeparam width="25" height="25" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="-12" maxX="147" minY="-12" maxY="107" />
-<infoparam name="Primitive port" value="Channel comm" />
+<infoparam name="Primitive port" value="Channel nonce_ch" />
 <new d="false" />
 <TGConnectingPoint num="0" id="369" />
 <extraparam>
-<Prop commName="comm" commType="0" origin="true" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="int16_t" associatedEvent="" checkConf="true" checkConfStatus="2" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
+<Prop commName="nonce_ch" commType="0" origin="false" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="int16_t" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
@@ -969,17 +969,17 @@
 <Type type="0" typeOther="" />
 </extraparam>
 </SUBCOMPONENT>
-<SUBCOMPONENT type="1203" id="372" index="7" uid="3a57071f-7f06-425a-a0a5-d6c487afbd10" >
+<SUBCOMPONENT type="1203" id="372" index="7" uid="4b3c553b-8c45-4729-8a22-92683c78ab19" >
 <father id="381" num="1" />
-<cdparam x="565" y="306" />
+<cdparam x="565" y="263" />
 <sizeparam width="25" height="25" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="-12" maxX="147" minY="-12" maxY="107" />
-<infoparam name="Primitive port" value="Channel nonce_ch" />
+<infoparam name="Primitive port" value="Channel comm" />
 <new d="false" />
 <TGConnectingPoint num="0" id="371" />
 <extraparam>
-<Prop commName="nonce_ch" commType="0" origin="false" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="int16_t" associatedEvent="" checkConf="false" checkConfStatus="0" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
+<Prop commName="comm" commType="0" origin="true" finite="false" blocking="false" maxSamples="8" widthSamples="4" isLossy="false" isPrex="false" isPostex="false" lossPercentage="0" maxNbOfLoss="0" dataFlowType="int16_t" associatedEvent="" checkConf="true" checkConfStatus="1" checkAuth="false" checkWeakAuthStatus="0" checkStrongAuthStatus="0" vc="0" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
 <Type type="0" typeOther="" />
@@ -1407,13 +1407,13 @@
 <attributes byteDataSize="4"  memorySize="1024"  clockRatio="1"  bufferType="0" />
 </extraparam>
 </COMPONENT>
-<SUBCOMPONENT type="1103" id="483" index="19" uid="758629cb-5cec-476e-9490-89ba05e4cf75" >
+<SUBCOMPONENT type="1103" id="483" index="19" uid="aa788f80-fc04-45c8-b0ec-86a79bb52b6c" >
 <father id="517" num="0" />
-<cdparam x="468" y="418" />
-<sizeparam width="142" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="480" y="371" />
+<sizeparam width="119" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="28" minY="0" maxY="95" />
-<infoparam name="TGComponent" value="nonce::nonce_ch" />
+<cdrectangleparam minX="0" maxX="51" minY="0" maxY="95" />
+<infoparam name="TGComponent" value="nonce::comm" />
 <new d="false" />
 <TGConnectingPoint num="0" id="475" />
 <TGConnectingPoint num="1" id="476" />
@@ -1424,16 +1424,16 @@
 <TGConnectingPoint num="6" id="481" />
 <TGConnectingPoint num="7" id="482" />
 <extraparam>
-<info value="nonce::nonce_ch" communicationName="nonce_ch" referenceCommunicationName="nonce" mappedElements="ExternalBus BusAlice BusBob" priority="0" typeName="channel" />
+<info value="nonce::comm" communicationName="comm" referenceCommunicationName="nonce" mappedElements="ExternalBus BusAlice BusBob" priority="0" typeName="channel" />
 </extraparam>
 </SUBCOMPONENT>
-<SUBCOMPONENT type="1103" id="492" index="20" uid="aa788f80-fc04-45c8-b0ec-86a79bb52b6c" >
+<SUBCOMPONENT type="1103" id="492" index="20" uid="758629cb-5cec-476e-9490-89ba05e4cf75" >
 <father id="517" num="1" />
-<cdparam x="480" y="371" />
-<sizeparam width="119" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="468" y="418" />
+<sizeparam width="142" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="51" minY="0" maxY="95" />
-<infoparam name="TGComponent" value="nonce::comm" />
+<cdrectangleparam minX="0" maxX="28" minY="0" maxY="95" />
+<infoparam name="TGComponent" value="nonce::nonce_ch" />
 <new d="false" />
 <TGConnectingPoint num="0" id="484" />
 <TGConnectingPoint num="1" id="485" />
@@ -1444,7 +1444,7 @@
 <TGConnectingPoint num="6" id="490" />
 <TGConnectingPoint num="7" id="491" />
 <extraparam>
-<info value="nonce::comm" communicationName="comm" referenceCommunicationName="nonce" mappedElements="ExternalBus BusAlice BusBob" priority="0" typeName="channel" />
+<info value="nonce::nonce_ch" communicationName="nonce_ch" referenceCommunicationName="nonce" mappedElements="ExternalBus BusAlice BusBob" priority="0" typeName="channel" />
 </extraparam>
 </SUBCOMPONENT>
 
@@ -3657,8 +3657,8 @@
 <cdparam x="255" y="121" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="Connector between ports" />
-<P1  x="262" y="123" id="1467" />
-<P2  x="342" y="123" id="1456" />
+<P1  x="275" y="136" id="1467" />
+<P2  x="329" y="136" id="1456" />
 <AutomaticDrawing  data="true" />
 <new d="false" />
 </CONNECTOR>
@@ -4040,9 +4040,9 @@
 <SUBCOMPONENT type="1103" id="1559" index="19" uid="76cd5fa6-e1fd-4c65-be7d-ddf0dd15d4da" >
 <father id="1584" num="0" />
 <cdparam x="452" y="375" />
-<sizeparam width="177" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<sizeparam width="165" height="40" minWidth="75" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="7" minY="0" maxY="55" />
+<cdrectangleparam minX="0" maxX="19" minY="0" maxY="55" />
 <infoparam name="TGComponent" value="sampleAutoSec::comm" />
 <new d="false" />
 <TGConnectingPoint num="0" id="1551" />
@@ -4282,9 +4282,9 @@
 <SUBCOMPONENT type="1101" id="1718" index="20" uid="b32b9452-707e-4352-b8b8-23eb1dd18377" >
 <father id="1743" num="0" />
 <cdparam x="192" y="186" />
-<sizeparam width="169" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<sizeparam width="157" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="4" minY="0" maxY="60" />
+<cdrectangleparam minX="0" maxX="16" minY="0" maxY="60" />
 <infoparam name="TGComponent" value="sampleAutoSec::Alice" />
 <new d="false" />
 <TGConnectingPoint num="0" id="1710" />
@@ -4339,9 +4339,9 @@
 <SUBCOMPONENT type="1101" id="1752" index="21" uid="c1e31903-9b44-4db2-95b8-eb4725318992" >
 <father id="1777" num="0" />
 <cdparam x="729" y="187" />
-<sizeparam width="164" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<sizeparam width="152" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="4" minY="0" maxY="60" />
+<cdrectangleparam minX="0" maxX="16" minY="0" maxY="60" />
 <infoparam name="TGComponent" value="sampleAutoSec::Bob" />
 <new d="false" />
 <TGConnectingPoint num="0" id="1744" />
diff --git a/src/main/java/myutil/AIInterface.java b/src/main/java/myutil/AIInterface.java
index 7e7bf18be1..7354e2ac35 100644
--- a/src/main/java/myutil/AIInterface.java
+++ b/src/main/java/myutil/AIInterface.java
@@ -39,11 +39,11 @@
 
 package myutil;
 
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.InputStreamReader;
+import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 
 import org.json.JSONObject;
@@ -64,11 +64,12 @@ public class AIInterface {
     private final static String NO_KEY = "No key specified";
     private final static String NO_AI_MODEL = "No ai model specified (e.g. \"gpt-3.5-turbo\")";
     private final static String CONNECTION_PB = "Connection to server failed";
+    private final static String DISCONNECTION_PB = "DisConnection to server failed";
 
-    private String urlText;
-    private String key;
-    private String aiModel;
-    private HttpURLConnection connection;
+    private  String urlText;
+    private  String key;
+    private  String aiModel;
+    private  HttpURLConnection connection;
     private ArrayList<AIKnowledge> knowledge;
 
     public AIInterface() {
@@ -105,15 +106,32 @@ public class AIInterface {
         }
 
         try {
-            connection = (HttpURLConnection) new URL(urlText).openConnection();
-            connection.setRequestMethod("POST");
-            connection.setRequestProperty("Content-Type", "application/json");
-            connection.setRequestProperty("Authorization", "Bearer " + key);
-            connection.setDoOutput(true);
+            if (connection == null) {
+                TraceManager.addDev("Connecting to " + urlText);
+                connection = (HttpURLConnection) new URL(urlText).openConnection();
+                TraceManager.addDev("Connection to " + urlText + " is opened");
+                connection.setRequestMethod("POST");
+                //connection.setRequestProperty("Content-Type", "application/json");
+                connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
+                connection.setRequestProperty("Authorization", "Bearer " + key);
+                connection.setDoOutput(true);
+            }
 
         } catch (Exception e) {
+            disconnect();
             throw new AIInterfaceException(CONNECTION_PB);
         }
+        TraceManager.addDev("Connection done with key: " + key);
+    }
+
+    private void disconnect() throws AIInterfaceException {
+        try {
+            connection.disconnect();
+        } catch (Exception e) {
+            connection = null;
+            throw new AIInterfaceException(DISCONNECTION_PB);
+        }
+        connection = null;
     }
 
     public String chat(String text, boolean useKnowledgeAsInput, boolean useOuputKnowledge) throws AIInterfaceException {
@@ -161,6 +179,8 @@ public class AIInterface {
             AIKnowledge addedKnowledge = new AIKnowledge(text, aiText);
             knowledge.add(addedKnowledge);
         }
+        //connection = null;
+        disconnect();
         return aiText;
     }
 
@@ -169,11 +189,22 @@ public class AIInterface {
             throw new AIInterfaceException(CONNECTION_PB);
         }
 
-        try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
-            outputStream.writeBytes(_jsonToBeSent.toString());
+        try (OutputStream os = connection.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8")) {
+            osw.write(_jsonToBeSent.toString());
+            osw.flush();
         } catch (Exception e) {
+            connection = null;
             throw new AIInterfaceException(e.getMessage());
         }
+
+        /*String formData = URLEncoder.encode(_jsonToBeSent.toString(), StandardCharsets.UTF_8);
+
+        try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
+            outputStream.writeBytes(formData);
+        } catch (Exception e) {
+            connection = null;
+            throw new AIInterfaceException(e.getMessage());
+        }*/
     }
 
     private StringBuilder getAnswer() throws AIInterfaceException {
diff --git a/src/main/java/ui/window/JFrameAI.java b/src/main/java/ui/window/JFrameAI.java
index 6ffb4a3a90..11c81224cd 100644
--- a/src/main/java/ui/window/JFrameAI.java
+++ b/src/main/java/ui/window/JFrameAI.java
@@ -101,33 +101,43 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
             "expr is a boolean expression using either attributes of blocks or blocks states";
 
     private MainGUI mgui;
-    private JTextPane question, answer, console;
-    private ArrayList<JTextPane> answers;
+    private JTextPane question, console;
     private JTabbedPane answerPane;
-    private String automatedAnswer;
-    private String lastSelectedAnswer;
+    private ArrayList<ChatData> chats;
 
-
-    private TDiagramPanel previousTDP;
-    private int previousKind;
-    private String lastChatAnswer;
+    private int currentChatIndex = -1;
 
     private JMenuBar menuBar;
     private JMenu help;
     private JPopupMenu helpPopup;
 
-    private AIInterface aiinterface;
-    private boolean knowledgeOnProperties = false;
-
     private boolean go = false;
 
+    private class ChatData {
+        public AIInterface aiinterface;
+        public boolean knowledgeOnProperties = false;
+        public JTextPane answer = new JTextPane();
+        public String lastAnswer = "";
+        public int previousKind;
+        public TDiagramPanel tdp;
+
+        public ChatData() {}
+
+        public void clear() {
+            lastAnswer = "";
+            answer.setText("");
+        }
+    }
+
 
     private JButton buttonClose, buttonStart, buttonApplyResponse;
 
     public JFrameAI(String title, MainGUI _mgui) {
         super(title);
         mgui = _mgui;
+        chats = new ArrayList<>();
         makeComponents();
+
     }
 
     public void makeComponents() {
@@ -199,7 +209,6 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
         answerPane = new JTabbedPane();
         answerPane.addMouseListener(new JFrameAI.PopupListener(this));
         answerPane.setPreferredSize(new Dimension(500, 500));
-        answers = new ArrayList<>();
         addChat("Chat1");
         answerPanel.add(answerPane, BorderLayout.CENTER);
 
@@ -249,12 +258,13 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
     }
 
     private void addChat(String nameOfChat) {
-        answer = new JTextPane();
-        answers.add(answer);
+
+        ChatData data = new ChatData();
+        chats.add(data);
 
         //answer.setPreferredSize(new Dimension(400, 500));
         //setOptionsJTextPane(answer, false);
-        JScrollPane scrollPane = new JScrollPane(answer);
+        JScrollPane scrollPane = new JScrollPane(data.answer);
         scrollPane.setMinimumSize(new Dimension(400, 400));
         scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
         answerPane.add(scrollPane);
@@ -284,37 +294,40 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
     }
 
     private void start() {
+        currentChatIndex = answerPane.getSelectedIndex();
         runChat();
     }
 
     private void applyResponse() {
-        if (previousKind == KIND_CLASSIFY_REQUIREMENT) {
+
+        if (selectedChat().previousKind == KIND_CLASSIFY_REQUIREMENT) {
             applyRequirementClassification();
-        } else if (previousKind == IDENTIFY_REQUIREMENT) {
+        } else if (selectedChat().previousKind == IDENTIFY_REQUIREMENT) {
             applyRequirementIdentification();
+        } else {
+            return;
         }
         question.setText("");
     }
 
     private void applyRequirementIdentification() {
-        if (previousTDP == null) {
+        if (selectedChat().tdp == null) {
             error("No diagram has been selected\n");
             return;
         }
 
-        if (!(previousTDP instanceof AvatarRDPanel)) {
+        if (!(selectedChat().tdp instanceof AvatarRDPanel)) {
             error("Wrong diagram has been selected\n");
             return;
         }
 
-        AvatarRDPanel rdpanel = (AvatarRDPanel) previousTDP;
+        AvatarRDPanel rdpanel = (AvatarRDPanel) selectedChat().tdp;
 
         inform("Enhancing requirement diagram with ai answer, please wait\n");
-        TraceManager.addDev("Considered JSON array: " + automatedAnswer);
+        int index = answerPane.getSelectedIndex();
+        TraceManager.addDev("Considered JSON array: " + selectedChat().lastAnswer);
         try {
-
-            rdpanel.loadAndUpdateFromText(automatedAnswer);
-
+            rdpanel.loadAndUpdateFromText( selectedChat().lastAnswer );
         } catch (org.json.JSONException e) {
             TraceManager.addDev("JSON Exception: " + e.getMessage());
             inform("Answer provided by AI does not respect the JSON format necessary for TTool");
@@ -327,26 +340,28 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
     }
 
     private void applyRequirementClassification() {
-        if (previousTDP == null) {
+        if (selectedChat().tdp == null) {
             error("No diagram has been selected\n");
             return;
         }
 
-        if (!(previousTDP instanceof AvatarRDPanel)) {
+        if (!(selectedChat().tdp instanceof AvatarRDPanel)) {
             error("Wrong diagram has been selected\n");
             return;
         }
 
-        AvatarRDPanel rdpanel = (AvatarRDPanel) previousTDP;
+        AvatarRDPanel rdpanel = (AvatarRDPanel) selectedChat().tdp;
 
         inform("Enhancing requirement diagram with ai answer, please wait\n");
 
+        String automatedAnswer = selectedChat().lastAnswer;
+
         for (TGComponent tgc : rdpanel.getAllRequirements()) {
             AvatarRDRequirement req = (AvatarRDRequirement) tgc;
             String query = req.getValue() + ":";
             int index = automatedAnswer.indexOf(query);
             if (index != -1) {
-                String kind = automatedAnswer.substring((index + query.length()), automatedAnswer.length()).trim();
+                String kind = automatedAnswer.substring( index + query.length() ).trim();
                 //TraceManager.addDev("Kind=" + kind);
                 int indexSpace = kind.indexOf("\n");
                 int indexSpace1 = kind.indexOf(" ");
@@ -381,7 +396,8 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
     }
 
     private void enableDisableActions() {
-        buttonApplyResponse.setEnabled(automatedAnswer != null);
+        String chat = chats.get(answerPane.getSelectedIndex()).lastAnswer;
+        buttonApplyResponse.setEnabled(chat != null && chat.length() > 0);
         buttonStart.setEnabled(!go);
     }
 
@@ -430,20 +446,22 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
             return;
         }
 
-
         inform("Simple chat is selected\n");
         TraceManager.addDev("Appending: " + question.getText().trim() + " to answer");
-        GraphicLib.appendToPane(answer, "\nYou:" + question.getText().trim() + "\n", Color.blue);
+        GraphicLib.appendToPane(chatOfStart().answer, "\nYou:" + question.getText().trim() + "\n", Color.blue);
+
+        String lastChatAnswer = "";
 
         try {
             GraphicLib.appendToPane(console, "Connecting, waiting for answer\n", Color.blue);
-            lastChatAnswer = aiinterface.chat(question.getText().trim(), true, true);
+            lastChatAnswer = chatOfStart().aiinterface.chat(question.getText().trim(), true, true);
         } catch (AIInterfaceException aiie) {
             error(aiie.getMessage());
             return;
         }
         inform("Got answer from ai. All done.\n\n");
-        GraphicLib.appendToPane(answer, "\nAI:" + lastChatAnswer + "\n", Color.red);
+        GraphicLib.appendToPane(chatOfStart().answer, "\nAI:" + lastChatAnswer + "\n", Color.red);
+        chatOfStart().lastAnswer = lastChatAnswer;
         question.setText("");
 
     }
@@ -508,8 +526,8 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
         TraceManager.addDev("Appending: " + sb.toString().trim() + " to answer");
         String question = QUESTION_IDENTIFY_PROPERTIES + "\n" + sb.toString().trim();
 
-        if (!knowledgeOnProperties) {
-            knowledgeOnProperties = true;
+        if (!(chats.get(answerPane.getSelectedIndex()).knowledgeOnProperties)) {
+            chats.get(answerPane.getSelectedIndex()).knowledgeOnProperties = true;
             question = KNOWLEDGE_ON_DESIGN_PROPERTIES + "\n" + question;
         }
         question = "\nTTool:" + question + "\n";
@@ -517,43 +535,51 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
     }
 
     private String makeQuestion(String _question, int _kind, TDiagramPanel _tdp) {
-        GraphicLib.appendToPane(answer, _question, Color.blue);
+        GraphicLib.appendToPane(chatOfStart().answer, _question, Color.blue);
 
         try {
             GraphicLib.appendToPane(console, "Connecting, waiting for answer\n", Color.blue);
-            automatedAnswer = aiinterface.chat(_question, true, true);
-            previousKind = _kind;
-            previousTDP = _tdp;
+            chatOfStart().lastAnswer = chatOfStart().aiinterface.chat(_question, true, true);
+            chatOfStart().previousKind = _kind;
+            chatOfStart().tdp = _tdp;
         } catch (AIInterfaceException aiie) {
             error(aiie.getMessage());
             return null;
         }
         inform("Got answer from ai. All done.\n\n");
-        GraphicLib.appendToPane(answer, "\nAI:\n" + automatedAnswer + "\n", Color.red);
+        GraphicLib.appendToPane(chatOfStart().answer, "\nAI:\n" + chatOfStart().lastAnswer + "\n", Color.red);
 
-        return automatedAnswer;
+        return chatOfStart().lastAnswer;
 
     }
 
+    private ChatData selectedChat() {
+        return chats.get(answerPane.getSelectedIndex());
+    }
+
+    private ChatData chatOfStart() {
+        return chats.get(currentChatIndex);
+    }
+
     private boolean makeAIInterface() {
-        if (aiinterface == null) {
+        if (chatOfStart().aiinterface == null) {
             String key = ConfigurationTTool.OPENAIKey;
             if (key == null) {
                 error("No key has been set. Aborting.\n");
                 return false;
             } else {
                 TraceManager.addDev("Setting key: " + key);
-                aiinterface = new AIInterface();
-                aiinterface.setURL(AIInterface.URL_OPENAI_COMPLETION);
-                aiinterface.setAIModel(AIInterface.MODEL_GPT_35);
-                aiinterface.setKey(key);
+                chatOfStart().aiinterface = new AIInterface();
+                chatOfStart().aiinterface.setURL(AIInterface.URL_OPENAI_COMPLETION);
+                chatOfStart().aiinterface.setAIModel(AIInterface.MODEL_GPT_35);
+                chatOfStart().aiinterface.setKey(key);
             }
         }
         return true;
     }
 
     private void error(String text) {
-        GraphicLib.appendToPane(console, text, Color.red);
+        GraphicLib.appendToPane(console, "\n****" + text + " ****\n\n", Color.red);
     }
 
     private void inform(String text) {
@@ -576,9 +602,9 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
     }
 
     public void clear() {
-        int index = answerPane.getSelectedIndex();
-        answers.get(index).setText("");
-        // Must also remove the associated knowledge
+        selectedChat().clear();
+        // We must also remove the knowledge
+        selectedChat().aiinterface.clearKnowledge();
     }
 
     public void requestRenameTab() {
@@ -599,8 +625,8 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
 
     public void removeCurrentTab() {
         int index = answerPane.getSelectedIndex();
-        answers.remove(index);
         answerPane.remove(index);
+        chats.remove(index);
     }
 
     public void requestMoveRightTab() {
@@ -634,9 +660,9 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
         // Add a new tab
         answerPane.insertTab(label, icon, comp, tooltip, dst);
 
-        JTextPane pane = answers.get(src);
-        answers.remove(src);
-        answers.add(dst, pane);
+        ChatData data  = chats.get(src);
+        chats.remove(src);
+        chats.add(dst, data);
 
         // Restore all properties
         answerPane.setDisabledIconAt(dst, iconDis);
-- 
GitLab