-
Notifications
You must be signed in to change notification settings - Fork 19
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
Calculate cash flow #1281
Calculate cash flow #1281
Conversation
…; branch 'main' of https://github.com/equinor/dcd into calculate-cash-flow
var values = new List<double>(); | ||
|
||
if (facilityOpex > 0) | ||
{ | ||
(facilityOpex - 1) / 8, | ||
(facilityOpex - 1) / 4, | ||
(facilityOpex - 1) / 2 | ||
}; | ||
values.Add((facilityOpex - 1) / 8); | ||
values.Add((facilityOpex - 1) / 4); | ||
values.Add((facilityOpex - 1) / 2); | ||
|
||
for (int i = firstYear; i < lastYear; i++) | ||
for (int i = firstYear; i < lastYear; i++) | ||
{ | ||
values.Add(facilityOpex); | ||
} | ||
} | ||
else | ||
{ | ||
values.Add(facilityOpex); | ||
values.AddRange(Enumerable.Repeat(0.0, lastYear - firstYear + 3)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work as intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testet, og det ser ut som det fungerer.
Task CalculateTotalIncome(Guid caseId); | ||
|
||
Task CalculateTotalCost(Guid caseId); | ||
|
||
Task<TimeSeries<double>> CalculateTotalOffshoreFacilityCostAsync(Case caseItem); | ||
|
||
Task<TimeSeries<double>> CalculateTotalDevelopmentCostAsync(Case caseItem); | ||
|
||
Task<TimeSeries<double>> CalculateTotalExplorationCostAsync(Case caseItem); | ||
|
||
TimeSeries<double> CalculateCashFlow(TimeSeries<double> income, TimeSeries<double> totalCost); | ||
Task CalculateNPV(Guid caseId); | ||
Task CalculateBreakEvenOilPrice(Guid caseId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the methods be split into their own classes and move common functionality to a static helper class?
|
||
public async Task<TimeSeries<double>> CalculateTotalDevelopmentCostAsync(Case caseItem) | ||
{ | ||
var wellProject = await _wellProjectRepository.GetWellProject(caseItem.WellProjectLink); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to include the profiles you need in GetWithIncludes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send these as parameters and you can make the method a static helper method
|
||
public async Task<TimeSeries<double>> CalculateTotalExplorationCostAsync(Case caseItem) | ||
{ | ||
var explorationCost = await _explorationRepository.GetExploration(caseItem.ExplorationLink); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to include the profiles you need in GetWithIncludes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send these as parameters and you can make the method a static helper method
var substructure = await _substructureRepository.GetSubstructure(caseItem.SubstructureLink); | ||
var surf = await _surfRepository.GetSurf(caseItem.SurfLink); | ||
var topside = await _topsideRepository.GetTopside(caseItem.TopsideLink); | ||
var transport = await _transportRepository.GetTransport(caseItem.TransportLink); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to include the profiles you need in GetWithIncludes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send these as parameters and you can make the method a static helper method
var caseItem = await _caseService.GetCaseWithIncludes( | ||
caseId, | ||
c => c.Project | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is project needed?
It seems like you are missing the cost profiles later used in study cost, opex cost
private readonly IWellProjectRepository _wellProjectRepository; | ||
private readonly ICaseService _caseService; | ||
private readonly IDrainageStrategyService _drainageStrategyService; | ||
private readonly IDrainageStrategyRepository _drainageStrategyRepository; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
No description provided.