From 3ef2ef1f664e5750b19c67b3c5e89e4f7ab6d56f Mon Sep 17 00:00:00 2001 From: Lee <irina.lee@etu.upmc.fr> Date: Wed, 1 Aug 2018 14:42:05 +0200 Subject: [PATCH] add connecting point as subcomponent of ELN component (eln) --- .../elntranslator/ELNTComponentCapacitor.java | 14 +- .../ELNTComponentCurrentSinkTDF.java | 14 +- .../ELNTComponentCurrentSourceTDF.java | 14 +- .../ELNTComponentIdealTransformer.java | 16 +- ...ELNTComponentIndependentCurrentSource.java | 14 +- ...ELNTComponentIndependentVoltageSource.java | 14 +- .../elntranslator/ELNTComponentInductor.java | 14 +- .../elntranslator/ELNTComponentResistor.java | 14 +- .../ELNTComponentTransmissionLine.java | 14 +- ...mponentVoltageControlledCurrentSource.java | 14 +- ...mponentVoltageControlledVoltageSource.java | 16 +- .../ELNTComponentVoltageSinkTDF.java | 14 +- .../ELNTComponentVoltageSourceTDF.java | 14 +- src/main/java/ui/ELNPanelTranslator.java | 191 +++++++++++++++--- 14 files changed, 278 insertions(+), 99 deletions(-) diff --git a/src/main/java/elntranslator/ELNTComponentCapacitor.java b/src/main/java/elntranslator/ELNTComponentCapacitor.java index 6090df53f4..975d6051d1 100644 --- a/src/main/java/elntranslator/ELNTComponentCapacitor.java +++ b/src/main/java/elntranslator/ELNTComponentCapacitor.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentCapacitor @@ -52,17 +52,17 @@ public class ELNTComponentCapacitor extends ELNTComponent { private String name; private double val, q0; private String unit0, unit1; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentCapacitor(String _name, double _val, double _q0, String _unit0, String _unit1, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentCapacitor(String _name, double _val, double _q0, String _unit0, String _unit1, ELNTModule _module) { name = _name; val = _val; q0 = _q0; unit0 = _unit0; unit1 = _unit1; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -86,9 +86,13 @@ public class ELNTComponentCapacitor extends ELNTComponent { return unit1; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } public ELNTModule getModule() { return module; diff --git a/src/main/java/elntranslator/ELNTComponentCurrentSinkTDF.java b/src/main/java/elntranslator/ELNTComponentCurrentSinkTDF.java index a0ffc2cba4..e747dff39b 100644 --- a/src/main/java/elntranslator/ELNTComponentCurrentSinkTDF.java +++ b/src/main/java/elntranslator/ELNTComponentCurrentSinkTDF.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentCurrentSinkTDF @@ -51,14 +51,14 @@ import ui.eln.ELNConnectingPoint; public class ELNTComponentCurrentSinkTDF extends ELNTComponent { private String name; private double scale; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentCurrentSinkTDF(String _name, double _scale, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentCurrentSinkTDF(String _name, double _scale, ELNTModule _module) { name = _name; scale = _scale; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -70,10 +70,14 @@ public class ELNTComponentCurrentSinkTDF extends ELNTComponent { return scale; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentCurrentSourceTDF.java b/src/main/java/elntranslator/ELNTComponentCurrentSourceTDF.java index 464097cd52..bb66ec8523 100644 --- a/src/main/java/elntranslator/ELNTComponentCurrentSourceTDF.java +++ b/src/main/java/elntranslator/ELNTComponentCurrentSourceTDF.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentCurrentSourceTDF @@ -51,14 +51,14 @@ import ui.eln.ELNConnectingPoint; public class ELNTComponentCurrentSourceTDF extends ELNTComponent { private String name; private double scale; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentCurrentSourceTDF(String _name, double _scale, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentCurrentSourceTDF(String _name, double _scale, ELNTModule _module) { name = _name; scale = _scale; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -70,10 +70,14 @@ public class ELNTComponentCurrentSourceTDF extends ELNTComponent { return scale; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentIdealTransformer.java b/src/main/java/elntranslator/ELNTComponentIdealTransformer.java index e6e8588bc0..0b95c6c3b5 100644 --- a/src/main/java/elntranslator/ELNTComponentIdealTransformer.java +++ b/src/main/java/elntranslator/ELNTComponentIdealTransformer.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentIdealTransformer @@ -51,14 +51,14 @@ import ui.eln.ELNConnectingPoint; public class ELNTComponentIdealTransformer extends ELNTComponent { private String name; private double ratio; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentIdealTransformer(String _name, double _ratio, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentIdealTransformer(String _name, double _ratio, ELNTModule _module) { name = _name; ratio = _ratio; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -70,10 +70,14 @@ public class ELNTComponentIdealTransformer extends ELNTComponent { return ratio; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } - + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentIndependentCurrentSource.java b/src/main/java/elntranslator/ELNTComponentIndependentCurrentSource.java index 9596a8b4ae..a02f1fd5e0 100644 --- a/src/main/java/elntranslator/ELNTComponentIndependentCurrentSource.java +++ b/src/main/java/elntranslator/ELNTComponentIndependentCurrentSource.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentIndependentCurrentSource @@ -53,12 +53,12 @@ public class ELNTComponentIndependentCurrentSource extends ELNTComponent { private double initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmplitude; private String delay; private String unit0; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; public ELNTComponentIndependentCurrentSource(String _name, double _initValue, double _offset, double _amplitude, double _frequency, double _phase, - double _acAmplitude, double _acPhase, double _acNoiseAmplitude, String _delay, String _unit0, ELNConnectingPoint[] _cp, ELNTModule _module) { + double _acAmplitude, double _acPhase, double _acNoiseAmplitude, String _delay, String _unit0, ELNTModule _module) { name = _name; initValue = _initValue; offset = _offset; @@ -70,7 +70,7 @@ public class ELNTComponentIndependentCurrentSource extends ELNTComponent { acNoiseAmplitude = _acNoiseAmplitude; delay = _delay; unit0 = _unit0; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -118,9 +118,13 @@ public class ELNTComponentIndependentCurrentSource extends ELNTComponent { return unit0; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } public ELNTModule getModule() { return module; diff --git a/src/main/java/elntranslator/ELNTComponentIndependentVoltageSource.java b/src/main/java/elntranslator/ELNTComponentIndependentVoltageSource.java index 9b2c8c944a..6e98bab774 100644 --- a/src/main/java/elntranslator/ELNTComponentIndependentVoltageSource.java +++ b/src/main/java/elntranslator/ELNTComponentIndependentVoltageSource.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentIndependentVoltageSource @@ -53,12 +53,12 @@ public class ELNTComponentIndependentVoltageSource extends ELNTComponent { private double initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmplitude; private String delay; private String unit0; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; public ELNTComponentIndependentVoltageSource(String _name, double _initValue, double _offset, double _amplitude, double _frequency, double _phase, - double _acAmplitude, double _acPhase, double _acNoiseAmplitude, String _delay, String _unit0, ELNConnectingPoint[] _cp, ELNTModule _module) { + double _acAmplitude, double _acPhase, double _acNoiseAmplitude, String _delay, String _unit0, ELNTModule _module) { name = _name; initValue = _initValue; offset = _offset; @@ -70,7 +70,7 @@ public class ELNTComponentIndependentVoltageSource extends ELNTComponent { acNoiseAmplitude = _acNoiseAmplitude; delay = _delay; unit0 = _unit0; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -118,10 +118,14 @@ public class ELNTComponentIndependentVoltageSource extends ELNTComponent { return unit0; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentInductor.java b/src/main/java/elntranslator/ELNTComponentInductor.java index 96020bf090..57c53c527e 100644 --- a/src/main/java/elntranslator/ELNTComponentInductor.java +++ b/src/main/java/elntranslator/ELNTComponentInductor.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentInductor @@ -52,17 +52,17 @@ public class ELNTComponentInductor extends ELNTComponent { private String name; private double val, phi0; private String unit0, unit1; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentInductor(String _name, double _val, double _phi0, String _unit0, String _unit1, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentInductor(String _name, double _val, double _phi0, String _unit0, String _unit1, ELNTModule _module) { name = _name; val = _val; phi0 = _phi0; unit0 = _unit0; unit1 = _unit1; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -86,10 +86,14 @@ public class ELNTComponentInductor extends ELNTComponent { return unit1; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentResistor.java b/src/main/java/elntranslator/ELNTComponentResistor.java index fc015176c7..fb604ef3f8 100644 --- a/src/main/java/elntranslator/ELNTComponentResistor.java +++ b/src/main/java/elntranslator/ELNTComponentResistor.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentResistor @@ -52,15 +52,15 @@ public class ELNTComponentResistor extends ELNTComponent { private String name; private double val; private String unit; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentResistor(String _name, double _val, String _unit, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentResistor(String _name, double _val, String _unit, ELNTModule _module) { name = _name; val = _val; unit = _unit; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -76,9 +76,13 @@ public class ELNTComponentResistor extends ELNTComponent { return unit; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } public ELNTModule getModule() { return module; diff --git a/src/main/java/elntranslator/ELNTComponentTransmissionLine.java b/src/main/java/elntranslator/ELNTComponentTransmissionLine.java index 8211c380ec..2649cc6b88 100644 --- a/src/main/java/elntranslator/ELNTComponentTransmissionLine.java +++ b/src/main/java/elntranslator/ELNTComponentTransmissionLine.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentTransmissionLine @@ -53,18 +53,18 @@ public class ELNTComponentTransmissionLine extends ELNTComponent { private double z0, delta0; private String delay; private String unit0, unit2; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentTransmissionLine(String _name, double _z0, double _delta0, String _delay, String _unit0, String _unit2, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentTransmissionLine(String _name, double _z0, double _delta0, String _delay, String _unit0, String _unit2, ELNTModule _module) { name = _name; z0 = _z0; delta0 = _delta0; delay = _delay; unit0 = _unit0; unit2 = _unit2; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -92,10 +92,14 @@ public class ELNTComponentTransmissionLine extends ELNTComponent { return unit2; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentVoltageControlledCurrentSource.java b/src/main/java/elntranslator/ELNTComponentVoltageControlledCurrentSource.java index fa7c19ba10..e3c1e1a00f 100644 --- a/src/main/java/elntranslator/ELNTComponentVoltageControlledCurrentSource.java +++ b/src/main/java/elntranslator/ELNTComponentVoltageControlledCurrentSource.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentVoltageControlledCurrentSource @@ -52,15 +52,15 @@ public class ELNTComponentVoltageControlledCurrentSource extends ELNTComponent { private String name; private double val; private String unit; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentVoltageControlledCurrentSource(String _name, double _val, String _unit, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentVoltageControlledCurrentSource(String _name, double _val, String _unit, ELNTModule _module) { name = _name; val = _val; unit = _unit; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -76,9 +76,13 @@ public class ELNTComponentVoltageControlledCurrentSource extends ELNTComponent { return unit; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } public ELNTModule getModule() { return module; diff --git a/src/main/java/elntranslator/ELNTComponentVoltageControlledVoltageSource.java b/src/main/java/elntranslator/ELNTComponentVoltageControlledVoltageSource.java index 7a1e9e2892..a1c98ca186 100644 --- a/src/main/java/elntranslator/ELNTComponentVoltageControlledVoltageSource.java +++ b/src/main/java/elntranslator/ELNTComponentVoltageControlledVoltageSource.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentVoltageControlledVoltageSource @@ -51,14 +51,14 @@ import ui.eln.ELNConnectingPoint; public class ELNTComponentVoltageControlledVoltageSource extends ELNTComponent { private String name; private double val; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentVoltageControlledVoltageSource(String _name, double _val, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentVoltageControlledVoltageSource(String _name, double _val, ELNTModule _module) { name = _name; val = _val; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -70,10 +70,14 @@ public class ELNTComponentVoltageControlledVoltageSource extends ELNTComponent { return val; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } - + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentVoltageSinkTDF.java b/src/main/java/elntranslator/ELNTComponentVoltageSinkTDF.java index da0e9c1083..5af3bb9dc4 100644 --- a/src/main/java/elntranslator/ELNTComponentVoltageSinkTDF.java +++ b/src/main/java/elntranslator/ELNTComponentVoltageSinkTDF.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentVoltageSinkTDF @@ -51,14 +51,14 @@ import ui.eln.ELNConnectingPoint; public class ELNTComponentVoltageSinkTDF extends ELNTComponent { private String name; private double scale; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentVoltageSinkTDF(String _name, double _scale, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentVoltageSinkTDF(String _name, double _scale, ELNTModule _module) { name = _name; scale = _scale; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -70,10 +70,14 @@ public class ELNTComponentVoltageSinkTDF extends ELNTComponent { return scale; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } + public ELNTModule getModule() { return module; } diff --git a/src/main/java/elntranslator/ELNTComponentVoltageSourceTDF.java b/src/main/java/elntranslator/ELNTComponentVoltageSourceTDF.java index 6f51b41e0e..4f81aa9c57 100644 --- a/src/main/java/elntranslator/ELNTComponentVoltageSourceTDF.java +++ b/src/main/java/elntranslator/ELNTComponentVoltageSourceTDF.java @@ -38,7 +38,7 @@ package elntranslator; -import ui.eln.ELNConnectingPoint; +import java.util.LinkedList; /** * Class ELNTComponentVoltageSourceTDF @@ -51,14 +51,14 @@ import ui.eln.ELNConnectingPoint; public class ELNTComponentVoltageSourceTDF extends ELNTComponent { private String name; private double scale; - private ELNConnectingPoint[] cp; + private LinkedList<ELNTConnectingPoint> cp; private ELNTModule module; - public ELNTComponentVoltageSourceTDF(String _name, double _scale, ELNConnectingPoint[] _cp, ELNTModule _module) { + public ELNTComponentVoltageSourceTDF(String _name, double _scale, ELNTModule _module) { name = _name; scale = _scale; - cp = _cp; + cp = new LinkedList<ELNTConnectingPoint>(); module = _module; } @@ -70,9 +70,13 @@ public class ELNTComponentVoltageSourceTDF extends ELNTComponent { return scale; } - public ELNConnectingPoint[] getCp() { + public LinkedList<ELNTConnectingPoint> getConnectingPoint() { return cp; } + + public void addConnectingPoint(ELNTConnectingPoint _cp) { + cp.add(_cp); + } public ELNTModule getModule() { return module; diff --git a/src/main/java/ui/ELNPanelTranslator.java b/src/main/java/ui/ELNPanelTranslator.java index 1146e1540b..8045494b5b 100644 --- a/src/main/java/ui/ELNPanelTranslator.java +++ b/src/main/java/ui/ELNPanelTranslator.java @@ -155,10 +155,17 @@ public class ELNPanelTranslator { 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); + ELNConnectingPoint cp0 = (ELNConnectingPoint) capacitor.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) capacitor.getTGConnectingPointAtIndex(1); + ELNTComponentCapacitor elnCapacitor = new ELNTComponentCapacitor(name, val, q0, unit0, unit1, elnModule); + + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnCapacitor, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnCapacitor, cp1.getName()); + + elnCapacitor.addConnectingPoint(elncp0); + elnCapacitor.addConnectingPoint(elncp1); + elnMap.put(capacitor, elnCapacitor); elnModule.addCapacitor(elnCapacitor); elnComponents.add(elnCapacitor); @@ -169,9 +176,19 @@ public class ELNPanelTranslator { String name = TDF_isink.getValue(); double scale = TDF_isink.getScale(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) TDF_isink.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) TDF_isink.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) TDF_isink.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) TDF_isink.getTGConnectingPointAtIndex(2); - ELNTComponentCurrentSinkTDF elnTDF_isink = new ELNTComponentCurrentSinkTDF(name, scale, cp, elnModule); + ELNTComponentCurrentSinkTDF elnTDF_isink = new ELNTComponentCurrentSinkTDF(name, scale,elnModule); + + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnTDF_isink, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnTDF_isink, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnTDF_isink, cp2.getName()); + + elnTDF_isink.addConnectingPoint(elncp0); + elnTDF_isink.addConnectingPoint(elncp1); + elnTDF_isink.addConnectingPoint(elncp2); elnMap.put(TDF_isink, elnTDF_isink); elnModule.addTDF_isink(elnTDF_isink); @@ -183,10 +200,20 @@ public class ELNPanelTranslator { 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); + ELNConnectingPoint cp0 = (ELNConnectingPoint) TDF_isource.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) TDF_isource.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) TDF_isource.getTGConnectingPointAtIndex(2); + + ELNTComponentCurrentSourceTDF elnTDF_isource = new ELNTComponentCurrentSourceTDF(name, scale, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnTDF_isource, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnTDF_isource, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnTDF_isource, cp2.getName()); + + elnTDF_isource.addConnectingPoint(elncp0); + elnTDF_isource.addConnectingPoint(elncp1); + elnTDF_isource.addConnectingPoint(elncp2); + elnMap.put(TDF_isource, elnTDF_isource); elnModule.addTDF_isource(elnTDF_isource); elnComponents.add(elnTDF_isource); @@ -197,10 +224,23 @@ public class ELNPanelTranslator { String name = idealTransformer.getValue(); double ratio = idealTransformer.getRatio(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) idealTransformer.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) idealTransformer.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) idealTransformer.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) idealTransformer.getTGConnectingPointAtIndex(2); + ELNConnectingPoint cp3 = (ELNConnectingPoint) idealTransformer.getTGConnectingPointAtIndex(3); - ELNTComponentIdealTransformer elnIdealTransformer = new ELNTComponentIdealTransformer(name, ratio, cp, elnModule); + ELNTComponentIdealTransformer elnIdealTransformer = new ELNTComponentIdealTransformer(name, ratio, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnIdealTransformer, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnIdealTransformer, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnIdealTransformer, cp2.getName()); + ELNTConnectingPoint elncp3 = new ELNTConnectingPoint(elnIdealTransformer, cp3.getName()); + + elnIdealTransformer.addConnectingPoint(elncp0); + elnIdealTransformer.addConnectingPoint(elncp1); + elnIdealTransformer.addConnectingPoint(elncp2); + elnIdealTransformer.addConnectingPoint(elncp3); + elnMap.put(idealTransformer, elnIdealTransformer); elnModule.addIdealTransformer(elnIdealTransformer); elnComponents.add(elnIdealTransformer); @@ -220,10 +260,17 @@ public class ELNPanelTranslator { double acNoiseAmpliture = isource.getAcNoiseAmplitude(); String delay = isource.getDelay(); String unit0 = isource.getUnit0(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) isource.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) isource.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) isource.getTGConnectingPointAtIndex(1); - ELNTComponentIndependentCurrentSource elnISource = new ELNTComponentIndependentCurrentSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, cp, elnModule); + ELNTComponentIndependentCurrentSource elnISource = new ELNTComponentIndependentCurrentSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnISource, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnISource, cp1.getName()); + + elnISource.addConnectingPoint(elncp0); + elnISource.addConnectingPoint(elncp1); + elnMap.put(isource, elnISource); elnModule.addIsource(elnISource); elnComponents.add(elnISource); @@ -243,10 +290,17 @@ public class ELNPanelTranslator { 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); + ELNConnectingPoint cp0 = (ELNConnectingPoint) vsource.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) vsource.getTGConnectingPointAtIndex(1); + + ELNTComponentIndependentVoltageSource elnVSource = new ELNTComponentIndependentVoltageSource(name, initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmpliture, delay, unit0, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnVSource, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnVSource, cp1.getName()); + + elnVSource.addConnectingPoint(elncp0); + elnVSource.addConnectingPoint(elncp1); + elnMap.put(vsource, elnVSource); elnModule.addVsource(elnVSource); elnComponents.add(elnVSource); @@ -260,10 +314,17 @@ public class ELNPanelTranslator { 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); + ELNConnectingPoint cp0 = (ELNConnectingPoint) inductor.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) inductor.getTGConnectingPointAtIndex(1); + + ELNTComponentInductor elnInductor = new ELNTComponentInductor(name, val, phi0, unit0, unit1, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnInductor, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnInductor, cp1.getName()); + + elnInductor.addConnectingPoint(elncp0); + elnInductor.addConnectingPoint(elncp1); + elnMap.put(inductor, elnInductor); elnModule.addInductor(elnInductor); elnComponents.add(elnInductor); @@ -287,10 +348,17 @@ public class ELNPanelTranslator { String name = resistor.getValue(); double val = resistor.getVal(); String unit = resistor.getUnit(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) resistor.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) resistor.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) resistor.getTGConnectingPointAtIndex(1); - ELNTComponentResistor elnResistor = new ELNTComponentResistor(name, val, unit, cp, elnModule); + ELNTComponentResistor elnResistor = new ELNTComponentResistor(name, val, unit, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnResistor, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnResistor, cp1.getName()); + + elnResistor.addConnectingPoint(elncp0); + elnResistor.addConnectingPoint(elncp1); + elnMap.put(resistor, elnResistor); elnModule.addResistor(elnResistor); elnComponents.add(elnResistor); @@ -305,10 +373,23 @@ public class ELNPanelTranslator { String delay = transmissionLine.getDelay(); String unit0 = transmissionLine.getUnit0(); String unit2 = transmissionLine.getUnit2(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) transmissionLine.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) transmissionLine.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) transmissionLine.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) transmissionLine.getTGConnectingPointAtIndex(2); + ELNConnectingPoint cp3 = (ELNConnectingPoint) transmissionLine.getTGConnectingPointAtIndex(3); - ELNTComponentTransmissionLine elnTransmissionLine = new ELNTComponentTransmissionLine(name, z0, delta0, delay, unit0, unit2, cp, elnModule); + ELNTComponentTransmissionLine elnTransmissionLine = new ELNTComponentTransmissionLine(name, z0, delta0, delay, unit0, unit2, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnTransmissionLine, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnTransmissionLine, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnTransmissionLine, cp2.getName()); + ELNTConnectingPoint elncp3 = new ELNTConnectingPoint(elnTransmissionLine, cp3.getName()); + + elnTransmissionLine.addConnectingPoint(elncp0); + elnTransmissionLine.addConnectingPoint(elncp1); + elnTransmissionLine.addConnectingPoint(elncp2); + elnTransmissionLine.addConnectingPoint(elncp3); + elnMap.put(transmissionLine, elnTransmissionLine); elnModule.addTransmissionLine(elnTransmissionLine); elnComponents.add(elnTransmissionLine); @@ -320,10 +401,23 @@ public class ELNPanelTranslator { String name = vccs.getValue(); double val = vccs.getVal(); String unit = vccs.getUnit(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vccs.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) vccs.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) vccs.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) vccs.getTGConnectingPointAtIndex(2); + ELNConnectingPoint cp3 = (ELNConnectingPoint) vccs.getTGConnectingPointAtIndex(3); - ELNTComponentVoltageControlledCurrentSource elnVCCS = new ELNTComponentVoltageControlledCurrentSource(name, val, unit, cp, elnModule); + ELNTComponentVoltageControlledCurrentSource elnVCCS = new ELNTComponentVoltageControlledCurrentSource(name, val, unit, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnVCCS, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnVCCS, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnVCCS, cp2.getName()); + ELNTConnectingPoint elncp3 = new ELNTConnectingPoint(elnVCCS, cp3.getName()); + + elnVCCS.addConnectingPoint(elncp0); + elnVCCS.addConnectingPoint(elncp1); + elnVCCS.addConnectingPoint(elncp2); + elnVCCS.addConnectingPoint(elncp3); + elnMap.put(vccs, elnVCCS); elnModule.addVccs(elnVCCS); elnComponents.add(elnVCCS); @@ -334,10 +428,23 @@ public class ELNPanelTranslator { String name = vcvs.getValue(); double val = vcvs.getVal(); - ELNConnectingPoint[] cp = (ELNConnectingPoint[]) vcvs.connectingPoint; + ELNConnectingPoint cp0 = (ELNConnectingPoint) vcvs.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) vcvs.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) vcvs.getTGConnectingPointAtIndex(2); + ELNConnectingPoint cp3 = (ELNConnectingPoint) vcvs.getTGConnectingPointAtIndex(3); - ELNTComponentVoltageControlledVoltageSource elnVCVS = new ELNTComponentVoltageControlledVoltageSource(name, val, cp, elnModule); + ELNTComponentVoltageControlledVoltageSource elnVCVS = new ELNTComponentVoltageControlledVoltageSource(name, val, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnVCVS, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnVCVS, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnVCVS, cp2.getName()); + ELNTConnectingPoint elncp3 = new ELNTConnectingPoint(elnVCVS, cp3.getName()); + + elnVCVS.addConnectingPoint(elncp0); + elnVCVS.addConnectingPoint(elncp1); + elnVCVS.addConnectingPoint(elncp2); + elnVCVS.addConnectingPoint(elncp3); + elnMap.put(vcvs, elnVCVS); elnModule.addVcvs(elnVCVS); elnComponents.add(elnVCVS); @@ -348,10 +455,20 @@ public class ELNPanelTranslator { 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); + ELNConnectingPoint cp0 = (ELNConnectingPoint) TDF_vsink.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) TDF_vsink.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) TDF_vsink.getTGConnectingPointAtIndex(2); + + ELNTComponentVoltageSinkTDF elnTDF_vsink = new ELNTComponentVoltageSinkTDF(name, scale, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnTDF_vsink, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnTDF_vsink, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnTDF_vsink, cp2.getName()); + + elnTDF_vsink.addConnectingPoint(elncp0); + elnTDF_vsink.addConnectingPoint(elncp1); + elnTDF_vsink.addConnectingPoint(elncp2); + elnMap.put(TDF_vsink, elnTDF_vsink); elnModule.addTDF_vsink(elnTDF_vsink); elnComponents.add(elnTDF_vsink); @@ -362,10 +479,20 @@ public class ELNPanelTranslator { 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); + ELNConnectingPoint cp0 = (ELNConnectingPoint) TDF_vsource.getTGConnectingPointAtIndex(0); + ELNConnectingPoint cp1 = (ELNConnectingPoint) TDF_vsource.getTGConnectingPointAtIndex(1); + ELNConnectingPoint cp2 = (ELNConnectingPoint) TDF_vsource.getTGConnectingPointAtIndex(2); + + ELNTComponentVoltageSourceTDF elnTDF_vsource = new ELNTComponentVoltageSourceTDF(name, scale, elnModule); + ELNTConnectingPoint elncp0 = new ELNTConnectingPoint(elnTDF_vsource, cp0.getName()); + ELNTConnectingPoint elncp1 = new ELNTConnectingPoint(elnTDF_vsource, cp1.getName()); + ELNTConnectingPoint elncp2 = new ELNTConnectingPoint(elnTDF_vsource, cp2.getName()); + + elnTDF_vsource.addConnectingPoint(elncp0); + elnTDF_vsource.addConnectingPoint(elncp1); + elnTDF_vsource.addConnectingPoint(elncp2); + elnMap.put(TDF_vsource, elnTDF_vsource); elnModule.addTDF_vsource(elnTDF_vsource); elnComponents.add(elnTDF_vsource); -- GitLab