public override string ToString() { //If we know the unit if (Unit.Symbol is object && Unit.Symbol != "") { return($"{ValueLocalUnit} {Unit}"); } //Check if we have the unit in the list foreach (var item in PowerUnit.List()) { //Debug.Print($"{this.Unit.GetTotalFactor()} == {item.Unit.GetTotalFactor()}"); if (this.Unit.GetTotalFactor() == item.Unit.GetTotalFactor()) { return($"{As(Unit)} {item.Unit}"); } } //Return unit in SI return($"{As(PowerUnit.SI)} {PowerUnit.SI.Unit}"); }
public PowerUnit(PreFix SI, PowerUnit unit) { Name = "Power"; Unit = unit.Unit.Copy(); SetCombined(SI); SetNewSymbol(SI); }
public HeatTransferCoefficientUnit(PowerUnit power, AreaUnit area, TemperatureUnit temperature, string NewSymbol = "Empty", decimal correction = 1) { Name = "HeatTransferCoefficienth"; Unit = power.Unit / (area.Unit * temperature.Unit); SetCombined(correction); SetNewSymbol(NewSymbol, $"{power}/{area}{temperature}"); }
public ThermalResistanceUnit(AreaUnit area, TemperatureUnit temperature, PowerUnit power, string NewSymbol = "Empty", decimal correction = 1) { Name = "ThermalResistanceh"; Unit = (area.Unit * temperature.Unit) / power.Unit; SetCombined(correction); SetNewSymbol(NewSymbol, $"{area}{temperature}/{power}"); }
public EnergyUnit(PowerUnit power, DurationUnit duration, string NewSymbol = "Empty", decimal correction = 1) { Name = "Energy"; Unit = power.Unit * duration.Unit; SetCombined(correction); SetNewSymbol(NewSymbol, $"{power}{duration}"); }
public static ThermalConductivityUnit BtuPerHourFootFahrenheit = new ThermalConductivityUnit(PowerUnit.BritishThermalUnitPerHour, LengthUnit.Foot, TemperatureUnit.DegreeRankine, "BTU/h·ft·°F"); //Not sure this is correct in UnitNets public ThermalConductivityUnit(PowerUnit power, LengthUnit length, TemperatureUnit temperature, string NewSymbol = "Empty", decimal correction = 1) { Name = "ThermalConductivity"; Unit = power.Unit / (length.Unit * temperature.Unit); SetCombined(correction); SetNewSymbol(NewSymbol, $"{power}/{length}·{temperature}"); }
public Power ToUnit(PowerUnit selectedUnit) => new Power(ToTheOutSide(selectedUnit.Unit), selectedUnit);
public double As(PowerUnit ReturnInThisUnit) => (double)ToTheOutSide(ReturnInThisUnit.Unit);
public static Power From(double value, PowerUnit unit) => new Power(value, unit);
public Power(int value, PowerUnit selectedUnit) : base(value, selectedUnit.Unit) { }
public Power(double value, PowerUnit selectedUnit) : base(value, selectedUnit.Unit) { }
public Power(decimal value, PowerUnit selectedUnit) : base(value, selectedUnit.Unit) { }