153 lines
6.5 KiB
Plaintext
153 lines
6.5 KiB
Plaintext
@page "/"
|
|
@using Radzen
|
|
@using Radzen.Blazor
|
|
@using BattSim.Models
|
|
@using BattSim.Services
|
|
|
|
<PageTitle>Energie Simulator</PageTitle>
|
|
|
|
<h1>Energie Simulator</h1>
|
|
|
|
<h2>Je Fluvius Energie Data</h2>
|
|
<div>
|
|
<p>Ga naar de website van Fluvius en download je historische elektriciteitsverbruiksgegevens met kwartier nauwkeurigheid. Voor een optimale simulatie is het raadzaam om een volledig jaar te downloaden. Dit geeft je inzicht in seizoensgebonden patronen en helpt om realistische uitkomsten te genereren.</p>
|
|
<InputFile OnChange="OnFileUploaded" accept=".csv"/>
|
|
@if (_isLoadingFile) { <p>Data aan het inladen...</p> }
|
|
else
|
|
{
|
|
@if (FluviusDataRaw.Length != 0)
|
|
{
|
|
<p>@(FluviusDataRaw.Length) kwartieren ingeladen.</p>
|
|
}
|
|
|
|
@if (FluviusDataDaily.Length != 0)
|
|
{
|
|
<RadzenChart>
|
|
<RadzenAreaSeries Smooth=true Data="@FluviusDataDaily" CategoryProperty="Time" Title="Consumption" ValueProperty="Consumption">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenAreaSeries Smooth=true Data="@FluviusDataDaily" CategoryProperty="Time" Title="Production" ValueProperty="Production">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenCategoryAxis Formatter="@FormatObject" Padding="20" LabelAutoRotation="-45">
|
|
<RadzenGridLines Visible="true"/>
|
|
<RadzenAxisTitle Text="Time"/>
|
|
</RadzenCategoryAxis>
|
|
<RadzenValueAxis Formatter="@FormatObject">
|
|
<RadzenGridLines Visible="true"/>
|
|
<RadzenAxisTitle Text="Energy"/>
|
|
</RadzenValueAxis>
|
|
</RadzenChart>
|
|
}
|
|
}
|
|
</div>
|
|
|
|
@code{
|
|
EnergyData[] FluviusDataRaw = [];
|
|
EnergyData[] FluviusDataDaily = [];
|
|
bool _isLoadingFile = false;
|
|
|
|
private async Task OnFileUploaded(InputFileChangeEventArgs e)
|
|
{
|
|
var file = e.File;
|
|
if (file.ContentType != "text/csv")
|
|
{
|
|
Console.WriteLine("Only CSV files are allowed!");
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
Console.WriteLine("Reading csv file...");
|
|
_isLoadingFile = true;
|
|
StateHasChanged();
|
|
FluviusDataRaw = await FluviusDataHandler.LoadAndProcessFile(file);
|
|
FluviusDataDaily = FluviusDataHandler.GenerateDailyData(FluviusDataRaw);
|
|
_isLoadingFile = false;
|
|
StateHasChanged();
|
|
Console.WriteLine("Done reading csv file!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine($"Error loading file: {ex.Message}");
|
|
}
|
|
}
|
|
|
|
private void OnSeriesClick(){}
|
|
private string FormatObject(object value) {
|
|
if(value is double d) return $"{d:0.##} kWh";
|
|
if(value is DateTime time) return time.ToString("dd/MM/yyyy");
|
|
if(value is DateOnly date) return date.ToString("dd/MM/yyyy");
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
<h2>Batterij Simulatie</h2>
|
|
<div>
|
|
<p>
|
|
Met je Fluvius-kwartierdata simuleren we een batterij die elk kwartier de energie die normaal op het elektriciteitsnet wordt teruggeleverd, opvangt en de stroom die normaal uit het net wordt gehaald vervangt—mits de batterij nog voldoende capaciteit heeft.
|
|
Op deze manier kun je verschillende batterijcapaciteiten testen om te zien welke installatie het beste past bij jouw verbruiksprofiel en besparingsdoelen. Daarnaast kun je onderzoeken hoe verschillende batterijtypes, met uiteenlopende efficiëntieniveaus, de uitkomsten beïnvloeden. Onder efficiëntie verstaan we hier het aandeel van de opgeslagen energie dat uiteindelijk ook daadwerkelijk weer kan worden gebruikt.
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<p>Batterijcapaciteit: <InputNumber @bind-value="BatteryCapacity"/> kWh</p>
|
|
</li>
|
|
<li>
|
|
<p>Round-trip Efficiëntie: <InputNumber @bind-value="Efficiency"/> %</p>
|
|
</li>
|
|
</ul>
|
|
<Button @onclick="SimulateBattery">Simulate</Button>
|
|
@if (_isSimulating) { <p>Simulating...</p> }
|
|
else
|
|
{
|
|
@if (SimulationDataDaily.Length != 0)
|
|
{
|
|
<RadzenChart>
|
|
<RadzenAreaSeries Smooth=true Data="@SimulationDataDaily" CategoryProperty="Time" Title="Consumption" ValueProperty="Consumption">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenAreaSeries Smooth=true Data="@SimulationDataDaily" CategoryProperty="Time" Title="Production" ValueProperty="Production">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenAreaSeries Smooth=true Data="@SimulationDataDaily" CategoryProperty="Time" Title="SimulatedConsumption" ValueProperty="SimulatedConsumption">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenAreaSeries Smooth=true Data="@SimulationDataDaily" CategoryProperty="Time" Title="SimulatedProduction" ValueProperty="SimulatedProduction">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenAreaSeries Smooth=true Data="@SimulationDataDaily" CategoryProperty="Time" Title="BatteryCharge" ValueProperty="BatteryCharge">
|
|
<RadzenChartTooltipOptions Visible="true"/>
|
|
</RadzenAreaSeries>
|
|
<RadzenCategoryAxis Formatter="@FormatObject" Padding="20" LabelAutoRotation="-45">
|
|
<RadzenGridLines Visible="true"/>
|
|
<RadzenAxisTitle Text="Time"/>
|
|
</RadzenCategoryAxis>
|
|
<RadzenValueAxis Formatter="@FormatObject">
|
|
<RadzenGridLines Visible="true"/>
|
|
<RadzenAxisTitle Text="Energy"/>
|
|
</RadzenValueAxis>
|
|
</RadzenChart>
|
|
}
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
double BatteryCapacity = 7.5;
|
|
double Efficiency = 90;
|
|
bool _isSimulating = false;
|
|
|
|
SimulatedBatteryEnergyData[] SimulationData = [];
|
|
SimulatedBatteryEnergyData[] SimulationDataDaily = [];
|
|
|
|
private void SimulateBattery(){
|
|
Console.WriteLine("Simulating...");
|
|
_isSimulating = true;
|
|
SimulationData = BatterySimulator.SimulateBattery(FluviusDataRaw, BatteryCapacity, Efficiency/100);
|
|
SimulationDataDaily = BatterySimulator.GenerateDailyData(SimulationData);
|
|
_isSimulating = false;
|
|
Console.WriteLine("Done simulating!");
|
|
}
|
|
}
|
|
|
|
<h2>Calculate Cost</h2>
|