Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/RealAntennasProject/Physics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ public static float NoiseTemperature(RealAntenna rx, Vector3d origin)
float amt = AntennaMicrowaveTemp(rx);
float atmos = AtmosphericTemp(rx, origin);
float cosmic = CosmicBackgroundTemp(rx, origin);
// Home Stations are directional, but treated as always pointing towards the peer.
float allbody = rx.ParentNode.isHome ? AllBodyTemps(rx, origin - rx.Position) : AllBodyTemps(rx, rx.ToTarget);
// Tracking antennas always point towards the peer.
float allbody = rx.IsTracking ? AllBodyTemps(rx, origin - rx.Position) : AllBodyTemps(rx, rx.ToTarget);
float total = amt + atmos + cosmic + allbody;
// Debug.LogFormat("NoiseTemp: Antenna {0:F2} Atmos: {1:F2} Cosmic: {2:F2} Bodies: {3:F2} Total: {4:F2}", amt, atmos, cosmic, allbody, total);
return total;
Expand Down Expand Up @@ -304,7 +304,7 @@ private static float CosmicBackgroundTemp(RealAntenna rx, Vector3d origin)
temp = CosmicBackgroundTemp(new double3(normal.x, normal.y, normal.z),
new double3(to_origin.x, to_origin.y, to_origin.z),
rx.Frequency,
rxNode.isHome);
rxNode.isGroundStation);

}
return temp;
Expand All @@ -320,7 +320,7 @@ public static float AllBodyTemps(RealAntenna rx, Vector3d rxPointing)
// Note there are ~33 bodies in RSS.
foreach (CelestialBody body in FlightGlobals.Bodies)
{
if (!node.isHome || !node.ParentBody.Equals(body))
if (!node.isGroundStation || !node.ParentBody.Equals(body))
{
temp += BodyNoiseTemp(rx, body, rxPointing);
}
Expand Down
5 changes: 4 additions & 1 deletion src/RealAntennasProject/PlannerGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private void FireOnce()
var defaultPos = home.GetWorldSurfacePosition(0, 0, 100);
var defaultOffset = home.GetWorldSurfacePosition(0, 0, 1e6);
var defaultDir = (defaultOffset - defaultPos).normalized;
var offset = fixedNode.isHome ? 1e8 : 0;
var offset = ((fixedAntenna.ParentNode as RACommNode)?.isGroundStation ?? false) ? 1e8 : 0;
fixedNode.transform.SetPositionAndRotation(defaultPos + offset * defaultDir, Quaternion.identity);
primaryNearNode.transform.SetPositionAndRotation(defaultPos + (offset + distanceMin) * defaultDir, Quaternion.identity);
primaryFarNode.transform.SetPositionAndRotation(defaultPos + (offset + distanceMax) * defaultDir, Quaternion.identity);
Expand All @@ -361,6 +361,9 @@ private void FireOnce()
primaryNearNode.ParentBody = (primaryAntenna.ParentNode as RACommNode)?.ParentBody;
primaryFarNode.ParentBody = (primaryAntenna.ParentNode as RACommNode)?.ParentBody;
fixedNode.ParentBody = (fixedAntenna.ParentNode as RACommNode)?.ParentBody;
primaryNearNode.ParentVessel = (primaryAntenna.ParentNode as RACommNode)?.ParentVessel; // Copy this info over as well in case anything needs it.
primaryFarNode.ParentVessel = (primaryAntenna.ParentNode as RACommNode)?.ParentVessel;
fixedNode.ParentVessel = (fixedAntenna.ParentNode as RACommNode)?.ParentVessel;

var nodes = new List<CommNet.CommNode> { fixedNode, primaryNearNode };
var bodies = new List<CelestialBody> { Planetarium.fetch.Home };
Expand Down
2 changes: 1 addition & 1 deletion src/RealAntennasProject/Precompute/FilteringJobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Execute(int index)
int y = pairs[index].y;
CNInfo a = nodes[x];
CNInfo b = nodes[y];
valid[index] = x != y && !(a.isHome && b.isHome) && a.canComm && b.canComm;
valid[index] = x != y && !(a.isGroundStation && b.isGroundStation) && a.canComm && b.canComm;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/RealAntennasProject/Precompute/Precompute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct CNInfo
{
internal double3 position;
internal double3 surfaceNormal;
internal bool isHome;
internal bool isGroundStation;
internal bool canComm;
}

Expand Down Expand Up @@ -682,7 +682,7 @@ private void SetupCommNodes(out NativeList<CNInfo> infos, List<CommNet.CommNode>
infos.Add(new CNInfo()
{
position = new double3(node.precisePosition.x, node.precisePosition.y, node.precisePosition.z),
isHome = node.isHome,
isGroundStation = node.isGroundStation,
canComm = forceValid || node.CanComm(),
surfaceNormal = new double3(surfN.x, surfN.y, surfN.z),
//name = $"{node}",
Expand Down
4 changes: 4 additions & 0 deletions src/RealAntennasProject/RACommNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class RACommNetwork : CommNetwork
public List<CommNode> Nodes { get => nodes; }
public RealAntenna DebugAntenna => connectionDebugger?.antenna;
public Network.ConnectionDebugger connectionDebugger = null;
public readonly EventVoid NetworkUpdateComplete = new EventVoid("Network Rebuild Complete");
public double LastUpdateUT { get; private set; } = 0;

public override CommNode Add(CommNode conn)
{
Expand Down Expand Up @@ -164,6 +166,8 @@ public virtual void CompleteRebuild()
PostUpdateNodes();
if (OnNetworkPostUpdate is Action)
OnNetworkPostUpdate();
LastUpdateUT = Planetarium.GetUniversalTime();
NetworkUpdateComplete.Fire();
tempWatch.Stop();
Profiler.EndSample();
(RACommNetScenario.Instance as RACommNetScenario).metrics.AddMeasurement("Precompute LateRebuild", PrecomputeLateWatch.Elapsed.TotalMilliseconds);
Expand Down
2 changes: 2 additions & 0 deletions src/RealAntennasProject/RACommNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class RACommNode : CommNet.CommNode
public List<RealAntenna> RAAntennaList { get; set; }
public CelestialBody ParentBody { get; set; }
public Vessel ParentVessel { get; set; }
public bool isGroundStation => !(ParentBody is null);
// Skopos stations have isHome set to false, hence the need for this check.

public RACommNode() : base() { }
public RACommNode(Transform t) : base(t)
Expand Down
2 changes: 1 addition & 1 deletion src/RealAntennasProject/RealAntennasUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void VesselCounts(out int vessels, out int groundStations, out int anten
net = $"{racn}";
foreach (RACommNode node in racn.Nodes)
{
if (node.isHome)
if (node.isGroundStation)
{
groundStations++;
}
Expand Down
Loading