BioSTEAMDevelopmentGroup / biosteam

The Biorefinery Simulation and Techno-Economic Analysis Modules; Life Cycle Assessment; Chemical Process Simulation Under Uncertainty
Other
179 stars 35 forks source link

Sub class modelling of CSTR #196

Closed Omotola94 closed 8 months ago

Omotola94 commented 8 months ago

Describe the bug A clear and concise description of what the bug is. Encountered series of bugs,I believe it is with my sub class modelling of CSTR.

To Reproduce Reactor model.txt

Expected behavior I am expecting the reactor to give product based on the reaction provided to run in a continuous method, just like the continuous fermentation example

Actual behavior Full trace back, as Screenshot 2024-03-15 112814 text or a screenshot

Version

Additional context In addition, I am finding it difficult to add auxiliary units for example recirculation pump and an exchanger.

yoelcortes commented 8 months ago

@Omotola94,

On first impression, the code looks good except for this one line:

effluent.mix_from(self.ins[0])  # Mix feed with effluent

Note that mix_from expects a list/iterable of streams, not a single Stream object. You can replace this line with:

effluent.copy_like(self.ins[0]) # Or effluent.mix_from([self.ins[0]]) 

I'm also going to add a better error message for this case (when users try to use a stream like an iterable).

Let me know if you run into anything else! Thanks,