Kitz Forum

Chat => Chit Chat => Topic started by: Weaver on January 19, 2022, 01:24:46 AM

Title: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 19, 2022, 01:24:46 AM
Referring to https://forum.kitz.co.uk/index.php/topic,24614.msg414054.html, here’s a pretty ugly picture of the DSL blight which I named "the hollow curve phenomenon" for want of a better term. This has affected my lines many times over the last two years.

(https://forum.kitz.co.uk/index.php?action=dlattach;topic=24614.0;attach=28426;image)

In reality I would be working on y = bitloading values of 0…15, not a curvy SNR graph.

Generality: there may well be non-zero values below x<32, unlike in the above example. In either case any values below x<32 are upstream values and are data to be ignored.

What I want to do is write some pseudo-code to start with, or C, to detect the presence of this illness by inspecting some graph and determining whether it looks like the above or looks normal, normal being with a single hump, but ignoring any sharp dips due to DSL weirdness such as a pilot tone or narrow interference. I’m hoping you all can contribute some all mathematical ideas that will make it highly robust and very fast. The finished code will be written in code for the iOS Shortcuts engine, which is painfully slow these days in iPadOS 15, so minimising the number of lines of code is the way to go.
 
There are various ways of detecting the double maximum (ill; hollow curve) versus single maximum (healthy) but these only work properly if you filter out the aforementioned sharp dips. I wonder if such filtering might be the way to go before anything else is done. At least after that life is simple. The other method is to try to design a single algorithm that is immune to such dips while detecting the ‘genuine’ double maxima.

The simplest (‘cheapo’) test I can think of is simply three ycooord tests, at x==40, x==60, x==85. I’m not sure that that is general enough. In the aforementioned example there’s a small sharp dip worryingly close to x = 85. Something like
        hollow = y[60] < y[40] && y[60] < y[85];

The mathematical ‘heavyweight’ method I can think of would be:The problem with the latter ‘heavyweight’ method is where and how to apply the sign change test. Also the whole thing is too much code, and is overkill unless its potential robustness turns out to be needed because the first, cheap method proves too fragile.

One kind of sharp dip, which is extremely severe, is the pilot tone, which dips all the way down from y==whatever, 11, maybe, down to y==bitloading of 2, x==unpredictable. The width is extremely narrow. This can really mess up the simple test and can score a false positive if the test is e.g. y[60] and the pilot tone is also at say x==60 even though there is otherwise only a single smooth hump overall, a single local maximum.

Comments, suggestions? Ways to ensure method 1 (‘cheapo’) can be made reliable?

The y data is presented as a list of ASCII decimal numbers separated by newlines. I also need to find a very cheap way of converting all those decimal strings into numbers in an array, as otherwise I can’t think of any way of finding line 40, 60, 85 say. I’m not sure I can afford a loop with 80 iterations or worse. I could do with some help with this problem, which despite sounding simple could be a showstopper given the limitations of the iOS Shortcuts engine.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 19, 2022, 03:41:13 PM
My first (and currently only) suggestion is to restrict the domain of the X-axis values to be considered. I would use:

100 > X > 32
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 19, 2022, 09:21:23 PM
Agreed. In some other data I immediately found a dip all the way down to y=2 due to pilot tone (which I don’t fully understand - Kitz where are you ? ;) ) at around tone 60 iirc. That kind of thing is going to be a nuisance to deal with.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 19, 2022, 10:10:14 PM
As 100 - 32 = 68, my next suggestion is to perform an initial pass looking at blocks of 4. That should minimise the distraction caused by a pilot tone, etc.

(Why blocks of 4? No real reason other than that 4 x 17 = 68 and 4 > 1.)

I feel the urge to type "first differential".
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 19, 2022, 10:51:41 PM
And average the blocks? or…
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 19, 2022, 11:21:32 PM
Just differentiate the arithmetic mean and find the turning point(s) of the curve. If you have a local maximum, followed by a local minimum, followed by a local maximum then the hollow curve phenomenon has struck again.

Hmm . . . I think you will need to look at the second differential. (My memory of A-level pure mathematics, from 50+ years ago, has faded somewhat.)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 20, 2022, 04:40:30 AM
I understand the calculus rationale. However the pilot tone thing has a huge spike in both first and second derivatives.

l would rather not do differentiation; recte finite differences here, since the bits-per-bin data are discrete integer-valued (y). The reason is because having a loop with lots of subtractions in it will be slow, as Shortcuts is incredibly slow.

What were you saying before about four quarters? My most urgent need is to get rid of all spikes, pilot tone being the main one. Wobble of y +/- 1 is also a nuisance, some being mere quantisation noise.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 20, 2022, 03:16:33 PM
I'm not too sure what I was thinking about, late yesterday.  :-[

At the moment, I can't see a clear forward path to a boolean answer to a query asking if a "hollow curve" is present.

Random thought. Suppose that the bit loading per sub-carrier index is "harvested", once, at the same time each 24 hour period. Now subtract that of dayn from that of dayn+1 to give the delta on dayn+1. What would that delta show when the "hollow curve phenomenon" first appears?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 20, 2022, 08:55:57 PM
Yes, it would, but that won’t fit in the spec for this as I was going to add this in as an additional immediate health check amongst those already checked in the application program that I write about some weeks ago, an iOS Shortcuts app that checks all the modems and delivers a very succinct report - good or bad and if bad it gives the details. That program does not run continuously so that rules out your idea, because iOS doesn’t allow Shortcuts programs to run continuously - they’re UI-modal, locking up the UI, with no multitasking and no thought given to what should happen if you run two Shortcuts programs - in other words a complete design dog’s breakfast. Perhaps tolerable on an iPhone for very short excution-time programs, but not suitable for an iPad with a big screen and several very slow Shortcuts programs wanting to run side by side. But apart from being painfully slow in iOS 15 the result works really well and does what it’s supposed to.

I was thinking about a crude spike detector that looks at x==60 for a dip down to y=2 (or maybe 3,4 for a bit of insurance) and then if it sees one at x==60 it walks sideways in increasing x+=2 to get away from the spike. Then y[x==60 or 62] now is compared against y[40] and y[85] as mentioned in my first post. Something like
        hollow = y[x==60 or 62] < y[40] && y[x==60 or 62] < y[85];

The benefit of this is that it has no loops in it, given the painful slowness of Shortcuts iOS15

Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 20, 2022, 10:42:06 PM
I was thinking about a crude spike detector that looks at x==60 for a dip down to y=2 (or maybe 3,4 for a bit of insurance) and then if it sees one at x==60 it walks sideways in increasing x+=2 to get away from the spike. Then y[x==60 or 62] now is compared against y[40] and y[85] as mentioned in my first post. Something like

        hollow = y[x==60 or 62] < y[40] && y[x==60 or 62] < y[85];

I am not that certain . . . but it certainly is worth testing.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 21, 2022, 12:24:29 AM
There’s a bug in that expression. Because of quantisation noise, the value of y can go up/down by 1 in a semi-random fashion. For this reason I’ve adapted the expression to give:
        hollow = y[x==60 or 62] < y[40] - 1 && y[x==60 or 62] < y[85] - 1;

This is I hope correct? The y values can wobble up and down by 1 so y1 < y2 should really read y1 < y2 -1 - that’s my reasoning. Please someone sanity check me on this.

I’ve written the Shortcuts code for this. It has absolutely zero loops in the Shortcuts code[!], letting the engine runtime do the work at low level that I would otherwise have to write in lines of Shortcuts source code. This means that it’s not slow. It gets the bitloading data file from each modem as http://modem:8000/data/Bits/ and uses regexes like ^\X*\n[ \t]*40[ \t]+(\d+)\X*$ to get y[40] for example, searching the whole of the text for a line like
    40  11

which means tone=40 bitloading=11 bits. Same for tone 60 or thereabouts and for tone 85.

I need to look back at some of the old bitloading hollow curve illness reports (not the SNR reports).

I need to test what happens if there are some small dips due to interference, downwards-going just a few bits deep and say 2-3 tones wide. My worry is that such could be mistaken for hollow curve. A more sophisticated test, which is capable of moving the y[x60] point sideways more, that would presumably do the trick but the details escape me just now.



A question: when writing posts in the forums, it does of course go crackers when I try to write certain things inside [ ]. How do I work around that?



A question for all ADSL experts : is the bitloading[pilot_tone] == 2 thing something that is always exactly true? I didn’t know whether the value can be zero or > 2 or what. Because I didn’t know, for now I made the pilot tone test "(bitloading y < 4)".
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 21, 2022, 01:18:26 AM
Here’s an example. Very very serious disease. What I also want is very mild early onset so the algorithm can detect the onset really early and warn in good time. The very serious disease thing would be detected by the min-sync rate test in any case.

