pqopen-lib 0.8.2__py3-none-any.whl → 0.8.4__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.
- pqopen/powersystem.py +7 -5
- pqopen/zcd.py +3 -1
- {pqopen_lib-0.8.2.dist-info → pqopen_lib-0.8.4.dist-info}/METADATA +1 -1
- {pqopen_lib-0.8.2.dist-info → pqopen_lib-0.8.4.dist-info}/RECORD +6 -6
- {pqopen_lib-0.8.2.dist-info → pqopen_lib-0.8.4.dist-info}/WHEEL +0 -0
- {pqopen_lib-0.8.2.dist-info → pqopen_lib-0.8.4.dist-info}/licenses/LICENSE +0 -0
pqopen/powersystem.py
CHANGED
|
@@ -305,11 +305,11 @@ class PowerSystem(object):
|
|
|
305
305
|
if self._features["harmonics"]:
|
|
306
306
|
for phase in self._phases:
|
|
307
307
|
if phase._u_channel.freq_response:
|
|
308
|
-
phase._u_fft_corr_array = create_fft_corr_array(self._harm_fft_resample_size
|
|
308
|
+
phase._u_fft_corr_array = create_fft_corr_array(self._harm_fft_resample_size,
|
|
309
309
|
self._samplerate/2,
|
|
310
310
|
phase._u_channel.freq_response)
|
|
311
311
|
if phase._i_channel is not None and phase._i_channel.freq_response:
|
|
312
|
-
phase._i_fft_corr_array = create_fft_corr_array(self._harm_fft_resample_size
|
|
312
|
+
phase._i_fft_corr_array = create_fft_corr_array(self._harm_fft_resample_size,
|
|
313
313
|
self._samplerate/2,
|
|
314
314
|
phase._i_channel.freq_response)
|
|
315
315
|
|
|
@@ -481,7 +481,8 @@ class PowerSystem(object):
|
|
|
481
481
|
if self._features["harmonics"]:
|
|
482
482
|
data_fft_U = pq.resample_and_fft(u_values, self._harm_fft_resample_size)
|
|
483
483
|
if phase._u_fft_corr_array is not None:
|
|
484
|
-
|
|
484
|
+
resample_factor = min(self._harm_fft_resample_size / u_values.size, 1)
|
|
485
|
+
data_fft_U *= phase._u_fft_corr_array[np.linspace(0, self._harm_fft_resample_size*resample_factor, self._harm_fft_resample_size//2+1).astype(np.int32)]
|
|
485
486
|
u_h_mag, u_h_phi = pq.calc_harmonics(data_fft_U, self.nper, self._features["harmonics"])
|
|
486
487
|
u_ih_mag = pq.calc_interharmonics(data_fft_U, self.nper, self._features["harmonics"])
|
|
487
488
|
if phase._number == 1: # use phase 1 angle as reference
|
|
@@ -658,7 +659,7 @@ class PowerSystem(object):
|
|
|
658
659
|
List[int]: Detected zero-crossing indices.
|
|
659
660
|
"""
|
|
660
661
|
zcd_data = self._zcd_channel.read_data_by_index(start_idx=start_acq_sidx, stop_idx=stop_acq_sidx)
|
|
661
|
-
zero_crossings = self._zero_cross_detector.process(zcd_data)
|
|
662
|
+
zero_crossings = self._zero_cross_detector.process(zcd_data, self._zero_crossings[-1] - start_acq_sidx)
|
|
662
663
|
if not zero_crossings:
|
|
663
664
|
if (self._zero_crossings[-1] + self._samplerate/self._zcd_minimum_frequency - self._zero_cross_detector.filter_delay_samples) < stop_acq_sidx:
|
|
664
665
|
zero_crossings.append(self._zero_crossings[-1] + self._samplerate/self._last_known_freq - start_acq_sidx)
|
|
@@ -674,9 +675,10 @@ class PowerSystem(object):
|
|
|
674
675
|
if self._last_known_freq < self._zcd_minimum_frequency:
|
|
675
676
|
self._last_known_freq = self.nominal_frequency
|
|
676
677
|
self._calculation_mode = "FALLBACK"
|
|
678
|
+
elif self._calculation_mode == "FALLBACK":
|
|
679
|
+
self._calculation_mode = "NORMAL"
|
|
677
680
|
else:
|
|
678
681
|
self._calculation_mode = "NORMAL"
|
|
679
|
-
|
|
680
682
|
return zero_crossings
|
|
681
683
|
|
|
682
684
|
def get_aggregated_data(self, start_acq_sidx: int, stop_acq_sidx: int) -> dict:
|
pqopen/zcd.py
CHANGED
|
@@ -55,7 +55,7 @@ class ZeroCrossDetector:
|
|
|
55
55
|
self.filter_delay_samples = np.angle(h)[0] / (2 * np.pi) * self.samplerate / self.f_cutoff - 1 # due to adding sample in front for continuity
|
|
56
56
|
self.filtered_data = []
|
|
57
57
|
|
|
58
|
-
def process(self, data: np.ndarray)-> list:
|
|
58
|
+
def process(self, data: np.ndarray, abs_last_zc: int = None)-> list:
|
|
59
59
|
"""
|
|
60
60
|
Processes a block of input data and detect zero-crossings.
|
|
61
61
|
|
|
@@ -117,6 +117,8 @@ class ZeroCrossDetector:
|
|
|
117
117
|
else:
|
|
118
118
|
if self._last_zc and (real_zc <= self._last_zc):
|
|
119
119
|
logger.warning("Detected ZC before last one, ignoring")
|
|
120
|
+
elif (abs_last_zc is not None) and (self._last_zc and (real_zc <= abs_last_zc)):
|
|
121
|
+
logger.warning("Detected ZC before last one, ignoring")
|
|
120
122
|
else:
|
|
121
123
|
zero_crossings.append(real_zc + self.filter_delay_samples)
|
|
122
124
|
last_used_p_idx = p_idx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pqopen-lib
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.4
|
|
4
4
|
Summary: A power quality processing library for calculating parameters from waveform data
|
|
5
5
|
Project-URL: Homepage, https://github.com/DaqOpen/pqopen-lib
|
|
6
6
|
Project-URL: Issues, https://github.com/DaqOpen/pqopen-lib/issues
|
|
@@ -3,10 +3,10 @@ pqopen/auxcalc.py,sha256=P11Nu9pgJRoPYZDjLk-mXI6Ha02LoTH5bS9FdFTvC9M,2733
|
|
|
3
3
|
pqopen/eventdetector.py,sha256=NKZU7GbeorZdkYu3ET4lhMaeynw70GhIGO2p1xH4aTA,11962
|
|
4
4
|
pqopen/helper.py,sha256=0msrm6i1v8jj2Z5X8F7wDEW0KD5i91RBNZwPJC05YrA,2533
|
|
5
5
|
pqopen/powerquality.py,sha256=dRVCedWa1QJKHgdiYoIIdvhH_p40cwpgeUePO5u1j28,15953
|
|
6
|
-
pqopen/powersystem.py,sha256=
|
|
6
|
+
pqopen/powersystem.py,sha256=BDB-Xf-xe3UYVBUyX2gjKXnWpeZWTQTaLDSGCvtmGZ4,49256
|
|
7
7
|
pqopen/storagecontroller.py,sha256=AhVaPgIh4CBKKMJm9Ja0dOjVd4dLppWprxeeg3vrmAk,31266
|
|
8
|
-
pqopen/zcd.py,sha256=
|
|
9
|
-
pqopen_lib-0.8.
|
|
10
|
-
pqopen_lib-0.8.
|
|
11
|
-
pqopen_lib-0.8.
|
|
12
|
-
pqopen_lib-0.8.
|
|
8
|
+
pqopen/zcd.py,sha256=olJZsHRd1CjU65vysc2emR5wFGMkayIWdUEDNE8jfIc,6253
|
|
9
|
+
pqopen_lib-0.8.4.dist-info/METADATA,sha256=hC1fidnpdel5XKb8T5zDJ6H3zidLNtTTJuhnYnKAVQE,4787
|
|
10
|
+
pqopen_lib-0.8.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
11
|
+
pqopen_lib-0.8.4.dist-info/licenses/LICENSE,sha256=yhYwu9dioytbAvNQa0UBwaBVcALqiOoBViEs4HLW6aU,1064
|
|
12
|
+
pqopen_lib-0.8.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|