Skip to content
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

Small error in BoilerTurbogenerator design cause negative work/cost #151

Closed
yalinli2 opened this issue Mar 29, 2023 · 2 comments
Closed

Comments

@yalinli2
Copy link
Member

@emilypl2 and I ran into a problem when running the lactic acid module with biosteam's BoilerTurbogenerator. Essentially a very small negative value (to 10-15) was calculated for H_electricity:

H_electricity = H_content - H_steam

which led to negative work and error in decorated cost calculation:

C[i] = I * (x.f(F) if x.f else x.cost * F**x.n)

I locally inserted a line H_electricity = 0 if abs(H_electricity)<1e-6 else H_electricity to temporarily fix it for now, but not sure if it's good for a permanent fix, thanks!

@yoelcortes
Copy link
Member

@yalinli2,

The temporary fix confuses the solver. I added some code to handle this special case. I am not able to test it, but I believe it should fix your issue:

if self.cooling_duty > 0.:

Thanks,

@yalinli2
Copy link
Member Author

lol I know my two-second fix would be problematic, I think your fix works, thank you!

@emilypl2 I didn't test all the way through, feel free to reopen this issue and follow up if you run into future problems!

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

No branches or pull requests

2 participants