diff --git a/src/main/java/ui/GTURTLEModeling.java b/src/main/java/ui/GTURTLEModeling.java
index ea5ad6faa4e0d4ddd6ed286b3875e6b8b3bd64c1..2a430720d82c62fe6ca47a33131f89287bef34c6 100644
--- a/src/main/java/ui/GTURTLEModeling.java
+++ b/src/main/java/ui/GTURTLEModeling.java
@@ -7716,6 +7716,23 @@ public class GTURTLEModeling {
             tgc.loadExtraParam(elt1.getElementsByTagName("extraparam"), decX, decY, decId);
             //TraceManager.addDev("Extra param ok");
 
+            //#issue 82
+            if ((myValue != null) && (!myValue.equals(null))) {
+                if ((tgc instanceof TMLCPrimitivePort) && (decId > 0)) {
+                    if (tdp.isAlreadyATMLPrimitivePortName(myValue)) {
+                        myValue = tdp.findTMLCPrimitivePortName(myValue + "_");
+                        //TraceManager.addDev("MyValue=" + myValue);
+                        ((TMLCPrimitivePort) tgc).setPortName(((TMLCPrimitivePort) tgc).getPortNameFromValue(myValue));
+                        ((TMLCPrimitivePort) tgc).commName = ((TMLCPrimitivePort) tgc).getPortNameFromValue(myValue);
+                        // ((TMLCPrimitivePort) tgc).loadExtraParam(elt1.getElementsByTagName("extraparam"), decX, decY, decId);
+                        // TraceManager.addDev("getPortType = " + ((TMLCPrimitivePort) tgc).getPortTypeName() + "" +
+                        //        "\ngetPortName = " + ((TMLCPrimitivePort) tgc).getPortName());
+                        tgc.setValue(myValue);
+                    }
+                }
+            }
+
+
             if ((tgc instanceof TCDTObject) && (decId > 0)) {
                 TCDTObject to = (TCDTObject) tgc;
                 //TraceManager.addDev("Setting TObject name to: " + to.getObjectName());
diff --git a/src/main/java/ui/TDiagramPanel.java b/src/main/java/ui/TDiagramPanel.java
index 1704ae0812d9260ba2b97cdcc4311108c87efdf2..b10d9faf6d213550a69e2a0ff0de4e55bd70e679 100644
--- a/src/main/java/ui/TDiagramPanel.java
+++ b/src/main/java/ui/TDiagramPanel.java
@@ -2365,6 +2365,67 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         }
     }
 
