Metering question

  • 1
  • Question
  • Updated 4 years ago
  • Answered
  • (Edited)
1) In Radio.cs.3657


            else if (m.Name == "+13.8A") // A: before the fuse
                m.DataReady += new Meter.DataReadyEventHandler(Volts_DataReady);

I assume from the comment, that really should be "+13.8A", I don't understand the comment as what is really being expected is a voltage not amperage .

2) in Radio.cs.3642
                m.DataReady += new Meter.DataReadyEventHandler(FWDPW_DataReady);

If I understand C# events, this is adding an event sink of FWDPW_DataReady which, when invoked, passes the meter and the meter's value, as seen here at 3691

        private void FWDPW_DataReady(Meter meter, float data)
        {
            OnForwardPowerDataReady(data);
        }


This, in turn, invokes Radio.cs:3749
        private void OnForwardPowerDataReady(float data)
        {
            if (ForwardPowerDataReady != null)
                ForwardPowerDataReady(data);
        }

This seems a tad circular. it adds an event notification target in an instance of meter that reflect the event back to radio(a singleton really) that in turn reflects the event to whatever registered for the ForwardPowerNotification.

Since the passed back meter instance is stripped anyway, would it not be easier to pass it directly to OnForwardPowerDataReady. This would preserve the many to one relationship and save, what appears to be, a non productive event notification.

Another way to phrase this, perhaps, is what is the purpose of FWDPW_DataReady?

Thanks
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes

Posted 4 years ago

  • 1
Photo of Jay / NO5J

Jay / NO5J

  • 1673 Posts
  • 260 Reply Likes
Is there a comment  for 13.8B after the fuse?
I thought it was just 2 metering points for the Voltage, A before, and B after the fuse.
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
Hi Jay,
   Nope..I just double checked. Just A. I did not know there were two points. Just because the code only checks the one, doesn't mean it couldn't check the other. To my knowledge, the only app that looks at voltage (clearly A) is DDUtil.
   I would have guessed it was a typo except there was a specific comment. I can certainly add a check for a B 'sink'.
Photo of Tim - W4TME

Tim - W4TME, Customer Experience Manager

  • 9186 Posts
  • 3541 Reply Likes
Jay is correct we monitor the input voltage before and after the main fuse.
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
Up to this point the discussion was on the first question re: 13.8A, vs. 13.8V. The substantive portion of the thread was the issue around the event wiring. I was hoping this would have been answered en masse rather than part, which is why I opened a specific thread regarding the other issue as I cannot go back and change the opening stmt. That second one got deleted as this was marked, incorrectly, answered. 
Photo of Jay / NO5J

Jay / NO5J

  • 1673 Posts
  • 260 Reply Likes
Sorry Walt, I was just curious if both the A, and B voltage measurement points were mentioned in radio.cs. I should have just searched in radio.cs myself. I thought you might have been looking right at it. I had no intention of hijacking the thread.

Jay - NO5J  
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
No Jay, that is why your comment took me by surprise. I thought the A was for amp and when you mentioned the b point I didn't know what you were referring to
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
Not familiar with flexmeter. I was referring to the metering logic in ssdr. That is where I was looking for 13.8B, as Jay mentioned..
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
I was afraid this is what would happen. This thread would be marked answered prematurely. I'll move the unanswered to a new thread.
Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 875 Posts
  • 323 Reply Likes
Walt,

The ForwardPowerDataReady event (and other similar meters) were added to the Radio class so that the client could attach directly to them prior to the meters actually being there.  It also prevents having to reattach the events if the radio becomes disconnected.  It was a simplification for the client.

While the circular nature of the calls can be confusing upon first glance, it works in the object oriented sense in that the Meter class is doing one thing (unpackaging meter data and exposing the data in a useful manner) and doing it well.  The fact that we happen to be using this functionality in the Radio class itself is a convenience.
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
OK, thank you Eric!
Photo of Walt - KZ1F

Walt - KZ1F

  • 3040 Posts
  • 645 Reply Likes
Tim, would you mark this answered please?