-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenerator.py
1835 lines (1352 loc) · 75.9 KB
/
Generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) 2021-2024 Paulo Meira
# Copyright (c) 2021-2024 DSS-Extensions contributors
from __future__ import annotations
from typing import Union, List, AnyStr, Optional, Iterator, TYPE_CHECKING
from typing_extensions import TypedDict, Unpack
from .types import Float64Array, Int32Array
from . import enums
from .DSSObj import IDSSObj, DSSObj
from .Batch import DSSBatch
from .ArrayProxy import BatchFloat64ArrayProxy, BatchInt32ArrayProxy
from .common import LIST_LIKE
from .PCElement import PCElementBatchMixin, ElementHasRegistersMixin, PCElementMixin
from .CircuitElement import CircuitElementBatchMixin, CircuitElementMixin
from .DynamicExp import DynamicExp
from .LoadShape import LoadShape
from .Spectrum import Spectrum as SpectrumObj
class Generator(DSSObj, CircuitElementMixin, PCElementMixin, ElementHasRegistersMixin):
__slots__ = DSSObj._extra_slots + CircuitElementMixin._extra_slots + PCElementMixin._extra_slots + ElementHasRegistersMixin._extra_slots
_cls_name = 'Generator'
_cls_idx = 27
_cls_int_idx = {
1,
7,
13,
15,
16,
17,
22,
35,
36,
38,
47,
}
_cls_float_idx = {
3,
4,
5,
6,
8,
9,
14,
18,
19,
20,
21,
23,
24,
25,
26,
27,
28,
29,
34,
37,
39,
40,
41,
46,
}
_cls_prop_idx = {
'phases': 1,
'bus1': 2,
'kv': 3,
'kw': 4,
'pf': 5,
'kvar': 6,
'model': 7,
'vminpu': 8,
'vmaxpu': 9,
'yearly': 10,
'daily': 11,
'duty': 12,
'dispmode': 13,
'dispvalue': 14,
'conn': 15,
'status': 16,
'cls': 17,
'class': 17,
'vpu': 18,
'maxkvar': 19,
'minkvar': 20,
'pvfactor': 21,
'forceon': 22,
'kva': 23,
'mva': 24,
'xd': 25,
'xdp': 26,
'xdpp': 27,
'h': 28,
'd': 29,
'usermodel': 30,
'userdata': 31,
'shaftmodel': 32,
'shaftdata': 33,
'dutystart': 34,
'debugtrace': 35,
'balanced': 36,
'xrdp': 37,
'usefuel': 38,
'fuelkwh': 39,
'pctfuel': 40,
'%fuel': 40,
'pctreserve': 41,
'%reserve': 41,
'refuel': 42,
'dynamiceq': 43,
'dynout': 44,
'spectrum': 45,
'basefreq': 46,
'enabled': 47,
'like': 48,
}
def __init__(self, api_util, ptr):
DSSObj.__init__(self, api_util, ptr)
CircuitElementMixin.__init__(self)
PCElementMixin.__init__(self)
ElementHasRegistersMixin.__init__(self)
def edit(self, **kwargs: Unpack[GeneratorProperties]) -> Generator:
"""
Edit this Generator.
This method will try to open a new edit context (if not already open),
edit the properties, and finalize the edit context.
It can be seen as a shortcut to manually setting each property, or a Pythonic
analogous (but extended) to the DSS `Edit` command.
:param **kwargs: Pass keyword arguments equivalent to the DSS properties of the object.
:return: Returns itself to allow call chaining.
"""
self._edit(props=kwargs)
return self
def _get_Phases(self) -> int:
return self._lib.Obj_GetInt32(self._ptr, 1)
def _set_Phases(self, value: int, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 1, value, flags)
Phases = property(_get_Phases, _set_Phases) # type: int
"""
Number of Phases, this Generator. Power is evenly divided among phases.
DSS property name: `Phases`, DSS property index: 1.
"""
def _get_Bus1(self) -> str:
return self._get_prop_string(2)
def _set_Bus1(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(2, value, flags)
Bus1 = property(_get_Bus1, _set_Bus1) # type: str
"""
Bus to which the Generator is connected. May include specific node specification.
DSS property name: `Bus1`, DSS property index: 2.
"""
def _get_kV(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 3)
def _set_kV(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 3, value, flags)
kV = property(_get_kV, _set_kV) # type: float
"""
Nominal rated (1.0 per unit) voltage, kV, for Generator. For 2- and 3-phase Generators, specify phase-phase kV. Otherwise, for phases=1 or phases>3, specify actual kV across each branch of the Generator. If wye (star), specify phase-neutral kV. If delta or phase-phase connected, specify phase-phase kV.
DSS property name: `kV`, DSS property index: 3.
"""
def _get_kW(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 4)
def _set_kW(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 4, value, flags)
kW = property(_get_kW, _set_kW) # type: float
"""
Total base kW for the Generator. A positive value denotes power coming OUT of the element,
which is the opposite of a load. This value is modified depending on the dispatch mode. Unaffected by the global load multiplier and growth curves. If you want there to be more generation, you must add more generators or change this value.
DSS property name: `kW`, DSS property index: 4.
"""
def _get_PF(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 5)
def _set_PF(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 5, value, flags)
PF = property(_get_PF, _set_PF) # type: float
"""
Generator power factor. Default is 0.80. Enter negative for leading powerfactor (when kW and kvar have opposite signs.)
A positive power factor for a generator signifies that the generator produces vars
as is typical for a synchronous generator. Induction machines would be
specified with a negative power factor.
DSS property name: `PF`, DSS property index: 5.
"""
def _get_kvar(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 6)
def _set_kvar(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 6, value, flags)
kvar = property(_get_kvar, _set_kvar) # type: float
"""
Specify the base kvar. Alternative to specifying the power factor. Side effect: the power factor value is altered to agree based on present value of kW.
DSS property name: `kvar`, DSS property index: 6.
"""
def _get_Model(self) -> enums.GeneratorModel:
return enums.GeneratorModel(self._lib.Obj_GetInt32(self._ptr, 7))
def _set_Model(self, value: Union[int, enums.GeneratorModel], flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 7, value, flags)
Model = property(_get_Model, _set_Model) # type: enums.GeneratorModel
"""
Integer code for the model to use for generation variation with voltage. Valid values are:
1:Generator injects a constant kW at specified power factor.
2:Generator is modeled as a constant admittance.
3:Const kW, constant kV. Somewhat like a conventional transmission power flow P-V generator.
4:Const kW, Fixed Q (Q never varies)
5:Const kW, Fixed Q(as a constant reactance)
6:Compute load injection from User-written Model.(see usage of Xd, Xdp)
7:Constant kW, kvar, but current-limited below Vminpu. Approximates a simple inverter. See also Balanced.
DSS property name: `Model`, DSS property index: 7.
"""
def _get_VMinpu(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 8)
def _set_VMinpu(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 8, value, flags)
VMinpu = property(_get_VMinpu, _set_VMinpu) # type: float
"""
Default = 0.90. Minimum per unit voltage for which the Model is assumed to apply. Below this value, the load model reverts to a constant impedance model. For model 7, the current is limited to the value computed for constant power at Vminpu.
DSS property name: `VMinpu`, DSS property index: 8.
"""
def _get_VMaxpu(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 9)
def _set_VMaxpu(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 9, value, flags)
VMaxpu = property(_get_VMaxpu, _set_VMaxpu) # type: float
"""
Default = 1.10. Maximum per unit voltage for which the Model is assumed to apply. Above this value, the load model reverts to a constant impedance model.
DSS property name: `VMaxpu`, DSS property index: 9.
"""
def _get_Yearly_str(self) -> str:
return self._get_prop_string(10)
def _set_Yearly_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(10, value, flags)
Yearly_str = property(_get_Yearly_str, _set_Yearly_str) # type: str
"""
Dispatch shape to use for yearly simulations. Must be previously defined as a Loadshape object. If this is not specified, a constant value is assumed (no variation). If the generator is assumed to be ON continuously, specify Status=FIXED, or designate a curve that is 1.0 per unit at all times. Set to NONE to reset to no loadshape. Nominally for 8760 simulations. If there are fewer points in the designated shape than the number of points in the solution, the curve is repeated.
DSS property name: `Yearly`, DSS property index: 10.
"""
def _get_Yearly(self) -> LoadShape:
return self._get_obj(10, LoadShape)
def _set_Yearly(self, value: Union[AnyStr, LoadShape], flags: enums.SetterFlags = 0):
if isinstance(value, DSSObj) or value is None:
self._set_obj(10, value, flags)
return
self._set_string_o(10, value, flags)
Yearly = property(_get_Yearly, _set_Yearly) # type: LoadShape
"""
Dispatch shape to use for yearly simulations. Must be previously defined as a Loadshape object. If this is not specified, a constant value is assumed (no variation). If the generator is assumed to be ON continuously, specify Status=FIXED, or designate a curve that is 1.0 per unit at all times. Set to NONE to reset to no loadshape. Nominally for 8760 simulations. If there are fewer points in the designated shape than the number of points in the solution, the curve is repeated.
DSS property name: `Yearly`, DSS property index: 10.
"""
def _get_Daily_str(self) -> str:
return self._get_prop_string(11)
def _set_Daily_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(11, value, flags)
Daily_str = property(_get_Daily_str, _set_Daily_str) # type: str
"""
Dispatch shape to use for daily simulations. Must be previously defined as a Loadshape object of 24 hrs, typically. If generator is assumed to be ON continuously, specify Status=FIXED, or designate a Loadshape object that is 1.0 per unit for all hours. Set to NONE to reset to no loadshape.
DSS property name: `Daily`, DSS property index: 11.
"""
def _get_Daily(self) -> LoadShape:
return self._get_obj(11, LoadShape)
def _set_Daily(self, value: Union[AnyStr, LoadShape], flags: enums.SetterFlags = 0):
if isinstance(value, DSSObj) or value is None:
self._set_obj(11, value, flags)
return
self._set_string_o(11, value, flags)
Daily = property(_get_Daily, _set_Daily) # type: LoadShape
"""
Dispatch shape to use for daily simulations. Must be previously defined as a Loadshape object of 24 hrs, typically. If generator is assumed to be ON continuously, specify Status=FIXED, or designate a Loadshape object that is 1.0 per unit for all hours. Set to NONE to reset to no loadshape.
DSS property name: `Daily`, DSS property index: 11.
"""
def _get_Duty_str(self) -> str:
return self._get_prop_string(12)
def _set_Duty_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(12, value, flags)
Duty_str = property(_get_Duty_str, _set_Duty_str) # type: str
"""
Load shape to use for duty cycle dispatch simulations such as for wind generation. Must be previously defined as a Loadshape object. Typically would have time intervals less than 1 hr -- perhaps, in seconds. Set Status=Fixed to ignore Loadshape designation. Set to NONE to reset to no loadshape. Designate the number of points to solve using the Set Number=xxxx command. If there are fewer points in the actual shape, the shape is assumed to repeat.
DSS property name: `Duty`, DSS property index: 12.
"""
def _get_Duty(self) -> LoadShape:
return self._get_obj(12, LoadShape)
def _set_Duty(self, value: Union[AnyStr, LoadShape], flags: enums.SetterFlags = 0):
if isinstance(value, DSSObj) or value is None:
self._set_obj(12, value, flags)
return
self._set_string_o(12, value, flags)
Duty = property(_get_Duty, _set_Duty) # type: LoadShape
"""
Load shape to use for duty cycle dispatch simulations such as for wind generation. Must be previously defined as a Loadshape object. Typically would have time intervals less than 1 hr -- perhaps, in seconds. Set Status=Fixed to ignore Loadshape designation. Set to NONE to reset to no loadshape. Designate the number of points to solve using the Set Number=xxxx command. If there are fewer points in the actual shape, the shape is assumed to repeat.
DSS property name: `Duty`, DSS property index: 12.
"""
def _get_DispMode(self) -> enums.GeneratorDispatchMode:
return enums.GeneratorDispatchMode(self._lib.Obj_GetInt32(self._ptr, 13))
def _set_DispMode(self, value: Union[AnyStr, int, enums.GeneratorDispatchMode], flags: enums.SetterFlags = 0):
if not isinstance(value, int):
self._set_string_o(13, value, flags)
return
self._lib.Obj_SetInt32(self._ptr, 13, value, flags)
DispMode = property(_get_DispMode, _set_DispMode) # type: enums.GeneratorDispatchMode
"""
{Default* | Loadlevel | Price } Default = Default. Dispatch mode. In default mode, gen is either always on or follows dispatch curve as specified. Otherwise, the gen comes on when either the global default load level (Loadshape "default") or the price level exceeds the dispatch value.
DSS property name: `DispMode`, DSS property index: 13.
"""
def _get_DispMode_str(self) -> str:
return self._get_prop_string(13)
def _set_DispMode_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_DispMode(value, flags)
DispMode_str = property(_get_DispMode_str, _set_DispMode_str) # type: str
"""
{Default* | Loadlevel | Price } Default = Default. Dispatch mode. In default mode, gen is either always on or follows dispatch curve as specified. Otherwise, the gen comes on when either the global default load level (Loadshape "default") or the price level exceeds the dispatch value.
DSS property name: `DispMode`, DSS property index: 13.
"""
def _get_DispValue(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 14)
def _set_DispValue(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 14, value, flags)
DispValue = property(_get_DispValue, _set_DispValue) # type: float
"""
Dispatch value.
If = 0.0 (default) then Generator follow dispatch curves, if any.
If > 0 then Generator is ON only when either the price signal (in Price dispatch mode) exceeds this value or the active circuit load multiplier * "default" loadshape value * the default yearly growth factor exceeds this value. Then the generator follows dispatch curves (duty, daily, or yearly), if any (see also Status).
DSS property name: `DispValue`, DSS property index: 14.
"""
def _get_Conn(self) -> enums.Connection:
return enums.Connection(self._lib.Obj_GetInt32(self._ptr, 15))
def _set_Conn(self, value: Union[AnyStr, int, enums.Connection], flags: enums.SetterFlags = 0):
if not isinstance(value, int):
self._set_string_o(15, value, flags)
return
self._lib.Obj_SetInt32(self._ptr, 15, value, flags)
Conn = property(_get_Conn, _set_Conn) # type: enums.Connection
"""
={wye|LN|delta|LL}. Default is wye.
DSS property name: `Conn`, DSS property index: 15.
"""
def _get_Conn_str(self) -> str:
return self._get_prop_string(15)
def _set_Conn_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_Conn(value, flags)
Conn_str = property(_get_Conn_str, _set_Conn_str) # type: str
"""
={wye|LN|delta|LL}. Default is wye.
DSS property name: `Conn`, DSS property index: 15.
"""
def _get_Status(self) -> enums.GeneratorStatus:
return enums.GeneratorStatus(self._lib.Obj_GetInt32(self._ptr, 16))
def _set_Status(self, value: Union[AnyStr, int, enums.GeneratorStatus], flags: enums.SetterFlags = 0):
if not isinstance(value, int):
self._set_string_o(16, value, flags)
return
self._lib.Obj_SetInt32(self._ptr, 16, value, flags)
Status = property(_get_Status, _set_Status) # type: enums.GeneratorStatus
"""
={Fixed | Variable*}. If Fixed, then dispatch multipliers do not apply. The generator is alway at full power when it is ON. Default is Variable (follows curves).
DSS property name: `Status`, DSS property index: 16.
"""
def _get_Status_str(self) -> str:
return self._get_prop_string(16)
def _set_Status_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_Status(value, flags)
Status_str = property(_get_Status_str, _set_Status_str) # type: str
"""
={Fixed | Variable*}. If Fixed, then dispatch multipliers do not apply. The generator is alway at full power when it is ON. Default is Variable (follows curves).
DSS property name: `Status`, DSS property index: 16.
"""
def _get_Class(self) -> int:
return self._lib.Obj_GetInt32(self._ptr, 17)
def _set_Class(self, value: int, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 17, value, flags)
Class = property(_get_Class, _set_Class) # type: int
"""
An arbitrary integer number representing the class of Generator so that Generator values may be segregated by class.
DSS property name: `Class`, DSS property index: 17.
"""
def _get_Vpu(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 18)
def _set_Vpu(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 18, value, flags)
Vpu = property(_get_Vpu, _set_Vpu) # type: float
"""
Per Unit voltage set point for Model = 3 (typical power flow model). Default is 1.0.
DSS property name: `Vpu`, DSS property index: 18.
"""
def _get_Maxkvar(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 19)
def _set_Maxkvar(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 19, value, flags)
Maxkvar = property(_get_Maxkvar, _set_Maxkvar) # type: float
"""
Maximum kvar limit for Model = 3. Defaults to twice the specified load kvar. Always reset this if you change PF or kvar properties.
DSS property name: `Maxkvar`, DSS property index: 19.
"""
def _get_Minkvar(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 20)
def _set_Minkvar(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 20, value, flags)
Minkvar = property(_get_Minkvar, _set_Minkvar) # type: float
"""
Minimum kvar limit for Model = 3. Enter a negative number if generator can absorb vars. Defaults to negative of Maxkvar. Always reset this if you change PF or kvar properties.
DSS property name: `Minkvar`, DSS property index: 20.
"""
def _get_PVFactor(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 21)
def _set_PVFactor(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 21, value, flags)
PVFactor = property(_get_PVFactor, _set_PVFactor) # type: float
"""
Deceleration factor for P-V generator model (Model=3). Default is 0.1. If the circuit converges easily, you may want to use a higher number such as 1.0. Use a lower number if solution diverges. Use Debugtrace=yes to create a file that will trace the convergence of a generator model.
DSS property name: `PVFactor`, DSS property index: 21.
"""
def _get_ForceOn(self) -> bool:
return self._lib.Obj_GetInt32(self._ptr, 22) != 0
def _set_ForceOn(self, value: bool, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 22, value, flags)
ForceOn = property(_get_ForceOn, _set_ForceOn) # type: bool
"""
{Yes | No} Forces generator ON despite requirements of other dispatch modes. Stays ON until this property is set to NO, or an internal algorithm cancels the forced ON state.
DSS property name: `ForceOn`, DSS property index: 22.
"""
def _get_kVA(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 23)
def _set_kVA(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 23, value, flags)
kVA = property(_get_kVA, _set_kVA) # type: float
"""
kVA rating of electrical machine. Defaults to 1.2* kW if not specified. Applied to machine or inverter definition for Dynamics mode solutions.
DSS property name: `kVA`, DSS property index: 23.
"""
def _get_Xd(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 25)
def _set_Xd(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 25, value, flags)
Xd = property(_get_Xd, _set_Xd) # type: float
"""
Per unit synchronous reactance of machine. Presently used only for Thevenin impedance for power flow calcs of user models (model=6). Typically use a value 0.4 to 1.0. Default is 1.0
DSS property name: `Xd`, DSS property index: 25.
"""
def _get_Xdp(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 26)
def _set_Xdp(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 26, value, flags)
Xdp = property(_get_Xdp, _set_Xdp) # type: float
"""
Per unit transient reactance of the machine. Used for Dynamics mode and Fault studies. Default is 0.27.For user models, this value is used for the Thevenin/Norton impedance for Dynamics Mode.
DSS property name: `Xdp`, DSS property index: 26.
"""
def _get_Xdpp(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 27)
def _set_Xdpp(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 27, value, flags)
Xdpp = property(_get_Xdpp, _set_Xdpp) # type: float
"""
Per unit subtransient reactance of the machine. Used for Harmonics. Default is 0.20.
DSS property name: `Xdpp`, DSS property index: 27.
"""
def _get_H(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 28)
def _set_H(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 28, value, flags)
H = property(_get_H, _set_H) # type: float
"""
Per unit mass constant of the machine. MW-sec/MVA. Default is 1.0.
DSS property name: `H`, DSS property index: 28.
"""
def _get_D(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 29)
def _set_D(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 29, value, flags)
D = property(_get_D, _set_D) # type: float
"""
Damping constant. Usual range is 0 to 4. Default is 1.0. Adjust to get damping
DSS property name: `D`, DSS property index: 29.
"""
def _get_UserModel(self) -> str:
return self._get_prop_string(30)
def _set_UserModel(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(30, value, flags)
UserModel = property(_get_UserModel, _set_UserModel) # type: str
"""
Name of DLL containing user-written model, which computes the terminal currents for Dynamics studies, overriding the default model. Set to "none" to negate previous setting.
DSS property name: `UserModel`, DSS property index: 30.
"""
def _get_UserData(self) -> str:
return self._get_prop_string(31)
def _set_UserData(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(31, value, flags)
UserData = property(_get_UserData, _set_UserData) # type: str
"""
String (in quotes or parentheses) that gets passed to user-written model for defining the data required for that model.
DSS property name: `UserData`, DSS property index: 31.
"""
def _get_ShaftModel(self) -> str:
return self._get_prop_string(32)
def _set_ShaftModel(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(32, value, flags)
ShaftModel = property(_get_ShaftModel, _set_ShaftModel) # type: str
"""
Name of user-written DLL containing a Shaft model, which models the prime mover and determines the power on the shaft for Dynamics studies. Models additional mass elements other than the single-mass model in the DSS default model. Set to "none" to negate previous setting.
DSS property name: `ShaftModel`, DSS property index: 32.
"""
def _get_ShaftData(self) -> str:
return self._get_prop_string(33)
def _set_ShaftData(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(33, value, flags)
ShaftData = property(_get_ShaftData, _set_ShaftData) # type: str
"""
String (in quotes or parentheses) that gets passed to user-written shaft dynamic model for defining the data for that model.
DSS property name: `ShaftData`, DSS property index: 33.
"""
def _get_DutyStart(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 34)
def _set_DutyStart(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 34, value, flags)
DutyStart = property(_get_DutyStart, _set_DutyStart) # type: float
"""
Starting time offset [hours] into the duty cycle shape for this generator, defaults to 0
DSS property name: `DutyStart`, DSS property index: 34.
"""
def _get_DebugTrace(self) -> bool:
return self._lib.Obj_GetInt32(self._ptr, 35) != 0
def _set_DebugTrace(self, value: bool, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 35, value, flags)
DebugTrace = property(_get_DebugTrace, _set_DebugTrace) # type: bool
"""
{Yes | No } Default is no. Turn this on to capture the progress of the generator model for each iteration. Creates a separate file for each generator named "GEN_name.csv".
DSS property name: `DebugTrace`, DSS property index: 35.
"""
def _get_Balanced(self) -> bool:
return self._lib.Obj_GetInt32(self._ptr, 36) != 0
def _set_Balanced(self, value: bool, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 36, value, flags)
Balanced = property(_get_Balanced, _set_Balanced) # type: bool
"""
{Yes | No*} Default is No. For Model=7, force balanced current only for 3-phase generators. Force zero- and negative-sequence to zero.
DSS property name: `Balanced`, DSS property index: 36.
"""
def _get_XRdp(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 37)
def _set_XRdp(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 37, value, flags)
XRdp = property(_get_XRdp, _set_XRdp) # type: float
"""
Default is 20. X/R ratio for Xdp property for FaultStudy and Dynamic modes.
DSS property name: `XRdp`, DSS property index: 37.
"""
def _get_UseFuel(self) -> bool:
return self._lib.Obj_GetInt32(self._ptr, 38) != 0
def _set_UseFuel(self, value: bool, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 38, value, flags)
UseFuel = property(_get_UseFuel, _set_UseFuel) # type: bool
"""
{Yes | *No}. Activates the use of fuel for the operation of the generator. When the fuel level reaches the reserve level, the generator stops until it gets refueled. By default, the generator is connected to a continuous fuel supply, Use this mode to mimic dependency on fuel level for different generation technologies.
DSS property name: `UseFuel`, DSS property index: 38.
"""
def _get_FuelkWh(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 39)
def _set_FuelkWh(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 39, value, flags)
FuelkWh = property(_get_FuelkWh, _set_FuelkWh) # type: float
"""
{*0}Is the nominal level of fuel for the generator (kWh). It only applies if UseFuel = Yes/True
DSS property name: `FuelkWh`, DSS property index: 39.
"""
def _get_pctFuel(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 40)
def _set_pctFuel(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 40, value, flags)
pctFuel = property(_get_pctFuel, _set_pctFuel) # type: float
"""
It is a number between 0 and 100 representing the current amount of fuel available in percentage of FuelkWh. It only applies if UseFuel = Yes/True
DSS property name: `%Fuel`, DSS property index: 40.
"""
def _get_pctReserve(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 41)
def _set_pctReserve(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 41, value, flags)
pctReserve = property(_get_pctReserve, _set_pctReserve) # type: float
"""
It is a number between 0 and 100 representing the reserve level in percentage of FuelkWh. It only applies if UseFuel = Yes/True
DSS property name: `%Reserve`, DSS property index: 41.
"""
def Refuel(self, value: bool = True, flags: enums.SetterFlags = 0):
"""
It is a boolean value (Yes/True, No/False) that can be used to manually refuel the generator when needed. It only applies if UseFuel = Yes/True
DSS property name: `Refuel`, DSS property index: 42.
"""
self._lib.Obj_SetInt32(self._ptr, 42, value, flags)
def _get_DynamicEq_str(self) -> str:
return self._get_prop_string(43)
def _set_DynamicEq_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(43, value, flags)
DynamicEq_str = property(_get_DynamicEq_str, _set_DynamicEq_str) # type: str
"""
The name of the dynamic equation (DynamicExp) that will be used for defining the dynamic behavior of the generator. if not defined, the generator dynamics will follow the built-in dynamic equation.
DSS property name: `DynamicEq`, DSS property index: 43.
"""
def _get_DynamicEq(self) -> DynamicExp:
return self._get_obj(43, DynamicExp)
def _set_DynamicEq(self, value: Union[AnyStr, DynamicExp], flags: enums.SetterFlags = 0):
if isinstance(value, DSSObj) or value is None:
self._set_obj(43, value, flags)
return
self._set_string_o(43, value, flags)
DynamicEq = property(_get_DynamicEq, _set_DynamicEq) # type: DynamicExp
"""
The name of the dynamic equation (DynamicExp) that will be used for defining the dynamic behavior of the generator. if not defined, the generator dynamics will follow the built-in dynamic equation.
DSS property name: `DynamicEq`, DSS property index: 43.
"""
def _get_DynOut(self) -> List[str]:
return self._get_string_array(self._lib.Obj_GetStringArray, self._ptr, 44)
def _set_DynOut(self, value: List[AnyStr], flags: enums.SetterFlags = 0):
value, value_ptr, value_count = self._prepare_string_array(value)
self._lib.Obj_SetStringArray(self._ptr, 44, value_ptr, value_count, flags)
self._check_for_error()
DynOut = property(_get_DynOut, _set_DynOut) # type: List[str]
"""
The name of the variables within the Dynamic equation that will be used to govern the generator dynamics.This generator model requires 2 outputs from the dynamic equation:
1. Shaft speed (velocity) relative to synchronous speed.
2. Shaft, or power, angle (relative to synchronous reference frame).
The output variables need to be defined in tha strict order.
DSS property name: `DynOut`, DSS property index: 44.
"""
def _get_Spectrum_str(self) -> str:
return self._get_prop_string(45)
def _set_Spectrum_str(self, value: AnyStr, flags: enums.SetterFlags = 0):
self._set_string_o(45, value, flags)
Spectrum_str = property(_get_Spectrum_str, _set_Spectrum_str) # type: str
"""
Name of harmonic voltage or current spectrum for this generator. Voltage behind Xd" for machine - default. Current injection for inverter. Default value is "default", which is defined when the DSS starts.
DSS property name: `Spectrum`, DSS property index: 45.
"""
def _get_Spectrum(self) -> SpectrumObj:
return self._get_obj(45, SpectrumObj)
def _set_Spectrum(self, value: Union[AnyStr, SpectrumObj], flags: enums.SetterFlags = 0):
if isinstance(value, DSSObj) or value is None:
self._set_obj(45, value, flags)
return
self._set_string_o(45, value, flags)
Spectrum = property(_get_Spectrum, _set_Spectrum) # type: SpectrumObj
"""
Name of harmonic voltage or current spectrum for this generator. Voltage behind Xd" for machine - default. Current injection for inverter. Default value is "default", which is defined when the DSS starts.
DSS property name: `Spectrum`, DSS property index: 45.
"""
def _get_BaseFreq(self) -> float:
return self._lib.Obj_GetFloat64(self._ptr, 46)
def _set_BaseFreq(self, value: float, flags: enums.SetterFlags = 0):
self._lib.Obj_SetFloat64(self._ptr, 46, value, flags)
BaseFreq = property(_get_BaseFreq, _set_BaseFreq) # type: float
"""
Base Frequency for ratings.
DSS property name: `BaseFreq`, DSS property index: 46.
"""
def _get_Enabled(self) -> bool:
return self._lib.Obj_GetInt32(self._ptr, 47) != 0
def _set_Enabled(self, value: bool, flags: enums.SetterFlags = 0):
self._lib.Obj_SetInt32(self._ptr, 47, value, flags)
Enabled = property(_get_Enabled, _set_Enabled) # type: bool
"""
{Yes|No or True|False} Indicates whether this element is enabled.
DSS property name: `Enabled`, DSS property index: 47.
"""
def Like(self, value: AnyStr):
"""
Make like another object, e.g.:
New Capacitor.C2 like=c1 ...
DSS property name: `Like`, DSS property index: 48.
"""
self._set_string_o(48, value)
class GeneratorProperties(TypedDict):
Phases: int
Bus1: AnyStr
kV: float
kW: float
PF: float
kvar: float
Model: Union[int, enums.GeneratorModel]
VMinpu: float
VMaxpu: float
Yearly: Union[AnyStr, LoadShape]
Daily: Union[AnyStr, LoadShape]
Duty: Union[AnyStr, LoadShape]
DispMode: Union[AnyStr, int, enums.GeneratorDispatchMode]
DispValue: float
Conn: Union[AnyStr, int, enums.Connection]
Status: Union[AnyStr, int, enums.GeneratorStatus]
Class: int
Vpu: float
Maxkvar: float
Minkvar: float
PVFactor: float
ForceOn: bool
kVA: float
Xd: float
Xdp: float
Xdpp: float
H: float
D: float
UserModel: AnyStr
UserData: AnyStr
ShaftModel: AnyStr
ShaftData: AnyStr
DutyStart: float
DebugTrace: bool
Balanced: bool
XRdp: float
UseFuel: bool
FuelkWh: float
pctFuel: float
pctReserve: float
Refuel: bool
DynamicEq: Union[AnyStr, DynamicExp]
DynOut: List[AnyStr]
Spectrum: Union[AnyStr, SpectrumObj]
BaseFreq: float
Enabled: bool
Like: AnyStr
class GeneratorBatch(DSSBatch, CircuitElementBatchMixin, PCElementBatchMixin):
_cls_name = 'Generator'
_obj_cls = Generator
_cls_idx = 27
__slots__ = []
def __init__(self, api_util, **kwargs):
DSSBatch.__init__(self, api_util, **kwargs)
CircuitElementBatchMixin.__init__(self)
PCElementBatchMixin.__init__(self)
def edit(self, **kwargs: Unpack[GeneratorBatchProperties]) -> GeneratorBatch:
"""
Edit this Generator batch.
This method will try to open a new edit context (if not already open),
edit the properties, and finalize the edit context for objects in the batch.
It can be seen as a shortcut to manually setting each property, or a Pythonic
analogous (but extended) to the DSS `BatchEdit` command.
:param **kwargs: Pass keyword arguments equivalent to the DSS properties of the objects.
:return: Returns itself to allow call chaining.
"""
self._edit(props=kwargs)
return self
if TYPE_CHECKING:
def __iter__(self) -> Iterator[Generator]:
yield from DSSBatch.__iter__(self)
def _get_Phases(self) -> BatchInt32ArrayProxy:
return BatchInt32ArrayProxy(self, 1)
def _set_Phases(self, value: Union[int, Int32Array], flags: enums.SetterFlags = 0):
self._set_batch_int32_array(1, value, flags)
Phases = property(_get_Phases, _set_Phases) # type: BatchInt32ArrayProxy
"""
Number of Phases, this Generator. Power is evenly divided among phases.
DSS property name: `Phases`, DSS property index: 1.
"""
def _get_Bus1(self) -> List[str]:
return self._get_batch_str_prop(2)
def _set_Bus1(self, value: Union[AnyStr, List[AnyStr]], flags: enums.SetterFlags = 0):
self._set_batch_string(2, value, flags)
Bus1 = property(_get_Bus1, _set_Bus1) # type: List[str]
"""
Bus to which the Generator is connected. May include specific node specification.
DSS property name: `Bus1`, DSS property index: 2.