This repository has been archived by the owner on Jan 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from 2nd-Semester-Project/fix-folders
Fix folders
- Loading branch information
Showing
46 changed files
with
592 additions
and
799 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Xunit; | ||
|
||
namespace HeatOptimiser.Tests | ||
{ | ||
public class OptimiserTest | ||
{ | ||
|
||
[Fact] | ||
public void TestOptimise() | ||
{ | ||
// Arrange | ||
SourceDataManager sourceManager = new SourceDataManager(); | ||
string projectDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; | ||
string file = Path.Combine(projectDirectory, "SourceDataTest.xlsx"); | ||
var data = sourceManager.LoadXLSXFile(file, 4, 2); | ||
|
||
IAssetManager assetManager = new AssetManager(); | ||
assetManager.AddUnit("GB", "none", 5.0, 0, 1.1, 500, 215); | ||
assetManager.AddUnit("OB", "none", 4.0, 0, 1.2, 700, 265); | ||
|
||
Optimiser optimiser = new Optimiser(sourceManager, assetManager); | ||
string startDateStr = "12/02/2023"; | ||
string endDateStr = "25/02/2023"; | ||
DateTime startDate = DateTime.ParseExact(startDateStr, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); | ||
DateTime endDate = DateTime.ParseExact(endDateStr, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); | ||
|
||
// Act | ||
Schedule schedule = optimiser.Optimise(startDate, endDate); | ||
|
||
// Assert | ||
Assert.NotNull(schedule); | ||
Assert.Equal(startDate, schedule.startDate); | ||
Assert.Equal(endDate, schedule.endDate); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Xunit; | ||
|
||
namespace HeatOptimiser.Tests | ||
{ | ||
public class SourceDataManagerTest | ||
{ | ||
[Fact] | ||
public void TestLoadXLSXFile() | ||
{ | ||
// Arrange | ||
SourceDataManager sourceManager = new SourceDataManager(); | ||
string projectDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; | ||
string file = Path.Combine(projectDirectory, "SourceDataTest.xlsx"); | ||
Console.WriteLine(file); | ||
|
||
// Act | ||
var result = sourceManager.LoadXLSXFile(file, 4, 2); | ||
|
||
// Assert | ||
Assert.NotNull(result); | ||
Assert.NotEmpty(result); | ||
} | ||
|
||
[Fact] | ||
public void TestGetDataInRange() | ||
{ | ||
// Arrange | ||
SourceData data = new SourceData(); | ||
SourceDataManager sourceManager = new SourceDataManager(); | ||
DateTime startDate = new DateTime(2023, 1, 1); | ||
DateTime endDate = new DateTime(2023, 1, 31); | ||
|
||
// Act | ||
var result = sourceManager.GetDataInRange(data, startDate, endDate); | ||
|
||
// Assert | ||
Assert.NotNull(result); | ||
} | ||
} | ||
} |
File renamed without changes.
30 changes: 15 additions & 15 deletions
30
HeatOptimiser/UserInterface/App.axaml → HeatOptimiser/App.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="UserInterface.App" | ||
xmlns:local="using:UserInterface" | ||
RequestedThemeVariant="Default"> | ||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. --> | ||
|
||
<Application.DataTemplates> | ||
<local:ViewLocator/> | ||
</Application.DataTemplates> | ||
|
||
<Application.Styles> | ||
<FluentTheme /> | ||
<StyleInclude Source="avares://UserInterface/Assets/Icons.axaml"/> | ||
</Application.Styles> | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="UserInterface.App" | ||
xmlns:local="using:UserInterface" | ||
RequestedThemeVariant="Default"> | ||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. --> | ||
|
||
<Application.DataTemplates> | ||
<local:ViewLocator/> | ||
</Application.DataTemplates> | ||
|
||
<Application.Styles> | ||
<FluentTheme /> | ||
<StyleInclude Source="avares://HeatOptimiser/Assets/Icons.axaml"/> | ||
</Application.Styles> | ||
</Application> |
54 changes: 27 additions & 27 deletions
54
HeatOptimiser/UserInterface/App.axaml.cs → HeatOptimiser/App.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.Markup.Xaml; | ||
using UserInterface.ViewModels; | ||
using UserInterface.Views; | ||
|
||
namespace UserInterface; | ||
|
||
public partial class App : Application | ||
{ | ||
public override void Initialize() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) | ||
{ | ||
desktop.MainWindow = new MainWindow | ||
{ | ||
DataContext = new MainWindowViewModel(), | ||
}; | ||
} | ||
|
||
base.OnFrameworkInitializationCompleted(); | ||
} | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.Markup.Xaml; | ||
using UserInterface.ViewModels; | ||
using UserInterface.Views; | ||
|
||
namespace UserInterface; | ||
|
||
public partial class App : Application | ||
{ | ||
public override void Initialize() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) | ||
{ | ||
desktop.MainWindow = new MainWindow | ||
{ | ||
DataContext = new MainWindowViewModel(), | ||
}; | ||
} | ||
|
||
base.OnFrameworkInitializationCompleted(); | ||
} | ||
} |
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,23 @@ | ||
namespace HeatOptimiser | ||
{ | ||
class Program { | ||
public static void Main() | ||
{ | ||
AssetManager assets = new(); | ||
assets.AddUnit("GB", "none", 5.0, 0, 1.1, 500, 215); | ||
assets.AddUnit("OB", "none", 4.0, 0, 1.2, 700, 265); | ||
|
||
SourceDataManager dataManager = new(); | ||
Optimiser optimiser = new(dataManager, assets); | ||
string startDateStr = "12/02/2023"; | ||
string endDateStr = "25/02/2023"; | ||
DateTime startDate = DateTime.ParseExact(startDateStr, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); | ||
DateTime endDate = DateTime.ParseExact(endDateStr, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); | ||
Schedule optimisedData = optimiser.Optimise(startDate, endDate); | ||
using Avalonia; | ||
using Avalonia.ReactiveUI; | ||
using System; | ||
|
||
namespace UserInterface; | ||
|
||
// Example on visualizing the data | ||
|
||
// foreach (ScheduleHour hour in optimisedData.schedule) | ||
// { | ||
// Console.WriteLine(hour.Hour); | ||
// foreach (ProductionAsset asset in hour.Assets) | ||
// { | ||
// Console.Write($"{asset.Name} "); | ||
// } | ||
// Console.WriteLine(); | ||
// foreach (double demand in hour.Demands) | ||
// { | ||
// Console.Write($"{demand} "); | ||
// } | ||
// Console.WriteLine("\n"); | ||
// } | ||
sealed class Program | ||
{ | ||
// Initialization code. Don't use any Avalonia, third-party APIs or any | ||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized | ||
// yet and stuff might break. | ||
[STAThread] | ||
public static void Main(string[] args) => BuildAvaloniaApp() | ||
.StartWithClassicDesktopLifetime(args); | ||
|
||
new TextBasedUI().Interface(); | ||
} | ||
} | ||
} | ||
// Avalonia configuration, don't remove; also used by visual designer. | ||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure<App>() | ||
.UsePlatformDetect() | ||
.WithInterFont() | ||
.LogToTrace() | ||
.UseReactiveUI(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.