/*
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2013 Ausenco Engineering Canada Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
package com.jaamsim.FluidObjects;

import com.sandwell.JavaSimulation.DoubleInput;
import com.sandwell.JavaSimulation.Keyword;
import com.sandwell.JavaSimulation3D.DisplayEntity;

/**
 * Fluid defines the properties of the fluid being used in a hydraulic calculation.
 * @author Harry King
 *
 */
public class Fluid extends DisplayEntity {

	@Keyword(desc = "The density of the fluid (default = water).",
	         example = "Fluid1 Density { 1000 kg/m3 }")
	private final DoubleInput densityInput;

	@Keyword(desc = "The dynamic viscosity of the fluid (default = water).",
	         example = "Fluid1 Viscosity { 0.001002 Pa-s }")
	private final DoubleInput viscosityInput;

	@Keyword(desc = "The acceleration of gravity.",
	         example = "Fluid1 Gravity { 9.81 m/s2 }")
	private final DoubleInput gravityInput;

	{
		densityInput = new DoubleInput( "Density", "Key Inputs", 1000.0d);
		densityInput.setValidRange( 0.0, Double.POSITIVE_INFINITY);
		densityInput.setUnits( "kg/m3");
		this.addInput( densityInput, true);

		viscosityInput = new DoubleInput( "Viscosity", "Key Inputs", 0.001002d);
		viscosityInput.setValidRange( 0.0, Double.POSITIVE_INFINITY);
		viscosityInput.setUnits( "Pa-s");
		this.addInput( viscosityInput, true);

		gravityInput = new DoubleInput( "Gravity", "Key Inputs", 9.81d);
		gravityInput.setValidRange( 0.0, Double.POSITIVE_INFINITY);
		gravityInput.setUnits( "m/s2");
		this.addInput( gravityInput, true);
	}

	public double getDensity() {
		return densityInput.getValue();
	}

	public double getViscosity() {
		return viscosityInput.getValue();
	}

	public double getGravity() {
		return gravityInput.getValue();
	}

	public double getDensityxGravity() {
		return densityInput.getValue() * gravityInput.getValue();
	}

	public double getKinematicViscosity() {
		return viscosityInput.getValue() / densityInput.getValue();
	}
}

@@ -630,16 +630,97 @@
 jects;%0A%0A
+import com.jaamsim.math.Color4d;%0Aimport com.sandwell.JavaSimulation.ColourInput;%0A
 import c
@@ -755,24 +755,24 @@
 oubleInput;%0A
-
 import com.s
@@ -1344,32 +1344,211 @@
 iscosityInput;%0A%0A
+%09@Keyword(desc = %22The colour of the product, defined using a colour keyword or RGB values.%22,%0A%09         example = %22Fluid1 Colour %7B red %7D%22)%0A%09private final ColourInput colourInput;%0A%0A
 %09@Keyword(desc =
@@ -2098,16 +2098,137 @@
 true);%0A%0A
+%09%09colourInput = new ColourInput( %22Colour%22, %22Key Inputs%22, ColourInput.RED);%0A%09%09this.addInput(colourInput, true, %22Color%22);%0A%0A
 %09%09gravit
@@ -2516,32 +2516,32 @@
 etViscosity() %7B%0A
-
 %09%09return viscosi
@@ -2556,32 +2556,99 @@
 getValue();%0A%09%7D%0A%0A
+%09public Color4d getColour() %7B%0A%09%09return colourInput.getValue();%0A%09%7D%0A%0A
 %09public double g

Add keyword "Colour" to Fluid