Skip to content

Commit

Permalink
New Topside variable 'WaterInjectionCapacity' (#817)
Browse files Browse the repository at this point in the history
Added new property in Topside model and mapped it for import in prospservice
  • Loading branch information
ahmedoabdi authored Oct 28, 2022
1 parent dacaf1b commit 0850cc6
Show file tree
Hide file tree
Showing 13 changed files with 2,005 additions and 58 deletions.
16 changes: 11 additions & 5 deletions backend/api/Adapters/TopsideAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static Topside Convert(TopsideDto topsideDto)
DryWeight = topsideDto.DryWeight,
OilCapacity = topsideDto.OilCapacity,
GasCapacity = topsideDto.GasCapacity,
WaterInjectionCapacity = topsideDto.WaterInjectionCapacity,
ArtificialLift = topsideDto.ArtificialLift,
Maturity = topsideDto.Maturity,
Currency = topsideDto.Currency,
Expand All @@ -36,7 +37,7 @@ public static Topside Convert(TopsideDto topsideDto)
ApprovedBy = topsideDto.ApprovedBy,
DG3Date = topsideDto.DG3Date,
DG4Date = topsideDto.DG4Date,
FacilityOpex = topsideDto.FacilityOpex
FacilityOpex = topsideDto.FacilityOpex,
};

if (topsideDto.CostProfile != null)
Expand All @@ -60,6 +61,7 @@ public static void ConvertExisting(Topside existing, TopsideDto topsideDto)
existing.DryWeight = topsideDto.DryWeight;
existing.OilCapacity = topsideDto.OilCapacity;
existing.GasCapacity = topsideDto.GasCapacity;
existing.WaterInjectionCapacity = topsideDto.WaterInjectionCapacity;
existing.ArtificialLift = topsideDto.ArtificialLift;
existing.Maturity = topsideDto.Maturity;
existing.Currency = topsideDto.Currency;
Expand All @@ -85,39 +87,43 @@ public static void ConvertExisting(Topside existing, TopsideDto topsideDto)
existing.DG4Date = topsideDto.DG4Date;
existing.FacilityOpex = topsideDto.FacilityOpex;
}

private static TopsideCostProfile? Convert(TopsideCostProfileDto? costprofile, Topside topside)
{
if (costprofile == null)
{
return null;
}

var topsideCostProfile = new TopsideCostProfile
{
Id = costprofile.Id,
Currency = costprofile.Currency,
EPAVersion = costprofile.EPAVersion,
Topside = topside,
StartYear = costprofile.StartYear,
Values = costprofile.Values
Values = costprofile.Values,
};

return topsideCostProfile;
}

private static TopsideCessationCostProfile? Convert(TopsideCessationCostProfileDto? topsideCessationCostProfileDto, Topside topside)
private static TopsideCessationCostProfile? Convert(TopsideCessationCostProfileDto? topsideCessationCostProfileDto,
Topside topside)
{
if (topsideCessationCostProfileDto == null)
{
return null;
}
TopsideCessationCostProfile topsideCessationCostProfile = new TopsideCessationCostProfile

var topsideCessationCostProfile = new TopsideCessationCostProfile
{
Id = topsideCessationCostProfileDto.Id,
Currency = topsideCessationCostProfileDto.Currency,
EPAVersion = topsideCessationCostProfileDto.EPAVersion,
Topside = topside,
StartYear = topsideCessationCostProfileDto.StartYear,
Values = topsideCessationCostProfileDto.Values
Values = topsideCessationCostProfileDto.Values,
};

return topsideCessationCostProfile;
Expand Down
9 changes: 5 additions & 4 deletions backend/api/Adapters/TopsideDtoAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static TopsideDto Convert(Topside topside)
DryWeight = topside.DryWeight,
OilCapacity = topside.OilCapacity,
GasCapacity = topside.GasCapacity,
WaterInjectionCapacity = topside.WaterInjectionCapacity,
ArtificialLift = topside.ArtificialLift,
Maturity = topside.Maturity,
Currency = topside.Currency,
Expand All @@ -38,7 +39,7 @@ public static TopsideDto Convert(Topside topside)
ApprovedBy = topside.ApprovedBy,
DG3Date = topside.DG3Date,
DG4Date = topside.DG4Date,
FacilityOpex = topside.FacilityOpex
FacilityOpex = topside.FacilityOpex,
};
return topsideDto;
}
Expand All @@ -56,7 +57,7 @@ public static TopsideDto Convert(Topside topside)
Currency = costProfile.Currency,
EPAVersion = costProfile.EPAVersion,
Values = costProfile.Values,
StartYear = costProfile.StartYear
StartYear = costProfile.StartYear,
};
return topsideCostProfile;
}
Expand All @@ -68,13 +69,13 @@ public static TopsideDto Convert(Topside topside)
return null;
}

TopsideCessationCostProfileDto topsideCostProfile = new TopsideCessationCostProfileDto
var topsideCostProfile = new TopsideCessationCostProfileDto
{
Id = topsideCessationCostProfile.Id,
Currency = topsideCessationCostProfile.Currency,
EPAVersion = topsideCessationCostProfile.EPAVersion,
Values = topsideCessationCostProfile.Values,
StartYear = topsideCessationCostProfile.StartYear
StartYear = topsideCessationCostProfile.StartYear,
};
return topsideCostProfile;
}
Expand Down
4 changes: 1 addition & 3 deletions backend/api/Dtos/TopsideDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace api.Dtos;

public class TopsideDto
{

public Guid Id { get; set; }
public string Name { get; set; } = string.Empty!;
public Guid ProjectId { get; set; }
Expand All @@ -13,6 +12,7 @@ public class TopsideDto
public double DryWeight { get; set; }
public double OilCapacity { get; set; }
public double GasCapacity { get; set; }
public double WaterInjectionCapacity { get; set; }
public ArtificialLift ArtificialLift { get; set; }
public Maturity Maturity { get; set; }
public Currency Currency { get; set; }
Expand All @@ -39,10 +39,8 @@ public class TopsideDto

public class TopsideCostProfileDto : TimeSeriesCostDto
{

}

public class TopsideCessationCostProfileDto : TimeSeriesCostDto
{

}
8 changes: 4 additions & 4 deletions backend/api/Helpers/EmissionCalculationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class EmissionCalculationHelper
private const int DailyEmissionFromDrillingRig = 100;
private const int DaysInLeapYear = 366;
private const int DaysInYear = 365;
private const int ConversionFactor = 1000;
private const int ConversionFactorFromMtoG = 1000;

public static TimeSeries<double> CalculateTotalFuelConsumptions(Case caseItem, Topside topside,
DrainageStrategy drainageStrategy)
Expand All @@ -28,7 +28,7 @@ public static TimeSeries<double> CalculateTotalFuelConsumptions(Case caseItem, T
var year = caseItem.DG4Date.Year + i;
var calendarDays = DateTime.IsLeapYear(year) ? DaysInLeapYear : DaysInYear;

var fuelGasConsumption = productionEfficiency * fuelGasConsumptionMax * calendarDays / ConversionFactor;
var fuelGasConsumption = productionEfficiency * fuelGasConsumptionMax * calendarDays / ConversionFactorFromMtoG;

valuesList.Add(fuelGasConsumption);
}
Expand Down Expand Up @@ -136,7 +136,7 @@ private static TimeSeriesVolume CalculatedOilRatesInFlaring(DrainageStrategy dra
}

var oilRates = drainageStrategy.ProductionProfileOil.Values;
oilValues.AddRange(oilRates.Select(oilValue => oilValue * FlaredGasPerProducedVolume / ConversionFactor));
oilValues.AddRange(oilRates.Select(oilValue => oilValue * FlaredGasPerProducedVolume / ConversionFactorFromMtoG));

return new TimeSeriesVolume
{
Expand All @@ -154,7 +154,7 @@ private static TimeSeriesVolume CalculatedGasRatesInFlaring(DrainageStrategy dra
}

var gasRates = drainageStrategy.ProductionProfileGas.Values;
gasValues.AddRange(gasRates.Select(gasValue => gasValue * FlaredGasPerProducedVolume / ConversionFactor));
gasValues.AddRange(gasRates.Select(gasValue => gasValue * FlaredGasPerProducedVolume / ConversionFactorFromMtoG));

return new TimeSeriesVolume
{
Expand Down
11 changes: 6 additions & 5 deletions backend/api/Helpers/ProspImportSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ namespace api.Helpers;

public class Prosp
{
public SubStructure SubStructure;
public Surf Surf;
public TopSide TopSide;
public Transport Transport;

public Prosp()
{
Surf = new Surf();
TopSide = new TopSide();
SubStructure = new SubStructure();
Transport = new Transport();

}
public Surf Surf;
public TopSide TopSide;
public SubStructure SubStructure;
public Transport Transport;
}

public class Surf
Expand Down Expand Up @@ -47,6 +47,7 @@ public class TopSide
public string flaredGas { get; set; } = null!;
public string oilCapacity { get; set; } = null!;
public string gasCapacity { get; set; } = null!;
public string waterInjectionCapacity { get; set; } = null!;
public string producerCount { get; set; } = null!;
public string waterInjectorCount { get; set; } = null!;
public string gasInjectorCount { get; set; } = null!;
Expand Down
Loading

0 comments on commit 0850cc6

Please sign in to comment.