From 6557f07eb7238c926b47954721d4a9c83153edac Mon Sep 17 00:00:00 2001
From: Lee <irina.lee@etu.upmc.fr>
Date: Tue, 31 Jul 2018 19:15:42 +0200
Subject: [PATCH] add multi panels (eln) + add code generation (eln)

---
 modeling/monoprocessor.xml                    | 742 --------------
 .../java/elntranslator/ELNSpecification.java  |  19 +
 .../java/elntranslator/toELN/ClusterCode.java | 190 ++++
 .../elntranslator/toELN/MakefileCode.java     | 109 +++
 .../java/elntranslator/toELN/ModuleCode.java  | 913 ++++++++++++++++++
 .../elntranslator/toELN/TopCellGenerator.java | 138 +++
 src/main/java/ui/ActionPerformer.java         |   2 +
 src/main/java/ui/ELNDesignPanel.java          |  72 +-
 src/main/java/ui/GTURTLEModeling.java         |  22 +-
 src/main/java/ui/MainGUI.java                 |  68 +-
 .../java/ui/SysCAMSComponentDesignPanel.java  |   2 +-
 src/main/java/ui/TGUIAction.java              |   6 +-
 src/main/java/ui/TURTLEPanel.java             |   4 +
 .../java/ui/TURTLEPanelPopupListener.java     |  12 +-
 src/main/java/ui/eln/ELNDiagramToolBar.java   |   6 +
 .../JDialogELNExecutableCodeGeneration.java   | 772 +++++++++++++++
 16 files changed, 2289 insertions(+), 788 deletions(-)
 delete mode 100644 modeling/monoprocessor.xml
 create mode 100644 src/main/java/elntranslator/toELN/ClusterCode.java
 create mode 100644 src/main/java/elntranslator/toELN/MakefileCode.java
 create mode 100644 src/main/java/elntranslator/toELN/ModuleCode.java
 create mode 100644 src/main/java/elntranslator/toELN/TopCellGenerator.java
 create mode 100644 src/main/java/ui/window/JDialogELNExecutableCodeGeneration.java

