예제 #1
0
  @Override
  public void update(double simTime) {

    double dt = simTime - lastUpdateTime;
    lastUpdateTime = simTime;

    // Update the volume stored at the source and destination
    FluidComponent source = sourceInput.getValue();
    FluidComponent destination = destinationInput.getValue();
    double dV = flowRate * dt;
    if (dV > 0.0 && source != null) {
      dV = Math.min(dV, source.getFluidVolume());
    } else if (dV < 0.0 && destination != null) {
      dV = -Math.min(-dV, destination.getFluidVolume());
    }
    if (source != null) {
      source.addVolume(-dV);
    }
    if (destination != null) {
      destination.addVolume(dV);
    }

    // Set the new flow rate
    this.calcFlowRate(source, destination, dt);
  }
예제 #2
0
  @Override
  public void validate() {
    super.validate();

    // Confirm that the fluid has been specified
    if (fluidInput.getValue() == null) {
      throw new InputErrorException("The keyword Fluid must be set.");
    }
  }
예제 #3
0
 protected FluidComponent getDestination() {
   return destinationInput.getValue();
 }
예제 #4
0
 public Fluid getFluid() {
   return fluidInput.getValue();
 }
예제 #5
0
 protected FluidComponent getSource() {
   return sourceInput.getValue();
 }