Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Flow.CubicDecimeterPerMinute #169

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UnitsNet.Tests/CustomCode/FlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class FlowTests : FlowTestsBase
{
protected override double CubicMetersPerHourInOneCubicMeterPerSecond => 3600.0;

protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000;

protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666213;

protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond => 22.824465227;
Expand Down
2 changes: 2 additions & 0 deletions UnitsNet.Tests/CustomCode/MassFlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class MassFlowTests : MassFlowTestsBase

protected override double HectogramsPerSecondInOneGramPerSecond => 1E-2;

protected override double KilogramsPerHourInOneGramPerSecond => 3.6;

protected override double KilogramsPerSecondInOneGramPerSecond => 1E-3;

protected override double DecigramsPerSecondInOneGramPerSecond => 1E1;
Expand Down
6 changes: 6 additions & 0 deletions UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace UnitsNet.Tests
public abstract partial class FlowTestsBase
{
protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; }
protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; }
protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; }
Expand All @@ -51,6 +52,7 @@ public abstract partial class FlowTestsBase

// ReSharper disable VirtualMemberNeverOverriden.Global
protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } }
protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } }
protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } }
Expand All @@ -69,6 +71,7 @@ public void CubicMeterPerSecondToFlowUnits()
{
Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1);
Assert.AreEqual(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance);
Assert.AreEqual(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance);
Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance);
Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance);
Expand All @@ -86,6 +89,7 @@ public void CubicMeterPerSecondToFlowUnits()
public void FromValueAndUnit()
{
Assert.AreEqual(1, Flow.From(1, FlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance);
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
Expand All @@ -104,6 +108,7 @@ public void As()
{
var cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1);
Assert.AreEqual(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance);
Assert.AreEqual(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance);
Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance);
Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance);
Expand All @@ -122,6 +127,7 @@ public void ConversionRoundTrip()
{
Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1);
Assert.AreEqual(1, Flow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance);
Assert.AreEqual(1, Flow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance);
Assert.AreEqual(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance);
Assert.AreEqual(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance);
Assert.AreEqual(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
Expand Down
6 changes: 6 additions & 0 deletions UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public abstract partial class MassFlowTestsBase
protected abstract double DecigramsPerSecondInOneGramPerSecond { get; }
protected abstract double GramsPerSecondInOneGramPerSecond { get; }
protected abstract double HectogramsPerSecondInOneGramPerSecond { get; }
protected abstract double KilogramsPerHourInOneGramPerSecond { get; }
protected abstract double KilogramsPerSecondInOneGramPerSecond { get; }
protected abstract double MicrogramsPerSecondInOneGramPerSecond { get; }
protected abstract double MilligramsPerSecondInOneGramPerSecond { get; }
Expand All @@ -53,6 +54,7 @@ public abstract partial class MassFlowTestsBase
protected virtual double DecigramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double GramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double HectogramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double KilogramsPerHourTolerance { get { return 1e-5; } }
protected virtual double KilogramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double MicrogramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double MilligramsPerSecondTolerance { get { return 1e-5; } }
Expand All @@ -69,6 +71,7 @@ public void GramPerSecondToMassFlowUnits()
Assert.AreEqual(DecigramsPerSecondInOneGramPerSecond, grampersecond.DecigramsPerSecond, DecigramsPerSecondTolerance);
Assert.AreEqual(GramsPerSecondInOneGramPerSecond, grampersecond.GramsPerSecond, GramsPerSecondTolerance);
Assert.AreEqual(HectogramsPerSecondInOneGramPerSecond, grampersecond.HectogramsPerSecond, HectogramsPerSecondTolerance);
Assert.AreEqual(KilogramsPerHourInOneGramPerSecond, grampersecond.KilogramsPerHour, KilogramsPerHourTolerance);
Assert.AreEqual(KilogramsPerSecondInOneGramPerSecond, grampersecond.KilogramsPerSecond, KilogramsPerSecondTolerance);
Assert.AreEqual(MicrogramsPerSecondInOneGramPerSecond, grampersecond.MicrogramsPerSecond, MicrogramsPerSecondTolerance);
Assert.AreEqual(MilligramsPerSecondInOneGramPerSecond, grampersecond.MilligramsPerSecond, MilligramsPerSecondTolerance);
Expand All @@ -84,6 +87,7 @@ public void FromValueAndUnit()
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.DecigramPerSecond).DecigramsPerSecond, DecigramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.GramPerSecond).GramsPerSecond, GramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.HectogramPerSecond).HectogramsPerSecond, HectogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.KilogramPerHour).KilogramsPerHour, KilogramsPerHourTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.KilogramPerSecond).KilogramsPerSecond, KilogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.MicrogramPerSecond).MicrogramsPerSecond, MicrogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance);
Expand All @@ -100,6 +104,7 @@ public void As()
Assert.AreEqual(DecigramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.DecigramPerSecond), DecigramsPerSecondTolerance);
Assert.AreEqual(GramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.GramPerSecond), GramsPerSecondTolerance);
Assert.AreEqual(HectogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.HectogramPerSecond), HectogramsPerSecondTolerance);
Assert.AreEqual(KilogramsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerHour), KilogramsPerHourTolerance);
Assert.AreEqual(KilogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerSecond), KilogramsPerSecondTolerance);
Assert.AreEqual(MicrogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MicrogramPerSecond), MicrogramsPerSecondTolerance);
Assert.AreEqual(MilligramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MilligramPerSecond), MilligramsPerSecondTolerance);
Expand All @@ -116,6 +121,7 @@ public void ConversionRoundTrip()
Assert.AreEqual(1, MassFlow.FromDecigramsPerSecond(grampersecond.DecigramsPerSecond).GramsPerSecond, DecigramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromGramsPerSecond(grampersecond.GramsPerSecond).GramsPerSecond, GramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromHectogramsPerSecond(grampersecond.HectogramsPerSecond).GramsPerSecond, HectogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromKilogramsPerHour(grampersecond.KilogramsPerHour).GramsPerSecond, KilogramsPerHourTolerance);
Assert.AreEqual(1, MassFlow.FromKilogramsPerSecond(grampersecond.KilogramsPerSecond).GramsPerSecond, KilogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromMicrogramsPerSecond(grampersecond.MicrogramsPerSecond).GramsPerSecond, MicrogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance);
Expand Down
1 change: 1 addition & 0 deletions UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum FlowUnit
{
Undefined = 0,
CentilitersPerMinute,
CubicDecimeterPerMinute,
CubicFootPerSecond,
CubicMeterPerHour,
CubicMeterPerSecond,
Expand Down
1 change: 1 addition & 0 deletions UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public enum MassFlowUnit
DecigramPerSecond,
GramPerSecond,
HectogramPerSecond,
KilogramPerHour,
KilogramPerSecond,
MicrogramPerSecond,
MilligramPerSecond,
Expand Down
37 changes: 37 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ public double CentilitersPerMinute
get { return (_cubicMetersPerSecond*60000.00000) / 1e-2d; }
}

