Comments (4)
Hi Yalin, I have run into errors when evaluating Monte Carlo. It usually means that the system is not robust (i.e. accumulation of energy/material in streams), or going to an infeasible region (the conversions are too high or something). One problem with using try and exceptions is that information from the last run still lingers and causes a cascade of infeasible scenarios. This could be fixed by resetting all flows each time a system fails. However, if the system is not robust, you could be getting significantly different results for very similar scenarios when you reset flows.
I think you could add the try and except blocks in the <Model>.evaluation
method (lines 145, 146) and see what you get:
try:
simulate()
except:
self._system.reset_flows()
values[i] = [None] * len(funcs)
else:
values[i] = [i() for i in funcs]
I'd be willing to make this can be an optional behavior in BioSTEAM if you'd like to make a pull request ;)
Alternatively, you could run each sample in the model outside the evaluate method:
for i in samples:
# Some debugging stuff or, save data
results_dict = model(i)
If you still can't find where the system is failing I'd be happy to help you out too.
from biosteam.
A quick followup that just adding the try/except block won't work (because all flows are set to 0, it leads to divide by 0 error when simulating stream price for TEA). So I think I'll work around this for now. But it's good to know the reset_flows
method, would save me a lot of time (I used to restart the kernel every time to de-cache)
However this leads to some additional questions:
- When using
<Model>.evaluate
, does it retain the system's setting on converge_method, maxiter, and molar_tolerance? - If I let my system simulate for five times within the system.py, when executing
<Model>.evaluate
, for each scenario, will my system be simulated for only once or six times?
Thanks!
from biosteam.
Hmm, the streams should have a flow after simulating again... Could one of your products not be updated by simulating the system? As for your numbered questions:
- Yes, all settings are kept.
- The system is only simulated once in each scenario. If your results are changing significantly after resimulating the system, there may be a problem in one of your units (energy or mass balance). If you send me the files, I can help you debug it.
from biosteam.
Thanks for answering my question!
As for the try/except thing, I tried to manually reset my system flows and re-simulate and it worked, so I'm not sure what exactly happened, but I made a couple of changes since that so those might have helped. The unfortunate (or fortunate) thing is that I can run Monte Carlo without getting errors for small trials, so I'll close this for now and maybe revisit when I ran into the problem again, thanks!
from biosteam.
Related Issues (20)
- High CAPEX cost at low pumping rates HOT 4
- Small error in `BoilerTurbogenerator` design cause negative work/cost HOT 2
- Negative water flows in permeate of AnMBR in high-rate WWT system HOT 4
- Notice: Moving to Python 3.11 in October
- AttributeError: 'Stream' object has no attribute 'indices' HOT 1
- Kinetic model does not take 't' into account HOT 1
- Unable to get graphic data like Diagrams and graphs HOT 1
- numba inlines biosteam.CE value into compiled code HOT 4
- Better batch design HOT 3
- Power consumption default in AeratedBioReactor needs more detail HOT 2
- Biogas upgrading HOT 1
- Depreciable capital in NPV calculation HOT 24
- Valve node has no label
- Unit z_mol_in and z_mol_out properties don't work
- Compressor type and adding Cooling Agent HOT 15
- Implement Blower as a Compressor type
- Include special-case utilities in utility worksheet.
- Sub class modelling of CSTR HOT 1
- Reactor duty for sub class modelling of CSTR
- Minor issues with high-rate WWT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biosteam.