-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offline bus #566
Comments
Issue unexpected behaviors of
|
Not sure what went off, but with my fresh installation of ANDES, second case seems to work:
|
The following is my result. It needs a fix.
|
I doubled checked and you are right, this one work as expected. My end messed up due to my local development. |
I'm happy to do it, and I am actually doing it. Welcome your further suggestions if anything worth our attention. |
andes/andes/core/model/modeldata.py Lines 322 to 334 in 5ab784b
It can be fixed from here. It might introduces one change. The output shall always be a list, which has the same length as |
Develop a model
|
@cuihantao Hantao, my ongoing work of connectivity manager is in https://github.com/jinningwang/andes/blob/conm/andes/core/connman.py The outline is excerpted below for discussion, your suggestions are very welcome. class ConnMan:
"""
Define a Connectivity Manager class for System
"""
def __init__(self, system=None):
"""
Initialize the connectivity manager.
system: system object
"""
self.system = system
self.busu0 = None # placeholder for Bus.u.v
self.is_act = False # flag for act, True to act
def init(self):
"""
Initialize the connectivity.
"""
self.busu0 = self.system.Bus.u.v.copy()
return None
def record(self):
"""
Record the bus connectivity in-place.
"""
self.busu0[...] = self.system.Bus.u
return None
def act(self):
"""
Update the connectivity.
"""
if not self.is_act:
logger.debug('Connectivity is not need to be updated.')
return None
# --- action ---
pass
self.system.connectivity(info=True)
return None My considerations:
|
Thanks! I know you are looking to implement a mechanism to handle offline devices by turning off connected devices. Its better to start the design with how you expect to to use it: when, where and how it’s going to be called. Sent from my iPhoneOn Oct 5, 2024, at 2:45 PM, Jinning Wang ***@***.***> wrote:
@cuihantao Hantao, my ongoing work of connectivity manager is in https://github.com/jinningwang/andes/blob/conm/andes/core/connman.py
The outline is excerpted below for discussion, your suggestions are very welcome.
class ConnMan:
"""
Define a Connectivity Manager class for System
"""
def __init__(self, system=None):
"""
Initialize the connectivity manager.
system: system object
"""
self.system = system
self.busu0 = None # placeholder for Bus.u.v
self.is_act = False # flag for act, True to act
def init(self):
"""
Initialize the connectivity.
"""
self.busu0 = self.system.Bus.u.v.copy()
return None
def record(self):
"""
Record the bus connectivity in-place.
"""
self.busu0[...] = self.system.Bus.u
return None
def act(self):
"""
Update the connectivity.
"""
if not self.is_act:
logger.debug('Connectivity is not need to be updated.')
return None
# --- action ---
pass
self.system.connectivity(info=True)
return None
My considerations:
status flag is_act to enable lazy evaluation
In model Bus, overwriting set and alter to set is_act if values changed
In action part, use Model.set to achieve target devices connectivity change
In this module, define an OrderedDict to define the connectivity check logic
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@cuihantao I summarized my thoughts as below. Usage Scenarios
Proposed development effortsDevelop a module named When described things happened, mark a flag. Before running any analysis routine, do the connectivity action if flagged. |
Can you turn these descriptions into code which describes how you expect to use your design? That will also help you think about the design. The class API design is not the usage code. |
Implementation planConnectivity Manager Classclass >>> ss = andes.load(andes.get_case('ieee14/ieee14_conn.xlsx'))
>>> ss.conn
<andes.core.connman.ConnMan at 0x11cb3f2b0>
>>> ss.conn.busu0
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] Usage ScenariosAction flag triggering conditionLet say, there is one bus offline in any following way:
The connectivity action flag should be True. >>> ss.Bus.u.v
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
>>> ss.conn.to_act
True Before a routine is initializedWhen running any routine analysis, the system will check the connectivity action flag, and run the connectivity act if it is True. This is applicable for all the three routiens, PFlow, TDS, and EIG. # In the `Routine.init()`, add a flag check
class Routinebase:
def init(self):
if self.system.conn.to_act:
self.system.conn.act()
... # existing code The logging message should be like: >>> ss.<Routine>.init()
Connectivity action is required. Running connectivity action...
Bus <15> is offline, involved Line <15-16> is turned off. After a routine is initializedFor PFlow and EIG, once the action flag is true, the routine results should be reset. For TDS, once the action flag is true, the Bus online status should not be changed. >>> ... # previous code that a Bus is offline
>>> ss.PFlow.init()
Connectivity action is required. Running connectivity action...
Bus <15> is offline, involved Line <15-16> is turned off.
>>> ... # previous code that a Bus is offline
>>> ss.EIG.init()
Connectivity action is required. Running connectivity action...
Bus <15> is offline, involved Line <15-16> is turned off.
>>> ... # previous code that a Bus is offline
>>> ss.TDS.init()
Bus connectivity status changed, but it is not allowed after TDS initialization.
The action is not taken, and TDS running is aborted. |
Addressed by the development of Connectivity Manager, #576 |
Describe the bug
When some Buses are offline (
u=0
), they seem to be still in power flow calculation.To Reproduce
In this case, Bus with
idx=1
is connected with Lines withidx in [0, 3, 6]
Minimal code:
Return:
Expected:
Note: the involved line should have no line flow, and other places numerical values are not necessary to be accurate
Expected behavior
For Lines, their effective online status should take that into account that the connected bus status.
Desktop (please complete the following information):
andes misc --version
)**pip packages (please paste the output from
pip list
)Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: