Closed yalinli2 closed 1 year ago
@yalinli2, sure thing, there is actually a good way to do this:
Systems remember their original configuration by default to enable agile systems and have multiple systems with different configurations. To "refresh" the system, you can pass "update_configuration=True" during simulation.
If you only changed unit connections:
system.simulate(update_configuration=True)
If you also have new units:
system.simulate(update_configuration=True, units=units)
Unit connections are also updated dynamically (i.e., if connections change during simulation). I hope this helps!
ah I see! I tried sys._setup(update_configuration=True)
but probably messed up somewhere so it wasn't working as I expected, thanks @yoelcortes !
This request originates from my recent trials to replace just one stream of a system, but couldn't find a best way to do so. For the corn stover biorefinery, I was hoping to just replace the feedstock from the original
cornstover
to a newmiscanthus
stream, however, I'm not sure how to best handle the connections and update theSystem.streams
,System.feeds
, etc., so this is what I ended up with:It works but I don't like how I made it work, so just wondering is there a better way to do so, or could we add a
replace
function for streams and units (maybe even systems, not sure if it's good)? Thanks!