// MyBWRSimulator.Core/Ports/FluidPort.cs
namespace MyBWRSimulator.Core.Ports
{
//using MyBWRSimulator.Core.Components.Enums;
using MyBWRSimulator.Core.Components.Abstract;
///
/// Represents a fluid connection point on a component.
///
public class FluidPort : Port
{
///
/// Current fluid flow rate through this port (e.g., kg/s).
///
public double FlowRate { get; set; }
///
/// Current fluid pressure at this port (e.g., Pa).
///
public double Pressure { get; set; }
///
/// Current fluid temperature at this port (e.g., K or C).
///
public double Temperature { get; set; }
///
/// Current volume of fluid within the port itself (optional, for more detailed modeling).
///
public double CurrentVolume { get; set; }
///
/// Constructor for a FluidPort.
///
/// Unique identifier for the port.
/// The type of fluid port (Inlet or Outlet).
public FluidPort(string id) : base(id)
{
FlowRate = 0.0;
Pressure = 0.0;
Temperature = 0.0;
CurrentVolume = 0.0;
}
///
/// Connects this fluid port to another fluid port.
/// Includes basic type checking.
///
/// The port to connect to.
public override void Connect(Port otherPort)
{
base.Connect(otherPort);
}
///
/// Mirrors fluid properties from this port to its connected port.
/// This is for the direct property assignment data flow model.
///
public void MirrorToConnectedPort()
{
if (ConnectedPort is FluidPort connectedFluidPort)
{
connectedFluidPort.FlowRate = this.FlowRate;
connectedFluidPort.Pressure = this.Pressure;
connectedFluidPort.Temperature = this.Temperature;
// Optionally, mirror CurrentVolume if applicable
// connectedFluidPort.CurrentVolume = this.CurrentVolume;
}
}
}
}