diff --git a/modeling/monoprocessor.xml b/modeling/monoprocessor.xml
deleted file mode 100644
index 4736146653..0000000000
--- a/modeling/monoprocessor.xml
+++ /dev/null
@@ -1,742 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<TURTLEGMODELING version="1.0beta">
-
-<Modeling type="AVATAR Design" nameTab="AVATAR Design" >
-<AVATARBlockDiagramPanel name="Block Diagram" minX="10" maxX="1400" minY="10" maxY="900" zoom="1.0" >
-<MainCode value="void __user_init() {"/>
-<MainCode value="}"/>
-<Optimized value="true" />
-<Validated value="" />
-<Ignored value="" />
-
-<COMPONENT type="5000" id="25" >
-<cdparam x="117" y="236" />
-<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="Block0" value="Block0" />
-<TGConnectingPoint num="0" id="1" />
-<TGConnectingPoint num="1" id="2" />
-<TGConnectingPoint num="2" id="3" />
-<TGConnectingPoint num="3" id="4" />
-<TGConnectingPoint num="4" id="5" />
-<TGConnectingPoint num="5" id="6" />
-<TGConnectingPoint num="6" id="7" />
-<TGConnectingPoint num="7" id="8" />
-<TGConnectingPoint num="8" id="9" />
-<TGConnectingPoint num="9" id="10" />
-<TGConnectingPoint num="10" id="11" />
-<TGConnectingPoint num="11" id="12" />
-<TGConnectingPoint num="12" id="13" />
-<TGConnectingPoint num="13" id="14" />
-<TGConnectingPoint num="14" id="15" />
-<TGConnectingPoint num="15" id="16" />
-<TGConnectingPoint num="16" id="17" />
-<TGConnectingPoint num="17" id="18" />
-<TGConnectingPoint num="18" id="19" />
-<TGConnectingPoint num="19" id="20" />
-<TGConnectingPoint num="20" id="21" />
-<TGConnectingPoint num="21" id="22" />
-<TGConnectingPoint num="22" id="23" />
-<TGConnectingPoint num="23" id="24" />
-<extraparam>
-<blockType data="block" color="-4072719" />
-<CryptoBlock value="false" />
-</extraparam>
-</COMPONENT>
-
-
-</AVATARBlockDiagramPanel>
-
-<AVATARStateMachineDiagramPanel name="Block0" minX="10" maxX="1400" minY="10" maxY="900" >
-<CONNECTOR type="5102" id="32" >
-<cdparam x="460" y="115" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="null" />
-<TGConnectingPoint num="0" id="31" />
-<P1  x="460" y="115" id="48" />
-<P2  x="456" y="164" id="40" />
-<AutomaticDrawing  data="true" />
-</CONNECTOR><SUBCOMPONENT type="-1" id="30" >
-<father id="32" num="0" />
-<cdparam x="458" y="139" />
-<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="List of all parameters of an Avatar SMD transition" value="" />
-<TGConnectingPoint num="0" id="26" />
-<TGConnectingPoint num="1" id="27" />
-<TGConnectingPoint num="2" id="28" />
-<TGConnectingPoint num="3" id="29" />
-<extraparam>
-<guard value="[ ]" />
-<afterMin value="" />
-<afterMax value="" />
-<computeMin value="" />
-<computeMax value="" />
-<probability value="" />
-</extraparam>
-</SUBCOMPONENT>
-
-<CONNECTOR type="5102" id="39" >
-<cdparam x="407" y="70" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="null" />
-<TGConnectingPoint num="0" id="38" />
-<P1  x="407" y="70" id="83" />
-<P2  x="410" y="71" id="62" />
-<AutomaticDrawing  data="true" />
-</CONNECTOR><SUBCOMPONENT type="-1" id="37" >
-<father id="39" num="0" />
-<cdparam x="407" y="110" />
-<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="List of all parameters of an Avatar SMD transition" value="" />
-<TGConnectingPoint num="0" id="33" />
-<TGConnectingPoint num="1" id="34" />
-<TGConnectingPoint num="2" id="35" />
-<TGConnectingPoint num="3" id="36" />
-<extraparam>
-<guard value="[ ]" />
-<afterMin value="" />
-<afterMax value="" />
-<computeMin value="" />
-<computeMax value="" />
-<probability value="" />
-</extraparam>
-</SUBCOMPONENT>
-
-<COMPONENT type="5101" id="41" >
-<cdparam x="446" y="169" />
-<sizeparam width="20" height="20" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="stop state" value="null" />
-<TGConnectingPoint num="0" id="40" />
-</COMPONENT>
-
-<COMPONENT type="5106" id="82" >
-<cdparam x="410" y="65" />
-<sizeparam width="100" height="50" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="state0" value="state0" />
-<TGConnectingPoint num="0" id="42" />
-<TGConnectingPoint num="1" id="43" />
-<TGConnectingPoint num="2" id="44" />
-<TGConnectingPoint num="3" id="45" />
-<TGConnectingPoint num="4" id="46" />
-<TGConnectingPoint num="5" id="47" />
-<TGConnectingPoint num="6" id="48" />
-<TGConnectingPoint num="7" id="49" />
-<TGConnectingPoint num="8" id="50" />
-<TGConnectingPoint num="9" id="51" />
-<TGConnectingPoint num="10" id="52" />
-<TGConnectingPoint num="11" id="53" />
-<TGConnectingPoint num="12" id="54" />
-<TGConnectingPoint num="13" id="55" />
-<TGConnectingPoint num="14" id="56" />
-<TGConnectingPoint num="15" id="57" />
-<TGConnectingPoint num="16" id="58" />
-<TGConnectingPoint num="17" id="59" />
-<TGConnectingPoint num="18" id="60" />
-<TGConnectingPoint num="19" id="61" />
-<TGConnectingPoint num="20" id="62" />
-<TGConnectingPoint num="21" id="63" />
-<TGConnectingPoint num="22" id="64" />
-<TGConnectingPoint num="23" id="65" />
-<TGConnectingPoint num="24" id="66" />
-<TGConnectingPoint num="25" id="67" />
-<TGConnectingPoint num="26" id="68" />
-<TGConnectingPoint num="27" id="69" />
-<TGConnectingPoint num="28" id="70" />
-<TGConnectingPoint num="29" id="71" />
-<TGConnectingPoint num="30" id="72" />
-<TGConnectingPoint num="31" id="73" />
-<TGConnectingPoint num="32" id="74" />
-<TGConnectingPoint num="33" id="75" />
-<TGConnectingPoint num="34" id="76" />
-<TGConnectingPoint num="35" id="77" />
-<TGConnectingPoint num="36" id="78" />
-<TGConnectingPoint num="37" id="79" />
-<TGConnectingPoint num="38" id="80" />
-<TGConnectingPoint num="39" id="81" />
-<extraparam>
-<entryCode value="printf(&quot;Hello World! \n&quot;);" />
-</extraparam>
-</COMPONENT>
-
-<COMPONENT type="5100" id="84" >
-<cdparam x="400" y="50" />
-<sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="start state" value="null" />
-<TGConnectingPoint num="0" id="83" />
-</COMPONENT>
-
-
-</AVATARStateMachineDiagramPanel>
-
-</Modeling>
-
-
-
-
-<Modeling type="ADD" nameTab="Avatar Deployment" >
-<ADDDiagramPanel name="Deployment Diagram" minX="10" maxX="1400" minY="10" maxY="900" attributes="0" masterClockFrequency="200" >
-<COMPONENT type="5365" id="109" >
-<cdparam x="1177" y="513" />
-<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="cluster1" value="cluster1" />
-<TGConnectingPoint num="0" id="85" />
-<TGConnectingPoint num="1" id="86" />
-<TGConnectingPoint num="2" id="87" />
-<TGConnectingPoint num="3" id="88" />
-<TGConnectingPoint num="4" id="89" />
-<TGConnectingPoint num="5" id="90" />
-<TGConnectingPoint num="6" id="91" />
-<TGConnectingPoint num="7" id="92" />
-<TGConnectingPoint num="8" id="93" />
-<TGConnectingPoint num="9" id="94" />
-<TGConnectingPoint num="10" id="95" />
-<TGConnectingPoint num="11" id="96" />
-<TGConnectingPoint num="12" id="97" />
-<TGConnectingPoint num="13" id="98" />
-<TGConnectingPoint num="14" id="99" />
-<TGConnectingPoint num="15" id="100" />
-<TGConnectingPoint num="16" id="101" />
-<TGConnectingPoint num="17" id="102" />
-<TGConnectingPoint num="18" id="103" />
-<TGConnectingPoint num="19" id="104" />
-<TGConnectingPoint num="20" id="105" />
-<TGConnectingPoint num="21" id="106" />
-<TGConnectingPoint num="22" id="107" />
-<TGConnectingPoint num="23" id="108" />
-<extraparam>
-<info stereotype="SystemC-AMS Cluster" nodeName="cluster1" />
-<attributes index="0" />
-</extraparam>
-</COMPONENT>
-
-<COMPONENT type="5365" id="134" >
-<cdparam x="995" y="128" />
-<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="cluster" value="cluster" />
-<TGConnectingPoint num="0" id="110" />
-<TGConnectingPoint num="1" id="111" />
-<TGConnectingPoint num="2" id="112" />
-<TGConnectingPoint num="3" id="113" />
-<TGConnectingPoint num="4" id="114" />
-<TGConnectingPoint num="5" id="115" />
-<TGConnectingPoint num="6" id="116" />
-<TGConnectingPoint num="7" id="117" />
-<TGConnectingPoint num="8" id="118" />
-<TGConnectingPoint num="9" id="119" />
-<TGConnectingPoint num="10" id="120" />
-<TGConnectingPoint num="11" id="121" />
-<TGConnectingPoint num="12" id="122" />
-<TGConnectingPoint num="13" id="123" />
-<TGConnectingPoint num="14" id="124" />
-<TGConnectingPoint num="15" id="125" />
-<TGConnectingPoint num="16" id="126" />
-<TGConnectingPoint num="17" id="127" />
-<TGConnectingPoint num="18" id="128" />
-<TGConnectingPoint num="19" id="129" />
-<TGConnectingPoint num="20" id="130" />
-<TGConnectingPoint num="21" id="131" />
-<TGConnectingPoint num="22" id="132" />
-<TGConnectingPoint num="23" id="133" />
-<extraparam>
-<info stereotype="SystemC-AMS Cluster" nodeName="cluster" />
-<attributes index="0" />
-</extraparam>
-</COMPONENT>
-
-<COMPONENT type="5363" id="159" >
-<cdparam x="523" y="309" />
-<sizeparam width="250" height="50" minWidth="100" minHeight="50" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="Bus0" value="name" />
-<TGConnectingPoint num="0" id="135" />
-<TGConnectingPoint num="1" id="136" />
-<TGConnectingPoint num="2" id="137" />
-<TGConnectingPoint num="3" id="138" />
-<TGConnectingPoint num="4" id="139" />
-<TGConnectingPoint num="5" id="140" />
-<TGConnectingPoint num="6" id="141" />
-<TGConnectingPoint num="7" id="142" />
-<TGConnectingPoint num="8" id="143" />
-<TGConnectingPoint num="9" id="144" />
-<TGConnectingPoint num="10" id="145" />
-<TGConnectingPoint num="11" id="146" />
-<TGConnectingPoint num="12" id="147" />
-<TGConnectingPoint num="13" id="148" />
-<TGConnectingPoint num="14" id="149" />
-<TGConnectingPoint num="15" id="150" />
-<TGConnectingPoint num="16" id="151" />
-<TGConnectingPoint num="17" id="152" />
-<TGConnectingPoint num="18" id="153" />
-<TGConnectingPoint num="19" id="154" />
-<TGConnectingPoint num="20" id="155" />
-<TGConnectingPoint num="21" id="156" />
-<TGConnectingPoint num="22" id="157" />
-<TGConnectingPoint num="23" id="158" />
-<extraparam>
-<info stereotype="VGSB" nodeName="Bus0" />
-<attributes index="0"  nbOfAttachedInitiators="0"  nbOfAttachedTargets="0"  minLatency="10"  fifoDepth="10" />
-</extraparam>
-</COMPONENT>
-
-<COMPONENT type="5355" id="184" >
-<cdparam x="218" y="386" />
-<sizeparam width="200" height="200" minWidth="100" minHeight="35" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="Memory0" value="name" />
-<TGConnectingPoint num="0" id="160" />
-<TGConnectingPoint num="1" id="161" />
-<TGConnectingPoint num="2" id="162" />
-<TGConnectingPoint num="3" id="163" />
-<TGConnectingPoint num="4" id="164" />
-<TGConnectingPoint num="5" id="165" />
-<TGConnectingPoint num="6" id="166" />
-<TGConnectingPoint num="7" id="167" />
-<TGConnectingPoint num="8" id="168" />
-<TGConnectingPoint num="9" id="169" />
-<TGConnectingPoint num="10" id="170" />
-<TGConnectingPoint num="11" id="171" />
-<TGConnectingPoint num="12" id="172" />
-<TGConnectingPoint num="13" id="173" />
-<TGConnectingPoint num="14" id="174" />
-<TGConnectingPoint num="15" id="175" />
-<TGConnectingPoint num="16" id="176" />
-<TGConnectingPoint num="17" id="177" />
-<TGConnectingPoint num="18" id="178" />
-<TGConnectingPoint num="19" id="179" />
-<TGConnectingPoint num="20" id="180" />
-<TGConnectingPoint num="21" id="181" />
-<TGConnectingPoint num="22" id="182" />
-<TGConnectingPoint num="23" id="183" />
-<extraparam>
-<info stereotype="RAM" nodeName="Memory0" />
-<attributes byteDataSize="1048576"  index="0"  processCode="" />
-</extraparam>
-</COMPONENT>
-
-<COMPONENT type="5354" id="209" >
-<cdparam x="639" y="474" />
-<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="TTY0" value="name" />
-<TGConnectingPoint num="0" id="185" />
-<TGConnectingPoint num="1" id="186" />
-<TGConnectingPoint num="2" id="187" />
-<TGConnectingPoint num="3" id="188" />
-<TGConnectingPoint num="4" id="189" />
-<TGConnectingPoint num="5" id="190" />
-<TGConnectingPoint num="6" id="191" />
-<TGConnectingPoint num="7" id="192" />
-<TGConnectingPoint num="8" id="193" />
-<TGConnectingPoint num="9" id="194" />
-<TGConnectingPoint num="10" id="195" />
-<TGConnectingPoint num="11" id="196" />
-<TGConnectingPoint num="12" id="197" />
-<TGConnectingPoint num="13" id="198" />
-<TGConnectingPoint num="14" id="199" />
-<TGConnectingPoint num="15" id="200" />
-<TGConnectingPoint num="16" id="201" />
-<TGConnectingPoint num="17" id="202" />
-<TGConnectingPoint num="18" id="203" />
-<TGConnectingPoint num="19" id="204" />
-<TGConnectingPoint num="20" id="205" />
-<TGConnectingPoint num="21" id="206" />
-<TGConnectingPoint num="22" id="207" />
-<TGConnectingPoint num="23" id="208" />
-<extraparam>
-<info stereotype="TTY" nodeName="TTY0" />
-<attributes index="0" />
-</extraparam>
-</COMPONENT>
-
-<COMPONENT type="5351" id="243" >
-<cdparam x="113" y="44" />
-<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="CPU0" value="name" />
-<TGConnectingPoint num="0" id="219" />
-<TGConnectingPoint num="1" id="220" />
-<TGConnectingPoint num="2" id="221" />
-<TGConnectingPoint num="3" id="222" />
-<TGConnectingPoint num="4" id="223" />
-<TGConnectingPoint num="5" id="224" />
-<TGConnectingPoint num="6" id="225" />
-<TGConnectingPoint num="7" id="226" />
-<TGConnectingPoint num="8" id="227" />
-<TGConnectingPoint num="9" id="228" />
-<TGConnectingPoint num="10" id="229" />
-<TGConnectingPoint num="11" id="230" />
-<TGConnectingPoint num="12" id="231" />
-<TGConnectingPoint num="13" id="232" />
-<TGConnectingPoint num="14" id="233" />
-<TGConnectingPoint num="15" id="234" />
-<TGConnectingPoint num="16" id="235" />
-<TGConnectingPoint num="17" id="236" />
-<TGConnectingPoint num="18" id="237" />
-<TGConnectingPoint num="19" id="238" />
-<TGConnectingPoint num="20" id="239" />
-<TGConnectingPoint num="21" id="240" />
-<TGConnectingPoint num="22" id="241" />
-<TGConnectingPoint num="23" id="242" />
-<extraparam>
-<info stereotype="CPU" nodeName="CPU0" />
-<attributes nbOfIrq="6"  iCacheWays="1"  iCacheSets="8"  iCacheWords="4"  dCacheWays="1"  dCacheSets="8"  dCacheWords="4" />
-</extraparam>
-</COMPONENT>
-<SUBCOMPONENT type="5352" id="218" >
-<father id="243" num="0" />
-<cdparam x="172" y="134" />
-<sizeparam width="176" height="40" minWidth="75" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="0" maxX="74" minY="0" maxY="160" />
-<infoparam name="TGComponent" value="AVATAR Design::Block0" />
-<TGConnectingPoint num="0" id="210" />
-<TGConnectingPoint num="1" id="211" />
-<TGConnectingPoint num="2" id="212" />
-<TGConnectingPoint num="3" id="213" />
-<TGConnectingPoint num="4" id="214" />
-<TGConnectingPoint num="5" id="215" />
-<TGConnectingPoint num="6" id="216" />
-<TGConnectingPoint num="7" id="217" />
-<extraparam>
-<info value="AVATAR Design::Block0" taskName="Block0" referenceTaskName="AVATAR Design" />
-</extraparam>
-</SUBCOMPONENT>
-
-<CONNECTOR type="5350" id="244" >
-<cdparam x="1177" y="563" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="{info}" />
-<P1  x="1177" y="563" id="95" />
-<P2  x="773" y="346" id="148" />
-<AutomaticDrawing  data="true" />
-<extraparam>
-<spy value="false" />
-</extraparam>
-</CONNECTOR>
-<CONNECTOR type="5350" id="245" >
-<cdparam x="1006" y="263" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="{info}" />
-<P1  x="995" y="178" id="120" />
-<P2  x="773" y="309" id="137" />
-<AutomaticDrawing  data="true" />
-<extraparam>
-<spy value="false" />
-</extraparam>
-</CONNECTOR>
-<CONNECTOR type="5350" id="246" >
-<cdparam x="701" y="474" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="{info}" />
-<P1  x="701" y="474" id="193" />
-<P2  x="648" y="359" id="141" />
-<AutomaticDrawing  data="true" />
-<extraparam>
-<spy value="false" />
-</extraparam>
-</CONNECTOR>
-<CONNECTOR type="5350" id="247" >
-<cdparam x="418" y="436" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="{info}" />
-<P1  x="418" y="436" id="171" />
-<P2  x="523" y="359" id="140" />
-<AutomaticDrawing  data="true" />
-<extraparam>
-<spy value="false" />
-</extraparam>
-</CONNECTOR>
-<CONNECTOR type="5350" id="248" >
-<cdparam x="300" y="244" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="{info}" />
-<P1  x="300" y="244" id="234" />
-<P2  x="523" y="309" id="135" />
-<AutomaticDrawing  data="true" />
-<extraparam>
-<spy value="false" />
-</extraparam>
-</CONNECTOR>
-
-</ADDDiagramPanel>
-
-</Modeling>
-
-
-
-
-<Modeling type="SystemC-AMS" nameTab="SystemC_AMS" >
-<SysCAMSComponentTaskDiagramPanel name="SystemC-AMS Component Diagram" minX="10" maxX="2500" minY="10" maxY="1500" TDF="true" DE="true" zoom="1.0" >
-<CONNECTOR type="1601" id="386" >
-<cdparam x="681" y="329" />
-<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="681" y="329" id="291" />
-<P2  x="572" y="324" id="377" />
-<AutomaticDrawing  data="true" />
-</CONNECTOR>
-<CONNECTOR type="1601" id="250" >
-<cdparam x="733" y="410" />
-<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="811" y="410" id="281" />
-<P2  x="816" y="455" id="310" />
-<AutomaticDrawing  data="true" />
-</CONNECTOR>
-<CONNECTOR type="1601" id="251" >
-<cdparam x="860" y="449" />
-<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="907" y="333" id="271" />
-<P2  x="1232" y="447" id="252" />
-<AutomaticDrawing  data="true" />
-</CONNECTOR>
-<COMPONENT type="1608" id="270" >
-<cdparam x="1245" y="364" />
-<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="2500" minY="10" maxY="1500" />
-<infoparam name="Primitive component - Block GPIO2VCI" value="Block_GPIO2VCI" />
-<TGConnectingPoint num="0" id="262" />
-<TGConnectingPoint num="1" id="263" />
-<TGConnectingPoint num="2" id="264" />
-<TGConnectingPoint num="3" id="265" />
-<TGConnectingPoint num="4" id="266" />
-<TGConnectingPoint num="5" id="267" />
-<TGConnectingPoint num="6" id="268" />
-<TGConnectingPoint num="7" id="269" />
-</COMPONENT>
-<SUBCOMPONENT type="1605" id="261" >
-<father id="270" num="0" />
-<cdparam x="1232" y="434" />
-<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
-<infoparam name="Primitive port - Port DE" value="in" />
-<TGConnectingPoint num="0" id="252" />
-<TGConnectingPoint num="1" id="253" />
-<TGConnectingPoint num="2" id="254" />
-<TGConnectingPoint num="3" id="255" />
-<TGConnectingPoint num="4" id="256" />
-<TGConnectingPoint num="5" id="257" />
-<TGConnectingPoint num="6" id="258" />
-<TGConnectingPoint num="7" id="259" />
-<TGConnectingPoint num="8" id="260" />
-<extraparam>
-<Prop commName="in" commType="0" origin="0" type="int" sensitive="false" sensitive_method="positive" />
-</extraparam>
-</SUBCOMPONENT>
-
-<COMPONENT type="1607" id="356" >
-<cdparam x="303" y="181" />
-<sizeparam width="808" height="458" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="2500" minY="10" maxY="1500" />
-<infoparam name="Composite component - Cluster" value="cluster" />
-<TGConnectingPoint num="0" id="348" />
-<TGConnectingPoint num="1" id="349" />
-<TGConnectingPoint num="2" id="350" />
-<TGConnectingPoint num="3" id="351" />
-<TGConnectingPoint num="4" id="352" />
-<TGConnectingPoint num="5" id="353" />
-<TGConnectingPoint num="6" id="354" />
-<TGConnectingPoint num="7" id="355" />
-</COMPONENT>
-<SUBCOMPONENT type="1603" id="358" >
-<father id="356" num="0" />
-<cdparam x="359" y="277" />
-<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="0" maxX="608" minY="0" maxY="308" />
-<infoparam name="Primitive component - Block DE" value="Block_DE_0" />
-<TGConnectingPoint num="0" id="359" />
-<TGConnectingPoint num="1" id="360" />
-<TGConnectingPoint num="2" id="361" />
-<TGConnectingPoint num="3" id="362" />
-<TGConnectingPoint num="4" id="363" />
-<TGConnectingPoint num="5" id="364" />
-<TGConnectingPoint num="6" id="365" />
-<TGConnectingPoint num="7" id="366" />
-<extraparam>
-<Attribute name_function="test" code="void test() {
-	test_code;
-}" listStruct="" nameTemplate="" typeTemplate="int" listTypedef="" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1605" id="376" >
-<father id="358" num="0" />
-<cdparam x="546" y="311" />
-<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
-<infoparam name="Primitive port - Port DE" value="port" />
-<TGConnectingPoint num="0" id="377" />
-<TGConnectingPoint num="1" id="378" />
-<TGConnectingPoint num="2" id="379" />
-<TGConnectingPoint num="3" id="380" />
-<TGConnectingPoint num="4" id="381" />
-<TGConnectingPoint num="5" id="382" />
-<TGConnectingPoint num="6" id="383" />
-<TGConnectingPoint num="7" id="384" />
-<TGConnectingPoint num="8" id="385" />
-<extraparam>
-<Prop commName="in_de" commType="0" origin="0" type="int" sensitive="false" sensitive_method="positive" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1602" id="309" >
-<father id="356" num="1" />
-<cdparam x="694" y="247" />
-<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="0" maxX="608" minY="0" maxY="308" />
-<infoparam name="Primitive component - Block TDF" value="Sine" />
-<TGConnectingPoint num="0" id="301" />
-<TGConnectingPoint num="1" id="302" />
-<TGConnectingPoint num="2" id="303" />
-<TGConnectingPoint num="3" id="304" />
-<TGConnectingPoint num="4" id="305" />
-<TGConnectingPoint num="5" id="306" />
-<TGConnectingPoint num="6" id="307" />
-<TGConnectingPoint num="7" id="308" />
-<extraparam>
-<Attribute period="6" time="us" processCode="void processing() {
-	double t = out_de.get_time().to_seconds();
-	double x = sin(2.0 * M_PI * 5000000.0 * t);
-	out_de.write( (int) x);
-	tdf_out.write(x);
-}
-    " listStruct="" nameTemplate="" typeTemplate="int" listTypedef="" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1606" id="280" >
-<father id="309" num="0" />
-<cdparam x="881" y="320" />
-<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
-<infoparam name="Primitive port - Port Converter" value="out_de" />
-<TGConnectingPoint num="0" id="271" />
-<TGConnectingPoint num="1" id="272" />
-<TGConnectingPoint num="2" id="273" />
-<TGConnectingPoint num="3" id="274" />
-<TGConnectingPoint num="4" id="275" />
-<TGConnectingPoint num="5" id="276" />
-<TGConnectingPoint num="6" id="277" />
-<TGConnectingPoint num="7" id="278" />
-<TGConnectingPoint num="8" id="279" />
-<extraparam>
-<Prop commName="out_de" commType="0" origin="1" period="6" time="us" rate="1" delay="0" type="int" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1604" id="290" >
-<father id="309" num="1" />
-<cdparam x="798" y="384" />
-<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
-<infoparam name="Primitive port - Port TDF" value="tdf_out" />
-<TGConnectingPoint num="0" id="281" />
-<TGConnectingPoint num="1" id="282" />
-<TGConnectingPoint num="2" id="283" />
-<TGConnectingPoint num="3" id="284" />
-<TGConnectingPoint num="4" id="285" />
-<TGConnectingPoint num="5" id="286" />
-<TGConnectingPoint num="6" id="287" />
-<TGConnectingPoint num="7" id="288" />
-<TGConnectingPoint num="8" id="289" />
-<extraparam>
-<Prop commName="tdf_out" commType="0" origin="1" period="6" time="us" rate="1" delay="-1" type="double" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1606" id="300" >
-<father id="309" num="2" />
-<cdparam x="681" y="316" />
-<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
-<infoparam name="Primitive port - Port Converter" value="out2_de" />
-<TGConnectingPoint num="0" id="291" />
-<TGConnectingPoint num="1" id="292" />
-<TGConnectingPoint num="2" id="293" />
-<TGConnectingPoint num="3" id="294" />
-<TGConnectingPoint num="4" id="295" />
-<TGConnectingPoint num="5" id="296" />
-<TGConnectingPoint num="6" id="297" />
-<TGConnectingPoint num="7" id="298" />
-<TGConnectingPoint num="8" id="299" />
-<extraparam>
-<Prop commName="out2_de" commType="0" origin="1" period="-1" time="us" rate="-1" delay="-1" type="int" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1602" id="328" >
-<father id="356" num="2" />
-<cdparam x="705" y="468" />
-<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="0" maxX="608" minY="0" maxY="308" />
-<infoparam name="Primitive component - Block TDF" value="Sink" />
-<TGConnectingPoint num="0" id="320" />
-<TGConnectingPoint num="1" id="321" />
-<TGConnectingPoint num="2" id="322" />
-<TGConnectingPoint num="3" id="323" />
-<TGConnectingPoint num="4" id="324" />
-<TGConnectingPoint num="5" id="325" />
-<TGConnectingPoint num="6" id="326" />
-<TGConnectingPoint num="7" id="327" />
-<extraparam>
-<Attribute period="-1" time="" processCode="void processing() {
-	in.read();
-}
- " listStruct="" nameTemplate="" typeTemplate="int" listTypedef="" />
-</extraparam>
-</SUBCOMPONENT>
-<SUBCOMPONENT type="1604" id="319" >
-<father id="328" num="0" />
-<cdparam x="803" y="455" />
-<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
-<infoparam name="Primitive port - Port TDF" value="in" />
-<TGConnectingPoint num="0" id="310" />
-<TGConnectingPoint num="1" id="311" />
-<TGConnectingPoint num="2" id="312" />
-<TGConnectingPoint num="3" id="313" />
-<TGConnectingPoint num="4" id="314" />
-<TGConnectingPoint num="5" id="315" />
-<TGConnectingPoint num="6" id="316" />
-<TGConnectingPoint num="7" id="317" />
-<TGConnectingPoint num="8" id="318" />
-<extraparam>
-<Prop commName="in" commType="0" origin="0" period="-1" time="us" rate="1" delay="-1" type="double" />
-</extraparam>
-</SUBCOMPONENT>
-
-
-</SysCAMSComponentTaskDiagramPanel>
-
-</Modeling>
-
-
-
-
-</TURTLEGMODELING>
\ No newline at end of file
diff --git a/src/main/java/elntranslator/ELNSpecification.java b/src/main/java/elntranslator/ELNSpecification.java
index 9558db22e1..baceb90843 100644
--- a/src/main/java/elntranslator/ELNSpecification.java
+++ b/src/main/java/elntranslator/ELNSpecification.java
@@ -79,6 +79,15 @@ public class ELNSpecification{
     	return syscamsConnectors;
     }
 
