pyconvexity 0.4.9.post1__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyconvexity might be problematic. Click here for more details.

Files changed (51) hide show
  1. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/PKG-INFO +1 -1
  2. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/pyproject.toml +2 -2
  3. pyconvexity-0.5.0/src/pyconvexity/_version.py +1 -0
  4. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/storage.py +20 -28
  5. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity.egg-info/PKG-INFO +1 -1
  6. pyconvexity-0.4.9.post1/src/pyconvexity/_version.py +0 -1
  7. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/README.md +0 -0
  8. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/setup.cfg +0 -0
  9. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/__init__.py +0 -0
  10. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/core/__init__.py +0 -0
  11. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/core/database.py +0 -0
  12. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/core/errors.py +0 -0
  13. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/core/types.py +0 -0
  14. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/dashboard.py +0 -0
  15. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/README.md +0 -0
  16. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/__init__.py +0 -0
  17. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/loaders/__init__.py +0 -0
  18. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/loaders/cache.py +0 -0
  19. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/schema/01_core_schema.sql +0 -0
  20. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/schema/02_data_metadata.sql +0 -0
  21. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/schema/03_validation_data.sql +0 -0
  22. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/sources/__init__.py +0 -0
  23. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/data/sources/gem.py +0 -0
  24. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/io/__init__.py +0 -0
  25. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/io/excel_exporter.py +0 -0
  26. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/io/excel_importer.py +0 -0
  27. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/io/netcdf_exporter.py +0 -0
  28. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/io/netcdf_importer.py +0 -0
  29. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/__init__.py +0 -0
  30. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/attributes.py +0 -0
  31. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/carriers.py +0 -0
  32. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/components.py +0 -0
  33. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/network.py +0 -0
  34. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/results.py +0 -0
  35. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/models/scenarios.py +0 -0
  36. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/__init__.py +0 -0
  37. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/__init__.py +0 -0
  38. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/api.py +0 -0
  39. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/batch_loader.py +0 -0
  40. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/builder.py +0 -0
  41. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/clearing_price.py +0 -0
  42. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/constraints.py +0 -0
  43. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/solvers/pypsa/solver.py +0 -0
  44. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/timeseries.py +0 -0
  45. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/validation/__init__.py +0 -0
  46. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity/validation/rules.py +0 -0
  47. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity.egg-info/SOURCES.txt +0 -0
  48. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity.egg-info/dependency_links.txt +0 -0
  49. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity.egg-info/requires.txt +0 -0
  50. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/src/pyconvexity.egg-info/top_level.txt +0 -0
  51. {pyconvexity-0.4.9.post1 → pyconvexity-0.5.0}/tests/test_core_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyconvexity
3
- Version: 0.4.9.post1
3
+ Version: 0.5.0
4
4
  Summary: Python library for energy system modeling and optimization with PyPSA
5
5
  Author-email: Convexity Team <info@convexity.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyconvexity"
7
- version = "0.4.9.post1"
7
+ version = "0.5.0"
8
8
  description = "Python library for energy system modeling and optimization with PyPSA"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -81,7 +81,7 @@ profile = "black"
81
81
  line_length = 88
82
82
 
83
83
  [tool.mypy]
84
- python_version = "0.4.9.post1"
84
+ python_version = "0.5.0"
85
85
  warn_return_any = true
86
86
  warn_unused_configs = true
87
87
  disallow_untyped_defs = true
@@ -0,0 +1 @@
1
+ __version__ = "0.5.0"
@@ -829,6 +829,7 @@ class ResultStorage:
829
829
  # 1. GENERATORS - Generation dispatch (including UNMET_LOAD)
830
830
  if hasattr(network, "generators_t") and hasattr(network.generators_t, "p"):
831
831
  # Get generator-carrier mapping (include both GENERATOR and UNMET_LOAD)
832
+ # Use LEFT JOIN to include UNMET_LOAD components even if they don't have a carrier_id
832
833
  cursor = conn.execute(
833
834
  """
834
835
  SELECT c.name as component_name,
@@ -837,7 +838,7 @@ class ResultStorage:
837
838
  ELSE carr.name
838
839
  END as carrier_name
839
840
  FROM components c
840
- JOIN carriers carr ON c.carrier_id = carr.id
841
+ LEFT JOIN carriers carr ON c.carrier_id = carr.id
841
842
  WHERE c.component_type IN ('GENERATOR', 'UNMET_LOAD')
842
843
  """
843
844
  )
@@ -1006,19 +1007,16 @@ class ResultStorage:
1006
1007
  end_year = build_year + lifetime - 1
1007
1008
  return current_year <= end_year
1008
1009
 
1009
- # 1. GENERATORS - Capital costs (including UNMET_LOAD)
1010
+ # 1. GENERATORS - Capital costs (excluding UNMET_LOAD)
1010
1011
  if hasattr(network, "generators") and not network.generators.empty:
1011
- # Get generator info: carrier, capital_cost, build_year, lifetime (include UNMET_LOAD)
1012
+ # Get generator info: carrier, capital_cost, build_year, lifetime
1013
+ # EXCLUDE UNMET_LOAD - their capital cost is not meaningful (usually $0)
1012
1014
  cursor = conn.execute(
1013
1015
  """
1014
- SELECT c.name as component_name,
1015
- CASE
1016
- WHEN c.component_type = 'UNMET_LOAD' THEN 'Unmet Load'
1017
- ELSE carr.name
1018
- END as carrier_name
1016
+ SELECT c.name as component_name, carr.name as carrier_name
1019
1017
  FROM components c
1020
- JOIN carriers carr ON c.carrier_id = carr.id
1021
- WHERE c.component_type IN ('GENERATOR', 'UNMET_LOAD')
1018
+ LEFT JOIN carriers carr ON c.carrier_id = carr.id
1019
+ WHERE c.component_type = 'GENERATOR'
1022
1020
  """
1023
1021
  )
1024
1022
  generator_carriers = {row[0]: row[1] for row in cursor.fetchall()}
@@ -1297,19 +1295,16 @@ class ResultStorage:
1297
1295
  # Operational costs = dispatch (MWh) × marginal_cost (currency/MWh)
1298
1296
  # Only for components that are active in this year
1299
1297
 
1300
- # 1. GENERATORS - Operational costs (including UNMET_LOAD)
1298
+ # 1. GENERATORS - Operational costs (excluding UNMET_LOAD)
1301
1299
  if hasattr(network, "generators_t") and hasattr(network.generators_t, "p"):
1302
- # Get generator info: carrier, marginal_cost, build_year, lifetime (include UNMET_LOAD)
1300
+ # Get generator info: carrier, marginal_cost, build_year, lifetime
1301
+ # EXCLUDE UNMET_LOAD - their marginal cost is a penalty price, not a real operational cost
1303
1302
  cursor = conn.execute(
1304
1303
  """
1305
- SELECT c.name as component_name,
1306
- CASE
1307
- WHEN c.component_type = 'UNMET_LOAD' THEN 'Unmet Load'
1308
- ELSE carr.name
1309
- END as carrier_name
1304
+ SELECT c.name as component_name, carr.name as carrier_name
1310
1305
  FROM components c
1311
- JOIN carriers carr ON c.carrier_id = carr.id
1312
- WHERE c.component_type IN ('GENERATOR', 'UNMET_LOAD')
1306
+ LEFT JOIN carriers carr ON c.carrier_id = carr.id
1307
+ WHERE c.component_type = 'GENERATOR'
1313
1308
  """
1314
1309
  )
1315
1310
  generator_carriers = {row[0]: row[1] for row in cursor.fetchall()}
@@ -1539,19 +1534,16 @@ class ResultStorage:
1539
1534
 
1540
1535
  # Calculate capacity by carrier for this specific year
1541
1536
 
1542
- # 4. GENERATORS - Power capacity (MW) (including UNMET_LOAD)
1537
+ # 4. GENERATORS - Power capacity (MW) (excluding UNMET_LOAD)
1543
1538
  if hasattr(network, "generators") and not network.generators.empty:
1544
- # Get generator-carrier mapping (include UNMET_LOAD)
1539
+ # Get generator-carrier mapping for capacity
1540
+ # EXCLUDE UNMET_LOAD - their capacity (often infinite) is not meaningful for capacity stats
1545
1541
  cursor = conn.execute(
1546
1542
  """
1547
- SELECT c.name as component_name,
1548
- CASE
1549
- WHEN c.component_type = 'UNMET_LOAD' THEN 'Unmet Load'
1550
- ELSE carr.name
1551
- END as carrier_name
1543
+ SELECT c.name as component_name, carr.name as carrier_name
1552
1544
  FROM components c
1553
- JOIN carriers carr ON c.carrier_id = carr.id
1554
- WHERE c.component_type IN ('GENERATOR', 'UNMET_LOAD')
1545
+ LEFT JOIN carriers carr ON c.carrier_id = carr.id
1546
+ WHERE c.component_type = 'GENERATOR'
1555
1547
  """
1556
1548
  )
1557
1549
  generator_carriers = {row[0]: row[1] for row in cursor.fetchall()}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyconvexity
3
- Version: 0.4.9.post1
3
+ Version: 0.5.0
4
4
  Summary: Python library for energy system modeling and optimization with PyPSA
5
5
  Author-email: Convexity Team <info@convexity.com>
6
6
  License: MIT
@@ -1 +0,0 @@
1
- __version__ = "0.4.9.post1"
File without changes
File without changes