+    /* #issue 82
+     * added by Minh Hiep
+     */
+    public boolean checkInHierarchy(TGComponent mainTgc, TGComponent checkedCom) {
+        TGComponent tgctmp = checkedCom.getFather();
+        if (tgctmp == null) return checkedCom == mainTgc;
+        while(tgctmp != null && tgctmp != mainTgc) {
+            tgctmp = tgctmp.getFather();
+        }
+        return tgctmp == mainTgc;
+    }
+
+    /*
+     * #issue 82
+     * new cloneComponent added by Minh Hiep
+     */
+    public void cloneComponent(TGComponent _tgc) {
+        String clone;
+
+        Vector<TGComponent> connectorList = new Vector<>();
+        TGComponent c1, c2;
+        boolean b1,b2;
+
+        _tgc.select(true);
+
+        //list of connectors within the composite component
+        for(TGComponent tgc : this.getComponentList()) {
+            if(tgc instanceof TGConnector) {
+                c1 = getComponentToWhichBelongs(((TGConnector) tgc).getTGConnectingPointP1());
+                c2 = getComponentToWhichBelongs(((TGConnector) tgc).getTGConnectingPointP2());
+                b1 = checkInHierarchy(_tgc,c1);
+                b2 = checkInHierarchy(_tgc,c2);
+                if(b1 && b2){
+                    tgc.select(true);
+                    connectorList.add(tgc);
+                }
+            }
+        }
+
+        clone = mgui.gtm.makeXMLFromSelectedComponentOfADiagram(this, getMaxIdSelected(), _tgc.getX(), _tgc.getY());
+
+        _tgc.select(false);
+        for(int i = 0; i < connectorList.size(); i++){
+            connectorList.get(i).select(false);
+        }
+
+        //TraceManager.addDev("clone=\n"+ clone);
+        // paste
+        try {
+            mgui.gtm.copyModelingFromXML(this, clone, _tgc.getX() + 50, _tgc.getY() + 25);
+        } catch (MalformedModelingException mme) {
+            TraceManager.addDev("Clone Exception: " + mme.getMessage());
+            JOptionPane.showMessageDialog(mgui.getFrame(), "Clone creation failed", "Exception", JOptionPane.INFORMATION_MESSAGE);
+        }
+
+        //bringToBack(_tgc);
+        mgui.changeMade(this, NEW_COMPONENT);
+        repaint();
+    }
+
+    /*
     public void cloneComponent(TGComponent _tgc) {
         // copy
         String clone = mgui.gtm.makeXMLFromComponentOfADiagram(this, _tgc, getMaxIdSelected(), _tgc.getX(), _tgc.getY());
@@ -2381,7 +2442,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         }
         bringToBack(_tgc);
         mgui.changeMade(this, NEW_COMPONENT);
-    }
+    }*/
 
     public MainGUI getGUI() {
         return mgui;
@@ -2688,7 +2749,9 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
                     || (o instanceof NCEqNode && this.checkNCEqNode((NCEqNode) o, name))
                     || (o instanceof NCSwitchNode && this.checkNCSwitchNode((NCSwitchNode) o, name))
                     || (o instanceof AvatarBDDataType && this.checkAvatarBDDataType((AvatarBDDataType) o, name))
-                    || (o instanceof AvatarBDLibraryFunction && this.checkAvatarBDLibraryFunction((AvatarBDLibraryFunction) o, name));
+                    || (o instanceof AvatarBDLibraryFunction && this.checkAvatarBDLibraryFunction((AvatarBDLibraryFunction) o, name))
+                    //#issue 82
+                    || (o instanceof TMLCPrimitivePort && this.checkCPrimitivePort((TMLCPrimitivePort) o, name));
         }
 
         public boolean checkTClassInterface(TClassInterface o, String name) {
@@ -2870,6 +2933,12 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         public boolean checkAvatarBDLibraryFunction(AvatarBDLibraryFunction o, String name) {
             return false;
         }
+
+        //#issue 82
+        public boolean checkCPrimitivePort(TMLCPrimitivePort o, String name) {
+            return  false;
+        }
+
     }
 
     private boolean isNameUnique(String name, NameChecker checker) {
@@ -2879,6 +2948,41 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         return true;
     }
 
