DSMR P1 Frame example - c

I am reading DSMR P1 documentation and I have some doubts.
Documentation: https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf
This document gives an example of a P1 frame:
/ISk5\2MT382-1000
1-3:0.2.8(50)
0-0:1.0.0(101209113020W)
0-0:96.1.1(4B384547303034303436333935353037)
1-0:1.8.1(123456.789*kWh)
1-0:1.8.2(123456.789*kWh)
1-0:2.8.1(123456.789*kWh)
1-0:2.8.2(123456.789*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(01.193*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00004)
0-0:96.7.9(00002)
1-0:99.97.0(2)(0-0:96.7.19)(101208152415W)(0000000240*s)(101208151004W)(0000000301*s)
1-0:32.32.0(00002)
1-0:52.32.0(00001)
1-0:72.32.0(00000)
1-0:32.36.0(00000)
1-0:52.36.0(00003)
1-0:72.36.0(00000)
0-
0:96.13.0(303132333435363738393A3B3C3D3E3F303132333435363738393A3B3C3D3E3F303132333435363738393A3B3C
3D3E3F303132333435363738393A3B3C3D3E3F303132333435363738393A3B3C3D3E3F)
1-0:32.7.0(220.1*V)
1-0:52.7.0(220.2*V)
1-0:72.7.0(220.3*V)
1-0:31.7.0(001*A)
1-0:51.7.0(002*A)
1-0:71.7.0(003*A)
1-0:21.7.0(01.111*kW)
1-0:41.7.0(02.222*kW)
1-0:61.7.0(03.333*kW)
1-0:22.7.0(04.444*kW)
1-0:42.7.0(05.555*kW)
1-0:62.7.0(06.666*kW)
0-1:24.1.0(003)
0-1:96.1.0(3232323241424344313233343536373839)
0-1:24.2.1(101209112500W)(12785.123*m3)
!EF2F
I have a problem with several objects. For example, object 1-3: 0.2.8 is described as an alphanumeric string.
object 1-3: 0.2.8
According to the description in the documentation, the object should be sent as asciihex and in the example it looks like visible-string.
octet-string description
octet-string description
Can anyone tell me what's going on ?

"50" is a valid asciihex string, and represents the value 80 in decimal. However apparently the hexadecimal value is used as the value (in this case meaning version 5.0). An earlier standards version was 4.2 and was represented as the string "42".
Don't get too confused about that, just understand that a asciihex string of "AB" means version A.B.

Related

Is there a way to constrain music21's chord detection to non-slash chords?

I'm working on a script that takes as input a sequence of MIDI notes and outputs a chord symbol for use in Impro-Visor, an open-source jazz improvisation helper. In order to take advantage of Impro-Visor's large vocabulary of chords I've been trying to add to music21's chord vocabulary--music21 itself will handle the MIDI pitches and the interpretation of most common chords--using the harmony.addNewChordSymbol method, but the system doesn't offer the new chords in its chord detection. For example, if I try this chord from the Harmony module's docs:
>>>harmony.addNewChordSymbol('BethChord', '1,3,-6,#9', ['MH', 'beth'])
>>>c = chord.Chord(['C3','D#3','E3','A-3'])
>>>print(harmony.chordSymbolFromChord(c))
'A-+/CaddD#'
Whereas I would hope in this case to get: 'Cbeth'
Music21 consistently suggests slash chords like the above rather than whatever chord I've tried to add to the vocabulary, presumably because the chord type to the left of the slash--'+', in this case--comes earlier in the OrderedDict in harmony.py. Is there any way to make the chord-detection prefer a custom chord type over these slash chords (which I don't have any way of handling)?
I found that just telling music21 you meant for "C" to be the root does the trick. (Otherwise, it will try to stack in thirds and treat "Ab" as the root.) Call .root() like this:
>>> harmony.addNewChordSymbol('BethChord', '1,3,-6,#9', ['MH', 'beth'])
>>> c = chord.Chord(['C3','D#3','E3','A-3'])
>>> c.root(c.bass())
>>> harmony.chordSymbolFromChord(c)
<music21.harmony.ChordSymbol CMH>

