diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e6d57e1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,214 @@ +# To learn more about .editorconfig see https://aka.ms/editorconfigdocs +# top-most EditorConfig file +root = true + +############################### +# Core EditorConfig Options # +############################### +# All files +[*] +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +# Generated code +[*{_AssemblyInfo.cs,.g.cs}] +generated_code = true + +# XML project files +[*.{csproj}] +indent_size = 2 + +# Code files + +############################### +# .NET Coding Conventions # +############################### +[*.{cs}] + +# Organize usings +dotnet_sort_system_directives_first = false + +# this. preferences +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent + +# Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning +dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning +dotnet_style_readonly_field = true:warning + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +csharp_prefer_simple_default_expression = true:suggestion + +############################### +# Naming Conventions # +############################### +# Style Definitions +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# Use PascalCase for constant fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# static fields should have s_ prefix +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected +dotnet_naming_style.static_prefix_style.required_prefix = s_ +dotnet_naming_style.static_prefix_style.capitalization = camel_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +############################### +# C# Coding Conventions # +############################### +[*.cs] +# var preferences +csharp_style_var_for_built_in_types = true:silent +csharp_style_var_when_type_is_apparent = true:silent +csharp_style_var_elsewhere = true:silent +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Write namespaces using a semicolon +csharp_using_directive_placement = outside_namespace:warning +csharp_using_directive_end_of_line = true:silent + +csharp_prefer_braces = true:suggestion +csharp_preserve_single_line_blocks = true:none +csharp_preserve_single_line_statements = false:none +csharp_prefer_static_local_function = true:suggestion +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_methods = true:suggestion +csharp_style_expression_bodied_constructors = true:suggestion +csharp_style_expression_bodied_operators = true:suggestion +csharp_style_expression_bodied_properties = true:suggestion +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_accessors = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = true:suggestion + +# Pattern matching preferences +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# Null-checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Other features +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_pattern_local_over_anonymous_function = false:none + +############################### +# C# Formatting Rules # +############################### +indent_size = 4 +insert_final_newline = true +charset = utf-8 + +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + +# Space preferences +csharp_space_after_cast = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_statements = true +csharp_preserve_single_line_blocks = true + +# License header +file_header_template = Copyright 2024 SoftFuzz\n\nLicensed under the Apache License, Version 2.0 (the "License"):\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License. +csharp_style_namespace_declarations = file_scoped:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion +csharp_style_prefer_pattern_matching = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_prefer_parameter_null_checking = true:suggestion +csharp_style_prefer_method_group_conversion = true:suggestion diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index a4ae216..5d3fa0d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -20,17 +20,19 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - - name: Restore dependencies (OptiHeat) + + - name: Restore dependencies (ProfHeat) run: dotnet restore - working-directory: OptiHeat + working-directory: src/ProfHeat - - name: Build (OptiHeat) + - name: Build (ProfHeat) run: dotnet build --no-restore - working-directory: OptiHeat + working-directory: src/ProfHeat - - name: Restore dependencies (OptiHeat.Tests) + - name: Restore dependencies (ProfHeat.Tests) run: dotnet restore - working-directory: OptiHeat.Tests - - name: Test (OptiHeat.Tests) + working-directory: src/ProfHeat.Tests + + - name: Test (ProfHeat.Tests) run: dotnet test - working-directory: OptiHeat.Tests + working-directory: src/ProfHeat.Tests diff --git a/LICENSE b/LICENSE index 7ca281a..1e1cf77 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 SoftFuzz + Copyright 2024 SoftFuzz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/OptiHeat.Tests/UnitTest1.cs b/OptiHeat.Tests/UnitTest1.cs deleted file mode 100644 index b432094..0000000 --- a/OptiHeat.Tests/UnitTest1.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace OptiHeat.Tests; - -public class UnitTest1 -{ - [Fact] - public void Test1() - { - // Unimplemented test, it's null to quiet down the IDE - Assert.Null(null); - } -} diff --git a/OptiHeat.sln b/OptiHeat.sln deleted file mode 100644 index a95de13..0000000 --- a/OptiHeat.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34616.47 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OptiHeat", "OptiHeat\OptiHeat.csproj", "{1882C006-9192-456F-9FF1-B034BFCB31BE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OptiHeat.Tests", "OptiHeat.Tests\OptiHeat.Tests.csproj", "{B2D44B15-07DD-437B-939D-8446E8D07140}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1882C006-9192-456F-9FF1-B034BFCB31BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1882C006-9192-456F-9FF1-B034BFCB31BE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1882C006-9192-456F-9FF1-B034BFCB31BE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1882C006-9192-456F-9FF1-B034BFCB31BE}.Release|Any CPU.Build.0 = Release|Any CPU - {B2D44B15-07DD-437B-939D-8446E8D07140}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B2D44B15-07DD-437B-939D-8446E8D07140}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B2D44B15-07DD-437B-939D-8446E8D07140}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B2D44B15-07DD-437B-939D-8446E8D07140}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C320F9A3-D6E2-4017-BF9B-0C833EBE8469} - EndGlobalSection -EndGlobal diff --git a/OptiHeat/Models/AssetManagerBusinessModel.cs b/OptiHeat/Models/AssetManagerBusinessModel.cs deleted file mode 100644 index 3862dc6..0000000 --- a/OptiHeat/Models/AssetManagerBusinessModel.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OptiHeat.Models; - -public class AssetManagerBusinessModel -{ - public void AddProductionUnit(int unitId) - { - // Add production unit - throw new NotImplementedException(); - } - - public void RemoveProductionUnit(int unitId) - { - // Remove production unit - throw new NotImplementedException(); - } - - public void UpdateProductionUnit(int unitId) - { - // Update production unit - throw new NotImplementedException(); - } - - public List GetProductionUnits() - { - // Get production units - throw new NotImplementedException(); - } -} diff --git a/OptiHeat/Models/DemandDataModel.cs b/OptiHeat/Models/DemandDataModel.cs deleted file mode 100644 index 7a1bdb0..0000000 --- a/OptiHeat/Models/DemandDataModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Ignore Spelling: Timestamp Wh - -using System; - -namespace OptiHeat.Models; - -public class DemandDataModel -{ - public int Id { get; set; } // Id - public DateTime Timestamp { get; set; } // Date and Time - public double DemandInMWh { get; set; } // MWh -} \ No newline at end of file diff --git a/OptiHeat/Models/OptimizerBusinessModel.cs b/OptiHeat/Models/OptimizerBusinessModel.cs deleted file mode 100644 index d8821d8..0000000 --- a/OptiHeat/Models/OptimizerBusinessModel.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OptiHeat.Models; - -public class OptimizerBusinessModel -{ - public ResultDataModel CalculateOptimalProduction(List priceData, List demandData) - { - // Calculate optimal production - throw new NotImplementedException(); - } -} diff --git a/OptiHeat/Models/PriceDataModel.cs b/OptiHeat/Models/PriceDataModel.cs deleted file mode 100644 index 4f46ec9..0000000 --- a/OptiHeat/Models/PriceDataModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace OptiHeat.Models; - -public class PriceDataModel -{ - public int Id { get; set; } // Id - public DateTime Timestamp { get; set; } // Date and Time - public double PricePerMWh { get; set; } // DKK/MWh (I assume DKK because DanFoss is a Danish company) -} \ No newline at end of file diff --git a/OptiHeat/Models/ProductionUnitModel.cs b/OptiHeat/Models/ProductionUnitModel.cs deleted file mode 100644 index f1d106a..0000000 --- a/OptiHeat/Models/ProductionUnitModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace OptiHeat.Models; - -public class ProductionUnitModel -{ - public int Id { get; set; } // Unit Id - public string? Name { get; set; } // Unit name - public ProductionUnitType Type { get; set; } // Type of unit - public double MaximumOutput { get; set; } // MWh - public double MinimumOutput { get; set; } // MWh - public double OperationCost { get; set; } // DKK/MWh - public double CO2Emissions { get; set; } // kg/MWh - public bool IsElectricityProducer { get; set; } // Produces electricity? (True/False) - public double ElectricityOutput { get; set; } // MWh (if producer) - public double ElectricityConsumption { get; set; } // MWh (if consumer) -} \ No newline at end of file diff --git a/OptiHeat/Models/ProductionUnitType.cs b/OptiHeat/Models/ProductionUnitType.cs deleted file mode 100644 index 9b22a5f..0000000 --- a/OptiHeat/Models/ProductionUnitType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OptiHeat.Models; - -public enum ProductionUnitType -{ - GasBoiler, - OilBoiler, - GasMotor, - ElectricBoiler, -} diff --git a/OptiHeat/Models/ResultDataManagerBusinessModel.cs b/OptiHeat/Models/ResultDataManagerBusinessModel.cs deleted file mode 100644 index 8bf677c..0000000 --- a/OptiHeat/Models/ResultDataManagerBusinessModel.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OptiHeat.Models; - -public class ResultDataManagerBusinessModel -{ - public void SaveOptimizationResult(ResultDataModel results) - { - // Save optimization result - throw new NotImplementedException(); - } - - public List GetOptimizationResult() - { - // Get optimization result - throw new NotImplementedException(); - } -} diff --git a/OptiHeat/Models/ResultDataModel.cs b/OptiHeat/Models/ResultDataModel.cs deleted file mode 100644 index 49c5c02..0000000 --- a/OptiHeat/Models/ResultDataModel.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Ignore Spelling: Timestamp - -using System; - -namespace OptiHeat.Models; - -public class ResultDataModel -{ - public int Id { get; set; } // Id - public DateTime Timestamp { get; set; } // Date and Time - public double HeatProduced { get; set; } // MWh - public double ElectricityProduced { get; set; } // MWh - public double ElectricityConsumed { get; set; } // MWh - public double OperatingExpenses { get; set; } // DKK - public double Profits { get; set; } // DKK - public double CO2Emissions { get; set; } // Tons -} \ No newline at end of file diff --git a/OptiHeat/Models/SourceDataManagerBusinessModel.cs b/OptiHeat/Models/SourceDataManagerBusinessModel.cs deleted file mode 100644 index 21b5b7b..0000000 --- a/OptiHeat/Models/SourceDataManagerBusinessModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OptiHeat.Models; - -// Maybe should be a service instead of a model, loading the csv files -public class SourceDataManagerBusinessModel -{ - public List FetchHeatDemandData() - { - // Fetch heat demand data - throw new NotImplementedException(); - } - - public List FetchElectricityPriceData() - { - // Fetch electricity price data - throw new NotImplementedException(); - } - - public void UpdateData() - { - // Update data - throw new NotImplementedException(); - } -} diff --git a/OptiHeat/Program.cs b/OptiHeat/Program.cs deleted file mode 100644 index ebfec32..0000000 --- a/OptiHeat/Program.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Avalonia; -using Avalonia.ReactiveUI; -using System; - -namespace OptiHeat -{ - internal 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); - - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() - .WithInterFont() - .LogToTrace() - .UseReactiveUI(); - } -} diff --git a/OptiHeat/ViewLocator.cs b/OptiHeat/ViewLocator.cs deleted file mode 100644 index c1ea24f..0000000 --- a/OptiHeat/ViewLocator.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Controls.Templates; -using OptiHeat.ViewModels; -using System; - -namespace OptiHeat -{ - public class ViewLocator : IDataTemplate - { - - public Control? Build(object? data) - { - if (data is null) - return null; - - var name = data.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); - var type = Type.GetType(name); - - if (type != null) - { - var control = (Control)Activator.CreateInstance(type)!; - control.DataContext = data; - return control; - } - - return new TextBlock { Text = "Not Found: " + name }; - } - - public bool Match(object? data) - { - return data is ViewModelBase; - } - } -} diff --git a/OptiHeat/ViewModels/MainWindowViewModel.cs b/OptiHeat/ViewModels/MainWindowViewModel.cs deleted file mode 100644 index 51b2912..0000000 --- a/OptiHeat/ViewModels/MainWindowViewModel.cs +++ /dev/null @@ -1,27 +0,0 @@ -using OptiHeat.Models; -using System; - -namespace OptiHeat.ViewModels; - -public class MainWindowViewModel : ViewModelBase -{ - public object? SelectedOptions { get; set; } - - public ResultDataModel CalculateResults() - { - // Calculate results - throw new NotImplementedException(); - } - - public void CalculateOptimization() - { - // Calculate optimization - throw new NotImplementedException(); - } - - public void UpdateResultsDisplay() - { - // Update results display - throw new NotImplementedException(); - } -} \ No newline at end of file diff --git a/OptiHeat/ViewModels/ViewModelBase.cs b/OptiHeat/ViewModels/ViewModelBase.cs deleted file mode 100644 index c1d44fb..0000000 --- a/OptiHeat/ViewModels/ViewModelBase.cs +++ /dev/null @@ -1,8 +0,0 @@ -using ReactiveUI; - -namespace OptiHeat.ViewModels; - -public class ViewModelBase : ReactiveObject -{ - -} \ No newline at end of file diff --git a/OptiHeat/Views/CalculatorView.axaml b/OptiHeat/Views/CalculatorView.axaml deleted file mode 100644 index 707b1be..0000000 --- a/OptiHeat/Views/CalculatorView.axaml +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/OptiHeat/Views/CalculatorView.axaml.cs b/OptiHeat/Views/CalculatorView.axaml.cs deleted file mode 100644 index 3fd6f86..0000000 --- a/OptiHeat/Views/CalculatorView.axaml.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; - -namespace OptiHeat.Views; - -public partial class CalculatorView : UserControl -{ - public CalculatorView() - { - InitializeComponent(); - } -} \ No newline at end of file diff --git a/OptiHeat/Views/DataVisualizerView.axaml.cs b/OptiHeat/Views/DataVisualizerView.axaml.cs deleted file mode 100644 index 75408a7..0000000 --- a/OptiHeat/Views/DataVisualizerView.axaml.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; - -namespace OptiHeat; - -public partial class DataVisualizerView : UserControl -{ - public DataVisualizerView() - { - InitializeComponent(); - } -} \ No newline at end of file diff --git a/OptiHeat/Views/MainWindow.axaml b/OptiHeat/Views/MainWindow.axaml deleted file mode 100644 index f9b7fbe..0000000 --- a/OptiHeat/Views/MainWindow.axaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/OptiHeat/Views/MainWindow.axaml.cs b/OptiHeat/Views/MainWindow.axaml.cs deleted file mode 100644 index ce59352..0000000 --- a/OptiHeat/Views/MainWindow.axaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Avalonia.Controls; - -namespace OptiHeat.Views -{ - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/README.md b/README.md index 04d01d8..6fdcdfe 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@
Logo -

