diff --git a/fastapi_app/main.py b/fastapi_app/main.py index 7825944..a618d77 100644 --- a/fastapi_app/main.py +++ b/fastapi_app/main.py @@ -188,9 +188,9 @@ async def optimize_grid(optimize_grid_request: models.OptimizeGridRequest, type_fixed=bool(node[4])) number_of_hubs = opt.get_expected_hub_number_from_k_means(grid=grid) - opt.nr_optimization(grid=grid, number_of_hubs=number_of_hubs, number_of_relaxation_step=10, + number_of_relaxation_steps_nr = optimize_grid_request.number_of_relaxation_steps_nr + opt.nr_optimization(grid=grid, number_of_hubs=number_of_hubs, number_of_relaxation_step=number_of_relaxation_steps_nr, save_output=False, plot_price_evolution=False) - sqliteConnection = sqlite3.connect(grid_db) cursor = sqliteConnection.cursor() diff --git a/fastapi_app/models.py b/fastapi_app/models.py index 9fc057d..fcc56d0 100644 --- a/fastapi_app/models.py +++ b/fastapi_app/models.py @@ -46,6 +46,7 @@ class OptimizeGridRequest(BaseModel): price_household: float price_interhub_cable: float price_distribution_cable: float + number_of_relaxation_steps_nr: int class ShsIdentificationRequest(BaseModel): diff --git a/fastapi_app/static/js/interactions.js b/fastapi_app/static/js/interactions.js index 2926ab1..7481f3d 100644 --- a/fastapi_app/static/js/interactions.js +++ b/fastapi_app/static/js/interactions.js @@ -97,19 +97,16 @@ function addNodeToDatBase( } function optimize_grid() { - const price_meterhub = hub_price.value; - const price_household = household_price.value; - const price_interhub_cable = interhub_cable_price.value; - const price_distribution_cable = distribution_cable_price.value; $.ajax({ url: "optimize_grid/", type: "POST", contentType: "application/json", data: JSON.stringify({ - price_meterhub: price_meterhub, - price_household: price_household, - price_interhub_cable: price_interhub_cable, - price_distribution_cable: price_distribution_cable, + price_meterhub: price_meterhub.value, + price_household: price_household.value, + price_interhub_cable: price_interhub_cable.value, + price_distribution_cable: price_distribution_cable.value, + number_of_relaxation_steps_nr: number_of_relaxation_steps_nr.value, }), dataType: "json", statusCode: { diff --git a/fastapi_app/templates/home.html b/fastapi_app/templates/home.html index b764344..4b7f190 100644 --- a/fastapi_app/templates/home.html +++ b/fastapi_app/templates/home.html @@ -4,11 +4,7 @@

Geospatial Optimization Tool

- +
@@ -16,65 +12,49 @@

Geospatial Optimization Tool

@@ -83,264 +63,155 @@

Geospatial Optimization Tool

Solar Home Sytem Identification

Cable price

- +

Connection

- +

- +
-
- -

kWh

- -

W

- -

-
- -
- -

kWh

- -

W

- -

-
- -
- -

kWh

- -

W

- -

-
- -
- -

kWh

- -

W

- -

-
- +
+ +

kWh

+ +

W

+ +

+
+ +
+ +

kWh

+ +

W

+ +

+
+ +
+ +

kWh

+ +

W

+ +

+
+ +
+ +

kWh

+ +

W

+ +

+
+
- +
- -
-
-
- -
- Nodes table -
-
-
-
- -
+
+
+
+
-
- -
-
- -
-
- +
+ Nodes table +
+
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+
-
-
- - - - - - - - - - - - - - -
IndexLatitudeLongitudeNode TypeType FixedRequired CapacityMax Power
+ + + + + + + + + + + + + + +
IndexLatitudeLongitudeNode TypeType FixedRequired CapacityMax Power
+
-
-