Jump to content

[1.12.x] Antenna Helper Adopted: Math your Antenna Range and Signal Strength


linuxgurugamer

Recommended Posts

1 hour ago, luizsilveira said:

Just a minor heads up, but this one is showing as incompatible to my 1.9.1 on CKAN.

It seems to be something about how CKAN checks for compatibility, as it does say "any" for max version.

Ninja edit: (it shows as compatible with 1.9 but not 1.9.1)

I know, this is happening for most of my mods :-(

Link to comment
Share on other sites

  • 1 month later...

Quick question:  If I'm showing DSN range in Map view (possibly only from Tracking Station?  I don't remember) and dip below the plane of the ecliptic then the colored range circles move off of Kerbin and instead center on a point in space roughly two or three planetary radii away.  Is this expected behavior?  Anybody else have this happening?  Thanks!

And, for others, when I moved to KSP 1.9.1 and upgraded the mod the aforementioned problem disappeared.

 

Thanks!

Edited by jamesf
Link to comment
Share on other sites

  • 2 months later...

Howdy @linuxgurugamer

There seems to be a bug in this mod. Tested on KSP 1.9.1, AntennaHelper 1.0.7.2, no other mods installed (aside from required dependencies).

Steps to reproduce - create a ship with RA-2 relay antenna (antenna power rating of 2 Gm). Target is the same ship. Antenna Helper Mod shows the correct range.

T8Fuk0x.png

Then use the game settings to increase the range modifier to 2.0

fLfmGPy.png

Antenna Helper shows antenna power increased by factor of 4.

bFYHCxY.png

If you change the range modifier setting to 3, Antenna Helper increases range by a factor of 9.

7cn40fM.png

It seems the mod is taking the range modifier setting, raising it to a power of 2 and using that as a multiplier.

I looked at the source code, but I'm not good enough with C#, I couldn't find the problem. It seems to be in AHUtil.cs? Sorry.

Thanks for all you do!

 

Link to comment
Share on other sites

That sounds mostly correct.  In order to double the range, the power needs to be increased by 4. When you double the range, the area that the antenna must cover increases by 4. Too late for me to do any searches, but google it, you will be surprised by the results.

edit:  its the inverse square law, read about it here:

https://en.wikipedia.org/wiki/Inverse-square_law

pinging @MalevolentNinja

Edited by linuxgurugamer
Link to comment
Share on other sites

No, something funky is going on here. The 'Range Modifier' doesn't actually modify the range, per se, of connections, it is just a multiplier coefficient that is applied against antenna parts' power rating. So for an RA-2 antenna with power of 2E+09 and a 'Range Modifier' of 2.0, the power of that antenna should become 4E+09 not 8E+09 as shown in the screenshot above.

EDIT: Tested the issue myself and I am seeing the same thing. With a Range Modifier of 2.00 it is resulting with a vessel power of 8E+09 which is doubled. Interestingly, if you chose an antenna part for a target instead of a vessel, you can see that the part list option is correctly showing the RA-2's power as 4E+09 in the list so I expect the issue is occurring when the total vessel power is being calculated.