/// <summary>
/// Get Flow in CubicDecimetersPerMinute.
/// </summary>
public double CubicDecimetersPerMinute
{
get { return _cubicMetersPerSecond*60000.00000; }
}

/// <summary>
/// Get Flow in CubicFeetPerSecond.
/// </summary>
Expand Down Expand Up @@ -206,6 +214,14 @@ public static Flow FromCentilitersPerMinute(double centilitersperminute)
return new Flow((centilitersperminute/60000.00000) * 1e-2d);
}

/// <summary>
/// Get Flow from CubicDecimetersPerMinute.
/// </summary>
public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute)
{
return new Flow(cubicdecimetersperminute/60000.00000);
}

/// <summary>
/// Get Flow from CubicFeetPerSecond.
/// </summary>
Expand Down Expand Up @@ -310,6 +326,21 @@ public static Flow FromUsGallonsPerMinute(double usgallonsperminute)
}
}

/// <summary>
/// Get nullable Flow from nullable CubicDecimetersPerMinute.
/// </summary>
public static Flow? FromCubicDecimetersPerMinute(double? cubicdecimetersperminute)
{
if (cubicdecimetersperminute.HasValue)
{
return FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value);
}
else
{
return null;
}
}

/// <summary>
/// Get nullable Flow from nullable CubicFeetPerSecond.
/// </summary>
Expand Down Expand Up @@ -489,6 +520,8 @@ public static Flow From(double val, FlowUnit fromUnit)
{
case FlowUnit.CentilitersPerMinute:
return FromCentilitersPerMinute(val);
case FlowUnit.CubicDecimeterPerMinute:
return FromCubicDecimetersPerMinute(val);
case FlowUnit.CubicFootPerSecond:
return FromCubicFeetPerSecond(val);
case FlowUnit.CubicMeterPerHour:
Expand Down Expand Up @@ -534,6 +567,8 @@ public static Flow From(double val, FlowUnit fromUnit)
{
case FlowUnit.CentilitersPerMinute:
return FromCentilitersPerMinute(value.Value);
case FlowUnit.CubicDecimeterPerMinute:
return FromCubicDecimetersPerMinute(value.Value);
case FlowUnit.CubicFootPerSecond:
return FromCubicFeetPerSecond(value.Value);
case FlowUnit.CubicMeterPerHour:
Expand Down Expand Up @@ -712,6 +747,8 @@ public double As(FlowUnit unit)
{
case FlowUnit.CentilitersPerMinute:
return CentilitersPerMinute;
case FlowUnit.CubicDecimeterPerMinute:
return CubicDecimetersPerMinute;
case FlowUnit.CubicFootPerSecond:
return CubicFeetPerSecond;
case FlowUnit.CubicMeterPerHour:
Expand Down
37 changes: 37 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ public double HectogramsPerSecond
get { return (_gramsPerSecond) / 1e2d; }
}

/// <summary>
/// Get MassFlow in KilogramsPerHour.
/// </summary>
public double KilogramsPerHour
{
get { return _gramsPerSecond*3.6; }
}

/// <summary>
/// Get MassFlow in KilogramsPerSecond.
/// </summary>
Expand Down Expand Up @@ -222,6 +230,14 @@ public static MassFlow FromHectogramsPerSecond(double hectogramspersecond)
return new MassFlow((hectogramspersecond) * 1e2d);
}

/// <summary>
/// Get MassFlow from KilogramsPerHour.
/// </summary>
public static MassFlow FromKilogramsPerHour(double kilogramsperhour)
{
return new MassFlow(kilogramsperhour/3.6);
}

/// <summary>
/// Get MassFlow from KilogramsPerSecond.
/// </summary>
Expand Down Expand Up @@ -338,6 +354,21 @@ public static MassFlow FromTonnesPerDay(double tonnesperday)
}
}

