Skip to content

Introduce new component from eesyplan#492

Draft
Bachibouzouk wants to merge 5 commits into
mainfrom
feature/introduce-new-component
Draft

Introduce new component from eesyplan#492
Bachibouzouk wants to merge 5 commits into
mainfrom
feature/introduce-new-component

Conversation

@Bachibouzouk

@Bachibouzouk Bachibouzouk commented Jul 8, 2026

Copy link
Copy Markdown

PROTOCOL (option a or b)

  1. a) write a new class which inherits from Asset with the new needed fields
    b) add the fields within the Asset class

  2. add an asset_type for this new component with their visible fields (under static/resources/assettypes_list.csv)

  3. add the asset to the drag and drop within the projects/views.py::scenario_create_topology function. Right at the beginning there is a dict named components with asset_type as keys and the verbose name as Value

    At this stage the component will be visible within the GUI and can be dragged to the energy system. However option a) doesn't provide out of the box access to the component's fields, whereas option b) does.
    To change this one need to be able to set the model attribute of the Meta class to something else than Asset (ie a decorator function which would find the new asset's Model from a dict and return a CreateAssetForm instance with modified Meta

@Bachibouzouk Bachibouzouk requested a review from paulapreuss July 8, 2026 13:11
Inherting from Asset might be preferable, as the class remain a child of
Asset, one can always use Asset.objects.filter(asset_type=...)
The ModelForm is instanciated with a Meta class referring to the
specific asset model if differing from Asset. Currently problems remain
at the export to datapackage and export scenarios
@Bachibouzouk Bachibouzouk force-pushed the feature/introduce-new-component branch from b3b2e5d to fd1cf09 Compare July 13, 2026 14:02
@Bachibouzouk

Copy link
Copy Markdown
Author

Now export of the scenario produces an error but only when the scenario is reimported and the special component clicked

The new asset specific fields are successfully exported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant