-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unsupplied_junctions and elements_on_path to pandapipes
- Loading branch information
Moritz Franz
committed
Jan 16, 2024
1 parent
613fe60
commit 3a15834
Showing
4 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright (c) 2020-2024 by Fraunhofer Institute for Energy Economics | ||
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
from pandapipes.component_models.abstract_models.branch_models import BranchComponent | ||
|
||
|
||
def get_all_branch_component_models(): | ||
""" | ||
Get all models of available branch components | ||
:return: branch model | ||
:rtype: list | ||
""" | ||
def get_all_subclasses(cls): | ||
all_subclasses = list() | ||
for subclass in cls.__subclasses__(): | ||
all_subclasses.append(subclass) | ||
all_subclasses.extend(get_all_subclasses(subclass)) | ||
return all_subclasses | ||
|
||
all_branch_components = get_all_subclasses(BranchComponent) | ||
filtered = list() | ||
for bc in all_branch_components: | ||
try: | ||
bc.table_name() | ||
filtered.append(bc) | ||
except Exception as e: | ||
# component does not have a table_name implemented | ||
continue | ||
return filtered | ||
|
||
|
||
def get_all_branch_component_table_names(): | ||
""" | ||
Get all table names of available branch components | ||
:return: table names | ||
:rtype: list | ||
""" | ||
cm = get_all_branch_component_models() | ||
return [c.table_name() for c in cm] |