public override int GetHashCode() { unchecked { return(((LengthUnit != null ? LengthUnit.GetHashCode() : 0) * 397) ^ (PowerUnit != null ? PowerUnit.GetHashCode() : 0)); } }
public LinearPowerLoss WithCounterUnit(PowerUnit newUnit) { // generator : FractionValuesGenerator.Add_WithCounterUnit var oldUnit = Unit.CounterUnit; if (oldUnit == newUnit) { return(this); } var oldFactor = GlobalUnitRegistry.Factors.GetThrow(oldUnit); var newFactor = GlobalUnitRegistry.Factors.GetThrow(newUnit); var resultUnit = Unit.WithCounterUnit(newUnit); return(new LinearPowerLoss(oldFactor / newFactor * Value, resultUnit)); }
/// <summary> /// Division operation, calculates value dividend/divisor with unit that derives from dividend unit /// </summary> /// <param name="energy">a dividend (counter) - a value that is being divided</param> /// <param name="time">a divisor (denominator) - a value which dividend is divided by</param> public static Power operator /(Energy energy, Time time) { // generator : MultiplyAlgebraGenerator.CreateOperator // scenario with hint // .Is<Energy, Time, Power>("/") // hint location HandleCreateOperatorCode, line 35 var energyUnit = energy.Unit; var tmp1 = energyUnit.GetSuggestedTimeUnit(); var tmp2 = PowerUnit.CratePowerUnitFromEnergyAndTime(energyUnit, tmp1); var resultUnit = tmp2; var timeConverted = time.ConvertTo(tmp1); var value = energy.Value / timeConverted.Value * tmp2.Multiplication; return(new Power(value, resultUnit)); // scenario F3 }
public static LinearPowerLoss Parse(string value) { // generator : FractionValuesGenerator.Add_Parse if (string.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } var r = CommonParse.Parse(value, typeof(LinearPowerLoss)); var units = Common.SplitUnitNameBySlash(r.UnitName); if (units.Length != 2) { throw new Exception($"{r.UnitName} is not valid LinearPowerLoss unit"); } var counterUnit = new PowerUnit(units[0]); var denominatorUnit = new LengthUnit(units[1]); return(new LinearPowerLoss(r.Value, counterUnit, denominatorUnit)); }
public ThermalResistanceUnit(LengthUnit lengthUnit, PowerUnit powerUnit) { LengthUnit = lengthUnit; PowerUnit = powerUnit; }
public LinearPowerLoss(decimal value, PowerUnit counterUnit, LengthUnit denominatorUnit) { Value = value; Unit = new LinearPowerLossUnit(counterUnit, denominatorUnit); }
public ThermalConductivityUnit(LengthUnit lengthUnit, PowerUnit powerUnit) { LengthUnit = lengthUnit; PowerUnit = powerUnit; }
public Irradiance(decimal value, PowerUnit counterUnit, AreaUnit denominatorUnit) { Value = value; Unit = new IrradianceUnit(counterUnit, denominatorUnit); }