+    //#issue 82
+    private Vector<TMLCPrimitivePort> getPortList () {
+        Vector<TMLCPrimitivePort> portList = new Vector<>();
+        //create list of ports
+        for (TGComponent o : componentList) {
+            if (o instanceof  TGConnector) {
+                if (this.getComponentToWhichBelongs(((TGConnector) o).getTGConnectingPointP1()) instanceof TMLCPrimitivePort) {
+                    TMLCPrimitivePort c1 = (TMLCPrimitivePort) getComponentToWhichBelongs(((TGConnector) o).getTGConnectingPointP1());
+                    portList.add(c1);
+                    // TraceManager.addDev("input port : " + c1.getValue());
+                }
+                if (this.getComponentToWhichBelongs(((TGConnector) o).getTGConnectingPointP2()) instanceof TMLCPrimitivePort) {
+                    TMLCPrimitivePort c2 = (TMLCPrimitivePort) getComponentToWhichBelongs(((TGConnector) o).getTGConnectingPointP2());
+                    portList.add(c2);
+                    // TraceManager.addDev("output port : " + c2.getValue());
+                }
+            }
+        }
+        return portList;
+    }
+
+    //#issue 82
+    private  boolean isPortNameUnique (String name, NameChecker checker) {
+        Vector<TMLCPrimitivePort> portList = getPortList();
+        //TraceManager.addDev("port list size : " + portList.size());
+        for (int i = 0; i < portList.size(); i++) {
+            if (checker.isNameAlreadyTaken(portList.get(i), name)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+
     private String findGoodName(String name, NameChecker checker) {
         // index >= 0 catch overflows
         for (int index = 0; index >= 0; index++) {
@@ -2890,6 +2994,19 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         throw new RuntimeException("Integer Overflow");
     }
 
+    //#issue 82
+    private String findGoodPortName(String name, NameChecker checker) {
+        // index >= 0 catch overflows
+        for (int index = 0; index >= 0; index++) {
+            String tryName = name + index;
+            if (this.isPortNameUnique(tryName, checker))
+                return tryName;
+        }
+
+        throw new RuntimeException("Integer Overflow");
+    }
+
+
     public String findTClassName(String name) {
         return this.findGoodName(name, new NameChecker() {
             public boolean checkTClassInterface(TClassInterface o, String name) {
@@ -2937,6 +3054,16 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         });
     }
 
+    //#issue 82
+    public String findTMLCPrimitivePortName(String name) {
+        return this.findGoodPortName(name, new NameChecker() {
+            public boolean checkCPrimitivePort(TMLCPrimitivePort o, String name) {
+                //TraceManager.addDev("in CheckCPrimitivePort : port value " + o.getValue());
+                return  o.getValue().equals(name);
+            }
+        });
+    }
+
     public String findTMLRecordComponentName(String name) {
         return this.findTMLPrimitiveComponentName(name);
     }
@@ -3255,6 +3382,16 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         });
     }
 
+    //#issue 82;
+    public boolean isAlreadyATMLPrimitivePortName(String name) {
+        return !this.isPortNameUnique(name, new NameChecker() {
+            public boolean checkCPrimitivePort(TMLCPrimitivePort o, String name) {
+                return o.getValue().equals(name);
+            }
+        });
+    }
+
+
     public boolean isAlreadyATOSClassName(String name) {
         return !this.isTOSClassNameUnique(name);
     }
diff --git a/src/main/java/ui/tmlcompd/TMLCPrimitivePort.java b/src/main/java/ui/tmlcompd/TMLCPrimitivePort.java
index bbda5bc30bd80740e678b455426629b6d4e65dad..630f7d0736c6fbb30e9d62ff5b85959f0871274c 100755
--- a/src/main/java/ui/tmlcompd/TMLCPrimitivePort.java
+++ b/src/main/java/ui/tmlcompd/TMLCPrimitivePort.java
@@ -156,6 +156,9 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent
     protected String conflictMessage;
     protected String dataFlowType = "VOID";
     protected String associatedEvent = "VOID";
+
+    //#issue 82
+    public String oldValue;
     
 
 
@@ -178,7 +181,15 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent
         removable = true;
         userResizable = false;
         checkConf=false;
-        commName = "comm";
+
+        //#issue 82
+        value = tdp.findTMLCPrimitivePortName("Channel comm_");
+        oldValue = value;
+        commName = getPortNameFromValue(oldValue);
+        typep = getPortTypeFromValue(oldValue);
+        // added until here
+
+        //commName = "comm";
         //value = "MyName";
         makeValue();
         setName("Primitive port");
@@ -1125,5 +1136,29 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent
         }
     }
 
+    //#issue 82
+    public String getPortNameFromValue(String myValue) {
+        String s = "";
+        String string[] = myValue.split("\\s");
+        for (int i = 1; i < string.length; i++) {
+            s = s + string[i];
+        }
+        return s;
+    }
+
+    //#issue 82
+    public int getPortTypeFromValue(String myValue) {
+        String typePortName = myValue.split("\\s")[0];
+        int typePort = 0;
+        if (typePortName.equals("Channel"))
+            typePort = 0;
+        if (typePortName.equals("Event"))
+            typePort = 1;
+        if (typePortName.equals("Request"))
+            typePort = 2;
+        return typePort;
+    }
+
+
 
 }