diff --git a/src/main/java/elntranslator/ELNSpecification.java b/src/main/java/elntranslator/ELNSpecification.java index 002a22c6f29bd7e26c5c0f23fa28083753feb046..9558db22e16d586cca741bc9b9addc468a4d818d 100644 --- a/src/main/java/elntranslator/ELNSpecification.java +++ b/src/main/java/elntranslator/ELNSpecification.java @@ -40,6 +40,7 @@ package elntranslator; import java.util.LinkedList; import java.util.List; +import syscamstranslator.*; /** * Class ELNSpecification @@ -50,25 +51,87 @@ import java.util.List; */ public class ELNSpecification{ - private List<ELNTComponent> components; - private List<ELNTConnector> connectors; + private List<ELNTComponent> elnComponents; + private List<ELNTConnector> elnConnectors; + private List<SysCAMSTComponent> syscamsComponents; + private List<SysCAMSTConnector> syscamsConnectors; - public ELNSpecification(List<ELNTComponent> _components, List<ELNTConnector> _connectors){ - components = _components ; - connectors = _connectors ; - } - - public List<ELNTComponent> getComponents(){ - return components; + public ELNSpecification(List<ELNTComponent> _elnComponents, List<ELNTConnector> _elnConnectors, List<SysCAMSTComponent> _syscamsComponents, List<SysCAMSTConnector> _syscamsConnectors){ + elnComponents = _elnComponents ; + elnConnectors = _elnConnectors ; + syscamsComponents = _syscamsComponents ; + syscamsConnectors = _syscamsConnectors ; + } + + public List<ELNTComponent> getELNComponents(){ + return elnComponents; } - public List<ELNTConnector> getConnectors(){ - return connectors; + public List<ELNTConnector> getELNConnectors(){ + return elnConnectors; + } + + public List<SysCAMSTComponent> getSysCAMSComponents(){ + return syscamsComponents; + } + + public List<SysCAMSTConnector> getSysCAMSConnectors(){ + return syscamsConnectors; + } + + public LinkedList<ELNTConnector> getAllConnectorsBetweenELNModuleTerminal(){ + 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<SysCAMSTConnector> getAllConnectorsBetweenTDFModulePort(){ + LinkedList<SysCAMSTConnector> cons = new LinkedList<SysCAMSTConnector>(); + for (SysCAMSTConnector con : syscamsConnectors) { + if (con.get_p1().getComponent() instanceof SysCAMSTPortTDF && con.get_p2().getComponent() instanceof SysCAMSTPortTDF) { + cons.add(con); + } + } + return cons; } + public LinkedList<SysCAMSTConnector> getAllConnectorsBetweenDEModulePort(){ + LinkedList<SysCAMSTConnector> cons = new LinkedList<SysCAMSTConnector>(); + for (SysCAMSTConnector con : syscamsConnectors) { + if (con.get_p1().getComponent() instanceof SysCAMSTPortDE && con.get_p2().getComponent() instanceof SysCAMSTPortDE) { + cons.add(con); + } + } + return cons; + } + + public LinkedList<SysCAMSTPortDE> getAllPortDE(){ + LinkedList<SysCAMSTPortDE> portsDE = new LinkedList<SysCAMSTPortDE>(); + for (SysCAMSTComponent portDE : syscamsComponents) { + if (portDE instanceof SysCAMSTPortDE) { + portsDE.add((SysCAMSTPortDE) portDE); + } + } + return portsDE; + } + + public LinkedList<SysCAMSTPortTDF> getAllPortTDF(){ + LinkedList<SysCAMSTPortTDF> portsTDF = new LinkedList<SysCAMSTPortTDF>(); + for (SysCAMSTComponent portTDF : syscamsComponents) { + if (portTDF instanceof SysCAMSTPortTDF) { + portsTDF.add((SysCAMSTPortTDF) portTDF); + } + } + return portsTDF; + } + public LinkedList<ELNTComponentCapacitor> getAllComponentCapacitor(){ LinkedList<ELNTComponentCapacitor> capacitors = new LinkedList<ELNTComponentCapacitor>(); - for (ELNTComponent capacitor : components) { + for (ELNTComponent capacitor : elnComponents) { if (capacitor instanceof ELNTComponentCapacitor) { capacitors.add((ELNTComponentCapacitor) capacitor); } @@ -78,7 +141,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentCurrentSinkTDF> getAllComponentCurrentSinkTDF(){ LinkedList<ELNTComponentCurrentSinkTDF> TDF_isinks = new LinkedList<ELNTComponentCurrentSinkTDF>(); - for (ELNTComponent TDF_isink : components) { + for (ELNTComponent TDF_isink : elnComponents) { if (TDF_isink instanceof ELNTComponentCurrentSinkTDF) { TDF_isinks.add((ELNTComponentCurrentSinkTDF) TDF_isink); } @@ -88,7 +151,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentCurrentSourceTDF> getAllComponentCurrentSourceTDF(){ LinkedList<ELNTComponentCurrentSourceTDF> TDF_isources = new LinkedList<ELNTComponentCurrentSourceTDF>(); - for (ELNTComponent TDF_isource : components) { + for (ELNTComponent TDF_isource : elnComponents) { if (TDF_isource instanceof ELNTComponentCurrentSourceTDF) { TDF_isources.add((ELNTComponentCurrentSourceTDF) TDF_isource); } @@ -98,7 +161,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentIdealTransformer> getAllComponentIdealTransformer(){ LinkedList<ELNTComponentIdealTransformer> idealTransformers = new LinkedList<ELNTComponentIdealTransformer>(); - for (ELNTComponent idealTransformer : components) { + for (ELNTComponent idealTransformer : elnComponents) { if (idealTransformer instanceof ELNTComponentIdealTransformer) { idealTransformers.add((ELNTComponentIdealTransformer) idealTransformer); } @@ -108,7 +171,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentIndependentCurrentSource> getAllComponentIndependentCurrentSource(){ LinkedList<ELNTComponentIndependentCurrentSource> isources = new LinkedList<ELNTComponentIndependentCurrentSource>(); - for (ELNTComponent isource : components) { + for (ELNTComponent isource : elnComponents) { if (isource instanceof ELNTComponentIndependentCurrentSource) { isources.add((ELNTComponentIndependentCurrentSource) isource); } @@ -118,7 +181,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentIndependentVoltageSource> getAllComponentIndependentVoltageSource(){ LinkedList<ELNTComponentIndependentVoltageSource> vsources = new LinkedList<ELNTComponentIndependentVoltageSource>(); - for (ELNTComponent vsource : components) { + for (ELNTComponent vsource : elnComponents) { if (vsource instanceof ELNTComponentIndependentVoltageSource) { vsources.add((ELNTComponentIndependentVoltageSource) vsource); } @@ -128,7 +191,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentInductor> getAllComponentInductor(){ LinkedList<ELNTComponentInductor> inductors = new LinkedList<ELNTComponentInductor>(); - for (ELNTComponent inductor : components) { + for (ELNTComponent inductor : elnComponents) { if (inductor instanceof ELNTComponentInductor) { inductors.add((ELNTComponentInductor) inductor); } @@ -138,7 +201,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentNodeRef> getAllComponentNodeRef(){ LinkedList<ELNTComponentNodeRef> nodeRefs = new LinkedList<ELNTComponentNodeRef>(); - for (ELNTComponent nodeRef : components) { + for (ELNTComponent nodeRef : elnComponents) { if (nodeRef instanceof ELNTComponentNodeRef) { nodeRefs.add((ELNTComponentNodeRef) nodeRef); } @@ -148,7 +211,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentResistor> getAllComponentResistor(){ LinkedList<ELNTComponentResistor> resistors = new LinkedList<ELNTComponentResistor>(); - for (ELNTComponent resistor : components) { + for (ELNTComponent resistor : elnComponents) { if (resistor instanceof ELNTComponentResistor) { resistors.add((ELNTComponentResistor) resistor); } @@ -158,7 +221,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentTransmissionLine> getAllComponentTransmissionLine(){ LinkedList<ELNTComponentTransmissionLine> transmissionLines = new LinkedList<ELNTComponentTransmissionLine>(); - for (ELNTComponent transmissionLine : components) { + for (ELNTComponent transmissionLine : elnComponents) { if (transmissionLine instanceof ELNTComponentTransmissionLine) { transmissionLines.add((ELNTComponentTransmissionLine) transmissionLine); } @@ -168,7 +231,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentVoltageControlledCurrentSource> getAllComponentVoltageControlledCurrentSource(){ LinkedList<ELNTComponentVoltageControlledCurrentSource> vccss = new LinkedList<ELNTComponentVoltageControlledCurrentSource>(); - for (ELNTComponent vccs : components) { + for (ELNTComponent vccs : elnComponents) { if (vccs instanceof ELNTComponentVoltageControlledCurrentSource) { vccss.add((ELNTComponentVoltageControlledCurrentSource) vccs); } @@ -178,7 +241,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentVoltageControlledVoltageSource> getAllComponentVoltageControlledVoltageSource(){ LinkedList<ELNTComponentVoltageControlledVoltageSource> vcvss = new LinkedList<ELNTComponentVoltageControlledVoltageSource>(); - for (ELNTComponent vcvs : components) { + for (ELNTComponent vcvs : elnComponents) { if (vcvs instanceof ELNTComponentVoltageControlledVoltageSource) { vcvss.add((ELNTComponentVoltageControlledVoltageSource) vcvs); } @@ -188,7 +251,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentVoltageSinkTDF> getAllComponentVoltageSinkTDF(){ LinkedList<ELNTComponentVoltageSinkTDF> TDF_vsinks = new LinkedList<ELNTComponentVoltageSinkTDF>(); - for (ELNTComponent TDF_vsink : components) { + for (ELNTComponent TDF_vsink : elnComponents) { if (TDF_vsink instanceof ELNTComponentVoltageSinkTDF) { TDF_vsinks.add((ELNTComponentVoltageSinkTDF) TDF_vsink); } @@ -198,7 +261,7 @@ public class ELNSpecification{ public LinkedList<ELNTComponentVoltageSourceTDF> getAllComponentVoltageSourceTDF(){ LinkedList<ELNTComponentVoltageSourceTDF> TDF_vsources = new LinkedList<ELNTComponentVoltageSourceTDF>(); - for (ELNTComponent TDF_vsource : components) { + for (ELNTComponent TDF_vsource : elnComponents) { if (TDF_vsource instanceof ELNTComponentVoltageSourceTDF) { TDF_vsources.add((ELNTComponentVoltageSourceTDF) TDF_vsource); } @@ -208,7 +271,7 @@ public class ELNSpecification{ public LinkedList<ELNTMidPortTerminal> getAllMidPortTerminal(){ LinkedList<ELNTMidPortTerminal> midPortTerminals = new LinkedList<ELNTMidPortTerminal>(); - for (ELNTComponent midPortTerminal : components) { + for (ELNTComponent midPortTerminal : elnComponents) { if (midPortTerminal instanceof ELNTMidPortTerminal) { midPortTerminals.add((ELNTMidPortTerminal) midPortTerminal); } @@ -218,7 +281,7 @@ public class ELNSpecification{ public LinkedList<ELNTModule> getAllModule(){ LinkedList<ELNTModule> modules = new LinkedList<ELNTModule>(); - for (ELNTComponent module : components) { + for (ELNTComponent module : elnComponents) { if (module instanceof ELNTModule) { modules.add((ELNTModule) module); } @@ -228,7 +291,7 @@ public class ELNSpecification{ public LinkedList<ELNTModuleTerminal> getAllModuleTerminal(){ LinkedList<ELNTModuleTerminal> moduleTerminals = new LinkedList<ELNTModuleTerminal>(); - for (ELNTComponent moduleTerminal : components) { + for (ELNTComponent moduleTerminal : elnComponents) { if (moduleTerminal instanceof ELNTModuleTerminal) { moduleTerminals.add((ELNTModuleTerminal) moduleTerminal); } @@ -236,6 +299,14 @@ public class ELNSpecification{ return moduleTerminals; } + public int getNbPortDE(){ + return (getAllPortDE()).size(); + } + + public int getNbPortTDf(){ + return (getAllPortTDF()).size(); + } + public int getNbComponentCapacitor(){ return (getAllComponentCapacitor()).size(); } diff --git a/src/main/java/elntranslator/ELNTCluster.java b/src/main/java/elntranslator/ELNTCluster.java new file mode 100644 index 0000000000000000000000000000000000000000..b60dd0609fa6df5d0f59dc6e5509b3d29a5f859c --- /dev/null +++ b/src/main/java/elntranslator/ELNTCluster.java @@ -0,0 +1,93 @@ +/* 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 elntranslator; + +import java.util.LinkedList; +import syscamstranslator.*; + +/** + * Class ELNTCluster + * Parameters of a ELN component : cluster + * Creation: 30/07/2018 + * @version 1.0 30/07/2018 + * @author Irina Kit Yan LEE +*/ + +public class ELNTCluster extends ELNTComponent { + private String name; + + private LinkedList<SysCAMSTPortDE> portDE; + private LinkedList<SysCAMSTPortTDF> portTDF; + private LinkedList<ELNTModule> module; + + public ELNTCluster(String _name) { + name = _name; + portDE = new LinkedList<SysCAMSTPortDE>(); + portTDF = new LinkedList<SysCAMSTPortTDF>(); + module = new LinkedList<ELNTModule>(); + } + + public String getName() { + return name; + } + + public LinkedList<SysCAMSTPortDE> getPortDE() { + return portDE; + } + + public void addPortDE(SysCAMSTPortDE _portDE){ + portDE.add(_portDE); + } + + public LinkedList<SysCAMSTPortTDF> getPortTDF() { + return portTDF; + } + + public void addPortTDF(SysCAMSTPortTDF _portTDF){ + portTDF.add(_portTDF); + } + + public LinkedList<ELNTModule> getModule() { + return module; + } + + public void addModule(ELNTModule _module){ + module.add(_module); + } +} \ No newline at end of file diff --git a/src/main/java/elntranslator/ELNTModule.java b/src/main/java/elntranslator/ELNTModule.java index b345c68ef8d0c9ab5049c8607568a51a356baa2a..6a5784cda46f0b6389ffb3a6ba8a6d5cc8e350af 100644 --- a/src/main/java/elntranslator/ELNTModule.java +++ b/src/main/java/elntranslator/ELNTModule.java @@ -39,6 +39,7 @@ package elntranslator; import java.util.LinkedList; +import syscamstranslator.*; /** * Class ELNTModule @@ -66,8 +67,12 @@ public class ELNTModule extends ELNTComponent { private LinkedList<ELNTComponentVoltageSinkTDF> TDF_vsink; private LinkedList<ELNTComponentVoltageSourceTDF> TDF_vsource; private LinkedList<ELNTModuleTerminal> moduleTerminal; + private LinkedList<SysCAMSTPortDE> portDE; + private LinkedList<SysCAMSTPortTDF> portTDF; - public ELNTModule(String _name) { + private ELNTCluster cluster; + + public ELNTModule(String _name, ELNTCluster _cluster) { name = _name; capacitor = new LinkedList<ELNTComponentCapacitor>(); idealTransformer = new LinkedList<ELNTComponentIdealTransformer>(); @@ -84,6 +89,9 @@ public class ELNTModule extends ELNTComponent { TDF_vsink = new LinkedList<ELNTComponentVoltageSinkTDF>(); TDF_vsource = new LinkedList<ELNTComponentVoltageSourceTDF>(); moduleTerminal = new LinkedList<ELNTModuleTerminal>(); + portDE = new LinkedList<SysCAMSTPortDE>(); + portTDF = new LinkedList<SysCAMSTPortTDF>(); + cluster = _cluster; } public String getName() { @@ -209,4 +217,24 @@ public class ELNTModule extends ELNTComponent { public void addModuleTerminal(ELNTModuleTerminal _moduleTerminal){ moduleTerminal.add(_moduleTerminal); } + + public LinkedList<SysCAMSTPortDE> getPortDE() { + return portDE; + } + + public void addPortDE(SysCAMSTPortDE _portDE){ + portDE.add(_portDE); + } + + public LinkedList<SysCAMSTPortTDF> getPortTDF() { + return portTDF; + } + + public void addPortTDF(SysCAMSTPortTDF _portTDF){ + portTDF.add(_portTDF); + } + + public ELNTCluster getCluster() { + return cluster; + } } \ No newline at end of file diff --git a/src/main/java/syscamstranslator/SysCAMSTPortDE.java b/src/main/java/syscamstranslator/SysCAMSTPortDE.java index 3ef0d4c8adc383253d7dc3168419cd8aa2055f9e..961db9e4e08a851feb59bb8e1ac5cc10ec3eba2e 100644 --- a/src/main/java/syscamstranslator/SysCAMSTPortDE.java +++ b/src/main/java/syscamstranslator/SysCAMSTPortDE.java @@ -38,6 +38,8 @@ package syscamstranslator; +import elntranslator.*; + /** * Class SysCAMSTPortDE * Parameters of a SystemC-AMS port DE @@ -60,6 +62,8 @@ public class SysCAMSTPortDE extends SysCAMSTComponent { private SysCAMSTBlockDE blockDE; private SysCAMSTBlockGPIO2VCI blockGPIO2VCI; + private ELNTCluster cluster; + private ELNTModule module; public SysCAMSTPortDE(String _name, int _origin, String _DEType, boolean _sensitive, String _sensitiveMethod, SysCAMSTBlockDE _blockDE) { name = _name; @@ -86,7 +90,33 @@ public class SysCAMSTPortDE extends SysCAMSTComponent { sensitiveMethod = _sensitiveMethod; blockGPIO2VCI = _blockGPIO2VCI; } + + public SysCAMSTPortDE(String _name, int _origin, String _DEType, boolean _sensitive, String _sensitiveMethod, ELNTCluster _cluster) { + name = _name; +// period = _period; +// time = _time; +// rate = _rate; +// delay = _delay;ELNTCluster + origin = _origin; + DEType = _DEType; + sensitive = _sensitive; + sensitiveMethod = _sensitiveMethod; + cluster = _cluster; + } + public SysCAMSTPortDE(String _name, int _origin, String _DEType, boolean _sensitive, String _sensitiveMethod, ELNTModule _module) { + name = _name; +// period = _period; +// time = _time; +// rate = _rate; +// delay = _delay;ELNTCluster + origin = _origin; + DEType = _DEType; + sensitive = _sensitive; + sensitiveMethod = _sensitiveMethod; + module = _module; + } + public String getName() { return name; } @@ -130,4 +160,12 @@ public class SysCAMSTPortDE extends SysCAMSTComponent { public SysCAMSTBlockGPIO2VCI getBlockGPIO2VCI() { return blockGPIO2VCI; } + + public ELNTCluster getCluster() { + return cluster; + } + + public ELNTModule getModule() { + return module; + } } \ No newline at end of file diff --git a/src/main/java/syscamstranslator/SysCAMSTPortTDF.java b/src/main/java/syscamstranslator/SysCAMSTPortTDF.java index 0fda4978c0be416f5abeec938345d18d9c6404e2..68d6e630ac3a5c49eaa2643f886c26852f0b19e4 100644 --- a/src/main/java/syscamstranslator/SysCAMSTPortTDF.java +++ b/src/main/java/syscamstranslator/SysCAMSTPortTDF.java @@ -38,6 +38,9 @@ package syscamstranslator; +import elntranslator.ELNTCluster; +import elntranslator.ELNTModule; + /** * Class SysCAMSTPortTDF * Parameters of a SystemC-AMS port TDF @@ -57,6 +60,8 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent { private String TDFType; private SysCAMSTBlockTDF blockTDF; + private ELNTCluster cluster; + private ELNTModule module; public SysCAMSTPortTDF(String _name, int _period, String _time, int _rate, int _delay, int _origin, String _TDFType, SysCAMSTBlockTDF _blockTDF) { name = _name; @@ -68,6 +73,28 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent { TDFType = _TDFType; blockTDF = _blockTDF; } + + public SysCAMSTPortTDF(String _name, int _period, String _time, int _rate, int _delay, int _origin, String _TDFType, ELNTCluster _cluster) { + name = _name; + period = _period; + time = _time; + rate = _rate; + delay = _delay; + origin = _origin; + TDFType = _TDFType; + cluster = _cluster; + } + + public SysCAMSTPortTDF(String _name, int _period, String _time, int _rate, int _delay, int _origin, String _TDFType, ELNTModule _module) { + name = _name; + period = _period; + time = _time; + rate = _rate; + delay = _delay; + origin = _origin; + TDFType = _TDFType; + module = _module; + } public String getName() { return name; @@ -100,4 +127,12 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent { public SysCAMSTBlockTDF getBlockTDF() { return blockTDF; } -} + + public ELNTCluster getCluster() { + return cluster; + } + + public ELNTModule getModule() { + return module; + } +} \ No newline at end of file diff --git a/src/main/java/ui/ELNPanelTranslator.java b/src/main/java/ui/ELNPanelTranslator.java index 451f67658ab263b6bf75bfdf88c0104437042d1b..1146e1540bb6370f685e5ae7277e348f9c84c80a 100644 --- a/src/main/java/ui/ELNPanelTranslator.java +++ b/src/main/java/ui/ELNPanelTranslator.java @@ -41,8 +41,10 @@ package ui; import ui.eln.*; import ui.eln.sca_eln.*; import ui.eln.sca_eln_sca_tdf.*; +import ui.syscams.*; import java.util.*; import elntranslator.*; +import syscamstranslator.*; /** * Class ELNPanelTranslator @@ -56,12 +58,16 @@ public class ELNPanelTranslator { private List<TGComponent> tgcComponents; private List<ELNTComponent> elnComponents; private List<ELNTConnector> elnConnectors; + private List<SysCAMSTComponent> syscamsComponents; + private List<SysCAMSTConnector> syscamsConnectors; public ELNPanelTranslator(ELNDiagramPanel _elnDiagramPanel) { tgcComponents = _elnDiagramPanel.getComponentList(); elnComponents = new LinkedList<ELNTComponent>(); elnConnectors = new LinkedList<ELNTConnector>(); + syscamsComponents = new LinkedList<SysCAMSTComponent>(); + syscamsConnectors = new LinkedList<SysCAMSTConnector>(); MakeListOfComponent(_elnDiagramPanel); } @@ -69,6 +75,7 @@ public class ELNPanelTranslator { private void MakeListOfComponent(ELNDiagramPanel elnDiagramPanel) { Map<TGComponent, ELNTComponent> elnMap = new HashMap<TGComponent, ELNTComponent>(); + Map<TGComponent, SysCAMSTComponent> syscamsMap = new HashMap<TGComponent, SysCAMSTComponent>(); TGComponent tgc; Iterator<TGComponent> iterator1 = tgcComponents.listIterator(); @@ -90,251 +97,331 @@ public class ELNPanelTranslator { } for (TGComponent dp : list) { - if (dp instanceof ELNModule) { - ELNModule module = (ELNModule) dp; - - String moduleName = module.getValue(); + if (dp instanceof ELNCluster) { + ELNCluster cluster = (ELNCluster) dp; - ELNTModule elnModule = new ELNTModule(moduleName); - - List<ELNComponentCapacitor> capacitors = module.getAllComponentCapacitor(); - for (int i = 0; i < capacitors.size(); i++) { - ELNComponentCapacitor capacitor = capacitors.get(i); - - String name = capacitor.getValue(); - double val = capacitor.getVal(); - double q0 = capacitor.getQ0(); - String unit0 = capacitor.getUnit0(); - String unit1 = capacitor.getUnit1(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) capacitor.connectingPoint; - - ELNTComponentCapacitor elnCapacitor = new ELNTComponentCapacitor(name, val, q0, unit0, unit1, cp, elnModule); - - elnMap.put(capacitor, elnCapacitor); - elnModule.addCapacitor(elnCapacitor); - elnComponents.add(elnCapacitor); - } - List<ELNComponentCurrentSinkTDF> TDF_isinks = module.getAllComponentCurrentSinkTDF(); - for (int i = 0; i < TDF_isinks.size(); i++) { - ELNComponentCurrentSinkTDF TDF_isink = TDF_isinks.get(i); - - String name = TDF_isink.getValue(); - double scale = TDF_isink.getScale(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_isink.connectingPoint; - - ELNTComponentCurrentSinkTDF elnTDF_isink = new ELNTComponentCurrentSinkTDF(name, scale, cp, elnModule); - - elnMap.put(TDF_isink, elnTDF_isink); - elnModule.addTDF_isink(elnTDF_isink); - elnComponents.add(elnTDF_isink); - } - List<ELNComponentCurrentSourceTDF> TDF_isources = module.getAllComponentCurrentSourceTDF(); - for (int i = 0; i < TDF_isources.size(); i++) { - ELNComponentCurrentSourceTDF TDF_isource = TDF_isources.get(i); - - String name = TDF_isource.getValue(); - double scale = TDF_isource.getScale(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_isource.connectingPoint; - - ELNTComponentCurrentSourceTDF elnTDF_isource = new ELNTComponentCurrentSourceTDF(name, scale, cp, elnModule); - - elnMap.put(TDF_isource, elnTDF_isource); - elnModule.addTDF_isource(elnTDF_isource); - elnComponents.add(elnTDF_isource); - } - List<ELNComponentIdealTransformer> idealTransformers = module.getAllComponentIdealTransformer(); - for (int i = 0; i < idealTransformers.size(); i++) { - ELNComponentIdealTransformer idealTransformer = idealTransformers.get(i); - - String name = idealTransformer.getValue(); - double ratio = idealTransformer.getRatio(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) idealTransformer.connectingPoint; - - ELNTComponentIdealTransformer elnIdealTransformer = new ELNTComponentIdealTransformer(name, ratio, cp, elnModule); - - elnMap.put(idealTransformer, elnIdealTransformer); - elnModule.addIdealTransformer(elnIdealTransformer); - elnComponents.add(elnIdealTransformer); - } - List<ELNComponentIndependentCurrentSource> isources = module.getAllComponentIndependentCurrentSource(); - for (int i = 0; i < isources.size(); i++) { - ELNComponentIndependentCurrentSource isource = isources.get(i); - - String name = isource.getValue(); - double initValue = isource.getInitValue(); - double offset = isource.getOffset(); - double amplitude = isource.getAmplitude(); - double frequency = isource.getFrequency(); - double phase = isource.getPhase(); - double acAmplitude = isource.getAcAmplitude(); - double acPhase = isource.getAcPhase(); - double acNoiseAmpliture = isource.getAcNoiseAmplitude(); - String delay = isource.getDelay(); - String unit0 = isource.getUnit0(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) isource.connectingPoint; - - ELNTComponentIndependentCurrentSource elnISource = new ELNTComponentIndependentCurrentSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, cp, elnModule); - - elnMap.put(isource, elnISource); - elnModule.addIsource(elnISource); - elnComponents.add(elnISource); - } - List<ELNComponentIndependentVoltageSource> vsources = module.getAllComponentIndependentVoltageSource(); - for (int i = 0; i < vsources.size(); i++) { - ELNComponentIndependentVoltageSource vsource = vsources.get(i); - - String name = vsource.getValue(); - double initValue = vsource.getInitValue(); - double offset = vsource.getOffset(); - double amplitude = vsource.getAmplitude(); - double frequency = vsource.getFrequency(); - double phase = vsource.getPhase(); - double acAmplitude = vsource.getAcAmplitude(); - double acPhase = vsource.getAcPhase(); - double acNoiseAmpliture = vsource.getAcNoiseAmplitude(); - String delay = vsource.getDelay(); - String unit0 = vsource.getUnit0(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vsource.connectingPoint; - - ELNTComponentIndependentVoltageSource elnVSource = new ELNTComponentIndependentVoltageSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, cp, elnModule); - - elnMap.put(vsource, elnVSource); - elnModule.addVsource(elnVSource); - elnComponents.add(elnVSource); - } - List<ELNComponentInductor> inductors = module.getAllComponentInductor(); - for (int i = 0; i < inductors.size(); i++) { - ELNComponentInductor inductor = inductors.get(i); - - String name = inductor.getValue(); - double val = inductor.getVal(); - double phi0 = inductor.getPhi0(); - String unit0 = inductor.getUnit0(); - String unit1 = inductor.getUnit1(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) inductor.connectingPoint; - - ELNTComponentInductor elnInductor = new ELNTComponentInductor(name, val, phi0, unit0, unit1, cp, elnModule); - - elnMap.put(inductor, elnInductor); - elnModule.addInductor(elnInductor); - elnComponents.add(elnInductor); - } - List<ELNComponentNodeRef> nodeRefs = module.getAllComponentNodeRef(); - for (int i = 0; i < nodeRefs.size(); i++) { - ELNComponentNodeRef nodeRef = nodeRefs.get(i); - - String name = nodeRef.getValue(); - - ELNTComponentNodeRef elnNodeRef = new ELNTComponentNodeRef(name, elnModule); - - elnMap.put(nodeRef, elnNodeRef); - elnModule.addNodeRef(elnNodeRef); - elnComponents.add(elnNodeRef); - } - List<ELNComponentResistor> resistors = module.getAllComponentResistor(); - for (int i = 0; i < resistors.size(); i++) { - ELNComponentResistor resistor = resistors.get(i); + String clusterName = cluster.getValue(); + + ELNTCluster elnCluster = new ELNTCluster(clusterName); + + List<SysCAMSPortDE> portsDE = cluster.getAllPortDE(); + for (int i = 0; i < portsDE.size(); i++) { + SysCAMSPortDE portDE = portsDE.get(i); - String name = resistor.getValue(); - double val = resistor.getVal(); - String unit = resistor.getUnit(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) resistor.connectingPoint; + String portName = portDE.getPortName(); + String type = portDE.getDEType(); + int origin = portDE.getOrigin(); + boolean sensitive = portDE.getSensitive(); + String sensitiveMethod = portDE.getSensitiveMethod(); - ELNTComponentResistor elnResistor = new ELNTComponentResistor(name, val, unit, cp, elnModule); + SysCAMSTPortDE syscamsPortDE = new SysCAMSTPortDE(portName, origin, type, sensitive, sensitiveMethod, elnCluster); - elnMap.put(resistor, elnResistor); - elnModule.addResistor(elnResistor); - elnComponents.add(elnResistor); + syscamsMap.put(portDE, syscamsPortDE); + elnCluster.addPortDE(syscamsPortDE); + syscamsComponents.add(syscamsPortDE); } - List<ELNComponentTransmissionLine> transmissionLines = module.getAllComponentTransmissionLine(); - for (int i = 0; i < transmissionLines.size(); i++) { - ELNComponentTransmissionLine transmissionLine = transmissionLines.get(i); - - String name = transmissionLine.getValue(); - double z0 = transmissionLine.getZ0(); - double delta0 = transmissionLine.getDelta0(); - String delay = transmissionLine.getDelay(); - String unit0 = transmissionLine.getUnit0(); - String unit2 = transmissionLine.getUnit2(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) transmissionLine.connectingPoint; - - ELNTComponentTransmissionLine elnTransmissionLine = new ELNTComponentTransmissionLine(name, z0, delta0, delay, unit0, unit2, cp, elnModule); - - elnMap.put(transmissionLine, elnTransmissionLine); - elnModule.addTransmissionLine(elnTransmissionLine); - elnComponents.add(elnTransmissionLine); + List<SysCAMSPortTDF> portsTDF = cluster.getAllPortTDF(); + for (int i = 0; i < portsTDF.size(); i++) { + SysCAMSPortTDF portTDF = portsTDF.get(i); + + String portName = portTDF.getPortName(); + int periodPort = portTDF.getPeriod(); + String time = portTDF.getTime(); + int rate = portTDF.getRate(); + int delay = portTDF.getDelay(); + String type = portTDF.getTDFType(); + int origin = portTDF.getOrigin(); + + SysCAMSTPortTDF syscamsPortTDF = new SysCAMSTPortTDF(portName, periodPort, time, rate, delay, origin, type, elnCluster); + + syscamsMap.put(portTDF, syscamsPortTDF); + elnCluster.addPortTDF(syscamsPortTDF); + syscamsComponents.add(syscamsPortTDF); } - List<ELNComponentVoltageControlledCurrentSource> vccss = module.getAllComponentVoltageControlledCurrentSource(); - for (int i = 0; i < vccss.size(); i++) { - ELNComponentVoltageControlledCurrentSource vccs = vccss.get(i); - - String name = vccs.getValue(); - double val = vccs.getVal(); - String unit = vccs.getUnit(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vccs.connectingPoint; + List<ELNModule> modules = cluster.getAllModule(); + for (int i = 0; i < modules.size(); i++) { + ELNModule module = modules.get(i); - ELNTComponentVoltageControlledCurrentSource elnVCCS = new ELNTComponentVoltageControlledCurrentSource(name, val, unit, cp, elnModule); - - elnMap.put(vccs, elnVCCS); - elnModule.addVccs(elnVCCS); - elnComponents.add(elnVCCS); - } - List<ELNComponentVoltageControlledVoltageSource> vcvss = module.getAllComponentVoltageControlledVoltageSource(); - for (int i = 0; i < vcvss.size(); i++) { - ELNComponentVoltageControlledVoltageSource vcvs = vcvss.get(i); - - String name = vcvs.getValue(); - double val = vcvs.getVal(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vcvs.connectingPoint; - - ELNTComponentVoltageControlledVoltageSource elnVCVS = new ELNTComponentVoltageControlledVoltageSource(name, val, cp, elnModule); - - elnMap.put(vcvs, elnVCVS); - elnModule.addVcvs(elnVCVS); - elnComponents.add(elnVCVS); + String moduleName = module.getValue(); + + ELNTModule elnModule = new ELNTModule(moduleName, elnCluster); + + List<ELNComponentCapacitor> capacitors = module.getAllComponentCapacitor(); + for (int j = 0; j < capacitors.size(); j++) { + ELNComponentCapacitor capacitor = capacitors.get(i); + + String name = capacitor.getValue(); + double val = capacitor.getVal(); + double q0 = capacitor.getQ0(); + String unit0 = capacitor.getUnit0(); + String unit1 = capacitor.getUnit1(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) capacitor.connectingPoint; + + ELNTComponentCapacitor elnCapacitor = new ELNTComponentCapacitor(name, val, q0, unit0, unit1, cp, elnModule); + + elnMap.put(capacitor, elnCapacitor); + elnModule.addCapacitor(elnCapacitor); + elnComponents.add(elnCapacitor); + } + List<ELNComponentCurrentSinkTDF> TDF_isinks = module.getAllComponentCurrentSinkTDF(); + for (int j = 0; j < TDF_isinks.size(); j++) { + ELNComponentCurrentSinkTDF TDF_isink = TDF_isinks.get(i); + + String name = TDF_isink.getValue(); + double scale = TDF_isink.getScale(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_isink.connectingPoint; + + ELNTComponentCurrentSinkTDF elnTDF_isink = new ELNTComponentCurrentSinkTDF(name, scale, cp, elnModule); + + elnMap.put(TDF_isink, elnTDF_isink); + elnModule.addTDF_isink(elnTDF_isink); + elnComponents.add(elnTDF_isink); + } + List<ELNComponentCurrentSourceTDF> TDF_isources = module.getAllComponentCurrentSourceTDF(); + for (int j = 0; j < TDF_isources.size(); j++) { + ELNComponentCurrentSourceTDF TDF_isource = TDF_isources.get(i); + + String name = TDF_isource.getValue(); + double scale = TDF_isource.getScale(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_isource.connectingPoint; + + ELNTComponentCurrentSourceTDF elnTDF_isource = new ELNTComponentCurrentSourceTDF(name, scale, cp, elnModule); + + elnMap.put(TDF_isource, elnTDF_isource); + elnModule.addTDF_isource(elnTDF_isource); + elnComponents.add(elnTDF_isource); + } + List<ELNComponentIdealTransformer> idealTransformers = module.getAllComponentIdealTransformer(); + for (int j = 0; j < idealTransformers.size(); j++) { + ELNComponentIdealTransformer idealTransformer = idealTransformers.get(i); + + String name = idealTransformer.getValue(); + double ratio = idealTransformer.getRatio(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) idealTransformer.connectingPoint; + + ELNTComponentIdealTransformer elnIdealTransformer = new ELNTComponentIdealTransformer(name, ratio, cp, elnModule); + + elnMap.put(idealTransformer, elnIdealTransformer); + elnModule.addIdealTransformer(elnIdealTransformer); + elnComponents.add(elnIdealTransformer); + } + List<ELNComponentIndependentCurrentSource> isources = module.getAllComponentIndependentCurrentSource(); + for (int j = 0; j < isources.size(); j++) { + ELNComponentIndependentCurrentSource isource = isources.get(i); + + String name = isource.getValue(); + double initValue = isource.getInitValue(); + double offset = isource.getOffset(); + double amplitude = isource.getAmplitude(); + double frequency = isource.getFrequency(); + double phase = isource.getPhase(); + double acAmplitude = isource.getAcAmplitude(); + double acPhase = isource.getAcPhase(); + double acNoiseAmpliture = isource.getAcNoiseAmplitude(); + String delay = isource.getDelay(); + String unit0 = isource.getUnit0(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) isource.connectingPoint; + + ELNTComponentIndependentCurrentSource elnISource = new ELNTComponentIndependentCurrentSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, cp, elnModule); + + elnMap.put(isource, elnISource); + elnModule.addIsource(elnISource); + elnComponents.add(elnISource); + } + List<ELNComponentIndependentVoltageSource> vsources = module.getAllComponentIndependentVoltageSource(); + for (int j = 0; j < vsources.size(); j++) { + ELNComponentIndependentVoltageSource vsource = vsources.get(i); + + String name = vsource.getValue(); + double initValue = vsource.getInitValue(); + double offset = vsource.getOffset(); + double amplitude = vsource.getAmplitude(); + double frequency = vsource.getFrequency(); + double phase = vsource.getPhase(); + double acAmplitude = vsource.getAcAmplitude(); + double acPhase = vsource.getAcPhase(); + double acNoiseAmpliture = vsource.getAcNoiseAmplitude(); + String delay = vsource.getDelay(); + String unit0 = vsource.getUnit0(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vsource.connectingPoint; + + ELNTComponentIndependentVoltageSource elnVSource = new ELNTComponentIndependentVoltageSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, cp, elnModule); + + elnMap.put(vsource, elnVSource); + elnModule.addVsource(elnVSource); + elnComponents.add(elnVSource); + } + List<ELNComponentInductor> inductors = module.getAllComponentInductor(); + for (int j = 0; j < inductors.size(); j++) { + ELNComponentInductor inductor = inductors.get(i); + + String name = inductor.getValue(); + double val = inductor.getVal(); + double phi0 = inductor.getPhi0(); + String unit0 = inductor.getUnit0(); + String unit1 = inductor.getUnit1(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) inductor.connectingPoint; + + ELNTComponentInductor elnInductor = new ELNTComponentInductor(name, val, phi0, unit0, unit1, cp, elnModule); + + elnMap.put(inductor, elnInductor); + elnModule.addInductor(elnInductor); + elnComponents.add(elnInductor); + } + List<ELNComponentNodeRef> nodeRefs = module.getAllComponentNodeRef(); + for (int j = 0; j < nodeRefs.size(); j++) { + ELNComponentNodeRef nodeRef = nodeRefs.get(i); + + String name = nodeRef.getValue(); + + ELNTComponentNodeRef elnNodeRef = new ELNTComponentNodeRef(name, elnModule); + + elnMap.put(nodeRef, elnNodeRef); + elnModule.addNodeRef(elnNodeRef); + elnComponents.add(elnNodeRef); + } + List<ELNComponentResistor> resistors = module.getAllComponentResistor(); + for (int j = 0; j < resistors.size(); j++) { + ELNComponentResistor resistor = resistors.get(i); + + String name = resistor.getValue(); + double val = resistor.getVal(); + String unit = resistor.getUnit(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) resistor.connectingPoint; + + ELNTComponentResistor elnResistor = new ELNTComponentResistor(name, val, unit, cp, elnModule); + + elnMap.put(resistor, elnResistor); + elnModule.addResistor(elnResistor); + elnComponents.add(elnResistor); + } + List<ELNComponentTransmissionLine> transmissionLines = module.getAllComponentTransmissionLine(); + for (int j = 0; j < transmissionLines.size(); j++) { + ELNComponentTransmissionLine transmissionLine = transmissionLines.get(i); + + String name = transmissionLine.getValue(); + double z0 = transmissionLine.getZ0(); + double delta0 = transmissionLine.getDelta0(); + String delay = transmissionLine.getDelay(); + String unit0 = transmissionLine.getUnit0(); + String unit2 = transmissionLine.getUnit2(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) transmissionLine.connectingPoint; + + ELNTComponentTransmissionLine elnTransmissionLine = new ELNTComponentTransmissionLine(name, z0, delta0, delay, unit0, unit2, cp, elnModule); + + elnMap.put(transmissionLine, elnTransmissionLine); + elnModule.addTransmissionLine(elnTransmissionLine); + elnComponents.add(elnTransmissionLine); + } + List<ELNComponentVoltageControlledCurrentSource> vccss = module.getAllComponentVoltageControlledCurrentSource(); + for (int j = 0; j < vccss.size(); j++) { + ELNComponentVoltageControlledCurrentSource vccs = vccss.get(i); + + String name = vccs.getValue(); + double val = vccs.getVal(); + String unit = vccs.getUnit(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vccs.connectingPoint; + + ELNTComponentVoltageControlledCurrentSource elnVCCS = new ELNTComponentVoltageControlledCurrentSource(name, val, unit, cp, elnModule); + + elnMap.put(vccs, elnVCCS); + elnModule.addVccs(elnVCCS); + elnComponents.add(elnVCCS); + } + List<ELNComponentVoltageControlledVoltageSource> vcvss = module.getAllComponentVoltageControlledVoltageSource(); + for (int j = 0; j < vcvss.size(); j++) { + ELNComponentVoltageControlledVoltageSource vcvs = vcvss.get(i); + + String name = vcvs.getValue(); + double val = vcvs.getVal(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vcvs.connectingPoint; + + ELNTComponentVoltageControlledVoltageSource elnVCVS = new ELNTComponentVoltageControlledVoltageSource(name, val, cp, elnModule); + + elnMap.put(vcvs, elnVCVS); + elnModule.addVcvs(elnVCVS); + elnComponents.add(elnVCVS); + } + List<ELNComponentVoltageSinkTDF> TDF_vsinks = module.getAllComponentVoltageSinkTDF(); + for (int j = 0; j < TDF_vsinks.size(); j++) { + ELNComponentVoltageSinkTDF TDF_vsink = TDF_vsinks.get(i); + + String name = TDF_vsink.getValue(); + double scale = TDF_vsink.getScale(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_vsink.connectingPoint; + + ELNTComponentVoltageSinkTDF elnTDF_vsink = new ELNTComponentVoltageSinkTDF(name, scale, cp, elnModule); + + elnMap.put(TDF_vsink, elnTDF_vsink); + elnModule.addTDF_vsink(elnTDF_vsink); + elnComponents.add(elnTDF_vsink); + } + List<ELNComponentVoltageSourceTDF> TDF_vsources = module.getAllComponentVoltageSourceTDF(); + for (int j = 0; j < TDF_vsources.size(); j++) { + ELNComponentVoltageSourceTDF TDF_vsource = TDF_vsources.get(i); + + String name = TDF_vsource.getValue(); + double scale = TDF_vsource.getScale(); + ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_vsource.connectingPoint; + + ELNTComponentVoltageSourceTDF elnTDF_vsource = new ELNTComponentVoltageSourceTDF(name, scale, cp, elnModule); + + elnMap.put(TDF_vsource, elnTDF_vsource); + elnModule.addTDF_vsource(elnTDF_vsource); + elnComponents.add(elnTDF_vsource); + } + List<ELNModuleTerminal> moduleTerminals = module.getAllModuleTerminal(); + for (int j = 0; j < moduleTerminals.size(); j++) { + ELNModuleTerminal moduleTerminal = moduleTerminals.get(i); + + String name = moduleTerminal.getValue(); + + ELNTModuleTerminal elnModuleTerminal = new ELNTModuleTerminal(name, elnModule); + + elnMap.put(moduleTerminal, elnModuleTerminal); + elnModule.addModuleTerminal(elnModuleTerminal); + elnComponents.add(elnModuleTerminal); + } + List<SysCAMSPortDE> portsDEModule = module.getAllPortDE(); + for (int j = 0; j < portsDEModule.size(); j++) { + SysCAMSPortDE portDE = portsDEModule.get(i); + + String portName = portDE.getPortName(); + String type = portDE.getDEType(); + int origin = portDE.getOrigin(); + boolean sensitive = portDE.getSensitive(); + String sensitiveMethod = portDE.getSensitiveMethod(); + + SysCAMSTPortDE syscamsPortDE = new SysCAMSTPortDE(portName, origin, type, sensitive, sensitiveMethod, elnModule); + + syscamsMap.put(portDE, syscamsPortDE); + elnModule.addPortDE(syscamsPortDE); + syscamsComponents.add(syscamsPortDE); + } + List<SysCAMSPortTDF> portsTDFModule = module.getAllPortTDF(); + for (int j = 0; j < portsTDFModule.size(); j++) { + SysCAMSPortTDF portTDF = portsTDFModule.get(i); + + String portName = portTDF.getPortName(); + int periodPort = portTDF.getPeriod(); + String time = portTDF.getTime(); + int rate = portTDF.getRate(); + int delay = portTDF.getDelay(); + String type = portTDF.getTDFType(); + int origin = portTDF.getOrigin(); + + SysCAMSTPortTDF syscamsPortTDF = new SysCAMSTPortTDF(portName, periodPort, time, rate, delay, origin, type, elnModule); + + syscamsMap.put(portTDF, syscamsPortTDF); + elnModule.addPortTDF(syscamsPortTDF); + syscamsComponents.add(syscamsPortTDF); + } + elnMap.put(module, elnModule); + elnCluster.addModule(elnModule); + elnComponents.add(elnModule); } - List<ELNComponentVoltageSinkTDF> TDF_vsinks = module.getAllComponentVoltageSinkTDF(); - for (int i = 0; i < TDF_vsinks.size(); i++) { - ELNComponentVoltageSinkTDF TDF_vsink = TDF_vsinks.get(i); - - String name = TDF_vsink.getValue(); - double scale = TDF_vsink.getScale(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_vsink.connectingPoint; - - ELNTComponentVoltageSinkTDF elnTDF_vsink = new ELNTComponentVoltageSinkTDF(name, scale, cp, elnModule); - - elnMap.put(TDF_vsink, elnTDF_vsink); - elnModule.addTDF_vsink(elnTDF_vsink); - elnComponents.add(elnTDF_vsink); - } - List<ELNComponentVoltageSourceTDF> TDF_vsources = module.getAllComponentVoltageSourceTDF(); - for (int i = 0; i < TDF_vsources.size(); i++) { - ELNComponentVoltageSourceTDF TDF_vsource = TDF_vsources.get(i); - - String name = TDF_vsource.getValue(); - double scale = TDF_vsource.getScale(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_vsource.connectingPoint; - - ELNTComponentVoltageSourceTDF elnTDF_vsource = new ELNTComponentVoltageSourceTDF(name, scale, cp, elnModule); - - elnMap.put(TDF_vsource, elnTDF_vsource); - elnModule.addTDF_vsource(elnTDF_vsource); - elnComponents.add(elnTDF_vsource); - } - List<ELNModuleTerminal> moduleTerminals = module.getAllModuleTerminal(); - for (int i = 0; i < moduleTerminals.size(); i++) { - ELNModuleTerminal moduleTerminal = moduleTerminals.get(i); - - String name = moduleTerminal.getValue(); - - ELNTModuleTerminal elnModuleTerminal = new ELNTModuleTerminal(name, elnModule); - - elnMap.put(moduleTerminal, elnModuleTerminal); - elnModule.addModuleTerminal(elnModuleTerminal); - elnComponents.add(elnModuleTerminal); - } - elnMap.put(module, elnModule); - elnComponents.add(elnModule); + elnMap.put(cluster, elnCluster); + elnComponents.add(elnCluster); } else if (dp instanceof ELNConnector) { ELNConnector connector = (ELNConnector) dp; @@ -369,11 +456,30 @@ public class ELNPanelTranslator { } elnConnectors.add(avconnector); + } else if (dp instanceof SysCAMSPortConnector) { + SysCAMSPortConnector connector = (SysCAMSPortConnector) dp; + + TGConnectingPoint connectingPoint1 = connector.get_p1(); + TGConnectingPoint connectingPoint2 = connector.get_p2(); + + String name = connector.getValue(); + + TGComponent owner_p1 = elnDiagramPanel.getComponentToWhichBelongs(connectingPoint1); + TGComponent owner_p2 = elnDiagramPanel.getComponentToWhichBelongs(connectingPoint2); + + SysCAMSTComponent avowner_p1 = syscamsMap.get(owner_p1); + SysCAMSTComponent avowner_p2 = syscamsMap.get(owner_p2); + + SysCAMSTConnectingPoint avConnectingPoint1 = new SysCAMSTConnectingPoint(avowner_p1); + SysCAMSTConnectingPoint avConnectingPoint2 = new SysCAMSTConnectingPoint(avowner_p2); + + SysCAMSTConnector avconnector = new SysCAMSTConnector(avConnectingPoint1, avConnectingPoint2, name); + syscamsConnectors.add(avconnector); } } } public ELNSpecification getELNSpecification() { - return new ELNSpecification(elnComponents, elnConnectors); + return new ELNSpecification(elnComponents, elnConnectors, syscamsComponents, syscamsConnectors); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/ELNModule.java b/src/main/java/ui/eln/ELNModule.java index dc7c22550daa59261b0b144714f3f2b761ed969b..bc592b2333bc248683a8e1b2ac5405695cfc38a6 100644 --- a/src/main/java/ui/eln/ELNModule.java +++ b/src/main/java/ui/eln/ELNModule.java @@ -619,4 +619,24 @@ public class ELNModule extends TGCScalableWithInternalComponent implements Swall } return list; } + + public java.util.List<SysCAMSPortDE> getAllPortDE() { + java.util.List<SysCAMSPortDE> list = new ArrayList<SysCAMSPortDE>(); + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof SysCAMSPortDE) { + list.add((SysCAMSPortDE)(tgcomponent[i])); + } + } + return list; + } + + public java.util.List<SysCAMSPortTDF> getAllPortTDF() { + java.util.List<SysCAMSPortTDF> list = new ArrayList<SysCAMSPortTDF>(); + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof SysCAMSPortTDF) { + list.add((SysCAMSPortTDF)(tgcomponent[i])); + } + } + return list; + } } \ No newline at end of file