one-hot encoding issue

I have the following code which i am trying to achieve one hot encoding.
k=tf.Variable(tf.zeros((10,1)))
hprev=tf.Variable(tf.zeros((10,1)))
x=tf.placeholder(tf.int32,shape=None,name="x")
y_op =tf.assign(k, k[x,0].assign(1))
M_c=tf.concat((hprev,y_op),axis=0)
init=tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
print(sess.run(y_op,feed_dict={x:1}))
print(M_c.eval())
I get the error:You must feed a value for placeholder tensor 'x_64' with dtype int32. Yet I have passed 1 as the value, which in my understanding is an integer. What I am doing wrong ?. I am still a beginner please.

Flex does not recognize identifiers

I am trying to implement a very simple parser using flex. I am currently stuck in the ID recognition. That is my code:
ID [a−zA−Z_][a−zA−Z0−9_]*
...
{ID} { printf( "An identifier: %s\n", yytext ); return TOK_ID;}
However what I get is only the first letter of the identifier, for example if I try to parse:
int _underscore ;
The result is:
An identifier: _
Any advice?
EDIT:
With a more accurate analysis I have figured out that the code is able to recognize only the id with a,z,A,Z,_, that are the explicit characters in the regular expression. I did not find anything like that online, is that a bug?
EDIT2:
If I modify the code in that way all work
ID [a−zA−Z_][a−zA−Z0−9_]*
...
[a−zA−Z_][a−zA−Z0−9_]* { printf( "An identifier: %s\n", yytext ); return TOK_ID;}
According to the documentation it should work also in the other way.
This is a character encoding issue. In your copy-and-pasted source code, the things that look like ASCII hyphens (-, code U+2D) in your definition of ID:
ID [a−zA−Z_][a−zA−Z0−9_]*
aren't. Instead they're unicode minus signs (−, U+2212). If you replace the incorrect minus signs with the correct hyphens, the line will look like:
ID [a-zA-Z_][a-zA-Z0-9_]*
Depending on your font, if you look very closely, you may see a difference between the − in the first version and the - in the second.
Anyway, replace your ID definition with the second version above (or else retype it from scratch, and all should be well.

How to set quality of resized jpg

I'd like set size and quality of JPG file. I found in doc a "q" parameter. OK, I write the parameter
<img src="~/media(28bd31b4-7102-461f-9206-a27d89b6be68)?mh=800&q=80" alt="blah" />
When I try to save it I get message Not well-formed - '=' is an unexpected token. The expected token is ';'. Line 10, position 70.
How can I save it?
Note 1: Default quality should be 80, as written in doc; value imageQuality in Composite.config is 80. But quality is really much lower (20?).
Note 2: Composite C1 4.2 Update 1, Build no. 4.2.5287.17495 (but upgraded from 3.x -> 4.1 -> 4.2)
Everything in Composite C1 is well formatted XHTML, you need to do
<img src="~/media(28bd31b4-7102-461f-9206-a27d89b6be68)?mh=800&q=80" alt="blah" />

How to format a number in ng:pluralize

How to format a number passed into ng:pluralize directive via attribtute 'count'?
Consider following code:
<ng:pluralize count="5000000" when="{'other': '{} things'}"></pluralize>
the output is:
5000000 things
How can I modify this for output to be:
5,000,000 things // in US locale
5 000 000 things // in Czech locale
I tried using filter 'number', but I think I don't know where to put it. It doesn't work in the object passed to attribute 'when'. I tried these:
... when="{'many': '{{{}|number}} things'}"
... when="{'many': '{}|number things'}"
... when="{'many': '{|number} things'}"
You need to assign the value to a variable
<ng:pluralize ng-init="myCount=5000000" count="myCount" when="{'other': '{{myCount|number}} things'}"></ng:pluralize>
This will format the value to the current locale rules
Demo:
plunker
Expanding on #Liviu T.'s answer, there's no real need to use ng-init to assign the variable. You can do it directly in count.
<ng:pluralize count="myCount=5000000" when="{'other': '{{myCount|number}} things'}"></ng:pluralize>

Resources