Ejemplo n.º 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);
  }
Ejemplo n.º 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.");
    }
  }
Ejemplo n.º 3
0
 protected FluidComponent getDestination() {
   return destinationInput.getValue();
 }
Ejemplo n.º 4
0
 public Fluid getFluid() {
   return fluidInput.getValue();
 }
Ejemplo n.º 5
0
 protected FluidComponent getSource() {
   return sourceInput.getValue();
 }