-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Received unknown message from PMU #35
Comments
Hey @hrvojej You might get better insight if you simply remove
to this
Even better, you can try with |
Hey @sstevan , thank you for that - it helped me find the error:
Program correctly identifies Any advice on what can I do now? I assume that So if I'm reading correctly bits 05-04 is Unlocked time and it suppose to be 11 as I read it from my Anyway I can change code so that value get calculated properly, or should I just hardcode EDIT and I started to receive data! |
Since standard says that: Bits 4–5―Unlocked time: indicates a range of seconds since loss of synch was detected. This counts Bit code -- Indication I guess I shouldn't keep this value hardcoded. Biggest problem is why is my STAT 15bit instead 16bit long and how to get around this? |
Hey @hrvojej, Looks like shift operation is missing here:
Shifting should be done for each flag in stat word. |
According to your comment I've changed lines 1956 - 1969 in
According to this: After code updating everything seems to be running fine. |
Thanks @hrvojej I will keep this one open until we get this resolved. |
@hrvojej First, in line 1920 in frame.py: Next, in line 1955 should be:
We don't really have to do any shifting with trigger and cfg_change, since they are casted into bool types, but shifting will not cause any error. Thank you for helping us! |
Hi Veljko,
Your assumption seems correct.
Unfortunately currently I don't have time to properly test this but if
shifting is done according to number of bits each field occupies in
standard than I guess it's correct.
I'll implement this within 3 weeks time and report back to you.
Hrvoje
…On Tue, Jul 19, 2022, 17:12 Veljko Djurkovic ***@***.***> wrote:
@hrvojej <https://github.com/hrvojej>
Hello, I found some problems that are causing this error.
First, in line 1920 in frame.py:
stat = measurement_status << 2
This should be written this way:
stat = measurement_status << 1 because, according to the standard, PMU
sync takes only 1 bit, so if we shift this two times, we have one zero more
than we actually need to have.
Next, in line 1955 should be:
measurement_status = DataFrame.MEASUREMENT_STATUS_WORDS[stat >> 14]
If we shift this one 15 times, we will loose less significant byte in Data
error bits.
So, this whole part of code should be written like this:
*measurement_status = DataFrame.MEASUREMENT_STATUS_WORDS[stat >> 14]*
sync = bool(stat & 0x2000)
if stat & 0x1000:
sorting = "arrival"
else:
sorting = "timestamp"
trigger = bool(stat & 0x800)
cfg_change = bool(stat & 0x400)
modified = bool(stat & 0x200)
**_time_quality = DataFrame.TIME_QUALITY_WORDS[(stat & 0x1c0)>>6]
unlocked = DataFrame.UNLOCKED_TIME_WORDS[(stat & 0x30)>>4]_**
trigger_reason = DataFrame.TRIGGER_REASON_WORDS[stat & 0xf]
return measurement_status, sync, sorting, trigger, cfg_change, modified, time_quality, unlocked, trigger_reason
We don't really have to do any shifting with *trigger and cfg_change*,
since they are casted into bool types, but shifting will not cause any
error.
Tell me if you agree with those, and I will have frame.py updated as soon
it is possible.
Thank you for helping us!
Best regards!
—
Reply to this email directly, view it on GitHub
<#35 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIFMSLVW6NH2XRHPEZ7KVLVU3AUDANCNFSM5JXD3UTA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thank you @hrvojej for very fast response! I'm glad that we might have this issue closed soon. Veljko |
First, in line 1920 in frame.py: stat = measurement_status << 2 This should be written this way: stat = measurement_status << 1 because, according to the standard, PMU sync takes only 1 bit, so if we shift this two times, we have one zero more than we actually need to have. Next, in line 1955 should be: measurement_status = DataFrame.MEASUREMENT_STATUS_WORDS[stat >> 14] If we shift this one 15 times, we will loose less significant bit in Data error bits. So, this whole part of code should be written like this:
First, in line 1920 in frame.py: stat = measurement_status << 2 This should be written this way: stat = measurement_status << 1 because, according to the standard, PMU sync takes only 1 bit, so if we shift this two times, we have one zero more than we actually need to have. Next, in line 1955 should be: measurement_status = DataFrame.MEASUREMENT_STATUS_WORDS[stat >> 14] If we shift this one 15 times, we will loose less significant bit in Data error bits. time_quality and trigger_reason should be shifted to get exact numbers from TIME_QUALITY_WORDS and TRIGGER_REASON_WORDS dictionaries.
Updates to run in the SINTEF lab I changed collections to collections.abs in frame.py. Since Sequence was moved to collections.abc as of Python 3.7. It seems that we are receiving frequency and not frequency deviations. I therefore implemented iicsys#3 (comment) . I also implemented iicsys#35 (comment) to fix a bug.
Seems like everything is working correctly. Are you sure |
The thing is that sync is casted to bool, so we don't need to shift it since bool casting returns True for every number which is not zero. |
Ok, great, thanks. |
Hi,
I'm having problem receiving Data Frames from my PMU.
When I do test with example scripts using
randomPMU.py
as sample PMU andtinyPDC.py
as PDC everything works perfectly.But when I connect to my PMU I get ConfigFrame2 without any problems after that I got error receiving Data Frames.
PMU is on 192.168.100.214, port is 4712. PCAP capture taken with Wireshark is here.
Any kind of help is highly appreciated,
Thanks!
The text was updated successfully, but these errors were encountered: