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

Calculate cash flow #1281

Merged
merged 86 commits into from
Oct 16, 2024
Merged

Calculate cash flow #1281

merged 86 commits into from
Oct 16, 2024

Conversation

JonasABach
Copy link
Contributor

No description provided.

backend/api/Helpers/EconomicsCalculationHelper.cs Outdated Show resolved Hide resolved
backend/api/Context/DcdDbContext.cs Outdated Show resolved Hide resolved
backend/api/Context/DcdDbContext.cs Outdated Show resolved Hide resolved
backend/api/Context/DcdDbContext.cs Outdated Show resolved Hide resolved
backend/api/Context/DcdDbContext.cs Outdated Show resolved Hide resolved
backend/api/Repositories/Case/CaseTimeSeriesRepository.cs Outdated Show resolved Hide resolved
backend/api/Repositories/Case/CaseTimeSeriesRepository.cs Outdated Show resolved Hide resolved
backend/api/Repositories/Case/CaseTimeSeriesRepository.cs Outdated Show resolved Hide resolved
Comment on lines +157 to 173
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));
}
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Comment on lines 10 to 22
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);
Copy link
Contributor

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);
Copy link
Contributor

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

Copy link
Contributor

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);
Copy link
Contributor

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

Copy link
Contributor

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

Comment on lines 541 to 544
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);
Copy link
Contributor

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

Copy link
Contributor

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

Comment on lines 139 to 142
var caseItem = await _caseService.GetCaseWithIncludes(
caseId,
c => c.Project
);
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@JonasABach JonasABach merged commit 66568a6 into equinor:main Oct 16, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants