sir3stoolkit 90.15.0.0.dev1__py3-none-any.whl

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.
@@ -0,0 +1,2226 @@
1
+
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Created on Fri Nov 22 14:46:49 2024
5
+
6
+ @author: Giriyan
7
+ """
8
+
9
+ #**********************************************************************************
10
+ # IMPORTANT NOTICE FOR USER MANUAL (2024-12-06 NTC):
11
+ # The Meaning and Limitations of all Method-Parameters
12
+ # are literally written in the Definition of the Interface 'ISir3SToolkitModel'.
13
+ # So it may be helpful to copy/paste them when writing the User Manual.
14
+ #
15
+ # AFTER SEVERAL ATTEMPTS (maybe 26), VISUAL STUDIO FORCED ME (NTC) TO USE Python3.9
16
+ #**********************************************************************************
17
+
18
+ import sys
19
+ from turtle import fillcolor
20
+ import clr as net
21
+ import random
22
+ import inspect
23
+ import os
24
+ import System
25
+ from collections import namedtuple
26
+ import numpy as np
27
+
28
+ # Global variables
29
+ SIR3S_SIRGRAF_DIR = None
30
+
31
+ # User defined types
32
+ textProperties = namedtuple("textProperties", ["x", "y", "color", "textContent", "angle_degree", "faceName",
33
+ "heightPt", "isBold", "isItalic", "isUnderline", "idRef", "description"])
34
+
35
+ numericalDisplayProperties = namedtuple("numericalDisplayProperties", ["x", "y", "color", "angle_degree", "faceName",
36
+ "heightPt", "isBold", "isItalic", "isUnderline",
37
+ "description", "forResult", "tkObserved", "elemPropertyNameOrResult",
38
+ "prefix", "unit", "numDec", "absValue"])
39
+
40
+ fontInformation = namedtuple("fontInformation", ["textContent", "color", "angle_degree", "faceName",
41
+ "heightPt", "isBold", "isItalic", "isUnderline"])
42
+
43
+
44
+ # CAUTION: User should call this function before creating any instances of the classes provoded through this library !!!
45
+ # Failed to do so will result in incorrect initialization of classes and object model that are key components to
46
+ # interact with Sir3S
47
+
48
+ # Function to initialize the toolkit with correct SirGraf path
49
+ def Initialize_Toolkit(basePath: str):
50
+ global SIR3S_SIRGRAF_DIR
51
+
52
+ if ((basePath is None) or (basePath is System.String.Empty)):
53
+ print("SirGraf directory is Empty or None")
54
+
55
+ else:
56
+ SIR3S_SIRGRAF_DIR = basePath
57
+ sys.path.append(SIR3S_SIRGRAF_DIR)
58
+
59
+ net.AddReference(r"System")
60
+
61
+ net.AddReference(SIR3S_SIRGRAF_DIR+r"\Sir3S_Repository.ModelManager")
62
+ net.AddReference(SIR3S_SIRGRAF_DIR+r"\Sir3S_Repository.Utilities")
63
+ net.AddReference(SIR3S_SIRGRAF_DIR+r"\Sir3S_Repository.Interfaces")
64
+
65
+ # THE COMPILED DLL FOR Sir3S_Toolkit SHOULD ALSO BE COPIED TO SIR3S_SIRGRAF_DIR
66
+ net.AddReference(SIR3S_SIRGRAF_DIR+r"\Sir3S_Toolkit")
67
+
68
+
69
+ """
70
+ Class definition of SIR3S_Model() wrapper to access functionalities provided by SIR3S software
71
+ This can be used independently or by using inside python console plugin to give better control over the model for users
72
+ """
73
+
74
+ class SIR3S_Model:
75
+ def __init__(self):
76
+ # Basic imports to dlls provided by SirGraf
77
+ # This will only work if Initialize_Toolkit() is called in the same context
78
+ import Sir3S_Repository.ModelManager
79
+ import Sir3S_Repository.Utilities as Util
80
+ import Sir3S_Repository.Interfaces as Interfaces
81
+ import Sir3S_Toolkit.Model as Sir3SToolkit
82
+
83
+ # Create the toolkit
84
+ self.toolkit = Util.StaticUI.Toolkit
85
+ if self.toolkit == None:
86
+ self.toolkit = Sir3SToolkit.CSir3SToolkitFactory.CreateToolkit(None, SIR3S_SIRGRAF_DIR, r"90-15-00-01")
87
+ if (self.toolkit is None):
88
+ print("Error in initializing the toolkit")
89
+ else:
90
+ print("Initialization complete")
91
+
92
+ def StartTransaction(self, SessionName: str):
93
+ """
94
+ Start a transaction with the given session name.
95
+
96
+ :param SessionName: A meaningful name to start a transaction; Empty string or None will lead to error.
97
+ :type SessionName: str
98
+ :return: None
99
+ :rtype: None
100
+ :description: This method is a wrapper method for StartTransaction() from toolkit.
101
+ """
102
+ isTransactionStarted, message = self.toolkit.StartTransaction(SessionName)
103
+ if not isTransactionStarted:
104
+ print(message)
105
+ else:
106
+ if message == "":
107
+ print("Now you can make changes to the model")
108
+ else:
109
+ print(message)
110
+
111
+ def EndTransaction(self):
112
+ """
113
+ End the current transaction.
114
+
115
+ :return: None
116
+ :rtype: None
117
+ :description: This method is a wrapper method for EndTransaction() from toolkit. Use it after StartTransaction() to close that transaction.
118
+ """
119
+ isTransactionEnded, message = self.toolkit.EndTransaction()
120
+ if not isTransactionEnded:
121
+ print(message)
122
+ else:
123
+ if message == "":
124
+ print("Transaction has ended. Please open up a new transaction if you want to make further changes")
125
+ else:
126
+ print(message)
127
+
128
+ def StartEditSession(self, SessionName: str):
129
+ """
130
+ Start an edit session with the given session name.
131
+
132
+ :param SessionName: A meaningful name to start a session.
133
+ :type SessionName: str
134
+ :return: None
135
+ :rtype: None
136
+ :description: This method is a wrapper method for StartEditSession() from toolkit.
137
+ """
138
+ isTransactionStarted, message = self.toolkit.StartEditSession(SessionName)
139
+ if not isTransactionStarted:
140
+ print(message)
141
+ else:
142
+ if message == "":
143
+ print("Now you can make changes to the model")
144
+ else:
145
+ print(message)
146
+
147
+ def EndEditSession(self):
148
+ """
149
+ End the current edit session.
150
+
151
+ :return: None
152
+ :rtype: None
153
+ :description: This method is a wrapper method for EndEditSession() from toolkit. Use it after StartEditSession() to close that session.
154
+ """
155
+ isTransactionEnded, message = self.toolkit.EndEditSession()
156
+ if not isTransactionEnded:
157
+ print(message)
158
+ else:
159
+ if message == "":
160
+ print("Edit Session has ended. Please open up a new session if you want to make further changes")
161
+ else:
162
+ print(message)
163
+
164
+ def GetCurrentTimeStamp(self) -> str:
165
+ """
166
+ Returns the value of the current time stamp.
167
+
168
+ :return: Current time stamp.
169
+ :rtype: str
170
+ :description: This is a wrapper method to access the get method for the property CurrentTimestamp from toolkit.
171
+ """
172
+ return self.toolkit.CurrentTimestamp
173
+
174
+ def SetCurrentTimeStamp(self, timestamp: str):
175
+ """
176
+ Sets the current time stamp.
177
+
178
+ :param timestamp: Time stamp value to be set.
179
+ :type timestamp: str
180
+ :return: None
181
+ :rtype: None
182
+ :description: This is a wrapper method to access the set method for the property CurrentTimestamp from toolkit.
183
+ """
184
+ self.toolkit.CurrentTimestamp = timestamp
185
+
186
+ def GetValue(self, Tk: str, propertyName: str) -> tuple[str, str]:
187
+ """
188
+ Gets the value for the given element's property.
189
+
190
+ :param Tk: The pk/tk of the element in question.
191
+ :type Tk: str
192
+ :param propertyName: Property of the element for which you want the value.
193
+ :type propertyName: str
194
+ :return: Value and type of the value returned.
195
+ :rtype: tuple[str, str]
196
+ :description: This is a wrapper method for GetValue() from toolkit; Watch out for error message for more information.
197
+ """
198
+ value, isFound, valueType, error = self.toolkit.GetValue(Tk, propertyName)
199
+ if value is None:
200
+ print(f"Error: {error}")
201
+ return value, valueType
202
+
203
+ def SetValue(self, Tk: str, propertyName: str, Value: str):
204
+ """
205
+ Sets the value for the given element's property.
206
+
207
+ :param Tk: The pk/tk of the element in question.
208
+ :type Tk: str
209
+ :param propertyName: Property of the element for which you want to set the value.
210
+ :type propertyName: str
211
+ :param Value: Value to be set.
212
+ :type Value: str
213
+ :return: None
214
+ :rtype: None
215
+ :description: This is a wrapper method for SetValue() from toolkit; Watch out for error message for more information.
216
+ """
217
+ isValueSet, error = self.toolkit.SetValue(Tk, propertyName, Value)
218
+ if(isValueSet):
219
+ print("Value is set")
220
+ else:
221
+ print(f"Error: {error}")
222
+
223
+ def OpenModelXml(self, Path: str, SaveCurrentModel: bool):
224
+ """
225
+ Opens a model from an XML file.
226
+
227
+ :param Path: Path to XML file.
228
+ :type Path: str
229
+ :param SaveCurrentModel: Do you want to save the current model before closing it?
230
+ :type SaveCurrentModel: bool
231
+ :return: None
232
+ :rtype: None
233
+ :description: This is a wrapper method for OpenModelXml() from toolkit; Watch out for error message for more information.
234
+ """
235
+ result, error = self.toolkit.OpenModelXml(Path, SaveCurrentModel)
236
+ if(result == True):
237
+ print("Model is open for further operation")
238
+ else:
239
+ print("Error while opening the model," + error)
240
+
241
+ def OpenModel(self, dbName: str, providerType, Mid: str, saveCurrentlyOpenModel: bool, namedInstance: str, userID: str, password: str):
242
+ """
243
+ Opens a model from a database file.
244
+
245
+ :param dbName: Full path to the database file.
246
+ :type dbName: str
247
+ :param providerType: Provider type from the enum.
248
+ :type providerType: Interfaces.SirDBProviderType
249
+ :param Mid: Model identifier.
250
+ :type Mid: str
251
+ :param saveCurrentlyOpenModel: Do you want to save the current model before closing it?
252
+ :type saveCurrentlyOpenModel: bool
253
+ :param namedInstance: Instance name of the SQL Server.
254
+ :type namedInstance: str
255
+ :param userID: User ID for authentication, only needed for ORACLE and for SQLServer only if SQLServer authentication is required.
256
+ :type userID: str
257
+ :param password: Password for authentication, only needed for ORACLE and for SQLServer only if SQLServer authentication is required.
258
+ :type password: str
259
+ :return: None
260
+ :rtype: None
261
+ :description: This is a wrapper method for OpenModel() from toolkit; Watch out for errors for more information.
262
+ """
263
+ result, error = self.toolkit.OpenModel(dbName, providerType, Mid, saveCurrentlyOpenModel, namedInstance, userID, password)
264
+ if(result == True):
265
+ print("Model is open for further operation")
266
+ else:
267
+ print("Error while opening the model, " + error)
268
+
269
+ def ExecCalculation(self, waitForSirCalcToExit: bool):
270
+ """
271
+ Executes the model calculation.
272
+
273
+ :param waitForSirCalcToExit: Do you want to wait for SirCalc engine to exit before proceeding?
274
+ :type waitForSirCalcToExit: bool
275
+ :return: None
276
+ :rtype: None
277
+ :description: This is a wrapper method for ExecCalculation() from toolkit; Watch out for errors for more information.
278
+ """
279
+ isExecuted, error = self.toolkit.ExecCalculation(waitForSirCalcToExit)
280
+ if not isExecuted:
281
+ print(f"Could not start Model Calculation: {error}")
282
+ else:
283
+ print("Model Calculation is complete")
284
+
285
+ def GetTimeStamps(self) -> tuple[list, str, str, str]:
286
+ """
287
+ Gets all available timestamps as ISO formatted strings.
288
+
289
+ :return: Array with all available timestamps as ISO formatted strings.
290
+ :rtype: tuple[list, str, str, str]
291
+ :description: This is a wrapper method for GetTimeStamps() from toolkit; Watch out for errors for more information.
292
+ """
293
+ timestamps, error, tsStat, tsMin, tsMax = self.toolkit.GetTimeStamps()
294
+ if len(timestamps) == 0:
295
+ print(f"Error : {error}")
296
+ return list(timestamps), tsStat, tsMin, tsMax
297
+
298
+ def GetTksofElementType(self, ElementType) -> list:
299
+ """
300
+ Gets all Tk's belonging to the elements of the specified type.
301
+
302
+ :param ElementType: Object type defined in the enum.
303
+ :type ElementType: Interfaces.Sir3SObjectTypes
304
+ :return: List of all Tk's belonging to the elements of type 'ElementType'.
305
+ :rtype: list
306
+ :description: This is a wrapper method for GetAllElementKeys() from toolkit.
307
+ """
308
+ Tk_list = None
309
+ Tk_list = self.toolkit.GetAllElementKeys(ElementType)
310
+ if list(Tk_list) is None:
311
+ print(f"Couldn't retrieve any Tk of element type {ElementType}")
312
+ return list(Tk_list)
313
+
314
+ def GetNetworkType(self):
315
+ """
316
+ Gets the network type.
317
+
318
+ :return: Network type defined in the enum.
319
+ :rtype: Interfaces.NetworkType
320
+ :description: This is a wrapper method for GetNetworkType() from toolkit.
321
+ """
322
+ return self.toolkit.GetNetworkType()
323
+
324
+ def IsMainContainer(self, fkCont: str) -> bool:
325
+ """
326
+ Tests if the provided Key (TK) is the Key of the main container of the model.
327
+
328
+ :param fkCont: Tk of the object in question.
329
+ :type fkCont: str
330
+ :return: Boolean value indicating if it is the main container.
331
+ :rtype: bool
332
+ :description: This is a wrapper method for IsMainContainer() from toolkit.
333
+ """
334
+ return self.toolkit.IsMainContainer(fkCont)
335
+
336
+ def GetMainContainer(self):
337
+ """
338
+ Finds the main container of the model and returns its Key (TK).
339
+
340
+ :return: Tk of the main container and object type.
341
+ :rtype: tuple[str, Interfaces.Sir3SObjectTypes]
342
+ :description: This is a wrapper method for GetMainContainer() from toolkit.
343
+ """
344
+ Tk, objType, error = self.toolkit.GetMainContainer()
345
+ if Tk == "-1":
346
+ print("Error: " + error)
347
+ return Tk, objType
348
+ def GetElementInfo(self, Tk: str):
349
+ """
350
+ Gets the element information.
351
+
352
+ :param Tk: The pk/tk of the element in question.
353
+ :type Tk: str
354
+ :return: None
355
+ :rtype: None
356
+ :description: This is a wrapper method for GetElementInfo() from toolkit; Watch out for errors for more information.
357
+ """
358
+ info, error = self.toolkit.GetElementInfo(Tk)
359
+ if info == "":
360
+ print(f"Error is : {error}")
361
+ else:
362
+ print(f"Info: {info}")
363
+
364
+ def GetNumberOfElements(self, ElementType) -> int:
365
+ """
366
+ Gets the total number of elements of the specified type.
367
+
368
+ :param ElementType: Object type defined in the enum.
369
+ :type ElementType: Interfaces.Sir3SObjectTypes
370
+ :return: Total number of elements of type 'ElementType'.
371
+ :rtype: int
372
+ :description: This is a wrapper method for GetNumberOfElements() from toolkit.
373
+ """
374
+ return self.toolkit.GetNumberOfElements(ElementType)
375
+
376
+ def GetPropertiesofElementType(self, ElementType) -> list:
377
+ """
378
+ Gets all properties belonging to the element of the specified type.
379
+
380
+ :param ElementType: Object type defined in the enum.
381
+ :type ElementType: Interfaces.Sir3SObjectTypes
382
+ :return: List of all properties belonging to the element of type 'ElementType'.
383
+ :rtype: list
384
+ :description: This is a wrapper method for GetPropertyNames() from toolkit.
385
+ """
386
+ Properties_list = None
387
+ Properties_list = self.toolkit.GetPropertyNames(ElementType)
388
+ if list(Properties_list) is None:
389
+ print(f"Couldn't retrieve any Properties for the element type {ElementType}")
390
+ return list(Properties_list)
391
+
392
+ def GetObjectTypeof_Key(self, Key: str):
393
+ """
394
+ Gets the type of object the input Key belongs to.
395
+
396
+ :param Key: The pk/tk of the element in question.
397
+ :type Key: str
398
+ :return: Type of object the input Key belongs to.
399
+ :rtype: Interfaces.Sir3SObjectTypes
400
+ :description: This is a wrapper method for GetObjectTypeOf_Key() from toolkit; Watch out for errors for more information.
401
+ """
402
+ objectType = self.toolkit.GetObjectTypeOf_Key(Key)
403
+ return objectType
404
+
405
+ def DeleteElement(self, Tk: str):
406
+ """
407
+ Deletes the specified element.
408
+
409
+ :param Tk: The pk/tk of the element to be deleted.
410
+ :type Tk: str
411
+ :return: None
412
+ :rtype: None
413
+ :description: This is a wrapper method for DeleteElement() from toolkit; Watch out for errors for more information.
414
+ """
415
+ isDeleted, info, error = self.toolkit.DeleteElement(Tk)
416
+ if not isDeleted:
417
+ print(f"Error: {error}")
418
+ else:
419
+ print("Element deleted successfully")
420
+
421
+ def InsertElement(self, ElementType, IdRef: str) -> str:
422
+ """
423
+ Inserts a new element of the specified type.
424
+
425
+ :param ElementType: Object type defined in the enum to be inserted.
426
+ :type ElementType: Interfaces.Sir3SObjectTypes
427
+ :param IdRef: Id reference.
428
+ :type IdRef: str
429
+ :return: Tk of the element inserted.
430
+ :rtype: str
431
+ :description: This is a wrapper method for InsertElement() from toolkit; Watch out for errors for more information.
432
+ """
433
+ result, error = self.toolkit.InsertElement(ElementType, IdRef)
434
+ if result == "-1":
435
+ print(f"Error : {error}")
436
+ else:
437
+ print(f"Element inserted successfully into the model with Tk: {result}")
438
+ return result
439
+
440
+ def NewModel(self, dbName: str, providerType, netType, modelDescription: str, namedInstance: str, userID: str, password: str):
441
+ """
442
+ Creates a new model.
443
+
444
+ :param dbName: Full path to the database file.
445
+ :type dbName: str
446
+ :param providerType: Provider type from the enum.
447
+ :type providerType: Interfaces.SirDBProviderType
448
+ :param netType: Network type.
449
+ :type netType: Interfaces.NetworkType
450
+ :param modelDescription: Description of the model to be created.
451
+ :type modelDescription: str
452
+ :param namedInstance: Instance name of the SQL Server.
453
+ :type namedInstance: str
454
+ :param userID: User ID for authentication, only needed for ORACLE and for SQLServer only if SQLServer authentication is required.
455
+ :type userID: str
456
+ :param password: Password for authentication, only needed for ORACLE and for SQLServer only if SQLServer authentication is required.
457
+ :type password: str
458
+ :return: None
459
+ :rtype: None
460
+ :description: This is a wrapper method for NewModel() from toolkit; Watch out for errors for more information.
461
+ """
462
+ modelIdentifier, error = self.toolkit.NewModel(dbName, providerType, netType, modelDescription, namedInstance, userID, password)
463
+ if modelIdentifier == "-1":
464
+ print(f"Error : {error}")
465
+ else:
466
+ print(f"New model is created with the model identifier: {modelIdentifier}")
467
+
468
+ def ConnectConnectingElementWithNodes(self, Tk: str, keyOfNodeI: str, keyOfNodeK: str):
469
+ """
470
+ Connects the specified connecting element with nodes.
471
+
472
+ :param Tk: Tk of the connecting object.
473
+ :type Tk: str
474
+ :param keyOfNodeI: Tk of node I (one of the elements that needs to be connected).
475
+ :type keyOfNodeI: str
476
+ :param keyOfNodeK: Tk of node K (other element that needs to be connected).
477
+ :type keyOfNodeK: str
478
+ :return: None
479
+ :rtype: None
480
+ :description: This is a wrapper method for ConnectConnectingElementWithNodes() from toolkit; Watch out for errors for more information.
481
+ """
482
+ result, error = self.toolkit.ConnectConnectingElementWithNodes(Tk, keyOfNodeI, keyOfNodeK)
483
+ if not result:
484
+ print("Error: " + error)
485
+ else:
486
+ print("Objects connected successfully")
487
+
488
+ def ConnectBypassElementWithNode(self, Tk: str, keyOfNodeI: str):
489
+ """
490
+ Connects the specified bypass element with a node.
491
+
492
+ :param Tk: Tk of the connecting object.
493
+ :type Tk: str
494
+ :param keyOfNodeI: Tk of node I (element that needs to be connected).
495
+ :type keyOfNodeI: str
496
+ :return: None
497
+ :rtype: None
498
+ :description: This is a wrapper method for ConnectBypassElementWithNode() from toolkit; Watch out for errors for more information.
499
+ """
500
+ result, error = self.toolkit.ConnectBypassElementWithNode(Tk, keyOfNodeI)
501
+ if not result:
502
+ print("Error: " + error)
503
+ else:
504
+ print("Object connected successfully")
505
+
506
+ def SaveChanges(self):
507
+ """
508
+ Saves changes made to the model.
509
+
510
+ :return: None
511
+ :rtype: None
512
+ :description: This is a wrapper method for SaveChanges() from toolkit; Use it after End{EditSession/Transaction}. Watch out for errors for more information.
513
+ """
514
+ isSaved, error = self.toolkit.SaveChanges()
515
+ if not isSaved:
516
+ print(f"Error: {error}")
517
+ else:
518
+ print("Changes saved successfully")
519
+
520
+ def AddTableRow(self, tablePkTk: str):
521
+ """
522
+ Adds a row to the specified table.
523
+
524
+ :param tablePkTk: Key of the table.
525
+ :type tablePkTk: str
526
+ :return: Tk of the inserted row and object type.
527
+ :rtype: tuple[str, Interfaces.SirDBProviderType]
528
+ :description: This is a wrapper method for AddTableRow() from toolkit; Watch out for errors for more information.
529
+ """
530
+ Tk, objectType, error = self.toolkit.AddTableRow(tablePkTk)
531
+ if Tk == "-1":
532
+ print("Error: " + error)
533
+ else:
534
+ print(f"Row is added to the table with Tk: {Tk}")
535
+ return Tk, objectType
536
+
537
+ def GetTableRows(self, tablePkTk: str):
538
+ """
539
+ Gets all rows of the specified table.
540
+
541
+ :param tablePkTk: Key of the table.
542
+ :type tablePkTk: str
543
+ :return: List of Tk's of all rows of the table and object type.
544
+ :rtype: tuple[list, Interfaces.SirDBProviderType]
545
+ :description: This is a wrapper method for GetTableRows() from toolkit; Watch out for errors for more information.
546
+ """
547
+ Tk_list, objectType, error = self.toolkit.GetTableRows(tablePkTk)
548
+ if Tk_list is None:
549
+ print("Error: " + error)
550
+ return Tk_list, objectType
551
+
552
+ def RefreshViews(self):
553
+ """
554
+ Refreshes the views.
555
+
556
+ :return: None
557
+ :rtype: None
558
+ :description: This is a wrapper method for RefreshViews() from toolkit; Watch out for errors for more information.
559
+ """
560
+ result, error = self.toolkit.RefreshViews()
561
+ if not result:
562
+ print("Error: " + error)
563
+ else:
564
+ print("Refresh successful")
565
+
566
+ def SetInsertPoint(self, elementKey: str, x: np.float64, y: np.float64):
567
+ """
568
+ Sets the insert point of a symbol-object.
569
+
570
+ :param elementKey: Key of the symbol-object.
571
+ :type elementKey: str
572
+ :param x: x-coordinate for the object.
573
+ :type x: np.float64
574
+ :param y: y-coordinate for the object.
575
+ :type y: np.float64
576
+ :return: None
577
+ :rtype: None
578
+ :description: Set the insert point of a symbol-object (e.g., Node, Valve, Tank, etc.). The insert point is the position on which the object is placed in the view.
579
+ """
580
+ result, error = self.toolkit.SetInsertPoint(elementKey, x, y)
581
+ if not result:
582
+ print("Error: " + error)
583
+ else:
584
+ print("New point inserted")
585
+
586
+ def SetElementColor_RGB(self, elementKey: str, red: int, green: int, blue: int, fillOrLineColor: bool):
587
+ """
588
+ Sets the color of the specified element using RGB values.
589
+
590
+ :param elementKey: Key of the symbol-object.
591
+ :type elementKey: str
592
+ :param red: The R-part of the color (0...255).
593
+ :type red: int
594
+ :param green: The G-part of the color (0...255).
595
+ :type green: int
596
+ :param blue: The B-part of the color (0...255).
597
+ :type blue: int
598
+ :param fillOrLineColor: True if the filling color is to be set, False if only the line color is to be set.
599
+ :type fillOrLineColor: bool
600
+ :return: None
601
+ :rtype: None
602
+ :description: This is a wrapper method for SetElementColor() from toolkit; Watch out for errors for more information.
603
+ """
604
+ result, error = self.toolkit.SetElementColor(elementKey, red, green, blue, fillOrLineColor)
605
+ if not result:
606
+ print("Error: " + error)
607
+ else:
608
+ print("Color of the element is set")
609
+
610
+ def SetElementColor(self, elementKey: str, color: int, fillOrLineColor: bool):
611
+ """
612
+ Sets the color of the specified element using an RGB integer representation.
613
+
614
+ :param elementKey: Key of the symbol-object.
615
+ :type elementKey: str
616
+ :param color: The RGB integer representation of the color (COLORREF in GDI).
617
+ :type color: int
618
+ :param fillOrLineColor: True if the filling color is to be set, False if only the line color is to be set.
619
+ :type fillOrLineColor: bool
620
+ :return: None
621
+ :rtype: None
622
+ :description: This is a wrapper method for SetElementColor() from toolkit; Watch out for errors for more information.
623
+ """
624
+ result, error = self.toolkit.SetElementColor(elementKey, color, fillOrLineColor)
625
+ if not result:
626
+ print("Error: " + error)
627
+ else:
628
+ print("Color of the element is set")
629
+
630
+ def AlignElement(self, elementKey: str):
631
+ """
632
+ Aligns the specified element.
633
+
634
+ :param elementKey: Key of the symbol-object.
635
+ :type elementKey: str
636
+ :return: None
637
+ :rtype: None
638
+ :description: This is a wrapper method for AlignElement() from toolkit; Watch out for errors for more information.
639
+ """
640
+ result, error = self.toolkit.AlignElement(elementKey)
641
+ if not result:
642
+ print("Error: " + error)
643
+ else:
644
+ print("Alignment successful")
645
+
646
+ def GetResultValue(self, elementKey: str, propertyName: str) -> tuple[str, str]:
647
+ """
648
+ Gets the result value for the given element's property.
649
+
650
+ :param elementKey: Key of the symbol-object.
651
+ :type elementKey: str
652
+ :param propertyName: The name of the result property.
653
+ :type propertyName: str
654
+ :return: Value for the given element's property and type of the value returned.
655
+ :rtype: tuple[str, str]
656
+ :description: This is a wrapper method for GetResultValue() from toolkit; Watch out for errors for more information.
657
+ """
658
+ result = None
659
+ result, found, valueType, error = self.toolkit.GetResultValue(elementKey, propertyName)
660
+ if result is None:
661
+ print("Error: " + error)
662
+ return result, valueType
663
+
664
+ def GetResultProperties_from_elementType(self, elementType, onlySelectedVectors: bool) -> list:
665
+ """
666
+ Gets the result properties for the specified element type.
667
+
668
+ :param elementType: The element type.
669
+ :type elementType: Interfaces.Sir3SObjectTypes
670
+ :param onlySelectedVectors: If True, only the names of selected vector channels for this element type shall be returned, otherwise all possible result property names for this element type shall be returned.
671
+ :type onlySelectedVectors: bool
672
+ :return: List of result property names of an element type.
673
+ :rtype: list
674
+ :description: This is a wrapper method for GetResultProperties() from toolkit; Watch out for errors for more information.
675
+ """
676
+ Result_list = None
677
+ Result_list, error = self.toolkit.GetResultProperties(elementType, onlySelectedVectors)
678
+ if Result_list is None:
679
+ print("Error: " + error)
680
+ return list(Result_list)
681
+
682
+ def GetResultProperties_from_elementKey(self, elementKey: str) -> list:
683
+ """
684
+ Gets the result properties for the specified element key.
685
+
686
+ :param elementKey: The element key.
687
+ :type elementKey: str
688
+ :return: List of all result property names of an element.
689
+ :rtype: list
690
+ :description: This is a wrapper method for GetResultProperties() from toolkit; Watch out for errors for more information.
691
+ """
692
+ Result_list = None
693
+ Result_list, error = self.toolkit.GetResultProperties(elementKey)
694
+ if Result_list is None:
695
+ print("Error: " + error)
696
+ return list(Result_list)
697
+
698
+ def GetMinResult(self, elementType, propertyName: str) -> tuple[str, str, str]:
699
+ """
700
+ Gets the minimal result value of an element type and also the key (tk/pk) of the corresponding element.
701
+
702
+ :param elementType: The element type.
703
+ :type elementType: Interfaces.Sir3SObjectTypes
704
+ :param propertyName: The name of the result property.
705
+ :type propertyName: str
706
+ :return: The minimal result value of an element type, the key (tk/pk) of the corresponding element, and the data type of the result.
707
+ :rtype: tuple[str, str, str]
708
+ :description: This is a wrapper method for GetMinResult() from toolkit; Watch out for errors for more information.
709
+ """
710
+ MinResult = None
711
+ MinResult, tkElement, valueType, error = self.toolkit.GetMinResult(elementType, propertyName)
712
+ if MinResult is None:
713
+ print("Error: " + error)
714
+ return MinResult, tkElement, valueType
715
+
716
+ def GetMaxResult(self, elementType, propertyName: str) -> tuple[str, str, str]:
717
+ """
718
+ Gets the maximal result value of an element type and also the key (tk/pk) of the corresponding element.
719
+
720
+ :param elementType: The element type.
721
+ :type elementType: Interfaces.Sir3SObjectTypes
722
+ :param propertyName: The name of the result property.
723
+ :type propertyName: str
724
+ :return: The maximal result value of an element type, the key (tk/pk) of the corresponding element, and the data type of the result.
725
+ :rtype: tuple[str, str, str]
726
+ :description: This is a wrapper method for GetMaxResult() from toolkit; Watch out for errors for more information.
727
+ """
728
+ MaxResult = None
729
+ MaxResult, tkElement, valueType, error = self.toolkit.GetMaxResult(elementType, propertyName)
730
+ if MaxResult is None:
731
+ print("Error: " + error)
732
+ return MaxResult, tkElement, valueType
733
+
734
+ def GetMinResult_for_timestamp(self, timestamp: str, elementType, propertyName: str) -> tuple[str, str, str]:
735
+ """
736
+ Gets the minimal result value of an element type at a particular timestamp and also the key (tk/pk) of the corresponding element.
737
+
738
+ :param timestamp: The timestamp for which result is needed.
739
+ :type timestamp: str
740
+ :param elementType: The element type.
741
+ :type elementType: Interfaces.Sir3SObjectTypes
742
+ :param propertyName: The name of the result property.
743
+ :type propertyName: str
744
+ :return: The minimal result value of an element type at a particular timestamp, the key (tk/pk) of the corresponding element, and the data type of the result.
745
+ :rtype: tuple[str, str, str]
746
+ :description: This is a wrapper method for GetMinResult() from toolkit; Watch out for errors for more information.
747
+ """
748
+ MinResult = None
749
+ MinResult, tkElement, valueType, error = self.toolkit.GetMinResult(timestamp, elementType, propertyName)
750
+ if MinResult is None:
751
+ print("Error: " + error)
752
+ return MinResult, tkElement, valueType
753
+
754
+ def GetMaxResult_for_timestamp(self, timestamp: str, elementType, propertyName: str) -> tuple[str, str, str]:
755
+ """
756
+ Gets the maximal result value of an element type at a particular timestamp and also the key (tk/pk) of the corresponding element.
757
+
758
+ :param timestamp: The timestamp for which result is needed.
759
+ :type timestamp: str
760
+ :param elementType: The element type.
761
+ :type elementType: Interfaces.Sir3SObjectTypes
762
+ :param propertyName: The name of the result property.
763
+ :type propertyName: str
764
+ :return: The maximal result value of an element type at a particular timestamp, the key (tk/pk) of the corresponding element, and the data type of the result.
765
+ :rtype: tuple[str, str, str]
766
+ :description: This is a wrapper method for GetMaxResult() from toolkit; Watch out for errors for more information.
767
+ """
768
+ MaxResult = None
769
+ MaxResult, tkElement, valueType, error = self.toolkit.GetMaxResult(timestamp, elementType, propertyName)
770
+ if MaxResult is None:
771
+ print("Error: " + error)
772
+ return MaxResult, tkElement, valueType
773
+
774
+ def AddNewNode(self, tkCont: str, name: str, typ: str, x: np.float64, y: np.float64, z: np.float32, qm_PH: np.float32, symbolFactor: np.float64, description: str, idRef: str, kvr: int) -> str:
775
+ """
776
+ Inserts a new node.
777
+
778
+ :param tkCont: The TK of the container (view) in which the new object shall be inserted. Entering a value of "-1" means the main view of the model.
779
+ :type tkCont: str
780
+ :param name: Name of the new node.
781
+ :type name: str
782
+ :param typ: Type of the new node.
783
+ :type typ: str
784
+ :param x: X coordinate.
785
+ :type x: np.float64
786
+ :param y: Y coordinate.
787
+ :type y: np.float64
788
+ :param z: Geodetic height.
789
+ :type z: np.float32
790
+ :param qm_PH: Value for extraction/feeding (in case QKON) or pressure (in case PKON or PKQN).
791
+ :type qm_PH: np.float32
792
+ :param symbolFactor: The symbol factor of the new node.
793
+ :type symbolFactor: np.float64
794
+ :param description: Description.
795
+ :type description: str
796
+ :param idRef: ID in reference system.
797
+ :type idRef: str
798
+ :param kvr: SL/RL flag. Should be 0 (undefined), 1 (SL) or 2 (RL).
799
+ :type kvr: int
800
+ :return: The key (TK) of the added node, otherwise '-1' if something went wrong.
801
+ :rtype: str
802
+ :description: Comfortable method for inserting a new node.
803
+ """
804
+ Tk_new, error = self.toolkit.AddNewNode(tkCont, name, typ, x, y, z, qm_PH, symbolFactor, description, idRef, kvr)
805
+ if Tk_new == "-1":
806
+ print("Error: " + error)
807
+ else:
808
+ print("New node added")
809
+ return Tk_new
810
+
811
+ def AddNewPipe(self, tkCont: str, tkFrom: str, tkTo: str, L: np.float32, linestring: str, material: str, dn: str, roughness: np.float32, idRef: str, description: str, kvr: int) -> str:
812
+ """
813
+ Inserts a new pipe.
814
+
815
+ :param tkCont: The TK of the container (view) in which the new object shall be inserted. Entering a value of "-1" means the main view of the model.
816
+ :type tkCont: str
817
+ :param tkFrom: Tk (key) of the start node.
818
+ :type tkFrom: str
819
+ :param tkTo: Tk (key) of the end node.
820
+ :type tkTo: str
821
+ :param L: The pipe length, mandatory for computation.
822
+ :type L: np.float32
823
+ :param linestring: An optional string with intermediate points for geometry formatted like 'LINESTRING (120 76, 500 300, 620 480)'. The insert points of from and to will be added on both ends of the geometry.
824
+ :type linestring: str
825
+ :param material: Name or Tk (key) of the pipe diameter table.
826
+ :type material: str
827
+ :param dn: The nominal diameter or the Tk of the nominal diameter.
828
+ :type dn: str
829
+ :param roughness: Roughness of pipe.
830
+ :type roughness: np.float32
831
+ :param description: Description.
832
+ :type description: str
833
+ :param idRef: ID in reference system.
834
+ :type idRef: str
835
+ :param kvr: SL/RL flag. Should be 0 (undefined), 1 (SL) or 2 (RL).
836
+ :type kvr: int
837
+ :return: The key (TK) of the added pipe, otherwise '-1' if something went wrong.
838
+ :rtype: str
839
+ :description: Comfortable method for inserting a new pipe.
840
+ """
841
+ Tk_new, error = self.toolkit.AddNewPipe(tkCont, tkFrom, tkTo, L, linestring, material, dn, roughness, idRef, description, kvr)
842
+ if Tk_new == "-1":
843
+ print("Error: " + error)
844
+ else:
845
+ print("New pipe added")
846
+ return Tk_new
847
+
848
+ def AddNewConnectingElement(self, tkCont: str, tkFrom: str, tkTo: str, x: np.float64, y: np.float64, z: np.float32, elementType, dn: np.float32, symbolFactor: np.float64, angleDegree: np.float32, idRef: str, description: str) -> str:
849
+ """
850
+ Inserts a new connecting element.
851
+
852
+ :param tkCont: The TK of the container (view) in which the new object shall be inserted. Entering a value of "-1" means the main view of the model.
853
+ :type tkCont: str
854
+ :param tkFrom: Tk (key) of the start node.
855
+ :type tkFrom: str
856
+ :param tkTo: Tk (key) of the end node.
857
+ :type tkTo: str
858
+ :param x: X coordinate.
859
+ :type x: np.float64
860
+ :param y: Y coordinate.
861
+ :type y: np.float64
862
+ :param z: Z coordinate.
863
+ :type z: np.float32
864
+ :param elementType: Element type.
865
+ :type elementType: Interfaces.Sir3SObjectTypes
866
+ :param dn: The nominal diameter or the Tk of the nominal diameter.
867
+ :type dn: np.float32
868
+ :param symbolFactor: The symbol factor of the new node.
869
+ :type symbolFactor: np.float64
870
+ :param angleDegree: The symbol angle in degrees.
871
+ :type angleDegree: np.float32
872
+ :param idRef: ID in reference system.
873
+ :type idRef: str
874
+ :param description: Description.
875
+ :type description: str
876
+ :return: The key (TK) of the added connecting element, otherwise '-1' if something went wrong.
877
+ :rtype: str
878
+ :description: Comfortable method for inserting a new connecting element.
879
+ """
880
+ Tk_new, error = self.toolkit.AddNewConnectingElement(tkCont, tkFrom, tkTo, x, y, z, elementType, dn, symbolFactor, angleDegree, idRef, description)
881
+ if Tk_new == "-1":
882
+ print("Error: " + error)
883
+ else:
884
+ print("New connecting element added")
885
+ return Tk_new
886
+
887
+ def AddNewBypassElement(self, tkCont: str, tkFrom: str, x: np.float64, y: np.float64, z: np.float32, symbolFactor: np.float64, elementType, idRef: str, description: str) -> str:
888
+ """
889
+ Inserts a new bypass element.
890
+
891
+ :param tkCont: The TK of the container (view) in which the new object shall be inserted. Entering a value of "-1" means the main view of the model.
892
+ :type tkCont: str
893
+ :param tkFrom: Tk (key) of the start node.
894
+ :type tkFrom: str
895
+ :param x: X coordinate.
896
+ :type x: np.float64
897
+ :param y: Y coordinate.
898
+ :type y: np.float64
899
+ :param z: Z coordinate.
900
+ :type z: np.float32
901
+ :param symbolFactor: The symbol factor of the new node.
902
+ :type symbolFactor: np.float64
903
+ :param elementType: Element type.
904
+ :type elementType: Interfaces.Sir3SObjectTypes
905
+ :param idRef: ID in reference system.
906
+ :type idRef: str
907
+ :param description: Description.
908
+ :type description: str
909
+ :return: The key (TK) of the added bypass element, otherwise '-1' if something went wrong.
910
+ :rtype: str
911
+ :description: Comfortable method for inserting a new bypass element.
912
+ """
913
+ Tk_new, error = self.toolkit.AddNewBypassElement(tkCont, tkFrom, x, y, z, symbolFactor, elementType, idRef, description)
914
+ if Tk_new == "-1":
915
+ print("Error: " + error)
916
+ else:
917
+ print("New Bypass element added")
918
+ return Tk_new
919
+
920
+ def GetTkFromIDReference(self, IdRef: str, object_type) -> str:
921
+ """
922
+ Extracts the TK of an element using its ID reference.
923
+
924
+ :param IdRef: ID reference of the element.
925
+ :type IdRef: str
926
+ :param object_type: Type of the element (like Node, Pipe, Valve, etc.).
927
+ :type object_type: Interfaces.Sir3SObjectTypes
928
+ :return: TK of the element.
929
+ :rtype: str
930
+ :description: This is a wrapper method for GetTkFromIDReference() from toolkit; Watch out for error messages for more information.
931
+ """
932
+ Tk, error = self.toolkit.GetTkFromIDReference(IdRef, object_type)
933
+ if Tk == "-1":
934
+ print("Error: " + error)
935
+ return Tk
936
+
937
+ def GetGeometryInformation(self, Tk: str) -> str:
938
+ """
939
+ Extracts the geometry information of an element using its TK.
940
+
941
+ :param Tk: TK of the element whose geometry information is needed.
942
+ :type Tk: str
943
+ :return: Geometry information of the element.
944
+ :rtype: str
945
+ :description: This is a wrapper method for GetGeometryInformation() from toolkit; Watch out for error messages for more information.
946
+ """
947
+ geomInfo, error = self.toolkit.GetGeometryInformation(Tk)
948
+ if error != "":
949
+ print("Error: " + error)
950
+ return geomInfo
951
+
952
+ def SetGeometryInformation(self, Tk: str, Wkt: str) -> bool:
953
+ """
954
+ Sets the geometry information of an element using its TK.
955
+
956
+ :param Tk: TK of the element whose geometry information needs to be set.
957
+ :type Tk: str
958
+ :param Wkt: Geometry information to be set in the format of WKT.
959
+ :type Wkt: str
960
+ :return: True if geometry information is set, False otherwise.
961
+ :rtype: bool
962
+ :description: This is a wrapper method for SetGeometryInformation() from toolkit; Watch out for error messages for more information.
963
+ """
964
+ isSet, error = self.toolkit.SetGeometryInformation(Tk, Wkt)
965
+ if not isSet:
966
+ print("Error: " + error)
967
+ else:
968
+ print("Geometry Information is set correctly")
969
+ return isSet
970
+
971
+ def AllowSirMessageBox(self, bAllow: bool):
972
+ """
973
+ Use this method for allowing SIR DB Message Boxes to pop or not
974
+
975
+ :param bAllow: Allow/not allow
976
+ :type Tk: bool
977
+ :return: None
978
+ :rtype: None
979
+ :description: This is a wrapper method for AllowSirMessageBox() from toolkit
980
+ """
981
+ self.toolkit.AllowSirMessageBox(bAllow)
982
+
983
+ def GetEndNodes(self, Tk: str) -> tuple[str, str, str, str] :
984
+ """
985
+ General Methot for getting the Tk (keys) of Endnodes connected to an Element.
986
+ In SIR 3S, they exists Elements that have:
987
+ Only 1 Endnodes (i.e. Tanks, Air Valves, ...) : Bypass Elements in General
988
+ 2 Endnodes (i.e. Pipes, Pumps, Flap Valves, ...): Connecting Elements in General
989
+ 4 Endnodes (Heat Exchangers)
990
+ This Method always return for unconnected or non-existent Sides a fkkX Value of '-1'
991
+
992
+ :param Tk: The Tk (key) of the Element we need to retrieve the Endnodes
993
+ :type Tk: str
994
+ :return: fkKI, fkKK, fkKI2, fkKK2
995
+ :rtype: tuple[str, str, str, str]
996
+ :description: This is a wrapper method for GetEndNodes() from toolkit
997
+ """
998
+ returnValue, fkKI, fkKK, fkKI2, fkKK2, error = self.toolkit.GetEndNodes(Tk)
999
+ if not returnValue:
1000
+ print("Error: " + error)
1001
+ return fkKI, fkKK, fkKI2, fkKK2
1002
+
1003
+ """
1004
+ Class definition of SIR3S_View() wrapper to access functionalities provided by SIR3S software
1005
+ This should be used inside python console plugin to give better control over the model for users
1006
+ """
1007
+
1008
+ class SIR3S_View:
1009
+
1010
+ def __init__(self):
1011
+ """
1012
+ Create an instance of the Sir3SToolkit class using toolkitfactory provided by Sir3S_Toolkit.dll.
1013
+
1014
+ :description: Initializes the toolkit. If initialization fails, an error message is printed.
1015
+ """
1016
+ # Basic imports to dlls provided by SirGraf
1017
+ # This will only work if Initialize_Toolkit() is called in the same context
1018
+ import Sir3S_Repository.ModelManager
1019
+ import Sir3S_Repository.Utilities as Util
1020
+ import Sir3S_Repository.Interfaces as Interfaces
1021
+ import Sir3S_Toolkit.Model as Sir3SToolkit
1022
+
1023
+ self.toolkit = Util.StaticUI.Toolkit
1024
+ if self.toolkit == None:
1025
+ self.toolkit = Sir3SToolkit.CSir3SToolkitFactory.CreateToolkit(None, SIR3S_SIRGRAF_DIR, r"90-15-00-01")
1026
+ if (self.toolkit is None):
1027
+ print("Error in initializing the toolkit")
1028
+ else:
1029
+ print("Initialization complete")
1030
+
1031
+ def StartTransaction(self, SessionName: str):
1032
+ """
1033
+ Start a transaction with the given session name.
1034
+
1035
+ :param SessionName: A meaningful name to start a transaction; Empty string or None will lead to error.
1036
+ :type SessionName: str
1037
+ :return: None
1038
+ :rtype: None
1039
+ :description: This method is a wrapper method for StartTransaction() from toolkit.
1040
+ """
1041
+ isTransactionStarted, message = self.toolkit.StartTransaction(SessionName)
1042
+ if not isTransactionStarted:
1043
+ print(message)
1044
+ else:
1045
+ if message == "":
1046
+ print("Now you can make changes to the model")
1047
+ else:
1048
+ print(message)
1049
+
1050
+ def EndTransaction(self):
1051
+ """
1052
+ End the current transaction.
1053
+
1054
+ :return: None
1055
+ :rtype: None
1056
+ :description: This method is a wrapper method for EndTransaction() from toolkit. Use it after StartTransaction() to close that transaction.
1057
+ """
1058
+ isTransactionEnded, message = self.toolkit.EndTransaction()
1059
+ if not isTransactionEnded:
1060
+ print(message)
1061
+ else:
1062
+ if message == "":
1063
+ print("Transaction has ended. Please open up a new transaction if you want to make further changes")
1064
+ else:
1065
+ print(message)
1066
+
1067
+ def StartEditSession(self, SessionName: str):
1068
+ """
1069
+ Start an edit session with the given session name.
1070
+
1071
+ :param SessionName: A meaningful name to start a session.
1072
+ :type SessionName: str
1073
+ :return: None
1074
+ :rtype: None
1075
+ :description: This method is a wrapper method for StartEditSession() from toolkit.
1076
+ """
1077
+ isTransactionStarted, message = self.toolkit.StartEditSession(SessionName)
1078
+ if not isTransactionStarted:
1079
+ print(message)
1080
+ else:
1081
+ if message == "":
1082
+ print("Now you can make changes to the model")
1083
+ else:
1084
+ print(message)
1085
+
1086
+ def EndEditSession(self):
1087
+ """
1088
+ End the current edit session.
1089
+
1090
+ :return: None
1091
+ :rtype: None
1092
+ :description: This method is a wrapper method for EndEditSession() from toolkit. Use it after StartEditSession() to close that session.
1093
+ """
1094
+ isTransactionEnded, message = self.toolkit.EndEditSession()
1095
+ if not isTransactionEnded:
1096
+ print(message)
1097
+ else:
1098
+ if message == "":
1099
+ print("Edit Session has ended. Please open up a new session if you want to make further changes")
1100
+ else:
1101
+ print(message)
1102
+
1103
+ def SaveChanges(self):
1104
+ """
1105
+ Saves changes made to the model.
1106
+
1107
+ :return: None
1108
+ :rtype: None
1109
+ :description: This is a wrapper method for SaveChanges() from toolkit; Use it after End{EditSession/Transaction}. Watch out for errors for more information.
1110
+ """
1111
+ isSaved, error = self.toolkit.SaveChanges()
1112
+ if not isSaved:
1113
+ print(f"Error: {error}")
1114
+ else:
1115
+ print("Changes saved successfully")
1116
+
1117
+ def OpenModelXml(self, Path: str, SaveCurrentModel: bool):
1118
+ """
1119
+ Opens a model from an XML file.
1120
+
1121
+ :param Path: Path to XML file.
1122
+ :type Path: str
1123
+ :param SaveCurrentModel: Do you want to save the current model before closing it?
1124
+ :type SaveCurrentModel: bool
1125
+ :return: None
1126
+ :rtype: None
1127
+ :description: This is a wrapper method for OpenModelXml() from toolkit; Watch out for error message for more information.
1128
+ """
1129
+ result, error = self.toolkit.OpenModelXml(Path, SaveCurrentModel)
1130
+ if(result == True):
1131
+ print("Model is open for further operation")
1132
+ else:
1133
+ print("Error while opening the model," + error)
1134
+
1135
+
1136
+
1137
+ def OpenModel(self, dbName: str, providerType, Mid: str, saveCurrentlyOpenModel: bool, namedInstance: str, userID: str, password: str):
1138
+ """
1139
+ Opens a model from a database file.
1140
+
1141
+ :param dbName: Full path to the database file.
1142
+ :type dbName: str
1143
+ :param providerType: Provider type from the enum.
1144
+ :type providerType: Interfaces.SirDBProviderType
1145
+ :param Mid: Model identifier.
1146
+ :type Mid: str
1147
+ :param saveCurrentlyOpenModel: Do you want to save the current model before closing it?
1148
+ :type saveCurrentlyOpenModel: bool
1149
+ :param namedInstance: Instance name of the SQL Server.
1150
+ :type namedInstance: str
1151
+ :param userID: User Id for Authentication, only needed for ORACLE and for SQLServer only if SQLServer Authentication is required.
1152
+ :type userID: str
1153
+ :param password: Password for Authentication, only needed for ORACLE and for SQLServer Authentication is required.
1154
+ :return: None
1155
+ :rtype: None
1156
+ :description: This is a wrapper method for openModel() from toolkit; Watch out for errors for more information.
1157
+ """
1158
+ result, error = self.toolkit.OpenModel(dbName, providerType, Mid, saveCurrentlyOpenModel, namedInstance, userID, password)
1159
+ if(result == True):
1160
+ print("Model is open for further operation")
1161
+ else:
1162
+ print("Error while opening the model, " + error)
1163
+
1164
+ def GetMainContainer(self):
1165
+ """
1166
+ Finds the main container of the model and returns its Key (TK).
1167
+
1168
+ :return: Tk of the main container and object type.
1169
+ :rtype: tuple[str, Interfaces.Sir3SObjectTypes]
1170
+ :description: This is a wrapper method for GetMainContainer() from toolkit; Finds the Main Container of the Model and returns its Key (TK).
1171
+ """
1172
+ Tk, objType, error = self.toolkit.GetMainContainer()
1173
+ if Tk == "-1":
1174
+ print("Error: " + error)
1175
+ return Tk, objType
1176
+
1177
+ def AddExternalPolyline(self, xArray: list, yArray: list, iColor: int, lineWidthMM: np.float64, dashedLine: bool, containerTK: str) -> str:
1178
+ """
1179
+ Adds an external polyline.
1180
+
1181
+ :param xArray: List of x coordinates.
1182
+ :type xArray: list
1183
+ :param yArray: List of y coordinates.
1184
+ :type yArray: list
1185
+ :param iColor: Color of the polyline.
1186
+ :type iColor: int
1187
+ :param lineWidthMM: Width of the polyline in mm.
1188
+ :type lineWidthMM: np.float64
1189
+ :param dashedLine: Boolean indicating if the polyline is dashed.
1190
+ :type dashedLine: bool
1191
+ :param containerTK: Key of the container.
1192
+ :type containerTK: str
1193
+ :return: Tk of the added polyline.
1194
+ :rtype: str
1195
+ :description: This is a wrapper method for AddExternalPolyline() from toolkit; Watch out for errors for more information.
1196
+ """
1197
+ Tk, error = self.toolkit.AddExternalPolyline(System.String.Empty, xArray, yArray, iColor, lineWidthMM, dashedLine, containerTK)
1198
+ if Tk == "-1":
1199
+ print("Error: " + error)
1200
+ else:
1201
+ print("External polyline added")
1202
+ return Tk
1203
+
1204
+ def AddExternalPolylinePoint(self, Tk: str, x: np.float64, y: np.float64):
1205
+ """
1206
+ Adds a point to an external polyline.
1207
+
1208
+ :param Tk: Key of the polyline.
1209
+ :type Tk: str
1210
+ :param x: x-coordinate of the point.
1211
+ :type x: np.float64
1212
+ :param y: y-coordinate of the point.
1213
+ :type y: np.float64
1214
+ :return: None
1215
+ :rtype: None
1216
+ :description: This is a wrapper method for AddExternalPolylinePoint() from toolkit; Watch out for errors for more information.
1217
+ """
1218
+ result, error = self.toolkit.AddExternalPolylinePoint(Tk, x, y, System.String.Empty)
1219
+ if not result:
1220
+ print("Error: " + error)
1221
+ else:
1222
+ print("External poly line point added")
1223
+
1224
+ def SetExternalPolyLineWidthAndColor(self, Tk: str, lineWidthMM: np.float64, iColor: int):
1225
+ """
1226
+ Sets the width and color of an external polyline.
1227
+
1228
+ :param Tk: Key of the polyline.
1229
+ :type Tk: str
1230
+ :param lineWidthMM: Width of the polyline in mm.
1231
+ :type lineWidthMM: np.float64
1232
+ :param iColor: Color of the polyline.
1233
+ :type iColor: int
1234
+ :return: None
1235
+ :rtype: None
1236
+ :description: This is a wrapper method for AddExternalPolylinePoint() from toolkit; Watch out for errors for more information.
1237
+ """
1238
+ result, error = self.toolkit.SetExternalPolyLineWidthAndColor(Tk, lineWidthMM, iColor, System.String.Empty)
1239
+ if not result:
1240
+ print("Error: " + error)
1241
+ else:
1242
+ print("External polyline width and color are set")
1243
+
1244
+ def AddExternalPolygon(self, xArray: list, yArray: list, lineColor: int, fillColor: int, lineWidthMM: np.float64, isFilled: bool, containerTK: str) -> str:
1245
+ """
1246
+ Adds an external polygon.
1247
+
1248
+ :param xArray: List of x coordinates.
1249
+ :type xArray: list
1250
+ :param yArray: List of y coordinates.
1251
+ :type yArray: list
1252
+ :param lineColor: Color of the polygon's line.
1253
+ :type lineColor: int
1254
+ :param fillColor: Fill color of the polygon.
1255
+ :type fillColor: int
1256
+ :param lineWidthMM: Width of the polygon's line in mm.
1257
+ :type lineWidthMM: np.float64
1258
+ :param isFilled: Boolean indicating if the polygon is filled.
1259
+ :type isFilled: bool
1260
+ :param containerTK: Key of the container.
1261
+ :type containerTK: str
1262
+ :return: Tk of the added polygon.
1263
+ :rtype: str
1264
+ :description: This is a wrapper method for AddExternalPolygon() from toolkit; Watch out for errors for more information.
1265
+ """
1266
+ Tk, error = self.toolkit.AddExternalPolygon(System.String.Empty, xArray, yArray, lineColor, fillColor, lineWidthMM, isFilled, containerTK)
1267
+ if Tk == "-1":
1268
+ print("Error: " + error)
1269
+ else:
1270
+ print("External polygon is added")
1271
+ return Tk
1272
+
1273
+ def AddExternalPolygonPoint(self, Tk: str, x: np.float64, y: np.float64):
1274
+ """
1275
+ Adds a point to an external polygon.
1276
+
1277
+ :param Tk: Key of the polygon.
1278
+ :type Tk: str
1279
+ :param x: x-coordinate of the point.
1280
+ :type x: np.float64
1281
+ :param y: y-coordinate of the point.
1282
+ :type y: np.float64
1283
+ :return: None
1284
+ :rtype: None
1285
+ :description: This is a wrapper method for AddExternalPolygonPoint() from toolkit; Watch out for errors for more information.
1286
+ """
1287
+ result, error = self.toolkit.AddExternalPolygonPoint(Tk, x, y, System.String.Empty)
1288
+ if not result:
1289
+ print("Error: " + error)
1290
+ else:
1291
+ print("External polygon point added")
1292
+
1293
+ def SetExternalPolygonProperties(self, Tk: str, lineWidthMM: np.float64, lineColor: int, fillColor: int, isFilled: bool):
1294
+ """
1295
+ Sets properties of an external polygon.
1296
+
1297
+ :param Tk: Key of the polygon.
1298
+ :type Tk: str
1299
+ :param lineWidthMM: Width of the polygon's line in mm.
1300
+ :type lineWidthMM: np.float64
1301
+ :param lineColor: Color of the polygon's line.
1302
+ :type lineColor: int
1303
+ :param fillColor: Fill color of the polygon.
1304
+ :type fillColor: int
1305
+ :param isFilled: Boolean indicating if the polygon is filled.
1306
+ :type isFilled: bool
1307
+ :return: None
1308
+ :rtype: None
1309
+ :description: This is a wrapper method for SetExternalPolygonProperties() from toolkit; Watch out for errors for more information.
1310
+ """
1311
+ result, error = self.toolkit.SetExternalPolygonProperties(Tk, lineWidthMM, lineColor, fillColor, isFilled, System.String.Empty)
1312
+ if not result:
1313
+ print("Error: " + error)
1314
+ else:
1315
+ print("External polygon properties are set")
1316
+
1317
+ def AddExternalText(self, x: np.float64, y: np.float64, textColor: int, text: str, angleDegree: np.float32, heightPt: np.float32,
1318
+ isBold: bool, isItalic: bool, isUnderline: bool, containerTK: str):
1319
+ """
1320
+ Adds external text.
1321
+
1322
+ :param x: x-coordinate of the text.
1323
+ :type x: np.float64
1324
+ :param y: y-coordinate of the text.
1325
+ :type y: np.float64
1326
+ :param textColor: Color of the text.
1327
+ :type textColor: int
1328
+ :param text: The text content.
1329
+ :type text: str
1330
+ :param angleDegree: Angle of the text in degrees.
1331
+ :type angleDegree: np.float32
1332
+ :param heightPt: Height of the text in points.
1333
+ :type heightPt: np.float32
1334
+ :param isBold: Boolean indicating if the text is bold.
1335
+ :type isBold: bool
1336
+ :param isItalic: Boolean indicating if the text is italic.
1337
+ :type isItalic: bool
1338
+ :param isUnderline: Boolean indicating if the text is underlined.
1339
+ :type isUnderline: bool
1340
+ :param containerTK: Key of the container.
1341
+ :type containerTK: str
1342
+ :return: Tk of the added text.
1343
+ :rtype: str
1344
+ :description: This is a wrapper method for AddExternalText() from toolkit; Watch out for errors for more information.
1345
+ """
1346
+ Tk, error = self.toolkit.AddExternalText(System.String.Empty, x, y, textColor, text, angleDegree, heightPt, isBold, isItalic, isUnderline, containerTK)
1347
+ if Tk == "-1":
1348
+ print("Error: " + error)
1349
+ else:
1350
+ print("External text is added")
1351
+ return Tk
1352
+
1353
+ def SetExternalTextText(self, Tk: str, text: str):
1354
+ """
1355
+ Sets the text of an external text element.
1356
+
1357
+ :param Tk: Key of the text element.
1358
+ :type Tk: str
1359
+ :param text: The text content.
1360
+ :type text: str
1361
+ :return: None
1362
+ :rtype: None
1363
+ :description: This is a wrapper method for SetExternalTextText() from toolkit; Watch out for errors for more information.
1364
+ """
1365
+ result, error = self.toolkit.SetExternalTextText(Tk, text, System.String.Empty)
1366
+ if not result:
1367
+ print("Error: " + error)
1368
+ else:
1369
+ print("External text is set")
1370
+
1371
+ def SetExternalTextProperties(self, Tk: str, x: np.float64, y: np.float64, textColor: int, text: str, angleDegree: np.float32, heightPt: np.float32,
1372
+ isBold: bool, isItalic: bool,isUnderline: bool):
1373
+ """
1374
+ Sets properties of an external text element.
1375
+
1376
+ :param Tk: Key of the text element.
1377
+ :type Tk: str
1378
+ :param x: x-coordinate of the text.
1379
+ :type x: np.float64
1380
+ :param y: y-coordinate of the text.
1381
+ :type y: np.float64
1382
+ :param textColor: Color of the text.
1383
+ :type textColor: int
1384
+ :param text: The text content.
1385
+ :type text: str
1386
+ :param angleDegree: Angle of the text in degrees.
1387
+ :type angleDegree: np.float32
1388
+ :param heightPt: Height of the text in points.
1389
+ :type heightPt: np.float32
1390
+ :param isBold: Boolean indicating if the text is bold.
1391
+ :type isBold: bool
1392
+ :param isItalic: Boolean indicating if the text is italic.
1393
+ :type isItalic: bool
1394
+ :param isUnderline: Boolean indicating if the text is underlined.
1395
+ :type isUnderline: bool
1396
+ :return: None
1397
+ :rtype: None
1398
+ :description: This is a wrapper method for SetExternalTextProperties() from toolkit; Watch out for errors for more information.
1399
+ """
1400
+ result, error = self.toolkit.SetExternalTextProperties(Tk, x, y,System.String.Empty, textColor, text, angleDegree, heightPt, isBold, isItalic, isUnderline)
1401
+ if not result:
1402
+ print("Error: " + error)
1403
+ else:
1404
+ print("External text properties are set")
1405
+
1406
+ def AddExternalArrow(self, x: np.float64, y: np.float64, lineColor: int, fillColor: int, lineWidthMM: np.float64,
1407
+ isFilled: bool, symbolFactor: np.float64, containerTK: str):
1408
+ """
1409
+ Adds an external arrow.
1410
+
1411
+ :param x: x-coordinate of the arrow.
1412
+ :type x: np.float64
1413
+ :param y: y-coordinate of the arrow.
1414
+ :type y: np.float64
1415
+ :param lineColor: Color of the arrow's line.
1416
+ :type lineColor: int
1417
+ :param fillColor: Fill color of the arrow.
1418
+ :type fillColor: int
1419
+ :param lineWidthMM: Width of the arrow's line in mm.
1420
+ :type lineWidthMM: np.float64
1421
+ :param isFilled: Boolean indicating if the arrow is filled.
1422
+ :type isFilled: bool
1423
+ :param symbolFactor: Symbol factor of the arrow.
1424
+ :type symbolFactor: np.float64
1425
+ :param containerTK: Key of the container.
1426
+ :type containerTK: str
1427
+ :return: Tk of the added arrow.
1428
+ :rtype: str
1429
+ :description: This is a wrapper method for AddExternalArrow() from toolkit; Watch out for errors for more information.
1430
+ """
1431
+ Tk, error = self.toolkit.AddExternalArrow(System.String.Empty,x, y, lineColor, fillColor, lineWidthMM, isFilled, symbolFactor, containerTK)
1432
+ if Tk == "-1":
1433
+ print("Error : " + error)
1434
+ else:
1435
+ print("External arrow added")
1436
+ return Tk
1437
+
1438
+ def SetExternalArrowProperties(self, Tk: str, x: np.float64, y: np.float64, lineColor: int, fillColor: int, lineWidthMM: np.float64,
1439
+ isFilled: bool, symbolFactor: np.float64):
1440
+ """
1441
+ Sets properties of an external arrow element.
1442
+
1443
+ :param Tk: Key of the arrow element.
1444
+ :type Tk: str
1445
+ :param x: x-coordinate of the arrow element.
1446
+ :type x: np.float64
1447
+ :param y: y-coordinate of the arrow element.
1448
+ :type y: np.float64
1449
+ :param lineColor: Color of the arrow's line.
1450
+ :type lineColor: int
1451
+ :param fillColor: Fill color of the arrow element.
1452
+ :type fillColor: int
1453
+ :param lineWidthMM: Width of the arrow's line in mm.
1454
+ :type lineWidthMM: np.float64
1455
+ :param isFilled: Boolean indicating if the arrow element is filled.
1456
+ :type isFilled: bool
1457
+ :param symbolFactor: Symbol factor of the arrow element.
1458
+ :type symbolFactor: np.float64
1459
+ :return: None
1460
+ :rtype: None
1461
+ :description: This is a wrapper method for AddExternalArrow() from toolkit; Watch out for errors for more information.
1462
+ """
1463
+ result, error = self.toolkit.SetExternalArrowProperties(Tk, System.String.Empty, x, y, lineColor, fillColor, lineWidthMM, isFilled, symbolFactor)
1464
+ if not result:
1465
+ print("Error: " + error)
1466
+ else:
1467
+ print("External arrow properties are set")
1468
+
1469
+ def AddExternalRectangle(self, left: np.float64, top: np.float64, right: np.float64, bottom: np.float64,
1470
+ lineColor: int, fillColor: int, lineWidthMM: np.float64,
1471
+ isFilled: bool, isRounded: bool, containerTK: str):
1472
+ """
1473
+ Adds an external rectangle element.
1474
+
1475
+ :param left: Left coordinate of the rectangle.
1476
+ :type left: np.float64
1477
+ :param top: Top coordinate of the rectangle.
1478
+ :type top: np.float64
1479
+ :param right: Right coordinate of the rectangle.
1480
+ :type right: np.float64
1481
+ :param bottom: Bottom coordinate of the rectangle.
1482
+ :type bottom: np.float64
1483
+ :param lineColor: Color of the rectangle's line.
1484
+ :type lineColor: int
1485
+ :param fillColor: Fill color of the rectangle.
1486
+ :type fillColor: int
1487
+ :param lineWidthMM: Width of the rectangle's line in mm.
1488
+ :type lineWidthMM: np.float64
1489
+ :param isFilled: Boolean indicating if the rectangle is filled.
1490
+ :type isFilled: bool
1491
+ :param isRounded: Boolean indicating if the rectangle is rounded.
1492
+ :type isRounded: bool
1493
+ :param containerTK: Key of the container.
1494
+ :type containerTK: str
1495
+ :return: Tk of the added rectangle.
1496
+ :rtype: str
1497
+ :description: This is a wrapper method for AddExternalRectangle() from toolkit; Watch out for errors for more information.
1498
+ """
1499
+ Tk, error = self.toolkit.AddExternalRectangle(System.String.Empty,left, top, right, bottom, lineColor, fillColor, lineWidthMM, isFilled, isRounded, containerTK)
1500
+ if Tk == "-1":
1501
+ print("Error : " + error)
1502
+ else:
1503
+ print("External rectangle is added")
1504
+ return Tk
1505
+
1506
+ def SetExternalRectangleProperties(self, Tk: str, left: np.float64, top: np.float64, right: np.float64, bottom: np.float64,
1507
+ lineColor: int, fillColor: int, lineWidthMM: np.float64,
1508
+ isFilled: bool, isRounded: bool):
1509
+ """
1510
+ Sets properties of an external rectangle element.
1511
+
1512
+ :param Tk: Key of the rectangle element.
1513
+ :type Tk: str
1514
+ :param left: Left coordinate of the rectangle.
1515
+ :type left: np.float64
1516
+ :param top: Top coordinate of the rectangle.
1517
+ :type top: np.float64
1518
+ :param right: Right coordinate of the rectangle.
1519
+ :type right: np.float64
1520
+ :param bottom: Bottom coordinate of the rectangle.
1521
+ :type bottom: np.float64
1522
+ :param lineColor: Color of the rectangle's line.
1523
+ :type lineColor: int
1524
+ :param fillColor: Fill color of the rectangle.
1525
+ :type fillColor: int
1526
+ :param lineWidthMM: Width of the rectangle's line in mm.
1527
+ :type lineWidthMM: np.float64
1528
+ :param isFilled: Boolean indicating if the rectangle is filled.
1529
+ :type isFilled: bool
1530
+ :param isRounded: Boolean indicating if the rectangle is rounded.
1531
+ :type isRounded: bool
1532
+ :return: None
1533
+ :rtype: None
1534
+ :description: This is a wrapper method for SetExternalRectangleProperties() from toolkit; Watch out for errors for more information.
1535
+ """
1536
+ result, error = self.toolkit.SetExternalRectangleProperties(Tk, System.String.Empty, left, top, right, bottom, lineColor, fillColor, lineWidthMM, isFilled, isRounded)
1537
+ if not result:
1538
+ print("Error: " + error)
1539
+ else:
1540
+ print("External rectangle properties are set")
1541
+
1542
+ def AddExternalEllipse(self, left: np.float64, top: np.float64, right: np.float64, bottom: np.float64,
1543
+ lineColor: int, fillColor: int, lineWidthMM: np.float64,
1544
+ isFilled: bool, containerTK: str) -> str:
1545
+ """
1546
+ Adds an external ellipse element.
1547
+
1548
+ :param left: Left coordinate of the ellipse.
1549
+ :type left: np.float64
1550
+ :param top: Top coordinate of the ellipse.
1551
+ :type top: np.float64
1552
+ :param right: Right coordinate of the ellipse.
1553
+ :type right: np.float64
1554
+ :param bottom: Bottom coordinate of the ellipse.
1555
+ :type bottom: np.float64
1556
+ :param lineColor: Color of the ellipse's line.
1557
+ :type lineColor: int
1558
+ :param fillColor: Fill color of the ellipse.
1559
+ :type fillColor: int
1560
+ :param lineWidthMM: Width of the ellipse's line in mm.
1561
+ :type lineWidthMM: np.float64
1562
+ :param isFilled: Boolean indicating if the ellipse is filled.
1563
+ :type isFilled: bool
1564
+ :param containerTK: Key of the container.
1565
+ :type containerTK: str
1566
+ :return: Tk of the added ellipse.
1567
+ :rtype: str
1568
+ :description: This is a wrapper method for AddExternalEllipse() from toolkit; Watch out for errors for more information.
1569
+ """
1570
+ Tk, error = self.toolkit.AddExternalEllipse(System.String.Empty, left, top, right, bottom, lineColor, fillColor, lineWidthMM, isFilled, containerTK)
1571
+ if Tk == "-1":
1572
+ print("Error : " + error)
1573
+ else:
1574
+ print("External ellipse is added")
1575
+ return Tk
1576
+
1577
+ def SetExternalEllipseProperties(self, Tk: str, left: np.float64, top: np.float64, right: np.float64, bottom: np.float64,
1578
+ lineColor: int, fillColor: int, lineWidthMM: np.float64, isFilled: bool):
1579
+ """
1580
+ Sets properties of an external ellipse element.
1581
+
1582
+ :param Tk: Key of the ellipse element.
1583
+ :type Tk: str
1584
+ :param left: Left coordinate of the ellipse.
1585
+ :type left: np.float64
1586
+ :param top: Top coordinate of the ellipse.
1587
+ :type top: np.float64
1588
+ :param right: Right coordinate of the ellipse.
1589
+ :type right: np.float64
1590
+ :param bottom: Bottom coordinate of the ellipse.
1591
+ :type bottom: np.float64
1592
+ :param lineColor: Color of the ellipse's line.
1593
+ :type lineColor: int
1594
+ :param fillColor: Fill color of the ellipse.
1595
+ :type fillColor: int
1596
+ :param lineWidthMM: Width of the ellipse's line in mm.
1597
+ :type lineWidthMM: np.float64
1598
+ :param isFilled: Boolean indicating if the ellipse is filled.
1599
+ :type isFilled: bool
1600
+ :return: None
1601
+ :rtype: None
1602
+ :description: This is a wrapper method for SetExternalEllipseProperties() from toolkit; Watch out for errors for more information.
1603
+ """
1604
+ result, error = self.toolkit.SetExternalEllipseProperties(Tk, System.String.Empty, left, top, right, bottom, lineColor, fillColor, lineWidthMM, isFilled)
1605
+ if not result:
1606
+ print("Error: " + error)
1607
+ else:
1608
+ print("External ellipse properties are set")
1609
+
1610
+ def PrepareColoration(self):
1611
+ """
1612
+ Prepares coloration for elements.
1613
+
1614
+ :return: None
1615
+ :rtype: None
1616
+ :description: This is a wrapper method for PrepareColoration() from toolkit; Watch out for errors for more information.
1617
+ """
1618
+ result, error = self.toolkit.PrepareColoration(System.String.Empty)
1619
+ if not result:
1620
+ print("Error: " + error)
1621
+ else:
1622
+ print("Prepare coloration is done")
1623
+
1624
+ def InitColorTable(self, iColors: list, maxColors: int) -> bool:
1625
+ """
1626
+ Initializes color table with specified colors and maximum colors.
1627
+
1628
+ :param iColors: List of colors to initialize table with.
1629
+ :type iColors: list
1630
+ :param maxColors: Maximum number of colors in table.
1631
+ :type maxColors: int
1632
+ :return: Boolean indicating if color table was initialized successfully.
1633
+ :rtype: bool
1634
+ :description: This is a wrapper method for InitColorTable() from toolkit; Watch out for errors for more information.
1635
+ """
1636
+ return self.toolkit.InitColorTable(iColors, maxColors)
1637
+
1638
+ def GetColor(self, valMin: np.float64, valMax: np.float64, val: np.float64) -> tuple[int, int]:
1639
+ """
1640
+ Gets color corresponding to specified value within range defined by minimum and maximum values.
1641
+
1642
+ :param valMin: Minimum value in range.
1643
+ :type valMin: np.float64
1644
+ :param valMax: Maximum value in range.
1645
+ :type valMax: np.float64
1646
+ :param val: Value to get color for within range defined by min and max values.
1647
+ :type val: np.float64
1648
+ :return: Color corresponding to specified value within range defined by min and max values and index of color in table.
1649
+ :rtype: tuple[int, int]
1650
+ :description: This is a wrapper method for GetColor() from toolkit; Watch out for errors for more information.
1651
+ """
1652
+ color, idx = self.toolkit.GetColor(valMin, valMax, val, System.Int32(-1))
1653
+ return color, idx
1654
+
1655
+ def GetColorTableEntries(self, result_i: np.float64, result_k: np.float64, scaleMin: np.float64, scaleMax: np.float64) -> list:
1656
+ """
1657
+ Gets color table entries.
1658
+
1659
+ :param result_i: Result i value.
1660
+ :type result_i: np.float64
1661
+ :param result_k: Result k value.
1662
+ :type result_k: np.float64
1663
+ :param scaleMin: Minimum scale value.
1664
+ :type scaleMin: np.float64
1665
+ :param scaleMax: Maximum scale value.
1666
+ :type scaleMax: np.float64
1667
+ :return: List of color table entries.
1668
+ :rtype: list
1669
+ :description: This is a wrapper method for GetColorTableEntries() from toolkit; Watch out for errors for more information.
1670
+ """
1671
+ return self.toolkit.GetColorTableEntries(result_i, result_k, scaleMin, scaleMax)
1672
+
1673
+ def SetWidthScaleProperties(self, valMin: np.float64, widthMin: np.float64, valMax: np.float64, widthMax: np.float64) -> bool:
1674
+ """
1675
+ Sets width scale properties.
1676
+
1677
+ :param valMin: Minimum value.
1678
+ :type valMin: np.float64
1679
+ :param widthMin: Minimum width.
1680
+ :type widthMin: np.float64
1681
+ :param valMax: Maximum value.
1682
+ :type valMax: np.float64
1683
+ :param widthMax: Maximum width.
1684
+ :type widthMax: np.float64
1685
+ :return: Boolean indicating if width scale properties were set successfully.
1686
+ :rtype: bool
1687
+ :description: This is a wrapper method for SetWidthScaleProperties() from toolkit; Watch out for errors for more information.
1688
+ """
1689
+ return self.toolkit.SetWidthScaleProperties(valMin, widthMin, valMax, widthMax)
1690
+
1691
+ def GetWidthFactor(self, actualValue: np.float64) -> np.float64:
1692
+ """
1693
+ Gets width factor corresponding to specified actual value.
1694
+
1695
+ :param actualValue: Value to get width factor for.
1696
+ :type actualValue: np.float64
1697
+ :return: Width factor corresponding to specified actual value.
1698
+ :rtype: np.float64
1699
+ :description: This is a wrapper method for GetWidthFactor() from toolkit; Watch out for errors for more information.
1700
+ """
1701
+ return self.toolkit.GetWidthFactor(actualValue)
1702
+
1703
+ def ColoratePipe(self, Tk: str, lengths: list, Colors: list, widthFactors: list):
1704
+ """
1705
+ Colorates pipe with specified lengths, colors and width factors.
1706
+
1707
+ :param Tk: Key of pipe element.
1708
+ :type Tk: str
1709
+ :param lengths: List of lengths to colorate pipe with.
1710
+ :type lengths: list
1711
+ :param Colors: List of colors to colorate pipe with.
1712
+ :type Colors: list
1713
+ :param widthFactors: List of width factors to colorate pipe with.
1714
+ :type widthFactors: list
1715
+ :return: None
1716
+ :rtype: None
1717
+ :description: This is a wrapper method for ColoratePipe() from toolkit; Watch out for errors for more information.
1718
+ """
1719
+ result, error = self.toolkit.ColoratePipe(Tk, lengths, Colors, System.String.Empty, widthFactors)
1720
+ if not result:
1721
+ print("Error: " + error)
1722
+ else:
1723
+ print("Colorating pipe is successful")
1724
+
1725
+ def ResetColoration(self):
1726
+ """
1727
+ Resets coloration of elements.
1728
+
1729
+ :return: None
1730
+ :rtype: None
1731
+ :description: This is a wrapper method for ResetColoration() from toolkit; Watch out for errors for more information.
1732
+ """
1733
+ result, error = self.toolkit.ResetColoration(System.String.Empty)
1734
+ if not result:
1735
+ print("Error: " + error)
1736
+ else:
1737
+ print("Coloration reset is successful")
1738
+
1739
+ def DoColoration(self):
1740
+ """
1741
+ Performs coloration of elements.
1742
+
1743
+ :return: None
1744
+ :rtype: None
1745
+ :description: This is a wrapper method for DoColoration() from toolkit; Watch out for errors for more information.
1746
+ """
1747
+ result, error = self.toolkit.DoColoration(System.String.Empty)
1748
+ if not result:
1749
+ print("Error: " + error)
1750
+ else:
1751
+ print("Coloration is done")
1752
+
1753
+ def MoveElementTo(self, Tk: str, newX: np.float64, newY: np.float64):
1754
+ """
1755
+ General Method for moving an Object to a specified ABSOLUTE Location.
1756
+ This Method only applies to Symbol-Objects (and Texts).
1757
+ Thus Calling it on Line Objects such as Pipes, Polylines, Polygones
1758
+ has no effect.
1759
+
1760
+ :param Tk: The tk (key) of the Element
1761
+ :type Tk: str
1762
+ :param newX: New absolute X-Position
1763
+ :type newX: np.float64
1764
+ :param newY: New absolute Y-Position
1765
+ :type newY: np.float64
1766
+ :return: None
1767
+ :rtype: None
1768
+ :description: This is a wrapper method for MoveElementTo() from toolkit; Watch out for errors for more information.
1769
+ """
1770
+ result, error = self.toolkit.MoveElementTo(Tk, newX, newY)
1771
+ if not result:
1772
+ print("Error: " + error)
1773
+
1774
+ def MoveElementBy(self, Tk: str, dX: np.float64, dY: np.float64):
1775
+ """
1776
+ General Method for moving an Object by a defined (relative) Amount.
1777
+ This Method only applies to both Symbol-Objects (incl. Texts) and also
1778
+ to Line Objects such as Pipes, Polylines, Polygones.
1779
+ Calling this Method on a Pipe would also move the both End Nodes of the Pipe.
1780
+
1781
+ :param Tk: The tk (key) of the Element
1782
+ :type Tk: str
1783
+ :param dX: The Amount of Translation in X-Direction
1784
+ :type dX: np.float64
1785
+ :param dY: The Amount of Translation in Y-Direction
1786
+ :type dY: np.float64
1787
+ :return: None
1788
+ :rtype: None
1789
+ :description: This is a wrapper method for MoveElementBy() from toolkit; Watch out for errors for more information.
1790
+ """
1791
+ result, error = self.toolkit.MoveElementBy(Tk, dX, dY)
1792
+ if not result:
1793
+ print("Error: " + error)
1794
+
1795
+
1796
+ def AddNewText(self, tkCont: str, x: np.float64, y: np.float64, color: int, textContent: str,
1797
+ angle_degree: np.float32, faceName: str, heightPt: np.float32, isBold: bool,
1798
+ isItalic: bool, isUnderlined: bool, idRef: str, description: str) -> str:
1799
+ """
1800
+ Method for inserting a new Text within a Container
1801
+
1802
+ :param tkCont: The (tk) key of the Container to insert the Text in
1803
+ :type tkCont: str
1804
+ :param x: Absolute x-Coordinate of the Text (left)
1805
+ :type x np.float64
1806
+ :param y: Absolute y-Coordinate of the Text (bottom)
1807
+ :type y: np.float64
1808
+ :param color: The desired Color as RGB
1809
+ :type color: int
1810
+ :param textContent: The textual Content of the Text. Max 80 Characters
1811
+ :type textContent: str
1812
+ :param angle_degree: Angle in Degree
1813
+ :type angle_degree: np.float32
1814
+ :param faceName: Face Name of the Font (max. 32 Characters). Entering a non-installed
1815
+ Face Name will assume it to be 'Arial'
1816
+ :type faceName: str
1817
+ :param heightPt: The height in Point
1818
+ :type heightPt: np.float32
1819
+ :param isBold: True if the Font should be bold
1820
+ :type isBold: bool
1821
+ :param isItalic: True if the Font should be italic
1822
+ :type isItalic: bool
1823
+ :param isUnderlined: True if the Font should be underlined
1824
+ :type isUnderlined: bool
1825
+ :param idRef: user-defined Reference ID. Max 40 Characters
1826
+ :type idRef: str
1827
+ :param description: Description of Text. Max 254 Characters
1828
+ :type description: str
1829
+ :return: The TK of the newly inserted Text, otherwise '-1'.
1830
+ :rtype: str
1831
+ :description: This is a wrapper method for AddNewText() from toolkit; Watch out for errors for more information.
1832
+ """
1833
+ Tk, error = self.toolkit.AddNewText(tkCont, x, y, color, textContent, angle_degree,
1834
+ faceName, heightPt, isBold, isItalic, isUnderlined, idRef, description)
1835
+ if Tk == "-1":
1836
+ print("Error : " + error)
1837
+ return Tk
1838
+
1839
+ def GetTextProperties(self, Tk: str) -> textProperties:
1840
+ """
1841
+ Method for getting Properties of a Text
1842
+
1843
+ :param Tk: The tk (key) of the Element
1844
+ :type Tk: str
1845
+ :return: return all text properties bundled in a namedtuple 'textProperties'
1846
+ :rtype: textProperties
1847
+ :description: This is a wrapper method for GetTextProperties() from toolkit; Watch out for errors for more information.
1848
+ """
1849
+ result, error, x, y, color, textContent, angle_degree, faceName, heightPt, isBold, isItalic, isUnderline, idRef, description = self.toolkit.GetTextProperties(Tk)
1850
+ if not result:
1851
+ print("Error: " + error)
1852
+ return textProperties(x=x,y=y, color=color, textContent=textContent, angle_degree=angle_degree, faceName=faceName, heightPt=heightPt, isBold=isBold, isItalic=isItalic, isUnderline=isUnderline, idRef=idRef, description=description)
1853
+
1854
+ def AddNewNumericalDisplay(self, tkCont: str, x: np.float64, y: np.float64, color: int,
1855
+ angle_degree: np.float32, faceName: str, heightPt: np.float32, isBold: bool,
1856
+ isItalic: bool, isUnderlined: bool, description: str, forResult: bool, tkObserved: str,
1857
+ elemPropertyNameOrResult: str, prefix: str, unit: str, numDec: int, absValue: bool) -> str:
1858
+ """
1859
+ Method for inserting a new numerical Display into a Container
1860
+
1861
+ :param tkCont: The (tk) key of the Container to insert the numerical Display in
1862
+ :type tkCont: str
1863
+ :param x: Absolute x-Coordinate of the numerical Displa (left)
1864
+ :type dX: np.float64
1865
+ :param dY: Absolute y-Coordinate of the numerical Displa (bottom)
1866
+ :type dY: np.float64
1867
+ :param color: The desired Color as RGB
1868
+ :type color: int
1869
+ :param angle_degree: Angle in Degree
1870
+ :type angle_degree: np.float32
1871
+ :param faceName: Face Name of the Font (max. 32 Characters). Entering a non-installed
1872
+ Face Name will assume it to be 'Arial'
1873
+ :type faceName: str
1874
+ :param heightPt: The height in Point
1875
+ :type heightPt: np.float32
1876
+ :param isBold: True if the Font should be bold
1877
+ :type isBold: bool
1878
+ :param isItalic: True if the Font should be italic
1879
+ :type isItalic: bool
1880
+ :param isUnderlined: True if the Font should be underlined
1881
+ :type isUnderlined: bool
1882
+ :param description: Description of Text. Max 254 Characters
1883
+ :type description: str
1884
+ :param forResult: True if it should display a Calculation Result of an Element, False if it
1885
+ should display an Element Property
1886
+ :type forResult: bool
1887
+ :param tkObserved: The tk (Key) of the Element observed by this num. Display
1888
+ :type tkObserved: str
1889
+ :param elemPropertyNameOrResult: a String representing the Result-Property or the
1890
+ Element Property Name, depending on Parameter 'forResult'.
1891
+ eg. "L" if a Pipe Length is observed or "QMAV" for the Result 'Average Flow Rate' on Pipe.
1892
+ :type elemPropertyNameOrResult: str
1893
+ :param prefix: Prefix (precedes the Text), max. 80 Characters
1894
+ :type prefix: str
1895
+ :param unit: User-defined Unit, max. 80 Characters
1896
+ :type unit: str
1897
+ :param numDec: Number of Decimals Digits
1898
+ :type numDec: str
1899
+ :param absValue: True if a absolute Value should be displayed
1900
+ :type absValue: bool
1901
+ :return: The TK of the newly inserted numerical display, otherwise '-1'.
1902
+ :rtype: str
1903
+ :description: This is a wrapper method for AddNewNumericalDisplay() from toolkit; Watch out for errors for more information.
1904
+ """
1905
+ Tk, error = self.toolkit.AddNewNumericalDisplay(tkCont, x, y, color, angle_degree,
1906
+ faceName, heightPt, isBold, isItalic, isUnderlined, description, forResult, tkObserved,
1907
+ elemPropertyNameOrResult, prefix, unit, numDec, absValue)
1908
+ if Tk == "-1":
1909
+ print("Error : " + error)
1910
+ return Tk
1911
+
1912
+ def AddNewDirectionalArrow(self, tkCont: str, x: np.float64, y: np.float64, lineColor: int, lineWidth: np.float64, fillColor: int,
1913
+ isFilled: bool, symbolFactor: np.float64, description: str, tkObserved: str, elemResultProperty: str, EPS:np.float32):
1914
+ """
1915
+ Adds an external arrow.
1916
+
1917
+ :param tkCont: The (tk) key of the Container
1918
+ :type tkCont: str
1919
+ :param x: x-coordinate of the directional arrow.
1920
+ :type x: np.float64
1921
+ :param y: y-coordinate of the directional arrow.
1922
+ :type y: np.float64
1923
+ :param lineColor: Color of the directional arrow's line.
1924
+ :type lineColor: int
1925
+ :param lineWidth: Width of the arrow's line in mm.
1926
+ :type lineWidth: np.float64
1927
+ :param fillColor: Fill color of the arrow.
1928
+ :type fillColor: int
1929
+ :param isFilled: Boolean indicating if the arrow is filled.
1930
+ :type isFilled: bool
1931
+ :param symbolFactor: Symbol factor of the arrow.
1932
+ :type symbolFactor: np.float64
1933
+ :param description: The Description, max 254 Characters
1934
+ :type description: str
1935
+ :param tkObserved: The Tk (key) of the Element this array shall be bound to
1936
+ :type tkObserved: str
1937
+ :param elemResultProperty: The Property Name of a Result on the bound Element
1938
+ :type elemResultProperty: str
1939
+ :param EPS: Display Tolerance.
1940
+ Arrow direction is only displayed if the absolute value of the data point Result value is greater
1941
+ than the specified tolerance
1942
+ :type EPS: np.float32
1943
+ :return: Tk of the added directional arrow.
1944
+ :rtype: str
1945
+ :description: This is a wrapper method for AddNewDirectionalArrow() from toolkit; Watch out for errors for more information.
1946
+ """
1947
+ Tk, error = self.toolkit.AddNewDirectionalArrow(tkCont, x, y, lineColor, lineWidth, fillColor, isFilled, symbolFactor,
1948
+ description, tkObserved, elemResultProperty, EPS)
1949
+ if Tk == "-1":
1950
+ print("Error : " + error)
1951
+ return Tk
1952
+
1953
+ def GetNumericalDisplayProperties(self, Tk:str) -> numericalDisplayProperties:
1954
+ """
1955
+ Method for getting Properties of a numerical display
1956
+
1957
+ :param Tk: The tk (key) of the Element
1958
+ :type Tk: str
1959
+ :return: return all the properties bundled in a namedtuple 'numericalDisplayProperties'
1960
+ :rtype: numericalDisplayProperties
1961
+ :description: This is a wrapper method for GetNumericalDisplayProperties() from toolkit; Watch out for errors for more information.
1962
+ """
1963
+ result, x, y, color, angle_degree, faceName, heightPt, isBold, isItalic, isUnderline, description, forResult, tkObserved, elemPropertyNameOrResult, prefix, unit, numDec, absValue, error = self.toolkit.GetNumericalDisplayProperties(Tk)
1964
+ if not result:
1965
+ print("Error: " + error)
1966
+ return numericalDisplayProperties(x=x,y=y, color=color, angle_degree=angle_degree, faceName=faceName, heightPt=heightPt, isBold=isBold, isItalic=isItalic, isUnderline=isUnderline, description=description, forResult=forResult, tkObserved=tkObserved, elemPropertyNameOrResult=elemPropertyNameOrResult,
1967
+ prefix=prefix, unit=unit, numDec=numDec, absValue=absValue)
1968
+
1969
+ def SetFont(self, Tk: str, textContent: str, color: int,
1970
+ angle_degree: np.float32, faceName: str, heightPt: np.float32, isBold: bool, isItalic: bool, isUnderlined: bool):
1971
+ """
1972
+ Sets the Font on a Element that has Font.
1973
+ This Method only applies to Texts, numerical Displays, Block Symbols and Block References.
1974
+
1975
+ :param Tk: The tk (key) of the Element which Font has to be retrieved
1976
+ :type Tk: str
1977
+ :param color: The desired Color as RGB
1978
+ :type color: int
1979
+ :param textContent: Only has Effect on TEXTs
1980
+ :type textContent: str
1981
+ :param angle_degree: Text angle
1982
+ :type angle_degree: np.float32
1983
+ :param faceName: Face Name of the Font
1984
+ :type faceName: str
1985
+ :param heightPt: The height in Point
1986
+ :type heightPt: np.float32
1987
+ :param isBold: True if the Font should be bold
1988
+ :type isBold: bool
1989
+ :param isItalic: True if the Font should be italic
1990
+ :type isItalic: bool
1991
+ :param isUnderlined: True if the Font should be underlined
1992
+ :type isUnderlined: bool
1993
+ :return: None
1994
+ :rtype: None
1995
+ :description: This is a wrapper method for SetFont() from toolkit; Watch out for errors for more information.
1996
+ """
1997
+ result, error = self.toolkit.SetFont(Tk, textContent, color, angle_degree, faceName, heightPt, isBold, isItalic, isUnderlined)
1998
+ if not result:
1999
+ print("Error: " + error)
2000
+ else:
2001
+ print("Font is set")
2002
+
2003
+
2004
+ def GetFont(self, Tk: str) -> fontInformation:
2005
+ """
2006
+ Method for getting font related information
2007
+
2008
+ :param Tk: The tk (key) of the Element
2009
+ :type Tk: str
2010
+ :return: return all the properties bundled in a namedtuple 'fontInformation'
2011
+ :rtype: fontInformation
2012
+ :description: This is a wrapper method for GetFont() from toolkit; Watch out for errors for more information.
2013
+ """
2014
+ result, textContent, color, angle_degree, faceName, heightPt, isBold, isItalic, isUnderline, error = self.toolkit.GetFont(Tk)
2015
+ if not result:
2016
+ print("Error: " + error)
2017
+ return fontInformation(textContent=textContent, color=color, angle_degree=angle_degree, faceName=faceName, heightPt=heightPt, isBold=isBold, isItalic=isItalic, isUnderline=isUnderline)
2018
+
2019
+ def AddNewStreet(self, name:str, number:str, place:str, district:str, idref:str) -> str:
2020
+ """
2021
+ Method for adding a new Street
2022
+
2023
+ :param name: Street Name, max. 80 Characters
2024
+ :type name: str
2025
+ :param number: Street Number, max. 80 characters (it may be a official Number)
2026
+ :type number: str
2027
+ :param place: The name of the Place hosting the Street, max. 80 characters
2028
+ :type place: str
2029
+ :param district: The name of the District under the Place, max. 80 characters
2030
+ :type district: str
2031
+ :param idref: Reference ID, max. 40 characters
2032
+ :type idref: str
2033
+ :return: returns the TK of the newly inserted Street, otherwise '-1'.
2034
+ :rtype: str
2035
+ :description: This is a wrapper method for AddNewStreet() from toolkit; Watch out for errors for more information.
2036
+ """
2037
+ Tk, error = self.toolkit.AddNewStreet(name, number, place, district, idref)
2038
+ if Tk == "-1":
2039
+ print("Error : " + error)
2040
+ return Tk
2041
+
2042
+
2043
+ def AddNewHouse(self, x: np.float64, y: np.float64, symbolFactor: np.float64, fkStreet: str, houseNumber: int, numberSuffix: int,
2044
+ postalCode: int, dsn: str, fkNode: str, fkDH_Customer: str, idRef: str):
2045
+ """
2046
+ Method for inserting a new House within the main Container of the Model
2047
+
2048
+ :param x: Absolute x-Coordinate of the House
2049
+ :type x: np.float64
2050
+ :param y: Absolute y-Coordinate of the House
2051
+ :type y: np.float64
2052
+ :param symbolFactor: The Symbol Factor
2053
+ :type symbolFactor: np.float64
2054
+ :param fkStreet: The tk (Key) of the Street if any (or just an emty String ot '-1' if none)
2055
+ :type fkStreet: str
2056
+ :param houseNumber: The House number
2057
+ :type houseNumber: int
2058
+ :param numberSuffix: The house Number Suffix, max. 40 characters
2059
+ :type numberSuffix: int
2060
+ :param postalCode: The Postal Code
2061
+ :type postalCode: int
2062
+ :param dsn: The official Number of the Street (if known), max. 80 Characters
2063
+ :type dsn: str
2064
+ :param fkNode: Only for non-District Heating Networks: The tk (key) of the Node connected to the House (if any)
2065
+ :type fkNode: str
2066
+ :param fkDH_Customer: Only for District Heating Networks: The tk (key) of the DH Consumer connected to the House (if any)
2067
+ :type fkDH_Customer: str
2068
+ :param idRef: User-defined Reference ID
2069
+ :type idRef: str
2070
+ :return: returns the TK of the newly inserted House, otherwise '-1'.
2071
+ :rtype: str
2072
+ :description: This is a wrapper method for AddNewHouse() from toolkit; Watch out for errors for more information.
2073
+ """
2074
+ Tk, error = self.toolkit.AddNewHouse(x, y, symbolFactor,fkStreet, houseNumber, numberSuffix, postalCode,
2075
+ dsn, fkNode, fkDH_Customer, idRef)
2076
+ if Tk == "-1":
2077
+ print("Error : " + error)
2078
+ return Tk
2079
+
2080
+
2081
+ def AddNewCustomer(self, x: np.float64, y: np.float64, z: np.float32, symbolFactor: np.float64, fkHouse: str, consumption: np.float64,
2082
+ counterId: str, customerId: str, dimension: str, divisionType: str, customerGroup: str, idRef: str) -> str:
2083
+ """
2084
+ Method for inserting a new Customer within the main Container of the Model
2085
+
2086
+ :param x: Absolute x-Coordinate of the Customer
2087
+ :type x: np.float64
2088
+ :param y: Absolute y-Coordinate of the Customer
2089
+ :type y: np.float64
2090
+ :param z: Absolute z-Coordinate of the Customer
2091
+ :type z: np.float32
2092
+ :param symbolFactor: The Symbol Factor
2093
+ :type symbolFactor: np.float64
2094
+ :param fkHouse: The tk (Key) of the House the Customer is attached to (or empty String or '-1' if none)
2095
+ :type fkHouse: str
2096
+ :param consumption: Consumption Value Q0 (NODE) or W0 (DH-Consumer).
2097
+ The consumption Value can have different Dimensions.In Water usually Qa - i.e. [m^3/ a]. In Gas[Nm^3/ a]. In heat, it is usually a power in [kW] or[MW].
2098
+ :type consumption: np.float64
2099
+ :param counterId: ID point of consumption (from reference data for identification). max 40 Characters
2100
+ :type counterId: str
2101
+ :param customerId: ID of the Customer who is the contractual Partner of the CC for this point of consumption (from reference data for identification). max 40 Characters
2102
+ :type customerId: str
2103
+ :param dimension: Dimension of consumption m3/a, Nm3/a, kW, kWh, MW or MWh, max 12 Characters
2104
+ :type dimension: str
2105
+ :param divisionType: Division type, max 12 Characters ( should be 'W-', 'W+', 'F-', 'G-' or 'K-' depending on Netrworkm type);
2106
+ W- = consumer in the water network (outflow);
2107
+ W+ = "consumer" in the collection network (inflow);
2108
+ F- = consumer in the district heating network (W0);
2109
+ G- = consumer in the gas network (outflow);
2110
+ K- = consumer in the refrigeration network;
2111
+ :type divisionType: str
2112
+ :param customerGroup: Name of Customer Group, just to differenciate Customers, max 80 Characters
2113
+ :type customerGroup: str
2114
+ :param idRef: ID n Reference System, max 40 Characters
2115
+ :type idRef: str
2116
+ :return: returns the TK of the newly inserted Customer, otherwise '-1'.
2117
+ :rtype: str
2118
+ :description: This is a wrapper method for AddNewCustomer() from toolkit; Watch out for errors for more information.
2119
+ """
2120
+ Tk, error = self.toolkit.AddNewCustomer(x, y, z, symbolFactor, fkHouse, consumption, counterId,
2121
+ customerId, dimension, divisionType, customerGroup, idRef)
2122
+ if Tk == "-1":
2123
+ print("Error : " + error)
2124
+ return Tk
2125
+
2126
+ def AddNewValveOnPipe(self, tkPipe: str, iSymbolType, position: np.float32, name: str, description: str,
2127
+ isPostureStatic, fkSWVT: str, openClose: bool, idRef: str):
2128
+ """
2129
+ Insert a new Net Valve of Pipe. If the Pipe does'nt lie on the main Container, nothing shall be done.
2130
+
2131
+ :param tkPipe: The tk (key) of the Pipe
2132
+ :type tkPipe: str
2133
+ :param iSymbolType: Symbol Type:
2134
+ Possible values are:
2135
+ 1 = Gate Valve
2136
+ 2 = Flap Valve
2137
+ 3 = Plug Valve
2138
+ :type iSymbolType: Interfaces.NetValveTypes
2139
+ :param position: Position on Pipe: Possible Values are:
2140
+ 0 = at the Beginning of the Pipe (by Node Ki)
2141
+ -1 = at the End of the Pipe (by Node Kk)
2142
+ -2 = at the Middle of the Pipe
2143
+ or every Value in the interval [0, L] where L is the technical Length of the Pipe.
2144
+ :type position: np.float32
2145
+ :param name: A Name for the Valve, max 40 Characters
2146
+ :type name: str
2147
+ :param description: Description of the Valve, max 254 Characters
2148
+ :type description: str
2149
+ :param isPostureStatic: Option if the Posture is statically open/closed or time depemdant.
2150
+ Enter NetValvePostures.STATIC_OPEN_CLOSE if Posture is always open / closed
2151
+ otherwise enter NetValvePostures.TIME_DEP_TABLE if the Posture depends on a Setpoint Table (SWVT)
2152
+ :type isPostureStatic: Interfaces.NetValvePostures
2153
+ :param fkSWVT: the pk (key) of the SetPoint Table, in Case the Parameter 'isPostureStatic' is entered as NetValvePostures.TIME_DEP_TABLE
2154
+ :type fkSWVT: str
2155
+ :param openClose: Only usable in Case the Parameter 'isPostureStatic' is entered as NetValvePostures.STATIC_OPEN_CLOSE. So entering
2156
+ in that case 'True', resp. 'False' assumes the Valve is always open resp. closed.
2157
+ :type openClose: bool
2158
+ :param idRef: Reference ID, max 40 Characters
2159
+ :type idRef: str
2160
+ :return: returns the TK of the newly inserted Valve, otherwise '-1'.
2161
+ :rtype: str
2162
+ :description: This is a wrapper method for AddNewValveOnPipe() from toolkit; Watch out for errors for more information.
2163
+ """
2164
+ Tk, error = self.toolkit.AddNewValveOnPipe(tkPipe, iSymbolType, position, name, description, isPostureStatic, fkSWVT, openClose, idRef)
2165
+ if Tk == "-1":
2166
+ print("Error : " + error)
2167
+ return Tk
2168
+
2169
+
2170
+ def AddNewHydrant(self, x: np.float64, y: np.float64, z: np.float64, iType, symbolFactor: np.float64, fkNode: str, L: np.float32, dn: np.float32, roughness: np.float32,
2171
+ ph_min: np.float32, ph_soll: np.float32, qm_soll, activity,
2172
+ idRef: str, name: str, description: str):
2173
+ """
2174
+ Method for inserting a new Customer within the main Container of the Model
2175
+
2176
+ :param x: The X-Coordinate of the Hydrant
2177
+ :type x: np.float64
2178
+ :param y: The Y-Coordinate of the Hydrant
2179
+ :type y: np.float64
2180
+ :param z: The Z-Coordinate of the Hydrant
2181
+ :type z: np.float32
2182
+ :param iType: Type of Hydrant. Possible Value are:
2183
+ 1 = Subsurface
2184
+ 11 = Surface
2185
+ :type iType: Interfaces.Hydrant_Type
2186
+ :param symbolFactor: The Symbol Factor
2187
+ :type symbolFactor: np.float64
2188
+ :param fkNode: The tk (key) of a Node within the main Comntainer if the Hydrant is attached to a Node
2189
+ :type fkNode: str
2190
+ :param L: Length of the Connection Pipe
2191
+ :type L: np.float32
2192
+ :param dn: Nominal Diameter of the Hydrant in [mm]
2193
+ :type dn: np.float32
2194
+ :param roughness: Roughness coefficient (k-value) Connecting pipe
2195
+ :type roughness: np.float32
2196
+ :param ph_min: Minimum pressure at the tapping point
2197
+ :type ph_min: np.float32
2198
+ :param ph_soll: Set pressure at the binding point
2199
+ :type ph_soll: np.float32
2200
+ :param qm_soll: Target extraction quantity
2201
+ :type qm_soll: Interfaces.Hydrant_QM_SOLL
2202
+ :param activity: Activity status (0=inactive | 1=calculated in the extinguishing water plugin | 2=calculated)
2203
+ :type activity: Interfaces.Hydrant_Activity
2204
+ :param idRef: Reference ID
2205
+ :type idRef: str
2206
+ :param name: Name of the Hydrant, max 40 Characters
2207
+ :type name: str
2208
+ :param description: Description, max 254 Characters
2209
+ :type description: str
2210
+ :return: returns the TK of the newly inserted Hydrant, otherwise '-1'.
2211
+ :rtype: str
2212
+ :description: This is a wrapper method for AddNewHydrant() from toolkit; Watch out for errors for more information.
2213
+ """
2214
+ Tk, error = self.toolkit.AddNewHydrant(x, y, z, iType, symbolFactor, fkNode, L, dn, roughness, ph_min, ph_soll, qm_soll, activity, idRef, name, description)
2215
+ if Tk == "-1":
2216
+ print("Error : " + error)
2217
+ return Tk
2218
+
2219
+
2220
+ # End of file
2221
+
2222
+
2223
+
2224
+
2225
+
2226
+