+    public ELNTCluster getCluster(){
+		for (ELNTComponent comp : elnComponents) {
+			if (comp instanceof ELNTCluster) {
+				return (ELNTCluster) comp;
+			}
+		}
+		return null;
+	}
+    
     public LinkedList<ELNTConnector> getAllConnectorsBetweenELNModuleTerminal(){
     	LinkedList<ELNTConnector> cons = new LinkedList<ELNTConnector>();
     	for (ELNTConnector con : elnConnectors) {
@@ -109,6 +118,16 @@ public class ELNSpecification{
     	return cons;
     }
     
+    public LinkedList<ELNTConnector> getAllConnectorsInModule(){
+    	LinkedList<ELNTConnector> cons = new LinkedList<ELNTConnector>();
+    	for (ELNTConnector con : elnConnectors) {
+    		if (!(con.get_p1().getComponent() instanceof ELNTModuleTerminal && con.get_p2().getComponent() instanceof ELNTModuleTerminal)) {
+    			cons.add(con);
+			}
+    	}
+    	return cons;
+    }
+    
     public LinkedList<SysCAMSTPortDE> getAllPortDE(){
 		LinkedList<SysCAMSTPortDE> portsDE = new LinkedList<SysCAMSTPortDE>();
 		for (SysCAMSTComponent portDE : syscamsComponents) {
diff --git a/src/main/java/elntranslator/toELN/ClusterCode.java b/src/main/java/elntranslator/toELN/ClusterCode.java
new file mode 100644
index 0000000000..01aed7fd22
--- /dev/null
+++ b/src/main/java/elntranslator/toELN/ClusterCode.java
@@ -0,0 +1,190 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package elntranslator.toELN;
+
+import java.util.LinkedList;
+import elntranslator.*;
+import syscamstranslator.*;
+
+/**
+ * Class ClusterCode 
+ * Principal code of a cluster component 
+ * Creation: 31/07/2018
+ * @version 1.0 31/07/2018
+ * @author Irina Kit Yan LEE
+ */
+
+public class ClusterCode {
+	static private String corpsCluster;
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	ClusterCode() {
+	}
+
+	public static String getClusterCode(ELNTCluster cluster, LinkedList<ELNTConnector> ELNconnectors, LinkedList<SysCAMSTConnector> TDFconnectors, LinkedList<SysCAMSTConnector> DEconnectors) {
+		LinkedList<String> ELNnames = new LinkedList<String>();
+		LinkedList<String> TDFnames = new LinkedList<String>();
+		LinkedList<String> DEnames = new LinkedList<String>();
+
+		if (cluster != null) {
+			LinkedList<ELNTModule> modules = cluster.getModule();
+
+			corpsCluster = "#include <systemc-ams>" + CR;
+
+			for (int i = 0; i < modules.size(); i++) {
+				corpsCluster = corpsCluster + "#include \"" + modules.get(i).getName() + ".h\"" + CR;
+				if (i == modules.size()-1) {
+					corpsCluster = corpsCluster + CR;
+				}
+			}
+			corpsCluster = corpsCluster + "int sc_main(int argc, char *argv[])" + CR + "{" + CR;
+
+			for (int i = 0; i < ELNconnectors.size(); i++) {
+				if (ELNconnectors.get(i).getName().equals("")) {
+					corpsCluster = corpsCluster + "\tsca_eln::sca_node " + "n_" + ((ELNTModuleTerminal) ELNconnectors.get(i).get_p1().getComponent()).getName() + "_" + ((ELNTModuleTerminal) ELNconnectors.get(i).get_p2().getComponent()).getName() + ";" + CR;
+					ELNnames.add("n_" + ((ELNTModuleTerminal) ELNconnectors.get(i).get_p1().getComponent()).getName() + "_" + ((ELNTModuleTerminal) ELNconnectors.get(i).get_p2().getComponent()).getName());
+				} else {
+					corpsCluster = corpsCluster + "\tsca_eln::sca_node " + ELNconnectors.get(i).getName() + ";" + CR;
+					ELNnames.add(ELNconnectors.get(i).getName());
+				}
+				if (i == ELNconnectors.size()-1) {
+					corpsCluster = corpsCluster + CR;
+				}
+			}
+				
+			for (int i = 0; i < TDFconnectors.size(); i++) {
+				if (TDFconnectors.get(i).getName().equals("")) {
+					corpsCluster = corpsCluster + "\tsca_tdf::sca_signal<" + ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p1().getComponent()).getTDFType() + "> " 
+							+ "s_" + ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p1().getComponent()).getName() + "_" + ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p2().getComponent()).getName() + ";" + CR;
+					TDFnames.add("s_" + ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p1().getComponent()).getName() + "_" + ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p2().getComponent()).getName());
+				} else {
+					corpsCluster = corpsCluster + "\tsca_tdf::sca_signal<" + ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p1().getComponent()).getTDFType() + "> " 
+							+ TDFconnectors.get(i).getName() + ";" + CR;
+					TDFnames.add(TDFconnectors.get(i).getName());
+				}
+				if (i == TDFconnectors.size()-1) {
+					corpsCluster = corpsCluster + CR;
+				}
+			}
+			
+			for (int i = 0; i < DEconnectors.size(); i++) {
+				if (DEconnectors.get(i).getName().equals("")) {
+					corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortDE) DEconnectors.get(i).get_p1().getComponent()).getDEType() + "> " 
+							+ "s_" + ((SysCAMSTPortDE) DEconnectors.get(i).get_p1().getComponent()).getName() + "_" + ((SysCAMSTPortDE) DEconnectors.get(i).get_p2().getComponent()).getName() + ";" + CR;
+					DEnames.add("s_" + ((SysCAMSTPortDE) DEconnectors.get(i).get_p1().getComponent()).getName() + "_" + ((SysCAMSTPortDE) DEconnectors.get(i).get_p2().getComponent()).getName());
+				} else {
+					corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortDE) DEconnectors.get(i).get_p1().getComponent()).getDEType() + "> " 
+							+ DEconnectors.get(i).getName() + ";" + CR;
+					DEnames.add(DEconnectors.get(i).getName());
+				}
+				if (i == DEconnectors.size()-1) {
+					corpsCluster = corpsCluster + CR;
+				}
+			}
+
+			for (ELNTModule t : modules) {
+				corpsCluster = corpsCluster + "\t" + t.getName() + " i_" + t.getName() + "(\"i_" + t.getName() + "\");" + CR;
+
+				LinkedList<ELNTModuleTerminal> term = t.getModuleTerminal();
+				LinkedList<SysCAMSTPortTDF> portTDF = t.getPortTDF();
+				LinkedList<SysCAMSTPortDE> portDE = t.getPortDE();
+
+				for (ELNTModuleTerminal p : term) {
+					for (int i = 0; i < ELNconnectors.size(); i++) {
+						if (((ELNTModuleTerminal) ELNconnectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((ELNTModuleTerminal) ELNconnectors.get(i).get_p1().getComponent()).getModule().getName().equals(t.getName())) {
+							corpsCluster = corpsCluster + "\ti_" + t.getName() + "." + p.getName() + "(" + ELNnames.get(i) + ");" + CR;
+						} else if (((ELNTModuleTerminal) ELNconnectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((ELNTModuleTerminal) ELNconnectors.get(i).get_p2().getComponent()).getModule().getName().equals(t.getName())) {
+							corpsCluster = corpsCluster + "\ti_" + t.getName() + "." + p.getName() + "(" + ELNnames.get(i) + ");" + CR;
+						}
+					}
+				}
+
+				for (SysCAMSTPortTDF p : portTDF) {
+					for (int i = 0; i < TDFconnectors.size(); i++) {
+						if (((SysCAMSTPortTDF) TDFconnectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p1().getComponent()).getModule().getName().equals(t.getName())) {
+							corpsCluster = corpsCluster + "\ti_" + t.getName() + "." + p.getName() + "(" + TDFnames.get(i) + ");" + CR;
+						} else if (((SysCAMSTPortTDF) TDFconnectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortTDF) TDFconnectors.get(i).get_p2().getComponent()).getModule().getName().equals(t.getName())) {
+							corpsCluster = corpsCluster + "\ti_" + t.getName() + "." + p.getName() + "(" + TDFnames.get(i) + ");" + CR;
+						}
+					}
+				}
+				
+				for (SysCAMSTPortDE p : portDE) {
+					for (int i = 0; i < DEconnectors.size(); i++) {
+						if (((SysCAMSTPortDE) DEconnectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) DEconnectors.get(i).get_p1().getComponent()).getModule().getName().equals(t.getName())) {
+							corpsCluster = corpsCluster + "\ti_" + t.getName() + "." + p.getName() + "(" + DEnames.get(i) + ");" + CR;
+						} else if (((SysCAMSTPortDE) DEconnectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) DEconnectors.get(i).get_p2().getComponent()).getModule().getName().equals(t.getName())) {
+							corpsCluster = corpsCluster + "\ti_" + t.getName() + "." + p.getName() + "(" + DEnames.get(i) + ");" + CR;
+						}
+					}
+				}
+				corpsCluster = corpsCluster + CR;
+			}
+
+			corpsCluster = corpsCluster + "\tsca_util::sca_trace_file* tfp = sca_util::sca_create_tabular_trace_file(\"" + cluster.getName() + "_tb\");" + CR;
+
+			for (int i = 0; i < ELNconnectors.size(); i++) {
+				corpsCluster = corpsCluster + "\tsca_util::sca_trace(tfp, "+ ELNnames.get(i) + ", \"" + ELNnames.get(i) + "\");" + CR;
+			}
+			
+			for (int i = 0; i < TDFconnectors.size(); i++) {
+				corpsCluster = corpsCluster + "\tsca_util::sca_trace(tfp, "+ TDFnames.get(i) + ", \"" + TDFnames.get(i) + "\");" + CR;
+			}
+			
+			for (int i = 0; i < DEconnectors.size(); i++) {
+				corpsCluster = corpsCluster + "\tsca_util::sca_trace(tfp, "+ DEnames.get(i) + ", \"" + DEnames.get(i) + "\");" + CR;
+			}
+			
+			corpsCluster = corpsCluster + CR + "\tsc_start(100.0, sc_core::SC_MS);" + CR2
+					+ "\tsca_util::sca_close_tabular_trace_file(tfp);" + CR
+					+ "\tsc_core::sc_stop();" + CR + "\treturn 0;" + CR + "}" + CR2;
+		} else {
+			corpsCluster = "";
+		}
+		return corpsCluster;
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/elntranslator/toELN/MakefileCode.java b/src/main/java/elntranslator/toELN/MakefileCode.java
new file mode 100644
index 0000000000..a846679eb7
--- /dev/null
+++ b/src/main/java/elntranslator/toELN/MakefileCode.java
@@ -0,0 +1,109 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package elntranslator.toELN;
+
+import java.util.LinkedList;
+import elntranslator.*;
+
+/**
+ * Class MakefileCode 
+ * Principal code of a makefile 
+ * Creation: 31/07/2018
+ * @version 1.0 31/07/2018
+ * @author Irina Kit Yan LEE
+ */
+
+public class MakefileCode {
+	static private String corpsMakefile;
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	MakefileCode() {
+	}
+
+	public static String getMakefileCode(LinkedList<ELNTCluster> clusters) {
+		if (clusters != null) {
+			corpsMakefile = "# Compiler and linker flags" + CR + "CXXFLAGS = -g -Wall -I. $(SYSTEMC_INCLUDE_DIRS)" + CR
+					+ "LDFLAGS = $(SYSTEMC_LIBRARY_DIRS)" + CR2 + "# List of all ecutables to be compiled" + CR
+					+ "EXECUTABLES = ";
+
+			for (int i = 0; i < clusters.size(); i++) {
+				if (i == 0) {
+					corpsMakefile = corpsMakefile + clusters.get(i).getName() + "_tb";
+				}
+				if (i > 0) {
+					corpsMakefile = corpsMakefile + " " + clusters.get(i).getName() + "_tb";
+				}
+				if (i == clusters.size() - 1) {
+					corpsMakefile = corpsMakefile + CR2;
+				}
+			}
+
+			corpsMakefile = corpsMakefile + "# .PHONY targets don't generate files" + CR + ".PHONY:	all clean" + CR2
+					+ "# Default targets" + CR + "all:	$(EXECUTABLES)" + CR2;
+
+			for (int i = 0; i < clusters.size(); i++) {
+				LinkedList<ELNTModule> modules = clusters.get(i).getModule();
+
+				corpsMakefile = corpsMakefile + clusters.get(i).getName() + "_tb: "
+						+ clusters.get(i).getName() + "_tb.cpp";
+
+				for (ELNTModule t : modules) {
+					corpsMakefile = corpsMakefile + " " + t.getName() + ".h";
+				}
+
+				corpsMakefile = corpsMakefile + CR
+						+ "\t$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< -lsystemc-ams -lsystemc | c++filt" + CR2;
+			}
+
+			corpsMakefile = corpsMakefile + "# Clean rule to delete temporary and generated files" + CR + "clean:" + CR
+					+ "\trm -rf *~ *.o *.dat *.vcd *.dSYM $(EXECUTABLES)" + CR;
+		} else {
+			corpsMakefile = "";
+		}
+		return corpsMakefile;
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/elntranslator/toELN/ModuleCode.java b/src/main/java/elntranslator/toELN/ModuleCode.java
new file mode 100644
index 0000000000..8ce714325e
--- /dev/null
+++ b/src/main/java/elntranslator/toELN/ModuleCode.java
@@ -0,0 +1,913 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package elntranslator.toELN;
+
+import java.util.*;
+import elntranslator.*;
+
+/**
+ * Class ModuleCode
+ * Principal code of a module
+ * Creation: 25/07/2018
+ * @version 1.0 25/07/2018
+ * @author Irina Kit Yan LEE
+ */
+
+public class ModuleCode {
+	static private String corpsModule;
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	ModuleCode() {}
+
+	public static String getModuleCode(ELNTModule module, List<ELNTConnector> connectors) {
+		if (module != null) {
+			corpsModule = "#ifndef " + module.getName().toUpperCase() + "_H"+ CR 
+					+ "#define " + module.getName().toUpperCase() + "_H" + CR2
+					+ "#include <cmath>" + CR + "#include <iostream>" + CR + "#include <systemc-ams>" + CR2;
+			
+			corpsModule = corpsModule + "SC_MODULE(" + module.getName() + ")" + CR + "{" + CR;
+			
+			LinkedList<ELNTModuleTerminal> terms = module.getModuleTerminal();
+			for (int i = 0; i < terms.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_terminal " + terms.get(i).getName() + ";" + CR;
+				if (i == terms.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentCapacitor> capacitors = module.getCapacitor();
+			for (int i = 0; i < capacitors.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_c " + capacitors.get(i).getName() + ";" + CR;
+				if (i == capacitors.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentIdealTransformer> idealTransformers = module.getIdealTransformer();
+			for (int i = 0; i < idealTransformers.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_ideal_transformer " + idealTransformers.get(i).getName() + ";" + CR;
+				if (i == idealTransformers.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentIndependentCurrentSource> isources = module.getIsource();
+			for (int i = 0; i < isources.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_isource " + isources.get(i).getName() + ";" + CR;
+				if (i == isources.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentIndependentVoltageSource> vsources = module.getVsource();
+			for (int i = 0; i < vsources.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_vsource " + vsources.get(i).getName() + ";" + CR;
+				if (i == vsources.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentInductor> inductors = module.getInductor();
+			for (int i = 0; i < inductors.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_l " + inductors.get(i).getName() + ";" + CR;
+				if (i == inductors.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+
+			LinkedList<ELNTComponentResistor> resistors = module.getResistor();
+			for (int i = 0; i < resistors.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_r " + resistors.get(i).getName() + ";" + CR;
+				if (i == resistors.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentTransmissionLine> transmissionLines = module.getTransmissionLine();
+			for (int i = 0; i < transmissionLines.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_transmission_line " + transmissionLines.get(i).getName() + ";" + CR;
+				if (i == transmissionLines.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentVoltageControlledCurrentSource> vccss = module.getVccs();
+			for (int i = 0; i < vccss.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_vccs " + vccss.get(i).getName() + ";" + CR;
+				if (i == vccss.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentVoltageControlledVoltageSource> vcvss = module.getVcvs();
+			for (int i = 0; i < vcvss.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_vcvs " + vcvss.get(i).getName() + ";" + CR;
+				if (i == vcvss.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentCurrentSinkTDF> TDF_isinks = module.getTDF_isink();
+			for (int i = 0; i < TDF_isinks.size(); i++) {
+				//corps = corps + "\tsca_eln::sca_tdf::sca_isink" + TDF_isinks.get(i).getName() + ";" + CR;
+				corpsModule = corpsModule + "\tsca_eln::sca_tdf_isink " + TDF_isinks.get(i).getName() + ";" + CR;
+				if (i == TDF_isinks.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentCurrentSourceTDF> TDF_isources = module.getTDF_isource();
+			for (int i = 0; i < TDF_isources.size(); i++) {
+				//corps = corps + "\tsca_eln::sca_tdf::sca_isource " + TDF_isources.get(i).getName() + ";" + CR;
+				corpsModule = corpsModule + "\tsca_eln::sca_tdf_isource " + TDF_isources.get(i).getName() + ";" + CR;
+				if (i == TDF_isources.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentVoltageSinkTDF> TDF_vsinks = module.getTDF_vsink();
+			for (int i = 0; i < TDF_vsinks.size(); i++) {
+				//corps = corps + "\tsca_eln::sca_tdf::sca_vsink " + TDF_vsinks.get(i).getName() + ";" + CR;
+				corpsModule = corpsModule + "\tsca_eln::sca_tdf_vsink " + TDF_vsinks.get(i).getName() + ";" + CR;
+				if (i == TDF_vsinks.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentVoltageSourceTDF> TDF_vsources = module.getTDF_vsource();
+			for (int i = 0; i < TDF_vsources.size(); i++) {
+				//corps = corps + "\tsca_eln::sca_tdf::sca_vsource " + TDF_vsources.get(i).getName() + ";" + CR;
+				corpsModule = corpsModule + "\tsca_eln::sca_tdf_vsource " + TDF_vsources.get(i).getName() + ";" + CR;
+				if (i == TDF_vsources.size()-1) {
+					corpsModule = corpsModule + CR;
+				}
+			}
+			
+			corpsModule = corpsModule + "\tSC_CTOR(" + module.getName() + ")" + CR;
+			
+			int cpt = 0;
+			for (int i = 0; i < terms.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + terms.get(i).getName() + "(\"" + terms.get(i).getName() + "\")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + terms.get(i).getName() + "(\"" + terms.get(i).getName() + "\")" + CR;
+				}
+			}
+			for (int i = 0; i < capacitors.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + capacitors.get(i).getName() + "(\"" + capacitors.get(i).getName() + "\", " + capacitors.get(i).getVal() + ", " + capacitors.get(i).getQ0() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + capacitors.get(i).getName() + "(\"" + capacitors.get(i).getName() + "\", " + capacitors.get(i).getVal() + ", " + capacitors.get(i).getQ0() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < idealTransformers.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + idealTransformers.get(i).getName() + "(\"" + idealTransformers.get(i).getName() + "\", " + idealTransformers.get(i).getRatio() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + idealTransformers.get(i).getName() + "(\"" + idealTransformers.get(i).getName() + "\", " + idealTransformers.get(i).getRatio() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < isources.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + isources.get(i).getName() + "(\"" + isources.get(i).getName() + "\", " + isources.get(i).getInitValue() + ", " + isources.get(i).getOffset() 
+					  + ", " + isources.get(i).getAmplitude() + ", " + isources.get(i).getFrequency() + ", " + isources.get(i).getPhase() + ", " + isources.get(i).getDelay() 
+					  + ", " + isources.get(i).getAcAmplitude() + ", " + isources.get(i).getAcPhase() + ", " + isources.get(i).getAcNoiseAmplitude() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + isources.get(i).getName() + "(\"" + isources.get(i).getName() + "\", " + isources.get(i).getInitValue() + ", " + isources.get(i).getOffset() 
+					  + ", " + isources.get(i).getAmplitude() + ", " + isources.get(i).getFrequency() + ", " + isources.get(i).getPhase() + ", " + isources.get(i).getDelay() 
+					  + ", " + isources.get(i).getAcAmplitude() + ", " + isources.get(i).getAcPhase() + ", " + isources.get(i).getAcNoiseAmplitude() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < vsources.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + vsources.get(i).getName() + "(\"" + vsources.get(i).getName() + "\", " + vsources.get(i).getInitValue() + ", " + vsources.get(i).getOffset() 
+					  + ", " + vsources.get(i).getAmplitude() + ", " + vsources.get(i).getFrequency() + ", " + vsources.get(i).getPhase() + ", " + vsources.get(i).getDelay() 
+					  + ", " + vsources.get(i).getAcAmplitude() + ", " + vsources.get(i).getAcPhase() + ", " + vsources.get(i).getAcNoiseAmplitude() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + vsources.get(i).getName() + "(\"" + vsources.get(i).getName() + "\", " + vsources.get(i).getInitValue() + ", " + vsources.get(i).getOffset() 
+					  + ", " + vsources.get(i).getAmplitude() + ", " + vsources.get(i).getFrequency() + ", " + vsources.get(i).getPhase() + ", " + vsources.get(i).getDelay() 
+					  + ", " + vsources.get(i).getAcAmplitude() + ", " + vsources.get(i).getAcPhase() + ", " + vsources.get(i).getAcNoiseAmplitude() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < inductors.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + inductors.get(i).getName() + "(\"" + inductors.get(i).getName() + "\", " + inductors.get(i).getVal() + ", " + inductors.get(i).getPhi0() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + inductors.get(i).getName() + "(\"" + inductors.get(i).getName() + "\", " + inductors.get(i).getVal() + ", " + inductors.get(i).getPhi0() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < resistors.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + resistors.get(i).getName() + "(\"" + resistors.get(i).getName() + "\", " + resistors.get(i).getVal() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + resistors.get(i).getName() + "(\"" + resistors.get(i).getName() + "\", " + resistors.get(i).getVal() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < transmissionLines.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + transmissionLines.get(i).getName() + "(\"" + transmissionLines.get(i).getName() + "\", " + transmissionLines.get(i).getZ0() + ", " + transmissionLines.get(i).getDelay() + ", " + transmissionLines.get(i).getDelta0() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + transmissionLines.get(i).getName() + "(\"" + transmissionLines.get(i).getName() + "\")" + CR;
+				}
+			}
+			for (int i = 0; i < vccss.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + vccss.get(i).getName() + "(\"" + vccss.get(i).getName() + "\", " + vccss.get(i).getVal() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + vccss.get(i).getName() + "(\"" + vccss.get(i).getName() + "\", " + vccss.get(i).getVal() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < vcvss.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + vcvss.get(i).getName() + "(\"" + vcvss.get(i).getName() + "\", " + vcvss.get(i).getVal() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + vcvss.get(i).getName() + "(\"" + vcvss.get(i).getName() + "\", " + vcvss.get(i).getVal() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < TDF_isinks.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + TDF_isinks.get(i).getName() + "(\"" + TDF_isinks.get(i).getName() + "\", " + TDF_isinks.get(i).getScale() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + TDF_isinks.get(i).getName() + "(\"" + TDF_isinks.get(i).getName() + "\", " + TDF_isinks.get(i).getScale() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < TDF_isources.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + TDF_isources.get(i).getName() + "(\"" + TDF_isources.get(i).getName() + "\", " + TDF_isources.get(i).getScale() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + TDF_isources.get(i).getName() + "(\"" + TDF_isources.get(i).getName() + "\", " + TDF_isources.get(i).getScale() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < TDF_vsinks.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + TDF_vsinks.get(i).getName() + "(\"" + TDF_vsinks.get(i).getName() + "\", " + TDF_vsinks.get(i).getScale() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + TDF_vsinks.get(i).getName() + "(\"" + TDF_vsinks.get(i).getName() + "\", " + TDF_vsinks.get(i).getScale() + ")" + CR;
+				}
+			}
+			for (int i = 0; i < TDF_vsources.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + TDF_vsources.get(i).getName() + "(\"" + TDF_vsources.get(i).getName() + "\", " + TDF_vsources.get(i).getScale() + ")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + TDF_vsources.get(i).getName() + "(\"" + TDF_vsources.get(i).getName() + "\", " + TDF_vsources.get(i).getScale() + ")" + CR;
+				}
+			}
+			
+			// List of nodes
+			LinkedList<ELNTConnector> nodes = new LinkedList<ELNTConnector>();
+			for (int i = 0; i < connectors.size(); i++) {
+				if (!connectors.get(i).getName().equals("")) {
+					nodes.add(connectors.get(i));
+				}
+			}
+			
+			for (int i = 0; i < nodes.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + nodes.get(i).getName() + "(\"" + nodes.get(i).getName() + "\")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + nodes.get(i).getName() + "(\"" + nodes.get(i).getName() + "\")" + CR;
+				}
+			}
+			
+			LinkedList<ELNTComponentNodeRef> nodeRefs = module.getNodeRef();
+			for (int i = 0; i < nodeRefs.size(); i++) {
+				if (cpt == 0) {
+					corpsModule = corpsModule + "\t: " + nodeRefs.get(i).getName() + "(\"" + nodeRefs.get(i).getName() + "\")" + CR;
+					cpt ++;
+				} else {
+					corpsModule = corpsModule + "\t, " + nodeRefs.get(i).getName() + "(\"" + nodeRefs.get(i).getName() + "\")" + CR;
+				}
+			}
+			
+			corpsModule = corpsModule + "\t{" + CR;
+			
+			for (int i = 0; i < capacitors.size(); i++) {
+				for (int j = 0; j < capacitors.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + capacitors.get(i).getName() + "." + capacitors.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(capacitors.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(capacitors.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(capacitors.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(capacitors.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < idealTransformers.size(); i++) {
+				for (int j = 0; j < idealTransformers.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + idealTransformers.get(i).getName() + "." + idealTransformers.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(idealTransformers.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(idealTransformers.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(idealTransformers.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(idealTransformers.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < isources.size(); i++) {
+				for (int j = 0; j < isources.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + isources.get(i).getName() + "." + isources.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(isources.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(isources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(isources.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(isources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < vsources.size(); i++) {
+				for (int j = 0; j < vsources.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + vsources.get(i).getName() + "." + vsources.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(vsources.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(vsources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(vsources.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(vsources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < inductors.size(); i++) {
+				for (int j = 0; j < inductors.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + inductors.get(i).getName() + "." + inductors.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(inductors.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(inductors.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(inductors.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(inductors.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < resistors.size(); i++) {
+				for (int j = 0; j < resistors.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + resistors.get(i).getName() + "." + resistors.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(resistors.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(resistors.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(resistors.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(resistors.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < transmissionLines.size(); i++) {
+				for (int j = 0; j < transmissionLines.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + transmissionLines.get(i).getName() + "." + transmissionLines.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(transmissionLines.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(transmissionLines.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(transmissionLines.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(transmissionLines.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < vccss.size(); i++) {
+				for (int j = 0; j < vccss.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + vccss.get(i).getName() + "." + vccss.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(vccss.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(vccss.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(vccss.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(vccss.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < vcvss.size(); i++) {
+				for (int j = 0; j < vcvss.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + vcvss.get(i).getName() + "." + vcvss.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(vcvss.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(vcvss.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(vcvss.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(vcvss.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < TDF_isinks.size(); i++) {
+				for (int j = 0; j < TDF_isinks.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + TDF_isinks.get(i).getName() + "." + TDF_isinks.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(TDF_isinks.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(TDF_isinks.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(TDF_isinks.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(TDF_isinks.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < TDF_isources.size(); i++) {
+				for (int j = 0; j < TDF_isources.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + TDF_isources.get(i).getName() + "." + TDF_isources.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(TDF_isources.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(TDF_isources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(TDF_isources.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(TDF_isources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < TDF_vsinks.size(); i++) {
+				for (int j = 0; j < TDF_vsinks.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + TDF_vsinks.get(i).getName() + "." + TDF_vsinks.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(TDF_vsinks.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(TDF_vsinks.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(TDF_vsinks.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(TDF_vsinks.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			for (int i = 0; i < TDF_vsources.size(); i++) {
+				for (int j = 0; j < TDF_vsources.get(i).getCp().length; j++) {
+					corpsModule = corpsModule + "\t\t" + TDF_vsources.get(i).getName() + "." + TDF_vsources.get(i).getCp()[j].getName() + "(";
+					for (int k = 0; k < connectors.size(); k++) {
+						if (connectors.get(k).get_p1().getName().equals(TDF_vsources.get(i).getCp()[j].getName()) && connectors.get(k).get_p1().getComponent().getName().equals(TDF_vsources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p2().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+						if (connectors.get(k).get_p2().getName().equals(TDF_vsources.get(i).getCp()[j].getName()) && connectors.get(k).get_p2().getComponent().getName().equals(TDF_vsources.get(i).getName())) {
+							if (!connectors.get(k).getName().equals("")) {
+								corpsModule = corpsModule + connectors.get(k).getName() + ");" + CR;
+							} else {
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTModuleTerminal) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTComponentNodeRef) {
+									corpsModule = corpsModule + connectors.get(k).get_p1().getComponent().getName() + ");" + CR;
+								}
+								if (connectors.get(k).get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+									ELNTConnector connector = ((ELNTMidPortTerminal) connectors.get(k).get_p2().getComponent()).getConnector();
+									corpsModule = corpsModule + searchName(connector) + ");" + CR;
+								}
+							}
+						}
+					}
+				}
+			}
+			
+			corpsModule = corpsModule + "\t}" + CR2 + "private:" + CR;
+			
+			for (int i = 0; i < nodes.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_node " + nodes.get(i).getName() + CR;
+			}
+			
+			for (int i = 0; i < nodeRefs.size(); i++) {
+				corpsModule = corpsModule + "\tsca_eln::sca_node_ref " + nodeRefs.get(i).getName() + CR;
+			}
+			
+			corpsModule = corpsModule + "};" + CR2 + "#endif" + " // " + module.getName().toUpperCase() + "_H";
+		} else {
+			corpsModule = "";
+		}
+		return corpsModule;
+	}
+	
+	private static String searchName(ELNTConnector connector) {
+		if (connector.get_p1().getComponent() instanceof ELNTComponent) {
+			if (connector.get_p2().getComponent() instanceof ELNTModuleTerminal) {
+				return connector.get_p2().getComponent().getName();
+			}
+			if (connector.get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+				return connector.get_p2().getComponent().getName();
+			}
+			if (connector.get_p2().getComponent() instanceof ELNTMidPortTerminal) {
+				ELNTConnector c = ((ELNTMidPortTerminal) connector.get_p2().getComponent()).getConnector();
+				return searchName(c);
+			}
+		}
+		if (connector.get_p1().getComponent() instanceof ELNTModuleTerminal) { 
+			return connector.get_p1().getComponent().getName();
+		}
+		if (connector.get_p1().getComponent() instanceof ELNTComponentNodeRef) { 
+			return connector.get_p1().getComponent().getName();
+		}
+		if (connector.get_p1().getComponent() instanceof ELNTMidPortTerminal) {
+			if (connector.get_p2().getComponent() instanceof ELNTModuleTerminal) {
+				return connector.get_p2().getComponent().getName();
+			}
+			if (connector.get_p2().getComponent() instanceof ELNTComponentNodeRef) {
+				return connector.get_p2().getComponent().getName();
+			}
+			if (connector.get_p2().getComponent() instanceof ELNTComponent) {
+				ELNTConnector c = ((ELNTMidPortTerminal) connector.get_p1().getComponent()).getConnector();
+				return searchName(c);
+			}
+		}
+		return "";
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/elntranslator/toELN/TopCellGenerator.java b/src/main/java/elntranslator/toELN/TopCellGenerator.java
new file mode 100644
index 0000000000..f722f8546a
--- /dev/null
+++ b/src/main/java/elntranslator/toELN/TopCellGenerator.java
@@ -0,0 +1,138 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+  Daniela Genius, Lip6, UMR 7606 
+
+  ludovic.apvrille AT enst.fr
+  daniela.genius@lip6.fr
+
+  This software is a computer program whose purpose is to allow the 
+  edition of TURTLE analysis, design and deployment diagrams, to 
+  allow the generation of RT-LOTOS or Java code from this diagram, 
+  and at last to allow the analysis of formal validation traces 
+  obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+  from INRIA Rhone-Alpes.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
+*/
+
+/* Generator of the top cell for simulation with SoCLib virtual component 
+   library */
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package elntranslator.toELN;
+
+import java.io.*;
+import java.util.LinkedList;
+import java.util.List;
+import elntranslator.*;
+import syscamstranslator.*;
+
+/**
+ * Class TopCellGenerator
+ * Save the components and connectors in files
+ * Creation: 27/07/2018
+ * @version 1.0 27/07/2018
+ * @author Irina Kit Yan LEE
+*/
+
+public class TopCellGenerator {
+	public static ELNSpecification eln;
+
+	private final static String GENERATED_PATH1 = "generated_CPP" + File.separator;
+	private final static String GENERATED_PATH2 = "generated_H" + File.separator;
+
+	public TopCellGenerator(ELNSpecification _eln) {
+		eln = _eln;
+	}
+
+	public String generateTopCell(ELNTCluster cluster, LinkedList<ELNTConnector> ELNconnectors, LinkedList<SysCAMSTConnector> TDFconnectors, LinkedList<SysCAMSTConnector> DEconnectors) {
+		if (TopCellGenerator.eln.getCluster() == null) {
+			System.out.println("***Warning: require at least one cluster***");
+		}
+		if (TopCellGenerator.eln.getNbModule() == 0) {
+			System.out.println("***Warning: require at least one module***");
+		}
+		if (TopCellGenerator.eln.getNbModuleTerminal() == 0) {
+			System.out.println("***Warning: require at least one module terminal***");
+		}
+		if (TopCellGenerator.eln.getNbComponentCapacitor() + TopCellGenerator.eln.getNbComponentCurrentSinkTDF() + 
+				TopCellGenerator.eln.getNbComponentCurrentSourceTDF() + TopCellGenerator.eln.getNbComponentIdealTransformer() + 
+				TopCellGenerator.eln.getNbComponentIndependentCurrentSource() + TopCellGenerator.eln.getNbComponentIndependentVoltageSource() +
+				TopCellGenerator.eln.getNbComponentInductor() + TopCellGenerator.eln.getNbComponentResistor() + TopCellGenerator.eln.getNbComponentTransmissionLine() +
+				TopCellGenerator.eln.getNbComponentVoltageControlledCurrentSource() + TopCellGenerator.eln.getNbComponentVoltageControlledVoltageSource() + 
+				TopCellGenerator.eln.getNbComponentVoltageSinkTDF() + TopCellGenerator.eln.getNbComponentVoltageSourceTDF() == 0) {
+			System.out.println("***Warning: require at least one primitive component***");
+		}
+		if (TopCellGenerator.eln.getNbComponentNodeRef() == 0) {
+			System.out.println("***Warning: require at least one node ref***");
+		}
+		String top = ClusterCode.getClusterCode(cluster, ELNconnectors, TDFconnectors, DEconnectors);
+		return (top);
+	}
+
+	public void saveFile(String path) {
+		ELNTCluster cluster = TopCellGenerator.eln.getCluster();
+		LinkedList<ELNTConnector> ELNconnectorsIn = TopCellGenerator.eln.getAllConnectorsInModule();
+		LinkedList<ELNTConnector> ELNconnectorsOut = TopCellGenerator.eln.getAllConnectorsBetweenELNModuleTerminal();
+		LinkedList<SysCAMSTConnector> TDFconnectors = TopCellGenerator.eln.getAllConnectorsBetweenTDFModulePort();
+		LinkedList<SysCAMSTConnector> DEconnectors = TopCellGenerator.eln.getAllConnectorsBetweenDEModulePort();
+
+		String top;
+
+		try {
+			// Save file .cpp
+			System.err.println(path + GENERATED_PATH1 + cluster.getName() + ".cpp");
+			FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getName() + "_tb.cpp");
+			top = generateTopCell(cluster, ELNconnectorsOut, TDFconnectors, DEconnectors);
+			fw.write(top);
+			fw.close();
+		} catch (Exception ex) {
+			ex.printStackTrace();
+		}
+		// Save files .h
+		saveFileModule(path, cluster, ELNconnectorsIn);
+	}
+
+	public void saveFileModule(String path, ELNTCluster cluster, List<ELNTConnector> connectors) {
+		LinkedList<ELNTModule> modules = cluster.getModule();
+		
+		String code;
+		
+		for (ELNTModule module : modules) {
+			try {
+				System.err.println(path + GENERATED_PATH2 + module.getName() + ".h");
+				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + module.getName() + ".h");
+				code = ModuleCode.getModuleCode(module, connectors);
+				fw.write(code);
+				fw.close();
+			} catch (Exception ex) {
+				ex.printStackTrace();
+			}
+		}
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java
index 70b56c9ce8..4e559db924 100644
--- a/src/main/java/ui/ActionPerformer.java
+++ b/src/main/java/ui/ActionPerformer.java
@@ -976,6 +976,8 @@ public class ActionPerformer {
         	mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_TDF_CURRENT_SOURCE);
         } else if (command.equals(mgui.actions[TGUIAction.ELN_CLUSTER].getActionCommand())){
         	mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_CLUSTER);
+        } else if (command.equals(mgui.actions[TGUIAction.ELN_GENCODE].getActionCommand())){
+            mgui.elnExecutableCodeGeneration();
 
             // Attack Tree Diagrams
         } else if (command.equals(mgui.actions[TGUIAction.ATD_BLOCK].getActionCommand())) {
diff --git a/src/main/java/ui/ELNDesignPanel.java b/src/main/java/ui/ELNDesignPanel.java
index 3296df2d18..a0534af0d9 100644
--- a/src/main/java/ui/ELNDesignPanel.java
+++ b/src/main/java/ui/ELNDesignPanel.java
@@ -43,7 +43,6 @@ import myutil.GraphicLib;
 import ui.eln.ELNDiagramPanel;
 import ui.eln.ELNDiagramToolBar;
 import ui.util.IconManager;
-
 import javax.swing.*;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -87,31 +86,7 @@ public class ELNDesignPanel extends TURTLEPanel {
 	}
 
 	public void init() {
-
-		// Toolbar
-		ELNDiagramToolBar toolBarELN = new ELNDiagramToolBar(mgui);
-		toolbars.add(toolBarELN);
-
-		toolBarPanel = new JPanel();
-		toolBarPanel.setLayout(new BorderLayout());
-
-		// Diagram
-		elndp = new ELNDiagramPanel(mgui, toolBarELN);
-		elndp.setName("ELN Diagram");
-		elndp.tp = this;
-		tdp = elndp;
-		panels.add(elndp); // Always first in list
-		JScrollDiagramPanel jsp = new JScrollDiagramPanel(elndp);
-		elndp.jsp = jsp;
-		jsp.setWheelScrollingEnabled(true);
-		jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT);
-		toolBarPanel.add(toolBarELN, BorderLayout.NORTH);
-		toolBarPanel.add(jsp, BorderLayout.CENTER);
-		tabbedPane.addTab("ELN Diagram", IconManager.imgic1208, toolBarPanel,
-				"Opens ELN diagram");
-		tabbedPane.setSelectedIndex(0);
-
-		mgui.changeMade(elndp, TDiagramPanel.NEW_COMPONENT);
+		mgui.changeMade(null, TDiagramPanel.NEW_COMPONENT);
 	}
 
 	public String saveHeaderInXml(String extensionToName) {
@@ -128,6 +103,51 @@ public class ELNDesignPanel extends TURTLEPanel {
 	public String toString() {
 		return mgui.getTitleAt(this) + "(ELN Application diagram)";
 	}
+	
+	public boolean canFirstDiagramBeMoved() {
+		return true;
+	}
+
+	public boolean removeEnabled(int index) {
+		return panels.size() > 1;
+	}
+
+	public boolean renameEnabled(int index) {
+		if (panels.size() == 0) {
+			return false;
+		}
+		return (panels.elementAt(index) instanceof ELNDiagramPanel);
+	}
+
+	public boolean isELNEnabled() {
+		return true;
+	}
+
+	public boolean addELN(String s) {
+		ELNDiagramToolBar elntb = new ELNDiagramToolBar(mgui);
+		toolbars.add(elntb);
+
+		toolBarPanel = new JPanel();
+		toolBarPanel.setLayout(new BorderLayout());
+
+		elndp = new ELNDiagramPanel(mgui, elntb);
+		elndp.setName(s);
+		elndp.tp = this;
+		tdp = elndp;
+		panels.add(elndp);
+		JScrollDiagramPanel jsp = new JScrollDiagramPanel(elndp);
+		elndp.jsp = jsp;
+		jsp.setWheelScrollingEnabled(true);
+		jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT);
+		toolBarPanel.add(elntb, BorderLayout.NORTH);
+		toolBarPanel.add(jsp, BorderLayout.CENTER);
+		tabbedPane.addTab(s, IconManager.imgic1208, toolBarPanel, "Opens ELN component diagram");
+		tabbedPane.setSelectedIndex(0);
+		JPanel toolBarPanel = new JPanel();
+		toolBarPanel.setLayout(new BorderLayout());
+
+		return true;
+	}
 
 //	public SysCAMSBlockTDF getBlockTDFComponentByName(String _name) {
 //		return elndp.getBlockTDFComponentByName(_name);
diff --git a/src/main/java/ui/GTURTLEModeling.java b/src/main/java/ui/GTURTLEModeling.java
index 010b42b65a..a103aa2c8e 100644
--- a/src/main/java/ui/GTURTLEModeling.java
+++ b/src/main/java/ui/GTURTLEModeling.java
@@ -5863,6 +5863,7 @@ memloop:
 			String nameTab;
 			NodeList diagramNl;
 			int indexDesign;
+			int indexTab = 0;
 
 			nameTab = elt.getAttribute("nameTab");
 
@@ -5878,7 +5879,8 @@ memloop:
 					if (elt.getTagName().compareTo("ELNDiagramPanel") == 0) {
 						// Class diagram
 						TraceManager.addDev("Loading ELN");
-						loadELNDiagram(elt, indexDesign);
+						loadELNDiagram(elt, indexDesign, indexTab);
+						indexTab++;
 						TraceManager.addDev("End loading ELN");
 					}
 				}
@@ -6385,8 +6387,7 @@ memloop:
 			loadDiagram(elt, tdp);
 		}
 
-		public void loadSysCAMSDiagram(Element elt, int indexDesign, int indexTab)
-				throws MalformedModelingException, SAXException {
+		public void loadSysCAMSDiagram(Element elt, int indexDesign, int indexTab) throws MalformedModelingException, SAXException {
 			String name;
 
 			name = elt.getAttribute("name");
@@ -6402,15 +6403,18 @@ memloop:
 			loadDiagram(elt, tdp);
 		}
 
-		public void loadELNDiagram(Element elt, int indexDesign) throws MalformedModelingException, SAXException {
+		public void loadELNDiagram(Element elt, int indexDesign, int indexTab) throws MalformedModelingException, SAXException {
 			String name;
-			TDiagramPanel tdp;
 
-			// class diagram name
 			name = elt.getAttribute("name");
-			mgui.setELNDiagramName(indexDesign, name);
-			tdp = mgui.getMainTDiagramPanel(indexDesign);
-			tdp.setName(name);
+			mgui.createELN(indexDesign, name);
+
+			TDiagramPanel tdp = mgui.getELNPanel(indexDesign, indexTab, name);
+
+			if (tdp == null) {
+				throw new MalformedModelingException();
+			}
+			tdp.removeAll();
 
 			loadDiagram(elt, tdp);
 		}
diff --git a/src/main/java/ui/MainGUI.java b/src/main/java/ui/MainGUI.java
index 754598e246..1024449f09 100644
--- a/src/main/java/ui/MainGUI.java
+++ b/src/main/java/ui/MainGUI.java
@@ -68,6 +68,7 @@ import ui.avatarsmd.AvatarSMDPanel;
 import ui.cd.TClassDiagramPanel;
 import ui.diplodocusmethodology.DiplodocusMethodologyDiagramPanel;
 import ui.ebrdd.EBRDDPanel;
+import ui.eln.ELNDiagramPanel;
 import ui.file.*;
 import ui.ftd.FaultTreeDiagramPanel;
 import ui.interactivesimulation.JFrameInteractiveSimulation;
@@ -1101,7 +1102,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
         mainTabbedPane.add(sccdp.tabbedPane, index);
         mainTabbedPane.setToolTipTextAt(index, "Open SystemC-AMS design diagrams");
         mainTabbedPane.setTitleAt(index, name);
-        mainTabbedPane.setIconAt(index, IconManager.imgic60);
+        mainTabbedPane.setIconAt(index, IconManager.imgic1208);
         //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams");
         sccdp.init();
         //ystem.out.println("Design added");
@@ -1117,7 +1118,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
     	mainTabbedPane.add(elndp.tabbedPane, index);
     	mainTabbedPane.setToolTipTextAt(index, "Open ELN design diagrams");
     	mainTabbedPane.setTitleAt(index, name);
-    	mainTabbedPane.setIconAt(index, IconManager.imgic60);
+    	mainTabbedPane.setIconAt(index, IconManager.imgic1208);
     	//mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams");
     	elndp.init();
     	//ystem.out.println("Design added");
@@ -1935,7 +1936,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
     public void newELN() {
     	//TraceManager.addDev("NEW DESIGN");
     	addELNDesignPanel("ELN", -1);
-    	tabs.elementAt(tabs.size() - 1).tabbedPane.setSelectedIndex(0);
+//    	tabs.elementAt(tabs.size() - 1).tabbedPane.setSelectedIndex(0);
     	mainTabbedPane.setSelectedIndex(tabs.size() - 1);
     	//paneAction(null);
     	//frame.repaint();
@@ -7181,6 +7182,20 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
         setPanelMode();
         return true;
     }
+    
+    public boolean createELN(int index, String s) {
+        return createELN(tabs.elementAt(index), s);
+    }
+
+    public boolean createELN(TURTLEPanel tp, String s) {
+        if (!(tp instanceof ELNDesignPanel)) {
+            return false;
+        }
+
+        ((ELNDesignPanel) tp).addELN(s);
+        setPanelMode();
+        return true;
+    }
 
     public boolean isRequirementCreated(int index, String s) {
         return isRequirementCreated(tabs.elementAt(index), s);
@@ -7294,6 +7309,18 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
     	return null;
     }
     
+    public ELNDiagramPanel getELNPanel(int index, int indexTab, String s) {
+    	TURTLEPanel tp = tabs.elementAt(index);
+    	return getELNPanel(tp, indexTab, s);
+    }
+    
+    public ELNDiagramPanel getELNPanel(TURTLEPanel tp, int indexTab, String s) {
+    	if (tp.tabbedPane.getTitleAt(indexTab).equals(s)) {
+    		return (ELNDiagramPanel) (tp.panelAt(indexTab));
+    	}
+    	return null;
+    }
+    
     public AvatarRDPanel getAvatarRDPanel(int index, int indexTab, String s) {
         TURTLEPanel tp = tabs.elementAt(index);
         return getAvatarRDPanel(tp, indexTab, s);
@@ -8452,12 +8479,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
     			}
     		}
     		if (syscamsDiagram.size() == 0) 
-    			System.err.println("No SysCAMS Panel found : MainGUI.getSysCAMSPanel()");
+    			System.err.println("No SysCAMS Panel found : MainGUI.getListSysCAMSPanel()");
     		return syscamsDiagram;
     	} else {
     		JDialog msg = new JDialog();
     		msg.setLocationRelativeTo(null);
-    		JOptionPane.showMessageDialog(msg, "There is no Systemc-AMS panel. Please add one.", "Warning !",
+    		JOptionPane.showMessageDialog(msg, "There is no SystemC-AMS panel. Please add one.", "Warning !",
     				JOptionPane.WARNING_MESSAGE);
     		return null;
     	}
@@ -8472,6 +8499,37 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
         dtree.toBeUpdated();
     }
     
+    public Vector<ELNDiagramPanel> getListELNPanel() {
+    	Vector<ELNDiagramPanel> elnDiagram = new Vector<ELNDiagramPanel>(); 
+    	TURTLEPanel tp = getTURTLEPanel("ELN");
+    	if (tp != null) {
+    		Vector<TDiagramPanel> ps = tp.panels;
+    		for (TDiagramPanel panel : ps) {
+    			if (panel instanceof ELNDiagramPanel) {
+    				elnDiagram.add((ELNDiagramPanel) panel);
+    			}
+    		}
+    		if (elnDiagram.size() == 0) 
+    			System.err.println("No ELN Panel found : MainGUI.getListELNPanel()");
+    		return elnDiagram;
+    	} else {
+    		JDialog msg = new JDialog();
+    		msg.setLocationRelativeTo(null);
+    		JOptionPane.showMessageDialog(msg, "There is no ELN panel. Please add one.", "Warning !",
+    				JOptionPane.WARNING_MESSAGE);
+    		return null;
+    	}
+    }
+    
+    public void elnExecutableCodeGeneration() {
+        JDialogELNExecutableCodeGeneration jgen = new JDialogELNExecutableCodeGeneration(frame, this, "Executable Code generation, compilation and execution",
+                "../ELNGenerationCode/");
+   
+        GraphicLib.centerOnParent(jgen, 500, 450);
+        jgen.setVisible(true);
+        dtree.toBeUpdated();
+    }
+    
     public boolean selectMainTab(String id) {
         TURTLEPanel tp;
 
diff --git a/src/main/java/ui/SysCAMSComponentDesignPanel.java b/src/main/java/ui/SysCAMSComponentDesignPanel.java
index 622816aa64..63a3790f7b 100644
--- a/src/main/java/ui/SysCAMSComponentDesignPanel.java
+++ b/src/main/java/ui/SysCAMSComponentDesignPanel.java
@@ -164,7 +164,7 @@ public class SysCAMSComponentDesignPanel extends TURTLEPanel {
 		jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT);
 		toolBarPanel.add(ardtb, BorderLayout.NORTH);
 		toolBarPanel.add(jsp, BorderLayout.CENTER);
-		tabbedPane.addTab(s, IconManager.imgic84, toolBarPanel, "Opens SysCAMS component diagram");
+		tabbedPane.addTab(s, IconManager.imgic1208, toolBarPanel, "Opens SysCAMS component diagram");
 		tabbedPane.setSelectedIndex(0);
 		JPanel toolBarPanel = new JPanel();
 		toolBarPanel.setLayout(new BorderLayout());
diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java
index f3744ee46a..52f91d7443 100644
--- a/src/main/java/ui/TGUIAction.java
+++ b/src/main/java/ui/TGUIAction.java
@@ -301,6 +301,7 @@ public class TGUIAction extends AbstractAction {
     public static final int ELN_TDF_VOLTAGE_SOURCE = 502;
     public static final int ELN_TDF_CURRENT_SOURCE = 503;
     public static final int ELN_CLUSTER = 504;
+    public static final int ELN_GENCODE = 505;
     
     public static final int EBRDD_EDIT = 271;
     public static final int EBRDD_CONNECTOR = 272;
@@ -656,7 +657,7 @@ public class TGUIAction extends AbstractAction {
     public static final int MOVE_ENABLED = 463;
     public static final int FIRST_DIAGRAM = 464;
     
-    public static final int NB_ACTION = 505;
+    public static final int NB_ACTION = 506;
 
     private static final TAction [] actions = new TAction[NB_ACTION];
 
@@ -1161,7 +1162,7 @@ public class TGUIAction extends AbstractAction {
         actions[CAMS_PORT_DE] = new TAction("C-AMS-port-DE", "Add a DE port", IconManager.imgic8001, IconManager.imgic8001, "DE port", "Add a DE port to the currently opened SystemC-AMS Diagram", 0);
         actions[CAMS_PORT_CONVERTER] = new TAction("C-AMS-port-converter", "Add a converter port", IconManager.imgic8003, IconManager.imgic8003, "Converter port", "Add a converter port to the currently opened SystemC-AMS Diagram", 0);
         actions[CAMS_CLUSTER] = new TAction("C-AMS-cluster", "Add a cluster", IconManager.imgic8006, IconManager.imgic8006, "Cluster", "Add a cluster to the currently opened SystemC-AMS Diagram", 0);
-        actions[CAMS_GENCODE] = new TAction("GENCODE", "GENCODE",IconManager.imgic94, IconManager.imgic94, "Generate SystemC-AMS code", "SystemC-AMS diagram without check syntax", 0);
+        actions[CAMS_GENCODE] = new TAction("C-AMS-gencode", "SystemC-AMS code generation",IconManager.imgic94, IconManager.imgic94, "Generate SystemC-AMS code", "SystemC-AMS diagram without check syntax", 0);
         actions[CAMS_BLOCK_GPIO2VCI] = new TAction("C-AMS-block-GPIO2VCI", "Add a block GPIO2VCI",IconManager.imgic8009, IconManager.imgic8009, "GPIO2VCI block", "Add a GPIO2VCI block to the currently opened SystemC-AMS Diagram", 0);
 
         // ELN
@@ -1185,6 +1186,7 @@ public class TGUIAction extends AbstractAction {
         actions[ELN_TDF_VOLTAGE_SOURCE] = new TAction("eln-tdf-vsource", "Add a voltage source driven by a TDF input signal", IconManager.imgic8033, IconManager.imgic8033, "Voltage source driven by a TDF input signal", "Add a voltage source driven by a TDF input signal to the currently opened ELN Diagram", 0);
         actions[ELN_TDF_CURRENT_SOURCE] = new TAction("eln-tdf-isource", "Add a current source driven by a TDF input signal", IconManager.imgic8034, IconManager.imgic8034, "Current source driven by a TDF input signal", "Add a current source driven by a TDF input signal to the currently opened ELN Diagram", 0);
         actions[ELN_CLUSTER] = new TAction("eln-cluster", "Add a cluster", IconManager.imgic8006, IconManager.imgic8006, "Cluster", "Add a cluster to the currently opened ELN Diagram", 0);
+        actions[ELN_GENCODE] = new TAction("eln-gencode", "ELN code generation",IconManager.imgic94, IconManager.imgic94, "Generate ELN code", "ELN diagram without check syntax", 0);
 
         //ProActive State Machine Diagram
         actions[PROSMD_EDIT] = new TAction("edit-prosmd-diagram", "Edit ProActive state machine diagram", IconManager.imgic100, IconManager.imgic101, "Edit ProActive state machine diagram", "Make it possible to edit the currently opened ProActive state machine diagram", 0);
diff --git a/src/main/java/ui/TURTLEPanel.java b/src/main/java/ui/TURTLEPanel.java
index 632faec35f..f7a3fcb421 100755
--- a/src/main/java/ui/TURTLEPanel.java
+++ b/src/main/java/ui/TURTLEPanel.java
@@ -368,6 +368,10 @@ public abstract class TURTLEPanel implements GenericTree {
     	return false;
     }
     
+    public boolean isELNEnabled() {
+    	return false;
+    }
+    
     public MainGUI getMainGUI() {
         return mgui;
     }
diff --git a/src/main/java/ui/TURTLEPanelPopupListener.java b/src/main/java/ui/TURTLEPanelPopupListener.java
index 139c24dfab..d9e2a327ff 100755
--- a/src/main/java/ui/TURTLEPanelPopupListener.java
+++ b/src/main/java/ui/TURTLEPanelPopupListener.java
@@ -65,7 +65,7 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
     protected MainGUI mgui;
 
     private JMenuItem rename, remove, moveRight, moveLeft, sort, newucd, newsd, newsdzv, newsdfromucd, newreq,
-        newebrdd, newprosmd, newavatarrd, newavatarpd, newavatarcd, newavatarad, newavatarmad, newsyscams;
+        newebrdd, newprosmd, newavatarrd, newavatarpd, newavatarcd, newavatarad, newavatarmad, newsyscams, neweln;
     private JMenuItem newatd, newftd;
 
     public TURTLEPanelPopupListener(TURTLEPanel _tp, MainGUI _mgui) {
@@ -121,6 +121,7 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
         newavatarad = createMenuItem("New Activity Diagram");
         newavatarmad = createMenuItem("New AVATAR Modeling Assumptions Diagram");
         newsyscams = createMenuItem("New SystemC-AMS Diagram");
+        neweln = createMenuItem("New ELN Diagram");
 
         menu = new JPopupMenu("TURTLE panel");
         menu.add(moveLeft);
@@ -157,6 +158,7 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
         if (mgui.isSystemcOn()) {
         	menu.addSeparator();
             menu.add(newsyscams);
+            menu.add(neweln);
         }
     }
 
@@ -214,13 +216,14 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
         newebrdd.setEnabled(tp.isReqEnabled());
         newprosmd.setEnabled(tp.isProSMDEnabled());
         newatd.setEnabled(tp.isATDEnabled());
-	newftd.setEnabled(tp.isFTDEnabled());
+        newftd.setEnabled(tp.isFTDEnabled());
         newavatarrd.setEnabled(tp.isAvatarRDEnabled());
         newavatarpd.setEnabled(tp.isAvatarPDEnabled());
         newavatarcd.setEnabled(tp.isAvatarCDEnabled());
         newavatarad.setEnabled(tp.isAvatarADEnabled());
         newavatarmad.setEnabled(tp.isAvatarMADEnabled());
         newsyscams.setEnabled(tp.isSystemCAMSEnabled());
+        neweln.setEnabled(tp.isELNEnabled());
     }
 
     private Action listener = new AbstractAction() {
@@ -258,7 +261,7 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
                 } else if (ac.equals("New Attack Tree Diagram")) {
                     mgui.createAttackTreeDiagram(tp, "Attack Tree");
                     mgui.changeMade(null, -1);
-		} else if (e.getSource() == newftd) {
+                } else if (e.getSource() == newftd) {
                     mgui.createFaultTreeDiagram(tp, "Fault Tree");
                     mgui.changeMade(null, -1);
                 } else if (ac.equals("New Event-Based Requirement Description Diagram")) {
@@ -285,6 +288,9 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
                 } else if (e.getSource() == newsyscams) {
                 	mgui.createSysCAMS(tp, "SystemC-AMS Component Diagram");
                 	mgui.changeMade(null, -1);
+                } else if (e.getSource() == neweln) {
+                	mgui.createELN(tp, "ELN Diagram");
+                	mgui.changeMade(null, -1);
                 }
             }
         };
diff --git a/src/main/java/ui/eln/ELNDiagramToolBar.java b/src/main/java/ui/eln/ELNDiagramToolBar.java
index 466a7147ff..2ecddf3c39 100644
--- a/src/main/java/ui/eln/ELNDiagramToolBar.java
+++ b/src/main/java/ui/eln/ELNDiagramToolBar.java
@@ -88,6 +88,7 @@ public class ELNDiagramToolBar extends TToolBar {
 		mgui.actions[TGUIAction.ELN_CLUSTER].setEnabled(b);
 		mgui.actions[TGUIAction.CAMS_PORT_DE].setEnabled(b);
 		mgui.actions[TGUIAction.CAMS_PORT_TDF].setEnabled(b);
+		mgui.actions[TGUIAction.ELN_GENCODE].setEnabled(b);
 		
 		mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b);
 		mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b);
@@ -178,6 +179,11 @@ public class ELNDiagramToolBar extends TToolBar {
 		
 		this.addSeparator();
 		
+		button = this.add(mgui.actions[TGUIAction.ELN_GENCODE]);
+		button.addMouseListener(mgui.mouseHandler);
+		
+		this.addSeparator();
+		
 		button = this.add(mgui.actions[TGUIAction.ELN_TOGGLE_ATTR]);
 		button.addMouseListener(mgui.mouseHandler);
 	}
diff --git a/src/main/java/ui/window/JDialogELNExecutableCodeGeneration.java b/src/main/java/ui/window/JDialogELNExecutableCodeGeneration.java
new file mode 100644
index 0000000000..3ef7014b1d
--- /dev/null
+++ b/src/main/java/ui/window/JDialogELNExecutableCodeGeneration.java
@@ -0,0 +1,772 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package ui.window;
+
+import elntranslator.toELN.MakefileCode;
+import elntranslator.toELN.TopCellGenerator;
+import launcher.LauncherException;
+import launcher.RshClient;
+import myutil.*;
+import elntranslator.ELNSpecification;
+import elntranslator.ELNTCluster;
+import ui.util.IconManager;
+import ui.MainGUI;
+import ui.ELNPanelTranslator;
+import ui.eln.ELNDiagramPanel;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.FileWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.LinkedList;
+import java.util.Vector;
+
+/**
+ * Class JDialogELNExecutableCodeGeneration
+ * Dialog for managing the generation and compilation of ELN executable code
+ * Creation: 31/07/2018
+ * @version 1.0 31/07/2018
+ * @author Irina Kit Yan LEE
+ */
+
+@SuppressWarnings("serial")
+
+public class JDialogELNExecutableCodeGeneration extends javax.swing.JFrame implements ActionListener, Runnable, MasterProcessInterface {
+
+    protected Frame f;
+    protected MainGUI mgui;
+
+    private String textSysC1 = "Base directory of code generation:";
+    private String textSysC7 = "Base directory of topcell generation:";
+    private String textSysC8 = "Base directory of Makefile:";
+//    private String textSysC2 = "Compile SystemC-AMS executable with"; // compile
+//    private String textSysC4 = "Run code in soclib / mutekh:";
+//    private String textSysC5 = "Show AVATAR trace from file w/o hardware:";
+//    private String textSysC6 = "Show cycle accurate trace from MPSoC file:";
+
+//    private static String[] codes = {"AVATAR SOCLIB"};
+
+//    private static int selectedRun = 1;
+//    private static int selectedCompile = 0;
+//    private static int selectedViewTrace = 0;
+//    private static boolean static_putUserCode = true;
+
+    protected static String pathCode;
+    protected static String pathSoclibTraceFile;
+    protected static String pathCompileMPSoC;
+    protected static String pathExecuteMPSoC;
+    protected static boolean optimizeModeSelected = true;
+
+    protected final static int NOT_STARTED = 1;
+    protected final static int STARTED = 2;
+    protected final static int STOPPED = 3;
+
+    private static
+
+    int mode;
+
+    //components
+    protected JTextArea jta;
+    protected JButton start;
+    protected JButton stop;
+    protected JButton close;
+
+    protected JRadioButton exe, exeint, exetrace, exesoclib, compile, compilesoclib, viewtrace, viewtracesoclib;
+    protected ButtonGroup compilegroup, exegroup, viewgroup;
+    protected JLabel gen;
+    protected JTextField code1, code2, code3, compiler, exe1, exe2, exe3, exe4, exe2int, simulationTraceFile, simulationsoclibTraceFile;
+    protected JTabbedPane jp1;
+    protected JScrollPane jsp;
+    protected JCheckBox removeCFiles, removeXFiles, debugmode, tracemode, optimizemode, putUserCode;
+    protected JComboBox<String> versionCodeGenerator, units;
+    protected JButton showSimulationTrace, showOverflowStatus;
+
+//    private static int selectedUnit = 2;
+//    private static boolean removeCFilesValue = true;
+//    private static boolean removeXFilesValue = true;
+//    private static boolean debugValue = false;
+//    private static boolean tracingValue = false;
+//    private static boolean optimizeValue = true;
+
+    private Thread t;
+    private boolean go = false;
+//    private boolean hasError = false;
+    protected boolean startProcess = false;
+
+//    private String hostExecute;
+
+    protected RshClient rshc;
+
+    public JDialogELNExecutableCodeGeneration(Frame _f, MainGUI _mgui, String title, String _pathCode) {
+        super(title);
+        f = _f;
+        mgui = _mgui;
+
+        if (pathCode == null) {
+            pathCode = _pathCode;
+        }
+
+//        if (pathCompileMPSoC == null) {
+//            pathCompileMPSoC = _pathCompileMPSoC;
+//        }
+//
+//        if (pathExecuteMPSoC == null) {
+//            pathExecuteMPSoC = _pathExecuteMPSoC;
+//        }
+//
+//        hostExecute = _hostExecute;
+
+        initComponents();
+        myInitComponents();
+        pack();
+
+        getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+    }
+
+    protected void myInitComponents() {
+        mode = NOT_STARTED;
+        setButtons();
+//        makeSelectionCompile();
+//        makeSelectionExecute();
+//        makeSelectionViewTrace();
+    }
+
+    protected void initComponents() {
+        Container c = getContentPane();
+        setFont(new Font("Helvetica", Font.PLAIN, 14));
+        c.setLayout(new BorderLayout());
+
+        // Issue #41 Ordering of tabbed panes 
+        jp1 = GraphicLib.createTabbedPane();//new JTabbedPane();
+
+        JPanel jp01 = new JPanel();
+        GridBagLayout gridbag01 = new GridBagLayout();
+        GridBagConstraints c01 = new GridBagConstraints();
+        jp01.setLayout(gridbag01);
+        jp01.setBorder(new javax.swing.border.TitledBorder("Code generation"));
+
+//        JPanel jp02 = new JPanel();
+//        GridBagLayout gridbag02 = new GridBagLayout();
+//        GridBagConstraints c02 = new GridBagConstraints();
+//        jp02.setLayout(gridbag02);
+//        jp02.setBorder(new javax.swing.border.TitledBorder("Compilation"));
+//
+//        JPanel jp03 = new JPanel();
+//        GridBagLayout gridbag03 = new GridBagLayout();
+//        GridBagConstraints c03 = new GridBagConstraints();
+//        jp03.setLayout(gridbag03);
+//        jp03.setBorder(new javax.swing.border.TitledBorder("Execution"));
+//
+//        JPanel jp04 = new JPanel();
+//        GridBagLayout gridbag04 = new GridBagLayout();
+//        GridBagConstraints c04 = new GridBagConstraints();
+//        jp04.setLayout(gridbag04);
+//        jp04.setBorder(new javax.swing.border.TitledBorder("Simulation trace"));
+
+        c01.gridheight = 1;
+        c01.weighty = 1.0;
+        c01.weightx = 1.0;
+        c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c01.fill = GridBagConstraints.BOTH;
+        c01.gridheight = 1;
+
+        gen = new JLabel(textSysC1);
+        jp01.add(gen, c01);
+
+        code1 = new JTextField(pathCode, 100);
+        jp01.add(code1, c01);
+
+        gen = new JLabel(textSysC7);
+        jp01.add(gen, c01);
+
+        code2 = new JTextField(pathCode, 100);
+        jp01.add(code2, c01);
+        
+        gen = new JLabel(textSysC8);
+        jp01.add(gen, c01);
+        
+        code3 = new JTextField(pathCode, 100);
+        jp01.add(code3, c01);
+
+        jp01.add(new JLabel(" "), c01);
+        c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+
+//        removeCFiles = new JCheckBox("Remove .c / .h files");
+//        removeCFiles.setSelected(removeCFilesValue);
+//        jp01.add(removeCFiles, c01);
+
+//        removeXFiles = new JCheckBox("Remove .x files");
+//        removeXFiles.setSelected(removeXFilesValue);
+//        jp01.add(removeXFiles, c01);
+
+//        debugmode = new JCheckBox("Put debug information in generated code");
+//        debugmode.setSelected(debugValue);
+//        jp01.add(debugmode, c01);
+//
+//        tracemode = new JCheckBox("Put tracing capabilities in generated code");
+//        tracemode.setSelected(tracingValue);
+//        jp01.add(tracemode, c01);
+//
+//        optimizemode = new JCheckBox("Optimize code");
+//        optimizemode.setSelected(optimizeModeSelected);
+//        jp01.add(optimizemode, c01);
+//
+//        putUserCode = new JCheckBox("Include user code");
+//        putUserCode.setSelected(static_putUserCode);
+//        jp01.add(putUserCode, c01);
+
+//        jp01.add(new JLabel("1 time unit ="), c01);
+//
+//        units = new JComboBox<String>(unitTab);
+//        units.setSelectedIndex(selectedUnit);
+//        units.addActionListener(this);
+//        jp01.add(units, c01);
+
+//        jp01.add(new JLabel("Code generator used:"), c01);
+
+//        versionCodeGenerator = new JComboBox<String>(codes);
+        // versionCodeGenerator.setSelectedIndex(selectedItem);
+//        versionCodeGenerator.addActionListener(this);
+//        jp01.add(versionCodeGenerator, c01);
+
+        jp01.add(new JLabel(" "), c01);
+        jp1.add("Generate code", jp01);
+
+        // Panel 02 -> compile
+//        c02.gridheight = 1;
+//        c02.weighty = 1.0;
+//        c02.weightx = 1.0;
+//        c02.gridwidth = GridBagConstraints.REMAINDER; //end row
+//        c02.fill = GridBagConstraints.BOTH;
+//        c02.gridheight = 1;
+
+//        compilegroup = new ButtonGroup();
+//
+//        compilesoclib = new JRadioButton(textSysC2, false);
+//        compilesoclib.addActionListener(this);
+//        jp02.add(compilesoclib, c02);
+//        compilegroup.add(compilesoclib);
+//        compiler = new JTextField(pathCompileMPSoC, 100);
+//        jp02.add(compiler, c02);
+
+        //compile.setSelected(selectedCompile == 0);
+//        compilesoclib.setSelected(selectedCompile == 1);
+//
+//        jp1.add("Compile", jp02);
+
+        // Panel 03 -> Execute
+//        c03.gridheight = 1;
+//        c03.weighty = 1.0;
+//        c03.weightx = 1.0;
+//        c03.gridwidth = GridBagConstraints.REMAINDER; //end row
+//        c03.fill = GridBagConstraints.BOTH;
+//        c03.gridheight = 1;
+
+//        exegroup = new ButtonGroup();
+
+        /*exetrace = new JRadioButton(textSysC3, false);
+        exetrace.addActionListener(this);
+        exegroup.add(exetrace);
+        jp03.add(exetrace, c03);
+        exe3 = new JTextField(pathExecuteMPSoC+"-trace", 100);
+        jp03.add(exe3, c03);*/
+//
+//        exesoclib = new JRadioButton(textSysC4, false);
+//        exesoclib.addActionListener(this);
+//        exegroup.add(exesoclib);
+//        jp03.add(exesoclib, c03);
+//        exe4 = new JTextField(pathExecuteMPSoC, 100);
+//        jp03.add(exe4, c03);
+
+        //exe.setSelected(selectedRun == 0);
+        //exetrace.setSelected(selectedRun == 1);
+      //  exesoclib.setSelected(selectedRun == 2);
+
+//        jp03.add(new JLabel(" "), c03);
+
+//        jp1.add("Execute", jp03);
+
+        // Panel 04 -> View trace
+//        c04.gridheight = 1;
+//        c04.weighty = 1.0;
+//        c04.weightx = 1.0;
+//        c04.gridwidth = GridBagConstraints.REMAINDER; //end row
+//        c04.fill = GridBagConstraints.HORIZONTAL;
+//        c04.gridheight = 1;
+
+//        viewgroup = new ButtonGroup();
+//        viewtrace = new JRadioButton(textSysC5, false);
+//        viewgroup.add(viewtrace);
+//        viewtrace.addActionListener(this);
+//        jp04.add(viewtrace, c04);
+//        simulationTraceFile = new JTextField(pathCode + "trace.txt", 100);
+//        jp04.add(simulationTraceFile, c04);
+//        viewtracesoclib = new JRadioButton(textSysC6, false);
+//        viewgroup.add(viewtracesoclib);
+//        viewtracesoclib.addActionListener(this);
+//        jp04.add(viewtracesoclib, c04);
+//        simulationsoclibTraceFile = new JTextField(pathSoclibTraceFile, 100);
+//        jp04.add(simulationsoclibTraceFile, c04);
+//
+//        showSimulationTrace = new JButton("Show simulation trace");
+//        showSimulationTrace.addActionListener(this);
+//        jp04.add(showSimulationTrace, c04);
+
+        //-------------Ajout C.Demarigny---------------
+
+//        showOverflowStatus = new JButton("Show overflow status");
+//        showOverflowStatus.addActionListener(this);
+//        jp04.add(showOverflowStatus, c04);
+
+        //----------------Fin ajout--------------------
+
+//        viewtrace.setSelected(selectedViewTrace == 0);
+//        viewtracesoclib.setSelected(selectedViewTrace == 1);
+
+//        jp1.add("Results", jp04);
+
+        c.add(jp1, BorderLayout.NORTH);
+
+        jta = new ScrolledJTextArea();
+        jta.setEditable(false);
+        jta.setMargin(new Insets(10, 10, 10, 10));
+        jta.setTabSize(3);
+        jta.append("Select options and then, click on 'start' to launch code generation\n"); // / compilation / execution
+        Font f = new Font("Courrier", Font.BOLD, 12);
+        jta.setFont(f);
+        jsp = new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+
+        c.add(jsp, BorderLayout.CENTER);
+
+        start = new JButton("Start", IconManager.imgic53);
+        stop = new JButton("Stop", IconManager.imgic55);
+        close = new JButton("Close", IconManager.imgic27);
+
+        start.setPreferredSize(new Dimension(100, 30));
+        stop.setPreferredSize(new Dimension(100, 30));
+        close.setPreferredSize(new Dimension(100, 30));
+
+        start.addActionListener(this);
+        stop.addActionListener(this);
+        close.addActionListener(this);
+
+        JPanel jp2 = new JPanel();
+        jp2.add(start);
+        jp2.add(stop);
+        jp2.add(close);
+
+        c.add(jp2, BorderLayout.SOUTH);
+    }
+
+    public void actionPerformed(ActionEvent evt) {
+        String command = evt.getActionCommand();
+
+        // Compare the action command to the known actions.
+        if (command.equals("Start")) {
+            startProcess();
+        } else if (command.equals("Stop")) {
+            stopProcess();
+        } else if (command.equals("Close")) {
+            closeDialog();
+        } else if (evt.getSource() == versionCodeGenerator) {
+            // selectedItem = versionCodeGenerator.getSelectedIndex();
+//        } else if (evt.getSource() == units) {
+//            selectedUnit = units.getSelectedIndex();
+//        } else if (evt.getSource() == showSimulationTrace) {
+//            showSimulationTrace();
+        //} else if ((evt.getSource() == exe) || (evt.getSource() == exetrace)|| (evt.getSource() == exesoclib)) {
+//        else if ((evt.getSource() == exetrace) || (evt.getSource() == exesoclib)) {
+//            makeSelectionExecute();
+//            // } else if ((evt.getSource() == compile) || (evt.getSource() == compilesoclib)) {
+//        } else if ((evt.getSource() == compilesoclib)) {
+//            makeSelectionCompile();
+//        } else if ((evt.getSource() == viewtrace) || (evt.getSource() == viewtracesoclib)) {
+//            makeSelectionViewTrace();
+//        } else if ((evt.getSource() == showOverflowStatus)) { //ajout CD
+//            showOverflowStatus();
+        }
+    }
+
+    public void closeDialog() {
+        if (mode == STARTED) {
+            stopProcess();
+        }
+//        optimizeModeSelected = optimizemode.isSelected();
+//        removeCFilesValue = removeCFiles.isSelected();
+//        removeXFilesValue = removeXFiles.isSelected();
+//        debugValue = debugmode.isSelected();
+//        tracingValue = tracemode.isSelected();
+//        static_putUserCode = putUserCode.isSelected();
+        dispose();
+    }
+//
+//    public void makeSelectionExecute() {
+//
+//        //if (exetrace.isSelected()) {
+//        //    selectedRun = 1;
+//        //} else {
+//        selectedRun = 2;
+//        //}
+//
+//        // exe2.setEnabled(selectedRun == 0);
+//        //exe3.setEnabled(selectedRun == 1);
+//        exe4.setEnabled(selectedRun == 2);
+//    }
+
+//    public void makeSelectionCompile() {
+//
+//        selectedCompile = 1;
+//        compiler.setEnabled(selectedCompile == 1);
+//
+//    }
+
+//    public void makeSelectionViewTrace() {
+//        if (viewtrace.isSelected()) {
+//            selectedViewTrace = 0;
+//        } else {
+//            selectedViewTrace = 1;
+//        }
+//        simulationTraceFile.setEnabled(selectedViewTrace == 0);
+//        // simulationsoclibTraceFile.setEnabled(selectedViewTrace == 1);
+//    }
+
+    public void stopProcess() {
+        try {
+            rshc.stopCommand();
+        } catch (LauncherException le) {
+
+        }
+        rshc = null;
+        mode = STOPPED;
+        setButtons();
+        go = false;
+    }
+
+    public void startProcess() {
+        startProcess = false;
+        t = new Thread(this);
+        mode = STARTED;
+        setButtons();
+        go = true;
+        t.start();
+    }
+
+    private void testGo() throws InterruptedException {
+        if (go == false) {
+            throw new InterruptedException("Stopped by user");
+        }
+    }
+
+    public void run() {
+//        String cmd;
+//        String list;//, data;
+//        hasError = false;
+
+        try {
+            if (jp1.getSelectedIndex() == 0) {
+                jta.append("Generating executable code (ELN version)\n");
+
+                Vector<ELNDiagramPanel> elnDiagramPanels = mgui.getListELNPanel();
+                LinkedList<ELNTCluster> clusters = new LinkedList<ELNTCluster>();
+                for (ELNDiagramPanel elnDiagramPanel : elnDiagramPanels) {
+                	ELNPanelTranslator elnPanelTranslator = new ELNPanelTranslator(elnDiagramPanel);
+                	ELNSpecification elnSpec = elnPanelTranslator.getELNSpecification();
+                	clusters.add(elnSpec.getCluster());
+                }
+                for (ELNDiagramPanel elnDiagramPanel : elnDiagramPanels) {
+                	ELNPanelTranslator elnPanelTranslator = new ELNPanelTranslator(elnDiagramPanel);
+                	ELNSpecification elnSpec = elnPanelTranslator.getELNSpecification();
+
+                	// Generating code
+                	if (elnSpec == null) {
+                		jta.append("Error: No ELN specification\n");
+                	} else {
+                		System.err.println("**ELN TOPCELL found");
+
+                		TopCellGenerator topCellGenerator = new TopCellGenerator(elnSpec);
+                		testGo();
+                		jta.append("Generation of TopCell \"" + elnSpec.getCluster().getName() + "\" executable code: done\n");
+
+                		try {
+                			jta.append("Saving ELN code in files\n");
+                			System.err.println("Saving ELN code in files\n");
+                			pathCode = code2.getText();
+
+                			System.err.println("ELN TOPCELL : " + elnSpec.getCluster().getName() + "saved in " + code2.getText());
+                			topCellGenerator.saveFile(pathCode);
+
+                			jta.append("Code saved\n");
+                		} catch (Exception e) {
+                			jta.append("Could not generate files\n");
+                			System.err.println("Could not generate ELN files\n");
+                			e.printStackTrace();
+                		}
+                	}
+                	testGo();
+                }
+                try {
+        			String makefile;
+        			System.err.println(pathCode + "Makefile");
+        			FileWriter fw = new FileWriter(pathCode + "/" + "Makefile");
+        			makefile = MakefileCode.getMakefileCode(clusters);
+        			fw.write(makefile);
+        			fw.close();
+        		} catch (Exception ex) {
+        			ex.printStackTrace();
+        		}
+                testGo();
+            }
+//                if (removeCFiles.isSelected()) {
+//
+//                    jta.append("Removing all .h files\n");
+//
+//                    list = FileUtils.deleteFiles(code1.getText() + TasksAndMainGenerator.getGeneratedPath(), ".h");
+//                    if (list.length() == 0) {
+//                        jta.append("No files were deleted\n");
+//                    } else {
+//                        jta.append("Files deleted:\n" + list + "\n");
+//                    }
+//                    jta.append("Removing all  .c files\n");
+//                    list = FileUtils.deleteFiles(code1.getText() + TasksAndMainGenerator.getGeneratedPath(), ".c");
+//                    if (list.length() == 0) {
+//                        jta.append("No files were deleted\n");
+//                    } else {
+//                        jta.append("Files deleted:\n" + list + "\n");
+//                    }
+//                }
+
+//                if (removeXFiles.isSelected()) {
+//                    jta.append("Removing all .x files\n");
+//                    list = FileUtils.deleteFiles(code1.getText(), ".x");
+//                    if (list.length() == 0) {
+//                        jta.append("No files were deleted\n");
+//                    } else {
+//                        jta.append("Files deleted:\n" + list + "\n");
+//                    }
+//                }
+
+//                testGo();
+
+//                selectedUnit = units.getSelectedIndex();
+
+                // Generating code
+//                if (avspec == null) {
+//                    jta.append("Error: No AVATAR specification\n");
+//                } else {
+//
+//                    TasksAndMainGenerator gene = new TasksAndMainGenerator(syscalsspec, avspec);
+//                    gene.includeUserCode(putUserCode.isSelected());
+//                    gene.setTimeUnit(selectedUnit);
+//                    gene.generateSoclib(debugmode.isSelected(), tracemode.isSelected());
+//
+//                    if (syscalsspec == null) {
+//                        jta.append("Error: No AVATAR Deployment specification\n");
+//                    } else {
+//                        System.err.println("AVATAR TOPCELL found");
+//                    }
+//
+//                    TopCellGenerator topCellGenerator = new TopCellGenerator(syscalsspec, tracemode.isSelected(), avspec);
+//                    testGo();
+//                    jta.append("Generation of TopCell executable code: done\n");
+//
+//                    try {
+//                        jta.append("Saving code in files\n");
+//                        pathCode = code2.getText();
+//                        topCellGenerator.saveFile(pathCode);
+//
+//                        jta.append("Code saved\n");
+//                    } catch (Exception e) {
+//                        jta.append("Could not generate files\n");
+//                    }
+//
+//                    testGo();
+//                    jta.append("Generation of C-SOCLIB executable code: done\n");
+//                    try {
+//                        jta.append("Saving code in files\n");
+//                        pathCode = code1.getText();
+//                        gene.saveInFiles(pathCode);
+//
+//                        jta.append("Code saved\n");
+//                    } catch (Exception e) {
+//                        jta.append("Could not generate files\n");
+//                    }
+//                }
+//            }
+
+//            testGo();
+
+//            if (jp1.getSelectedIndex() == 1) {
+//                cmd = compiler.getText();
+//                jta.append("Compiling executable code with command: \n" + cmd + "\n");
+//
+//                rshc = new RshClient(hostExecute);
+//                try {
+//                    processCmd(cmd, jta);
+//                    jta.append("Compilation done\n");
+//                } catch (LauncherException le) {
+//                    jta.append("Error: " + le.getMessage() + "\n");
+//                    mode = STOPPED;
+//                    setButtons();
+//                    return;
+//                } catch (Exception e) {
+//                    mode = STOPPED;
+//                    setButtons();
+//                    return;
+//                }
+//            }
+//
+//            if (jp1.getSelectedIndex() == 2) {
+//                try {
+//                    cmd = exe4.getText();
+//                    jta.append("Executing code with command: \n" + cmd + "\n");
+//                    rshc = new RshClient(hostExecute);
+//                    processCmd(cmd, jta);
+//                    jta.append("Execution done\n");
+//                } catch (LauncherException le) {
+//                    jta.append("Error: " + le.getMessage() + "\n");
+//                    mode = STOPPED;
+//                    setButtons();
+//                    return;
+//                } catch (Exception e) {
+//                    mode = STOPPED;
+//                    setButtons();
+//                    return;
+//                }
+//            }
+//            if ((hasError == false) && (jp1.getSelectedIndex() < 2)) {
+//                jp1.setSelectedIndex(jp1.getSelectedIndex() + 1);
+//            }
+        } catch (InterruptedException ie) {
+            jta.append("Interrupted\n");
+        }
+
+        jta.append("\n\nReady to process next command\n");
+
+        checkMode();
+        setButtons();
+    }
+
+    protected void processCmd(String cmd, JTextArea _jta) throws LauncherException {
+        rshc.setCmd(cmd);
+        rshc.sendExecuteCommandRequest();
+        final Writer output = new StringWriter();
+        rshc.writeCommandMessages(output);
+        _jta.append(output.toString());
+
+        return;
+    }
+
+    protected void checkMode() {
+        mode = NOT_STARTED;
+    }
+
+    protected void setButtons() {
+        switch (mode) {
+            case NOT_STARTED:
+                start.setEnabled(true);
+                stop.setEnabled(false);
+                close.setEnabled(true);
+                getGlassPane().setVisible(false);
+                break;
+            case STARTED:
+                start.setEnabled(false);
+                stop.setEnabled(true);
+                close.setEnabled(false);
+                getGlassPane().setVisible(true);
+                break;
+            case STOPPED:
+            default:
+                start.setEnabled(false);
+                stop.setEnabled(false);
+                close.setEnabled(true);
+                getGlassPane().setVisible(false);
+                break;
+        }
+    }
+
+    public boolean hasToContinue() {
+        return (go == true);
+    }
+
+    public void appendOut(String s) {
+        jta.append(s);
+    }
+
+
+    public void setError() {
+//        hasError = true;
+    }
+
+//    public void showSimulationTrace() {
+//        JFrameSimulationSDPanel jfssdp = new JFrameSimulationSDPanel(f, mgui, "Simulation trace of " + simulationTraceFile.getText());
+//        jfssdp.setIconImage(IconManager.img8);
+//        GraphicLib.centerOnParent(jfssdp, 600, 600);
+//        if (selectedViewTrace == 0) {
+//            jfssdp.setFileReference(simulationTraceFile.getText());
+//        } else {
+//            jfssdp.setFileReference(simulationsoclibTraceFile.getText());
+//        }
+//        jfssdp.setVisible(true);
+//        TraceManager.addDev("Ok JFrame");
+//    }
+
+//    public void showOverflowStatus() {
+//        try {
+//            String path = ConfigurationTTool.AVATARMPSoCPerformanceEvaluationDirectory;
+//            String taille = "0";
+//
+//            String log = "mwmr0.log";
+//
+//            String[] commande = {"sh", path + "callingOverflow.sh", taille, path, log};
+//
+//            ProcessBuilder pb = new ProcessBuilder(commande);
+//            pb.redirectError(ProcessBuilder.Redirect.INHERIT);
+//            Process p = pb.start();
+//
+//            int exitStatus = p.waitFor();
+//
+//        } catch (InterruptedException e) {
+//            e.printStackTrace();
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//    }
+}
-- 
GitLab