(https://i.postimg.cc/CKhL37Nz/B3-C832-E0-9-EF4-4-B85-B17-B-CA5864-B42-F92.png)



And here are the latest perfectly healthy pictures:

(https://i.postimg.cc/dt0RFMsK/0-F72-E4-EA-966-B-4118-8-A20-24497-FD22-B46.png)

(https://i.postimg.cc/htcXnTbQ/7-D1-B8-ED7-13-EA-4-BB7-83-AA-C5-D957-B6-A44-A.png)

(https://i.postimg.cc/DzNHrQxS/E095-AAE3-2-BCC-4-AB4-80-C8-7-A968-B488-CC5.png)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 21, 2022, 02:19:24 AM
A further thought. Using any kind of averaging, smoothing type filter would surely make the depth of the pilot tone dip much higher, would it not? Thus increasing the danger that a pilot tone in the wrong place could be mistaken for a hollow curve y-min if the smoothing filter was applied first, before all other inspection, and therefore affecting all data pilot tone dip included.

Despite this earlier post of mine (https://forum.kitz.co.uk/index.php/topic,25351.0.html) which I had completely forgotten, I still don’t understand the data in pilot tone thing.



ALGORITHM II

Another idea about the central comparison in the algorithm. Take the two points ( 40, y40-1 ), ( 85, y85-1 ). Then consider the data point ( 60 or 62, y6x) where y6x is the corresponding data y value. Now draw a straight line between the first two points. Then where it reaches x=60 or 62, solve for ymid = y; that is the y value of the straight line at the middle point x== x60 = (60 or 62). Now we have
    hollow_curve = ( y6x < ymid );  ymid = y40 - 1 + (y85 - y40)*(x60 - 40.0)/(85.0 - 40.0) — is that correct ?

I’m not sure if this is an improvement or not. It certainly handles one potential problem case, which is where the y85 value is really low, because the whole thing is very peaky/pointy, not like a nice rounded / domed loaf kind of shape. If the y85 value is really low then the second of the tests in the && in the first algorithm will be in danger and the expression will fail to spot very early mild hollow curve onset.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: jelv on January 21, 2022, 08:16:38 AM
A question: when writing posts in the forums, it does of course go crackers when I try to write certain things inside [ ]. How do I work around that?

Enclose the text in [nobbc]...[/nobbc] tags (which I had to do in this post so they would show - start a quote of this post to see how).
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 21, 2022, 06:46:48 PM
Here’s an example. Very very serious disease. What I also want is very mild early onset so the algorithm can detect the onset really early and warn in good time. The very serious disease thing would be detected by the min-sync rate test in any case.

<snip>



And here are the latest perfectly healthy pictures:

<snip>


If it would not be too inconvenient, would you please send me (via e-mail) the "xdslctl info --Bits" data for those four plots? I would like to generate those plots with my usual utility, so I can see how different the plots look when compared with the "Easy Stats (tm)" output that you have shown, above.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 21, 2022, 07:51:37 PM
I’m really sorry, I don’t have the data sets for the older ones. I just got the images alone from my "Photos" image library in which they were screen shots. I can of course send you the new data.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 21, 2022, 09:19:00 PM
Ah, no, please don't bother with that. I just wanted to compare the style of plotting. As you will recall, when I was last using an ADSL2 based service my bit loading v sub-carrier plots did not show any pilot tone(s). (I'm not saying that they were not present . . .)

Puzzled.  :-\
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 21, 2022, 09:27:53 PM
Has anyone else ever seen a disease like this? (Which now seems to be quite possibly a modem disease, not anything to do with DSL lines.)



I wanted to draw a straight line between the two humps and show on it the variables discussed, to make a pretty picture. Especially if I can find a picture where such a straight line would be downwards sloping to the right. (Increasing x, decreasing y). However I don’t have a tool for that. And would get lost immediately amongst the thousands of iOS apps. I would need something that can draw on an existing bitmap, draw straight lines in various line styles, drop various symbols such as dots, blobs, crosses and draw text too. And with multiple undo too.



Pilot tone shows bitloading of 2 always.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 21, 2022, 10:13:56 PM
I wanted to draw a straight line between the two humps and show on it the variables discussed, to make a pretty picture. Especially if I can find a picture where such a straight line would be downwards sloping to the right. (Increasing x, decreasing y). However I don’t have a tool for that. And would get lost immediately amongst the thousands of iOS apps. I would need something that can draw on an existing bitmap, draw straight lines in various line styles, drop various symbols such as dots, blobs, crosses and draw text too. And with multiple undo too.

Have a play with GraphSketch (https://graphsketch.com/)

Here's two that I prepared earlier (https://graphsketch.com/?eqn1_color=1&eqn1_eqn=10-x&eqn2_color=2&eqn2_eqn=10-%2810%28x%2F25%29%29&eqn3_color=3&eqn3_eqn=&eqn4_color=4&eqn4_eqn=&eqn5_color=5&eqn5_eqn=&eqn6_color=6&eqn6_eqn=&x_min=-5&x_max=27&y_min=-10.5&y_max=10.5&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=640&image_h=640).

Quote
Pilot tone shows bitloading of 2 always.

Crazy idea? "Normalise" the data by subtracting the bit loading of the pilot tone from the bit loadings of all the other sub-carriers and then work only with the data that is greater than zero.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 22, 2022, 04:38:29 AM
Another question: is the pilot tone always a single tone only? ie x-width == 1. Never x-width >= 2 ? I step sideways to get away from a suspected pilot tone.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 22, 2022, 04:05:14 PM
Let x be the sub-carrier index (or tone) and y be the bit-loading at x . . .

for (x > 32; x < 120; x++) {
        if (y < 3)
                continue;

        process data;
}



Remember that a pilot tone is a defined frequency, not a 4.3125 kHz block of frequencies. The latter is what we are looking at on the X-axis.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 22, 2022, 05:57:18 PM
Ah, that’s a good point. But when it is modulated, then the modulation will cause a single frequency to spread into a band of frequencies of a width determined by the type and top frequency of the modulation, no? But I wasn’t thinking straight, indeed. Is it sometimes a real pure and simple pilot tone and sometimes an ordinary ‘bin’ instead, when carrying data? Did you say that VDSL2 is different or am I imagining things?



In my code as it is now, implementing algorithm one (of the two described above), I test y at 3 x values: x==40, x==60 or 62 and x==85. The x==60 thing is the approximate mid point, but there is a danger of hitting the pilot tone there, so if x < 4 (I see you have 3 there, so I should perhaps amend my code) then I assume I have hit a pilot tone and so I switch to sample y at x==62 instead. I hopped out of the way sideways by x+=2 because of nervousness about the width of the pilot tone but I was overly paranoid in this respect as you have told me, so x+=1 would have suffixed, but there’s no harm in x+=2 so I’ll leave it as is in case I have hit something other than a pilot tone, possible if the bitloadings are extremely low in a very very diseased system. (See one of my earlier pictures (https://forum.kitz.co.uk/index.php/topic,26716.msg447930.html#msg447930).)



Can someone tell me - is the bit loading = 2 thing always true ? For VDSL ? Different for different ADSL implementations ?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 22, 2022, 08:28:43 PM
I really don't know . . . I regard ADSL2(+) and VDSL2 as identical except for the band plans, which define the number of sub-carriers and the split between US & DS.

I know that Fritz!Box devices will very clearly put an indicator for the pilot tone in the plots they show. I have never seen any evidence for a pilot tone when plotting data for my ADSL2 (deceased) and VDSL2 (current) circuits.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 22, 2022, 08:33:59 PM
So you haven’t seen a bitloading=2 data point deep dip in your ADSL days?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 22, 2022, 08:38:04 PM
In my code as it is now, implementing algorithm one (of the two described above), I test y at 3 x values: x==40, x==60 or 62 and x==85. The x==60 thing is the approximate mid point, but there is a danger of hitting the pilot tone there, so if x < 4 (I see you have 3 there, so I should perhaps amend my code) then I assume I have hit a pilot tone and so I switch to sample y at x==62 instead. I hopped out of the way sideways by x+=2 because of nervousness about the width of the pilot tone but I was overly paranoid in this respect as you have told me, so x+=1 would have suffixed, but there’s no harm in x+=2 so I’ll leave it as is in case I have hit something other than a pilot tone, possible if the bitloadings are extremely low in a very very diseased system. (See one of my earlier pictures (https://forum.kitz.co.uk/index.php/topic,26716.msg447930.html#msg447930).)

<Nods> in broad agreement.

I was actually looking at that earlier picture (https://forum.kitz.co.uk/index.php/topic,26716.msg447930.html#msg447930) when I sketched out that psuedo C-code snippet.

Until such time as you have the raw data, which produces such a plot (from a blighted line), it is difficult to suggest suitable code. Perhaps put together a few examples and wait for the "hollow curve phenomenon" to occur; then test the code.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 22, 2022, 08:39:49 PM
So you haven’t seen a bitloading=2 data point deep dip in your ADSL days?

I don't recall . . . goes to look for anything, stored away, that might help.

<Some minutes later> See the attached image, which shows the bit loading plots for the earliest ADSL2 and the most recent VDSL2 variants of my circuit. (I don't have the data from which the ADSL2 plot was created.)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 22, 2022, 09:20:11 PM
So there’s clearly a bitloading==2 in the right place in the ADSL2 plot. I know nothing at all about VDSL2 and the resolution isn’t high enough to allow one to pick out such a thing.

A point about my usage: As you know, I’m not trying to detect the location of a pilot tone, just avoid one if I happen to hit it by misfortune.



Quote
Until such time as you have the raw data, which produces such a plot (from a blighted line), it is difficult to suggest suitable code. Perhaps put together a few examples and wait for the "hollow curve phenomenon" to occur; then test the code.

Yes, I don’t know whether or not I have saved data sets from times of illness, I’ll dig around a little more. Maybe if I wait a month or two there will be another outbreak. But
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 24, 2022, 12:21:34 AM
I just tweaked the algorithm "I" a little. Instead of using y[40]-1, I’m doing the same cautionary test as for y60 in case there’s a pilot tone at x==40. That is:
        x4x = ( y[40] <= 2 ) ? 40+1 : 40;
        y4x = y[x4x];


And as described earlier:
        x6x = ( y[60] <= 2 ) ? 60+1 : 60;
        y6x = y[x6x];


Also the updated algorithm "I", now algorithm v.Ia, reads:
        hollow = y6x < y4x - 1 && y6x <= y[85];

where the -1 is to guard against the effect of quantisation noise messing up the == and < comparisons, that is in case y4x happens to be one bit higher because of quantisation wobble and y6x is not at that same one bit higher level even though they are both approx n+0.5. Also with a final <= test now including an =, altered to better accord with the shape of a hollow curve on the right, which might finish up being horizontal at the right hand end.



Questions:

Is it possible to have zero bitloading on a pilot tone? (I seem to remember something about this in G.992.1 as opposed to G.992.3/G.992.5)

Could anyone who is still on G.992.1 (ie so called ‘ADSL1’, that is the original standard - ADSL that is not ADSL2/ADSL2+) especially send me their bitloading numbers ?

In fact I would be grateful for the bitloading numbers from anyone who is on G.992.x ie G.992.1 / G.992.3=ADSL2 / G.992.5=ADSL2x also send me their bitloading numbers ? Please tell me which standard you’re working on and give me the basic stats too.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 24, 2022, 06:17:42 PM
I’m wondering about (1) switching to algorithm II, (2) employing a chained AND of both algorithms. Algorithm II is the ‘height below a straight line midpoint’ algorithm. The more the deviation below a straight line, the more the shape counts as ‘hollow curve’, by definition. Still need the same checks for pilot tones to avoid false data points. Opinions?

BTW, I couldn’t draw a graph with the web app that Burakkucat alerted me to; I realise that I have used that neat little graph drawing app before.



> Is it possible to have zero bitloading on a pilot tone? (I seem to remember something about this in G.992.1 as opposed to G.992.3/G.992.5)

@Kitz, if you are about and are feeling well enough, let me know what you think, as I’m sure that you’re the one who would know. (I know a lot about ‘not being up to it’ at the moment; For example, today I missed my Welsh evening class for the second week now because I was feeling rotten with fatigue.



@Burakkucat - Referring to your ADSL bitloading dataset (https://forum.kitz.co.uk/index.php/topic,26716.msg448059.html#msg448059) mentioned c
, I see there’s a 1-tone wide drop down to y=8 bits, somewhere in the region 40 < x < 50. That would really mess up either of my two algorithms if there a hit on x at the ‘mid’ sampling point. I’m using x==60, so by sheer good fortune I would not score a hit on the drop to y=8, but that’s not the point.

@all:
Is there any way to fix this? Need some help from collective brains.

I don’t suffer from that kind of deep dip behaviour in that region currently on any of my three lines, but I want to make the algorithm general; With Burakkucat’s ADSL dataset above (https://forum.kitz.co.uk/index.php/topic,26716.msg448059.html#msg448059), my algorithm II would return a hollow = true for Burakkucat! :o  ???

What about replacing the test for a specific pilot tone dip with a test that spots any huge sharp dip? Something like compare :
        is_bogus = (y[x6x] < y[x6x + 2] - 2) && ( y[x6x] < y[x6x - 2] - 2);

Not sure how to weld these expressions into a finished sharp bogus dip guard yet; that’s just a first guess. If a low data point is much much lower than its neighbours then it is bogus, and this includes pilot tones and makes them the same as any other scenarios with other kinds of natural dips. So any bogus points are excluded.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 26, 2022, 05:39:05 AM
I have once again altered the core algorithm, now using algorithm II, combined with general sharp dip detection (not just specific to the pilot tone) at the ‘mid’ test point. The x==40 test point has a specific test for being a pilot tone.

    y40 = ( y[40] <= 2 ) ? y[41] : y[40];
    y60_is_bogus = (y[60] < y[60 + 2] - 2) && ( y[60] < y[60 - 2] - 2);
    y6x = y60_is_bogus ? y[62] : y[60];
    ymid = y40 - 1 + (y85 - y40)*(60 - 40.0)/(85.0 - 40.0);
    hollow_curve = ( y6x < ymid );


y6x is supposed to be our ‘middle’ (approx.) test data point. If y60_is_bogus, because that y is a sharp dip, then we step aside to a different x data point and take that y value as our y6x. As discussed earlier, we are looking for a vertical distance hanging down from the straight line (ymid) to our test data point y6x.

I’m not sure what to do about conversion to integers yet. Any thoughts ?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 26, 2022, 11:45:26 AM
The code looks quite encouraging now. A bit more robust. As Burakkucat mentioned, I keep getting drawn to differentiate the whole thing n times, where n is (at least) 2, butThere’s a mixture of quantisation and other low-level noise and occasional serious spikes, including radio stations potentially, and the pilot tone, which is a killer, has already been discussed and can’t be included in a system involving differencing.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 26, 2022, 03:50:09 PM
I have once again altered the core algorithm, now using algorithm II, combined with general sharp dip detection (not just specific to the pilot tone) at the ‘mid’ test point. The x==40 test point has a specific test for being a pilot tone.

    y40 = ( y[40] <= 2 ) ? y[41] : y[40];
    y60_is_bogus = (y[60] < y[60 + 2] - 2) && ( y[60] < y[60 - 2] - 2);
    y6x = y60_is_bogus ? y[62] : y[60];
    ymid = y40 - 1 + (y85 - y40)*(60 - 40.0)/(85.0 - 40.0);
    hollow_curve = ( y6x < ymid );


That certainly looks simpler and can be easily understood.

I keep going back to your example of bad (https://i.postimg.cc/CKhL37Nz/B3-C832-E0-9-EF4-4-B85-B17-B-CA5864-B42-F92.png) and example of good (https://i.postimg.cc/dt0RFMsK/0-F72-E4-EA-966-B-4118-8-A20-24497-FD22-B46.png) . . . Recently I looked at the former and asked myself "How do I know it shows the ailment?" The answer is that we visually take in the shape of the bulk image and mentally compare it to what we have seen in the past. No precise mathematical transformations are required . . .

Suppose we consider only part of the plot, the domain where

120 > X > 32

Now consider the "stripes", first

1 >= Y >= 0

then

2 >= Y >=1

then

3 >= Y >= 2

until the stripes contain no data. Would that give a fingerprint which could be compared with that archived from "bad" and "good" examples? I'm not sure.  ???

And now my brain is starting to hurt.  :(
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 26, 2022, 07:34:15 PM
You’re quite right. But now my brain hurts. The right hand portion of the diagram is generally fallling, tilting downwards. You are slicing it horizontally. isn’t that true? I’m looking at a right-down-tilting diagonal in my equation of a straight line, so a bit like your scheme apart from my tilt.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 26, 2022, 07:50:37 PM
I really think you need some data on which to test the various algorithms. And now I am thinking how I could recreate the data set which, when plotted, produces your example of bad (https://i.postimg.cc/CKhL37Nz/B3-C832-E0-9-EF4-4-B85-B17-B-CA5864-B42-F92.png).
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 26, 2022, 09:09:49 PM
I have found some more old examples, but they all predate the occurrence of bad. I’ll have to pray for the arrival of more badness. :o I just wish I had saved all the many recent data snapshots of bad that I have seen but not recorded.

I’ve also find a lot of old data from the DLink modem, but it was ‘being good’ though, no danger of hollow curve. The shape of the bitloading distribution is very different, much more jagged at the top, very bad for my code which wants a smooth sugar-loaf mountain (is it?) shaped distribution without to many jumps in it. My code cannot talk to a DLink, luckily, because the code requires the availability of Johnson firmware and its "Easy Stats"-HTTP protocol, as I have named it, so fortunately for me it will never be presented with the embarrassing DLink. I have the data if anyone is interested.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 26, 2022, 10:25:56 PM
asked myself "How do I know it shows the ailment?" The answer is that we visually take in the shape of the bulk image and mentally compare it to what we have seen in the past. No precise mathematical transformations are required…

I am using that philosophy and I reckon that the answer is in the core of the new Algorithm II - the droop below a straight line as defined by the straight line equation, cutting a chord across the top of a good distribution, but in the case of a ‘bad’ distribution, the ‘midpoint’ (approx) is hanging down below the straight line, a ‘sag’. And the vertical distance of that droop is measured in the code above.

When I was a small boy, I visited a farm across the valley, ‘Thorn Top’, and sat in the kitchen. While the adults were talking, I was miles away, as ever, staring at a lead pipe on the kitchen wall. The pipe had support clips every so far along it, but in one place the lead had flowed and sagged into a deep dip, miles below the horizontal straight line. I thought this thing was strange and wondrous. My first real-life meeting with the hollow curve?

Anyway, that’s my attempt at turning the feeling about the character of the shape into a precise mathematical test, only reliable though after downward spikes and quantisation noise have been removed as far as possible, something that is not at all easy and is the part I’m not confident about. I think I mentioned some while back that the usual filters to remove short-wavelength glitches could be very problematic; need to make that more precise, but I’m too tired just now.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 26, 2022, 11:05:09 PM
I am using that philosophy and I reckon that the answer is in the core of the new Algorithm II - the droop below a straight line as defined by the straight line equation, cutting a chord across the top of a good distribution, but in the case of a ‘bad’ distribution, the ‘midpoint’ (approx) is hanging down below the straight line, a ‘sag’. And the vertical distance of that droop is measured in the code above.

Yes, you have expressed it, in words, quite nicely.

Quote
When I was a small boy, I visited a farm across the valley, ‘Thorn Top’, and sat in the kitchen. While the adults were talking, I was miles away, as ever, staring at a lead pipe on the kitchen wall. The pipe had support clips every so far along it, but in one place the lead had flowed and sagged into a deep dip, miles below the horizontal straight line. I thought this thing was strange and wondrous.

I, too, have memories, from sixty plus years ago, of a horizontal lead pipe with sags between each support.  :)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 26, 2022, 11:10:57 PM
God only knows what all that lead did to them. Doesn’t lead form an insulating barrier compound ?an oxide? which prevents further dissolving into the water? I’m trying to remember Mrs Johnson’s chemistry lessons from 1976. ??? Luckily we had none in our farmhouse.

Referring to the line
    y6x = y60_is_bogus ? y[62] : y[60];
taking the "? :" expression apart and turning it into an if-statement, we are not fully examining the conditions surrounding our new sideways-x-shifted choice of x=62; is there any problem with that? laxity?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 26, 2022, 11:44:08 PM
God only knows what all that lead did to them. Doesn’t lead form an insulating barrier compound ?an oxide? which prevents further dissolving into the water?

Old lead pipes in a hard water area are quite safe, as the dissolved minerals will have created a passive barrier by precipitation. Soft water or slightly acidic water will rapidly dissolve lead and that was the problem.

Quote
Referring to the line
    y6x = y60_is_bogus ? y[62] : y[60];
taking the "? :" expression apart and turning it into an if-statement, we are not fully examining the conditions surrounding our new sideways-x-shifted choice of x=62; is there any problem with that? laxity?

I see

if (y60_is_bogus)
        y6x = y[62];
else
        y6x = y[60];

where y60_is_bogus is a boolean.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 27, 2022, 12:07:42 AM
Agreed about the if-statement. I was wondering if there are potential problems due to not applying the full double-sided test to the y[62] - that is testing y[60] - which is already done - and y[64] which isn’t. I am a bit lost there. I note that this is just a one-off rightward x-shift x+=2 and an if-statement; this could evolve into a loop, instead of a one-off; examining data points and shifting right until we find a good point.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 27, 2022, 05:45:50 PM
I see what you mean. Would it really be necessary? Hmm . . .  :-\

How about just enhancing the pseudo code to see how complex it becomes?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 27, 2022, 09:05:41 PM
Agreed, I don’t think it would be necessary, I don’t propose to fix the above code where it isn’t broken.

I wish I could find a picture and dataset of the earliest stages of the disease. There the first stage is a very subtle dent whose rhs is _horizontal_, so the two sides of the hollow are not symmetrical in the earliest stages. This is the reason for the ‘diagonal line’ (potentially) y=mx+c technology employed, because I feel it crucial to detect the earliest warning stages of the disease so as to warn the user soon. In truth though, the app will probably sound an alarm early because a check on the minimum downstream sync rate will fail as the highest bitloadings decrease in the formation of the hollow. I have now set the app’s minimum d/s sync rates to be a tight constraint.

So draw a chord, slightly sloping downward to the right, small in length, just chopping off the peak and reflect the curve in the line so that it is below the line instead of above it. That’s another way of picturing stage one of the disease. In this stage one or two bit high noise will really mess up detection. Our brains have neural network technology literally which can recognise this departure from the expected rounded hump shape.



I could generate some fake data using a spreadsheet. I need to write a quadratic or cubic polynomial to take care of drawing the ‘bite out of’ the good curve, below the ‘chord’ that is tilted in the decreasing y with increasing x direction.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 28, 2022, 11:02:56 PM
Here’s a presumably ‘good’ picture, no hollow curve. Modem 4.

(https://i.postimg.cc/mD2kB8QT/DD42568-E-A0-C2-4-CA5-9-E3-B-2-C1809050-CF3.png)

If I draw a diagonal straight line from (x=40, y=12) -> (x=85, y=10), and then I inspect the (x=60, y), you see that I’m in danger of hitting that small dip down to y=10 at (x=~58?, y=10) approx. with the diagonal.

Both fortunately and unfortunately, depending on how you look at it, I don’t have any hollow curve data. If I do see an iffy picture, I can immediately save the bitloading numbers by fetching the file : http://modem:8000/data/Bits.

Code: [Select]
xdslctl: ADSL driver and PHY status
Status: Showtime
Last Retrain Reason: 8000
Last initialization procedure status: 0
Max: Upstream rate = 321 Kbps, Downstream rate = 3304 Kbps
Bearer: 0, Upstream rate = 396 Kbps, Downstream rate = 3154 Kbps

Tone number      Bit Allocation
   0 0
   1 0
   2 0
   3 0
   4 0
   5 0
   6 0
   7 8
   8 9
   9 9
   10 10
   11 9
   12 9
   13 9
   14 8
   15 7
   16 7
   17 7
   18 6
   19 6
   20 5
   21 5
   22 5
   23 4
   24 4
   25 4
   26 4
   27 4
   28 3
   29 3
   30 3
   31 3
   32 0
   33 8
   34 9
   35 10
   36 11
   37 11
   38 11
   39 12
   40 12
   41 12
   42 12
   43 12
   44 12
   45 12
   46 7
   47 12
   48 2
   49 12
   50 12
   51 11
   52 11
   53 11
   54 11
   55 11
   56 11
   57 11
   58 10
   59 10
   60 11
   61 11
   62 12
   63 12
   64 12
   65 12
   66 12
   67 11
   68 12
   69 11
   70 11
   71 11
   72 11
   73 11
   74 11
   75 11
   76 11
   77 11
   78 11
   79 10
   80 10
   81 10
   82 10
   83 10
   84 10
   85 10
   86 10
   87 9
   88 9
   89 9
   90 9
   91 9
   92 9
   93 9
   94 9
   95 9
   96 8
   97 8
   98 8
   99 8
   100 8
   101 8
   102 8
   103 7
   104 7
   105 7
   106 7
   107 7
   108 7
   109 7
   110 7
   111 7
   112 6
   113 6
   114 6
   115 6
   116 6
   117 6
   118 6
   119 5
   120 4
   121 3
   122 2
   123 4
   124 4
   125 3
   126 4
   127 3
   128 4
   129 3
   130 3
   131 4
   132 4
   133 3
   134 3
   135 3
   136 2
   137 3
   138 3
   139 3
   140 3
   141 3
   142 2
   143 3
   144 3
   145 3
   146 2
   147 2
   148 0
   149 1
   150 0
   151 1
   152 0
   153 1
   154 1
   155 0
   156 0
   157 0
   158 0
   159 0
   160 0
   161 0
   162 0
   163 0
   164 0
   165 0
   166 0
   167 0
   168 0
   169 0
   170 0
   171 0
   172 0
   173 0
   174 0
   175 0
   176 0
   177 0
   178 0
   179 0
   180 0
   181 0
   182 0
   183 0
   184 0
   185 0
   186 0
   187 0
   188 0
   189 0
   190 0

From x-46 to x=58 the y-quantisation says to me that y is firmly down at 11, or even less than half a bit lower, say 10.8 in places because there is presumably one point where y dips under y<=10.49. Does this departure from y=12 down to y=11 or even slightly less count as the merest hint of incipient hollow curve? :o We can’t draw any conclusions based on ‘curves’ of depth y+/- 0.5 as we’re right in the noise. And what are we to make of the solid y=12 region 62 <= x <= 66 ?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 28, 2022, 11:50:48 PM
It's difficult to say when looking at that "step-wise" (rather low resolution) plot.  :-\

I'm still fiddling with things to try and generate a bit-loading v sub-carrier index "hollow curve" plot for you to use.  ::)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 28, 2022, 11:54:45 PM
I’ve now included the dataset, not just a pretty picture. Posts possibly crossing ;)

For some reason line 1 is a bit slower than line 4. Line 4 is bonkers, don’t know why.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 31, 2022, 04:04:24 AM
Referring to https://kitz.co.uk/adsl/adsl_technology.htm#tones_not_used : I don’t understand the part about which pilot tones are in use:
Quote
Upstream Pilot Tone for ADSL (Tone 16 - 69kHz)
Downstream Pilot Tone for ADSL (Tone 64 - 276kHz).
Adaptive Pilot Carriers. VDSL & some adsl2+ systems select best channel conditions to determine use for pilot tones (eg 105,110 etc).  Pilot carriers may change if either the DSLAM or the modem detects noise within the frequency range.  The amount of pilot carriers used depends upon the line characteristics.

Questions:
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Alex Atkin UK on January 31, 2022, 09:11:34 AM
If you need an old ADSL2 telnet stat log for anything, I still have some from when I temporarily moved back to ADSL after Digital Region closed.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on January 31, 2022, 10:10:26 AM
Alex, if you have the bitloading data then that would be fantastic!
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on January 31, 2022, 04:20:14 PM
Questions:
  • I can’t see an upstream pilot tone; am I misunderstanding?
  • My downstream pilot tone seems to vary in frequency. The article mentions VDSL and ADSL2+, but I’m ADSL2 G.992.3 not G.992.5, so should G.992.3 be including in the part about adaptive pilot carriers ?
  • Is this part:
    Quote
    Upstream Pilot Tone for ADSL (Tone 16 - 69kHz)
    Downstream Pilot Tone for ADSL (Tone 64 - 276kHz).
    applicable only to ADSL1 ie G.992.1 ? That is, not to all ADSL?

Answers:
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 01, 2022, 06:32:33 PM
Sorry, I didn’t explain. For question 3, I was asking about the tone numbers.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 01, 2022, 11:00:57 PM
Sorry, I didn’t explain. For question 3, I was asking about the tone numbers.

Ah, my apologies. I am unaware of any definitive source where one could find such information. So until proved otherwise, I would be inclined to regard those as ADSL (ITU-T G.992.1) only.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 10, 2022, 02:12:51 PM
Good and bad news. Since my wife is resting and recovering, we haven’t got anywhere with swapping out the four modems that are accused of developing potential hollow curve disease at times. The idea is to swap them all out for other modems from my store having flashed the replacements with kitizen Johnson’s good code.

And now after several months of good behaviour one line, line #4, suddenly developed serious hollow curve disease, and not progressive either, it came out of nowhere in a sudden bound; suddenly a serious deformation was seen with a drop to around half the previous downstream sync rate. There was a risk of lightning last night so in the small hours I asked Janet to unplug the modems from the wallsockets to be on the safe side. When they were plugged back in later, large hollow curve disease was seen in modem #4.

Modems’ sync rates:
  #1: downstream 2.964 Mbps, upstream 666 kbps
  #2: downstream 3.081 Mbps, upstream 531 kbps
  #4: downstream 3.253 Mbps, upstream 402 kbps

--------
* Estimated combined IP PDU rate totals (*):   
     downstream:  7.812 Mbps ( at an assumed 95% MLF ),
          upstream:  1.343 Mbps ( at an assumed 95% MLF ),

(*) calculated from:
   IP PDU rate upstream      = sync rate upstream      × protocol efficiency × MLF upstream,
   IP PDU rate downstream = sync rate downstream × protocol efficiency × MLF downstream
   where :
   *   if MLF, the so-called 'modem loading factor' = 100% = no rate-limiting, driving at maximum rate,
   *   MLF downstream = 95% (assumed);
   *   MLF upstream      = 95% (assumed);
   *   'protocol efficiency' is concerned with a protocol's bytestream bloat, and here
   *   protocol efficiency = 0.884434 ⇐ (
      ADSL and ATM,
      assumed PDU size = 1500 bytes,
      DSL header overhead = 32 bytes
      )
--------
   
                                              ◅ ◅ ◅◊▻ ▻ ▻

Turning the modem off and on, as proved successful before, simply didn’t work this time, unfortunately. See bitloading and SNR vs tones pictures for cwcc@a.4 below:

(https://i.postimg.cc/Hn9L2vC4/D1-EC52-A6-FE47-4-B0-A-AED5-9-F35-FFC21616.jpg)

(https://i.postimg.cc/1Xm8L1BY/2-BB4-D2-CB-101-C-42-B7-AB40-E738-D30-A119-F.jpg)

I was very pleased that my code did successfully detect and report the hollow curve disease, it’s first ever test! I’m thinking about moving the rhs x point to x=90 although I’m unsure. This data set shows a certain state of affairs, but that is HCD that is both fully developed and so very easy to detect, not a challenge. What we need most of all is early warning of the start of the disease and I think the coordinates in such a scenario might be slightly different, so I’m thinking we ignore this evidence as long as detect does work and we compromise in favour if some scenario where HCD is in the early stages of development. We need data for the early development scenario.

It seems that just power-cycling a modem is not enough to fix HCD. A modem needs to be left turned off for some significant length of time. We have no idea what this is. I’m wondering if it’s the time for certain capacitors to drain and the modem to truly die, entering state 0 with certainty.

Here’s the report my code generated:

Summary of DSL links’ wellbeing and error counts
     ────────────────────────


* There are 3 modems in total. They are:     #1, #2 and #4
* The active, contactable modems are:        #1, #2 and #4
* The modems successfully queried are:       #1, #2 and #4

Summary of DSL links’ wellbeing and error counts
     ────────────────────────


* There are 3 modems in total. They are:     #1, #2 and #4
* The active, contactable modems are:        #1, #2 and #4
* The modems successfully queried are:       #1, #2 and #4


       ───────────────────────
       ***                                                                           ***
       ***     There is some SERIOUS BADNESS !          ***
       ***                      All is not well !   😦                       ***
       ***                                                                           ***
       ───────────────────────


--
* Sync rate: The following link has a really low downstream sync rate, below min:
   Link #4 downstream:    current sync rate  1390 kbps is below minimum expected (3100 kbps)  ❗Line #4 fault  🔺

--
* SNRM: The SNRM of the following link is out of range:
   Link #4 downstream: current SNRM: 7.7 dB is too high;  above the expected maximum SNRM ( 3.8 dB )

   ❗Link #4 defect detected: so-called ‘hollow curve phenomenon’ in the downstream bit-loading 🔺
--
* ES (less serious): The following links have a few CRC errors, at lower error rates, where the ES rate < 60 ES / hr (†):
   Link #4 downstream:        latest period: ES per hr:   6.07, mean time between errors: 593 s, collection duration: 593 s
   Link #4 downstream: 'previous' period: ES per hr: 36.00, mean time between errors:  100 s, collection duration: 900 s


──────────────────────────────
(†) The duration of the ’latest‘ errored seconds (ES) collection
bucket is variable, with a _maximum_ of 15 mins. The buckets’
start times are always 15 mins apart. A ‘previous’ bucket's
duration is a fixed 15 mins. An ES is a 1 s time period in which one
or more CRC errors are detected. A CRC error is a Reed-Solomon
coding-uncorrectable error, ie. corrupted data is received that
cannot be recovered.
──────────────────────────────      
                                              ◅ ◅ ◅◊▻ ▻ ▻
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 10, 2022, 03:55:19 PM
Both encouraging and puzzling.  ???

When the modems were disconnected from the incoming lines, were they disconnected whilst still powered on? Or were they disconnected after being powered off?

When the modems were reconnected to the incoming lines, what was their power status? On or off?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 10, 2022, 07:22:37 PM
I’ll check with Janet but I’m pretty sure that the modems were on at all times until the power cycling experiment.

By the way, notice the amazing downstream sync rate of line 4. That is indeed an all time record for Torr Gorm ("mound green" = this site).
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 10, 2022, 07:46:54 PM
I’ll check with Janet but I’m pretty sure that the modems were on at all times until the power cycling experiment.

Hmm . . . I thought your iPad tools would be able to tell you if a modem is powered on or off.

My suggestion would be --

Disconnecting: Unplug the modems from the incoming lines, then power them off.
Connecting:    Power on the modems, then plug them into the incoming lines.

Quote
By the way, notice the amazing downstream sync rate of line 4.

I presume you are referring to --

Quote
Modems’ sync rates:
  #1: downstream 2.964 Mbps, upstream 666 kbps
  #2: downstream 3.081 Mbps, upstream 531 kbps
  #4: downstream 3.253 Mbps, upstream 402 kbps

Quote
That is indeed an all time record for Torr Gorm ("mound green" = this site).

I thought it was a shortened form of "Torr Gormless", as in your nod to A&A. ;)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 10, 2022, 10:30:05 PM
It’s the name of the house. I’m absolutely sure that A&A have a server called gormless they have just about everythingless. For example bottomless.aa.net.uk is the first router upstream that you reach when you’re tracerouting up into AA; it’s the good point to ping to to check if your line is really working.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 10, 2022, 11:32:17 PM
It’s the name of the house. I’m absolutely sure that A&A have a server called gormless . . .

Yes, indeed -- twice.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 11, 2022, 03:22:26 AM
I’ve tweaked the algorithm on the basis of something I noticed in the new data. The (rhs_x, rhs_y) y85 point is also in danger of being a pilot tone. It looks like it on the above picture; it either is on the pilot tone or it’s very close, so with the same test-and-shift-sideways applied now to point (85, y85), we have
    y85 = ( y[85] <= 2 ) ? y[87] : y[85];
I’ve talked about this before maybe, but should it be a shift sideways of +2 or just +1 for true pilot tone detection? Is the real pilot tone exactly 1 wide only and no more ? The test on the x==60 downwards spike is more general, meant to handle any bogus noise spike, which could be of lesser height and doesn’t have to be a pilot tone at all, although it could be. I should also do
    /* x_rhs = x85 = ( y[85] <= 2 ) ? 87 : 85; */

but I’m too lazy as it won’t make much difference to the diagonal line equation. See also the previous almost identical tweak (https://forum.kitz.co.uk/index.php/topic,26716.msg448108.html#msg448108) for the lhs point. It does seem that the pilot tone can be anywhere and I made far too many assumptions before and got this wrong not once but twice! Twice now I’ve had this blind spot about the possibility of embarrassing placement of the pilot tone. I just looked at the picture I had and assumed that everything was always exactly like that. Can the pilot tone be anywhere?

The way the code is now, it uses the simple pilot tone test-and-shift-sideways method of the above paragraph just here in this post. The test on the midpoint is more involved, more general and checks for general downspikes, stalactites small and large, and modest noise, not just the pilot tone because it is interested in spikes that muck up the reasonably (piecewise?) smooth curve that the algorithm is trying to detect. That’s the reason for the width of the sidestep and x-test-side-offset away from the downspike/stalactite/possible pilot tone test x’s of 2 (at least), not 1, as 1 is deemed to be of insufficient spike width for a real stalactite. So here’s the code surrounding

ALGORITHM II.2

    int y40 = ( y[40] <= 2 ) ? y[40+1] : y[40];
    bool y60_is_bogus = (y[60] < y[60 + 2] - 2) && ( y[60] < y[60 - 2] - 2);
    int y6x = y60_is_bogus ? y[60+2] : y[60];
    int y85 = ( y[85] <= 2 ) ? y[85+2] : y[85];
    double ymid = y40 - 1 + (y85 - y40)*((60 - 40.0)/(85.0 - 40.0));
    bool hollow_curve = y6x < ymid;


I could do with some advice about what to do with rounding and float-to-int conversion in the above expression. Should I do a certain type of explicit rounding and fp to int conversion? The floating point expression in ( ) comes to 20.0/25.0 (having neglected to do sideways x-coord shifts) so there we have a floating point multiplication by 0.8. In iOS Shortcuts, the whole lot is going to be in fp, of type ‘Number’, so bizarrely the coordinates are in fp too, which in this case is not such a bad thing because everything including the final crucial comparison before the bool assignment ends up in fp. So iOS Shortcuts gets us out of the problem, but is that what I should be doing?

I haven’t tried compiling it for a sanity check but I suspect there is a danger that the above may be a valid D or C program. In D, the last double perhaps should well be a real (ie 80-bit fp on x86/x86-64).
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 11, 2022, 03:09:41 PM
Is the real pilot tone exactly 1 wide only and no more ?
. . .
It does seem that the pilot tone can be anywhere and I made far too many assumptions before and got this wrong not once but twice! Twice now I’ve had this blind spot about the possibility of embarrassing placement of the pilot tone. I just looked at the picture I had and assumed that everything was always exactly like that. Can the pilot tone be anywhere?

Pilot tones are a problem. I am unaware of any definitive statements with regards to their size and placing within the bandwidth of an xDSL circuit.

Quote
I could do with some advice about what to do with rounding and float-to-int conversion in the above expression. Should I do a certain type of explicit rounding and fp to int conversion?

My methodology is: Once a floating point number is brought into a calculation, all other variables are promoted to floating point and it is only at the final, end, result that the float is then cast back to an int / long / unsigned int / unsigned long, with the option to ultimately convert to a boolean.

Quote
So iOS Shortcuts gets us out of the problem, but is that what I should be doing?

It appears to be sensible, to me.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 13, 2022, 05:12:34 AM
Line 2 seems to be starting to develop HCD. The downstream SNRM slid down from 3dB to 0.9dB over twelve hours and this low SNRM triggered an alarm in a wellness check performed by my iOS app. I reset the modem’s dsl link with the appropriate magical incantation and when it came back up, the downstream sync rate was a bit low (235 kbps down below a 2.9 Mbps d/s sync limit) and that triggered a different alarm based on an out-of-range low sync rate (when back at d/s SNRM 3.0). Here’s the report:

       Summary of DSL links’ wellbeing and error counts
     ────────────────────────


* There are 3 modems in total. They are:     #1, #2 and #4
* The active, contactable modems are:        #1, #2 and #4
* The modems successfully queried are:       #1, #2 and #4


       ───────────────────────
       ***                                                                           ***
       ***     There is some SERIOUS BADNESS !          ***
       ***                      All is not well !                          ***
       ***                                                                           ***
       ───────────────────────


--
* Sync rate: The following link has a really low downstream sync rate, below min:
   Link #2 downstream:    current sync rate 2765 kbps is below minimum expected (2900 kbps)  ❗Line #2 fault 

--
*❗ES (more serious): Links with CRC errors at higher error rates, where the ES rate ≥ 60 ES / hr (†):
   Link #2 downstream: 'previous' period: ES per hr: 268.00, mean time between errors:  13.43 s, collection duration: 900 s

--
* ES (less serious): The following link has a few CRC errors, at a lower error rate, where the ES rate < 60 ES / hr (†):
   Link #2 downstream: latest period: ES per hr: 48.00, mean time between errors: 75 s, collection duration: 675 s


──────────────────────────────
(†) The duration of the ’latest‘ errored seconds (ES) collection
bucket is variable, with a _maximum_ of 15 mins. The buckets’
start times are always 15 mins apart. A ‘previous’ bucket's
duration is a fixed 15 mins. An ES is a 1 s time period in which one
or more CRC errors are detected. A CRC error is a Reed-Solomon
coding-uncorrectable error, ie. corrupted data is received that
cannot be recovered.
──────────────────────────────     
                                              ◅ ◅ ◅◊▻ ▻ ▻

All this is a little suspicious, but the SNRM vs tones graph just looks a bit iffy, the smooth curve that is, not the bitloading data; in the latter one can’t see it.

(https://i.postimg.cc/25KxKttP/DBBE0473-B086-4063-9678-0282-D1-B11592.png)
(https://i.postimg.cc/KYRPBNYQ/BC427-B82-64-C4-48-A8-9-FD4-17-C7-E6-CD79-A3.png)

There’s no chance that my code could pick this up and diagnose it as HCD as the data just isn’t there in the raw bitloading; it needs the processing of the smoothed graph then the subsequent scrutiny by the advanced organic neural network that is within the kitizen’s skull to spot the slightly iffy shape. The y40 - 1 reduction that is used in case of quantisation noise really stuffs any chance of detecting very, very early HCD and you would have to have a different algorithm for this case perhaps, perhaps something to check where the max x coord is before y decreases permanently below the y40=y_lhs level but I have bad feelings about this latest algorithmic suggestion: I think it’s untried and uncertain, and there’s no criterion as to when to apply it rather than the current algorithm II.2 (code given earlier).

I’ll bet you this will develop, which will provide lovely data.

Notice that at x=70, dy/dx = 0 but y is not a local extremum at that point. (Apologies for using derivatives; the smooth curve shown is not the actual underlying dataset; that is in fact the bit-loading vs tones and is discrete, quantised in both dimensions.) This is the marker of the end of the very earliest stage of HCD, the first stage where one can make anything out albeit not with ideal reliability. Just before an RHS local maximum develops we have a dy/dx=0 on the left hand side of the point of inflection, and the y is falling on the right. This is a good bit to the left of my chosen x_rhs value used in algorithm II.2 because there the parameters are based on full-blown HCD. This means that I have maybe done the wrong thing; I should perhaps have chosen a x_rhs value suitable for the early development situation in HCD because the goal is early detection not detection when the disease is advanced. I could do with some advice here. I am very uncertain about using x_rhs == 70 instead of the current 85. A choice of x_rhs==70 is too close to the midpoint (the middle test point) and I don’t wish to shift that midpoint left to match. one dubious suggestion would be to run algorithm II.2 twice, with each of the differing (x_rhs, y_rhs) point values but I’m very uncertain about this and the Shortcuts code would be very ugly.

All the the other warnings are very important: imo they show the underlying mechanism at work that drives HCD, the drop in bitloading in response to the increased noise; bad reliability even with slightly reduced speed. Really the d/s target SNRM possibly needs to go up to 6dB to get reliability back. I say ‘possibly’ because I’m not sure whether the corruption is actually important given PhyR’s powers. My iOS Shortcuts app has no memory, so it cannot detect ‘deteriorations’ in performance or reliability. In any case badness in reliability or sync rate can never be simply presumed to be associated with HCD. Mind you, the range limits set in the config for sync rate and SNRM represent a kind of long-term memory, because I set them according to tight bands on ‘what is normal performance variation’. Most lines don’t vary much, but for a counter example we have line 2 upstream, which in history has usually jumped up and down one or more times in each day in a semi-regular fashion.



A thought suddenly struck me - why not actually use the SNR vs tones graph rather than the bitloading ? Vastly higher res of course and that might help with the early detection problem. So I made the change, which took all of 30 secs, but it didn’t make a change to the current case - didn’t give a ‘yes’, which was as expected here. This is not a permanent change, just a ‘fork’. `to do it properly requires changes to some of the other parameters that are used in algorithm II.2. Probably the y-1 can go as we don’t need ti worry about bitloading quantisation noise any more, but we do need to worry about some kind of noise represented in y-wobbles in the smooth SNR graph, also the y - 2 constant 2 is now wrong, and needs to be the equivalent for SNRM; I have no idea what that is. Need help with this. When these problems are solved, going to the SNRM-curve-based thing instead of bitloading-based might possibly be the right long-term move. Need advice.

I suspect though that I’m very biased because my line is exceptionally clean and the long-range RF environment is maybe reasonably good. Deep and hopefully narrow (but who knows) noise spikes are a rarity in my dataset but that is not something that could be relied on in general. A load of irregularities would, I believe, spell death for the proposed alternative SNRM-curve-based strategy, but then in such a problem scenario, I’m not sure why things would not also be bad for the current algorithm based on the bit-loading dataset too.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 14, 2022, 09:24:31 AM


The line 2 HCD has developed into a full blown thing as predicted. In the night there was a resynch event and after that the downstream sync rate was down to ~1.7 Mbps and the hollow curve was deep, so I missed most of the early development.

(https://i.postimg.cc/zfFhxV8x/5-BB55596-2-A75-43-C5-89-B6-C2-FBE6-D0-BD07.png)

From this picture I have two thoughts. The (lhs_x=40, lhs_y=y40-1) y40 has dropped so much that the ymid is quite low, especially when you consider that I’m actually working on a lhs_y of y40-1 but luckily the hcd detection still works. The lhs_y could be set to be equal to the rhs_y in this case! That would give a nice high ymid with a deep drop to the curve at y[xmid]. But if it works then all good enough I suppose. The diagonal line thing is really meant to detect the early phase.

Secondly, looking at (x_rhs, y_rhs) it seems x_rhs could be best moved up from x_rhs=85 to 90.

       Summary of DSL links’ wellbeing and error counts
     ────────────────────────


* There are 3 modems in total. They are:     #1, #2 and #4
* The active, contactable modems are:        #1, #2 and #4
* The modems successfully queried are:       #1, #2 and #4


       ───────────────────────
       ***                                                                           ***
       ***     There is some SERIOUS BADNESS !          ***
       ***                      All is not well !   😦                       ***
       ***                                                                           ***
       ───────────────────────


--
* Sync rate: The following link has a really low downstream sync rate, below min:
   Link #2 downstream:    current sync rate  1749 kbps is below minimum expected (2900 kbps)  ❗Line #2 fault  🔺

   ❗Link #2 defect detected: so-called ‘hollow curve phenomenon’ in the downstream bit-loading 🔺
--
*❗ES (more serious): Links with CRC errors at higher error rates, where the ES rate ≥ 60 ES / hr (†):
   Link #1  upstream:             latest period: ES per hr: 68.57, mean time between errors: 52.5 s, collection duration: 210 s
   Link #2 downstream:        latest period: ES per hr: 205.71, mean time between errors:  17.5 s, collection duration: 245 s
   Link #2 downstream: 'previous' period: ES per hr: 244.00, mean time between errors:  14.75 s, collection duration: 900 s


──────────────────────────────
(†) The duration of the ’latest‘ errored seconds (ES) collection
bucket is variable, with a _maximum_ of 15 mins. The buckets’
start times are always 15 mins apart. A ‘previous’ bucket's
duration is a fixed 15 mins. An ES is a 1 s time period in which one
or more CRC errors are detected. A CRC error is a Reed-Solomon
coding-uncorrectable error, ie. corrupted data is received that
cannot be recovered.
──────────────────────────────      
                                              ◅ ◅ ◅◊▻ ▻ ▻
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 14, 2022, 04:28:14 PM
I have been giving this some more thought.

I wonder if you could arrange for your utility to look at data for both the bit loading and the SNR plots? As you have shown, the SNR plot will show the early stages of the development of the phenomenon and the bit loading plot will "ring the big alarm bell".  :-\
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 14, 2022, 10:32:40 PM
It would be easy to do both, but due to the difficulty of writing subroutines that share variables with each other - awkward but not impossible as all the variables you need could be written into a struct and then that could be passed in  as a parameter - I would probably just be better off duplicating all the code twice. Could put it in a two-times-called loop but that would be very awkward too in this case.

Makes me think, if I process the SNR data, do I even need the bitloading "bits" data at all? What do we think?

The pilot tone isn’t a consideration in the SNR graph, so it actually simplifies the code if I just change over to use the smooth curve SNR dataset! If I go that way, it would massively simplify the algorithm at https://forum.kitz.co.uk/index.php/topic,26716.msg449098.html#msg449098 down to just a couple of lines of code approx as the if-else tests for pilot tones would be gone completely. Makes me think I made a huge error in using the wrong dataset to begin with, no?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 14, 2022, 10:58:30 PM
Makes me think, if I process the SNR data, do I even need the bitloading "bits" data at all? What do we think?

A good question. Hmm . . .  :hmm:

Quote
The pilot tone isn’t a consideration in the SNR graph, so it actually simplifies the code if I just change over to use the smooth curve SNR dataset! If I go that way, it would massively simplify the algorithm at https://forum.kitz.co.uk/index.php/topic,26716.msg449098.html#msg449098 down to just one line of code approx as all the if-else tests before the final boolean assignment would be gone completely.

It would be helpful to see some psuedo-code, please.

Quote
Makes me think I made a huge error in using the wrong dataset to begin with, no?

But only with my encouragement.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 14, 2022, 11:29:52 PM
What’s your feeling about the SNR-only option?

I did a trial implementation of this which I will call algorithm III (forthcoming v shortly), and my first question is about the minimum noise stalactite height which is a "- 2" in "<y> - 2", would need to decide what the SNR curve equivalent height is. The result with a bad guess at the answer to this question worked really well on the current ‘fully-developed HCD’ dataset.

I will post up the pseudo code asap.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 14, 2022, 11:54:11 PM
What’s your feeling about the SNR-only option?

I'm dithering (and thinking about finding my bed).

Quote
I did a trial implementation of this which I will call algorithm III (forthcoming v shortly), and my first question is about the minimum noise stalactite height which is a "- 2" in "<y> - 2", would need to decide what the SNR curve equivalent height is. The result with a bad guess at the answer to this question worked really well on the current ‘fully-developed HCD’ dataset.

This may be a silly suggestion but could you perform a first pass, looking to find the absolute minimum. Then, in a second pass, add or subtract the value found in first pass such that you will always work with a data set that has zero as its absolute minimum, thus all y-data points are then positive.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 15, 2022, 01:15:50 AM
Updated pseudo-code; current running version (old bits version archived)

ALGORITHM III.0.1 - applies now to the y[]=SNR[] table

    alias y = SNR;
    uint half_width = 3;
    double min_spike_height = 2.0;
    bool y60_is_bogus = (y[60] < y[60 + half_width] - min_spike_height )
                    && ( y[60] < y[60 - half_width] - min_spike_height );
    double y6x = y60_is_bogus ? y[60 + half_width] : y[60];
    double ymid = y[40] + (y[85] - y[40])*((60 - 40.0)/(85.0 - 40.0));
    bool hollow_curve = y6x < ymid;

Works well also even after the fault was cured by power-cycling modem 2, ie in the no-fault case gives the right answer of ‘all good’.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 15, 2022, 04:13:39 PM
Has a spurious "4" found its way into the penultimate line?

double ymid = y4[40] + . . .

Other than that, it appears to make sense (without applying it to test data).
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 15, 2022, 10:49:47 PM
typo, well spotted!

I’m not at all sure about the correct value of the min spike height parameter. This detects large spikes which cause the relevant test point to be shifted in the x dimension if it lands on a stalactite of a certain height or greater. Need to ignore these as they could be seen as bogus indicators of hollow curve disease.

I’m thinking that I’ve made a big mistake in simplifying this algorithm III as I have. I dumped the tests for pilot tones but now I suspect that I need a similar kind of test on the x==40 and x==85 points but to detect bogus stalactites not the pilot tone. Am I right in thinking this way ?

I’ve seen some stalactites on new healthy SNR curves that are dangerously close to the lhs and rhs x-coordinates, so if we go this way I’d have to apply the same kind of test as for x==60 currently. However I can’t do the double-sided test at x==40 as it’s way too close to the ramp up from nothing at the junction between upstream and downstream tones, so a single sided version with the y[40] < y[43] - 2.0 test would be the only test. And for x==x_rhs==85, I’m hoping that a double-sided test is overkill as that amount of code would be a bit of a pain in Shortcuts just from the point of view of finger-wear. What about the single-sided compromise there?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 15, 2022, 11:36:18 PM
Looking at the real-world data for my own circuit, there is a rapid up-ramp from x == 33 to about x == 65 and a stalactite at about x == 47.

I'm not sure that you can absolutely depend upon the presence of a stalactite, for when looking at your example --

(https://forum.kitz.co.uk/index.php?action=dlattach;topic=24614.0;attach=28426;image)

-- it really is quite clean.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 16, 2022, 12:51:40 AM
ALGORITHM III.1 - here’s the new currently running algorithm, with full bogus stalactite detection x 3; cheap stalactite detector by necessity at x==40 and cheap out of plain laziness at x==85. I should make some of the x values into variables rather than fixed numbers in the division below, but I don’t think the extra code is essential because the gradient error in the straight line expression is not going to be enormous.

    alias y = SNR;
    const uint half_width = 3;
    const double min_stalactite_height = 2.0;
    const bool y40_is_bogus = y[40] < y[40 + half_width] - min_stalactite_height;
    const double y4x = y40_is_bogus ? y[40 + half_width] : y[40];

    const bool y60_is_bogus = (y[60] < y[60 + half_width] - min_stalactite_height )
                    && ( y[60] < y[60 - half_width] - min_stalactite_height );
    const double y6x = y60_is_bogus ? y[60 + half_width] : y[60];

    const bool y85_is_bogus = y[85] < y[85 + half_width] - min_stalactite_height;
    const double y8x = y85_is_bogus ? y[85 + half_width] : y[85];

    const double ymid = y4x + (y8x - y4x)*((60 - 40.0)/(85.0 - 40.0));
    const bool hollow_curve = y6x < ymid;
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 16, 2022, 01:13:03 AM
> I'm not sure that you can absolutely depend upon the presence of a stalactite, for when looking at your example --

I presume that you meant ‘absence’ rather than presence? Otherwise I’m being stupid and have misunderstood completely ;)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 16, 2022, 03:12:57 AM
The modified algorithm is (III.2) - currently running:
    alias y = SNR;
    const uint half_width = 3;
    const double min_stalactite_height = 2.0;
    const bool y40_is_bogus = y[40] < y[40 + half_width] - min_stalactite_height;
    const uint x4x = y40_is_bogus ? 40 + half_width : 40;
    const double y4x = y[x4x];

    const bool y60_is_bogus = (y[60] < y[60 + half_width] - min_stalactite_height )
                    && ( y[60] < y[60 - half_width] - min_stalactite_height );
    const uint x6x = y60_is_bogus ? 60 + half_width :  60;
    const double y6x = y[x6x];

    const bool y85_is_bogus = y[85] < y[85 + half_width] - min_stalactite_height;
    const uint x8x = y85_is_bogus ? 85 + half_width : 85;
    const double y8x = y[x8x];

    const double ymid = y4x + (y8x - y4x)*((x6x - x4x)/(x8x - x4x));
    const bool hollow_curve = y6x < ymid;
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 16, 2022, 09:03:45 AM
Here are some pictures of the very healthy lines 2 and 4. They feature some nasty little stalactites and I would appreciate some advice on who to deal with them. The min stalactite height parameter is set to 2.0 and this you will recall is used in the filter in algorithm III.2 which will cause the test point x-coord to shift ahead (increased x) to avoid the stalactite and move on to a known good new point, known good because it is at least 2.0 dB higher.

Line 4:

(https://i.postimg.cc/KvK2CGmg/8-D17627-F-F3-B0-461-C-8700-41-A2-ECFFB764.png)



Line 2:

(https://i.postimg.cc/pTXfL1d3/AE194-E17-1199-4-D81-ADEB-A62392-F2947-C.png)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 16, 2022, 12:11:14 PM
A question, referring to the new algorithm III.2 (https://forum.kitz.co.uk/index.php/topic,26716.msg449345.html#msg449345), I wonder if the "<" signs in the stalactite height tests should be "≤" instead? For example in
   y40_is_bogus = y[40] < y[40 + half_width] - min_stalactite_height;
and the other two similar tests.


Notice in the latest SNR graphs above the various stalactites, all big enough to mess up the HCD algorithm without anti-down-spike filters. Line 4 shows three stalactites, two of which are in the critical region of tones 40-90. There’s also an iffy-looking dent in the top, which looks a bit like a mini hcd, but the shape is strange. The detector algorithm does not flag this feature as incipient HCD, which is a questionable decision but on balance I think correct, because the downstream speed is an all-time record high, so how can you ask for even better performance out of the tones? The line 4 stalactite at tone 74 is actually the pilot tone, so a pilot tone does show up on an SNR curve, but it seems that it’s only sometimes.  ???  On the other hand, line 2’s SNR vs tones graph doesn’t show the pilot tone at all.

Line 2 shows just one stalactite but in a potentially awkward place, approx tone 46, which could have hit the lhs detection point at tone 40 (or its secondary, shifted point x==40+3).
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 16, 2022, 03:42:41 PM
[b*cat has been to sleep since he last typed anything . . . ]

I've probably confused myself with the "mites" and "tites". I'm not sure what I meant in my last post.

As for using "<=" rather than "<", how about testing both by single-stepping through the code to see how they perform?

Your current "Line 2" I would state is normal. Your current "Line 4" I would state is abnormal, suspect, tending to show the start of a hollow curve. 
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 17, 2022, 06:27:59 AM
I agree about the incipient hollow curve thing, but the hollow is in the ‘wrong’ place in terms of x-cord, too far to the left compared with earlier incipient faults and as I said the sync rate is hardly such that I can say it’s already missing a few bits from a top-class bitloading. If I were to make a change to detect shapes like this, it might need to be a second complete test, with a different diagonal line. That’s not a bad thing though, it’s just a pain because I can’t easily make this into a subroutine for more than one reason. I’m also worried about introducing false positives by detecting noise as hollow curves. I feel I might have to make the detector oversensitive to get it to detect this, if you follow me. And I feel that any such false reports would be a very bad failing. As you can see I’m trying to talk myself into not doing it. And I’ll admit that I’m also lazy and it would be a lot of work, which you wouldn’t have in a better programming framework where it was easier to implement subroutines. (Can create subroutines and pass parameters, but sharing data is a bit awkward, and here the second killer is that I’m not really using array indexing as in the pseudo code. I’m extracting a per-tone ‘y’ data point value by using a regex instead to get the line. Doing that with literal constant index values is easy, but doing so with variable indices is a bit more of a fiddle, would have to inject a variable’s value into the regex, a bit awkward. Doing anything with iOS Shortcuts is massively harder than with C, but in some areas Shortcuts has these incredibly powerful high-level library functions, so it isn’t all one-way.)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 17, 2022, 07:45:12 AM
My chemistry teacher, Mrs Johnson, used to say, "when the mites go up, the tights come down".

I’m thinking about the case of a candidate possible ‘stalactite’ exactly 2.0 dB high. That hits the == condition. I wanted your opinion on what we should classify such a feature as. If you follow me, it’s not really a debugging issue, more of a ‘choosing the spec issue’. `it’s hardly crucial; if something is exactly 2.0 dB high, I skip past it (ignore it) or don’t and move to the right, that is increase x and return the y of a new increased x instead, as you see from the pseudo-code. In my view it’s all about the significance of the particular height value 2.0, and in truth there isn’t any :) so it’s difficult to know what to do and since any hit has to be an exact one on the y-difference value 2.0, then we ask ourselves what do we do if the y-difference were 1.999 say and that counts as pretty much exactly the same thing as the number 2.0 has no special significance. I’m inclined to leave it alone, but I do wonder if I would be missing anything by passing over the question?



Latest picture of line 4. Has this changed? This has to be an early HCD, but the test point at x==60 is to far to the right to pick it up. Can change that, of course. Or have two such test points. I’m wondering if this is just a slightly different type of early HCD shape to the ones that I’ve seen before?

(https://i.postimg.cc/5jdYvwqZ/BE6-A1112-C556-4152-BBE8-C9963243-A949.png)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 17, 2022, 03:12:59 PM
Understood.  :)

Latest picture of line 4. Has this changed? This has to be an early HCD, but the test point at x==60 is to far to the right to pick it up. Can change that, of course. Or have two such test points. I’m wondering if this is just a slightly different type of early HCD shape to the ones that I’ve seen before?

All those plots that we have previously seen with a "hollow curve" have never been critically analysed to extract the coordinates of the significant points. As such, I don't think I can comment on your last postulation.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 17, 2022, 06:45:29 PM
Agreed.

The reasoning behind that straight line equation algorithm is that a chord is already very slightly ‘hollow’, that is a real hollow curve must be lower at its midpoint than a chord is. If we knew the true equation of the expected ideal SNR curve then we could measure a downward deviation from the expected curve and that counts as accurate hollowness. So the algorithm is good imho, but we don’t know the coordinates of the chord endpoints to use; they were just obtained by observation of an extremely limited range of data. The best point for measurement of the downward deviation is always the midpoint of the chord assuming that the chord is well-chosen. In this latest case the midpoint is in the wrong place and therefore the rhs is in the wrong place too. The midpoint/test point is too far to the right.

Using the current chord and test point, the ‘drop’ at the midpoint, ie the y deviation below the test point is ~0.9 dB (very approx) by my calculations. I would say that’s too small to allow reliable detection because it could be in the noise.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 17, 2022, 07:39:58 PM
Ah, I now see the logic behind your technique. Thank you for that explanation.

I keep coming back to the idea of looking for a local maximum, followed by a local minimum, followed by a local maximum. (Which, of course, implies differentiation . . .  :-X )
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 17, 2022, 09:35:14 PM
You’re right of course about the local maxima, minima. The noise in the data would I think scupper any attempt, because the derivative values would be messy, would need a smoothing function to be applied first then. One reason for my hesitation would be the difficulty of implementation in iOS Shortcuts, as many-times loops are a bit slow and the interpreter engine is painfully slow now.

I am thinking about testing the chord from (40, y_lhs) to (60, y_rhs) and then measuring the ‘drop’ at the midpoint. That would be quite cheap as it would require only one additional spike-filtered test. The condition would be as usual, and then the final boolean would be an OR of the two existing boolean < tests.

Here’s the detailed data set from the problematic region of line 4, showing our candidate small HC. The third column and the chart on the right show the deviations from the value of y at x==40. You can see the shape of the hollow in that nicely. It’s just that its dip is in the wrong place for the current algorithm’s parametrisation.

(https://i.postimg.cc/XvPsgLrQ/BA61-A582-C3-A9-41-BE-955-F-36407-F7-B5034.png)

See also attached zip file containing spreadsheet in Excel format and in iOS Numbers format
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 17, 2022, 10:55:55 PM
A small note. I believe that theoretically you could have a ‘lopsided’ early / incipient HCD curve. This would be one tilted down to the right, so that the rhs is monotonically decreasing, but has a point where dy/dx is instantaneously 0, ie not a local extremum, but a turning point, is that the term? I forget after forty years. Of course since it’s diseased, the first derivative does not have to be continuous, but could go sharply from zero to a new negative value at our point.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 17, 2022, 11:21:02 PM
Hmm . . . If I am remembering correctly (from over 50 years ago), the critical (or turning) points of a curve are those points when the first differential equals zero.

Nothing else (currently) comes to mind.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 18, 2022, 12:40:49 AM
Agreed.

The modified algorithm currently running is as follows. Has two chords and has an associated test for each one:
    /* ALGORITHM IV */
    const double SNR[ 256 ];
    alias y = SNR;
    const uint half_width = 3;
    const double min_stalactite_height = 2.0;
    const bool y40_is_bogus = y[40] < y[40 + half_width] - min_stalactite_height;
    const uint x4 = y40_is_bogus ? 40 + half_width : 40;
    const double y4 = y[x4];
   
    const bool y5_is_bogus = (y[52] < y[52 - half_width] - min_stalactite_height )
                          && (y[52] < y[52 + half_width] - min_stalactite_height );
    const uint x5 = y5_is_bogus ? 52 + half_width : 52;
    const double y5 = y[x5];

    const bool y60_is_bogus = (y[60] < y[60 - half_width] - min_stalactite_height )
                           && (y[60] < y[60 + half_width] - min_stalactite_height );
    const uint x6 = y60_is_bogus ? 60 + half_width :  60;
    const double y6 = y[x6];

    const bool y85_is_bogus = (y[85] < y[85 - half_width] - min_stalactite_height)
                           && (y[85] < y[85 + half_width] - min_stalactite_height);
    const uint x8 = y85_is_bogus ? 85 + half_width : 85;
    const double y8 = y[x8];

    /* line chord1 [(x4,y4)-(x8,y8)]; 'approx midpoint' is at (x6, ymid1); data point is at (x6, y6) */
    const double ymid1 = y4 + ((y8 - y4)*(x6 - x4))/(x8 - x4); /* fp div required */
    const bool hollow_curve1 = y6 < ymid1;
   
    /* line chord2 [(x4,y4)-(x6,y6)]; 'approx midpoint' is at (x5, ymid2); data point is at (x5, y5) */
    const double ymid2 = y4 + ((y6 - y4)*(x5 - x4))/(x6 - x4); /* fp div required */
    const bool hollow_curve2 = y5 < ymid2;

    const bool hollow_curve = hollow_curve1 || hollow_curve2;


Implementation note: (1) the boolean OR is not available in iOS Shortcuts, although there is an extension package that has an if-or function or something, haven’t investigated this yet. Anyway, because of this, I implemented the OR as a pair of if-statements, quite ugly.

(2) The brackets surrounding the division in the chord equations shouldn’t be there. This is a bug because the bracket triggers integer division, the numerator and denominator bring uint’s, and floating point division is required. I’m assuming that the multiplication gets done first and that converts the rhs op uint to double so then the result of the multiplication is double and then so is the division operation.


* The new algorithm works fine ;D, now detects HCD for modem 4 (only), which of course is the correct answer.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on February 18, 2022, 03:22:51 PM
* The new algorithm works fine ;D, now detects HCD for modem 4 (only), which of course is the correct answer.

That's good to know. Congratulations.  :)

Let's see how things are reported over the coming days / weeks / months / etc.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 20, 2022, 03:25:25 AM
There is a mini stalactite developing slightly at x=58-59, quite deep now.



I am not sure about that, maybe random variation?

I powered the modems down for several hours overnight because of a lightning scare. When they came back up the notch - supposed incipient hollow curve was still exactly the same. By the chosen geometric definition of hollow curve, it definitely qualifies, but I’m not sure it qualifies as a disease that develops; could be a permanent quirk or permanent disease though. We will have to see if it does grow.



I added an additional parameter ‘chord2 notch min height’ set to 1.5 dB. This is subtracted from the drop height below the midpoint as in
      bool hollow_curve2 = y5 < ymid2 - chord2_notch_min_height;
This means that small notches are ignored when the parameter’s value is set large enough and the definition of ‘notch’ is that detected by chord2, that is the chord x=40 to x=60.

This worked perfectly, blocking the detection of small chord2 notches if they are regarded as not genuine ‘disease’, although this classification is questionable. I would say that notches are only bogus if they do not go on to develop into something larger.



After a resynch on Tue afternoon, it seems the chord2 notch phenomenon has gone away. Who knows how long for though. At least the flexible twin-chord test and the filter ‘chord2 notch min height’ parameter are available as a future flexible guard.

Current line 4, Tue afternoon after the notch went away:

(https://i.postimg.cc/hPtWqLWj/55-C76-B7-E-7-B52-4155-8-C51-C5-F6-B167-B03-F.png)

Code: [Select]

   39 39.2500
   40 40.0625
   41 40.6250
   42 40.8125
   43 41.0625
   44 41.2500
   45 41.5000
   46 35.3125
   47 41.1875
   48 41.5625
   49 41.5000
   50 38.6250
   51 41.6250
   52 41.1250
   53 41.4375
   54 41.3125
   55 41.0000
   56 40.8750
   57 40.8125
   58 39.0625
   59 39.0000
   60 39.9375
   61 40.0000
   62 40.2500
   63 40.0625
   64 39.4375
   65 39.5000
   66 39.0625
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on February 23, 2022, 07:58:28 PM
Lightning all over the western isles and the west coast last night. Port Rìgh electricity substation got struck by lightning at around 8:00 am-ish and the electricity supply was off when residents got up. I was watching the lightning warnings on the internet for half the night because I couldn’t sleep due to pain.

Lightning + ‘thundersnow[?]’ is forecast here for tomorrow (Thursday) with ‘yellow warnings’.

It seems to me that the downhill slope is more or less a straight line after x=65, and that is somewhat different to the impression that I initially had. Does anyone have any old ADSL SNR-vs-tones graph pictures at all, or the dataset?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 07, 2022, 10:20:29 AM
Final summary and up-to-date algorithm.

The algorithm currently running is as follows. Has two chords chord1 x=40 to x=85 and chord2 x=40 to x=60, and has an associated test for each one:
    /* ALGORITHM IV.1 */
    const double SNR[ 256 ];
    alias y = SNR;
    const uint half_width = 3;
    const double min_stalactite_height = 2.0;
    const double chord2_notch_min_height = 1.5; /* adjustment of sensitivity of ‘notch’-detector, detector for smaller hollow in chord2 x=40 to x=60 */

    const bool y40_is_bogus = y[40] < y[40 + half_width] - min_stalactite_height;
    const uint x4 = y40_is_bogus ? 40 + half_width : 40;
    const double y4 = y[x4];
   
    const bool y5_is_bogus = (y[52] < y[52 - half_width] - min_stalactite_height )
                          && (y[52] < y[52 + half_width] - min_stalactite_height );
    const uint x5 = y5_is_bogus ? 52 + half_width : 52;
    const double y5 = y[x5];

    const bool y60_is_bogus = (y[60] < y[60 - half_width] - min_stalactite_height )
                           && (y[60] < y[60 + half_width] - min_stalactite_height );
    const uint x6 = y60_is_bogus ? 60 + half_width :  60;
    const double y6 = y[x6];

    const bool y85_is_bogus = (y[85] < y[85 - half_width] - min_stalactite_height)
                           && (y[85] < y[85 + half_width] - min_stalactite_height);
    const uint x8 = y85_is_bogus ? 85 + half_width : 85;
    const double y8 = y[x8];

    /* line chord1 [(x4,y4)-(x8,y8)]; 'approx midpoint' is at (x6, ymid1); data point is at (x6, y6) */
    const double ymid1 = y4 + ((y8 - y4)*(x6 - x4))/(x8 - x4); /* fp div required */
    const bool hollow_curve1 = y6 < ymid1;
   
    /* line chord2 [(x4,y4)-(x6,y6)]; 'approx midpoint' is at (x5, ymid2); data point is at (x5, y5) */
    const double ymid2 = y4 + ((y6 - y4)*(x5 - x4))/(x6 - x4); /* fp div required */
    const bool hollow_curve2 = y5 < ymid2 - chord2_notch_min_height;

    const bool hollow_curve = hollow_curve1 || hollow_curve2;


As mentioned earlier, I added an additional parameter ‘chord2_notch_min_height’ set to 1.5 dB. This is subtracted from the drop height below the midpoint as in
      bool hollow_curve2 = y5 < ymid2 - chord2_notch_min_height;
This means that small ‘notches’ are ignored when the parameter’s value is set large enough and the definition of ‘notch’ is that detected by chord2, that is the chord x=40 to x=60.

This has worked perfectly, blocking the detection of small chord2 notches if they are regarded as not genuine ‘disease’, although this classification is questionable. I would say that ‘notches’ are only bogus if they do not go on to develop into something larger.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on March 07, 2022, 04:05:58 PM
Final summary and up-to-date algorithm.

Looks good. And hopefully it also works well.  :)

Quote
As mentioned earlier, I added an additional parameter ‘chord2_notch_min_height’ set to 1.5 dB.

<snip>

This has worked perfectly, blocking the detection of small chord2 notches if they are regarded as not genuine ‘disease’, although this classification is questionable. I would say that ‘notches’ are only bogus if they do not go on to develop into something larger.

As for the latter, I agree with you. The bogus status can only be resolved with the aid of either a crystal ball or a time machine.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 07, 2022, 10:31:58 PM
There has been a sudden outbreak tonight, second in two days, same modem: turned off, but perhaps not for long enough. The first power-cycling seemed to fix matters perfectly but it only lasted 24 hours.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on March 07, 2022, 10:36:37 PM
Just how long was the device left in a powered-off state?

Seconds? Minutes? Or an hour?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 07, 2022, 10:46:56 PM
Janet left it switched off for less than two minutes last night and one minute tonight very rough guess, she wanted to get to her bed. Didn’t work tonight at all.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on March 07, 2022, 10:59:46 PM
Hmm . . . In that case, I will suggest 15 - 30 minutes should be tested, next time.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 07, 2022, 11:05:51 PM
The main hollow tonight was very pronounced during the second outbreak, with loss of 800 kbps down to 2.1Mbps downstream, then loss of 1.5Mbps down to 1.4 Mbps downstream. After second switch-off tonight, left modem #2 off for one hour, now all good.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 08, 2022, 02:04:36 PM
And again. A superb result for the hcd detector which detected very early disease development. Disappointing that modem 2 only stayed healthy for about 12 hours or so though after a hard reset. Really will have to replace modem 2.


    Summary of DSL links’ wellbeing and error counts
     ────────────────────────

* There are 3 modems in total. They are:     #1, #2 and #4
* The active, contactable modems are:        #1, #2 and #4
* The modems successfully queried are:       #1, #2 and #4

       ───────────────────────
       ***                                                                           ***
       ***     There is some SERIOUS BADNESS !                   ***
       ***                      All is not well !   😦                                ***
       ***                                                                           ***
       ───────────────────────


--
* SNRM: The SNRM of the following link is out of range:
   Link #2 downstream: current SNRM:  1.9 dB is too low; below the expected minimum SNRM ( 2 dB )

*❗Link #2 defect detected: so-called ‘hollow curve phenomenon’ in the downstream bit-loading 🔺

--
* ES (less serious): The following links have a few CRC errors, at lower error rates, where the ES rate < 60 ES / hr (†):
   Link #1  upstream:            latest period: ES per hr:   9.18, mean time between errors: 392 s, collection duration: 784 s
   Link #2 downstream:        latest period: ES per hr:   4.04, mean time between errors: 891  s, collection duration: 891  s


──────────────────────────────
(†) The duration of the ’latest‘ errored seconds (ES) collection
bucket is variable, with a _maximum_ of 15 mins. The buckets’
start times are always 15 mins apart. A ‘previous’ bucket's
duration is a fixed 15 mins. An ES is a 1 s time period in which one
or more CRC errors are detected. A CRC error is a Reed-Solomon
coding-uncorrectable error, ie. corrupted data is received that
cannot be recovered.
──────────────────────────────      
                                              ◅ ◅ ◅◊▻ ▻ ▻



Despite the ‘hollow’ being only slight, it was detected to the rhs of the centre of the region.

(https://i.postimg.cc/zGyZZPcr/8-E6-B36-B1-0-E2-A-4-C09-AC80-F3-DA0-DC8-E1-A9.png)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on March 08, 2022, 04:52:10 PM
Despite the ‘hollow’ being only slight, it was detected to the rhs of the centre of the region.

Ah, yes. There it is, just starting to "ripen".  :)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 08, 2022, 05:53:12 PM
Taking readings for chord 1 from the above picture, my calculations show that there should indeed be an HCD=true result as the graph at x=60 is indeed just below the y value of chord1 at the test point, x=60. The graph is just under y<35.0 at x=60 and the chord chord1 at x=60 is definitely somewhat >35.0, so there is a drop from the chord chord1 to the graph at x=60.

Turning now to the latest graph, shown below, the relevant chord, chord1, is from (40, 36.4375) to (85, 32.0625) and the test is the drop from this chord at x=60. This graph is later than that shown in the picture above, readings taken at ~18:40. The graph should be below that x=60 point (60, y6) in order to trigger a true HCD result. My calculator says that the chord chord1 at x=60 is at y=34.93. Could you check that from the equation of the straight line chord 1?

Reading the values of the latest graph, the graph is seen to be y= 31.8125 at x=60, so that is indeed below the chord chord1, and so gives an HCD=true result.
  :congrats:

Latest picture:
(https://i.postimg.cc/qvQLrZrQ/103-EFFCF-4061-4-E8-A-82-F8-48-E6-C5-A183-C4.png)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 19, 2022, 12:32:50 AM
I have tweaked chord2 slightly so that it runs from x=40 to x=62 instead of to 60, and the associated midpoint test for chord 1 is moved from 60 to 62 as well to still match. The reason is that the chord2 x_rhs = 62 seems to suit recently seen ‘notch’-type nascent HCD phenomena slightly better than x_rhs=60.

    /* ALGORITHM IV.2 */
    const double SNR[ 256 ];
    alias y = SNR;
    const uint half_width = 3;
    const double min_stalactite_height = 2.0;
    const double chord2_notch_min_height = 1.5; /* adjustment of sensitivity of ‘notch’-detector, detector for smaller hollow in chord2 x=40 to x=62 */

    const bool y40_is_bogus = y[40] < y[40 + half_width] - min_stalactite_height;
    const uint x4 = y40_is_bogus ? 40 + half_width : 40;
    const double y4 = y[x4];
   
    const bool y5_is_bogus = (y[52] < y[52 - half_width] - min_stalactite_height )
                          && (y[52] < y[52 + half_width] - min_stalactite_height );
    const uint x5 = y5_is_bogus ? 52 + half_width : 52;
    const double y5 = y[x5];

    const bool y62_is_bogus = (y[62] < y[62 - half_width] - min_stalactite_height )
                           && (y[62] < y[62 + half_width] - min_stalactite_height );
    const uint x6 = y62_is_bogus ? 62 + half_width :  62;
    const double y6 = y[x6];

    const bool y85_is_bogus = (y[85] < y[85 - half_width] - min_stalactite_height)
                           && (y[85] < y[85 + half_width] - min_stalactite_height);
    const uint x8 = y85_is_bogus ? 85 + half_width : 85;
    const double y8 = y[x8];

    /* line chord1 [(x4,y4)-(x8,y8)]; 'approx midpoint' is at (x6, ymid1); data point is at (x6, y6) */
    const double ymid1 = y4 + ((y8 - y4)*(x6 - x4))/(x8 - x4); /* fp div required */
    const bool hollow_curve1 = y6 < ymid1;
   
    /* line chord2 [(x4,y4)-(x6,y6)]; 'approx midpoint' is at (x5, ymid2); data point is at (x5, y5) */
    const double ymid2 = y4 + ((y6 - y4)*(x5 - x4))/(x6 - x4); /* fp div required */
    const bool hollow_curve2 = y5 < ymid2 - chord2_notch_min_height;

    const bool hollow_curve = hollow_curve1 || hollow_curve2;
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on March 19, 2022, 02:44:23 PM
I haven't "single-stepped" through your latest code but looked at where you have made the latest change. It looks good.  :)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on March 20, 2022, 11:06:11 PM
The new rhs x parameter seems to catch the top of the rhs better; before it wasn’t up to the top of the peak, was too far to the left of it still.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on April 09, 2022, 03:00:08 AM
Referring to a post in a recent thread elsewhere
    https://forum.kitz.co.uk/index.php/topic,26851.msg451815.html#msg451815

I was wondering about (i) whether anyone may have seen this elsewhere and (ii) musing on the likely impossibility of translating these ideas into VDSL2. Could someone post an SNR vs tones graph for a VDSL2 circuit?
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on April 09, 2022, 02:09:59 PM
Could someone post an SNR vs tones graph for a VDSL2 circuit?

I have sent an e-mail message direct to you (at "The Weaving Shed") with eight such plots as an attachment.  :)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on April 10, 2022, 12:50:14 AM
I think we would have to define some terms. A wider definition might be "frequency-selective SNRM decrease". That doesn’t say as much about shape, so I think it’s weaker, but it concentrates on the essentials, that here we have a phenomenon limited to a frequency range.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on July 14, 2022, 03:27:04 PM
There has been a recent additional HCD case, line 4, see https://forum.kitz.co.uk/index.php/topic,27118.0.html and the HCD detector sometimes did successfully detect and report HCD, sometimes not, as the fine details kept shifting and this was a shape not seen before (see above link).

To handle this new shape, I added a third chord test, one with a right-hand (max x) end value of 70 in addition to the earlier chord 1 test that had a rhs at around tone 80. The tone range of this chord then is 4x - 70, where 4x is a bit greater than 40m adjusted for stalactite detection. I have not yet put in stalactite detection at the rhs tone 70 end, as there does not seem to be much of a problem yet. I will probably have to add that further enhancement / tweak for increased robustness.

So this gives us algorithm V.0 which now has a triple test: is_hollow_chord1 || is_hollow_chord2 || is_hollow_chord3.

With this new chord, the algorithm V.0 picks up the HCD nicely. It’s because the rhs endpoint is now on the rh mound, local maximum, so just nicely to the right of the local minimum that we’re interested in finding, the drop below the chord’ midpoint-y.

(https://forum.kitz.co.uk/proxy.php?request=http%3A%2F%2Fi.postimg.cc%2F8Pn2FX9k%2F645-C6-D7-A-4389-42-B1-B9-FC-8-EDA5-EF643-D2.png&hash=b92380e79d88b2ae10d555228454bbd128305cd4)

This is the problem picture.

[Moderator edited to fix a typo in a markup tag.]
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on July 14, 2022, 04:56:11 PM
This is the problem picture.

I see no picture.  :(

But, using my feline powers of "see all", I'll show the URL --

http://i.postimg.cc/8Pn2FX9k/645-C6-D7-A-4389-42-B1-B9-FC-8-EDA5-EF643-D2.png
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on August 09, 2022, 04:56:52 AM
The algorithm is now at v.5.2 after a bug fix in respect of the detection of the lhs chord endpoint ie near tone 40. The pseudocode for the paragraph determining x4, y4 code is now replaced by:
    /* Algorithm v 5.2 */

    uint x4 = find the x value for which y[ x ] = max( [ y[40], y[43], y45] );  /* test three points just above tone 40, find the highest y */
    double y4 = y[ x4 ];

There was a stupid bug here before. We want to find the highest y so as to get the best vertical drop value into the middle of any hollow. Any stalactites just above x=40 are irrelevant because they won’t win in the ‘max y’ determination algorithm anyway, as stalactites go down not up. ;)

This change was motivated by the need to handle the latest extremely severe late-stage HCD case. See below. Here’s the relevant picture of horror, line 4, at 288 kbps downstream, 350 kbps upstream. Weird shape, slightly, and it was this that required the small revision of the HCD detection algorithm to also this case, the lhs shape being odd.

The result is now successful:

--
* HCD:❗So-called ‘hollow curve disease’ (HCD) defect detected in the downstream SNR-vs-tones curve of link #4. Serious fault. 🔺
   Link #4: Summary:  tone 52 is 2.36932 dB below chord 2: (tones 40-62);  ❗
   Link #4: Details: chord 2: [ tone 40: 35.0625 dB; curve midpoint test tone 52: 28.875 dB; tone 62: 28.0625 dB ]; chord midpoint test tone 52: 31.24432 dB.

One minor annoyance that I’d like to correct is that while this is being reported as a failure against a chord 2 test, I suspect that it is could also be a failure against chord 1, and although there’s nothing wrong with the result, I’d prefer to report the chord 1 failure somehow where there’s a choice. Re-ordering the tests would fix this, as for some reason the code currently tests for chord 2 first, and first test wins. Moving blocks of code around is a nightmare in the iOS Shortcuts’ code editor and I’d have to think of some clever tricks to make it doable.



Note that unfortunately the picture below is from somewhat earlier today and the numbers don’t match those of the analysis above.

(https://i.postimg.cc/5tmf9xk1/61-DB2171-D318-43-A2-B0-B0-C63-F1220-C21-D.png)

Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on August 09, 2022, 03:37:27 PM
Ah, yes, I see. But as you are the expert with iOS Shortcuts, I know you will eventually make the required code adjustments.  :)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on August 12, 2022, 06:41:35 PM
I found the first serious bug in the field - a false detection report. This was due to a ripple, either noise or a very small stalactite; it was very near the test-midpoint of chord 3 and dipped down just below a chord that was very close to the curve over the whole length of the chord. The ripple just dipped below the chord midpoint and so was bogusly reported to be HCD chord 3. I kludge this by increasing the min midpoint drop parameter for chord 3, a feature that was designed specifically to reject noise like this, but failed because the min midpoint drop parameter was set too low so the chord 3 detector was oversensitive. Now it won’t detect real HCD quite so early, a disadvantage.

That is just a fudge though. The right thing to do is as described in the algorithm 5.2 bug fix for the lhs x= 40 to 45, done again for all three midpoints too, so the find-x-of-max-y[x] test replaces the existing stalactite test everywhere. This has the huge advantage of being possibly parameterless now. The min midpoint drop parameter requires hand-tuning and its value will always be bogus and arbitrary. I’m not completely certain that it should be done away with as getting rid of it is the same as setting the value to zero. I’m wondering if there is any virtue at all in retaining it with a small value. What do you think? It’s only the difference between:
           hcd = ( y_curve_mid < y_chord_mid );                       /* new code, possibly */
  and    hcd = ( y_curve_mid < y_chord_mid - min_midpoint_drop );   /* existing code, possibly to be retained */

This fix will take us to algorithm - what ? - v5.3 or v6 ? Which do you think it ought to be ?

It’s a slightly onerous change and will have to wait until I have a bit more energy. I wish I could copy code blocks. One of the many limitations of the strange Shortcuts code editor, which is ‘interactive’ - whatever that means - not like a traditional text editor. (It does live checking and offers instant parameter suggestions and various other interactive features integrated with syntax checking on the fly.)
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on August 12, 2022, 10:00:23 PM
This fix will take us to algorithm - what ? - v5.3 or v6 ? Which do you think it ought to be ?

If it is a minor(-ish) tweak, then v5.3; otherwise v6.0 would be my suggestion.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on August 14, 2022, 06:57:11 PM
Have now gone for it, have replaced the stalactite detectors at every point with find-x-for-ymax searching. This has increased reliability a lot. It kills two birds with one stone: it rejects stalactites, and also finds each max-y, something that is desired anyway in some cases, such as when finding the lhs-x.

Have also fixed a nasty bug that I spotted. In a certain case a variable was read before it was first written, so an undefined variable value. In this particular case it was not actually truly undefined, because the code was inside a major, all-enclosing outer loop ‘for-each-modem’, so an ‘undefined’ variable in pass modem( n ) would in this case pick up some bogus value from pass modem( n-1 ).

So very big improvement.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: burakkucat on August 14, 2022, 07:11:24 PM
So very big improvement.

That reads as if it is v6.0 of the code.
Title: Re: Maths - hollow curve phenomenon detector - algorithm design
Post by: Weaver on August 14, 2022, 08:11:21 PM
Agreed, algorithm v6.0 it is then.