/// <summary>
/// Get nullable MassFlow from nullable KilogramsPerHour.
/// </summary>
public static MassFlow? FromKilogramsPerHour(double? kilogramsperhour)
{
if (kilogramsperhour.HasValue)
{
return FromKilogramsPerHour(kilogramsperhour.Value);
}
else
{
return null;
}
}

/// <summary>
/// Get nullable MassFlow from nullable KilogramsPerSecond.
/// </summary>
Expand Down Expand Up @@ -435,6 +466,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit)
return FromGramsPerSecond(val);
case MassFlowUnit.HectogramPerSecond:
return FromHectogramsPerSecond(val);
case MassFlowUnit.KilogramPerHour:
return FromKilogramsPerHour(val);
case MassFlowUnit.KilogramPerSecond:
return FromKilogramsPerSecond(val);
case MassFlowUnit.MicrogramPerSecond:
Expand Down Expand Up @@ -476,6 +509,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit)
return FromGramsPerSecond(value.Value);
case MassFlowUnit.HectogramPerSecond:
return FromHectogramsPerSecond(value.Value);
case MassFlowUnit.KilogramPerHour:
return FromKilogramsPerHour(value.Value);
case MassFlowUnit.KilogramPerSecond:
return FromKilogramsPerSecond(value.Value);
case MassFlowUnit.MicrogramPerSecond:
Expand Down Expand Up @@ -650,6 +685,8 @@ public double As(MassFlowUnit unit)
return GramsPerSecond;
case MassFlowUnit.HectogramPerSecond:
return HectogramsPerSecond;
case MassFlowUnit.KilogramPerHour:
return KilogramsPerHour;
case MassFlowUnit.KilogramPerSecond:
return KilogramsPerSecond;
case MassFlowUnit.MicrogramPerSecond:
Expand Down
12 changes: 12 additions & 0 deletions UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ private static readonly ReadOnlyCollection<UnitLocalization> DefaultLocalization
{
new AbbreviationsForCulture("en-US", "cLPM"),
}),
new CulturesForEnumValue((int) FlowUnit.CubicDecimeterPerMinute,
new[]
{
new AbbreviationsForCulture("en-US", "dm³/min"),
new AbbreviationsForCulture("ru-RU", "дм³/мин"),
}),
new CulturesForEnumValue((int) FlowUnit.CubicFootPerSecond,
new[]
{
Expand Down Expand Up @@ -1179,6 +1185,12 @@ private static readonly ReadOnlyCollection<UnitLocalization> DefaultLocalization
{
new AbbreviationsForCulture("en-US", "hg/S"),
}),
new CulturesForEnumValue((int) MassFlowUnit.KilogramPerHour,
new[]
{
new AbbreviationsForCulture("en-US", "kg/h"),
new AbbreviationsForCulture("ru-RU", "кг/ч"),
}),
new CulturesForEnumValue((int) MassFlowUnit.KilogramPerSecond,
new[]
{
Expand Down
20 changes: 18 additions & 2 deletions UnitsNet/Scripts/UnitDefinitions/Flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
"PluralName": "LitersPerMinute",
"FromUnitToBaseFunc": "x/60000.00000",
"FromBaseToUnitFunc": "x*60000.00000",
"Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo"],
"Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo" ],
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "LPM" ],
"AbbreviationsWithPrefixes": ["nLPM", "μLPM", "mLPM", "cLPM", "dLPM", "kLPM"]
"AbbreviationsWithPrefixes": [ "nLPM", "μLPM", "mLPM", "cLPM", "dLPM", "kLPM" ]
}
]
},
Expand All @@ -84,6 +84,22 @@
"Abbreviations": [ "GPM" ]
}
]
},
{
"SingularName": "CubicDecimeterPerMinute",
"PluralName": "CubicDecimetersPerMinute",
"FromUnitToBaseFunc": "x/60000.00000",
"FromBaseToUnitFunc": "x*60000.00000",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "dm³/min" ]
},
{
"Culture": "ru-RU",
"Abbreviations": [ "дм³/мин" ]
}
]
}
]
}
Loading