DRVeyl / RealAntennas

KSP Mod to add better antenna / link calculations to CommNet.
29 stars 26 forks source link

Feature Request: Antenna Maxpower setting #63

Closed thunder175 closed 2 years ago

thunder175 commented 3 years ago

I've been trying to figure out a way to balance antenna parts in large parts packs such as Bluedog Design Bureau, which has antennas of all shapes and sizes based on their US space program counterparts. While working on config settings, it dawned on me that when only using reference gain for such a large number of antennas, there would be no prohibition from only using stick small stick antennas or rubber ducks. The size of the physical model doesn't matter, only the power and gain settings, as well as the available electric charge/power generation of the vehicle itself.

I was thinking of maybe adding to the antenna configs a maxpower setting to clamp the maximum transmit value to a specified setting in the config files. This way you can set simple little antennas to something a lot more reasonable, say 50W for small whip antennas instead of allowing them to be overdriven with humongous HPA's (by sliding the power way over to the right). Since we don't want to kill already existing configs, maybe something in the code that if maxpower != 0 or null, then maxpower = value. The PAW slider should scale so far right (max power) is equal to the maximum antenna power setting. This would also mean each antenna would have different default values of power upon placement in the VAB/SPH instead of the current 30dBm.

This would also apply to a lesser extent with dishes, and would also allow for better balancing in the tech trees.

DRVeyl commented 3 years ago

The ability of the vessel to generate the power required is the limiting factor on setting the power output, along with the mass and cost functions that scale with it. This is as it should be: there's very little, mechanically speaking, to limit the ability to drive power out of an antenna.

The gain setting is directly derived from the physical size of the model. Or a correctly configured one is, anyway. It's why "antennaDiameter" is the most appropriate way to specify a directional antenna. (Arguments for why "omni" antennas are allowed to go up to 5 dBi is a separate topic, and for most configs I encourage the limit to be ~3 dBi.)

thunder175 commented 3 years ago

I respectfully disagree on the statement about no factors limiting the power output of an antenna. If you were to pump 1000W of power thru an antenna rated for 50W continuous, you can expect damage to the internal antenna elements (like internal wiring, solder joints, etc) thru excessive heating, possible arcing, and in addition the SWR on the transceiver will skyrocket either damaging the radio or having it going into self-protect mode as most modern transceivers do.

Regardless, the point of my request was to not just allow for additional realism in choosing the right antenna for an appropriate power setting, but also for balancing when developing antenna configs. My 'concern' is that without a maxpower setting, one can game the system by selecting the smallest, cheapest antenna and crank 10K watts thru it, when in reality that would probably melt the antenna, feedline, and set your radio on fire.

For stock this isn't a big deal given the lack of antennas, but when using a parts pack like Coatl and BDB with a large amount of new antenna options both very large and extremely small I figured this would be a good way to balance the antennas and prevent misuse by the craft designer by adding an optional parameter to the antenna config.

Please keep up the outstanding work and am greatly looking forward to 2.2!

DRVeyl commented 3 years ago

I could implement this, because adding a setting to control the upper/lower limit for the UI controls in the editor is pretty trivial. Presumably it should automatically adjust if someone wanted a PartUpgrade route. I won't apply any adjustment to anything in flight.

However, I'm still very confused. The antenna part mass itself is scaled with TxPower. The formula isn't very smart, it's kg/watt. The highest TL is .142 kg/watt. https://github.com/DRVeyl/RealAntennas/blob/master/GameData/RealAntennas/RealAntennasCommNetParams.cfg#L263 At 1000W, you're paying an extra 142kg. This more than accounts for the need for thicker gauge wiring, larger connectors, thicker traces in the circuit boards, a larger housing for the amplifier, etc. You don't see it around the defaults of 30dBm = 1W. But where you do see it in practice is specifically to limit "just crank up the power."

Just cranking up the power is also not a good idea in gameplay. You pay that extra power to transmit science, so your vessel has to be able to generate it. Or you can not pay extra power by using a physically larger antenna. I only see two cases where you "win" by using more TxPower instead of more physical antenna:

  1. Don't intend to transmit any science at all, and just want a link to use to control the vessel. This doesn't actually work: if you have a kerbal onboard, you don't need a link at all. If you don't have a kerbal, what's the point of a probe that cannot send science?
  2. Abuse the fact that relays don't pay transmit costs, and decouple the relay with the huge transmitter from the science probe with a tiny antenna, and just stay close. But this is clearly an exploit.

The case where you -should- raise the power doesn't apply to this analysis, because it's in the lower power region. You probably don't need a 2m dish and 1/2W transmitter when you can use a 1m dish and 2W transmitter. At the low-power end, the formula does reward you for using a little more power if it is available. This is reasonable.