My guess is that it is calculating the 'true power' of all antenna parts (as it should be doing) by multipling each antenna by the range modifier (as specified in AHUtil.cs) but then its also taking the total vessel power and multiplying it AGAIN by the range modifier which is why it appears to be raising it to the square of the range modifier. I just started to look through the Source Code and GitHub has just gone down. :( 

X5R8RuO.png

Also, as an aside, the text is becoming mis-aligned when the 'Status' text is wrapping to a new line.

Edited by Poodmund
Link to comment
Share on other sites

@linuxgurugamer

I agree with @Poodmund - I've done some testing in game also.

I started with a stock install of KSP and changed the game setting for range modifier to 2. I cheated a couple sats into orbit, each with one RA-2 relay antenna (antenna power of 2 Gm). I get a very faint link at 4 Gm, but lose connection any farther out.

So it seems to me, the range modifier setting is a straight multiplication of the antenna power. The text that appears when you hover over the setting would indicate this also.

fLfmGPy.png

Since the formula is range = sqrt ( Vessel1AntennaPower * Vessel2AntennaPower), the range will be doubled just by doubling the antenna power.

Edited by MalevolentNinja
Just a little math
Link to comment
Share on other sites

Just now, MalevolentNinja said:

So it seems to me, the range modifier setting is a straight multiplication of the antenna power. The text that appears when you hover over the setting would indicate this also.

This is most definitely the case. Individual Effective Antenna Power = Individual Default Antenna Power * Range Modifier

Link to comment
Share on other sites

1 minute ago, Poodmund said:

This is most definitely the case. Individual Effective Antenna Power = Individual Default Antenna Power * Range Modifier

Also, just be aware, KSP does not show the effect of the range modifier setting in the part tooltip in the VAB. An RA-2 still shows an antenna power of 2G with the setting changed to 2. But it does work in flight.

Link to comment
Share on other sites

6 minutes ago, MalevolentNinja said:

Also, just be aware, KSP does not show the effect of the range modifier setting in the part tooltip in the VAB. An RA-2 still shows an antenna power of 2G with the setting changed to 2. But it does work in flight.

Yeah, if you want a fix for that to confirm the issue, try out this mod which resolves all of the broken UI displays with regards to CommNet: 

Theres been an issue raised about it for 2 years with no recognition... :( https://bugs.kerbalspaceprogram.com/issues/19996

 

Link to comment
Share on other sites

The CommNet Antennas Info mod acts similar to Antenna Helper. It shows an RA-2 (default antenna power of 2g) with a range modifier of 2 to have an antenna power of 8g. Which I bring up just to point out that the two mods agree, which made me question my sanity :)

So I retested in stock KSP 1.9.1. Here we have two probes, each with an RA-2. And the range modifier is set to 2.25. I propose this math is correct:

VesselAntennaPower = RA-2 * RangeModifier = 2,000,000,000 * 2.25 = 4.5G

MaxRange = SQRT ( 4.5 * 4.5 ) = 4.5Gm

Here's the in game test:

DfGGs7T.png


BPAk6FU.png

I lose the link between the two probes at exactly 4.5Gm.

Edit: The other mod 'CommNet Antennas Info' works correctly, my bad.

 

Edited by MalevolentNinja
Link to comment
Share on other sites

I took a couple of minutes to look at the code.  The only place that the rangemodifier is used is here:

		public static double TruePower (double power) {
			// return the "true power" of the antenna, stock power * range modifier
			return power * HighLogic.CurrentGame.Parameters.CustomParams<CommNet.CommNetParams>().rangeModifier;

As you can see it's only doing a multiplication.

Also, In @flart's CommNet Antennas Info, he uses it in two places:

                    mdt.Fields["powerText"].SetValue(
                        Formatter.ValueShort(mdt.antennaPower * commNetParams.rangeModifier) +
            moduleDT.Fields["powerText"].guiActiveEditor = false;

            double antennaPowerModified = moduleDT.antennaPower * commNetParams.rangeModifier;

and

            double BuiltInPowerModified = GetPowerMostCommonInternalAntenna(partsDT) * commNetParams.rangeModifier;
            string BuiltInPowerModified_str = Formatter.ValueExtraShortSpaced(BuiltInPowerModified);
                    double antennaPowerModified = moduleDT.antennaPower * commNetParams.rangeModifier;

                    string[] DSNranges_str = new string[TrackingLevels];

 

As you can see, both mods are only using it in a simple multiplication.

Now, I haven't done a lot of research, but what I think you might be missing is the fact that the OUTPUT power of the antenna is different than the sensitivity of the antenna for reception.  Again, I haven't done a lot of work, this is merely the result of 5 minutes searching, and I'm not an expert in the intricacies of KSP antennas.  But it seems to me that if two independent mods, both using the same calculation are both agreeing on the output, that maybe there is something else going on.

I'm hoping that @flart can respond also, I'm interested in seeing what he says

Link to comment
Share on other sites

11 minutes ago, linuxgurugamer said:

Now, I haven't done a lot of research, but what I think you might be missing is the fact that the OUTPUT power of the antenna is different than the sensitivity of the antenna for reception.  Again, I haven't done a lot of work, this is merely the result of 5 minutes searching, and I'm not an expert in the intricacies of KSP antennas.  But it seems to me that if two independent mods, both using the same calculation are both agreeing on the output, that maybe there is something else going on.

I also went through this and Flart's mod and I came to the same conclusion that it doesn't seem to be doing anything inccorrect but something may have been changed in KSP's Assembly library during the 1.8 or 1.9 update as I'm pretty sure this used to display properly. 'antennaPower' may now be factoring in the Range Modifier itself internally?

Coincidentally Linux, my CommNet calculator (https://goo.gl/Wn03VL) was what Li0n used to resolve the mathematics behind this mod which agrees with what MalevolentNinja has shown above.

EDIT: I'll go back through previous versions of KSP to see what differences there are.

Edited by Poodmund
Link to comment
Share on other sites

28 minutes ago, linuxgurugamer said:

I took a couple of minutes to look at the code.  The only place that the rangemodifier is used is here:


		public static double TruePower (double power) {
			// return the "true power" of the antenna, stock power * range modifier
			return power * HighLogic.CurrentGame.Parameters.CustomParams<CommNet.CommNetParams>().rangeModifier;

As you can see it's only doing a multiplication.

 

I'm no programmer, but what if KSP is giving you the correct antenna power, with the range modifier already factored in, and then you are multiplying it by the modifier again?

Edit:  

19 minutes ago, Poodmund said:

'antennaPower' may now be factoring in the Range Modifier itself internally?

Oops, @Poodmund already said that :)

Edited by MalevolentNinja
Link to comment
Share on other sites

Just now, linuxgurugamer said:

Quite possible, especially if it was added later.  Do the antennas show up with the correct values in the editor?  Correct as in already being multiplied?

The VAB/SPH part tooltip does not show the effect of the range modifier setting. See @Poodmund's bugtracker from 2 years ago

https://bugs.kerbalspaceprogram.com/issues/19996

 

Link to comment
Share on other sites

8 minutes ago, linuxgurugamer said:

Here is a rebuild of the mod, only change was to remove the multiplication:

https://www.dropbox.com/s/xr635hd1t7wc65i/AntennaHelper-1.0.7.2.zip?dl=0

I will test now.

And I need to confess something... I made a mistake. I am very sorry for the confusion.

The mod "CommNet Antenna Info" does not have the same problem. That mod shows the correct antenna power ratings with different range modifier settings. My mistake was because I had a leftover MM patch in place that doubled antenna power. Sorry!

That said, Antenna Helper is definitely showing the wrong info, as I described above.

Link to comment
Share on other sites

1 minute ago, MalevolentNinja said:

I will test now.

And I need to confess something... I made a mistake. I am very sorry for the confusion.

The mod "CommNet Antenna Info" does not have the same problem. That mod shows the correct antenna power ratings with different range modifier settings. My mistake was because I had a leftover MM patch in place that doubled antenna power. Sorry!

That said, Antenna Helper is definitely showing the wrong info, as I described above.

I would appreciate your doing the test in a brand new install, with ONLY AntennaHelper, CommNet Antenna Info and their required dependencies installed.

Given that I looked into the code and saw the same calculation, I'm rather concerned that you don't have something else going on

Link to comment
Share on other sites

Will do, I'm grabbing a fresh copy now.

Edit:

  • New install of KSP 1.9.1 with BG and MH
  • Installed Antenna Helper with dependencies from CKAN
  • Created new save file with range modifier of 1.90
  • Tested with RA-2. It should be 2G * 1.9 = 3.8G but Antenna helper shows 7.22G which is 2G  * 1.9 * 1.9

So I was able to reproduce the issue. I did make a mistake about the other mod having the same issue (sorry!), but I verified again that Antenna Helper does show the wrong info.

  • Replaced mod with build downloaded from dropbox
  • loaded the save
  • Antenna Helper shows range of 2G, which is the RA-2 without factoring in the range modifier

So no luck :(

uAnV8qq.png

@linuxgurugamer

Edited by MalevolentNinja
Link to comment
Share on other sites

I can confirm the issue persists on KSP 1.7.0 through to KSP 1.9.1 with all the respective versions of Antenna Helper and dependencies built for those versions. So the issue has been around for a while.

EDIT: Gone back as far as 1.4.3 and it still isn't working correctly.

Edited by Poodmund
Link to comment
Share on other sites

I don't know if this helps at all...

With range modifier settings of < 1 it seems to work fine. I've only spot checked a couple settings, but they worked. Here's range modifier 0.64 (2G * 0.64 = 1.28G):

KKL4a7m.png

With range modifier settings > 1 it seems to multiply antenna power by range modifier twice. Here's range modifier 2.48 (2G * 2.48 * 2.48 = 12.3G):

OIFcvTJ.png

 

You can see CommNet Antennas Info is showing the correct values in the tooltip.

Edited by MalevolentNinja
Link to comment
Share on other sites

Just now, MalevolentNinja said:

I don't know if this helps at all...

With range modifier settings of < 1 it seems to work fine. I've only spot checked a couple settings, but they worked. Here's range modifier 0.64 (2G * 0.64 = 1.28G):

Was this with the CKAN version of AntennaHelper?

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...