OptiHeat

+

ProfHeat

Optimize heat demand and electricity price integration with ease.
- View Project » + View Project »

Report Bug @@ -16,7 +16,7 @@ ## About The Project 🌐 -OptiHeat simplifies the integration of heat demand and electricity prices, making complex calculations and decision-making processes more straightforward. Designed for efficiency and ease of use, OptiHeat is the go-to application for optimizing your assets. +ProfHeat simplifies the integration of heat demand and electricity prices, making complex calculations and decision-making processes more straightforward. Designed for efficiency and ease of use, ProfHeat is the go-to application for optimizing your assets. ## Key Features 💡 @@ -36,7 +36,7 @@ dotnet new install Avalonia.Templates - For editing Avalonia UI projects in Visual Studio Code, install the [Avalonia for Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.vscode-avalonia). **Installation:** -1. Download the latest release from [releases](https://github.com/SP-SoftFuzz/OptiHeat/releases/). +1. Download the latest release from [releases](https://github.com/SP-SoftFuzz/ProfHeat/releases/). 2. Follow the installation guide provided with the release. ## Contributing 🤝 @@ -45,7 +45,7 @@ For a smooth collaboration process, please use [GitHub Desktop](https://desktop. 1. **Clone:** Open GitHub Desktop, go to `File > Clone Repository`, and paste: ``` - https://github.com/SP-SoftFuzz/OptiHeat/ + https://github.com/SP-SoftFuzz/ProfHeat/ ``` 2. **Branch:** Switch to `dev` using the branch switcher. 3. **Review:** Carefully review your changes to ensure accuracy and completeness. @@ -57,6 +57,10 @@ For a smooth collaboration process, please use [GitHub Desktop](https://desktop. 7. **Request a Review:** Tag a teammate in your pull request for a review. +## Style Guide 📚 + +For the `src` directory, adhere to the standards set in [Google's C# Style Guide](https://google.github.io/styleguide/csharp-style.html), use `var` for variable declarations when the type is clear, and write namespaces using a semicolon, which overrides Google's guidelines. The root directory will follow the [universal GitHub folder structure conventions](https://github.com/kriasoft/Folder-Structure-Conventions). To automatically apply the style use the [editorconfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) + ## Project Management 🗂️ - **Task Tracking:** We use [Jira](https://softfuzz.atlassian.net/jira/software/projects/SCRUM/boards/1) for all bug reports, feature requests, and overall project management. @@ -73,4 +77,4 @@ This project is distributed under the Apache 2.0 License. See `LICENSE` for more ## Contact 📧 -For inquiries, please visit our [GitHub page](https://github.com/SP-SoftFuzz/OptiHeat). +For inquiries, please visit our [GitHub page](https://github.com/SP-SoftFuzz/ProfHeat). diff --git a/docs/Hand-ins/Daily-Scrum-package-Sprint-2_02042024.pdf b/docs/Hand-ins/Daily-Scrum-package-Sprint-2_02042024.pdf new file mode 100644 index 0000000..4c63e7e Binary files /dev/null and b/docs/Hand-ins/Daily-Scrum-package-Sprint-2_02042024.pdf differ diff --git a/docs/Hand-ins/Updated_Class_Diagram.md b/docs/Hand-ins/Updated_Class_Diagram.md new file mode 100644 index 0000000..c099e07 --- /dev/null +++ b/docs/Hand-ins/Updated_Class_Diagram.md @@ -0,0 +1,63 @@ + Models: +- HeatingUnit + + Id: Guid + + Name: string + + Type: Enum (Gas, Oil, Electric) + + MaxHeat: double + + ProductionCost: double + + MaxElectricity: double + + CO2Emission: double + + GasConsumption: double + +- HeatDemand + + Time: DateTime + + DemandValue: double + +- ElectricityPrice + + Time: DateTime + + Price: double + +- OptimizationResult + + Time: DateTime + + OptimizedHeat: double + + OptimizedCosts: double + + CO2Emissions: double + +- Optimizer (Business Logic/Model) + + Optimize(assets: List, demands: List, prices: List): List + +Services: (Are named managers to keep consistency with the case) +- AssetManager + --> Interacts with: CSVDataImportExportService + + GetAllHeatingUnits(): List + + SaveHeatingUnit(unit: HeatingUnit): void + +- SourceDataManager + --> Interacts with: CSVDataImportExportService + + GetHeatDemand(): List + + GetElectricityPrice(): List + +- ResultDataManager + --> Interacts with: CSVDataImportExportService + + SaveOptimizationResults(results: List): void + + GetOptimizationResults(): List + +ViewModels: +- OptimizerViewModel + --> Uses: AssetService, SourceDataService, ResultDataService, Optimizer + + OptimizationResults: ObservableCollection + + OptimizeCommand(): void + +- DataVisualizerViewModel + --> Uses: SourceDataService + Inherits: ViewModelBase + + HeatDemands: ObservableCollection + + ElectricityPrices: ObservableCollection + + LoadDataCommand(): void + +Views: +- OptimizerView + --> Binds to: OptimizerViewModel + +- DataVisualizerView + --> Binds to: DataVisualizerViewModel \ No newline at end of file diff --git a/src/ProfHeat.Tests/ModelsTests/HeatDemandTests.cs b/src/ProfHeat.Tests/ModelsTests/HeatDemandTests.cs new file mode 100644 index 0000000..083b6e2 --- /dev/null +++ b/src/ProfHeat.Tests/ModelsTests/HeatDemandTests.cs @@ -0,0 +1,25 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace OptiHeat.Tests; + +public class HeatDemandTests +{ + [Fact] + public void Property_SettersAndGetters() + { + // Unimplemented test, it's null to quiet down the IDE + Assert.Null(null); + } +} diff --git a/OptiHeat.Tests/OptiHeat.Tests.csproj b/src/ProfHeat.Tests/ProfHeat.Tests.csproj similarity index 90% rename from OptiHeat.Tests/OptiHeat.Tests.csproj rename to src/ProfHeat.Tests/ProfHeat.Tests.csproj index f7747d3..6e01288 100644 --- a/OptiHeat.Tests/OptiHeat.Tests.csproj +++ b/src/ProfHeat.Tests/ProfHeat.Tests.csproj @@ -17,11 +17,11 @@ - + - \ No newline at end of file + diff --git a/src/ProfHeat.sln b/src/ProfHeat.sln new file mode 100644 index 0000000..c6c68ff --- /dev/null +++ b/src/ProfHeat.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34714.143 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProfHeat", "ProfHeat\ProfHeat.csproj", "{61A0CB4D-1C04-4FEC-84FC-16D2ECBE2564}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfHeat.Tests", "ProfHeat.Tests\ProfHeat.Tests.csproj", "{F8DE7C6C-4305-4CCA-8E1A-07581D256957}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {61A0CB4D-1C04-4FEC-84FC-16D2ECBE2564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61A0CB4D-1C04-4FEC-84FC-16D2ECBE2564}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61A0CB4D-1C04-4FEC-84FC-16D2ECBE2564}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61A0CB4D-1C04-4FEC-84FC-16D2ECBE2564}.Release|Any CPU.Build.0 = Release|Any CPU + {F8DE7C6C-4305-4CCA-8E1A-07581D256957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8DE7C6C-4305-4CCA-8E1A-07581D256957}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8DE7C6C-4305-4CCA-8E1A-07581D256957}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8DE7C6C-4305-4CCA-8E1A-07581D256957}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E15B2FD8-3992-4A46-B526-DA83F8D8EC97} + EndGlobalSection +EndGlobal diff --git a/OptiHeat/App.axaml b/src/ProfHeat/App.axaml similarity index 85% rename from OptiHeat/App.axaml rename to src/ProfHeat/App.axaml index d70db3d..85e7614 100644 --- a/OptiHeat/App.axaml +++ b/src/ProfHeat/App.axaml @@ -1,7 +1,7 @@ diff --git a/OptiHeat/App.axaml.cs b/src/ProfHeat/App.axaml.cs similarity index 76% rename from OptiHeat/App.axaml.cs rename to src/ProfHeat/App.axaml.cs index d27731e..e9df1e0 100644 --- a/OptiHeat/App.axaml.cs +++ b/src/ProfHeat/App.axaml.cs @@ -1,10 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -using OptiHeat.ViewModels; -using OptiHeat.Views; +using ProfHeat.ViewModels; +using ProfHeat.Views; -namespace OptiHeat +namespace ProfHeat { public partial class App : Application { diff --git a/OptiHeat/Assets/icon.ico b/src/ProfHeat/Assets/icon.ico similarity index 100% rename from OptiHeat/Assets/icon.ico rename to src/ProfHeat/Assets/icon.ico diff --git a/OptiHeat/Data/DemandAndPriceData.csv b/src/ProfHeat/Data/DanfossHeat2024.csv similarity index 100% rename from OptiHeat/Data/DemandAndPriceData.csv rename to src/ProfHeat/Data/DanfossHeat2024.csv diff --git a/src/ProfHeat/Interfaces/IDataService.cs b/src/ProfHeat/Interfaces/IDataService.cs new file mode 100644 index 0000000..641eab0 --- /dev/null +++ b/src/ProfHeat/Interfaces/IDataService.cs @@ -0,0 +1,22 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Collections.Generic; + +namespace ProfHeat.Interfaces; + +public interface IDataService +{ + +} diff --git a/src/ProfHeat/Models/ElectricityPrice.cs b/src/ProfHeat/Models/ElectricityPrice.cs new file mode 100644 index 0000000..d628008 --- /dev/null +++ b/src/ProfHeat/Models/ElectricityPrice.cs @@ -0,0 +1,23 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace ProfHeat.Models; + +public class ElectricityPrice +{ + public DateTime Time { get; set; } // The time of the price + public double Price { get; set; } // The price of electricity per MWh +} diff --git a/src/ProfHeat/Models/HeatDemand.cs b/src/ProfHeat/Models/HeatDemand.cs new file mode 100644 index 0000000..01762fb --- /dev/null +++ b/src/ProfHeat/Models/HeatDemand.cs @@ -0,0 +1,23 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace ProfHeat.Models; + +public class HeatDemand +{ + public DateTime Time { get; set; } // The time of the demand + public double DemandValue { get; set; } // The value of the heat demand in MWh +} diff --git a/src/ProfHeat/Models/HeatingUnit.cs b/src/ProfHeat/Models/HeatingUnit.cs new file mode 100644 index 0000000..58f4b2e --- /dev/null +++ b/src/ProfHeat/Models/HeatingUnit.cs @@ -0,0 +1,36 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace ProfHeat.Models; + +public enum HeatingUnitType +{ + Gas, + Oil, + Electric +} + +public class HeatingUnit +{ + public Guid Id { get; set; } // Unique identifier + public required string Name { get; set; } // Name of the heating unit + public HeatingUnitType Type { get; set; } // Type of the heating unit + public double MaxHeat { get; set; } // Maximum heat output in MWh + public double ProductionCost { get; set; } // Production cost in currency per MWh + public double MaxElectricity { get; set; } // Maximum electricity output in MWh + public double CO2Emission { get; set; } // CO2 emissions in kg per MWh + public double GasConsumption { get; set; } // Gas consumption in units +} diff --git a/src/ProfHeat/Models/OptimizationResult.cs b/src/ProfHeat/Models/OptimizationResult.cs new file mode 100644 index 0000000..77d6e37 --- /dev/null +++ b/src/ProfHeat/Models/OptimizationResult.cs @@ -0,0 +1,25 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace ProfHeat.Models; + +public class OptimizationResult +{ + public DateTime Time { get; set; } // The time of the optimization result + public double OptimizedHeat { get; set; } // Optimized heat production in MWh + public double OptimizedCosts { get; set; } // Optimized production costs + public double CO2Emissions { get; set; } // CO2 emissions after optimization in kg +} diff --git a/src/ProfHeat/Models/Optimizer.cs b/src/ProfHeat/Models/Optimizer.cs new file mode 100644 index 0000000..15eacdf --- /dev/null +++ b/src/ProfHeat/Models/Optimizer.cs @@ -0,0 +1,70 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ProfHeat.Models; + +public class Optimizer +{ + public List Optimize( + List assets, + List demands, + List prices) + { + var optimizationResults = new List(); + + foreach (var demand in demands) + { + var currentPrice = prices.Find(p => p.Time == demand.Time)?.Price ?? 0; + + // Calculate profit potential for each asset based on current electricity price and cost + var orderedAssets = assets + .Select(asset => new + { + Asset = asset, + ProfitPerMWh = currentPrice - asset.ProductionCost // Assuming electricity price applies to all unit types + }) + .Where(a => a.ProfitPerMWh > 0) // Only consider assets that can generate profit + .OrderByDescending(a => a.ProfitPerMWh) + .Select(a => a.Asset); + + var remainingDemand = demand.DemandValue; + + foreach (var asset in orderedAssets) + { + if (remainingDemand <= 0) + break; + + var productionAmount = Math.Min(asset.MaxHeat, remainingDemand); + var cost = productionAmount * asset.ProductionCost; + var profit = (productionAmount * currentPrice) - cost; + + optimizationResults.Add(new OptimizationResult + { + Time = demand.Time, + OptimizedHeat = productionAmount, + OptimizedCosts = cost, + CO2Emissions = productionAmount * asset.CO2Emission + }); + + remainingDemand -= productionAmount; + } + } + + return optimizationResults; + } +} diff --git a/OptiHeat/OptiHeat.csproj b/src/ProfHeat/ProfHeat.csproj similarity index 96% rename from OptiHeat/OptiHeat.csproj rename to src/ProfHeat/ProfHeat.csproj index f61c70d..6823df2 100644 --- a/OptiHeat/OptiHeat.csproj +++ b/src/ProfHeat/ProfHeat.csproj @@ -1,4 +1,4 @@ - + WinExe net8.0 diff --git a/src/ProfHeat/Program.cs b/src/ProfHeat/Program.cs new file mode 100644 index 0000000..2d3cabb --- /dev/null +++ b/src/ProfHeat/Program.cs @@ -0,0 +1,37 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using Avalonia; +using Avalonia.ReactiveUI; + +namespace ProfHeat; + +internal 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); + + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .WithInterFont() + .LogToTrace() + .UseReactiveUI(); +} diff --git a/src/ProfHeat/Services/AssetManager.cs b/src/ProfHeat/Services/AssetManager.cs new file mode 100644 index 0000000..4f27eb1 --- /dev/null +++ b/src/ProfHeat/Services/AssetManager.cs @@ -0,0 +1,25 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProfHeat.Services; + +public class AssetManager +{ +} diff --git a/src/ProfHeat/Services/CsvDataService.cs b/src/ProfHeat/Services/CsvDataService.cs new file mode 100644 index 0000000..7af68ad --- /dev/null +++ b/src/ProfHeat/Services/CsvDataService.cs @@ -0,0 +1,24 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using ProfHeat.Interfaces; + +namespace OptiHeat.Services; + +public class CsvDataService : IDataService +{ + +} diff --git a/src/ProfHeat/Services/ResultDataManager.cs b/src/ProfHeat/Services/ResultDataManager.cs new file mode 100644 index 0000000..14696a1 --- /dev/null +++ b/src/ProfHeat/Services/ResultDataManager.cs @@ -0,0 +1,26 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProfHeat.Services; + +public class ResultDataManager +{ + +} diff --git a/src/ProfHeat/Services/SourceDataManager.cs b/src/ProfHeat/Services/SourceDataManager.cs new file mode 100644 index 0000000..b05e7e0 --- /dev/null +++ b/src/ProfHeat/Services/SourceDataManager.cs @@ -0,0 +1,26 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProfHeat.Services; + +public class SourceDataManager +{ + +} diff --git a/src/ProfHeat/ViewLocator.cs b/src/ProfHeat/ViewLocator.cs new file mode 100644 index 0000000..8dcad54 --- /dev/null +++ b/src/ProfHeat/ViewLocator.cs @@ -0,0 +1,47 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using Avalonia.Controls; +using Avalonia.Controls.Templates; +using ProfHeat.ViewModels; + +namespace ProfHeat; + +public class ViewLocator : IDataTemplate +{ + + public Control? Build(object? data) + { + if (data is null) + return null; + + var name = data.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); + var type = Type.GetType(name); + + if (type != null) + { + var control = (Control)Activator.CreateInstance(type)!; + control.DataContext = data; + return control; + } + + return new TextBlock { Text = "Not Found: " + name }; + } + + public bool Match(object? data) + { + return data is ViewModelBase; + } +} diff --git a/src/ProfHeat/ViewModels/DataVisualizerViewModel.cs b/src/ProfHeat/ViewModels/DataVisualizerViewModel.cs new file mode 100644 index 0000000..8da0d5c --- /dev/null +++ b/src/ProfHeat/ViewModels/DataVisualizerViewModel.cs @@ -0,0 +1,26 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProfHeat.ViewModels; + +public class DataVisualizerViewModel : ViewModelBase +{ + +} diff --git a/src/ProfHeat/ViewModels/MainWindowViewModel.cs b/src/ProfHeat/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..46e14b4 --- /dev/null +++ b/src/ProfHeat/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,22 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace ProfHeat.ViewModels; + +public class MainWindowViewModel : ViewModelBase +{ + public OptimizerViewModel Optimizer { get; } = new OptimizerViewModel(); + + public DataVisualizerViewModel DataVisualizer { get; } = new DataVisualizerViewModel(); +} diff --git a/src/ProfHeat/ViewModels/OptimizerViewModel.cs b/src/ProfHeat/ViewModels/OptimizerViewModel.cs new file mode 100644 index 0000000..ca80a52 --- /dev/null +++ b/src/ProfHeat/ViewModels/OptimizerViewModel.cs @@ -0,0 +1,25 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProfHeat.ViewModels; + +public class OptimizerViewModel : ViewModelBase +{ +} diff --git a/src/ProfHeat/ViewModels/ViewModelBase.cs b/src/ProfHeat/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..cee373d --- /dev/null +++ b/src/ProfHeat/ViewModels/ViewModelBase.cs @@ -0,0 +1,22 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using ReactiveUI; + +namespace ProfHeat.ViewModels; + +public class ViewModelBase : ReactiveObject +{ + +} diff --git a/OptiHeat/Views/DataVisualizerView.axaml b/src/ProfHeat/Views/DataVisualizerView.axaml similarity index 54% rename from OptiHeat/Views/DataVisualizerView.axaml rename to src/ProfHeat/Views/DataVisualizerView.axaml index ff2c02c..d8d427e 100644 --- a/OptiHeat/Views/DataVisualizerView.axaml +++ b/src/ProfHeat/Views/DataVisualizerView.axaml @@ -1,8 +1,17 @@ + x:Class="ProfHeat.Views.DataVisualizerView"> + + + + + + diff --git a/src/ProfHeat/Views/DataVisualizerView.axaml.cs b/src/ProfHeat/Views/DataVisualizerView.axaml.cs new file mode 100644 index 0000000..9c55213 --- /dev/null +++ b/src/ProfHeat/Views/DataVisualizerView.axaml.cs @@ -0,0 +1,25 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Avalonia.Controls; + +namespace ProfHeat.Views; + +public partial class DataVisualizerView : UserControl +{ + public DataVisualizerView() + { + InitializeComponent(); + } +} diff --git a/src/ProfHeat/Views/MainWindow.axaml b/src/ProfHeat/Views/MainWindow.axaml new file mode 100644 index 0000000..c54b67d --- /dev/null +++ b/src/ProfHeat/Views/MainWindow.axaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/src/ProfHeat/Views/MainWindow.axaml.cs b/src/ProfHeat/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..453aaa8 --- /dev/null +++ b/src/ProfHeat/Views/MainWindow.axaml.cs @@ -0,0 +1,25 @@ +// Copyright 2024 SoftFuzz +// +// Licensed under the Apache License, Version 2.0 (the "License"): +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Avalonia.Controls; + +namespace ProfHeat.Views; + +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } +} diff --git a/src/ProfHeat/Views/OptimizerView.axaml b/src/ProfHeat/Views/OptimizerView.axaml new file mode 100644 index 0000000..3ffb97b --- /dev/null +++ b/src/ProfHeat/Views/OptimizerView.axaml @@ -0,0 +1,25 @@ + + + + + + + + + + +