@enervance/insight-cim-model 0.0.161 → 0.0.162
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/cim-class-names.d.ts +10 -0
- package/dist/constants/cim-class-names.js +11 -1
- package/dist/constants/cim-class-names.js.map +1 -1
- package/dist/converter/integral7/converter.integral7.d.ts +3 -1
- package/dist/converter/integral7/converter.integral7.js +219 -243
- package/dist/converter/integral7/converter.integral7.js.map +1 -1
- package/dist/converter/integral7/dl-convert/data-manager.d.ts +1 -10
- package/dist/converter/integral7/dl-convert/data-manager.js +0 -34
- package/dist/converter/integral7/dl-convert/data-manager.js.map +1 -1
- package/dist/converter/integral7/dl-convert/db/data-types.d.ts +0 -9
- package/dist/converter/integral7/dl-convert/db/data-types.js +0 -11
- package/dist/converter/integral7/dl-convert/db/data-types.js.map +1 -1
- package/dist/converter/integral7/dl-convert/dl-converter-i7.d.ts +153 -99
- package/dist/converter/integral7/dl-convert/dl-converter-i7.js +3401 -1315
- package/dist/converter/integral7/dl-convert/dl-converter-i7.js.map +1 -1
- package/dist/converter/integral7/dl-convert/executor.d.ts +3 -1
- package/dist/converter/integral7/dl-convert/executor.js +4 -3
- package/dist/converter/integral7/dl-convert/executor.js.map +1 -1
- package/dist/converter/integral7/model/dl-utils/util-functions.d.ts +7 -35
- package/dist/converter/integral7/model/dl-utils/util-functions.js +7 -659
- package/dist/converter/integral7/model/dl-utils/util-functions.js.map +1 -1
- package/dist/converter/integral7/{util-asset.model.d.ts → util-cim.model.d.ts} +5 -1
- package/dist/converter/integral7/{util-asset.model.js → util-cim.model.js} +10 -4
- package/dist/converter/integral7/util-cim.model.js.map +1 -0
- package/dist/converter/integral7/utils-cgmes-export.js +2 -0
- package/dist/converter/integral7/utils-cgmes-export.js.map +1 -1
- package/dist/converter/integral7/utils-trafo3w.d.ts +2 -2
- package/dist/converter/integral7/utils-trafo3w.js +21 -4
- package/dist/converter/integral7/utils-trafo3w.js.map +1 -1
- package/dist/converter/integral7/utils.d.ts +10 -22
- package/dist/converter/integral7/utils.js +187 -327
- package/dist/converter/integral7/utils.js.map +1 -1
- package/dist/etl/etl-dppower/etl-dppower.d.ts +15 -0
- package/dist/etl/etl-dppower/etl-dppower.js +204 -0
- package/dist/etl/etl-dppower/etl-dppower.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/model/wires/IRegulatingCondEq.d.ts +3 -0
- package/dist/model/assetinfo/CableInfo.d.ts +7 -0
- package/dist/model/assetinfo/CableInfo.js +49 -0
- package/dist/model/assetinfo/CableInfo.js.map +1 -1
- package/dist/model/assetinfo/OverheadWireInfo.d.ts +7 -0
- package/dist/model/assetinfo/OverheadWireInfo.js +49 -0
- package/dist/model/assetinfo/OverheadWireInfo.js.map +1 -1
- package/dist/model/assets/Facility.js +17 -3
- package/dist/model/assets/Facility.js.map +1 -1
- package/dist/model/assets/LifecycleDate.d.ts +1 -0
- package/dist/model/assets/LifecycleDate.js +3 -0
- package/dist/model/assets/LifecycleDate.js.map +1 -1
- package/dist/model/common/Location.js +1 -1
- package/dist/model/common/Location.js.map +1 -1
- package/dist/model/core/ACDCTerminal.js +2 -1
- package/dist/model/core/ACDCTerminal.js.map +1 -1
- package/dist/model/core/Equipment.js +6 -1
- package/dist/model/core/Equipment.js.map +1 -1
- package/dist/model/core/Substation.js +7 -7
- package/dist/model/core/Substation.js.map +1 -1
- package/dist/model/dc/DCLine.js +17 -17
- package/dist/model/dc/DCLineSegment.js +25 -25
- package/dist/model/diagram/DiagramObject.js +2 -2
- package/dist/model/diagram/DiagramObject.js.map +1 -1
- package/dist/model/equivalents/EquivalentInjection.d.ts +10 -0
- package/dist/model/equivalents/EquivalentInjection.js +111 -0
- package/dist/model/equivalents/EquivalentInjection.js.map +1 -1
- package/dist/model/extensions/amprion/core/AMPRIONBay.js.map +1 -1
- package/dist/model/extensions/enervance/assets/EVWireObject.js +7 -1
- package/dist/model/extensions/enervance/assets/EVWireObject.js.map +1 -1
- package/dist/model/extensions/integral/wires/INTEGRALAsynchronousMachine.d.ts +0 -1
- package/dist/model/extensions/integral/wires/INTEGRALAsynchronousMachine.js +0 -3
- package/dist/model/extensions/integral/wires/INTEGRALAsynchronousMachine.js.map +1 -1
- package/dist/model/extensions/neplan-westnetz/core/WNConnectivityNode.js +8 -1
- package/dist/model/extensions/neplan-westnetz/core/WNConnectivityNode.js.map +1 -1
- package/dist/model/loadmodel/ConformLoadGroup.js +22 -22
- package/dist/model/loadmodel/LoadArea.js +21 -21
- package/dist/model/loadmodel/SubLoadArea.js +22 -22
- package/dist/model/wires/ACLineSegment.d.ts +3 -0
- package/dist/model/wires/ACLineSegment.js +7 -1
- package/dist/model/wires/ACLineSegment.js.map +1 -1
- package/dist/model/wires/AsynchronousMachine.js +0 -1
- package/dist/model/wires/AsynchronousMachine.js.map +1 -1
- package/dist/model/wires/ExternalNetworkInjection.js.map +1 -1
- package/dist/model/wires/PowerTransformer.js +2 -0
- package/dist/model/wires/PowerTransformer.js.map +1 -1
- package/dist/model/wires/PowerTransformerEnd.js +1 -0
- package/dist/model/wires/PowerTransformerEnd.js.map +1 -1
- package/dist/model/wires/RatioTapChanger.js +1 -1
- package/dist/model-container/enum/EVSourceSystemKind.d.ts +1 -0
- package/dist/model-container/enum/EVSourceSystemKind.js +1 -0
- package/dist/model-container/enum/EVSourceSystemKind.js.map +1 -1
- package/dist/model-container/model/ModelContainer.d.ts +5 -0
- package/dist/model-container/model/ModelContainer.js +9 -0
- package/dist/model-container/model/ModelContainer.js.map +1 -1
- package/dist/util/util-create.d.ts +1 -1
- package/dist/util/util-create.js +4 -2
- package/dist/util/util-create.js.map +1 -1
- package/dist/util/utils.d.ts +1 -1
- package/dist/util/utils.js +4 -2
- package/dist/util/utils.js.map +1 -1
- package/dist/utils2/cim.model.utils.js +6 -0
- package/dist/utils2/cim.model.utils.js.map +1 -1
- package/dist/utils2/common.utils.d.ts +1 -0
- package/dist/utils2/common.utils.js +6 -2
- package/dist/utils2/common.utils.js.map +1 -1
- package/dist/utils2/fuseki.utils.js +7 -1
- package/dist/utils2/fuseki.utils.js.map +1 -1
- package/dist/utils2/import.utils.d.ts +2 -1
- package/dist/utils2/import.utils.js +9 -3
- package/dist/utils2/import.utils.js.map +1 -1
- package/dist/utils2/parser.utils.js +7 -7
- package/dist/utils2/parser.utils.js.map +1 -1
- package/package.json +5 -2
- package/dist/converter/integral7/dl-convert/dl-converter-i7-2.d.ts +0 -157
- package/dist/converter/integral7/dl-convert/dl-converter-i7-2.js +0 -3521
- package/dist/converter/integral7/dl-convert/dl-converter-i7-2.js.map +0 -1
- package/dist/converter/integral7/dl-convert/dl-converter-i7.types.d.ts +0 -3
- package/dist/converter/integral7/dl-convert/dl-converter-i7.types.js +0 -3
- package/dist/converter/integral7/dl-convert/dl-converter-i7.types.js.map +0 -1
- package/dist/converter/integral7/util-asset.model.js.map +0 -1
|
@@ -1,3521 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DLConverterI7 = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../model/dl-utils/constants.js");
|
|
6
|
-
const util_functions_1 = require("../model/dl-utils/util-functions.js");
|
|
7
|
-
const DiagramObject_1 = require("../../../model/diagram/DiagramObject.js");
|
|
8
|
-
const convert_graph_keys_1 = require("./dl-graphs/convert-graph-keys.js");
|
|
9
|
-
const Diagram_1 = require("../../../model/diagram/Diagram.js");
|
|
10
|
-
const parser_utils_1 = require("../../../utils2/parser.utils.js");
|
|
11
|
-
const OrientationKind_1 = require("../../../model/diagram/OrientationKind.js");
|
|
12
|
-
const DiagramStyle_1 = require("../../../model/diagram/DiagramStyle.js");
|
|
13
|
-
const common_utils_1 = require("../../../utils2/common.utils.js");
|
|
14
|
-
const cim_constants_1 = require("../../../constants/cim-constants.js");
|
|
15
|
-
const cim_model_graph_1 = require("./dl-graphs/cim-model-graph.js");
|
|
16
|
-
const db_object_graph_1 = require("./dl-graphs/db-object-graph.js");
|
|
17
|
-
const DiagramObjectPoint_1 = require("../../../model/diagram/DiagramObjectPoint.js");
|
|
18
|
-
const utils_schema_1 = require("../utils-schema.js");
|
|
19
|
-
const BusbarSection_1 = require("../../../model/wires/BusbarSection.js");
|
|
20
|
-
const Junction_1 = require("../../../model/wires/Junction.js");
|
|
21
|
-
class DLConverterI7 {
|
|
22
|
-
constructor(logger, config) {
|
|
23
|
-
this.exportedDiagramObjectsGraph = {};
|
|
24
|
-
this.logger = logger;
|
|
25
|
-
this.config = config;
|
|
26
|
-
this.dbObjectGraph = new db_object_graph_1.DbObjectGraph(convert_graph_keys_1.i7SchemaKeyDefinitions);
|
|
27
|
-
this.dbObjectKeyCimModelUuidGraph = new cim_model_graph_1.DbObjectKey2CimModelUUIDGraph(convert_graph_keys_1.i7SchemaKeyDefinitions);
|
|
28
|
-
this.cimModelGraph = new cim_model_graph_1.CimModelGraph();
|
|
29
|
-
this.exportedTerminalUUIDs = new Set();
|
|
30
|
-
this.exportedBusbarSectionConnectivityNodeUuidToDiagramObject = new Map();
|
|
31
|
-
}
|
|
32
|
-
addExportedDiagramObjectToGraph(variantennr, netzId, diagramObject) {
|
|
33
|
-
var _a;
|
|
34
|
-
this.exportedDiagramObjectsGraph[variantennr] = (_a = this.exportedDiagramObjectsGraph[variantennr]) !== null && _a !== void 0 ? _a : {};
|
|
35
|
-
this.exportedDiagramObjectsGraph[variantennr][netzId] = diagramObject;
|
|
36
|
-
}
|
|
37
|
-
setDbObjectGraph(graph) {
|
|
38
|
-
this.dbObjectGraph = graph;
|
|
39
|
-
}
|
|
40
|
-
setCimModelGraph(graph) {
|
|
41
|
-
this.cimModelGraph = graph;
|
|
42
|
-
}
|
|
43
|
-
setDbObjectKeyCimModelUuidGraph(graph) {
|
|
44
|
-
this.dbObjectKeyCimModelUuidGraph = graph;
|
|
45
|
-
}
|
|
46
|
-
addCimObject(uuid, object, typeOfKey, dbKey) {
|
|
47
|
-
if (typeOfKey !== undefined && dbKey !== undefined)
|
|
48
|
-
this.dbObjectKeyCimModelUuidGraph.addRelation(typeOfKey, dbKey, uuid);
|
|
49
|
-
this.cimModelGraph.addUnspecifiedObject(uuid, object);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* convertNsgVariante
|
|
53
|
-
*/
|
|
54
|
-
convertNsgVariante(arg) {
|
|
55
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const diagram = new Diagram_1.Diagram((0, parser_utils_1.getUUID)(arg.guid), arg.name, String(arg.id));
|
|
57
|
-
diagram.orientation = OrientationKind_1.OrientationKind.negative;
|
|
58
|
-
diagram.diagramStyle = new DiagramStyle_1.DiagramStyle(common_utils_1.CommonUtils.generateUUID(), cim_constants_1.DiagramLayoutTypes.NODE_BREAKER);
|
|
59
|
-
return diagram;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* convertSchemaStandort
|
|
64
|
-
*/
|
|
65
|
-
convertSchemaStandort(arg) {
|
|
66
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* convertSchemaKnotenStandort
|
|
71
|
-
*/
|
|
72
|
-
convertSchemaKnotenStandort(nsgKnotenSo) {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKnotenSo.variantennr, id: nsgKnotenSo.nsgso });
|
|
76
|
-
if (nsgStandort === undefined)
|
|
77
|
-
return null;
|
|
78
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgKnotenSo.knotenso })) !== null && _b !== void 0 ? _b : undefined;
|
|
79
|
-
const diagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
80
|
-
xPosition: nsgStandort.xrel + nsgKnotenSo.xrel + 16,
|
|
81
|
-
yPosition: nsgStandort.yrel + nsgKnotenSo.yrel + 16,
|
|
82
|
-
diagramObjectName: 'Abzweig',
|
|
83
|
-
identifiedObjectUUID: cimObjectUUID
|
|
84
|
-
});
|
|
85
|
-
// knotenso must be accessible via knotenzw-id
|
|
86
|
-
const netzSchlaufen = yield this.dbObjectGraph.findByAttributes(convert_graph_keys_1.i7TableNames.netz_schlaufe, {
|
|
87
|
-
eknoten: { in: [nsgKnotenSo.knotenso] }
|
|
88
|
-
});
|
|
89
|
-
if (netzSchlaufen && netzSchlaufen.length > 0) {
|
|
90
|
-
for (const netzSchlaufe of netzSchlaufen) {
|
|
91
|
-
this.addExportedDiagramObjectToGraph(nsgKnotenSo.variantennr, netzSchlaufe.knotenzw, diagramObject);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
this.addExportedDiagramObjectToGraph(nsgKnotenSo.variantennr, nsgKnotenSo.knotenso, diagramObject);
|
|
95
|
-
return diagramObject;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* convertSchemaKnotenStandort
|
|
100
|
-
*/
|
|
101
|
-
convertSchemaKnotenHgue(nsgKnotenHgue) {
|
|
102
|
-
var _a, _b;
|
|
103
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKnotenHgue.variantennr, id: nsgKnotenHgue.nsgso });
|
|
105
|
-
if (nsgStandort === undefined)
|
|
106
|
-
return null;
|
|
107
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgKnotenHgue.knotenso })) !== null && _b !== void 0 ? _b : undefined;
|
|
108
|
-
const diagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
109
|
-
xPosition: nsgStandort.xrel + nsgKnotenHgue.xrel + 16,
|
|
110
|
-
yPosition: nsgStandort.yrel + nsgKnotenHgue.yrel + 16,
|
|
111
|
-
diagramObjectName: 'Hgue-Knoten',
|
|
112
|
-
identifiedObjectUUID: cimObjectUUID
|
|
113
|
-
});
|
|
114
|
-
// knotenso must be accessible via knotenzw-id
|
|
115
|
-
const netzSchlaufen = yield this.dbObjectGraph.findByAttributes(convert_graph_keys_1.i7TableNames.netz_schlaufe, {
|
|
116
|
-
eknoten: { in: [nsgKnotenHgue.knotenso] }
|
|
117
|
-
});
|
|
118
|
-
if (netzSchlaufen && netzSchlaufen.length > 0) {
|
|
119
|
-
for (const netzSchlaufe of netzSchlaufen) {
|
|
120
|
-
this.addExportedDiagramObjectToGraph(nsgKnotenHgue.variantennr, netzSchlaufe.knotenzw, diagramObject);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
this.addExportedDiagramObjectToGraph(nsgKnotenHgue.variantennr, nsgKnotenHgue.knotenso, diagramObject);
|
|
124
|
-
return diagramObject;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* convertSchemaSchaltanlage
|
|
129
|
-
*/
|
|
130
|
-
convertSchemaSchaltanlage(arg) {
|
|
131
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* convertSchemaSchaltanlagenAbschnitte
|
|
136
|
-
*/
|
|
137
|
-
convertSchemaSchaltanlagenAbschnitte(arg) {
|
|
138
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
139
|
-
// const nsgSchaltanlage: NsgSchaltanlage = await this.dbObjectGraph.findObjectByKey(
|
|
140
|
-
// i7TableNames.nsg_nsgschaltanlage,
|
|
141
|
-
// i7SchemaKeyNames.VariantenNrIdKey, { variantennr: arg.variantennr, id: arg.nsgsa }
|
|
142
|
-
// );
|
|
143
|
-
//
|
|
144
|
-
// nsgSchaltanlage.nsgSaabschnitt = nsgSchaltanlage.nsgSaabschnitt ?? [];
|
|
145
|
-
// nsgSchaltanlage.nsgSaabschnitt.push(arg);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
// async convertSchemaSammelschienenAbschnitte(arg: NsgSchaltanlagenabschnitt) {
|
|
149
|
-
convertSchemaSammelschienenAbschnitte(arg) {
|
|
150
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
const netzSsabs = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.netz_ssab, {
|
|
152
|
-
saabschnitt: arg.saabschnitt
|
|
153
|
-
});
|
|
154
|
-
const resultingDiagramObjects = [];
|
|
155
|
-
for (const netzSsab of netzSsabs) {
|
|
156
|
-
const diagramObjects = yield this.convertSchemaSammelschienenAbschnitt(arg, netzSsab);
|
|
157
|
-
if (diagramObjects) {
|
|
158
|
-
resultingDiagramObjects.push(...diagramObjects);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return resultingDiagramObjects;
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* convertSchemaSammelschienenAbschnitt
|
|
166
|
-
*/
|
|
167
|
-
convertSchemaSammelschienenAbschnitt(nsgSaabschnitt, netzSsab) {
|
|
168
|
-
var _a, _b, _c;
|
|
169
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
171
|
-
if (!nsgSchaltanlage)
|
|
172
|
-
return;
|
|
173
|
-
const leftUpperPointOfSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsab, nsgSaabschnitt.variantennr);
|
|
174
|
-
const length = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnitt);
|
|
175
|
-
const points = [];
|
|
176
|
-
let topLeft = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
177
|
-
let bottomRight = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
178
|
-
topLeft.xPosition = leftUpperPointOfSsab[0];
|
|
179
|
-
topLeft.yPosition = leftUpperPointOfSsab[1];
|
|
180
|
-
if (nsgSchaltanlage.ausrichtung % 2 === 0) {
|
|
181
|
-
bottomRight.xPosition = leftUpperPointOfSsab[0] + length * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
182
|
-
bottomRight.yPosition = leftUpperPointOfSsab[1];
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
bottomRight.xPosition = leftUpperPointOfSsab[0];
|
|
186
|
-
bottomRight.yPosition = leftUpperPointOfSsab[1] + length * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
187
|
-
}
|
|
188
|
-
topLeft.sequenceNumber = 1;
|
|
189
|
-
bottomRight.sequenceNumber = 2;
|
|
190
|
-
points.push(topLeft, bottomRight);
|
|
191
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: netzSsab.id })) !== null && _b !== void 0 ? _b : undefined;
|
|
192
|
-
const connectivityNode = this.cimModelGraph.findObjectByUUID(cimObjectUUID);
|
|
193
|
-
let busbarSection = null;
|
|
194
|
-
let busbarSectionTerminal = null;
|
|
195
|
-
if (connectivityNode) {
|
|
196
|
-
for (const terminal of connectivityNode.terminals.values()) {
|
|
197
|
-
if (terminal.conductingEquipment instanceof BusbarSection_1.BusbarSection) {
|
|
198
|
-
busbarSection = terminal.conductingEquipment;
|
|
199
|
-
busbarSectionTerminal = terminal;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (busbarSection && busbarSectionTerminal && !((_c = this.config) === null || _c === void 0 ? void 0 : _c.busbarSectionAsConnectivityNode)) {
|
|
205
|
-
// compute the position for the ConnectivityNode (the center of the BusbarSection)
|
|
206
|
-
const centerPosition = [
|
|
207
|
-
(topLeft.xPosition + bottomRight.xPosition) / 2,
|
|
208
|
-
(topLeft.yPosition + bottomRight.yPosition) / 2
|
|
209
|
-
];
|
|
210
|
-
const doConnectivityNode = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(centerPosition[0], centerPosition[1], null);
|
|
211
|
-
doConnectivityNode.name = `NetzSsab CN ${netzSsab.id}`;
|
|
212
|
-
doConnectivityNode.identifiedObjectUUID = cimObjectUUID;
|
|
213
|
-
this.addExportedDiagramObjectToGraph(nsgSaabschnitt.variantennr, netzSsab.id, doConnectivityNode);
|
|
214
|
-
const doBusbarSection = new DiagramObject_1.DiagramObject(common_utils_1.CommonUtils.generateUUID(), `NetzSsab ${netzSsab.id}`);
|
|
215
|
-
doBusbarSection.identifiedObjectUUID = busbarSection.getUUID();
|
|
216
|
-
doBusbarSection.rotation = util_functions_1.DLUtilFunctions.getRotationBasedOnNsgSa(nsgSchaltanlage.ausrichtung);
|
|
217
|
-
(0, utils_schema_1.copyDiagramObjectPoints)(doBusbarSection, points);
|
|
218
|
-
this.exportedTerminalUUIDs.add(busbarSectionTerminal.getUUID());
|
|
219
|
-
const doBusbarSectionTerminal = this.createTerminalDiagramObjectFromPoints({
|
|
220
|
-
cePoints: [topLeft.xPosition, topLeft.yPosition], cnPoints: [...centerPosition],
|
|
221
|
-
terminalUuid: busbarSectionTerminal.getUUID()
|
|
222
|
-
});
|
|
223
|
-
return [doBusbarSection, doBusbarSectionTerminal, doConnectivityNode];
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
const doBusbarSectionAsConnectivityNode = new DiagramObject_1.DiagramObject(common_utils_1.CommonUtils.generateUUID(), `NetzSsab CN ${netzSsab.id}`);
|
|
227
|
-
doBusbarSectionAsConnectivityNode.identifiedObjectUUID = cimObjectUUID;
|
|
228
|
-
doBusbarSectionAsConnectivityNode.rotation = util_functions_1.DLUtilFunctions.getRotationBasedOnNsgSa(nsgSchaltanlage.ausrichtung);
|
|
229
|
-
(0, utils_schema_1.copyDiagramObjectPoints)(doBusbarSectionAsConnectivityNode, points);
|
|
230
|
-
this.addExportedDiagramObjectToGraph(nsgSaabschnitt.variantennr, netzSsab.id, doBusbarSectionAsConnectivityNode);
|
|
231
|
-
return [doBusbarSectionAsConnectivityNode];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* convertSchemaSchaltfeldElemente
|
|
237
|
-
*/
|
|
238
|
-
convertSchemaSchaltfeldElemente(nsgSchaltfeld) {
|
|
239
|
-
var _a, _b;
|
|
240
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
const resultingDiagramObjects = [];
|
|
242
|
-
// Es kann vorkommen, dass der Standort einer Sammelschiene bzw. einer Schaltanlage nicht eingeblendet ist.
|
|
243
|
-
// Dadurch wird die Sammelschiene bzw. die Schaltanlage nicht exportiert und deshalb existiert das Referenz-Objekt nsgSSAB nicht
|
|
244
|
-
// Das Schaltfeld kann somit ebenfalls nicht exportiert werden und wird übersprungen
|
|
245
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltfeld.variantennr, id: nsgSchaltfeld.nsgsaa });
|
|
246
|
-
if (!nsgSaabschnitt)
|
|
247
|
-
return;
|
|
248
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltfeld.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
249
|
-
if (!nsgSchaltanlage)
|
|
250
|
-
return;
|
|
251
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltfeld.variantennr, id: nsgSchaltanlage.nsgso });
|
|
252
|
-
if (!nsgStandort)
|
|
253
|
-
return;
|
|
254
|
-
const netzSsabs = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.netz_ssab, {
|
|
255
|
-
saabschnitt: nsgSaabschnitt.saabschnitt
|
|
256
|
-
});
|
|
257
|
-
let bayOrientation = nsgSchaltanlage.ausrichtung;
|
|
258
|
-
if (nsgSchaltfeld.deltaausrichtung === 1) {
|
|
259
|
-
bayOrientation = (bayOrientation + 2) % 4;
|
|
260
|
-
}
|
|
261
|
-
const netzSsabsIds = new Set(netzSsabs.map(arg => arg.id));
|
|
262
|
-
let schaltfeldOffset;
|
|
263
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
264
|
-
case 0:
|
|
265
|
-
case 1:
|
|
266
|
-
schaltfeldOffset = nsgSchaltfeld.slotnummer * 16 + 8;
|
|
267
|
-
break;
|
|
268
|
-
case 2:
|
|
269
|
-
case 3:
|
|
270
|
-
schaltfeldOffset = (nsgSaabschnitt.laenge - nsgSchaltfeld.slotnummer - 1) * 16 + 8;
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
const schaltfeldNodes = yield this.getNodesOfSchaltfeld(nsgSchaltfeld);
|
|
274
|
-
const onSsabNodes = schaltfeldNodes.filter(elem => netzSsabsIds.has(elem.aknoten) || netzSsabsIds.has(elem.eknoten));
|
|
275
|
-
const onlySingleBusbarWithDisconnector = netzSsabs.length === 1 && schaltfeldNodes.length === 1;
|
|
276
|
-
const nodePointMap = new Map();
|
|
277
|
-
let lastSsabBeforeStackLeaving;
|
|
278
|
-
for (const onSsabNode of onSsabNodes) {
|
|
279
|
-
let position;
|
|
280
|
-
let netzSsab;
|
|
281
|
-
if (netzSsabsIds.has(onSsabNode.aknoten)) {
|
|
282
|
-
netzSsab = netzSsabs.find(netzSsab => netzSsab.id === onSsabNode.aknoten);
|
|
283
|
-
position = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsab, nsgSchaltfeld.variantennr);
|
|
284
|
-
}
|
|
285
|
-
else if (netzSsabsIds.has(onSsabNode.eknoten)) {
|
|
286
|
-
netzSsab = netzSsabs.find(netzSsab => netzSsab.id === onSsabNode.eknoten);
|
|
287
|
-
position = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsab, nsgSchaltfeld.variantennr);
|
|
288
|
-
}
|
|
289
|
-
if (lastSsabBeforeStackLeaving === undefined)
|
|
290
|
-
lastSsabBeforeStackLeaving = netzSsab;
|
|
291
|
-
let rotationValue = null;
|
|
292
|
-
switch (bayOrientation) {
|
|
293
|
-
case 0: // TOP
|
|
294
|
-
rotationValue = 0;
|
|
295
|
-
position[0] += schaltfeldOffset;
|
|
296
|
-
if (onlySingleBusbarWithDisconnector)
|
|
297
|
-
position[1] -= 8;
|
|
298
|
-
break;
|
|
299
|
-
case 1: // RIGHT
|
|
300
|
-
rotationValue = 90;
|
|
301
|
-
position[1] += schaltfeldOffset;
|
|
302
|
-
if (onlySingleBusbarWithDisconnector)
|
|
303
|
-
position[0] += 8;
|
|
304
|
-
break;
|
|
305
|
-
case 2: // BOTTOM
|
|
306
|
-
rotationValue = 180;
|
|
307
|
-
position[0] += schaltfeldOffset;
|
|
308
|
-
if (onlySingleBusbarWithDisconnector)
|
|
309
|
-
position[1] += 8;
|
|
310
|
-
break;
|
|
311
|
-
case 3: // LEFT
|
|
312
|
-
rotationValue = 270;
|
|
313
|
-
position[1] += schaltfeldOffset;
|
|
314
|
-
if (onlySingleBusbarWithDisconnector)
|
|
315
|
-
position[0] -= 8;
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
// ConductingEquipment
|
|
319
|
-
nodePointMap.set(onSsabNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
320
|
-
}
|
|
321
|
-
const leftUpperCornerOfBay = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld, nsgSchaltfeld);
|
|
322
|
-
const maxSsabPos = yield this.getMaxPosOfSaabschnitt(nsgSaabschnitt);
|
|
323
|
-
const startPositionOfStack = [0, 0];
|
|
324
|
-
switch (bayOrientation) {
|
|
325
|
-
case 0: // TOP
|
|
326
|
-
startPositionOfStack[0] = leftUpperCornerOfBay[0] + 16;
|
|
327
|
-
startPositionOfStack[1] = leftUpperCornerOfBay[1] + (nsgSchaltfeld.hoehe - (maxSsabPos + 1) * 8) + 4;
|
|
328
|
-
break;
|
|
329
|
-
case 1: // RIGHT
|
|
330
|
-
startPositionOfStack[0] = leftUpperCornerOfBay[0] + ((maxSsabPos + 1) * 8) - 4;
|
|
331
|
-
startPositionOfStack[1] = leftUpperCornerOfBay[1] + 16;
|
|
332
|
-
break;
|
|
333
|
-
case 2: // BOTTOM
|
|
334
|
-
startPositionOfStack[0] = leftUpperCornerOfBay[0] + 16;
|
|
335
|
-
startPositionOfStack[1] = leftUpperCornerOfBay[1] + ((maxSsabPos + 1) * 8) - 4;
|
|
336
|
-
break;
|
|
337
|
-
case 3: // LEFT
|
|
338
|
-
startPositionOfStack[0] = leftUpperCornerOfBay[0] + (nsgSchaltfeld.hoehe - (maxSsabPos + 1) * 8) + 4;
|
|
339
|
-
startPositionOfStack[1] = leftUpperCornerOfBay[1] + 16;
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
let prevNode = onSsabNodes[0];
|
|
343
|
-
let crtNode = schaltfeldNodes.find(arg => arg.aknoten === onSsabNodes[0].eknoten);
|
|
344
|
-
let position = [...startPositionOfStack];
|
|
345
|
-
let connectivityNodePosition = [...startPositionOfStack];
|
|
346
|
-
let rotationValue = null;
|
|
347
|
-
while (crtNode !== undefined) {
|
|
348
|
-
switch (bayOrientation) {
|
|
349
|
-
case 0: // TOP
|
|
350
|
-
rotationValue = 0;
|
|
351
|
-
position[1] -= 8;
|
|
352
|
-
connectivityNodePosition[1] = position[1] + 4;
|
|
353
|
-
break;
|
|
354
|
-
case 1: // RIGHT
|
|
355
|
-
rotationValue = 90;
|
|
356
|
-
position[0] += 8;
|
|
357
|
-
connectivityNodePosition[0] = position[0] - 4;
|
|
358
|
-
break;
|
|
359
|
-
case 2: // BOTTOM
|
|
360
|
-
rotationValue = 180;
|
|
361
|
-
position[1] += 8;
|
|
362
|
-
connectivityNodePosition[1] = position[1] - 4;
|
|
363
|
-
break;
|
|
364
|
-
case 3: // LEFT
|
|
365
|
-
rotationValue = 270;
|
|
366
|
-
position[0] -= 8;
|
|
367
|
-
connectivityNodePosition[0] = position[0] + 4;
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
nodePointMap.set(crtNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
371
|
-
nodePointMap.set(crtNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(connectivityNodePosition[0], connectivityNodePosition[1], null));
|
|
372
|
-
prevNode = crtNode;
|
|
373
|
-
crtNode = schaltfeldNodes.find(arg => arg.aknoten === crtNode.eknoten);
|
|
374
|
-
}
|
|
375
|
-
// BEGIN: Last ConnectivityNode
|
|
376
|
-
// Exportiere das ConnectivityNode/den Endpunkt des Schaltfeldes
|
|
377
|
-
if (prevNode !== undefined) {
|
|
378
|
-
switch (bayOrientation) {
|
|
379
|
-
case 0: // TOP
|
|
380
|
-
position[1] = leftUpperCornerOfBay[1];
|
|
381
|
-
break;
|
|
382
|
-
case 1: // RIGHT
|
|
383
|
-
position[0] = leftUpperCornerOfBay[0] + nsgSchaltfeld.hoehe;
|
|
384
|
-
break;
|
|
385
|
-
case 2: // BOTTOM
|
|
386
|
-
position[1] = leftUpperCornerOfBay[1] + nsgSchaltfeld.hoehe;
|
|
387
|
-
break;
|
|
388
|
-
case 3: // LEFT
|
|
389
|
-
position[0] = leftUpperCornerOfBay[0];
|
|
390
|
-
break;
|
|
391
|
-
}
|
|
392
|
-
nodePointMap.set(prevNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], null));
|
|
393
|
-
// END: Last ConnectivityNode
|
|
394
|
-
}
|
|
395
|
-
for (const nodePointEntry of nodePointMap.entries()) {
|
|
396
|
-
const key = nodePointEntry[0];
|
|
397
|
-
const value = nodePointEntry[1];
|
|
398
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: key })) !== null && _b !== void 0 ? _b : undefined;
|
|
399
|
-
value.identifiedObjectUUID = cimObjectUUID;
|
|
400
|
-
resultingDiagramObjects.push(value);
|
|
401
|
-
this.addExportedDiagramObjectToGraph(nsgSchaltfeld.variantennr, key, value);
|
|
402
|
-
}
|
|
403
|
-
/* ---------- ---------- ---------- */
|
|
404
|
-
// BEGIN: Terminal-Export
|
|
405
|
-
for (const schaltfeldNode of schaltfeldNodes) {
|
|
406
|
-
let doBackwardConnectivityNode = nodePointMap.get(schaltfeldNode.aknoten);
|
|
407
|
-
if (netzSsabsIds.has(schaltfeldNode.aknoten)) {
|
|
408
|
-
doBackwardConnectivityNode = this.exportedDiagramObjectsGraph[nsgSchaltfeld.variantennr][schaltfeldNode.aknoten];
|
|
409
|
-
}
|
|
410
|
-
const doConductingEquipment = nodePointMap.get(schaltfeldNode.id);
|
|
411
|
-
const doForwardConnectivityNode = nodePointMap.get(schaltfeldNode.eknoten);
|
|
412
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
413
|
-
const dopConductingEquipment = doConductingEquipment.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
414
|
-
const dopForwardConnectivityNode = doForwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
415
|
-
if (netzSsabsIds.has(schaltfeldNode.aknoten)) {
|
|
416
|
-
switch (bayOrientation) {
|
|
417
|
-
case 0: // TOP
|
|
418
|
-
case 2: // BOTTOM
|
|
419
|
-
dopBackwardConnectivityNode[0] = dopConductingEquipment[0];
|
|
420
|
-
break;
|
|
421
|
-
case 1: // RIGHT
|
|
422
|
-
case 3: // LEFT
|
|
423
|
-
dopBackwardConnectivityNode[1] = dopConductingEquipment[1];
|
|
424
|
-
break;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(schaltfeldNode.aknoten, schaltfeldNode.id);
|
|
428
|
-
if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
429
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
430
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
431
|
-
cePoints: [...dopConductingEquipment], cnPoints: [...dopBackwardConnectivityNode],
|
|
432
|
-
terminalUuid: backwardTerminalUUID
|
|
433
|
-
});
|
|
434
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
435
|
-
}
|
|
436
|
-
const forwardTerminalUUID = this.lookupTerminalUUID(schaltfeldNode.eknoten, schaltfeldNode.id);
|
|
437
|
-
if (!this.exportedTerminalUUIDs.has(forwardTerminalUUID)) {
|
|
438
|
-
this.exportedTerminalUUIDs.add(forwardTerminalUUID);
|
|
439
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
440
|
-
cePoints: [...dopConductingEquipment], cnPoints: [...dopForwardConnectivityNode],
|
|
441
|
-
terminalUuid: forwardTerminalUUID
|
|
442
|
-
});
|
|
443
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
// END: Terminal-Export
|
|
447
|
-
/* ---------- ---------- ---------- */
|
|
448
|
-
return resultingDiagramObjects;
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* convertSchemaTransformer2W
|
|
453
|
-
*/
|
|
454
|
-
convertSchemaTransformer2W(nsgTrafo2w) {
|
|
455
|
-
var _a, _b;
|
|
456
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
457
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgTrafo2w.variantennr, id: nsgTrafo2w.nsgso }, false);
|
|
458
|
-
if (!nsgStandort)
|
|
459
|
-
return null;
|
|
460
|
-
const netzTrafo2W = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_trafo2w, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgTrafo2w.trafo2w });
|
|
461
|
-
if (!netzTrafo2W)
|
|
462
|
-
return;
|
|
463
|
-
const powerTransformerUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgTrafo2w.trafo2w })) !== null && _b !== void 0 ? _b : undefined;
|
|
464
|
-
let centerTransformer = [null, null];
|
|
465
|
-
let positionAnschlussanf = [null, null];
|
|
466
|
-
let positionAnschlussend = [null, null];
|
|
467
|
-
switch (nsgTrafo2w.ausrichtung) {
|
|
468
|
-
case 0: // (left) anschlussend <-00-> anschlussanf (right)
|
|
469
|
-
centerTransformer[0] = 24;
|
|
470
|
-
centerTransformer[1] = 16;
|
|
471
|
-
positionAnschlussanf[0] = 48;
|
|
472
|
-
positionAnschlussanf[1] = 16;
|
|
473
|
-
positionAnschlussend[0] = 0;
|
|
474
|
-
positionAnschlussend[1] = 16;
|
|
475
|
-
break;
|
|
476
|
-
case 1: // (top) anschlussend <-00-> anschlussanf (bottom)
|
|
477
|
-
centerTransformer[0] = 16;
|
|
478
|
-
centerTransformer[1] = 24;
|
|
479
|
-
positionAnschlussanf[0] = 16;
|
|
480
|
-
positionAnschlussanf[1] = 48;
|
|
481
|
-
positionAnschlussend[0] = 16;
|
|
482
|
-
positionAnschlussend[1] = 0;
|
|
483
|
-
break;
|
|
484
|
-
case 2: // (left) anschlussanf <-00-> anschlussend (right)
|
|
485
|
-
centerTransformer[0] = 24;
|
|
486
|
-
centerTransformer[1] = 16;
|
|
487
|
-
positionAnschlussanf[0] = 0;
|
|
488
|
-
positionAnschlussanf[1] = 16;
|
|
489
|
-
positionAnschlussend[0] = 48;
|
|
490
|
-
positionAnschlussend[1] = 16;
|
|
491
|
-
break;
|
|
492
|
-
case 3: // (top) anschlussanf <-00-> anschlussend (bottom)
|
|
493
|
-
centerTransformer[0] = 16;
|
|
494
|
-
centerTransformer[1] = 24;
|
|
495
|
-
positionAnschlussanf[0] = 16;
|
|
496
|
-
positionAnschlussanf[1] = 0;
|
|
497
|
-
positionAnschlussend[0] = 16;
|
|
498
|
-
positionAnschlussend[1] = 48;
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
// rotation 0 means: <-00->
|
|
502
|
-
const powerTransformerDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
503
|
-
xPosition: centerTransformer[0],
|
|
504
|
-
yPosition: centerTransformer[1],
|
|
505
|
-
rotation: util_functions_1.DLUtilFunctions.getRotationBasedOnTrafo2W(nsgTrafo2w.ausrichtung),
|
|
506
|
-
diagramObjectName: `NetzTrafo ${netzTrafo2W.id}`,
|
|
507
|
-
identifiedObjectUUID: powerTransformerUUID
|
|
508
|
-
});
|
|
509
|
-
const createdDiagramObjects = [];
|
|
510
|
-
createdDiagramObjects.push(powerTransformerDiagramObject);
|
|
511
|
-
const terminal1DiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
512
|
-
xPosition: positionAnschlussanf[0],
|
|
513
|
-
yPosition: positionAnschlussanf[1],
|
|
514
|
-
rotation: null,
|
|
515
|
-
diagramObjectName: 'Terminal 1',
|
|
516
|
-
identifiedObjectUUID: netzTrafo2W.guid_w1
|
|
517
|
-
});
|
|
518
|
-
createdDiagramObjects.push(terminal1DiagramObject);
|
|
519
|
-
const terminal2DiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
520
|
-
xPosition: positionAnschlussend[0],
|
|
521
|
-
yPosition: positionAnschlussend[1],
|
|
522
|
-
rotation: null,
|
|
523
|
-
diagramObjectName: 'Terminal 2',
|
|
524
|
-
identifiedObjectUUID: netzTrafo2W.guid_w2
|
|
525
|
-
});
|
|
526
|
-
createdDiagramObjects.push(terminal2DiagramObject);
|
|
527
|
-
for (const diagramObject of createdDiagramObjects) {
|
|
528
|
-
for (const diagramObjectPoint of diagramObject.diagramObjectPoints) {
|
|
529
|
-
diagramObjectPoint.xPosition += nsgTrafo2w.xrel;
|
|
530
|
-
diagramObjectPoint.yPosition += nsgTrafo2w.yrel;
|
|
531
|
-
diagramObjectPoint.xPosition += nsgStandort.xrel;
|
|
532
|
-
diagramObjectPoint.yPosition += nsgStandort.yrel;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
const doAKnotenConnectivityNode = this.exportedDiagramObjectsGraph[nsgTrafo2w.variantennr][netzTrafo2W.aknoten];
|
|
536
|
-
if (doAKnotenConnectivityNode) {
|
|
537
|
-
const dopAKnotenConnectivityNode = doAKnotenConnectivityNode.diagramObjectPoints[0];
|
|
538
|
-
util_functions_1.DLUtilFunctions.copyAndPushDiagramObjectPoint(terminal1DiagramObject, dopAKnotenConnectivityNode, false);
|
|
539
|
-
}
|
|
540
|
-
const doEKnotenConnectivityNode = this.exportedDiagramObjectsGraph[nsgTrafo2w.variantennr][netzTrafo2W.eknoten];
|
|
541
|
-
if (doEKnotenConnectivityNode) {
|
|
542
|
-
const dopEKnotenConnectivityNode = doEKnotenConnectivityNode.diagramObjectPoints[0];
|
|
543
|
-
util_functions_1.DLUtilFunctions.copyAndPushDiagramObjectPoint(terminal2DiagramObject, dopEKnotenConnectivityNode, false);
|
|
544
|
-
}
|
|
545
|
-
return createdDiagramObjects;
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* convertSchemaTransformer3W
|
|
550
|
-
*/
|
|
551
|
-
convertSchemaTransformer3W(nsgTrafo3w) {
|
|
552
|
-
var _a, _b;
|
|
553
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
554
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgTrafo3w.variantennr, id: nsgTrafo3w.nsgso }, false);
|
|
555
|
-
if (!nsgStandort)
|
|
556
|
-
return null;
|
|
557
|
-
const netzTrafo3w = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_trafo3w, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgTrafo3w.trafo3w });
|
|
558
|
-
if (!netzTrafo3w)
|
|
559
|
-
return null;
|
|
560
|
-
const powerTransformerUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgTrafo3w.trafo3w })) !== null && _b !== void 0 ? _b : undefined;
|
|
561
|
-
// Der relative Punkt des Transformators ist die linke obere Ecke bezogen auf die Bounding-Box
|
|
562
|
-
const trafoDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(constants_1.NsgConstants.TRAFO3W_WIDTH / 2, constants_1.NsgConstants.TRAFO3W_HEIGHT / 2);
|
|
563
|
-
const powerTransformerDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
564
|
-
xPosition: trafoDiagramObject.diagramObjectPoints[0].xPosition,
|
|
565
|
-
yPosition: trafoDiagramObject.diagramObjectPoints[0].yPosition,
|
|
566
|
-
rotation: (360 - (constants_1.NsgConstants.TAFO3W_RotationOrder.indexOf(nsgTrafo3w.ausrichtung) * 30 + 180) % 360) % 360,
|
|
567
|
-
diagramObjectName: 'PowerTransformer',
|
|
568
|
-
identifiedObjectUUID: powerTransformerUUID
|
|
569
|
-
});
|
|
570
|
-
// Ermittle die Auswechslung der Enden
|
|
571
|
-
const exchangeGroups = constants_1.NsgConstants.TRAFO3W_ExchangeGroups;
|
|
572
|
-
let exchangeGroup = undefined;
|
|
573
|
-
for (const key of Object.keys(exchangeGroups)) {
|
|
574
|
-
if (exchangeGroups[key].indexOf(nsgTrafo3w.ausrichtung) !== -1) {
|
|
575
|
-
exchangeGroup = constants_1.NsgConstants.TRAFO3W_ExchangeMap[key];
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
// Ermittle die 'default'-Positionen der Enden ohne Berücksichtigung der Auswechslungen
|
|
580
|
-
const rotationenGroups = constants_1.NsgConstants.TRAFO3W_RotationGroups;
|
|
581
|
-
let rotationenGroup = undefined;
|
|
582
|
-
for (const key of Object.keys(rotationenGroups)) {
|
|
583
|
-
if (rotationenGroups[key].indexOf(nsgTrafo3w.ausrichtung) !== -1) {
|
|
584
|
-
rotationenGroup = constants_1.NsgConstants.TRAFO3W_RotationGroup2Positions[key];
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
// Falls eine x-Spiegelung vorliegt, tausche die Werte der Enden 2 und 3 miteinander
|
|
589
|
-
const xMirroring = nsgTrafo3w.orientierung_cw === 1;
|
|
590
|
-
const createdDiagramObjects = [];
|
|
591
|
-
createdDiagramObjects.push(powerTransformerDiagramObject);
|
|
592
|
-
const terminal1DiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
593
|
-
xPosition: rotationenGroup[exchangeGroup[1]][0],
|
|
594
|
-
yPosition: rotationenGroup[exchangeGroup[1]][1],
|
|
595
|
-
diagramObjectName: 'Terminal 1',
|
|
596
|
-
identifiedObjectUUID: netzTrafo3w.guid_w1
|
|
597
|
-
});
|
|
598
|
-
createdDiagramObjects.push(terminal1DiagramObject);
|
|
599
|
-
const terminal2DiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
600
|
-
xPosition: rotationenGroup[exchangeGroup[xMirroring ? 3 : 2]][0],
|
|
601
|
-
yPosition: rotationenGroup[exchangeGroup[xMirroring ? 3 : 2]][1],
|
|
602
|
-
diagramObjectName: 'Terminal 2',
|
|
603
|
-
identifiedObjectUUID: netzTrafo3w.guid_w2
|
|
604
|
-
});
|
|
605
|
-
createdDiagramObjects.push(terminal2DiagramObject);
|
|
606
|
-
const terminal3DiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
607
|
-
xPosition: rotationenGroup[exchangeGroup[xMirroring ? 2 : 3]][0],
|
|
608
|
-
yPosition: rotationenGroup[exchangeGroup[xMirroring ? 2 : 3]][1],
|
|
609
|
-
diagramObjectName: 'Terminal 3',
|
|
610
|
-
identifiedObjectUUID: netzTrafo3w.guid_w3
|
|
611
|
-
});
|
|
612
|
-
createdDiagramObjects.push(terminal3DiagramObject);
|
|
613
|
-
for (const diagramObject of createdDiagramObjects) {
|
|
614
|
-
for (const diagramObjectPoint of diagramObject.diagramObjectPoints) {
|
|
615
|
-
diagramObjectPoint.xPosition += nsgTrafo3w.xrel;
|
|
616
|
-
diagramObjectPoint.yPosition += nsgTrafo3w.yrel;
|
|
617
|
-
diagramObjectPoint.xPosition += nsgStandort.xrel;
|
|
618
|
-
diagramObjectPoint.yPosition += nsgStandort.yrel;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
// if (nsgTrafo3w.orientierung_cw === 0) {
|
|
622
|
-
// // w1
|
|
623
|
-
// // 0
|
|
624
|
-
// // w2 <-0 0-> w3
|
|
625
|
-
const w1TypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
626
|
-
variantennr: nsgTrafo3w.variantennr, id: nsgTrafo3w.anschluss_w1
|
|
627
|
-
});
|
|
628
|
-
if (w1TypedResult) {
|
|
629
|
-
const w1ConnectivityNodePosition = yield this.getConnectivityNodePositionFor(w1TypedResult.type, w1TypedResult.object);
|
|
630
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(terminal1DiagramObject, w1ConnectivityNodePosition, false);
|
|
631
|
-
}
|
|
632
|
-
const w2TypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
633
|
-
variantennr: nsgTrafo3w.variantennr, id: nsgTrafo3w.anschluss_w2
|
|
634
|
-
});
|
|
635
|
-
if (w2TypedResult) {
|
|
636
|
-
const w2ConnectivityNodePosition = yield this.getConnectivityNodePositionFor(w2TypedResult.type, w2TypedResult.object);
|
|
637
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(terminal2DiagramObject, w2ConnectivityNodePosition, false);
|
|
638
|
-
}
|
|
639
|
-
const w3TypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
640
|
-
variantennr: nsgTrafo3w.variantennr, id: nsgTrafo3w.anschluss_w3
|
|
641
|
-
});
|
|
642
|
-
if (w3TypedResult) {
|
|
643
|
-
const w3ConnectivityNodePosition = yield this.getConnectivityNodePositionFor(w3TypedResult.type, w3TypedResult.object);
|
|
644
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(terminal3DiagramObject, w3ConnectivityNodePosition, false);
|
|
645
|
-
}
|
|
646
|
-
return createdDiagramObjects;
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* getConnectivityNodePositionFor
|
|
651
|
-
*/
|
|
652
|
-
getConnectivityNodePositionFor(i7ObjectType, object) {
|
|
653
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
654
|
-
const leftUpperCorner = yield this.getLeftUpperCornerOf(i7ObjectType, object);
|
|
655
|
-
if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgknotenso) {
|
|
656
|
-
return [leftUpperCorner[0] + 16, leftUpperCorner[1] + 16];
|
|
657
|
-
}
|
|
658
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld) {
|
|
659
|
-
const nsgSchaltfeld = object;
|
|
660
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltfeld.variantennr, id: nsgSchaltfeld.nsgsaa });
|
|
661
|
-
if (!nsgSaabschnitt)
|
|
662
|
-
return;
|
|
663
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
664
|
-
if (nsgSchaltanlage === undefined)
|
|
665
|
-
return;
|
|
666
|
-
let orientation = nsgSchaltanlage.ausrichtung;
|
|
667
|
-
if (nsgSchaltfeld.deltaausrichtung === 1) {
|
|
668
|
-
orientation = (orientation + 2) % 4;
|
|
669
|
-
}
|
|
670
|
-
switch (orientation) {
|
|
671
|
-
case 0: // TOP
|
|
672
|
-
return [leftUpperCorner[0] + 16, leftUpperCorner[1]];
|
|
673
|
-
case 1: // RIGHT
|
|
674
|
-
return [leftUpperCorner[0] + nsgSchaltfeld.hoehe, leftUpperCorner[1] + 16];
|
|
675
|
-
case 2: // BOTTOM
|
|
676
|
-
return [leftUpperCorner[0] + 16, leftUpperCorner[1] + nsgSchaltfeld.hoehe];
|
|
677
|
-
case 3: // LEFT
|
|
678
|
-
return [leftUpperCorner[0], leftUpperCorner[1] + 16];
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
return [null, null];
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* convertSchemaLeitung
|
|
686
|
-
*/
|
|
687
|
-
convertSchemaLeitung(nsgLeitung, splitLine = true) {
|
|
688
|
-
var _a, _b, _c, _d;
|
|
689
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
690
|
-
let netzLeitung;
|
|
691
|
-
netzLeitung = yield this.dbObjectGraph.findObjectByKey([
|
|
692
|
-
convert_graph_keys_1.i7TableNames.netz_leitung, convert_graph_keys_1.i7TableNames.netz_hgueleitung, convert_graph_keys_1.i7TableNames.netz_ersatzlaengszweig,
|
|
693
|
-
convert_graph_keys_1.i7TableNames.netz_streckenlast
|
|
694
|
-
], convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgLeitung.leitung });
|
|
695
|
-
if (!netzLeitung)
|
|
696
|
-
return;
|
|
697
|
-
if ('teilung' in netzLeitung) {
|
|
698
|
-
return this.convertNsgLeitungStreckenlast(nsgLeitung, netzLeitung, splitLine);
|
|
699
|
-
}
|
|
700
|
-
let generalNetzLeitung;
|
|
701
|
-
if ('anetzobjekt' in netzLeitung) {
|
|
702
|
-
generalNetzLeitung = {
|
|
703
|
-
id: netzLeitung.id,
|
|
704
|
-
bezeichner: netzLeitung.bezeichner,
|
|
705
|
-
kurzname: netzLeitung.kurzname,
|
|
706
|
-
aknoten: netzLeitung.anetzobjekt,
|
|
707
|
-
eknoten: netzLeitung.enetzobjekt,
|
|
708
|
-
aknotenzw: undefined, eknotenzw: undefined,
|
|
709
|
-
flakn3p: undefined, flekn3p: undefined
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
else {
|
|
713
|
-
generalNetzLeitung = netzLeitung;
|
|
714
|
-
}
|
|
715
|
-
const nsgLtgpunkte = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgltgpunkt, { nsgleitung: nsgLeitung.id });
|
|
716
|
-
// Manche Leitung beinhalten keine Zwischenpunkte, sondern verlaufen lediglich zwischen dem Start- und Endpunkt
|
|
717
|
-
// if (nsgLtgpunkte.length === 0) return;
|
|
718
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgLeitung.leitung })) !== null && _b !== void 0 ? _b : undefined;
|
|
719
|
-
nsgLtgpunkte.sort((a, b) => a.pos - b.pos);
|
|
720
|
-
const diagramObject = new DiagramObject_1.DiagramObject();
|
|
721
|
-
diagramObject.name = `Leitung ${generalNetzLeitung.id}`;
|
|
722
|
-
diagramObject.identifiedObjectUUID = cimObjectUUID;
|
|
723
|
-
diagramObject.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
724
|
-
diagramObject.rotation = null;
|
|
725
|
-
const relStartPos = yield this.getRelPos(nsgLeitung, true);
|
|
726
|
-
if (relStartPos === null)
|
|
727
|
-
return null;
|
|
728
|
-
const relEndPos = yield this.getRelPos(nsgLeitung, false);
|
|
729
|
-
if (relEndPos === null)
|
|
730
|
-
return null;
|
|
731
|
-
const leftUpperCornerStartPos = yield this.getLeftUpperCornerOfUnspecified(nsgLeitung.variantennr, nsgLeitung.anschlussanf);
|
|
732
|
-
const leftUpperCornerEndPos = yield this.getLeftUpperCornerOfUnspecified(nsgLeitung.variantennr, nsgLeitung.anschlussend);
|
|
733
|
-
for (let a = 0; a < nsgLtgpunkte.length; ++a) {
|
|
734
|
-
const nsgLtgpunkt = nsgLtgpunkte[a];
|
|
735
|
-
const diagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
736
|
-
diagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
737
|
-
diagramObject.diagramObjectPoints.push(diagramObjectPoint);
|
|
738
|
-
diagramObjectPoint.diagramObject = diagramObject;
|
|
739
|
-
if (nsgLtgpunkt.userelpos === 1) {
|
|
740
|
-
if (nsgLtgpunkt.reltoanf === 1) {
|
|
741
|
-
diagramObjectPoint.xPosition = leftUpperCornerStartPos[0] + nsgLtgpunkt.xrel;
|
|
742
|
-
diagramObjectPoint.yPosition = leftUpperCornerStartPos[1] + nsgLtgpunkt.yrel;
|
|
743
|
-
}
|
|
744
|
-
else if (nsgLtgpunkt.reltoanf === 0) {
|
|
745
|
-
diagramObjectPoint.xPosition = leftUpperCornerEndPos[0] + nsgLtgpunkt.xrel;
|
|
746
|
-
diagramObjectPoint.yPosition = leftUpperCornerEndPos[1] + nsgLtgpunkt.yrel;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
else {
|
|
750
|
-
diagramObjectPoint.xPosition = nsgLtgpunkt.xrel;
|
|
751
|
-
diagramObjectPoint.yPosition = nsgLtgpunkt.yrel;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
/*
|
|
755
|
-
left:
|
|
756
|
-
m: => x
|
|
757
|
-
c: => y
|
|
758
|
-
right:
|
|
759
|
-
m: => x * (-1)
|
|
760
|
-
c: => y * (-1)
|
|
761
|
-
top:
|
|
762
|
-
m: => y
|
|
763
|
-
c: => x * (-1)
|
|
764
|
-
bottom:
|
|
765
|
-
m: => y * (-1)
|
|
766
|
-
c: => x
|
|
767
|
-
*/
|
|
768
|
-
const firstDiagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
769
|
-
firstDiagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
770
|
-
firstDiagramObjectPoint.xPosition = relStartPos[0]; // + xyOffsetFirstPoint[0];
|
|
771
|
-
firstDiagramObjectPoint.yPosition = relStartPos[1]; // + xyOffsetFirstPoint[1];
|
|
772
|
-
firstDiagramObjectPoint.diagramObject = diagramObject;
|
|
773
|
-
diagramObject.diagramObjectPoints.unshift(firstDiagramObjectPoint);
|
|
774
|
-
const lastDiagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
775
|
-
lastDiagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
776
|
-
lastDiagramObjectPoint.xPosition = relEndPos[0]; // + xyOffsetLastPoint[0];
|
|
777
|
-
lastDiagramObjectPoint.yPosition = relEndPos[1]; // + xyOffsetLastPoint[1];
|
|
778
|
-
lastDiagramObjectPoint.diagramObject = diagramObject;
|
|
779
|
-
diagramObject.diagramObjectPoints.push(lastDiagramObjectPoint);
|
|
780
|
-
for (let a = 0; a < diagramObject.diagramObjectPoints.length; ++a) {
|
|
781
|
-
diagramObject.diagramObjectPoints[a].xPosition += 2;
|
|
782
|
-
diagramObject.diagramObjectPoints[a].yPosition += 2;
|
|
783
|
-
diagramObject.diagramObjectPoints[a].sequenceNumber = a + 1;
|
|
784
|
-
}
|
|
785
|
-
const resultingDiagramObjects = [];
|
|
786
|
-
const uuidsOfPlacedCimObject = new Set();
|
|
787
|
-
const netzLeitungsabschnitte = yield this.dbObjectGraph.findAllByAttributes([convert_graph_keys_1.i7TableNames.netz_freileitungabschnitt, convert_graph_keys_1.i7TableNames.netz_kabelabschnitt], { leitung: nsgLeitung.leitung });
|
|
788
|
-
netzLeitungsabschnitte.sort((a, b) => a.pos - b.pos);
|
|
789
|
-
if (netzLeitungsabschnitte.length === 0) {
|
|
790
|
-
splitLine = false;
|
|
791
|
-
}
|
|
792
|
-
if (splitLine) {
|
|
793
|
-
/* ---------- ---------- ---------- */
|
|
794
|
-
// BEGIN: split the line into line segments
|
|
795
|
-
// const netzLeitungsabschnitte = await this.dbObjectGraph.findAllByAttributes(
|
|
796
|
-
// [i7TableNames.netz_freileitungabschnitt, i7TableNames.netz_kabelabschnitt],
|
|
797
|
-
// { leitung: nsgLeitung.leitung }
|
|
798
|
-
// );
|
|
799
|
-
// netzLeitungsabschnitte.sort((a, b) => a.pos - b.pos);
|
|
800
|
-
const segmentPercentages = [];
|
|
801
|
-
let completeLength = 0;
|
|
802
|
-
for (let a = 0; a < netzLeitungsabschnitte.length; ++a) {
|
|
803
|
-
completeLength += netzLeitungsabschnitte[a].laenge;
|
|
804
|
-
}
|
|
805
|
-
// Berechne die Prozent-Anteile eines Leitungsabschnittes bezogen auf die Gesamtlänge
|
|
806
|
-
let crtLength = 0;
|
|
807
|
-
for (let a = 0; a < netzLeitungsabschnitte.length; ++a) {
|
|
808
|
-
// todo fix if 'laenge' is null (equals to a not-set length)
|
|
809
|
-
crtLength += netzLeitungsabschnitte[a].laenge;
|
|
810
|
-
segmentPercentages.push(crtLength / completeLength);
|
|
811
|
-
}
|
|
812
|
-
const segments = util_functions_1.DLUtilFunctions.splitLineIntoLineSegments(segmentPercentages, diagramObject.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition]));
|
|
813
|
-
for (let a = 0; a < segments.length; ++a) {
|
|
814
|
-
const thisSegmentUUID = (_d = (_c = this.dbObjectKeyCimModelUuidGraph) === null || _c === void 0 ? void 0 : _c.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: netzLeitungsabschnitte[a].id })) !== null && _d !== void 0 ? _d : undefined;
|
|
815
|
-
const thisSegmentCimObject = this.cimModelGraph.findObjectByUUID(thisSegmentUUID);
|
|
816
|
-
const diagramObject = new DiagramObject_1.DiagramObject();
|
|
817
|
-
diagramObject.name = `Leitung ${generalNetzLeitung.id}`;
|
|
818
|
-
diagramObject.identifiedObjectUUID = thisSegmentUUID;
|
|
819
|
-
diagramObject.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
820
|
-
diagramObject.rotation = null;
|
|
821
|
-
// for (const segment of segments[a]) {
|
|
822
|
-
for (const segmentPoint of segments[a]) {
|
|
823
|
-
const diagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
824
|
-
diagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
825
|
-
diagramObjectPoint.xPosition = segmentPoint[0];
|
|
826
|
-
diagramObjectPoint.yPosition = segmentPoint[1];
|
|
827
|
-
diagramObjectPoint.sequenceNumber = diagramObject.diagramObjectPoints.length + 1;
|
|
828
|
-
diagramObjectPoint.diagramObject = diagramObject;
|
|
829
|
-
diagramObject.diagramObjectPoints.push(diagramObjectPoint);
|
|
830
|
-
}
|
|
831
|
-
// }
|
|
832
|
-
resultingDiagramObjects.push(diagramObject);
|
|
833
|
-
if (a === 0) {
|
|
834
|
-
// continue (will be added at the end)
|
|
835
|
-
}
|
|
836
|
-
else {
|
|
837
|
-
if (thisSegmentCimObject) {
|
|
838
|
-
// need to get the ConnectivityNode and the Terminal, which connects the current (this) with the prev segment
|
|
839
|
-
const prevSegment = netzLeitungsabschnitte[a - 1];
|
|
840
|
-
const prevSegmentUUID = this.dbObjectKeyCimModelUuidGraph.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: prevSegment.id });
|
|
841
|
-
const prevSegmentCimObject = this.cimModelGraph.findObjectByUUID(prevSegmentUUID);
|
|
842
|
-
let connectivityNodeUUIDThisToPrev;
|
|
843
|
-
let terminalUUIDThisToPrevConnectivityNode;
|
|
844
|
-
for (const thisTerminal of thisSegmentCimObject.terminals.values()) {
|
|
845
|
-
for (const prevTerminal of prevSegmentCimObject.terminals.values()) {
|
|
846
|
-
if (prevTerminal.getConnectivityNodeUUID() === thisTerminal.getConnectivityNodeUUID()) {
|
|
847
|
-
connectivityNodeUUIDThisToPrev = prevTerminal.getConnectivityNodeUUID();
|
|
848
|
-
terminalUUIDThisToPrevConnectivityNode = thisTerminal.getUUID();
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
if (terminalUUIDThisToPrevConnectivityNode) {
|
|
853
|
-
break;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
// place the ConnectivityNode (if not being placed cause => maybe a previous iteration has placed it)
|
|
857
|
-
if (!uuidsOfPlacedCimObject.has(connectivityNodeUUIDThisToPrev)) {
|
|
858
|
-
const doConnectivityNode = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
859
|
-
xPosition: segments[a][0][0],
|
|
860
|
-
yPosition: segments[a][0][1],
|
|
861
|
-
diagramObjectName: `CN ${a} - Netz-Leitung ${generalNetzLeitung.id}`,
|
|
862
|
-
identifiedObjectUUID: connectivityNodeUUIDThisToPrev
|
|
863
|
-
});
|
|
864
|
-
resultingDiagramObjects.push(doConnectivityNode);
|
|
865
|
-
}
|
|
866
|
-
// place the terminal
|
|
867
|
-
const doTerminal = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
868
|
-
xPosition: segments[a][0][0],
|
|
869
|
-
yPosition: segments[a][0][1],
|
|
870
|
-
diagramObjectName: `T (Anf) ${a} - Netz-Leitung ${generalNetzLeitung.id}`,
|
|
871
|
-
identifiedObjectUUID: terminalUUIDThisToPrevConnectivityNode
|
|
872
|
-
});
|
|
873
|
-
resultingDiagramObjects.push(doTerminal);
|
|
874
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(doTerminal, segments[a][0], true);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
if (a === segments.length - 1) {
|
|
878
|
-
// continue (will be added at the end)
|
|
879
|
-
}
|
|
880
|
-
else {
|
|
881
|
-
if (thisSegmentCimObject) {
|
|
882
|
-
// need to get the ConnectivityNode and the Terminal, which connects the current (this) with the next segment
|
|
883
|
-
const nextSegment = netzLeitungsabschnitte[a + 1];
|
|
884
|
-
const nextSegmentUUID = this.dbObjectKeyCimModelUuidGraph.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nextSegment.id });
|
|
885
|
-
const nextSegmentCimObject = this.cimModelGraph.findObjectByUUID(nextSegmentUUID);
|
|
886
|
-
let connectivityNodeUUIDThisToNext;
|
|
887
|
-
let terminalUUIDThisToNextConnectivityNode;
|
|
888
|
-
for (const thisTerminal of thisSegmentCimObject.terminals.values()) {
|
|
889
|
-
for (const nextTerminal of nextSegmentCimObject.terminals.values()) {
|
|
890
|
-
if (nextTerminal.getConnectivityNodeUUID() === thisTerminal.getConnectivityNodeUUID()) {
|
|
891
|
-
connectivityNodeUUIDThisToNext = nextTerminal.getConnectivityNodeUUID();
|
|
892
|
-
terminalUUIDThisToNextConnectivityNode = thisTerminal.getUUID();
|
|
893
|
-
break;
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
if (terminalUUIDThisToNextConnectivityNode) {
|
|
897
|
-
break;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
// place the ConnectivityNode (if not being placed cause => maybe a previous iteration has placed it)
|
|
901
|
-
if (!uuidsOfPlacedCimObject.has(connectivityNodeUUIDThisToNext)) {
|
|
902
|
-
const doConnectivityNode = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
903
|
-
xPosition: segments[a][segments[a].length - 1][0],
|
|
904
|
-
yPosition: segments[a][segments[a].length - 1][1],
|
|
905
|
-
diagramObjectName: `CN ${a} - Netz-Leitung ${generalNetzLeitung.id}`,
|
|
906
|
-
identifiedObjectUUID: connectivityNodeUUIDThisToNext
|
|
907
|
-
});
|
|
908
|
-
resultingDiagramObjects.push(doConnectivityNode);
|
|
909
|
-
}
|
|
910
|
-
// place the terminal
|
|
911
|
-
const doTerminal = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
912
|
-
xPosition: segments[a][segments[a].length - 1][0],
|
|
913
|
-
yPosition: segments[a][segments[a].length - 1][1],
|
|
914
|
-
diagramObjectName: `T (End) ${a} - Netz-Leitung ${generalNetzLeitung.id}`,
|
|
915
|
-
identifiedObjectUUID: terminalUUIDThisToNextConnectivityNode
|
|
916
|
-
});
|
|
917
|
-
resultingDiagramObjects.push(doTerminal);
|
|
918
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(doTerminal, segments[a][segments[a].length - 1], true);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
// END: split the line into line segments
|
|
923
|
-
/* ---------- ---------- ---------- */
|
|
924
|
-
}
|
|
925
|
-
else {
|
|
926
|
-
resultingDiagramObjects.push(diagramObject);
|
|
927
|
-
}
|
|
928
|
-
/* ---------- ---------- ---------- */
|
|
929
|
-
// BEGIN: export the first terminal
|
|
930
|
-
// try {
|
|
931
|
-
const anschlussanfTypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
932
|
-
variantennr: nsgLeitung.variantennr, id: nsgLeitung.anschlussanf
|
|
933
|
-
});
|
|
934
|
-
const aknotenTerminalUUID = this.lookupTerminalUUID(generalNetzLeitung.aknoten, generalNetzLeitung.id);
|
|
935
|
-
if (anschlussanfTypedResult && aknotenTerminalUUID) {
|
|
936
|
-
const connectivityNodePosition = yield this.getConnectivityNodePositionFor(anschlussanfTypedResult.type, anschlussanfTypedResult.object);
|
|
937
|
-
const anfTerminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
938
|
-
cePoints: [...connectivityNodePosition], cnPoints: [...connectivityNodePosition],
|
|
939
|
-
terminalUuid: aknotenTerminalUUID,
|
|
940
|
-
name: 'Terminal Leitung-Anf'
|
|
941
|
-
});
|
|
942
|
-
resultingDiagramObjects.push(anfTerminalDiagramObject);
|
|
943
|
-
}
|
|
944
|
-
const anschlussendTypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
945
|
-
variantennr: nsgLeitung.variantennr, id: nsgLeitung.anschlussend
|
|
946
|
-
});
|
|
947
|
-
const eknotenTerminalUUID = this.lookupTerminalUUID(generalNetzLeitung.eknoten, generalNetzLeitung.id);
|
|
948
|
-
if (anschlussendTypedResult && eknotenTerminalUUID) {
|
|
949
|
-
const connectivityNodePosition = yield this.getConnectivityNodePositionFor(anschlussendTypedResult.type, anschlussendTypedResult.object);
|
|
950
|
-
const endTerminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
951
|
-
cePoints: [...connectivityNodePosition], cnPoints: [...connectivityNodePosition],
|
|
952
|
-
terminalUuid: eknotenTerminalUUID,
|
|
953
|
-
name: 'Terminal Leitung-End'
|
|
954
|
-
});
|
|
955
|
-
resultingDiagramObjects.push(endTerminalDiagramObject);
|
|
956
|
-
}
|
|
957
|
-
// } catch (e) {
|
|
958
|
-
// console.log(e)
|
|
959
|
-
// }
|
|
960
|
-
// END: export the last terminal
|
|
961
|
-
/* ---------- ---------- ---------- */
|
|
962
|
-
return resultingDiagramObjects;
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
/**
|
|
966
|
-
* convertSchemaQuerzweig
|
|
967
|
-
*/
|
|
968
|
-
convertSchemaQuerzweig(nsgQuerzweig) {
|
|
969
|
-
var _a, _b;
|
|
970
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
971
|
-
const resultingDiagramObjects = [];
|
|
972
|
-
const typedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
973
|
-
variantennr: nsgQuerzweig.variantennr, id: nsgQuerzweig.bezugsobjekt
|
|
974
|
-
});
|
|
975
|
-
if (!typedResult)
|
|
976
|
-
return null;
|
|
977
|
-
const { type, object } = typedResult;
|
|
978
|
-
let xPosition = nsgQuerzweig.xrel + 8;
|
|
979
|
-
let yPosition = nsgQuerzweig.yrel + 8;
|
|
980
|
-
const querzweigWrapperObject = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, {
|
|
981
|
-
id: nsgQuerzweig.querzweig
|
|
982
|
-
});
|
|
983
|
-
if (!querzweigWrapperObject) {
|
|
984
|
-
return null;
|
|
985
|
-
}
|
|
986
|
-
if (querzweigWrapperObject.type === convert_graph_keys_1.i7TableNames.netz_hguekopfklassisch) {
|
|
987
|
-
xPosition += 8;
|
|
988
|
-
yPosition += 8;
|
|
989
|
-
}
|
|
990
|
-
else if (querzweigWrapperObject.type === convert_graph_keys_1.i7TableNames.netz_hguekopfvsc) {
|
|
991
|
-
xPosition += 8;
|
|
992
|
-
yPosition += 8;
|
|
993
|
-
}
|
|
994
|
-
const netzQuerzweig = querzweigWrapperObject.object;
|
|
995
|
-
if (type === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld) {
|
|
996
|
-
const nsgSchaltfeld = object;
|
|
997
|
-
const leftUpperCornerOfSchaltfeld = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld, nsgSchaltfeld);
|
|
998
|
-
xPosition += leftUpperCornerOfSchaltfeld[0];
|
|
999
|
-
yPosition += leftUpperCornerOfSchaltfeld[1];
|
|
1000
|
-
}
|
|
1001
|
-
else {
|
|
1002
|
-
return null;
|
|
1003
|
-
}
|
|
1004
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgQuerzweig.querzweig })) !== null && _b !== void 0 ? _b : undefined;
|
|
1005
|
-
const querzweigDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
1006
|
-
xPosition: xPosition,
|
|
1007
|
-
yPosition: yPosition,
|
|
1008
|
-
rotation: util_functions_1.DLUtilFunctions.getRotationBasedOnQuerzweig(nsgQuerzweig.ausrichtung),
|
|
1009
|
-
diagramObjectName: `DiagramObject ${nsgQuerzweig.querzweig}`,
|
|
1010
|
-
identifiedObjectUUID: cimObjectUUID
|
|
1011
|
-
});
|
|
1012
|
-
this.addExportedDiagramObjectToGraph(nsgQuerzweig.variantennr, nsgQuerzweig.querzweig, querzweigDiagramObject);
|
|
1013
|
-
resultingDiagramObjects.push(querzweigDiagramObject);
|
|
1014
|
-
/* ---------- ---------- ---------- */
|
|
1015
|
-
// BEGIN: Terminal-Export
|
|
1016
|
-
const doBackwardConnectivityNode = this.exportedDiagramObjectsGraph[nsgQuerzweig.variantennr][netzQuerzweig.anschluss];
|
|
1017
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1018
|
-
const dopConductingEquipment = querzweigDiagramObject.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1019
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(netzQuerzweig.anschluss, nsgQuerzweig.querzweig);
|
|
1020
|
-
if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
1021
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
1022
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1023
|
-
cePoints: [...dopConductingEquipment], cnPoints: [...dopBackwardConnectivityNode],
|
|
1024
|
-
terminalUuid: backwardTerminalUUID
|
|
1025
|
-
});
|
|
1026
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
1027
|
-
}
|
|
1028
|
-
// END: Terminal-Export
|
|
1029
|
-
/* ---------- ---------- ---------- */
|
|
1030
|
-
return resultingDiagramObjects;
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* convertNsgLeitungStreckenlast
|
|
1035
|
-
*/
|
|
1036
|
-
convertNsgLeitungStreckenlast(nsgLeitung, netzStreckenlast, splitLine = true) {
|
|
1037
|
-
var _a, _b, _c, _d;
|
|
1038
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1039
|
-
const nsgLtgpunkte = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgltgpunkt, { nsgleitung: nsgLeitung.id });
|
|
1040
|
-
// Manche Leitung beinhalten keine Zwischenpunkte, sondern verlaufen lediglich zwischen dem Start- und Endpunkt
|
|
1041
|
-
// if (nsgLtgpunkte.length === 0) return;
|
|
1042
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgLeitung.leitung })) !== null && _b !== void 0 ? _b : undefined;
|
|
1043
|
-
nsgLtgpunkte.sort((a, b) => a.pos - b.pos);
|
|
1044
|
-
const diagramObject = new DiagramObject_1.DiagramObject();
|
|
1045
|
-
diagramObject.name = `Streckenlast ${netzStreckenlast.id}`;
|
|
1046
|
-
diagramObject.identifiedObjectUUID = cimObjectUUID;
|
|
1047
|
-
diagramObject.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
1048
|
-
diagramObject.rotation = null;
|
|
1049
|
-
const relStartPos = yield this.getRelPos(nsgLeitung, true);
|
|
1050
|
-
if (relStartPos === null)
|
|
1051
|
-
return null;
|
|
1052
|
-
const relEndPos = yield this.getRelPos(nsgLeitung, false);
|
|
1053
|
-
if (relEndPos === null)
|
|
1054
|
-
return null;
|
|
1055
|
-
const leftUpperCornerStartPos = yield this.getLeftUpperCornerOfUnspecified(nsgLeitung.variantennr, nsgLeitung.anschlussanf);
|
|
1056
|
-
const leftUpperCornerEndPos = yield this.getLeftUpperCornerOfUnspecified(nsgLeitung.variantennr, nsgLeitung.anschlussend);
|
|
1057
|
-
for (let a = 0; a < nsgLtgpunkte.length; ++a) {
|
|
1058
|
-
const nsgLtgpunkt = nsgLtgpunkte[a];
|
|
1059
|
-
const diagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
1060
|
-
diagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
1061
|
-
diagramObject.diagramObjectPoints.push(diagramObjectPoint);
|
|
1062
|
-
diagramObjectPoint.diagramObject = diagramObject;
|
|
1063
|
-
if (nsgLtgpunkt.userelpos === 1) {
|
|
1064
|
-
if (nsgLtgpunkt.reltoanf === 1) {
|
|
1065
|
-
diagramObjectPoint.xPosition = leftUpperCornerStartPos[0] + nsgLtgpunkt.xrel;
|
|
1066
|
-
diagramObjectPoint.yPosition = leftUpperCornerStartPos[1] + nsgLtgpunkt.yrel;
|
|
1067
|
-
}
|
|
1068
|
-
else if (nsgLtgpunkt.reltoanf === 0) {
|
|
1069
|
-
diagramObjectPoint.xPosition = leftUpperCornerEndPos[0] + nsgLtgpunkt.xrel;
|
|
1070
|
-
diagramObjectPoint.yPosition = leftUpperCornerEndPos[1] + nsgLtgpunkt.yrel;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
diagramObjectPoint.xPosition = nsgLtgpunkt.xrel;
|
|
1075
|
-
diagramObjectPoint.yPosition = nsgLtgpunkt.yrel;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
/*
|
|
1079
|
-
left:
|
|
1080
|
-
m: => x
|
|
1081
|
-
c: => y
|
|
1082
|
-
right:
|
|
1083
|
-
m: => x * (-1)
|
|
1084
|
-
c: => y * (-1)
|
|
1085
|
-
top:
|
|
1086
|
-
m: => y
|
|
1087
|
-
c: => x * (-1)
|
|
1088
|
-
bottom:
|
|
1089
|
-
m: => y * (-1)
|
|
1090
|
-
c: => x
|
|
1091
|
-
*/
|
|
1092
|
-
const firstDiagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
1093
|
-
firstDiagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
1094
|
-
firstDiagramObjectPoint.xPosition = relStartPos[0]; // + xyOffsetFirstPoint[0];
|
|
1095
|
-
firstDiagramObjectPoint.yPosition = relStartPos[1]; // + xyOffsetFirstPoint[1];
|
|
1096
|
-
firstDiagramObjectPoint.diagramObject = diagramObject;
|
|
1097
|
-
diagramObject.diagramObjectPoints.unshift(firstDiagramObjectPoint);
|
|
1098
|
-
const lastDiagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
1099
|
-
lastDiagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
1100
|
-
lastDiagramObjectPoint.xPosition = relEndPos[0]; // + xyOffsetLastPoint[0];
|
|
1101
|
-
lastDiagramObjectPoint.yPosition = relEndPos[1]; // + xyOffsetLastPoint[1];
|
|
1102
|
-
lastDiagramObjectPoint.diagramObject = diagramObject;
|
|
1103
|
-
diagramObject.diagramObjectPoints.push(lastDiagramObjectPoint);
|
|
1104
|
-
for (let a = 0; a < diagramObject.diagramObjectPoints.length; ++a) {
|
|
1105
|
-
diagramObject.diagramObjectPoints[a].xPosition += 2;
|
|
1106
|
-
diagramObject.diagramObjectPoints[a].yPosition += 2;
|
|
1107
|
-
diagramObject.diagramObjectPoints[a].sequenceNumber = a + 1;
|
|
1108
|
-
}
|
|
1109
|
-
const resultingDiagramObjects = [];
|
|
1110
|
-
const uuidsOfPlacedCimObject = new Set();
|
|
1111
|
-
const netzLeitungsabschnitte = yield this.dbObjectGraph.findAllByAttributes([convert_graph_keys_1.i7TableNames.netz_freileitungabschnitt, convert_graph_keys_1.i7TableNames.netz_kabelabschnitt], { leitung: nsgLeitung.leitung });
|
|
1112
|
-
netzLeitungsabschnitte.sort((a, b) => a.pos - b.pos);
|
|
1113
|
-
if (netzLeitungsabschnitte.length === 0) {
|
|
1114
|
-
splitLine = false;
|
|
1115
|
-
}
|
|
1116
|
-
if (splitLine) {
|
|
1117
|
-
/* ---------- ---------- ---------- */
|
|
1118
|
-
// BEGIN: split the line into line segments
|
|
1119
|
-
// const netzLeitungsabschnitte = await this.dbObjectGraph.findAllByAttributes(
|
|
1120
|
-
// [i7TableNames.netz_freileitungabschnitt, i7TableNames.netz_kabelabschnitt],
|
|
1121
|
-
// { leitung: nsgLeitung.leitung }
|
|
1122
|
-
// );
|
|
1123
|
-
// netzLeitungsabschnitte.sort((a, b) => a.pos - b.pos);
|
|
1124
|
-
const segmentPercentages = [];
|
|
1125
|
-
let completeLength = 0;
|
|
1126
|
-
for (let a = 0; a < netzLeitungsabschnitte.length; ++a) {
|
|
1127
|
-
completeLength += netzLeitungsabschnitte[a].laenge;
|
|
1128
|
-
}
|
|
1129
|
-
// Berechne die Prozent-Anteile eines Leitungsabschnittes bezogen auf die Gesamtlänge
|
|
1130
|
-
let crtLength = 0;
|
|
1131
|
-
for (let a = 0; a < netzLeitungsabschnitte.length; ++a) {
|
|
1132
|
-
// todo fix if 'laenge' is null (equals to a not-set length)
|
|
1133
|
-
crtLength += netzLeitungsabschnitte[a].laenge;
|
|
1134
|
-
segmentPercentages.push(crtLength / completeLength);
|
|
1135
|
-
}
|
|
1136
|
-
const segments = util_functions_1.DLUtilFunctions.splitLineIntoLineSegments(segmentPercentages, diagramObject.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition]));
|
|
1137
|
-
for (let a = 0; a < segments.length; ++a) {
|
|
1138
|
-
const thisSegmentUUID = (_d = (_c = this.dbObjectKeyCimModelUuidGraph) === null || _c === void 0 ? void 0 : _c.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: netzLeitungsabschnitte[a].id })) !== null && _d !== void 0 ? _d : undefined;
|
|
1139
|
-
const thisSegmentCimObject = this.cimModelGraph.findObjectByUUID(thisSegmentUUID);
|
|
1140
|
-
const diagramObject = new DiagramObject_1.DiagramObject();
|
|
1141
|
-
diagramObject.name = `Leitung ${netzStreckenlast.id}`;
|
|
1142
|
-
diagramObject.identifiedObjectUUID = thisSegmentUUID;
|
|
1143
|
-
diagramObject.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
1144
|
-
diagramObject.rotation = null;
|
|
1145
|
-
// for (const segment of segments[a]) {
|
|
1146
|
-
for (const segmentPoint of segments[a]) {
|
|
1147
|
-
const diagramObjectPoint = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
1148
|
-
diagramObjectPoint.mrid = common_utils_1.CommonUtils.generateUUID();
|
|
1149
|
-
diagramObjectPoint.xPosition = segmentPoint[0];
|
|
1150
|
-
diagramObjectPoint.yPosition = segmentPoint[1];
|
|
1151
|
-
diagramObjectPoint.sequenceNumber = diagramObject.diagramObjectPoints.length + 1;
|
|
1152
|
-
diagramObjectPoint.diagramObject = diagramObject;
|
|
1153
|
-
diagramObject.diagramObjectPoints.push(diagramObjectPoint);
|
|
1154
|
-
}
|
|
1155
|
-
// }
|
|
1156
|
-
resultingDiagramObjects.push(diagramObject);
|
|
1157
|
-
if (a === 0) {
|
|
1158
|
-
// continue (will be added at the end)
|
|
1159
|
-
}
|
|
1160
|
-
else {
|
|
1161
|
-
if (thisSegmentCimObject) {
|
|
1162
|
-
// need to get the ConnectivityNode and the Terminal, which connects the current (this) with the prev segment
|
|
1163
|
-
const prevSegment = netzLeitungsabschnitte[a - 1];
|
|
1164
|
-
const prevSegmentUUID = this.dbObjectKeyCimModelUuidGraph.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: prevSegment.id });
|
|
1165
|
-
const prevSegmentCimObject = this.cimModelGraph.findObjectByUUID(prevSegmentUUID);
|
|
1166
|
-
let connectivityNodeUUIDThisToPrev;
|
|
1167
|
-
let terminalUUIDThisToPrevConnectivityNode;
|
|
1168
|
-
for (const thisTerminal of thisSegmentCimObject.terminals.values()) {
|
|
1169
|
-
for (const prevTerminal of prevSegmentCimObject.terminals.values()) {
|
|
1170
|
-
if (prevTerminal.getConnectivityNodeUUID() === thisTerminal.getConnectivityNodeUUID()) {
|
|
1171
|
-
connectivityNodeUUIDThisToPrev = prevTerminal.getConnectivityNodeUUID();
|
|
1172
|
-
terminalUUIDThisToPrevConnectivityNode = thisTerminal.getUUID();
|
|
1173
|
-
break;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
if (terminalUUIDThisToPrevConnectivityNode) {
|
|
1177
|
-
break;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
// place the ConnectivityNode (if not being placed cause => maybe a previous iteration has placed it)
|
|
1181
|
-
if (!uuidsOfPlacedCimObject.has(connectivityNodeUUIDThisToPrev)) {
|
|
1182
|
-
const doConnectivityNode = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
1183
|
-
xPosition: segments[a][0][0],
|
|
1184
|
-
yPosition: segments[a][0][1],
|
|
1185
|
-
diagramObjectName: `CN ${a} - Netz-Leitung ${netzStreckenlast.id}`,
|
|
1186
|
-
identifiedObjectUUID: connectivityNodeUUIDThisToPrev
|
|
1187
|
-
});
|
|
1188
|
-
resultingDiagramObjects.push(doConnectivityNode);
|
|
1189
|
-
}
|
|
1190
|
-
// place the terminal
|
|
1191
|
-
const doTerminal = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
1192
|
-
xPosition: segments[a][0][0],
|
|
1193
|
-
yPosition: segments[a][0][1],
|
|
1194
|
-
diagramObjectName: `T (Anf) ${a} - Netz-Leitung ${netzStreckenlast.id}`,
|
|
1195
|
-
identifiedObjectUUID: terminalUUIDThisToPrevConnectivityNode
|
|
1196
|
-
});
|
|
1197
|
-
resultingDiagramObjects.push(doTerminal);
|
|
1198
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(doTerminal, segments[a][0], true);
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
if (a === segments.length - 1) {
|
|
1202
|
-
// continue (will be added at the end)
|
|
1203
|
-
}
|
|
1204
|
-
else {
|
|
1205
|
-
if (thisSegmentCimObject) {
|
|
1206
|
-
// need to get the ConnectivityNode and the Terminal, which connects the current (this) with the next segment
|
|
1207
|
-
const nextSegment = netzLeitungsabschnitte[a + 1];
|
|
1208
|
-
const nextSegmentUUID = this.dbObjectKeyCimModelUuidGraph.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nextSegment.id });
|
|
1209
|
-
const nextSegmentCimObject = this.cimModelGraph.findObjectByUUID(nextSegmentUUID);
|
|
1210
|
-
let connectivityNodeUUIDThisToNext;
|
|
1211
|
-
let terminalUUIDThisToNextConnectivityNode;
|
|
1212
|
-
for (const thisTerminal of thisSegmentCimObject.terminals.values()) {
|
|
1213
|
-
for (const nextTerminal of nextSegmentCimObject.terminals.values()) {
|
|
1214
|
-
if (nextTerminal.getConnectivityNodeUUID() === thisTerminal.getConnectivityNodeUUID()) {
|
|
1215
|
-
connectivityNodeUUIDThisToNext = nextTerminal.getConnectivityNodeUUID();
|
|
1216
|
-
terminalUUIDThisToNextConnectivityNode = thisTerminal.getUUID();
|
|
1217
|
-
break;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
if (terminalUUIDThisToNextConnectivityNode) {
|
|
1221
|
-
break;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
// place the ConnectivityNode (if not being placed cause => maybe a previous iteration has placed it)
|
|
1225
|
-
if (!uuidsOfPlacedCimObject.has(connectivityNodeUUIDThisToNext)) {
|
|
1226
|
-
const doConnectivityNode = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
1227
|
-
xPosition: segments[a][segments[a].length - 1][0],
|
|
1228
|
-
yPosition: segments[a][segments[a].length - 1][1],
|
|
1229
|
-
diagramObjectName: `CN ${a} - Netz-Leitung ${netzStreckenlast.id}`,
|
|
1230
|
-
identifiedObjectUUID: connectivityNodeUUIDThisToNext
|
|
1231
|
-
});
|
|
1232
|
-
resultingDiagramObjects.push(doConnectivityNode);
|
|
1233
|
-
}
|
|
1234
|
-
// place the terminal
|
|
1235
|
-
const doTerminal = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
1236
|
-
xPosition: segments[a][segments[a].length - 1][0],
|
|
1237
|
-
yPosition: segments[a][segments[a].length - 1][1],
|
|
1238
|
-
diagramObjectName: `T (End) ${a} - Netz-Leitung ${netzStreckenlast.id}`,
|
|
1239
|
-
identifiedObjectUUID: terminalUUIDThisToNextConnectivityNode
|
|
1240
|
-
});
|
|
1241
|
-
resultingDiagramObjects.push(doTerminal);
|
|
1242
|
-
util_functions_1.DLUtilFunctions.copyAndPushXYCoordinates(doTerminal, segments[a][segments[a].length - 1], true);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
// END: split the line into line segments
|
|
1247
|
-
/* ---------- ---------- ---------- */
|
|
1248
|
-
}
|
|
1249
|
-
else {
|
|
1250
|
-
resultingDiagramObjects.push(diagramObject);
|
|
1251
|
-
}
|
|
1252
|
-
const netzLeitungen = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.netz_leitung, { streckenlast: netzStreckenlast.id });
|
|
1253
|
-
if (netzLeitungen.length === 2) {
|
|
1254
|
-
/* ---------- ---------- ---------- */
|
|
1255
|
-
// BEGIN: export the first and last terminal
|
|
1256
|
-
// try {
|
|
1257
|
-
const anfId = netzLeitungen[0].eknoten === netzLeitungen[1].aknoten ? netzLeitungen[0].aknoten : netzLeitungen[0].eknoten;
|
|
1258
|
-
const endId = netzLeitungen[0].aknoten === netzLeitungen[1].eknoten ? netzLeitungen[0].eknoten : netzLeitungen[0].aknoten;
|
|
1259
|
-
const doAnfConnectivityNode = this.exportedDiagramObjectsGraph[nsgLeitung.variantennr][anfId];
|
|
1260
|
-
const doEndConnectivityNode = this.exportedDiagramObjectsGraph[nsgLeitung.variantennr][endId];
|
|
1261
|
-
const anschlussanfTypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
1262
|
-
variantennr: nsgLeitung.variantennr, id: nsgLeitung.anschlussend
|
|
1263
|
-
});
|
|
1264
|
-
const anschlussendTypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
1265
|
-
variantennr: nsgLeitung.variantennr, id: nsgLeitung.anschlussend
|
|
1266
|
-
});
|
|
1267
|
-
const aknotenTerminalUUID = this.lookupTerminalUUID(anfId, netzStreckenlast.id);
|
|
1268
|
-
const eknotenTerminalUUID = this.lookupTerminalUUID(endId, netzStreckenlast.id);
|
|
1269
|
-
if (anschlussanfTypedResult && aknotenTerminalUUID && doAnfConnectivityNode) {
|
|
1270
|
-
const mappedPoint = [
|
|
1271
|
-
doAnfConnectivityNode.diagramObjectPoints[0].xPosition,
|
|
1272
|
-
doAnfConnectivityNode.diagramObjectPoints[0].yPosition
|
|
1273
|
-
];
|
|
1274
|
-
const anfTerminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1275
|
-
cePoints: [...mappedPoint], cnPoints: [...mappedPoint],
|
|
1276
|
-
terminalUuid: aknotenTerminalUUID,
|
|
1277
|
-
name: 'Terminal Leitung-Anf'
|
|
1278
|
-
});
|
|
1279
|
-
resultingDiagramObjects.push(anfTerminalDiagramObject);
|
|
1280
|
-
}
|
|
1281
|
-
if (anschlussendTypedResult && eknotenTerminalUUID && doEndConnectivityNode) {
|
|
1282
|
-
const mappedPoint = [
|
|
1283
|
-
doEndConnectivityNode.diagramObjectPoints[0].xPosition,
|
|
1284
|
-
doEndConnectivityNode.diagramObjectPoints[0].yPosition
|
|
1285
|
-
];
|
|
1286
|
-
const endTerminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1287
|
-
cePoints: [...mappedPoint], cnPoints: [...mappedPoint],
|
|
1288
|
-
terminalUuid: eknotenTerminalUUID,
|
|
1289
|
-
name: 'Terminal Leitung-End'
|
|
1290
|
-
});
|
|
1291
|
-
resultingDiagramObjects.push(endTerminalDiagramObject);
|
|
1292
|
-
}
|
|
1293
|
-
// END: export the first and last terminal
|
|
1294
|
-
/* ---------- ---------- ---------- */
|
|
1295
|
-
}
|
|
1296
|
-
else {
|
|
1297
|
-
console.error(`Streckenlast-Error: Expected exactly two lines for the Terminal-Export, but got ${netzLeitungen.length}!`);
|
|
1298
|
-
}
|
|
1299
|
-
return resultingDiagramObjects;
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
/**
|
|
1303
|
-
* convertSchemaQuerzweigqcont
|
|
1304
|
-
*/
|
|
1305
|
-
convertSchemaQuerzweigqzcont(nsgQuerzweigqzcont) {
|
|
1306
|
-
var _a, _b;
|
|
1307
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1308
|
-
const resultingDiagramObjects = [];
|
|
1309
|
-
const typedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
1310
|
-
variantennr: nsgQuerzweigqzcont.variantennr, id: nsgQuerzweigqzcont.bezugsobjekt
|
|
1311
|
-
});
|
|
1312
|
-
if (!typedResult)
|
|
1313
|
-
return null;
|
|
1314
|
-
const { type, object } = typedResult;
|
|
1315
|
-
let xPosition = nsgQuerzweigqzcont.xrel + 8;
|
|
1316
|
-
let yPosition = nsgQuerzweigqzcont.yrel + 8;
|
|
1317
|
-
const nsgQuerzweigqzContelems = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgquerzweigqzcontelem, { constainer: nsgQuerzweigqzcont.id });
|
|
1318
|
-
// if (!querzweigWrapperObject) {
|
|
1319
|
-
// return null;
|
|
1320
|
-
// }
|
|
1321
|
-
//
|
|
1322
|
-
// if (querzweigWrapperObject.type === i7TableNames.netz_hguekopfklassisch) {
|
|
1323
|
-
// xPosition += 8;
|
|
1324
|
-
// yPosition += 8;
|
|
1325
|
-
// } else if (querzweigWrapperObject.type === i7TableNames.netz_hguekopfvsc) {
|
|
1326
|
-
// xPosition += 8;
|
|
1327
|
-
// yPosition += 8;
|
|
1328
|
-
// }
|
|
1329
|
-
if (type === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld) {
|
|
1330
|
-
const nsgSchaltfeld = object;
|
|
1331
|
-
const leftUpperCornerOfSchaltfeld = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld, nsgSchaltfeld);
|
|
1332
|
-
xPosition += leftUpperCornerOfSchaltfeld[0];
|
|
1333
|
-
yPosition += leftUpperCornerOfSchaltfeld[1];
|
|
1334
|
-
}
|
|
1335
|
-
else {
|
|
1336
|
-
return null;
|
|
1337
|
-
}
|
|
1338
|
-
for (const nsgQuerzweigqzContelem of nsgQuerzweigqzContelems) {
|
|
1339
|
-
const querzweigWrapperObject = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, {
|
|
1340
|
-
id: nsgQuerzweigqzContelem.querzweig
|
|
1341
|
-
});
|
|
1342
|
-
const netzQuerzweig = querzweigWrapperObject.object;
|
|
1343
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgQuerzweigqzContelem.querzweig })) !== null && _b !== void 0 ? _b : undefined;
|
|
1344
|
-
const querzweigDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
1345
|
-
xPosition: xPosition,
|
|
1346
|
-
yPosition: yPosition,
|
|
1347
|
-
rotation: util_functions_1.DLUtilFunctions.getRotationBasedOnQuerzweig(nsgQuerzweigqzcont.ausrichtung),
|
|
1348
|
-
diagramObjectName: `DiagramObject ${nsgQuerzweigqzcont.querzweig}`,
|
|
1349
|
-
identifiedObjectUUID: cimObjectUUID
|
|
1350
|
-
});
|
|
1351
|
-
this.addExportedDiagramObjectToGraph(nsgQuerzweigqzcont.variantennr, nsgQuerzweigqzcont.querzweig, querzweigDiagramObject);
|
|
1352
|
-
resultingDiagramObjects.push(querzweigDiagramObject);
|
|
1353
|
-
/* ---------- ---------- ---------- */
|
|
1354
|
-
// BEGIN: Terminal-Export
|
|
1355
|
-
const doBackwardConnectivityNode = this.exportedDiagramObjectsGraph[nsgQuerzweigqzContelem.variantennr][netzQuerzweig.anschluss];
|
|
1356
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1357
|
-
const dopConductingEquipment = querzweigDiagramObject.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1358
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(netzQuerzweig.anschluss, nsgQuerzweigqzContelem.querzweig);
|
|
1359
|
-
if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
1360
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
1361
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1362
|
-
cePoints: [...dopConductingEquipment], cnPoints: [...dopBackwardConnectivityNode],
|
|
1363
|
-
terminalUuid: backwardTerminalUUID
|
|
1364
|
-
});
|
|
1365
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
1366
|
-
}
|
|
1367
|
-
// END: Terminal-Export
|
|
1368
|
-
/* ---------- ---------- ---------- */
|
|
1369
|
-
}
|
|
1370
|
-
return resultingDiagramObjects;
|
|
1371
|
-
});
|
|
1372
|
-
}
|
|
1373
|
-
/**
|
|
1374
|
-
* convertSchemaNsgLKupplungRss
|
|
1375
|
-
*/
|
|
1376
|
-
convertSchemaNsgLKupplungRss(nsgLKupplungRss) {
|
|
1377
|
-
var _a, _b;
|
|
1378
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1379
|
-
const resultingDiagramObjects = [];
|
|
1380
|
-
const netzLKupplung = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_lkupplung, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgLKupplungRss.lkupplung });
|
|
1381
|
-
if (!netzLKupplung)
|
|
1382
|
-
return;
|
|
1383
|
-
const nsgSaabschnittAnf = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplungRss.variantennr, id: nsgLKupplungRss.nsgsaa_anf });
|
|
1384
|
-
if (!nsgSaabschnittAnf)
|
|
1385
|
-
return;
|
|
1386
|
-
const nsgSaabschnittEnd = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplungRss.variantennr, id: nsgLKupplungRss.nsgsaa_end });
|
|
1387
|
-
if (!nsgSaabschnittEnd)
|
|
1388
|
-
return;
|
|
1389
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplungRss.variantennr, id: nsgSaabschnittAnf.nsgsa });
|
|
1390
|
-
if (!nsgSchaltanlage)
|
|
1391
|
-
return;
|
|
1392
|
-
const coordsSlotAnf = yield this.getLeftUpperCornerOfLKupplungRssElement(nsgLKupplungRss, { slot_anf: true });
|
|
1393
|
-
const coordsSelf = yield this.getLeftUpperCornerOfLKupplungRssElement(nsgLKupplungRss, { self: true });
|
|
1394
|
-
const coordsSlotEnd = yield this.getLeftUpperCornerOfLKupplungRssElement(nsgLKupplungRss, { slot_end: true });
|
|
1395
|
-
let coordsSelfAnfDock;
|
|
1396
|
-
let coordsSelfEndDock;
|
|
1397
|
-
let coordsSelfCenter;
|
|
1398
|
-
switch (nsgLKupplungRss.ausrichtung) {
|
|
1399
|
-
case 0:
|
|
1400
|
-
coordsSelfAnfDock = [coordsSelf[0] + 16, coordsSelf[1] + 8];
|
|
1401
|
-
coordsSelfCenter = [coordsSelf[0] + 8, coordsSelf[1] + 8];
|
|
1402
|
-
coordsSelfEndDock = [coordsSelf[0], coordsSelf[1] + 8];
|
|
1403
|
-
break;
|
|
1404
|
-
case 1:
|
|
1405
|
-
coordsSelfAnfDock = [coordsSelf[0] + 8, coordsSelf[1] + 16];
|
|
1406
|
-
coordsSelfCenter = [coordsSelf[0] + 8, coordsSelf[1] + 8];
|
|
1407
|
-
coordsSelfEndDock = [coordsSelf[0] + 8, coordsSelf[1]];
|
|
1408
|
-
break;
|
|
1409
|
-
case 2:
|
|
1410
|
-
coordsSelfAnfDock = [coordsSelf[0], coordsSelf[1] + 8];
|
|
1411
|
-
coordsSelfCenter = [coordsSelf[0] + 8, coordsSelf[1] + 8];
|
|
1412
|
-
coordsSelfEndDock = [coordsSelf[0] + 16, coordsSelf[1] + 8];
|
|
1413
|
-
break;
|
|
1414
|
-
case 3:
|
|
1415
|
-
coordsSelfAnfDock = [coordsSelf[0] + 8, coordsSelf[1]];
|
|
1416
|
-
coordsSelfCenter = [coordsSelf[0] + 8, coordsSelf[1] + 8];
|
|
1417
|
-
coordsSelfEndDock = [coordsSelf[0] + 8, coordsSelf[1] + 16];
|
|
1418
|
-
break;
|
|
1419
|
-
}
|
|
1420
|
-
let bendnodeOfAnf;
|
|
1421
|
-
let bendnodeOfEnd;
|
|
1422
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
1423
|
-
case 0:
|
|
1424
|
-
case 2:
|
|
1425
|
-
coordsSlotAnf[0] += 16;
|
|
1426
|
-
coordsSlotAnf[1] += 12;
|
|
1427
|
-
coordsSlotEnd[0] += 16;
|
|
1428
|
-
coordsSlotEnd[1] += 12;
|
|
1429
|
-
bendnodeOfAnf = [coordsSlotAnf[0], coordsSelfAnfDock[1]];
|
|
1430
|
-
bendnodeOfEnd = [coordsSlotEnd[0], coordsSelfEndDock[1]];
|
|
1431
|
-
break;
|
|
1432
|
-
case 1:
|
|
1433
|
-
case 3:
|
|
1434
|
-
coordsSlotAnf[0] += 12;
|
|
1435
|
-
coordsSlotAnf[1] += 16;
|
|
1436
|
-
coordsSlotEnd[0] += 12;
|
|
1437
|
-
coordsSlotEnd[1] += 16;
|
|
1438
|
-
bendnodeOfAnf = [coordsSelfAnfDock[0], coordsSlotAnf[1]];
|
|
1439
|
-
bendnodeOfEnd = [coordsSelfEndDock[0], coordsSlotEnd[1]];
|
|
1440
|
-
break;
|
|
1441
|
-
}
|
|
1442
|
-
const netzSsabs = yield this.dbObjectGraph.findByAttributes(convert_graph_keys_1.i7TableNames.netz_ssab, {
|
|
1443
|
-
saabschnitt: {
|
|
1444
|
-
in: [nsgSaabschnittAnf.saabschnitt, nsgSaabschnittEnd.saabschnitt]
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
const lkupplungNodes = yield this.getNodesOfLKupplung(netzLKupplung);
|
|
1448
|
-
const netzSsabsIds = new Set(netzSsabs.map(arg => arg.id));
|
|
1449
|
-
const ssabConnectedNodes = lkupplungNodes.filter(elem => netzSsabsIds.has(elem.aknoten) || netzSsabsIds.has(elem.eknoten));
|
|
1450
|
-
const nodePointMap = new Map();
|
|
1451
|
-
if (lkupplungNodes.length === 1 && netzSsabsIds.has(lkupplungNodes[0].aknoten) && netzSsabsIds.has(lkupplungNodes[0].eknoten)) {
|
|
1452
|
-
const rotationValue = 360 - (nsgLKupplungRss.ausrichtung + 1 % 4) * 90;
|
|
1453
|
-
const ssabConnectedNode = ssabConnectedNodes[0];
|
|
1454
|
-
const aKnotenSsab = netzSsabs.find(arg => arg.id === ssabConnectedNode.aknoten);
|
|
1455
|
-
const eKnotenSsab = netzSsabs.find(arg => arg.id === ssabConnectedNode.eknoten);
|
|
1456
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
1457
|
-
case 0:
|
|
1458
|
-
case 2:
|
|
1459
|
-
coordsSlotAnf[1] += aKnotenSsab.pos * 8;
|
|
1460
|
-
coordsSlotEnd[1] += eKnotenSsab.pos * 8;
|
|
1461
|
-
break;
|
|
1462
|
-
case 1:
|
|
1463
|
-
case 3:
|
|
1464
|
-
coordsSlotAnf[0] += aKnotenSsab.pos * 8;
|
|
1465
|
-
coordsSlotEnd[0] += eKnotenSsab.pos * 8;
|
|
1466
|
-
break;
|
|
1467
|
-
}
|
|
1468
|
-
if (yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_sestarr3p, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: ssabConnectedNode.id })) {
|
|
1469
|
-
// cause 'starre Verbindungen' are modelled as junctions, there must be two points extracted
|
|
1470
|
-
// those two points are equal to the connectivity node positions and the rotation value is unnecessary
|
|
1471
|
-
const aKnotenPosition = [...coordsSlotAnf];
|
|
1472
|
-
const eKnotenPosition = [...coordsSlotEnd];
|
|
1473
|
-
const junctionCoordinates = [coordsSelfAnfDock, coordsSelfEndDock];
|
|
1474
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoints(junctionCoordinates, null));
|
|
1475
|
-
nodePointMap.set(ssabConnectedNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
1476
|
-
nodePointMap.set(ssabConnectedNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
1477
|
-
}
|
|
1478
|
-
else {
|
|
1479
|
-
const aKnotenPosition = [...coordsSlotAnf];
|
|
1480
|
-
const eKnotenPosition = [...coordsSlotEnd];
|
|
1481
|
-
const switchCoordinates = [...coordsSelfCenter];
|
|
1482
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(switchCoordinates[0], switchCoordinates[1], rotationValue));
|
|
1483
|
-
nodePointMap.set(ssabConnectedNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
1484
|
-
nodePointMap.set(ssabConnectedNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
1485
|
-
}
|
|
1486
|
-
const terminalAnfUUID = this.lookupTerminalUUID(ssabConnectedNode.aknoten, ssabConnectedNode.id);
|
|
1487
|
-
// if (!this.exportedTerminalUUIDs.has(terminalAnfUUID)) {
|
|
1488
|
-
this.exportedTerminalUUIDs.add(terminalAnfUUID);
|
|
1489
|
-
const terminalAnfDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1490
|
-
points: [coordsSelfAnfDock, bendnodeOfAnf, coordsSlotAnf],
|
|
1491
|
-
terminalUuid: terminalAnfUUID
|
|
1492
|
-
});
|
|
1493
|
-
resultingDiagramObjects.push(terminalAnfDiagramObject);
|
|
1494
|
-
// }
|
|
1495
|
-
const terminalEndUUID = this.lookupTerminalUUID(ssabConnectedNode.eknoten, ssabConnectedNode.id);
|
|
1496
|
-
// if (!this.exportedTerminalUUIDs.has(terminalEndUUID)) {
|
|
1497
|
-
this.exportedTerminalUUIDs.add(terminalEndUUID);
|
|
1498
|
-
const terminalEndDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1499
|
-
points: [coordsSelfEndDock, bendnodeOfEnd, coordsSlotEnd],
|
|
1500
|
-
terminalUuid: terminalEndUUID
|
|
1501
|
-
});
|
|
1502
|
-
resultingDiagramObjects.push(terminalEndDiagramObject);
|
|
1503
|
-
// }
|
|
1504
|
-
}
|
|
1505
|
-
else if (lkupplungNodes.length === 2 &&
|
|
1506
|
-
(netzSsabsIds.has(lkupplungNodes[0].aknoten) || netzSsabsIds.has(lkupplungNodes[0].eknoten)) &&
|
|
1507
|
-
(netzSsabsIds.has(lkupplungNodes[1].aknoten) || netzSsabsIds.has(lkupplungNodes[1].eknoten))) {
|
|
1508
|
-
let aKnotenSsabNode;
|
|
1509
|
-
let aKnotenSsabId;
|
|
1510
|
-
let eKnotenSsabNode;
|
|
1511
|
-
let eKnotenSsabId;
|
|
1512
|
-
let inbetweenNodeId;
|
|
1513
|
-
if (netzSsabsIds.has(lkupplungNodes[0].aknoten)) {
|
|
1514
|
-
aKnotenSsabId = lkupplungNodes[0].aknoten;
|
|
1515
|
-
aKnotenSsabNode = lkupplungNodes[0];
|
|
1516
|
-
eKnotenSsabId = lkupplungNodes[1].eknoten;
|
|
1517
|
-
eKnotenSsabNode = lkupplungNodes[1];
|
|
1518
|
-
inbetweenNodeId = lkupplungNodes[1].aknoten;
|
|
1519
|
-
}
|
|
1520
|
-
else {
|
|
1521
|
-
aKnotenSsabId = lkupplungNodes[1].aknoten;
|
|
1522
|
-
aKnotenSsabNode = lkupplungNodes[1];
|
|
1523
|
-
eKnotenSsabId = lkupplungNodes[0].eknoten;
|
|
1524
|
-
eKnotenSsabNode = lkupplungNodes[0];
|
|
1525
|
-
inbetweenNodeId = lkupplungNodes[0].aknoten;
|
|
1526
|
-
}
|
|
1527
|
-
const aKnotenSsab = netzSsabs.find(arg => arg.id === aKnotenSsabNode.aknoten);
|
|
1528
|
-
const eKnotenSsab = netzSsabs.find(arg => arg.id === eKnotenSsabNode.eknoten);
|
|
1529
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
1530
|
-
case 0:
|
|
1531
|
-
case 2:
|
|
1532
|
-
coordsSlotAnf[1] += aKnotenSsab.pos * 8;
|
|
1533
|
-
coordsSlotEnd[1] += eKnotenSsab.pos * 8;
|
|
1534
|
-
break;
|
|
1535
|
-
case 1:
|
|
1536
|
-
case 3:
|
|
1537
|
-
coordsSlotAnf[0] += aKnotenSsab.pos * 8;
|
|
1538
|
-
coordsSlotEnd[0] += eKnotenSsab.pos * 8;
|
|
1539
|
-
break;
|
|
1540
|
-
}
|
|
1541
|
-
const aKnotenPosition = [...coordsSlotAnf];
|
|
1542
|
-
const eKnotenPosition = [...coordsSlotEnd];
|
|
1543
|
-
let rotationValue;
|
|
1544
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
1545
|
-
case 0:
|
|
1546
|
-
case 2:
|
|
1547
|
-
rotationValue = 0;
|
|
1548
|
-
break;
|
|
1549
|
-
case 1:
|
|
1550
|
-
case 3:
|
|
1551
|
-
rotationValue = 270;
|
|
1552
|
-
break;
|
|
1553
|
-
}
|
|
1554
|
-
nodePointMap.set(aKnotenSsabNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
1555
|
-
const terminalAnfUUID = this.lookupTerminalUUID(aKnotenSsabNode.aknoten, aKnotenSsabNode.id);
|
|
1556
|
-
// if (!this.exportedTerminalUUIDs.has(terminalAnfUUID)) {
|
|
1557
|
-
this.exportedTerminalUUIDs.add(terminalAnfUUID);
|
|
1558
|
-
const terminalAnfDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1559
|
-
points: [aKnotenPosition, aKnotenPosition],
|
|
1560
|
-
terminalUuid: terminalAnfUUID
|
|
1561
|
-
});
|
|
1562
|
-
resultingDiagramObjects.push(terminalAnfDiagramObject);
|
|
1563
|
-
// }
|
|
1564
|
-
nodePointMap.set(aKnotenSsabNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], rotationValue));
|
|
1565
|
-
const terminalAnfInbetweenUUID = this.lookupTerminalUUID(inbetweenNodeId, aKnotenSsabNode.id);
|
|
1566
|
-
// if (!this.exportedTerminalUUIDs.has(terminalAnfInbetweenUUID)) {
|
|
1567
|
-
this.exportedTerminalUUIDs.add(terminalAnfInbetweenUUID);
|
|
1568
|
-
const terminalAnfInbetweenDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1569
|
-
points: [aKnotenPosition, bendnodeOfAnf, coordsSelfCenter],
|
|
1570
|
-
terminalUuid: terminalAnfInbetweenUUID
|
|
1571
|
-
});
|
|
1572
|
-
resultingDiagramObjects.push(terminalAnfInbetweenDiagramObject);
|
|
1573
|
-
// }
|
|
1574
|
-
nodePointMap.set(inbetweenNodeId, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(coordsSelfCenter[0], coordsSelfCenter[1], null));
|
|
1575
|
-
const terminalEndInbetweenUUID = this.lookupTerminalUUID(inbetweenNodeId, eKnotenSsabNode.id);
|
|
1576
|
-
// if (!this.exportedTerminalUUIDs.has(terminalEndInbetweenUUID)) {
|
|
1577
|
-
this.exportedTerminalUUIDs.add(terminalEndInbetweenUUID);
|
|
1578
|
-
const terminalndInbetweenDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1579
|
-
points: [eKnotenPosition, bendnodeOfEnd, coordsSelfCenter],
|
|
1580
|
-
terminalUuid: terminalEndInbetweenUUID
|
|
1581
|
-
});
|
|
1582
|
-
resultingDiagramObjects.push(terminalndInbetweenDiagramObject);
|
|
1583
|
-
// }
|
|
1584
|
-
nodePointMap.set(eKnotenSsabNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], rotationValue));
|
|
1585
|
-
const terminalEndUUID = this.lookupTerminalUUID(eKnotenSsabNode.eknoten, eKnotenSsabNode.id);
|
|
1586
|
-
// if (!this.exportedTerminalUUIDs.has(terminalEndUUID)) {
|
|
1587
|
-
this.exportedTerminalUUIDs.add(terminalEndUUID);
|
|
1588
|
-
const terminalEndDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1589
|
-
points: [eKnotenPosition, eKnotenPosition],
|
|
1590
|
-
terminalUuid: terminalEndUUID
|
|
1591
|
-
});
|
|
1592
|
-
resultingDiagramObjects.push(terminalEndDiagramObject);
|
|
1593
|
-
// }
|
|
1594
|
-
nodePointMap.set(eKnotenSsabNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
1595
|
-
}
|
|
1596
|
-
else {
|
|
1597
|
-
for (const ssabConnectedNode of ssabConnectedNodes) {
|
|
1598
|
-
const idOfSsab = netzSsabsIds.has(ssabConnectedNode.aknoten) ? ssabConnectedNode.aknoten : ssabConnectedNode.eknoten;
|
|
1599
|
-
const leftUpperCornerOfSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === idOfSsab), nsgLKupplungRss.variantennr);
|
|
1600
|
-
// needed to get the correct behaviour for universal couplings
|
|
1601
|
-
const breakerNode = lkupplungNodes.find(arg => arg.aknoten === ssabConnectedNode.eknoten);
|
|
1602
|
-
if (netzSsabsIds.has(ssabConnectedNode.aknoten) && breakerNode) {
|
|
1603
|
-
// place on 'left' side of the coupling-field (but at the end of the busbar)
|
|
1604
|
-
let rotationValue;
|
|
1605
|
-
const position = [null, null];
|
|
1606
|
-
const aKnotenPosition = [null, null]; // connectivity node to busbar
|
|
1607
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
1608
|
-
case 0: // left to right
|
|
1609
|
-
position[0] = coordsSlotAnf[0];
|
|
1610
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
1611
|
-
rotationValue = 0;
|
|
1612
|
-
aKnotenPosition[0] = coordsSlotAnf[0];
|
|
1613
|
-
aKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
1614
|
-
break;
|
|
1615
|
-
case 1: // top to bottom
|
|
1616
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
1617
|
-
position[1] = coordsSlotAnf[1];
|
|
1618
|
-
rotationValue = 270;
|
|
1619
|
-
aKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
1620
|
-
aKnotenPosition[1] = coordsSlotAnf[1];
|
|
1621
|
-
break;
|
|
1622
|
-
case 2: // right to left
|
|
1623
|
-
position[0] = coordsSlotAnf[0];
|
|
1624
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
1625
|
-
rotationValue = 0;
|
|
1626
|
-
aKnotenPosition[0] = coordsSlotAnf[0];
|
|
1627
|
-
aKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
1628
|
-
break;
|
|
1629
|
-
case 3: // bottom to top
|
|
1630
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
1631
|
-
position[1] = coordsSlotAnf[1];
|
|
1632
|
-
rotationValue = 270;
|
|
1633
|
-
aKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
1634
|
-
aKnotenPosition[1] = coordsSlotAnf[1];
|
|
1635
|
-
break;
|
|
1636
|
-
}
|
|
1637
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
1638
|
-
nodePointMap.set(ssabConnectedNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
1639
|
-
}
|
|
1640
|
-
else {
|
|
1641
|
-
// place on 'right' side of the coupling-field (but at the start of the busbar)
|
|
1642
|
-
let rotationValue;
|
|
1643
|
-
const position = [null, null];
|
|
1644
|
-
const eKnotenPosition = [null, null]; // connectivity node to busbar
|
|
1645
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
1646
|
-
case 0: // left to right
|
|
1647
|
-
position[0] = coordsSlotEnd[0];
|
|
1648
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
1649
|
-
rotationValue = 0;
|
|
1650
|
-
eKnotenPosition[0] = coordsSlotEnd[0];
|
|
1651
|
-
eKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
1652
|
-
break;
|
|
1653
|
-
case 1: // top to bottom
|
|
1654
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
1655
|
-
position[1] = coordsSlotEnd[1];
|
|
1656
|
-
rotationValue = 270;
|
|
1657
|
-
eKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
1658
|
-
eKnotenPosition[1] = coordsSlotEnd[1];
|
|
1659
|
-
break;
|
|
1660
|
-
case 2: // right to left
|
|
1661
|
-
position[0] = coordsSlotEnd[0];
|
|
1662
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
1663
|
-
rotationValue = 0;
|
|
1664
|
-
eKnotenPosition[0] = coordsSlotEnd[0];
|
|
1665
|
-
eKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
1666
|
-
break;
|
|
1667
|
-
case 3: // bottom to top
|
|
1668
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
1669
|
-
position[1] = coordsSlotEnd[1];
|
|
1670
|
-
rotationValue = 270;
|
|
1671
|
-
eKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
1672
|
-
eKnotenPosition[1] = coordsSlotEnd[1];
|
|
1673
|
-
break;
|
|
1674
|
-
}
|
|
1675
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
1676
|
-
nodePointMap.set(
|
|
1677
|
-
// needed to get the correct behaviour for universal couplings
|
|
1678
|
-
netzSsabsIds.has(ssabConnectedNode.aknoten) ? ssabConnectedNode.aknoten : ssabConnectedNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
if (ssabConnectedNodes.length > 2) {
|
|
1682
|
-
// universal-coupling ==> breaker must be placed 'on top' of the coupling
|
|
1683
|
-
const startSsabConnectedNode = lkupplungNodes.filter(elem => netzSsabsIds.has(elem.aknoten));
|
|
1684
|
-
// if (startSsabConnectedNode.length === 1 && !nodePointMap.has(startSsabConnectedNode[0].eknoten)) {
|
|
1685
|
-
const breakerNode = lkupplungNodes.find(arg => arg.aknoten === startSsabConnectedNode[0].eknoten || arg.eknoten === startSsabConnectedNode[0].eknoten);
|
|
1686
|
-
const rotationValue = 360 - (nsgLKupplungRss.ausrichtung + 1 % 4) * 90;
|
|
1687
|
-
nodePointMap.set(breakerNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(coordsSelfCenter[0], coordsSelfCenter[1], rotationValue));
|
|
1688
|
-
nodePointMap.set(breakerNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(bendnodeOfAnf[0], bendnodeOfAnf[1], null));
|
|
1689
|
-
nodePointMap.set(breakerNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(bendnodeOfEnd[0], bendnodeOfEnd[1], null));
|
|
1690
|
-
}
|
|
1691
|
-
else {
|
|
1692
|
-
const startSsabConnectedNode = lkupplungNodes.filter(elem => netzSsabsIds.has(elem.aknoten));
|
|
1693
|
-
if (startSsabConnectedNode.length === 1 && !nodePointMap.has(startSsabConnectedNode[0].eknoten)) {
|
|
1694
|
-
const centeredNode = lkupplungNodes.find(arg => arg.aknoten === startSsabConnectedNode[0].eknoten);
|
|
1695
|
-
const rotationValue = 360 - (nsgLKupplungRss.ausrichtung + 1 % 4) * 90;
|
|
1696
|
-
nodePointMap.set(centeredNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(coordsSelfCenter[0], coordsSelfCenter[1], rotationValue));
|
|
1697
|
-
nodePointMap.set(centeredNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(bendnodeOfAnf[0], bendnodeOfAnf[1], null));
|
|
1698
|
-
nodePointMap.set(centeredNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(bendnodeOfEnd[0], bendnodeOfEnd[1], null));
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
/* ---------- ---------- ---------- */
|
|
1702
|
-
// BEGIN: Terminal-Export
|
|
1703
|
-
for (const lkupplungNode of lkupplungNodes) {
|
|
1704
|
-
const doBackwardConnectivityNode = nodePointMap.get(lkupplungNode.aknoten);
|
|
1705
|
-
const doConductingEquipment = nodePointMap.get(lkupplungNode.id);
|
|
1706
|
-
const doForwardConnectivityNode = nodePointMap.get(lkupplungNode.eknoten);
|
|
1707
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode === null || doBackwardConnectivityNode === void 0 ? void 0 : doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1708
|
-
const dopsConductingEquipment = doConductingEquipment === null || doConductingEquipment === void 0 ? void 0 : doConductingEquipment.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition]);
|
|
1709
|
-
const dopForwardConnectivityNode = doForwardConnectivityNode === null || doForwardConnectivityNode === void 0 ? void 0 : doForwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1710
|
-
if (!dopBackwardConnectivityNode || !dopsConductingEquipment || !dopForwardConnectivityNode)
|
|
1711
|
-
continue;
|
|
1712
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(lkupplungNode.aknoten, lkupplungNode.id);
|
|
1713
|
-
// if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
1714
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
1715
|
-
const terminalbackwardDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1716
|
-
cePoints: dopsConductingEquipment[0], cnPoints: dopBackwardConnectivityNode,
|
|
1717
|
-
terminalUuid: backwardTerminalUUID
|
|
1718
|
-
});
|
|
1719
|
-
resultingDiagramObjects.push(terminalbackwardDiagramObject);
|
|
1720
|
-
// }
|
|
1721
|
-
const forwardTerminalUUID = this.lookupTerminalUUID(lkupplungNode.eknoten, lkupplungNode.id);
|
|
1722
|
-
// if (!this.exportedTerminalUUIDs.has(forwardTerminalUUID)) {
|
|
1723
|
-
this.exportedTerminalUUIDs.add(forwardTerminalUUID);
|
|
1724
|
-
const terminalforwardDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1725
|
-
cePoints: dopsConductingEquipment[dopsConductingEquipment.length - 1], cnPoints: dopForwardConnectivityNode,
|
|
1726
|
-
terminalUuid: forwardTerminalUUID
|
|
1727
|
-
});
|
|
1728
|
-
resultingDiagramObjects.push(terminalforwardDiagramObject);
|
|
1729
|
-
// }
|
|
1730
|
-
}
|
|
1731
|
-
// END: Terminal-Export
|
|
1732
|
-
/* ---------- ---------- ---------- */
|
|
1733
|
-
}
|
|
1734
|
-
for (const nodePointEntry of nodePointMap.entries()) {
|
|
1735
|
-
const key = nodePointEntry[0];
|
|
1736
|
-
const value = nodePointEntry[1];
|
|
1737
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: key })) !== null && _b !== void 0 ? _b : undefined;
|
|
1738
|
-
value.identifiedObjectUUID = cimObjectUUID;
|
|
1739
|
-
resultingDiagramObjects.push(value);
|
|
1740
|
-
}
|
|
1741
|
-
return resultingDiagramObjects;
|
|
1742
|
-
});
|
|
1743
|
-
}
|
|
1744
|
-
/**
|
|
1745
|
-
* getRelPos
|
|
1746
|
-
*/
|
|
1747
|
-
getRelPos(nsgLeitung, aknoten) {
|
|
1748
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1749
|
-
// const netzLeitung = await this.dbObjectGraph.findObjectByKey(i7TableNames.netz_leitung,
|
|
1750
|
-
// i7SchemaKeyNames.IdOnlyKey, { id: nsgLeitung.leitung }
|
|
1751
|
-
// );
|
|
1752
|
-
// if (!netzLeitung) return;
|
|
1753
|
-
const idOfNsgKnoten = aknoten ? nsgLeitung.anschlussanf : nsgLeitung.anschlussend;
|
|
1754
|
-
const typedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
1755
|
-
variantennr: nsgLeitung.variantennr, id: idOfNsgKnoten
|
|
1756
|
-
});
|
|
1757
|
-
if (!typedResult)
|
|
1758
|
-
return null;
|
|
1759
|
-
const { type, object } = typedResult;
|
|
1760
|
-
if (type === convert_graph_keys_1.i7TableNames.nsg_nsgknotenso) {
|
|
1761
|
-
const relPos = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgknotenso, object);
|
|
1762
|
-
return [relPos[0] + 32 / 2 - 2, relPos[1] + 32 / 2 - 2];
|
|
1763
|
-
}
|
|
1764
|
-
else if (type === convert_graph_keys_1.i7TableNames.nsg_nsgknotenhgue) {
|
|
1765
|
-
const relPos = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgknotenhgue, object);
|
|
1766
|
-
return [relPos[0] + 32 / 2 - 2, relPos[1] + 32 / 2 - 2];
|
|
1767
|
-
}
|
|
1768
|
-
else if (type === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld) {
|
|
1769
|
-
const nsgSchaltfeld = object;
|
|
1770
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltfeld.variantennr, id: nsgSchaltfeld.nsgsaa });
|
|
1771
|
-
if (!nsgSaabschnitt)
|
|
1772
|
-
return;
|
|
1773
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
1774
|
-
if (nsgSchaltanlage === undefined)
|
|
1775
|
-
return;
|
|
1776
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltanlage.variantennr, id: nsgSchaltanlage.nsgso });
|
|
1777
|
-
if (!nsgStandort)
|
|
1778
|
-
return;
|
|
1779
|
-
let orientation = nsgSchaltanlage.ausrichtung;
|
|
1780
|
-
if (nsgSchaltfeld.deltaausrichtung === 1) {
|
|
1781
|
-
orientation = (orientation + 2) % 4;
|
|
1782
|
-
}
|
|
1783
|
-
const relPos = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld, nsgSchaltfeld);
|
|
1784
|
-
switch (orientation) {
|
|
1785
|
-
case 0: // TOP
|
|
1786
|
-
relPos[0] += 16;
|
|
1787
|
-
break;
|
|
1788
|
-
case 1: // RIGHT
|
|
1789
|
-
relPos[0] += nsgSchaltfeld.hoehe;
|
|
1790
|
-
relPos[1] += 16;
|
|
1791
|
-
break;
|
|
1792
|
-
case 2: // BOTTOM
|
|
1793
|
-
relPos[0] += 16;
|
|
1794
|
-
relPos[1] += nsgSchaltfeld.hoehe;
|
|
1795
|
-
break;
|
|
1796
|
-
case 3: // LEFT
|
|
1797
|
-
relPos[1] += 16;
|
|
1798
|
-
break;
|
|
1799
|
-
}
|
|
1800
|
-
relPos[0] -= 2;
|
|
1801
|
-
relPos[1] -= 2;
|
|
1802
|
-
return relPos;
|
|
1803
|
-
}
|
|
1804
|
-
else if (type === convert_graph_keys_1.i7TableNames.nsg_nsgquerzweig) {
|
|
1805
|
-
const relPos = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgquerzweig, object);
|
|
1806
|
-
return [relPos[0] + 32 / 2 - 2, relPos[1] + 32 / 2 - 2];
|
|
1807
|
-
}
|
|
1808
|
-
return [];
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
/**
|
|
1812
|
-
* convertSchemaKpfeld
|
|
1813
|
-
*/
|
|
1814
|
-
convertSchemaKpfeld(nsgKpfeld) {
|
|
1815
|
-
var _a, _b;
|
|
1816
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1817
|
-
const resultingDiagramObjects = [];
|
|
1818
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKpfeld.variantennr, id: nsgKpfeld.nsgsaa }, false);
|
|
1819
|
-
if (!nsgSaabschnitt)
|
|
1820
|
-
return;
|
|
1821
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKpfeld.variantennr, id: nsgSaabschnitt.nsgsa }, false);
|
|
1822
|
-
if (!nsgSchaltanlage)
|
|
1823
|
-
return;
|
|
1824
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKpfeld.variantennr, id: nsgSchaltanlage.nsgso }, false);
|
|
1825
|
-
if (!nsgStandort)
|
|
1826
|
-
return;
|
|
1827
|
-
const netzSsabs = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.netz_ssab, {
|
|
1828
|
-
saabschnitt: nsgSaabschnitt.saabschnitt
|
|
1829
|
-
});
|
|
1830
|
-
let couplerOrientation = nsgSchaltanlage.ausrichtung;
|
|
1831
|
-
if (nsgKpfeld.deltaausrichtung === 1) {
|
|
1832
|
-
couplerOrientation = (couplerOrientation + 2) % 4;
|
|
1833
|
-
}
|
|
1834
|
-
const leftUpperCornerOfCoupler = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld, nsgKpfeld);
|
|
1835
|
-
const kpfeldNodes = yield this.getNodesOfKpfeld(nsgKpfeld);
|
|
1836
|
-
let containsLeistungsschalter = false;
|
|
1837
|
-
let leistungsschalterNode = null;
|
|
1838
|
-
for (const kpfeldNode of kpfeldNodes) {
|
|
1839
|
-
if (!containsLeistungsschalter) {
|
|
1840
|
-
leistungsschalterNode = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_leistungsschalter, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: kpfeldNode.id }, false);
|
|
1841
|
-
if (leistungsschalterNode) {
|
|
1842
|
-
containsLeistungsschalter = true;
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
const netzSsabsIds = new Set(netzSsabs.map(arg => arg.id));
|
|
1847
|
-
const maxSsabPos = yield this.getMaxPosOfSaabschnitt(nsgSaabschnitt);
|
|
1848
|
-
const nodePointMap = new Map();
|
|
1849
|
-
if (containsLeistungsschalter) {
|
|
1850
|
-
const onSsabNodes = kpfeldNodes.filter(elem => netzSsabsIds.has(elem.aknoten) || netzSsabsIds.has(elem.eknoten));
|
|
1851
|
-
// first: place the disconnectors (and the connectivity nodes) on the busbar sections
|
|
1852
|
-
for (const onSsabNode of onSsabNodes) {
|
|
1853
|
-
const idOfSsab = netzSsabsIds.has(onSsabNode.aknoten) ? onSsabNode.aknoten : onSsabNode.eknoten;
|
|
1854
|
-
const leftUpperCornerOfSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === idOfSsab), nsgKpfeld.variantennr);
|
|
1855
|
-
const nextNode = kpfeldNodes.find(arg => arg.aknoten === onSsabNode.eknoten);
|
|
1856
|
-
let rotationValue;
|
|
1857
|
-
let shiftOffset = 4;
|
|
1858
|
-
// um universalkupplungen korrekt zu platzieren, müssen die Disconnectoren untereinander platziert werden,
|
|
1859
|
-
// die auf den Leistungsschalter zeigen (bezogen auf aknoten)
|
|
1860
|
-
if (nextNode && (yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_leistungsschalter, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nextNode.id }, false))) {
|
|
1861
|
-
// on 'left' side
|
|
1862
|
-
shiftOffset = 4;
|
|
1863
|
-
}
|
|
1864
|
-
else {
|
|
1865
|
-
// on 'right' side
|
|
1866
|
-
shiftOffset = 28;
|
|
1867
|
-
}
|
|
1868
|
-
const position = [null, null];
|
|
1869
|
-
switch (couplerOrientation) {
|
|
1870
|
-
case 0: // TOP
|
|
1871
|
-
position[0] = leftUpperCornerOfCoupler[0] + shiftOffset;
|
|
1872
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
1873
|
-
rotationValue = 0;
|
|
1874
|
-
break;
|
|
1875
|
-
case 1: // RIGHT
|
|
1876
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
1877
|
-
position[1] = leftUpperCornerOfCoupler[1] + shiftOffset;
|
|
1878
|
-
rotationValue = 90;
|
|
1879
|
-
break;
|
|
1880
|
-
case 2: // BOTTOM
|
|
1881
|
-
position[0] = leftUpperCornerOfCoupler[0] + shiftOffset;
|
|
1882
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
1883
|
-
rotationValue = 180;
|
|
1884
|
-
break;
|
|
1885
|
-
case 3: // LEFT
|
|
1886
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
1887
|
-
position[1] = leftUpperCornerOfCoupler[1] + shiftOffset;
|
|
1888
|
-
rotationValue = 270;
|
|
1889
|
-
break;
|
|
1890
|
-
}
|
|
1891
|
-
nodePointMap.set(onSsabNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
1892
|
-
nodePointMap.set(idOfSsab, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], null));
|
|
1893
|
-
}
|
|
1894
|
-
// Leistungsschalter noch platzieren
|
|
1895
|
-
// const crtNode = leistungsschalterNode; //kpfeldNodes.find(arg => arg.aknoten === onSsabNodes[0].eknoten);
|
|
1896
|
-
let rotationValue = null;
|
|
1897
|
-
const position = [...leftUpperCornerOfCoupler];
|
|
1898
|
-
const cn1Position = [...leftUpperCornerOfCoupler];
|
|
1899
|
-
const cn2Position = [...leftUpperCornerOfCoupler];
|
|
1900
|
-
switch (couplerOrientation) {
|
|
1901
|
-
case 0: // TOP
|
|
1902
|
-
position[0] += 16;
|
|
1903
|
-
position[1] = leftUpperCornerOfCoupler[1] + 4;
|
|
1904
|
-
rotationValue = 90;
|
|
1905
|
-
cn1Position[0] = leftUpperCornerOfCoupler[0] + 4;
|
|
1906
|
-
cn1Position[1] = position[1];
|
|
1907
|
-
cn2Position[0] = leftUpperCornerOfCoupler[0] + 28;
|
|
1908
|
-
cn2Position[1] = position[1];
|
|
1909
|
-
break;
|
|
1910
|
-
case 1: // RIGHT
|
|
1911
|
-
position[0] = ((maxSsabPos + 1) * 8) + leftUpperCornerOfCoupler[0] + 4;
|
|
1912
|
-
position[1] += 16;
|
|
1913
|
-
rotationValue = 180;
|
|
1914
|
-
cn1Position[0] = position[0];
|
|
1915
|
-
cn1Position[1] = leftUpperCornerOfCoupler[1] + 4;
|
|
1916
|
-
cn2Position[0] = position[0];
|
|
1917
|
-
cn2Position[1] = leftUpperCornerOfCoupler[1] + 28;
|
|
1918
|
-
break;
|
|
1919
|
-
case 2: // BOTTOM
|
|
1920
|
-
position[0] += 16;
|
|
1921
|
-
position[1] = ((maxSsabPos + 1) * 8) + leftUpperCornerOfCoupler[1] + 4;
|
|
1922
|
-
rotationValue = 90;
|
|
1923
|
-
cn1Position[0] = leftUpperCornerOfCoupler[0] + 4;
|
|
1924
|
-
cn1Position[1] = position[1];
|
|
1925
|
-
cn2Position[0] = leftUpperCornerOfCoupler[0] + 28;
|
|
1926
|
-
cn2Position[1] = position[1];
|
|
1927
|
-
break;
|
|
1928
|
-
case 3: // LEFT
|
|
1929
|
-
position[0] = leftUpperCornerOfCoupler[0] + 4;
|
|
1930
|
-
position[1] += 16;
|
|
1931
|
-
rotationValue = 180;
|
|
1932
|
-
cn1Position[0] = position[0];
|
|
1933
|
-
cn1Position[1] = leftUpperCornerOfCoupler[1] + 4;
|
|
1934
|
-
cn2Position[0] = position[0];
|
|
1935
|
-
cn2Position[1] = leftUpperCornerOfCoupler[1] + 28;
|
|
1936
|
-
break;
|
|
1937
|
-
}
|
|
1938
|
-
nodePointMap.set(leistungsschalterNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
1939
|
-
nodePointMap.set(leistungsschalterNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cn1Position[0], cn1Position[1], null));
|
|
1940
|
-
nodePointMap.set(leistungsschalterNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cn2Position[0], cn2Position[1], null));
|
|
1941
|
-
/* ---------- ---------- ---------- */
|
|
1942
|
-
// BEGIN: Terminal-Export
|
|
1943
|
-
for (const kpfeldNode of kpfeldNodes) {
|
|
1944
|
-
const doBackwardConnectivityNode = nodePointMap.get(kpfeldNode.aknoten);
|
|
1945
|
-
const doConductingEquipment = nodePointMap.get(kpfeldNode.id);
|
|
1946
|
-
const doForwardConnectivityNode = nodePointMap.get(kpfeldNode.eknoten);
|
|
1947
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1948
|
-
const dopConductingEquipment = doConductingEquipment.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1949
|
-
const dopForwardConnectivityNode = doForwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
1950
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(kpfeldNode.aknoten, kpfeldNode.id);
|
|
1951
|
-
if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
1952
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
1953
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1954
|
-
cePoints: [...dopConductingEquipment], cnPoints: [...dopBackwardConnectivityNode],
|
|
1955
|
-
terminalUuid: backwardTerminalUUID
|
|
1956
|
-
});
|
|
1957
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
1958
|
-
}
|
|
1959
|
-
const forwardTerminalUUID = this.lookupTerminalUUID(kpfeldNode.eknoten, kpfeldNode.id);
|
|
1960
|
-
if (!this.exportedTerminalUUIDs.has(forwardTerminalUUID)) {
|
|
1961
|
-
this.exportedTerminalUUIDs.add(forwardTerminalUUID);
|
|
1962
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
1963
|
-
cePoints: [...dopConductingEquipment], cnPoints: [...dopForwardConnectivityNode],
|
|
1964
|
-
terminalUuid: forwardTerminalUUID
|
|
1965
|
-
});
|
|
1966
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
// END: Terminal-Export
|
|
1970
|
-
/* ---------- ---------- ---------- */
|
|
1971
|
-
}
|
|
1972
|
-
else {
|
|
1973
|
-
// case: cross-coupling without breaker
|
|
1974
|
-
let prevNode;
|
|
1975
|
-
let crtNode = kpfeldNodes.filter(elem => netzSsabsIds.has(elem.aknoten))[0];
|
|
1976
|
-
const offsetValue = 32 / (kpfeldNodes.length + 1);
|
|
1977
|
-
let rotationValue = null;
|
|
1978
|
-
const positionFirstSsabNode = [0, 0];
|
|
1979
|
-
const leftUpperPosOfAKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === crtNode.aknoten), nsgKpfeld.variantennr);
|
|
1980
|
-
switch (couplerOrientation) {
|
|
1981
|
-
case 0: // TOP
|
|
1982
|
-
positionFirstSsabNode[0] = leftUpperCornerOfCoupler[0] + 4;
|
|
1983
|
-
positionFirstSsabNode[1] = leftUpperPosOfAKnotenSsab[1];
|
|
1984
|
-
break;
|
|
1985
|
-
case 1: // RIGHT
|
|
1986
|
-
positionFirstSsabNode[0] = leftUpperPosOfAKnotenSsab[0];
|
|
1987
|
-
positionFirstSsabNode[1] = leftUpperCornerOfCoupler[1] + 4;
|
|
1988
|
-
break;
|
|
1989
|
-
case 2: // BOTTOM
|
|
1990
|
-
positionFirstSsabNode[0] = leftUpperCornerOfCoupler[0] + 4;
|
|
1991
|
-
positionFirstSsabNode[1] = leftUpperPosOfAKnotenSsab[1];
|
|
1992
|
-
break;
|
|
1993
|
-
case 3: // LEFT
|
|
1994
|
-
positionFirstSsabNode[0] = leftUpperPosOfAKnotenSsab[0];
|
|
1995
|
-
positionFirstSsabNode[1] = leftUpperCornerOfCoupler[1] + 4;
|
|
1996
|
-
break;
|
|
1997
|
-
}
|
|
1998
|
-
nodePointMap.set(crtNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(positionFirstSsabNode[0], positionFirstSsabNode[1], null));
|
|
1999
|
-
const position = [...leftUpperCornerOfCoupler];
|
|
2000
|
-
while (crtNode !== undefined) {
|
|
2001
|
-
switch (couplerOrientation) {
|
|
2002
|
-
case 0: // TOP
|
|
2003
|
-
position[0] += offsetValue;
|
|
2004
|
-
position[1] = leftUpperCornerOfCoupler[1] + 4;
|
|
2005
|
-
rotationValue = 90;
|
|
2006
|
-
break;
|
|
2007
|
-
case 1: // RIGHT
|
|
2008
|
-
position[0] = ((maxSsabPos + 1) * 8) + leftUpperCornerOfCoupler[0] + 4;
|
|
2009
|
-
position[1] += offsetValue;
|
|
2010
|
-
rotationValue = 0;
|
|
2011
|
-
break;
|
|
2012
|
-
case 2: // BOTTOM
|
|
2013
|
-
position[0] += offsetValue;
|
|
2014
|
-
position[1] = ((maxSsabPos + 1) * 8) + leftUpperCornerOfCoupler[1] + 4;
|
|
2015
|
-
rotationValue = 90;
|
|
2016
|
-
break;
|
|
2017
|
-
case 3: // LEFT
|
|
2018
|
-
position[0] = leftUpperCornerOfCoupler[0] + 4;
|
|
2019
|
-
position[1] += offsetValue;
|
|
2020
|
-
rotationValue = 0;
|
|
2021
|
-
break;
|
|
2022
|
-
}
|
|
2023
|
-
nodePointMap.set(crtNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
2024
|
-
const positionConnectivityNode = [...position];
|
|
2025
|
-
switch (couplerOrientation) {
|
|
2026
|
-
case 0: // TOP
|
|
2027
|
-
positionConnectivityNode[0] += (offsetValue / 2);
|
|
2028
|
-
break;
|
|
2029
|
-
case 1: // RIGHT
|
|
2030
|
-
positionConnectivityNode[1] += (offsetValue / 2);
|
|
2031
|
-
break;
|
|
2032
|
-
case 2: // BOTTOM
|
|
2033
|
-
positionConnectivityNode[0] += (offsetValue / 2);
|
|
2034
|
-
break;
|
|
2035
|
-
case 3: // LEFT
|
|
2036
|
-
positionConnectivityNode[1] += (offsetValue / 2);
|
|
2037
|
-
break;
|
|
2038
|
-
}
|
|
2039
|
-
nodePointMap.set(crtNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(positionConnectivityNode[0], positionConnectivityNode[1], null));
|
|
2040
|
-
prevNode = crtNode;
|
|
2041
|
-
crtNode = kpfeldNodes.find(arg => arg.aknoten === crtNode.eknoten);
|
|
2042
|
-
}
|
|
2043
|
-
// replace the last "ConnectivityNode"
|
|
2044
|
-
const positionLastSsabNode = [0, 0];
|
|
2045
|
-
const leftUpperPosOfEKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === prevNode.eknoten), nsgKpfeld.variantennr);
|
|
2046
|
-
switch (couplerOrientation) {
|
|
2047
|
-
case 0: // TOP
|
|
2048
|
-
positionLastSsabNode[0] = leftUpperCornerOfCoupler[0] + 28;
|
|
2049
|
-
positionLastSsabNode[1] = leftUpperPosOfEKnotenSsab[1];
|
|
2050
|
-
break;
|
|
2051
|
-
case 1: // RIGHT
|
|
2052
|
-
positionLastSsabNode[0] = leftUpperPosOfEKnotenSsab[0];
|
|
2053
|
-
positionLastSsabNode[1] = leftUpperCornerOfCoupler[1] + 28;
|
|
2054
|
-
break;
|
|
2055
|
-
case 2: // BOTTOM
|
|
2056
|
-
positionLastSsabNode[0] = leftUpperCornerOfCoupler[0] + 28;
|
|
2057
|
-
positionLastSsabNode[1] = leftUpperPosOfEKnotenSsab[1];
|
|
2058
|
-
break;
|
|
2059
|
-
case 3: // LEFT
|
|
2060
|
-
positionLastSsabNode[0] = leftUpperPosOfEKnotenSsab[0];
|
|
2061
|
-
positionLastSsabNode[1] = leftUpperCornerOfCoupler[1] + 28;
|
|
2062
|
-
break;
|
|
2063
|
-
}
|
|
2064
|
-
nodePointMap.set(prevNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(positionLastSsabNode[0], positionLastSsabNode[1], null));
|
|
2065
|
-
/* ---------- ---------- ---------- */
|
|
2066
|
-
// BEGIN: Terminal-Export
|
|
2067
|
-
for (const kpfeldNode of kpfeldNodes) {
|
|
2068
|
-
const doBackwardConnectivityNode = nodePointMap.get(kpfeldNode.aknoten);
|
|
2069
|
-
const doConductingEquipment = nodePointMap.get(kpfeldNode.id);
|
|
2070
|
-
const doForwardConnectivityNode = nodePointMap.get(kpfeldNode.eknoten);
|
|
2071
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2072
|
-
const dopConductingEquipment = doConductingEquipment.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2073
|
-
const dopForwardConnectivityNode = doForwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2074
|
-
let backwardTerminalPoints;
|
|
2075
|
-
if (netzSsabsIds.has(kpfeldNode.aknoten)) {
|
|
2076
|
-
// insert a bend node
|
|
2077
|
-
const bendNode = [null, null];
|
|
2078
|
-
switch (couplerOrientation) {
|
|
2079
|
-
case 0: // TOP
|
|
2080
|
-
case 2: // BOTTOM
|
|
2081
|
-
bendNode[0] = dopBackwardConnectivityNode[0];
|
|
2082
|
-
bendNode[1] = dopConductingEquipment[1];
|
|
2083
|
-
break;
|
|
2084
|
-
case 1: // RIGHT
|
|
2085
|
-
case 3: // LEFT
|
|
2086
|
-
bendNode[0] = dopConductingEquipment[0];
|
|
2087
|
-
bendNode[1] = dopBackwardConnectivityNode[1];
|
|
2088
|
-
break;
|
|
2089
|
-
}
|
|
2090
|
-
backwardTerminalPoints = [[...dopConductingEquipment], bendNode, [...dopBackwardConnectivityNode]];
|
|
2091
|
-
}
|
|
2092
|
-
else {
|
|
2093
|
-
backwardTerminalPoints = [[...dopConductingEquipment], [...dopBackwardConnectivityNode]];
|
|
2094
|
-
}
|
|
2095
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(kpfeldNode.aknoten, kpfeldNode.id);
|
|
2096
|
-
if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
2097
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
2098
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
2099
|
-
points: backwardTerminalPoints,
|
|
2100
|
-
terminalUuid: backwardTerminalUUID
|
|
2101
|
-
});
|
|
2102
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
2103
|
-
}
|
|
2104
|
-
let forwardTerminalPoints;
|
|
2105
|
-
if (netzSsabsIds.has(kpfeldNode.eknoten)) {
|
|
2106
|
-
// insert a bend node
|
|
2107
|
-
const bendNode = [null, null];
|
|
2108
|
-
switch (couplerOrientation) {
|
|
2109
|
-
case 0: // TOP
|
|
2110
|
-
case 2: // BOTTOM
|
|
2111
|
-
bendNode[0] = dopForwardConnectivityNode[0];
|
|
2112
|
-
bendNode[1] = dopConductingEquipment[1];
|
|
2113
|
-
break;
|
|
2114
|
-
case 1: // RIGHT
|
|
2115
|
-
case 3: // LEFT
|
|
2116
|
-
bendNode[0] = dopConductingEquipment[0];
|
|
2117
|
-
bendNode[1] = dopForwardConnectivityNode[1];
|
|
2118
|
-
break;
|
|
2119
|
-
}
|
|
2120
|
-
forwardTerminalPoints = [[...dopConductingEquipment], bendNode, [...dopForwardConnectivityNode]];
|
|
2121
|
-
}
|
|
2122
|
-
else {
|
|
2123
|
-
forwardTerminalPoints = [[...dopConductingEquipment], [...dopForwardConnectivityNode]];
|
|
2124
|
-
}
|
|
2125
|
-
const forwardTerminalUUID = this.lookupTerminalUUID(kpfeldNode.eknoten, kpfeldNode.id);
|
|
2126
|
-
if (!this.exportedTerminalUUIDs.has(forwardTerminalUUID)) {
|
|
2127
|
-
this.exportedTerminalUUIDs.add(forwardTerminalUUID);
|
|
2128
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
2129
|
-
points: forwardTerminalPoints,
|
|
2130
|
-
terminalUuid: forwardTerminalUUID
|
|
2131
|
-
});
|
|
2132
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
// END: Terminal-Export
|
|
2136
|
-
/* ---------- ---------- ---------- */
|
|
2137
|
-
}
|
|
2138
|
-
for (const nodePointEntry of nodePointMap.entries()) {
|
|
2139
|
-
const key = nodePointEntry[0];
|
|
2140
|
-
const value = nodePointEntry[1];
|
|
2141
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: key })) !== null && _b !== void 0 ? _b : undefined;
|
|
2142
|
-
value.identifiedObjectUUID = cimObjectUUID;
|
|
2143
|
-
resultingDiagramObjects.push(value);
|
|
2144
|
-
}
|
|
2145
|
-
return resultingDiagramObjects;
|
|
2146
|
-
});
|
|
2147
|
-
}
|
|
2148
|
-
/**
|
|
2149
|
-
* convertSchemaLKupplung
|
|
2150
|
-
*/
|
|
2151
|
-
convertSchemaLKupplung(nsgLKupplung, netzLKupplung) {
|
|
2152
|
-
var _a, _b;
|
|
2153
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2154
|
-
const resultingDiagramObjects = [];
|
|
2155
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplung.variantennr, id: nsgLKupplung.nsgsaa }, false);
|
|
2156
|
-
if (!nsgSaabschnitt)
|
|
2157
|
-
return;
|
|
2158
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplung.variantennr, id: nsgSaabschnitt.nsgsa }, false);
|
|
2159
|
-
if (!nsgSchaltanlage)
|
|
2160
|
-
return;
|
|
2161
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplung.variantennr, id: nsgSchaltanlage.nsgso }, false);
|
|
2162
|
-
if (!nsgStandort)
|
|
2163
|
-
return;
|
|
2164
|
-
const nsgSaabschnittAnf = yield this.dbObjectGraph.findFirstByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, { variantennr: nsgLKupplung.variantennr, saabschnitt: netzLKupplung.saa_anf });
|
|
2165
|
-
if (!nsgSaabschnittAnf)
|
|
2166
|
-
return;
|
|
2167
|
-
const nsgSaabschnittEnd = yield this.dbObjectGraph.findFirstByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, { variantennr: nsgLKupplung.variantennr, saabschnitt: netzLKupplung.saa_end });
|
|
2168
|
-
if (!nsgSaabschnittEnd)
|
|
2169
|
-
return;
|
|
2170
|
-
const netzSsabs = yield this.dbObjectGraph.findByAttributes(convert_graph_keys_1.i7TableNames.netz_ssab, {
|
|
2171
|
-
saabschnitt: {
|
|
2172
|
-
in: [nsgSaabschnittAnf.saabschnitt, nsgSaabschnittEnd.saabschnitt]
|
|
2173
|
-
}
|
|
2174
|
-
});
|
|
2175
|
-
const lkupplungNodes = yield this.getNodesOfLKupplung(netzLKupplung);
|
|
2176
|
-
const netzSsabsIds = new Set(netzSsabs.map(arg => arg.id));
|
|
2177
|
-
const ssabConnectedNodes = lkupplungNodes.filter(elem => netzSsabsIds.has(elem.aknoten) || netzSsabsIds.has(elem.eknoten));
|
|
2178
|
-
const nodePointMap = new Map();
|
|
2179
|
-
if (lkupplungNodes.length === 1 && netzSsabsIds.has(lkupplungNodes[0].aknoten) && netzSsabsIds.has(lkupplungNodes[0].eknoten)) {
|
|
2180
|
-
const ssabConnectedNode = ssabConnectedNodes[0];
|
|
2181
|
-
if (yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_sestarr3p, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: ssabConnectedNode.id })) {
|
|
2182
|
-
const leftUpperCornerOfAKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === ssabConnectedNode.aknoten), nsgLKupplung.variantennr);
|
|
2183
|
-
const sizeOfAKnotenSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittAnf);
|
|
2184
|
-
const leftUpperCornerOfEKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === ssabConnectedNode.eknoten), nsgLKupplung.variantennr);
|
|
2185
|
-
const sizeOfEKnotenSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittEnd);
|
|
2186
|
-
// cause 'starre Verbindungen' are modelled as junctions, there must be two points extracted
|
|
2187
|
-
// those two points are equals to the connectivity node positions and the rotation value is unnecessary
|
|
2188
|
-
const aKnotenPosition = [null, null];
|
|
2189
|
-
const eKnotenPosition = [null, null];
|
|
2190
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2191
|
-
case 0: // left to right
|
|
2192
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0] + (sizeOfAKnotenSsab) * 16;
|
|
2193
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2194
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2195
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2196
|
-
break;
|
|
2197
|
-
case 1: // top to bottom
|
|
2198
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2199
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1] + (sizeOfAKnotenSsab) * 16;
|
|
2200
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2201
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2202
|
-
break;
|
|
2203
|
-
case 2: // right to left
|
|
2204
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2205
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2206
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0] + (sizeOfEKnotenSsab) * 16;
|
|
2207
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2208
|
-
break;
|
|
2209
|
-
case 3: // bottom to top
|
|
2210
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2211
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2212
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2213
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1] + (sizeOfEKnotenSsab) * 16;
|
|
2214
|
-
break;
|
|
2215
|
-
}
|
|
2216
|
-
const junctionCoordinates = [[...aKnotenPosition], [...eKnotenPosition]];
|
|
2217
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoints(junctionCoordinates, null));
|
|
2218
|
-
nodePointMap.set(ssabConnectedNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
2219
|
-
nodePointMap.set(ssabConnectedNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
2220
|
-
}
|
|
2221
|
-
else {
|
|
2222
|
-
const leftUpperCornerOfAKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === ssabConnectedNode.aknoten), nsgLKupplung.variantennr);
|
|
2223
|
-
const sizeOfAKnotenSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittAnf);
|
|
2224
|
-
const leftUpperCornerOfEKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === ssabConnectedNode.eknoten), nsgLKupplung.variantennr);
|
|
2225
|
-
const sizeOfEKnotenSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittEnd);
|
|
2226
|
-
const aKnotenPosition = [null, null];
|
|
2227
|
-
const eKnotenPosition = [null, null];
|
|
2228
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2229
|
-
case 0: // left to right
|
|
2230
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0] + (sizeOfAKnotenSsab) * 16;
|
|
2231
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2232
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2233
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2234
|
-
break;
|
|
2235
|
-
case 1: // top to bottom
|
|
2236
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2237
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1] + (sizeOfAKnotenSsab) * 16;
|
|
2238
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2239
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2240
|
-
break;
|
|
2241
|
-
case 2: // right to left
|
|
2242
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2243
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2244
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0] + (sizeOfEKnotenSsab) * 16;
|
|
2245
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2246
|
-
break;
|
|
2247
|
-
case 3: // bottom to top
|
|
2248
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2249
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2250
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2251
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1] + (sizeOfEKnotenSsab) * 16;
|
|
2252
|
-
break;
|
|
2253
|
-
}
|
|
2254
|
-
const position = [
|
|
2255
|
-
(aKnotenPosition[0] + eKnotenPosition[0]) / 2,
|
|
2256
|
-
(aKnotenPosition[1] + eKnotenPosition[1]) / 2
|
|
2257
|
-
];
|
|
2258
|
-
let rotationValue = Math.atan2(eKnotenPosition[1] - aKnotenPosition[1], eKnotenPosition[0] - aKnotenPosition[0]);
|
|
2259
|
-
rotationValue = ((rotationValue * 180) / Math.PI) + 90;
|
|
2260
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
2261
|
-
nodePointMap.set(ssabConnectedNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
2262
|
-
nodePointMap.set(ssabConnectedNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
else if (lkupplungNodes.length === 2 &&
|
|
2266
|
-
(netzSsabsIds.has(lkupplungNodes[0].aknoten) || netzSsabsIds.has(lkupplungNodes[0].eknoten)) &&
|
|
2267
|
-
(netzSsabsIds.has(lkupplungNodes[1].aknoten) || netzSsabsIds.has(lkupplungNodes[1].eknoten))) {
|
|
2268
|
-
let aKnotenSsabNode;
|
|
2269
|
-
let aKnotenSsabId;
|
|
2270
|
-
let eKnotenSsabNode;
|
|
2271
|
-
let eKnotenSsabId;
|
|
2272
|
-
let inbetweenNodeId;
|
|
2273
|
-
if (netzSsabsIds.has(lkupplungNodes[0].aknoten)) {
|
|
2274
|
-
aKnotenSsabId = lkupplungNodes[0].aknoten;
|
|
2275
|
-
aKnotenSsabNode = lkupplungNodes[0];
|
|
2276
|
-
eKnotenSsabId = lkupplungNodes[1].eknoten;
|
|
2277
|
-
eKnotenSsabNode = lkupplungNodes[1];
|
|
2278
|
-
inbetweenNodeId = lkupplungNodes[1].aknoten;
|
|
2279
|
-
}
|
|
2280
|
-
else {
|
|
2281
|
-
aKnotenSsabId = lkupplungNodes[1].aknoten;
|
|
2282
|
-
aKnotenSsabNode = lkupplungNodes[1];
|
|
2283
|
-
eKnotenSsabId = lkupplungNodes[0].eknoten;
|
|
2284
|
-
eKnotenSsabNode = lkupplungNodes[0];
|
|
2285
|
-
inbetweenNodeId = lkupplungNodes[0].aknoten;
|
|
2286
|
-
}
|
|
2287
|
-
const leftUpperCornerOfAKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === aKnotenSsabId), nsgLKupplung.variantennr);
|
|
2288
|
-
const sizeOfAKnotenSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittAnf);
|
|
2289
|
-
const leftUpperCornerOfEKnotenSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === eKnotenSsabId), nsgLKupplung.variantennr);
|
|
2290
|
-
const sizeOfEKnotenSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittEnd);
|
|
2291
|
-
const aKnotenPosition = [null, null];
|
|
2292
|
-
const eKnotenPosition = [null, null];
|
|
2293
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2294
|
-
case 0: // left to right
|
|
2295
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0] + (sizeOfAKnotenSsab) * 16;
|
|
2296
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2297
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2298
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2299
|
-
break;
|
|
2300
|
-
case 1: // top to bottom
|
|
2301
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2302
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1] + (sizeOfAKnotenSsab) * 16;
|
|
2303
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2304
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2305
|
-
break;
|
|
2306
|
-
case 2: // right to left
|
|
2307
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2308
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2309
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0] + (sizeOfEKnotenSsab) * 16;
|
|
2310
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1];
|
|
2311
|
-
break;
|
|
2312
|
-
case 3: // bottom to top
|
|
2313
|
-
aKnotenPosition[0] = leftUpperCornerOfAKnotenSsab[0];
|
|
2314
|
-
aKnotenPosition[1] = leftUpperCornerOfAKnotenSsab[1];
|
|
2315
|
-
eKnotenPosition[0] = leftUpperCornerOfEKnotenSsab[0];
|
|
2316
|
-
eKnotenPosition[1] = leftUpperCornerOfEKnotenSsab[1] + (sizeOfEKnotenSsab) * 16;
|
|
2317
|
-
break;
|
|
2318
|
-
}
|
|
2319
|
-
const connectionVector2 = [
|
|
2320
|
-
eKnotenPosition[0] - aKnotenPosition[0],
|
|
2321
|
-
eKnotenPosition[1] - aKnotenPosition[1]
|
|
2322
|
-
];
|
|
2323
|
-
const offsetVector = [
|
|
2324
|
-
connectionVector2[0] / 4,
|
|
2325
|
-
connectionVector2[1] / 4
|
|
2326
|
-
];
|
|
2327
|
-
const ce1Position = [
|
|
2328
|
-
aKnotenPosition[0] + offsetVector[0],
|
|
2329
|
-
aKnotenPosition[1] + offsetVector[1]
|
|
2330
|
-
];
|
|
2331
|
-
const cnCe1Ce2Position = [
|
|
2332
|
-
aKnotenPosition[0] + offsetVector[0] * 2,
|
|
2333
|
-
aKnotenPosition[1] + offsetVector[1] * 2
|
|
2334
|
-
];
|
|
2335
|
-
const ce2Position = [
|
|
2336
|
-
aKnotenPosition[0] + offsetVector[0] * 3,
|
|
2337
|
-
aKnotenPosition[1] + offsetVector[1] * 3
|
|
2338
|
-
];
|
|
2339
|
-
let rotationValue = Math.atan2(connectionVector2[1], connectionVector2[0]);
|
|
2340
|
-
rotationValue = ((rotationValue * 180) / Math.PI) + 90;
|
|
2341
|
-
nodePointMap.set(aKnotenSsabNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
2342
|
-
nodePointMap.set(aKnotenSsabNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(ce1Position[0], ce1Position[1], rotationValue));
|
|
2343
|
-
nodePointMap.set(inbetweenNodeId, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cnCe1Ce2Position[0], cnCe1Ce2Position[1], null));
|
|
2344
|
-
nodePointMap.set(eKnotenSsabNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(ce2Position[0], ce2Position[1], rotationValue));
|
|
2345
|
-
nodePointMap.set(eKnotenSsabNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
2346
|
-
}
|
|
2347
|
-
else {
|
|
2348
|
-
for (const ssabConnectedNode of ssabConnectedNodes) {
|
|
2349
|
-
const idOfSsab = netzSsabsIds.has(ssabConnectedNode.aknoten) ? ssabConnectedNode.aknoten : ssabConnectedNode.eknoten;
|
|
2350
|
-
const leftUpperCornerOfSsab = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.netz_ssab, netzSsabs.find(arg => arg.id === idOfSsab), nsgLKupplung.variantennr);
|
|
2351
|
-
// needed to get the correct behaviour for universal couplings
|
|
2352
|
-
const breakerNode = lkupplungNodes.find(arg => arg.aknoten === ssabConnectedNode.eknoten);
|
|
2353
|
-
if (netzSsabsIds.has(ssabConnectedNode.aknoten) && breakerNode) {
|
|
2354
|
-
// place on 'left' side of the coupling-field (but at the end of the busbar)
|
|
2355
|
-
const sizeOfSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittAnf);
|
|
2356
|
-
let rotationValue;
|
|
2357
|
-
const position = [null, null];
|
|
2358
|
-
const aKnotenPosition = [null, null]; // connectivity node to busbar
|
|
2359
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2360
|
-
case 0: // left to right
|
|
2361
|
-
position[0] = leftUpperCornerOfSsab[0] + (sizeOfSsab) * 16 + 4;
|
|
2362
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
2363
|
-
rotationValue = 90;
|
|
2364
|
-
aKnotenPosition[0] = leftUpperCornerOfSsab[0] + (sizeOfSsab) * 16;
|
|
2365
|
-
aKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
2366
|
-
break;
|
|
2367
|
-
case 1: // top to bottom
|
|
2368
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
2369
|
-
position[1] = leftUpperCornerOfSsab[1] + (sizeOfSsab) * 16 + 4;
|
|
2370
|
-
rotationValue = 180;
|
|
2371
|
-
aKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
2372
|
-
aKnotenPosition[1] = leftUpperCornerOfSsab[1] + (sizeOfSsab) * 16;
|
|
2373
|
-
break;
|
|
2374
|
-
case 2: // right to left
|
|
2375
|
-
position[0] = leftUpperCornerOfSsab[0] - 4;
|
|
2376
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
2377
|
-
rotationValue = 270;
|
|
2378
|
-
aKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
2379
|
-
aKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
2380
|
-
break;
|
|
2381
|
-
case 3: // bottom to top
|
|
2382
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
2383
|
-
position[1] = leftUpperCornerOfSsab[1] - 4;
|
|
2384
|
-
rotationValue = 0;
|
|
2385
|
-
aKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
2386
|
-
aKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
2387
|
-
break;
|
|
2388
|
-
}
|
|
2389
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
2390
|
-
nodePointMap.set(ssabConnectedNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(aKnotenPosition[0], aKnotenPosition[1], null));
|
|
2391
|
-
}
|
|
2392
|
-
else {
|
|
2393
|
-
// place on 'right' side of the coupling-field (but at the start of the busbar)
|
|
2394
|
-
const sizeOfSsab = yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnittEnd);
|
|
2395
|
-
let rotationValue;
|
|
2396
|
-
const position = [null, null];
|
|
2397
|
-
const eKnotenPosition = [null, null]; // connectivity node to busbar
|
|
2398
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2399
|
-
case 0: // left to right
|
|
2400
|
-
position[0] = leftUpperCornerOfSsab[0] - 4;
|
|
2401
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
2402
|
-
rotationValue = 90;
|
|
2403
|
-
eKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
2404
|
-
eKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
2405
|
-
break;
|
|
2406
|
-
case 1: // top to bottom
|
|
2407
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
2408
|
-
position[1] = leftUpperCornerOfSsab[1] - 4;
|
|
2409
|
-
rotationValue = 180;
|
|
2410
|
-
eKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
2411
|
-
eKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
2412
|
-
break;
|
|
2413
|
-
case 2: // right to left
|
|
2414
|
-
position[0] = leftUpperCornerOfSsab[0] + (sizeOfSsab) * 16 + 4;
|
|
2415
|
-
position[1] = leftUpperCornerOfSsab[1];
|
|
2416
|
-
rotationValue = 270;
|
|
2417
|
-
eKnotenPosition[0] = leftUpperCornerOfSsab[0] + (sizeOfSsab) * 16;
|
|
2418
|
-
eKnotenPosition[1] = leftUpperCornerOfSsab[1];
|
|
2419
|
-
break;
|
|
2420
|
-
case 3: // bottom to top
|
|
2421
|
-
position[0] = leftUpperCornerOfSsab[0];
|
|
2422
|
-
position[1] = leftUpperCornerOfSsab[1] + (sizeOfSsab) * 16 + 4;
|
|
2423
|
-
rotationValue = 0;
|
|
2424
|
-
eKnotenPosition[0] = leftUpperCornerOfSsab[0];
|
|
2425
|
-
eKnotenPosition[1] = leftUpperCornerOfSsab[1] + (sizeOfSsab) * 16;
|
|
2426
|
-
break;
|
|
2427
|
-
}
|
|
2428
|
-
nodePointMap.set(ssabConnectedNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
2429
|
-
nodePointMap.set(
|
|
2430
|
-
// needed to get the correct behaviour for universal couplings
|
|
2431
|
-
netzSsabsIds.has(ssabConnectedNode.aknoten) ? ssabConnectedNode.aknoten : ssabConnectedNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(eKnotenPosition[0], eKnotenPosition[1], null));
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
if (ssabConnectedNodes.length > 2) {
|
|
2435
|
-
// universal-coupling ==> breaker must be placed 'on top' of the coupling
|
|
2436
|
-
const leftUpperCornerOfLKupplung = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsglkupplung, nsgLKupplung);
|
|
2437
|
-
const startSsabConnectedNode = lkupplungNodes.filter(elem => netzSsabsIds.has(elem.aknoten));
|
|
2438
|
-
// if (startSsabConnectedNode.length === 1 && !nodePointMap.has(startSsabConnectedNode[0].eknoten)) {
|
|
2439
|
-
const breakerNode = lkupplungNodes.find(arg => arg.aknoten === startSsabConnectedNode[0].eknoten || arg.eknoten === startSsabConnectedNode[0].eknoten);
|
|
2440
|
-
let rotationValue = null;
|
|
2441
|
-
const breakerPosition = [...leftUpperCornerOfLKupplung];
|
|
2442
|
-
let cn1Position;
|
|
2443
|
-
let cn2Position;
|
|
2444
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2445
|
-
case 0: // left to right
|
|
2446
|
-
rotationValue = 90;
|
|
2447
|
-
breakerPosition[0] += (nsgLKupplung.laenge / 2) * 16;
|
|
2448
|
-
breakerPosition[1] -= 4;
|
|
2449
|
-
cn1Position = [leftUpperCornerOfLKupplung[0] + 4, breakerPosition[1]];
|
|
2450
|
-
cn2Position = [leftUpperCornerOfLKupplung[0] + nsgLKupplung.laenge * 16 - 4, breakerPosition[1]];
|
|
2451
|
-
break;
|
|
2452
|
-
case 1: // top to bottom
|
|
2453
|
-
rotationValue = 180;
|
|
2454
|
-
breakerPosition[0] -= 4;
|
|
2455
|
-
breakerPosition[1] += (nsgLKupplung.laenge / 2) * 16;
|
|
2456
|
-
cn1Position = [breakerPosition[0], leftUpperCornerOfLKupplung[1] + 4];
|
|
2457
|
-
cn2Position = [breakerPosition[0], leftUpperCornerOfLKupplung[1] + nsgLKupplung.laenge * 16 - 4];
|
|
2458
|
-
break;
|
|
2459
|
-
case 2: // right to left
|
|
2460
|
-
rotationValue = 270;
|
|
2461
|
-
breakerPosition[0] += (nsgLKupplung.laenge / 2) * 16;
|
|
2462
|
-
breakerPosition[1] -= 4;
|
|
2463
|
-
cn1Position = [leftUpperCornerOfLKupplung[0] + nsgLKupplung.laenge * 16 - 4, breakerPosition[1]];
|
|
2464
|
-
cn2Position = [leftUpperCornerOfLKupplung[0] + 4, breakerPosition[1]];
|
|
2465
|
-
break;
|
|
2466
|
-
case 3: // bottom to top
|
|
2467
|
-
rotationValue = 0;
|
|
2468
|
-
breakerPosition[0] -= 4;
|
|
2469
|
-
breakerPosition[1] += (nsgLKupplung.laenge / 2) * 16;
|
|
2470
|
-
cn1Position = [breakerPosition[0], leftUpperCornerOfLKupplung[1] + nsgLKupplung.laenge * 16 - 4];
|
|
2471
|
-
cn2Position = [breakerPosition[0], leftUpperCornerOfLKupplung[1] + 4];
|
|
2472
|
-
break;
|
|
2473
|
-
}
|
|
2474
|
-
nodePointMap.set(breakerNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(breakerPosition[0], breakerPosition[1], rotationValue));
|
|
2475
|
-
nodePointMap.set(breakerNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cn1Position[0], cn1Position[1], null));
|
|
2476
|
-
nodePointMap.set(breakerNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cn2Position[0], cn2Position[1], null));
|
|
2477
|
-
}
|
|
2478
|
-
else {
|
|
2479
|
-
const startSsabConnectedNode = lkupplungNodes.filter(elem => netzSsabsIds.has(elem.aknoten));
|
|
2480
|
-
if (startSsabConnectedNode.length === 1 && !nodePointMap.has(startSsabConnectedNode[0].eknoten)) {
|
|
2481
|
-
const centeredNode = lkupplungNodes.find(arg => arg.aknoten === startSsabConnectedNode[0].eknoten);
|
|
2482
|
-
const leftNode = startSsabConnectedNode[0];
|
|
2483
|
-
const rightNode = lkupplungNodes.find(arg => arg.aknoten === centeredNode.eknoten);
|
|
2484
|
-
const position = [null, null];
|
|
2485
|
-
let cn1Position;
|
|
2486
|
-
let cn2Position;
|
|
2487
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
2488
|
-
case 0: // left to right
|
|
2489
|
-
cn1Position = nodePointMap.get(leftNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2490
|
-
cn2Position = nodePointMap.get(rightNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2491
|
-
cn1Position[0] += 4;
|
|
2492
|
-
cn2Position[0] -= 4;
|
|
2493
|
-
break;
|
|
2494
|
-
case 1: // top to bottom
|
|
2495
|
-
cn1Position = nodePointMap.get(leftNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2496
|
-
cn2Position = nodePointMap.get(rightNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2497
|
-
cn1Position[1] += 4;
|
|
2498
|
-
cn2Position[1] -= 4;
|
|
2499
|
-
break;
|
|
2500
|
-
case 2: // right to left
|
|
2501
|
-
cn1Position = nodePointMap.get(leftNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2502
|
-
cn2Position = nodePointMap.get(rightNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2503
|
-
cn1Position[0] -= 4;
|
|
2504
|
-
cn2Position[0] += 4;
|
|
2505
|
-
break;
|
|
2506
|
-
case 3: // bottom to top
|
|
2507
|
-
cn1Position = nodePointMap.get(leftNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2508
|
-
cn2Position = nodePointMap.get(rightNode.id).diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2509
|
-
cn1Position[1] -= 4;
|
|
2510
|
-
cn2Position[1] += 4;
|
|
2511
|
-
break;
|
|
2512
|
-
}
|
|
2513
|
-
position[0] = (cn1Position[0] + cn2Position[0]) / 2;
|
|
2514
|
-
position[1] = (cn1Position[1] + cn2Position[1]) / 2;
|
|
2515
|
-
let rotationValue = Math.atan2(cn2Position[1] - cn1Position[1], cn2Position[0] - cn1Position[0]);
|
|
2516
|
-
rotationValue = ((rotationValue * 180) / Math.PI) + 90;
|
|
2517
|
-
nodePointMap.set(centeredNode.id, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(position[0], position[1], rotationValue));
|
|
2518
|
-
nodePointMap.set(centeredNode.aknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cn1Position[0], cn1Position[1], null));
|
|
2519
|
-
nodePointMap.set(centeredNode.eknoten, util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(cn2Position[0], cn2Position[1], null));
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
/* ---------- ---------- ---------- */
|
|
2524
|
-
// BEGIN: Terminal-Export
|
|
2525
|
-
for (const lkupplungNode of lkupplungNodes) {
|
|
2526
|
-
const doBackwardConnectivityNode = nodePointMap.get(lkupplungNode.aknoten);
|
|
2527
|
-
const doConductingEquipment = nodePointMap.get(lkupplungNode.id);
|
|
2528
|
-
const doForwardConnectivityNode = nodePointMap.get(lkupplungNode.eknoten);
|
|
2529
|
-
const dopBackwardConnectivityNode = doBackwardConnectivityNode === null || doBackwardConnectivityNode === void 0 ? void 0 : doBackwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2530
|
-
const dopsConductingEquipment = doConductingEquipment === null || doConductingEquipment === void 0 ? void 0 : doConductingEquipment.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition]);
|
|
2531
|
-
const dopForwardConnectivityNode = doForwardConnectivityNode === null || doForwardConnectivityNode === void 0 ? void 0 : doForwardConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2532
|
-
if (!dopBackwardConnectivityNode || !dopsConductingEquipment || !dopForwardConnectivityNode)
|
|
2533
|
-
continue;
|
|
2534
|
-
const backwardTerminalUUID = this.lookupTerminalUUID(lkupplungNode.aknoten, lkupplungNode.id);
|
|
2535
|
-
if (!this.exportedTerminalUUIDs.has(backwardTerminalUUID)) {
|
|
2536
|
-
this.exportedTerminalUUIDs.add(backwardTerminalUUID);
|
|
2537
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
2538
|
-
cePoints: dopsConductingEquipment[0], cnPoints: dopBackwardConnectivityNode,
|
|
2539
|
-
terminalUuid: backwardTerminalUUID
|
|
2540
|
-
});
|
|
2541
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
2542
|
-
}
|
|
2543
|
-
const forwardTerminalUUID = this.lookupTerminalUUID(lkupplungNode.eknoten, lkupplungNode.id);
|
|
2544
|
-
if (!this.exportedTerminalUUIDs.has(forwardTerminalUUID)) {
|
|
2545
|
-
this.exportedTerminalUUIDs.add(forwardTerminalUUID);
|
|
2546
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
2547
|
-
cePoints: dopsConductingEquipment[dopsConductingEquipment.length - 1], cnPoints: dopForwardConnectivityNode,
|
|
2548
|
-
terminalUuid: forwardTerminalUUID
|
|
2549
|
-
});
|
|
2550
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
2551
|
-
}
|
|
2552
|
-
}
|
|
2553
|
-
// END: Terminal-Export
|
|
2554
|
-
/* ---------- ---------- ---------- */
|
|
2555
|
-
for (const nodePointEntry of nodePointMap.entries()) {
|
|
2556
|
-
const key = nodePointEntry[0];
|
|
2557
|
-
const value = nodePointEntry[1];
|
|
2558
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: key })) !== null && _b !== void 0 ? _b : undefined;
|
|
2559
|
-
value.identifiedObjectUUID = cimObjectUUID;
|
|
2560
|
-
resultingDiagramObjects.push(value);
|
|
2561
|
-
}
|
|
2562
|
-
return resultingDiagramObjects;
|
|
2563
|
-
});
|
|
2564
|
-
}
|
|
2565
|
-
/**
|
|
2566
|
-
* convertSchemaStpschiene
|
|
2567
|
-
*/
|
|
2568
|
-
convertSchemaLKondensator(nsgLKondensator) {
|
|
2569
|
-
var _a, _b;
|
|
2570
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2571
|
-
const resultingDiagramObjects = [];
|
|
2572
|
-
const leftUpperCornerOfNsgLKondensator = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsglkondensator, nsgLKondensator);
|
|
2573
|
-
const lkondensator = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_lkondensator, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgLKondensator.lkondensator });
|
|
2574
|
-
if (!lkondensator)
|
|
2575
|
-
return null;
|
|
2576
|
-
const pos = [...leftUpperCornerOfNsgLKondensator];
|
|
2577
|
-
const anfPos = [...leftUpperCornerOfNsgLKondensator];
|
|
2578
|
-
const endPos = [...leftUpperCornerOfNsgLKondensator];
|
|
2579
|
-
switch (nsgLKondensator.ausrichtung) {
|
|
2580
|
-
case 0: // <-- anschlussend || anschlussanf -->
|
|
2581
|
-
pos[0] += 24;
|
|
2582
|
-
pos[1] += 16;
|
|
2583
|
-
anfPos[0] += 48;
|
|
2584
|
-
anfPos[1] += 16;
|
|
2585
|
-
endPos[0] += 0;
|
|
2586
|
-
endPos[1] += 16;
|
|
2587
|
-
break;
|
|
2588
|
-
case 1:
|
|
2589
|
-
pos[0] += 16;
|
|
2590
|
-
pos[1] += 24;
|
|
2591
|
-
anfPos[0] += 16;
|
|
2592
|
-
anfPos[1] += 48;
|
|
2593
|
-
endPos[0] += 0;
|
|
2594
|
-
endPos[1] += 16;
|
|
2595
|
-
break;
|
|
2596
|
-
case 2:
|
|
2597
|
-
pos[0] += 24;
|
|
2598
|
-
pos[1] += 16;
|
|
2599
|
-
anfPos[0] += 0;
|
|
2600
|
-
anfPos[1] += 16;
|
|
2601
|
-
endPos[0] += 48;
|
|
2602
|
-
endPos[1] += 16;
|
|
2603
|
-
break;
|
|
2604
|
-
case 3:
|
|
2605
|
-
pos[0] += 16;
|
|
2606
|
-
pos[1] += 24;
|
|
2607
|
-
anfPos[0] += 0;
|
|
2608
|
-
anfPos[1] += 16;
|
|
2609
|
-
endPos[0] += 16;
|
|
2610
|
-
endPos[1] += 48;
|
|
2611
|
-
break;
|
|
2612
|
-
}
|
|
2613
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgLKondensator.lkondensator })) !== null && _b !== void 0 ? _b : undefined;
|
|
2614
|
-
const doLKondensator = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
2615
|
-
xPosition: pos[0],
|
|
2616
|
-
yPosition: pos[1],
|
|
2617
|
-
rotation: util_functions_1.DLUtilFunctions.getRotationBasedOnQuerzweig(nsgLKondensator.ausrichtung),
|
|
2618
|
-
diagramObjectName: `DiagramObject ${nsgLKondensator.lkondensator}`,
|
|
2619
|
-
identifiedObjectUUID: cimObjectUUID
|
|
2620
|
-
});
|
|
2621
|
-
this.addExportedDiagramObjectToGraph(nsgLKondensator.variantennr, nsgLKondensator.id, doLKondensator);
|
|
2622
|
-
resultingDiagramObjects.push(doLKondensator);
|
|
2623
|
-
/* ---------- ---------- ---------- */
|
|
2624
|
-
// BEGIN: Terminal-Export
|
|
2625
|
-
const anschlussanfTypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
2626
|
-
variantennr: nsgLKondensator.variantennr, id: nsgLKondensator.anschlussanf
|
|
2627
|
-
});
|
|
2628
|
-
const anfTerminalUUID = this.lookupTerminalUUID(lkondensator.aknoten, nsgLKondensator.lkondensator);
|
|
2629
|
-
if (anschlussanfTypedResult && anfTerminalUUID) {
|
|
2630
|
-
if (!this.exportedTerminalUUIDs.has(anfTerminalUUID)) {
|
|
2631
|
-
const connectivityNodePosition = yield this.getConnectivityNodePositionFor(anschlussanfTypedResult.type, anschlussanfTypedResult.object);
|
|
2632
|
-
this.exportedTerminalUUIDs.add(anfTerminalUUID);
|
|
2633
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
2634
|
-
cePoints: anfPos, cnPoints: connectivityNodePosition,
|
|
2635
|
-
terminalUuid: anfTerminalUUID
|
|
2636
|
-
});
|
|
2637
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
2638
|
-
}
|
|
2639
|
-
}
|
|
2640
|
-
const anschlussendTypedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
2641
|
-
variantennr: nsgLKondensator.variantennr, id: nsgLKondensator.anschlussend
|
|
2642
|
-
});
|
|
2643
|
-
const endTerminalUUID = this.lookupTerminalUUID(lkondensator.eknoten, nsgLKondensator.lkondensator);
|
|
2644
|
-
if (anschlussendTypedResult && endTerminalUUID) {
|
|
2645
|
-
if (!this.exportedTerminalUUIDs.has(endTerminalUUID)) {
|
|
2646
|
-
const connectivityNodePosition = yield this.getConnectivityNodePositionFor(anschlussendTypedResult.type, anschlussendTypedResult.object);
|
|
2647
|
-
this.exportedTerminalUUIDs.add(endTerminalUUID);
|
|
2648
|
-
const terminalDiagramObject = this.createTerminalDiagramObjectFromPoints({
|
|
2649
|
-
cePoints: endPos, cnPoints: connectivityNodePosition,
|
|
2650
|
-
terminalUuid: endTerminalUUID
|
|
2651
|
-
});
|
|
2652
|
-
resultingDiagramObjects.push(terminalDiagramObject);
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
// const doEndConnectivityNode = this.exportedDiagramObjectsGraph[nsgLKondensator.variantennr][nsgLKondensator.anschlussend];
|
|
2656
|
-
// const dopEndConnectivityNode = doEndConnectivityNode.diagramObjectPoints.map(arg => [arg.xPosition, arg.yPosition])[0];
|
|
2657
|
-
//
|
|
2658
|
-
// const endTerminalUUID = this.lookupTerminalUUID(nsgLKondensator.anschlussend, nsgLKondensator.id);
|
|
2659
|
-
// if (!this.exportedTerminalUUIDs.has(endTerminalUUID)) {
|
|
2660
|
-
// this.exportedTerminalUUIDs.add(endTerminalUUID);
|
|
2661
|
-
// const terminalDiagramObject = DLUtilFunctions.createDiagramObjectWithPoints(
|
|
2662
|
-
// [[...dopEndConnectivityNode], [...endPos]], null
|
|
2663
|
-
// );
|
|
2664
|
-
// terminalDiagramObject.identifiedObjectUUID = endTerminalUUID;
|
|
2665
|
-
// resultingDiagramObjects.push(terminalDiagramObject);
|
|
2666
|
-
// }
|
|
2667
|
-
// END: Terminal-Export
|
|
2668
|
-
/* ---------- ---------- ---------- */
|
|
2669
|
-
return resultingDiagramObjects;
|
|
2670
|
-
});
|
|
2671
|
-
}
|
|
2672
|
-
/**
|
|
2673
|
-
* convertSchemaStpschiene
|
|
2674
|
-
*/
|
|
2675
|
-
convertSchemaStpschiene(nsgStpschiene) {
|
|
2676
|
-
var _a, _b, _c;
|
|
2677
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2678
|
-
const leftUpperCornerOfNsgStpschiene = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstpschiene, nsgStpschiene);
|
|
2679
|
-
const length = nsgStpschiene.laenge;
|
|
2680
|
-
const points = [];
|
|
2681
|
-
let topLeft = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
2682
|
-
let bottomRight = new DiagramObjectPoint_1.DiagramObjectPoint();
|
|
2683
|
-
topLeft.xPosition = leftUpperCornerOfNsgStpschiene[0];
|
|
2684
|
-
topLeft.yPosition = leftUpperCornerOfNsgStpschiene[1];
|
|
2685
|
-
if (nsgStpschiene.ausrichtung % 2 === 0) {
|
|
2686
|
-
bottomRight.xPosition = leftUpperCornerOfNsgStpschiene[0] + length * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
2687
|
-
bottomRight.yPosition = leftUpperCornerOfNsgStpschiene[1];
|
|
2688
|
-
topLeft.yPosition += 4;
|
|
2689
|
-
bottomRight.yPosition += 4;
|
|
2690
|
-
}
|
|
2691
|
-
else {
|
|
2692
|
-
bottomRight.xPosition = leftUpperCornerOfNsgStpschiene[0];
|
|
2693
|
-
bottomRight.yPosition = leftUpperCornerOfNsgStpschiene[1] + length * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
2694
|
-
topLeft.xPosition += 4;
|
|
2695
|
-
bottomRight.xPosition += 4;
|
|
2696
|
-
}
|
|
2697
|
-
topLeft.sequenceNumber = 1;
|
|
2698
|
-
bottomRight.sequenceNumber = 2;
|
|
2699
|
-
points.push(topLeft, bottomRight);
|
|
2700
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgStpschiene.stpschiene })) !== null && _b !== void 0 ? _b : undefined;
|
|
2701
|
-
const connectivityNode = this.cimModelGraph.findObjectByUUID(cimObjectUUID);
|
|
2702
|
-
let junction = null;
|
|
2703
|
-
let junctionTerminal = null;
|
|
2704
|
-
if (connectivityNode) {
|
|
2705
|
-
for (const terminal of connectivityNode.terminals.values()) {
|
|
2706
|
-
if (terminal.conductingEquipment instanceof Junction_1.Junction) {
|
|
2707
|
-
junction = terminal.conductingEquipment;
|
|
2708
|
-
junctionTerminal = terminal;
|
|
2709
|
-
break;
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
if (junction && junctionTerminal && !((_c = this.config) === null || _c === void 0 ? void 0 : _c.busbarSectionAsConnectivityNode)) {
|
|
2714
|
-
// compute the position for the ConnectivityNode (the center of the BusbarSection)
|
|
2715
|
-
const centerPosition = [
|
|
2716
|
-
(topLeft.xPosition + bottomRight.xPosition) / 2,
|
|
2717
|
-
(topLeft.yPosition + bottomRight.yPosition) / 2
|
|
2718
|
-
];
|
|
2719
|
-
const doConnectivityNode = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint(centerPosition[0], centerPosition[1], null);
|
|
2720
|
-
doConnectivityNode.name = `Stpschiene CN ${nsgStpschiene.stpschiene}`;
|
|
2721
|
-
doConnectivityNode.identifiedObjectUUID = cimObjectUUID;
|
|
2722
|
-
this.addExportedDiagramObjectToGraph(nsgStpschiene.variantennr, nsgStpschiene.id, doConnectivityNode);
|
|
2723
|
-
const doJunction = new DiagramObject_1.DiagramObject(common_utils_1.CommonUtils.generateUUID(), `Stpschiene ${nsgStpschiene.id}`);
|
|
2724
|
-
doJunction.identifiedObjectUUID = junction.getUUID();
|
|
2725
|
-
doJunction.rotation = util_functions_1.DLUtilFunctions.getRotationBasedOnNsgSa(nsgStpschiene.ausrichtung);
|
|
2726
|
-
(0, utils_schema_1.copyDiagramObjectPoints)(doJunction, points);
|
|
2727
|
-
this.exportedTerminalUUIDs.add(junctionTerminal.getUUID());
|
|
2728
|
-
const doJunctionTerminal = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoints([[topLeft.xPosition, topLeft.yPosition], [...centerPosition]], null);
|
|
2729
|
-
doJunctionTerminal.identifiedObjectUUID = junctionTerminal.getUUID();
|
|
2730
|
-
return [doJunction, doJunctionTerminal, doConnectivityNode];
|
|
2731
|
-
}
|
|
2732
|
-
else {
|
|
2733
|
-
const doBusbarSectionAsConnectivityNode = new DiagramObject_1.DiagramObject(common_utils_1.CommonUtils.generateUUID(), `Stpschiene CN ${nsgStpschiene.id}`);
|
|
2734
|
-
doBusbarSectionAsConnectivityNode.identifiedObjectUUID = cimObjectUUID;
|
|
2735
|
-
doBusbarSectionAsConnectivityNode.rotation = util_functions_1.DLUtilFunctions.getRotationBasedOnNsgSa(nsgStpschiene.ausrichtung);
|
|
2736
|
-
(0, utils_schema_1.copyDiagramObjectPoints)(doBusbarSectionAsConnectivityNode, points);
|
|
2737
|
-
this.addExportedDiagramObjectToGraph(nsgStpschiene.variantennr, nsgStpschiene.id, doBusbarSectionAsConnectivityNode);
|
|
2738
|
-
return [doBusbarSectionAsConnectivityNode];
|
|
2739
|
-
}
|
|
2740
|
-
});
|
|
2741
|
-
}
|
|
2742
|
-
/**
|
|
2743
|
-
* convertSchemaStpknoten
|
|
2744
|
-
*/
|
|
2745
|
-
convertSchemaStpknoten(nsgStpknoten) {
|
|
2746
|
-
var _a, _b;
|
|
2747
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2748
|
-
const resultingDiagramObjects = [];
|
|
2749
|
-
let leftUpperCornerOfNsgStpknoten = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstpknoten, nsgStpknoten);
|
|
2750
|
-
const coords = [...leftUpperCornerOfNsgStpknoten];
|
|
2751
|
-
switch (nsgStpknoten.ausrichtung) {
|
|
2752
|
-
case 0:
|
|
2753
|
-
case 2:
|
|
2754
|
-
coords[0] += 8;
|
|
2755
|
-
coords[1] += 16;
|
|
2756
|
-
break;
|
|
2757
|
-
case 1:
|
|
2758
|
-
case 3:
|
|
2759
|
-
coords[0] += 16;
|
|
2760
|
-
coords[1] += 8;
|
|
2761
|
-
break;
|
|
2762
|
-
}
|
|
2763
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgStpknoten.knoten })) !== null && _b !== void 0 ? _b : undefined;
|
|
2764
|
-
const doStpknoten = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
2765
|
-
xPosition: coords[0],
|
|
2766
|
-
yPosition: coords[1],
|
|
2767
|
-
diagramObjectName: 'NsgStpknoten',
|
|
2768
|
-
identifiedObjectUUID: cimObjectUUID
|
|
2769
|
-
});
|
|
2770
|
-
this.addExportedDiagramObjectToGraph(nsgStpknoten.variantennr, nsgStpknoten.id, doStpknoten);
|
|
2771
|
-
resultingDiagramObjects.push(doStpknoten);
|
|
2772
|
-
// // TODO grounding
|
|
2773
|
-
// // check, if there is a ground that must be exported either
|
|
2774
|
-
// const netzKnoten1pelem = await this.dbObjectGraph.findFirstByAttributes(i7TableNames.netz_knoten1pelem, {
|
|
2775
|
-
// id: nsgStpknoten.knoten
|
|
2776
|
-
// });
|
|
2777
|
-
//
|
|
2778
|
-
// if (netzKnoten1pelem && netzKnoten1pelem.geerdet === 1) {
|
|
2779
|
-
//
|
|
2780
|
-
// }
|
|
2781
|
-
return resultingDiagramObjects;
|
|
2782
|
-
});
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* convertSchemaStpimpedanz
|
|
2786
|
-
*/
|
|
2787
|
-
convertSchemaStpimpedanz(nsgStpimpedanz) {
|
|
2788
|
-
var _a, _b;
|
|
2789
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2790
|
-
const resultingDiagramObjects = [];
|
|
2791
|
-
let leftUpperCornerOfNsgStpimpedanz = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstpimpedanz, nsgStpimpedanz);
|
|
2792
|
-
const coords = [...leftUpperCornerOfNsgStpimpedanz];
|
|
2793
|
-
/* width and height by orientation zero */
|
|
2794
|
-
const width = 32;
|
|
2795
|
-
const height = 16;
|
|
2796
|
-
switch (nsgStpimpedanz.ausrichtung) {
|
|
2797
|
-
case 0:
|
|
2798
|
-
case 2:
|
|
2799
|
-
coords[0] += (width / 2);
|
|
2800
|
-
coords[1] += (height / 2);
|
|
2801
|
-
break;
|
|
2802
|
-
case 1:
|
|
2803
|
-
case 3:
|
|
2804
|
-
coords[0] += (height / 2);
|
|
2805
|
-
coords[1] += (width / 2);
|
|
2806
|
-
break;
|
|
2807
|
-
}
|
|
2808
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgStpimpedanz.kdrossel })) !== null && _b !== void 0 ? _b : undefined;
|
|
2809
|
-
const doStpknoten = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
2810
|
-
xPosition: coords[0],
|
|
2811
|
-
yPosition: coords[1],
|
|
2812
|
-
diagramObjectName: 'NsgStpknoten',
|
|
2813
|
-
identifiedObjectUUID: cimObjectUUID
|
|
2814
|
-
});
|
|
2815
|
-
this.addExportedDiagramObjectToGraph(nsgStpimpedanz.variantennr, nsgStpimpedanz.id, doStpknoten);
|
|
2816
|
-
resultingDiagramObjects.push(doStpknoten);
|
|
2817
|
-
return resultingDiagramObjects;
|
|
2818
|
-
});
|
|
2819
|
-
}
|
|
2820
|
-
/**
|
|
2821
|
-
* convertSchemaStpschaltfeld
|
|
2822
|
-
*/
|
|
2823
|
-
convertSchemaStpschaltfeldElemente(nsgStpschaltfeld) {
|
|
2824
|
-
var _a, _b, _c, _d;
|
|
2825
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2826
|
-
const resultingDiagramObjects = [];
|
|
2827
|
-
const leftUpperCornerOfNsgStpSchaltfeld = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstpschaltfeld, nsgStpschaltfeld);
|
|
2828
|
-
const nsgStpschiene = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstpschiene, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
2829
|
-
variantennr: nsgStpschaltfeld.variantennr,
|
|
2830
|
-
id: nsgStpschaltfeld.nsgstpschiene
|
|
2831
|
-
});
|
|
2832
|
-
if (!nsgStpschiene)
|
|
2833
|
-
return;
|
|
2834
|
-
if (nsgStpschaltfeld.schaltfeld !== undefined) {
|
|
2835
|
-
const schaltelement1pelem = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.netz_schaltelement1pelem, convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgStpschaltfeld.schaltfeld });
|
|
2836
|
-
let bayOrientation = nsgStpschiene.ausrichtung;
|
|
2837
|
-
if (nsgStpschaltfeld.deltaausrichtung === 1) {
|
|
2838
|
-
bayOrientation = (bayOrientation + 2) % 4;
|
|
2839
|
-
}
|
|
2840
|
-
let rotationValue = null;
|
|
2841
|
-
const coordsEquipment = [...leftUpperCornerOfNsgStpSchaltfeld];
|
|
2842
|
-
const coordsConnectivityNodeBusbarSection = [...leftUpperCornerOfNsgStpSchaltfeld];
|
|
2843
|
-
const coordsConnectivityNodeBayEnd = [...leftUpperCornerOfNsgStpSchaltfeld];
|
|
2844
|
-
switch (bayOrientation) {
|
|
2845
|
-
case 0: // TOP
|
|
2846
|
-
rotationValue = 0;
|
|
2847
|
-
coordsEquipment[0] += 8;
|
|
2848
|
-
coordsEquipment[1] += 12;
|
|
2849
|
-
coordsConnectivityNodeBayEnd[0] += 8;
|
|
2850
|
-
// coordsConnectivityNodeBayEnd[1];
|
|
2851
|
-
coordsConnectivityNodeBusbarSection[0] += 8;
|
|
2852
|
-
coordsConnectivityNodeBusbarSection[1] += 20;
|
|
2853
|
-
break;
|
|
2854
|
-
case 1: // RIGHT
|
|
2855
|
-
rotationValue = 90;
|
|
2856
|
-
coordsEquipment[0] += 12;
|
|
2857
|
-
coordsEquipment[1] += 8;
|
|
2858
|
-
coordsConnectivityNodeBayEnd[0] += 24;
|
|
2859
|
-
coordsConnectivityNodeBayEnd[1] += 8;
|
|
2860
|
-
coordsConnectivityNodeBusbarSection[0] += 4;
|
|
2861
|
-
coordsConnectivityNodeBusbarSection[1] += 8;
|
|
2862
|
-
break;
|
|
2863
|
-
case 2: // BOTTOM
|
|
2864
|
-
rotationValue = 180;
|
|
2865
|
-
coordsEquipment[0] += 8;
|
|
2866
|
-
coordsEquipment[1] += 12;
|
|
2867
|
-
coordsConnectivityNodeBayEnd[0] += 8;
|
|
2868
|
-
coordsConnectivityNodeBayEnd[1] += 24;
|
|
2869
|
-
coordsConnectivityNodeBusbarSection[0] += 8;
|
|
2870
|
-
coordsConnectivityNodeBusbarSection[1] += 4;
|
|
2871
|
-
break;
|
|
2872
|
-
case 3: // LEFT
|
|
2873
|
-
rotationValue = 270;
|
|
2874
|
-
coordsEquipment[0] += 12;
|
|
2875
|
-
coordsEquipment[1] += 8;
|
|
2876
|
-
// coordsConnectivityNodeBayEnd[0];
|
|
2877
|
-
coordsConnectivityNodeBayEnd[1] += 8;
|
|
2878
|
-
coordsConnectivityNodeBusbarSection[0] += 20;
|
|
2879
|
-
coordsConnectivityNodeBusbarSection[1] += 8;
|
|
2880
|
-
break;
|
|
2881
|
-
}
|
|
2882
|
-
const equipmentUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: schaltelement1pelem.id })) !== null && _b !== void 0 ? _b : undefined;
|
|
2883
|
-
const doEquipment = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
2884
|
-
xPosition: coordsEquipment[0],
|
|
2885
|
-
yPosition: coordsEquipment[1],
|
|
2886
|
-
rotation: rotationValue,
|
|
2887
|
-
diagramObjectName: `NsgStpschaltfeld-Node ${schaltelement1pelem.id}`,
|
|
2888
|
-
identifiedObjectUUID: equipmentUUID
|
|
2889
|
-
});
|
|
2890
|
-
const connectivityNodeBayEndUUID = (_d = (_c = this.dbObjectKeyCimModelUuidGraph) === null || _c === void 0 ? void 0 : _c.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: schaltelement1pelem.eknoten })) !== null && _d !== void 0 ? _d : undefined;
|
|
2891
|
-
const doConnectivityNodeBayEnd = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoint2({
|
|
2892
|
-
xPosition: coordsConnectivityNodeBayEnd[0],
|
|
2893
|
-
yPosition: coordsConnectivityNodeBayEnd[1],
|
|
2894
|
-
diagramObjectName: `ConnectivityNodeBayEnd ${schaltelement1pelem.eknoten}`,
|
|
2895
|
-
identifiedObjectUUID: connectivityNodeBayEndUUID
|
|
2896
|
-
});
|
|
2897
|
-
const doTerminal1 = this.createTerminalDiagramObjectFromPoints({
|
|
2898
|
-
cePoints: [...coordsConnectivityNodeBusbarSection], cnPoints: [...coordsEquipment],
|
|
2899
|
-
terminalUuid: this.lookupTerminalUUID(schaltelement1pelem.aknoten, schaltelement1pelem.id)
|
|
2900
|
-
});
|
|
2901
|
-
resultingDiagramObjects.push(doTerminal1);
|
|
2902
|
-
const doTerminal2 = this.createTerminalDiagramObjectFromPoints({
|
|
2903
|
-
cePoints: [...coordsConnectivityNodeBayEnd], cnPoints: [...coordsEquipment],
|
|
2904
|
-
terminalUuid: this.lookupTerminalUUID(schaltelement1pelem.eknoten, schaltelement1pelem.id)
|
|
2905
|
-
});
|
|
2906
|
-
resultingDiagramObjects.push(doTerminal2);
|
|
2907
|
-
// this.addExportedDiagramObjectToGraph(nsgStpschaltfeld.variantennr, nsgStpschaltfeld.id, doStpknoten);
|
|
2908
|
-
resultingDiagramObjects.push(doEquipment);
|
|
2909
|
-
resultingDiagramObjects.push(doConnectivityNodeBayEnd);
|
|
2910
|
-
}
|
|
2911
|
-
return resultingDiagramObjects;
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
|
-
/**
|
|
2915
|
-
* convertSchemaStp*-Terminals
|
|
2916
|
-
*/
|
|
2917
|
-
convertSchemaStpTerminals(nsgStpknoten) {
|
|
2918
|
-
var _a, _b;
|
|
2919
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2920
|
-
const resultingDiagramObjects = [];
|
|
2921
|
-
const cimObjectUUID = (_b = (_a = this.dbObjectKeyCimModelUuidGraph) === null || _a === void 0 ? void 0 : _a.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: nsgStpknoten.knoten })) !== null && _b !== void 0 ? _b : undefined;
|
|
2922
|
-
const doConnectivityNode = this.exportedDiagramObjectsGraph[nsgStpknoten.variantennr][nsgStpknoten.id];
|
|
2923
|
-
const connectivityNode = this.cimModelGraph.findObjectByUUID(doConnectivityNode.getIdentifiedObjectUUID());
|
|
2924
|
-
if (connectivityNode !== undefined) {
|
|
2925
|
-
for (const terminal of connectivityNode.terminals.values()) {
|
|
2926
|
-
if (this.exportedTerminalUUIDs.has(terminal.getUUID()))
|
|
2927
|
-
continue;
|
|
2928
|
-
const ceUUID = terminal.getConductingEquipmentUUID();
|
|
2929
|
-
const ceDbKeys = this.dbObjectKeyCimModelUuidGraph.getDbKeyDbFromCimObjectId(ceUUID);
|
|
2930
|
-
if (ceDbKeys.VariantenNrIdKey) {
|
|
2931
|
-
const ceDbKey = ceDbKeys.VariantenNrIdKey;
|
|
2932
|
-
const doConductingEquipment = this.exportedDiagramObjectsGraph[ceDbKey.variantennr][ceDbKey.id];
|
|
2933
|
-
}
|
|
2934
|
-
else if (ceDbKeys.IdOnlyKey) {
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
else {
|
|
2939
|
-
console.log(cimObjectUUID);
|
|
2940
|
-
}
|
|
2941
|
-
return resultingDiagramObjects;
|
|
2942
|
-
});
|
|
2943
|
-
}
|
|
2944
|
-
/* ---------- ---------- ---------- ---------- ---------- */
|
|
2945
|
-
//
|
|
2946
|
-
// utility functions
|
|
2947
|
-
//
|
|
2948
|
-
/* ---------- ---------- ---------- ---------- ---------- */
|
|
2949
|
-
getLeftUpperCornerOfUnspecified(variantennr, id) {
|
|
2950
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2951
|
-
const { type, object } = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
2952
|
-
variantennr, id
|
|
2953
|
-
});
|
|
2954
|
-
if (type === convert_graph_keys_1.i7TableNames.nsg_nsgknotenso) {
|
|
2955
|
-
return yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgknotenso, object);
|
|
2956
|
-
}
|
|
2957
|
-
else if (type === convert_graph_keys_1.i7TableNames.nsg_nsgknotenhgue) {
|
|
2958
|
-
return yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgknotenhgue, object);
|
|
2959
|
-
}
|
|
2960
|
-
else if (type === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld) {
|
|
2961
|
-
return yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld, object);
|
|
2962
|
-
}
|
|
2963
|
-
else if (type === convert_graph_keys_1.i7TableNames.nsg_nsgquerzweig) {
|
|
2964
|
-
return yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgquerzweig, object);
|
|
2965
|
-
}
|
|
2966
|
-
});
|
|
2967
|
-
}
|
|
2968
|
-
getLeftUpperCornerOf(i7ObjectType, object, variantennr) {
|
|
2969
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2970
|
-
if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgknotenso) {
|
|
2971
|
-
const nsgKnotenSo = object;
|
|
2972
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKnotenSo.variantennr, id: nsgKnotenSo.nsgso });
|
|
2973
|
-
if (!nsgStandort)
|
|
2974
|
-
return;
|
|
2975
|
-
return [nsgStandort.xrel + nsgKnotenSo.xrel, nsgStandort.yrel + nsgKnotenSo.yrel];
|
|
2976
|
-
}
|
|
2977
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgknotenhgue) {
|
|
2978
|
-
const nsgKnotenHgue = object;
|
|
2979
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgKnotenHgue.variantennr, id: nsgKnotenHgue.nsgso });
|
|
2980
|
-
if (!nsgStandort)
|
|
2981
|
-
return;
|
|
2982
|
-
return [nsgStandort.xrel + nsgKnotenHgue.xrel, nsgStandort.yrel + nsgKnotenHgue.yrel];
|
|
2983
|
-
}
|
|
2984
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgstandort) {
|
|
2985
|
-
/* ---------- ---------- ---------- */
|
|
2986
|
-
/* NsgStandort */
|
|
2987
|
-
/* ---------- ---------- ---------- */
|
|
2988
|
-
const nsgStandort = object;
|
|
2989
|
-
return [nsgStandort.xrel, nsgStandort.yrel];
|
|
2990
|
-
}
|
|
2991
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage) {
|
|
2992
|
-
/* ---------- ---------- ---------- */
|
|
2993
|
-
/* NsgSchaltanlage */
|
|
2994
|
-
/* ---------- ---------- ---------- */
|
|
2995
|
-
const nsgSchaltanlage = object;
|
|
2996
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltanlage.variantennr, id: nsgSchaltanlage.nsgso });
|
|
2997
|
-
if (!nsgStandort)
|
|
2998
|
-
return;
|
|
2999
|
-
const coords = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, nsgStandort);
|
|
3000
|
-
coords[0] += nsgSchaltanlage.xrel;
|
|
3001
|
-
coords[1] += nsgSchaltanlage.yrel;
|
|
3002
|
-
return coords;
|
|
3003
|
-
}
|
|
3004
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt) {
|
|
3005
|
-
/* ---------- ---------- ---------- */
|
|
3006
|
-
/* NsgSaabschnitt */
|
|
3007
|
-
/* ---------- ---------- ---------- */
|
|
3008
|
-
const nsgSaabschnitt = object;
|
|
3009
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
3010
|
-
if (!nsgSchaltanlage)
|
|
3011
|
-
return;
|
|
3012
|
-
// add the i7-offset for a NsgSaabschnitt in x-direction
|
|
3013
|
-
const nsgSaabschnittCoords = [0, 0];
|
|
3014
|
-
nsgSaabschnittCoords[0] += nsgSaabschnitt.nslots * 16;
|
|
3015
|
-
const sizeOfSchaltanlage = yield this.getSizeOfSchaltanlage(nsgSchaltanlage);
|
|
3016
|
-
util_functions_1.DLUtilFunctions.rotatePoint(nsgSaabschnittCoords, -90 * nsgSchaltanlage.ausrichtung);
|
|
3017
|
-
if (nsgSchaltanlage.ausrichtung === 2) {
|
|
3018
|
-
nsgSaabschnittCoords[0] += (sizeOfSchaltanlage - nsgSaabschnitt.laenge) * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
3019
|
-
}
|
|
3020
|
-
else if (nsgSchaltanlage.ausrichtung === 3) {
|
|
3021
|
-
nsgSaabschnittCoords[1] += (sizeOfSchaltanlage - nsgSaabschnitt.laenge) * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
3022
|
-
}
|
|
3023
|
-
const nsgSchaltanlageCoords = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, nsgSchaltanlage);
|
|
3024
|
-
return util_functions_1.DLUtilFunctions.add(nsgSaabschnittCoords, nsgSchaltanlageCoords, nsgSchaltanlage.ausrichtung % 2 === 0 ? [8, 0] : [0, 8]);
|
|
3025
|
-
}
|
|
3026
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld || i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld) {
|
|
3027
|
-
/* ---------- ---------- ---------- */
|
|
3028
|
-
/* NsgSchaltfeld or NsgKpfeld */
|
|
3029
|
-
/* ---------- ---------- ---------- */
|
|
3030
|
-
// Important! The difference between a bay and a coupler is the slot-number related offset
|
|
3031
|
-
// the slot-number related offset of the bay must be adjusted by an offset of -8 related to the orientation
|
|
3032
|
-
// the slot-number related offset of the coupler matches exactly
|
|
3033
|
-
const nsgSchaltfeld = object;
|
|
3034
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltfeld.variantennr, id: nsgSchaltfeld.nsgsaa });
|
|
3035
|
-
if (!nsgSaabschnitt)
|
|
3036
|
-
return;
|
|
3037
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
3038
|
-
if (nsgSchaltanlage === undefined)
|
|
3039
|
-
return;
|
|
3040
|
-
//
|
|
3041
|
-
// const nsgStandort = await this.dbObjectGraph.findObjectByKey(i7TableNames.nsg_nsgstandort,
|
|
3042
|
-
// i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSchaltanlage.variantennr, id: nsgSchaltanlage.nsgso }
|
|
3043
|
-
// );
|
|
3044
|
-
// if (!nsgStandort) return;
|
|
3045
|
-
const leftUpperCornerOfNsgSaabschnitt = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, nsgSaabschnitt);
|
|
3046
|
-
let orientation = nsgSchaltanlage.ausrichtung;
|
|
3047
|
-
if (nsgSchaltfeld.deltaausrichtung === 1) {
|
|
3048
|
-
orientation = (orientation + 2) % 4;
|
|
3049
|
-
}
|
|
3050
|
-
let position = [...leftUpperCornerOfNsgSaabschnitt];
|
|
3051
|
-
let schaltfeldOffset;
|
|
3052
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
3053
|
-
case 0:
|
|
3054
|
-
case 1:
|
|
3055
|
-
schaltfeldOffset = nsgSchaltfeld.slotnummer * 16;
|
|
3056
|
-
break;
|
|
3057
|
-
case 2:
|
|
3058
|
-
case 3:
|
|
3059
|
-
schaltfeldOffset = (nsgSaabschnitt.laenge - nsgSchaltfeld.slotnummer - 1) * 16;
|
|
3060
|
-
if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld)
|
|
3061
|
-
schaltfeldOffset -= 16;
|
|
3062
|
-
break;
|
|
3063
|
-
}
|
|
3064
|
-
const maxSsabPos = yield this.getMaxPosOfSaabschnitt(nsgSaabschnitt);
|
|
3065
|
-
switch (orientation) {
|
|
3066
|
-
case 0: // TOP
|
|
3067
|
-
position[0] += (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld) ? schaltfeldOffset : schaltfeldOffset - 8;
|
|
3068
|
-
position[1] -= nsgSchaltfeld.hoehe - ((maxSsabPos + 1) * 8);
|
|
3069
|
-
break;
|
|
3070
|
-
case 1: // RIGHT
|
|
3071
|
-
position[1] += (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld) ? schaltfeldOffset : schaltfeldOffset - 8;
|
|
3072
|
-
break;
|
|
3073
|
-
case 2: // BOTTOM
|
|
3074
|
-
position[0] += (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld) ? schaltfeldOffset : schaltfeldOffset - 8;
|
|
3075
|
-
break;
|
|
3076
|
-
case 3: // LEFT
|
|
3077
|
-
position[0] -= nsgSchaltfeld.hoehe - ((maxSsabPos + 1) * 8);
|
|
3078
|
-
position[1] += (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld) ? schaltfeldOffset : schaltfeldOffset - 8;
|
|
3079
|
-
break;
|
|
3080
|
-
}
|
|
3081
|
-
return position;
|
|
3082
|
-
}
|
|
3083
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsglkupplung) {
|
|
3084
|
-
/* ---------- ---------- ---------- */
|
|
3085
|
-
/* NsgLKupplung */
|
|
3086
|
-
/* ---------- ---------- ---------- */
|
|
3087
|
-
const nsgLKupplung = object;
|
|
3088
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplung.variantennr, id: nsgLKupplung.nsgsaa });
|
|
3089
|
-
if (!nsgSaabschnitt)
|
|
3090
|
-
return;
|
|
3091
|
-
const leftUpperCornerOfNsgSaabschnitt = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, nsgSaabschnitt);
|
|
3092
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
3093
|
-
if (nsgSchaltanlage === undefined)
|
|
3094
|
-
return;
|
|
3095
|
-
let position = [...leftUpperCornerOfNsgSaabschnitt];
|
|
3096
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
3097
|
-
case 0: // left-to-right
|
|
3098
|
-
position[0] -= nsgLKupplung.laenge * 16;
|
|
3099
|
-
break;
|
|
3100
|
-
case 1: // top-to-bottom
|
|
3101
|
-
position[1] -= nsgLKupplung.laenge * 16;
|
|
3102
|
-
break;
|
|
3103
|
-
case 2: // right-to-left
|
|
3104
|
-
position[0] += (yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnitt)) * 16;
|
|
3105
|
-
break;
|
|
3106
|
-
case 3: // bottom-to-top
|
|
3107
|
-
position[1] += (yield this.getLengthOfSammelschienenAbschnitt(nsgSaabschnitt)) * 16;
|
|
3108
|
-
break;
|
|
3109
|
-
}
|
|
3110
|
-
return position;
|
|
3111
|
-
}
|
|
3112
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.netz_ssab) {
|
|
3113
|
-
/* ---------- ---------- ---------- */
|
|
3114
|
-
/* NetzSsab */
|
|
3115
|
-
/* ---------- ---------- ---------- */
|
|
3116
|
-
const netzSsab = object;
|
|
3117
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findFirstByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, { variantennr, saabschnitt: netzSsab.saabschnitt });
|
|
3118
|
-
if (nsgSaabschnitt === undefined)
|
|
3119
|
-
return;
|
|
3120
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
3121
|
-
if (!nsgSchaltanlage)
|
|
3122
|
-
return;
|
|
3123
|
-
// add the i7-offset for a NsgSaabschnitt in x-direction
|
|
3124
|
-
const nsgSaabschnittCoords = [0, 0];
|
|
3125
|
-
nsgSaabschnittCoords[0] += nsgSaabschnitt.nslots * 16;
|
|
3126
|
-
const sizeOfSchaltanlage = yield this.getSizeOfSchaltanlage(nsgSchaltanlage);
|
|
3127
|
-
util_functions_1.DLUtilFunctions.rotatePoint(nsgSaabschnittCoords, -90 * nsgSchaltanlage.ausrichtung);
|
|
3128
|
-
if (nsgSchaltanlage.ausrichtung === 0) {
|
|
3129
|
-
nsgSaabschnittCoords[1] += 4 + netzSsab.pos * 8;
|
|
3130
|
-
// const maxSsabPos = await this.getMaxPosOfSaabschnitt(nsgSaabschnitt);
|
|
3131
|
-
// nsgSaabschnittCoords[0] += 4 + ((maxSsabPos - netzSsab.pos) * 8);
|
|
3132
|
-
}
|
|
3133
|
-
else if (nsgSchaltanlage.ausrichtung === 1) {
|
|
3134
|
-
const maxSsabPos = yield this.getMaxPosOfSaabschnitt(nsgSaabschnitt);
|
|
3135
|
-
nsgSaabschnittCoords[0] += 4 + ((maxSsabPos - netzSsab.pos) * 8);
|
|
3136
|
-
}
|
|
3137
|
-
else if (nsgSchaltanlage.ausrichtung === 2) {
|
|
3138
|
-
const maxSsabPos = yield this.getMaxPosOfSaabschnitt(nsgSaabschnitt);
|
|
3139
|
-
nsgSaabschnittCoords[1] += 4 + ((maxSsabPos - netzSsab.pos) * 8);
|
|
3140
|
-
nsgSaabschnittCoords[0] += (sizeOfSchaltanlage - nsgSaabschnitt.laenge) * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
3141
|
-
}
|
|
3142
|
-
else if (nsgSchaltanlage.ausrichtung === 3) {
|
|
3143
|
-
nsgSaabschnittCoords[0] += 4 + netzSsab.pos * 8;
|
|
3144
|
-
nsgSaabschnittCoords[1] += (sizeOfSchaltanlage - nsgSaabschnitt.laenge) * constants_1.NsgConstants.HORIZONTAL_OFFSET;
|
|
3145
|
-
}
|
|
3146
|
-
const nsgSchaltanlageCoords = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, nsgSchaltanlage);
|
|
3147
|
-
return util_functions_1.DLUtilFunctions.add(nsgSaabschnittCoords, nsgSchaltanlageCoords, nsgSchaltanlage.ausrichtung % 2 === 0 ? [8, 0] : [0, 8]);
|
|
3148
|
-
}
|
|
3149
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgstpschiene) {
|
|
3150
|
-
/* ---------- ---------- ---------- */
|
|
3151
|
-
/* NsgStpschiene */
|
|
3152
|
-
/* ---------- ---------- ---------- */
|
|
3153
|
-
const nsgStpschiene = object;
|
|
3154
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgStpschiene.variantennr, id: nsgStpschiene.nsgso });
|
|
3155
|
-
if (!nsgStandort)
|
|
3156
|
-
return;
|
|
3157
|
-
const coords = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, nsgStandort);
|
|
3158
|
-
coords[0] += nsgStpschiene.xrel;
|
|
3159
|
-
coords[1] += nsgStpschiene.yrel;
|
|
3160
|
-
return coords;
|
|
3161
|
-
}
|
|
3162
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgtrafo2w || i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgtrafo3w) {
|
|
3163
|
-
/* ---------- ---------- ---------- */
|
|
3164
|
-
/* NsgTrafo{2w|3w}*/
|
|
3165
|
-
/* ---------- ---------- ---------- */
|
|
3166
|
-
const nsgTrafo = object;
|
|
3167
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgTrafo.variantennr, id: nsgTrafo.nsgso });
|
|
3168
|
-
if (!nsgStandort)
|
|
3169
|
-
return;
|
|
3170
|
-
const leftUpperCornerOfNsgSo = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, nsgStandort);
|
|
3171
|
-
leftUpperCornerOfNsgSo[0] += nsgTrafo.xrel;
|
|
3172
|
-
leftUpperCornerOfNsgSo[1] += nsgTrafo.yrel;
|
|
3173
|
-
return leftUpperCornerOfNsgSo;
|
|
3174
|
-
}
|
|
3175
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgstpschaltfeld) {
|
|
3176
|
-
/* ---------- ---------- ---------- */
|
|
3177
|
-
/* NsgStpschaltfeld */
|
|
3178
|
-
/* ---------- ---------- ---------- */
|
|
3179
|
-
const nsgStpschaltfeld = object;
|
|
3180
|
-
const nsgStpschiene = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstpschiene, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
3181
|
-
variantennr: nsgStpschaltfeld.variantennr,
|
|
3182
|
-
id: nsgStpschaltfeld.nsgstpschiene
|
|
3183
|
-
});
|
|
3184
|
-
if (!nsgStpschiene)
|
|
3185
|
-
return;
|
|
3186
|
-
const leftUpperCornerOfNsgStpschiene = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstpschiene, nsgStpschiene);
|
|
3187
|
-
let orientation = nsgStpschiene.ausrichtung;
|
|
3188
|
-
if (nsgStpschaltfeld.deltaausrichtung === 1) {
|
|
3189
|
-
orientation = (orientation + 2) % 4;
|
|
3190
|
-
}
|
|
3191
|
-
let position = [...leftUpperCornerOfNsgStpschiene];
|
|
3192
|
-
let schaltfeldOffset;
|
|
3193
|
-
switch (nsgStpschiene.ausrichtung) {
|
|
3194
|
-
case 0:
|
|
3195
|
-
case 1:
|
|
3196
|
-
schaltfeldOffset = nsgStpschaltfeld.slotnummer * 16;
|
|
3197
|
-
break;
|
|
3198
|
-
case 2:
|
|
3199
|
-
case 3:
|
|
3200
|
-
schaltfeldOffset = (nsgStpschiene.laenge - nsgStpschaltfeld.slotnummer - 1) * 16;
|
|
3201
|
-
break;
|
|
3202
|
-
}
|
|
3203
|
-
switch (orientation) {
|
|
3204
|
-
case 0: // TOP
|
|
3205
|
-
position[0] += schaltfeldOffset;
|
|
3206
|
-
position[1] -= nsgStpschaltfeld.hoehe - 8;
|
|
3207
|
-
break;
|
|
3208
|
-
case 1: // RIGHT
|
|
3209
|
-
position[1] += schaltfeldOffset;
|
|
3210
|
-
break;
|
|
3211
|
-
case 2: // BOTTOM
|
|
3212
|
-
position[0] += schaltfeldOffset;
|
|
3213
|
-
break;
|
|
3214
|
-
case 3: // LEFT
|
|
3215
|
-
position[0] -= nsgStpschaltfeld.hoehe - 8;
|
|
3216
|
-
position[1] += schaltfeldOffset;
|
|
3217
|
-
break;
|
|
3218
|
-
}
|
|
3219
|
-
return position;
|
|
3220
|
-
}
|
|
3221
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgstpknoten) {
|
|
3222
|
-
/* ---------- ---------- ---------- */
|
|
3223
|
-
/* NsgStpknoten */
|
|
3224
|
-
/* ---------- ---------- ---------- */
|
|
3225
|
-
const nsgStpknoten = object;
|
|
3226
|
-
let leftUpperCornerOfNsgTrafo;
|
|
3227
|
-
const nsgTrafo2w = this.dbObjectGraph.findFirstByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgtrafo2w, {
|
|
3228
|
-
anschlussanf_stp: nsgStpknoten.id,
|
|
3229
|
-
anschlussend_stp: nsgStpknoten.id
|
|
3230
|
-
}, true);
|
|
3231
|
-
if (!nsgTrafo2w) {
|
|
3232
|
-
const nsgTrafo3w = this.dbObjectGraph.findFirstByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgtrafo3w, {
|
|
3233
|
-
anschlussanfw1: nsgStpknoten.id,
|
|
3234
|
-
anschlussanfw2: nsgStpknoten.id,
|
|
3235
|
-
anschlussanfw3: nsgStpknoten.id
|
|
3236
|
-
}, true);
|
|
3237
|
-
if (!nsgTrafo3w)
|
|
3238
|
-
return;
|
|
3239
|
-
leftUpperCornerOfNsgTrafo = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgtrafo3w, nsgTrafo3w);
|
|
3240
|
-
}
|
|
3241
|
-
else {
|
|
3242
|
-
leftUpperCornerOfNsgTrafo = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgtrafo2w, nsgTrafo2w);
|
|
3243
|
-
}
|
|
3244
|
-
if (!leftUpperCornerOfNsgTrafo)
|
|
3245
|
-
return;
|
|
3246
|
-
leftUpperCornerOfNsgTrafo[0] += nsgStpknoten.xrel;
|
|
3247
|
-
leftUpperCornerOfNsgTrafo[1] += nsgStpknoten.yrel;
|
|
3248
|
-
return leftUpperCornerOfNsgTrafo;
|
|
3249
|
-
}
|
|
3250
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgstpimpedanz) {
|
|
3251
|
-
/* ---------- ---------- ---------- */
|
|
3252
|
-
/* NsgStpimpedanz */
|
|
3253
|
-
/* ---------- ---------- ---------- */
|
|
3254
|
-
const nsgStpimpedanz = object;
|
|
3255
|
-
const nsgStpschaltfeld = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstpschaltfeld, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
3256
|
-
variantennr: nsgStpimpedanz.variantennr,
|
|
3257
|
-
id: nsgStpimpedanz.anschluss
|
|
3258
|
-
});
|
|
3259
|
-
if (!nsgStpschaltfeld)
|
|
3260
|
-
return;
|
|
3261
|
-
const coords = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstpschaltfeld, nsgStpschaltfeld);
|
|
3262
|
-
coords[0] += nsgStpimpedanz.xrel;
|
|
3263
|
-
coords[1] += nsgStpimpedanz.yrel;
|
|
3264
|
-
return coords;
|
|
3265
|
-
}
|
|
3266
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsglkondensator) {
|
|
3267
|
-
/* ---------- ---------- ---------- */
|
|
3268
|
-
/* NsgLKondensator */
|
|
3269
|
-
/* ---------- ---------- ---------- */
|
|
3270
|
-
const nsgLKondensator = object;
|
|
3271
|
-
const nsgStandort = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKondensator.variantennr, id: nsgLKondensator.nsgso });
|
|
3272
|
-
if (!nsgStandort)
|
|
3273
|
-
return;
|
|
3274
|
-
const leftUpperCornerOfNsgSo = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgstandort, nsgStandort);
|
|
3275
|
-
leftUpperCornerOfNsgSo[0] += nsgLKondensator.xrel;
|
|
3276
|
-
leftUpperCornerOfNsgSo[1] += nsgLKondensator.yrel;
|
|
3277
|
-
return leftUpperCornerOfNsgSo;
|
|
3278
|
-
}
|
|
3279
|
-
else if (i7ObjectType === convert_graph_keys_1.i7TableNames.nsg_nsgquerzweig) {
|
|
3280
|
-
/* ---------- ---------- ---------- */
|
|
3281
|
-
/* NsgQuerzweig */
|
|
3282
|
-
/* ---------- ---------- ---------- */
|
|
3283
|
-
const nsgQuerzweig = object;
|
|
3284
|
-
const typedResult = this.dbObjectGraph.findTypedFirstByKey(convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, {
|
|
3285
|
-
variantennr: nsgQuerzweig.variantennr, id: nsgQuerzweig.bezugsobjekt
|
|
3286
|
-
});
|
|
3287
|
-
if (!typedResult)
|
|
3288
|
-
return null;
|
|
3289
|
-
const { type, object: resultObject } = typedResult;
|
|
3290
|
-
let xPosition = nsgQuerzweig.xrel;
|
|
3291
|
-
let yPosition = nsgQuerzweig.yrel;
|
|
3292
|
-
if (type === convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld) {
|
|
3293
|
-
const nsgSchaltfeld = resultObject;
|
|
3294
|
-
const leftUpperCornerOfSchaltfeld = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld, nsgSchaltfeld);
|
|
3295
|
-
return [xPosition + leftUpperCornerOfSchaltfeld[0], yPosition + leftUpperCornerOfSchaltfeld[1]];
|
|
3296
|
-
}
|
|
3297
|
-
else {
|
|
3298
|
-
return [undefined, undefined];
|
|
3299
|
-
}
|
|
3300
|
-
}
|
|
3301
|
-
return [undefined, undefined];
|
|
3302
|
-
});
|
|
3303
|
-
}
|
|
3304
|
-
getLeftUpperCornerOfLKupplungRssElement(nsgLKupplungRss, cornerOf) {
|
|
3305
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3306
|
-
if (cornerOf.slot_anf || cornerOf.slot_end) {
|
|
3307
|
-
/* ---------- ---------- ---------- */
|
|
3308
|
-
/* slot_anf || slot_end*/
|
|
3309
|
-
/* ---------- ---------- ---------- */
|
|
3310
|
-
const nsgSaabschnittId = cornerOf.slot_anf ? nsgLKupplungRss.nsgsaa_anf : nsgLKupplungRss.nsgsaa_end;
|
|
3311
|
-
const slotIndex = cornerOf.slot_anf ? nsgLKupplungRss.slot_anf : nsgLKupplungRss.slot_end;
|
|
3312
|
-
const nsgSaabschnitt = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgLKupplungRss.variantennr, id: nsgSaabschnittId });
|
|
3313
|
-
if (!nsgSaabschnitt)
|
|
3314
|
-
return;
|
|
3315
|
-
const leftUpperCornerOfNsgSaabschnitt = yield this.getLeftUpperCornerOf(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, nsgSaabschnitt);
|
|
3316
|
-
const nsgSchaltanlage = yield this.dbObjectGraph.findObjectByKey(convert_graph_keys_1.i7TableNames.nsg_nsgschaltanlage, convert_graph_keys_1.i7SchemaKeyNames.VariantenNrIdKey, { variantennr: nsgSaabschnitt.variantennr, id: nsgSaabschnitt.nsgsa });
|
|
3317
|
-
if (!nsgSchaltanlage)
|
|
3318
|
-
return;
|
|
3319
|
-
switch (nsgSchaltanlage.ausrichtung) {
|
|
3320
|
-
case 0:
|
|
3321
|
-
leftUpperCornerOfNsgSaabschnitt[0] += slotIndex * 16 - 8;
|
|
3322
|
-
leftUpperCornerOfNsgSaabschnitt[1] -= 8;
|
|
3323
|
-
break;
|
|
3324
|
-
case 1:
|
|
3325
|
-
leftUpperCornerOfNsgSaabschnitt[0] -= 8;
|
|
3326
|
-
leftUpperCornerOfNsgSaabschnitt[1] += slotIndex * 16 - 8;
|
|
3327
|
-
break;
|
|
3328
|
-
case 2:
|
|
3329
|
-
leftUpperCornerOfNsgSaabschnitt[0] += (nsgSaabschnitt.laenge - slotIndex - 1) * 16 - 8;
|
|
3330
|
-
leftUpperCornerOfNsgSaabschnitt[1] -= 8;
|
|
3331
|
-
break;
|
|
3332
|
-
case 3:
|
|
3333
|
-
leftUpperCornerOfNsgSaabschnitt[0] -= 8;
|
|
3334
|
-
leftUpperCornerOfNsgSaabschnitt[1] += (nsgSaabschnitt.laenge - slotIndex - 1) * 16 - 8;
|
|
3335
|
-
break;
|
|
3336
|
-
}
|
|
3337
|
-
return leftUpperCornerOfNsgSaabschnitt;
|
|
3338
|
-
}
|
|
3339
|
-
else if (cornerOf.self) {
|
|
3340
|
-
/* ---------- ---------- ---------- */
|
|
3341
|
-
/* self */
|
|
3342
|
-
/* ---------- ---------- ---------- */
|
|
3343
|
-
const leftUpperCornerOfSlotAnf = yield this.getLeftUpperCornerOfLKupplungRssElement(nsgLKupplungRss, { slot_anf: true });
|
|
3344
|
-
return [leftUpperCornerOfSlotAnf[0] + nsgLKupplungRss.xrel, leftUpperCornerOfSlotAnf[1] + nsgLKupplungRss.yrel];
|
|
3345
|
-
}
|
|
3346
|
-
return [undefined, undefined];
|
|
3347
|
-
});
|
|
3348
|
-
}
|
|
3349
|
-
getNodesOfSchaltfeld(arg) {
|
|
3350
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3351
|
-
return yield this.dbObjectGraph.findAllByAttributes([
|
|
3352
|
-
convert_graph_keys_1.i7TableNames.netz_leistungsschalter,
|
|
3353
|
-
convert_graph_keys_1.i7TableNames.netz_trenner3p,
|
|
3354
|
-
convert_graph_keys_1.i7TableNames.netz_trennerfi3p,
|
|
3355
|
-
convert_graph_keys_1.i7TableNames.netz_sestarr3p
|
|
3356
|
-
], { seliste: arg.schaltfeld });
|
|
3357
|
-
});
|
|
3358
|
-
}
|
|
3359
|
-
getNodesOfKpfeld(arg) {
|
|
3360
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3361
|
-
return yield this.dbObjectGraph.findAllByAttributes([
|
|
3362
|
-
convert_graph_keys_1.i7TableNames.netz_leistungsschalter,
|
|
3363
|
-
convert_graph_keys_1.i7TableNames.netz_trenner3p,
|
|
3364
|
-
convert_graph_keys_1.i7TableNames.netz_trennerfi3p,
|
|
3365
|
-
convert_graph_keys_1.i7TableNames.netz_sestarr3p
|
|
3366
|
-
], { seliste: arg.kpfeld });
|
|
3367
|
-
});
|
|
3368
|
-
}
|
|
3369
|
-
getNodesOfLKupplung(arg) {
|
|
3370
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3371
|
-
return yield this.dbObjectGraph.findAllByAttributes([
|
|
3372
|
-
convert_graph_keys_1.i7TableNames.netz_leistungsschalter,
|
|
3373
|
-
convert_graph_keys_1.i7TableNames.netz_trenner3p,
|
|
3374
|
-
convert_graph_keys_1.i7TableNames.netz_trennerfi3p,
|
|
3375
|
-
convert_graph_keys_1.i7TableNames.netz_sestarr3p
|
|
3376
|
-
], { seliste: arg.id });
|
|
3377
|
-
});
|
|
3378
|
-
}
|
|
3379
|
-
/** */
|
|
3380
|
-
getSizeOfSchaltanlage(arg) {
|
|
3381
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3382
|
-
let sizeOfSchaltanlage = 0;
|
|
3383
|
-
const nsgSaabschnitte = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.nsg_nsgsaabschnitt, {
|
|
3384
|
-
variantennr: arg.variantennr, nsgsa: arg.id
|
|
3385
|
-
});
|
|
3386
|
-
for (const tempNsgSaab of nsgSaabschnitte) {
|
|
3387
|
-
sizeOfSchaltanlage = sizeOfSchaltanlage < (tempNsgSaab.nslots + tempNsgSaab.laenge) ? (tempNsgSaab.nslots + tempNsgSaab.laenge) : sizeOfSchaltanlage;
|
|
3388
|
-
}
|
|
3389
|
-
return sizeOfSchaltanlage;
|
|
3390
|
-
});
|
|
3391
|
-
}
|
|
3392
|
-
getMaxPosOfSaabschnitt(nsgSaabschnitt) {
|
|
3393
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3394
|
-
const netzSsabs = yield this.dbObjectGraph.findAllByAttributes(convert_graph_keys_1.i7TableNames.netz_ssab, {
|
|
3395
|
-
saabschnitt: nsgSaabschnitt.saabschnitt
|
|
3396
|
-
});
|
|
3397
|
-
let maxSsabPos = netzSsabs[0].pos;
|
|
3398
|
-
for (let a = 1; a < netzSsabs.length; ++a) {
|
|
3399
|
-
if (netzSsabs[a].pos > maxSsabPos)
|
|
3400
|
-
maxSsabPos = netzSsabs[a].pos;
|
|
3401
|
-
}
|
|
3402
|
-
return maxSsabPos;
|
|
3403
|
-
});
|
|
3404
|
-
}
|
|
3405
|
-
getLengthOfSammelschienenAbschnitt(nsgSaab) {
|
|
3406
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3407
|
-
const maxLengthOfKuppelfeld = yield this.getMaxLengthOfKuppelfeld({
|
|
3408
|
-
id: nsgSaab.id,
|
|
3409
|
-
variantennr: nsgSaab.variantennr
|
|
3410
|
-
});
|
|
3411
|
-
const maxLengthOfSchaltfeld = yield this.getMaxLengthOfSchaltfeld({
|
|
3412
|
-
id: nsgSaab.id,
|
|
3413
|
-
variantennr: nsgSaab.variantennr
|
|
3414
|
-
});
|
|
3415
|
-
return Math.max(maxLengthOfKuppelfeld, maxLengthOfSchaltfeld, nsgSaab.laenge);
|
|
3416
|
-
});
|
|
3417
|
-
}
|
|
3418
|
-
getMaxLengthOfKuppelfeld(schaltanlagenabschnittKey) {
|
|
3419
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3420
|
-
const nsgKpFelder = (yield this.dbObjectGraph.getAllObjectsOfTable(convert_graph_keys_1.i7TableNames.nsg_nsgkpfeld)).filter(nsgKpFeld => nsgKpFeld.nsgsaa === schaltanlagenabschnittKey.id
|
|
3421
|
-
&& nsgKpFeld.variantennr === schaltanlagenabschnittKey.variantennr
|
|
3422
|
-
&& (nsgKpFeld.eingeblendet === 1 || (nsgKpFeld.eingeblendet === null && nsgKpFeld.angezeigt === 1)));
|
|
3423
|
-
let nsgKpFeldMaxSlotnummer = nsgKpFelder.length > 0 ? nsgKpFelder[0].slotnummer : undefined;
|
|
3424
|
-
for (let a = 1; a < nsgKpFelder.length; ++a) {
|
|
3425
|
-
const nsgKpFeld = nsgKpFelder[a];
|
|
3426
|
-
if (nsgKpFeldMaxSlotnummer < nsgKpFeld.slotnummer) {
|
|
3427
|
-
nsgKpFeldMaxSlotnummer = nsgKpFeld.slotnummer;
|
|
3428
|
-
}
|
|
3429
|
-
}
|
|
3430
|
-
return nsgKpFeldMaxSlotnummer ? nsgKpFeldMaxSlotnummer + 1 : 0;
|
|
3431
|
-
});
|
|
3432
|
-
}
|
|
3433
|
-
getMaxLengthOfSchaltfeld(schaltanlagenabschnittKey) {
|
|
3434
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
3435
|
-
const nsgSchaltfelder = (yield this.dbObjectGraph.getAllObjectsOfTable(convert_graph_keys_1.i7TableNames.nsg_nsgschaltfeld)).filter(nsgSchaltfeld => nsgSchaltfeld.nsgsaa === schaltanlagenabschnittKey.id
|
|
3436
|
-
&& nsgSchaltfeld.variantennr === schaltanlagenabschnittKey.variantennr
|
|
3437
|
-
&& (nsgSchaltfeld.eingeblendet === 1 || (nsgSchaltfeld.eingeblendet === null && nsgSchaltfeld.angezeigt === 1)));
|
|
3438
|
-
let nsgSchaltfeldMaxSlotnummer = nsgSchaltfelder.length > 0 ? nsgSchaltfelder[0].slotnummer : undefined;
|
|
3439
|
-
for (let a = 1; a < nsgSchaltfelder.length; ++a) {
|
|
3440
|
-
const nsgSchaltfeld = nsgSchaltfelder[a];
|
|
3441
|
-
if (nsgSchaltfeldMaxSlotnummer < nsgSchaltfeld.slotnummer) {
|
|
3442
|
-
nsgSchaltfeldMaxSlotnummer = nsgSchaltfeld.slotnummer;
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
return nsgSchaltfeldMaxSlotnummer ? nsgSchaltfeldMaxSlotnummer + 1 : 0;
|
|
3446
|
-
});
|
|
3447
|
-
}
|
|
3448
|
-
lookupTerminalUUID(connectivityNodeI7ID, conductingEquipmentI7ID) {
|
|
3449
|
-
if (DLConverterI7.testmode) {
|
|
3450
|
-
return common_utils_1.CommonUtils.generateUUID();
|
|
3451
|
-
}
|
|
3452
|
-
const connectivityNodeUUID = this.dbObjectKeyCimModelUuidGraph.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: connectivityNodeI7ID });
|
|
3453
|
-
const conductingEquipmentUUID = this.dbObjectKeyCimModelUuidGraph.getCimObjectIdFromDbKey(convert_graph_keys_1.i7SchemaKeyNames.IdOnlyKey, { id: conductingEquipmentI7ID });
|
|
3454
|
-
if (!connectivityNodeUUID || !conductingEquipmentUUID) {
|
|
3455
|
-
return null;
|
|
3456
|
-
}
|
|
3457
|
-
const connectivityNode = this.cimModelGraph.findObjectByUUID(connectivityNodeUUID);
|
|
3458
|
-
// const conductingEquipment = this.cimModelGraph.findObjectByUUID(conductingEquipmentUUID) as ConductingEquipment;
|
|
3459
|
-
// if (!connectivityNode || !conductingEquipment) return null;
|
|
3460
|
-
if (!connectivityNode)
|
|
3461
|
-
return null;
|
|
3462
|
-
if (connectivityNode.terminals !== undefined) {
|
|
3463
|
-
const cnTerminals = [...connectivityNode.terminals.values()];
|
|
3464
|
-
for (const cnTerminal of cnTerminals) {
|
|
3465
|
-
if (cnTerminal.getConductingEquipmentUUID() === conductingEquipmentUUID) {
|
|
3466
|
-
const terminalUUID = cnTerminal.getUUID();
|
|
3467
|
-
return terminalUUID !== undefined ? terminalUUID : null;
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
// try a brute-force terminal lookup for dc terminals / pcc terminals
|
|
3472
|
-
const bruteForcedTerminalUUID = this.cimModelGraph.findTerminalUUID(conductingEquipmentUUID, connectivityNodeUUID);
|
|
3473
|
-
return bruteForcedTerminalUUID !== undefined ? bruteForcedTerminalUUID : null;
|
|
3474
|
-
}
|
|
3475
|
-
/**
|
|
3476
|
-
* returns three Uuids if those two ConductingEquipments are connected with each other
|
|
3477
|
-
* result is either [Terminal-UUID, ConnectivityNode-UUID, Terminal-UUID] or []
|
|
3478
|
-
*/
|
|
3479
|
-
findConnectionAsUuidsBetweenTwoConductingEquipments(args) {
|
|
3480
|
-
const conductingEquipment1 = this.cimModelGraph.findObjectByUUID(args.conductingEquipment1Uuid);
|
|
3481
|
-
const conductingEquipment2 = this.cimModelGraph.findObjectByUUID(args.conductingEquipment2Uuid);
|
|
3482
|
-
if (!conductingEquipment1 || !conductingEquipment2) {
|
|
3483
|
-
return [];
|
|
3484
|
-
}
|
|
3485
|
-
if (conductingEquipment1.terminals !== undefined) {
|
|
3486
|
-
const ce1Terminals = [...conductingEquipment1.terminals.values()];
|
|
3487
|
-
for (const ce1Terminal of ce1Terminals) {
|
|
3488
|
-
const connectivityNode = this.cimModelGraph.findObjectByUUID(ce1Terminal.getConnectivityNodeUUID());
|
|
3489
|
-
if (connectivityNode.terminals !== undefined) {
|
|
3490
|
-
const cnTerminals = [...connectivityNode.terminals.values()];
|
|
3491
|
-
for (const cnTerminal of cnTerminals) {
|
|
3492
|
-
const tempConductingEquipmentUuid = cnTerminal.getConductingEquipmentUUID();
|
|
3493
|
-
if (tempConductingEquipmentUuid === args.conductingEquipment2Uuid) {
|
|
3494
|
-
return [ce1Terminal.getUUID(), connectivityNode.getUUID(), cnTerminal.getUUID()];
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
return [];
|
|
3501
|
-
}
|
|
3502
|
-
createTerminalDiagramObjectFromPoints(args) {
|
|
3503
|
-
if (args.points) {
|
|
3504
|
-
const terminalDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoints([...args.points], null);
|
|
3505
|
-
terminalDiagramObject.identifiedObjectUUID = args.terminalUuid;
|
|
3506
|
-
if (args.name)
|
|
3507
|
-
terminalDiagramObject.name = args.name;
|
|
3508
|
-
return terminalDiagramObject;
|
|
3509
|
-
}
|
|
3510
|
-
else {
|
|
3511
|
-
const terminalDiagramObject = util_functions_1.DLUtilFunctions.createDiagramObjectWithPoints([[...args.cePoints], [...args.cnPoints]], null);
|
|
3512
|
-
terminalDiagramObject.identifiedObjectUUID = args.terminalUuid;
|
|
3513
|
-
if (args.name)
|
|
3514
|
-
terminalDiagramObject.name = args.name;
|
|
3515
|
-
return terminalDiagramObject;
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
exports.DLConverterI7 = DLConverterI7;
|
|
3520
|
-
DLConverterI7.testmode = false;
|
|
3521
|
-
//# sourceMappingURL=dl-converter-i7-2.js.map
|