PlexosDB Troubleshooting: Missing 'System' Object Causes Error for bulk Property Addition" #64
-
|
Hi All Background:
Issue
Help Requested Any help on understanding what I am doing wrong would be greatly appreciated.
CODE: from plexosdb import PlexosDB
from plexosdb.enums import ClassEnum, CollectionEnum
# Initialize database
db = PlexosDB.from_xml("plexosdb.xml")
# Check if properties are valid
valid_props = db.list_valid_properties(
CollectionEnum.Generators,
parent_class_enum=ClassEnum.System,
child_class_enum=ClassEnum.Generator
)
print(f"Valid generator properties: {valid_props}")
# Prepare property records
property_records = [
{"name": "Generator1", "Offer Quantity": 100.0, Band": 1, "Date From": '01/07/2025', "Date To": '30/06/2026'},
{"name": "Generator2", "Offer Quantity": 100.0, Band": 1, "Date From": '01/07/2025', "Date To": '30/06/2026'},
{"name": "Generator3", "Offer Quantity": 200.0, Band": 1, "Date From": '01/07/2025', "Date To": '30/06/2026'},
]
db.add_properties_from_records(
property_records,
object_class=ClassEnum.Generator,
parent_class=ClassEnum.System,
collection=CollectionEnum.Generators,
scenario="Base Case"
)Traceback Error: Valid Generator Properties (As per Print): |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
Thanks for using @Bobby-Heyer! Let me have a look at it and will reach out to you. |
Beta Was this translation helpful? Give feedback.
-
|
I tried setting the scenario to None, since I didn't need a Base Scenario, and I used an XML file that I created in PLEXOS. It did load successfully and exported, but the resulting XML does not include the “Date From” and “Date To” properties, and I still couldn’t get these dates to work. Also, there was a " missing before Band -> "Band" code: from plexosdb import PlexosDB db = PlexosDB.from_xml("PLEXOS_BASE.xml") valid_props = db.list_valid_properties( db.add_object(ClassEnum.Generator, "USINA1") db.add_properties_from_records( |
Beta Was this translation helpful? Give feedback.
-
|
@mcllerena , can you follow up on this? |
Beta Was this translation helpful? Give feedback.
-
|
The two issues presented are now addressed and validated on this branch: #78 Hope this helps, please let me know if there's any other issue or observation! |
Beta Was this translation helpful? Give feedback.
The two issues presented are now addressed and validated on this branch: #78
And the correct way to add the bands and dates, according to the documentation would be: