0 votes
563 views

I am receiving a relatively large number of errors when I run my Monte Carlo assessment, all or most of which have the following form (image below):

Examining the parameters mentioned in this log entry I see no issues (i.e. all the formulas are evaluating appropriately). A little more background, the Monte Carlo proceeds and I get a result. When I create a new product system for specific processes that call these parameters (within my larger product system), every simulation beyond the first one produces an identical result. 

A few questions:

  • Any general suggestions on errors of this form would be useful.
  • Can you recommend any specific resources for interpreting and resolving Errors catalogued in the console? For example, the error defines locations such as "line 1, column 40 at line 1". To what is this referring and can it be used to resolve errors?
  • Is there a script or other command that I can use to export a copy of all parameter values for for each simulation within a monte carlo run? I would like to see if certain parameters are not evaluating and maybe trace that back to a source.

My apologies if I am missing something simple. Thank you in advance for your help!

in openLCA by (190 points)

1 Answer

0 votes
by (114k points)

The screenshot is somewhat hard to read (you could also copy as text, e.g., that would be easier) but I think I see sth like "evaluation of expression NO2ground failed". These errors should be fixed. You can see all incorrect formulas (and other issues in the database) by running a database validation, and can then jump to the listed incorrect formulas directly.

Common mistakes are commas instead of dots for decimal separators, but also typos in parameter names, or missing parameters that are input somewhere. The parameters are a bit tricky since the formula field is just text, and parsed afterwards, which means that you can initially enter also incorrect formulas. You see this though in the process by switching from formula view to amount view, the amount view shows then 0:

(entering independent and dependent parameter)

(entering in the process amounts)

(formula is evaluated and an incorrect formula is flagged but you can proceed)

From the formula view to the values view

and vice versa. So with the incorrect formula:

I hope this helps!

Best wishes,

Andreas

by (190 points)
Thank you Andreas for the suggestions.

I performed a database validation and no issues were identified. I also went through all of my processes and switched between formula and value view and checked to see that everything was evaluating, and it appears to be. I also went through all global dependent parameters to see that they were evaluating to a number, and they are.

Following is the text from one of my error messages. All follow the same basic form. Apologies that the original image was of poor quality.

This particular text from the error message has me wondering if there is some deeper issue beyond just an incorrectly entered formula: "Second evaluation call on variable digestate_n. Cyclic dependencies?" It seems to speak to the issue that I am seeing where the first simulation produces a unique result, while all subsequent simulations produce identical values.

Thanks!

Error Message:
org.openlca.expressions.InterpreterException: Evaluation of expression Avoided_Urea/Compost failed: Evaluation of variable avoided_urea failed: Evaluation of variable nitrogen failed: Evaluation of variable digestate_n_share failed: Second evaluation call on variable digestate_n. Cyclic dependencies? at line 1, column 40 at line 1, column 45 at line 1, column 1 at line 1, column 1
     at org.openlca.expressions.Scope.eval(Scope.java:61)
     at org.openlca.core.matrix.CalcExchange.matrixValue(CalcExchange.java:83)
     at org.openlca.core.matrix.uncertainties.UExchangeCell.next(UExchangeCell.java:39)
     at org.openlca.core.matrix.uncertainties.UMatrix.generate(UMatrix.java:88)
     at org.openlca.core.matrix.MatrixData.simulate(MatrixData.java:73)
     at org.openlca.core.math.Simulator.generateData(Simulator.java:209)
     at org.openlca.core.math.Simulator.nextRun(Simulator.java:153)
     at org.openlca.app.results.simulation.SimulationProgress.doNextRun(SimulationProgress.java:57)
     at org.openlca.app.results.simulation.SimulationProgress.run(SimulationProgress.java:41)
     at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
    Caused by: org.openlca.expressions.ExpressionException: Evaluation of variable avoided_urea failed: Evaluation of variable nitrogen failed: Evaluation of variable digestate_n_share failed: Second evaluation call on variable digestate_n. Cyclic dependencies? at line 1, column 40 at line 1, column 45 at line 1, column 1 at line 1, column 1
     at org.openlca.expressions.VariableFunction.evaluate(VariableFunction.java:35)
     at org.openlca.expressions.OpDivision.evaluate(OpDivision.java:7)
     at org.openlca.expressions.Scope.tryEval(Scope.java:71)
     at org.openlca.expressions.Scope.eval(Scope.java:58)
by (160 points)
Hi, did you find a solution to this? I have exactly the same problem.

Best,
Maja
by (190 points)
Hi Maja,

    I did ultimately resolve this issue. The relationship between my solution and the error is not 100% clear to me, so it can be difficult to explain. Ultimately, I believe that there was too much looping (dependencies) within the model for the Monte Carlo assessment to handle it. I had a lot of layered calculations with some feedback between global parameters, process input parameters, and calculated process parameters (all of which had uncertainty ranges) which I think overwhelmed the calculation. Ultimately, I simplified several of my calculated global and process parameters a little and the error went away. It was a bit of a trial and error process. I was unable to find any actual issue with how I had set it up (as I indicated previously, the database validated just fine), but it just wouldn't work.

I think the most concise way I can put it would be to look for instances where within the monte carlo analysis a process parameter (with an uncertainty range) affects the value of a global parameter (also with an uncertainty range), or vice versa. This seemed to be the source of my issue. I changed a few key parameters from calculated parameters to static values (which got rid of some of the looping) and it ran successfully. This did remove some of the dynamics within the model, but I decided this was acceptable for my purposes. If you examine the error message in detail it should indicate what expressions are failing and this will clue you in as to where to start looking for such issues. Sorry this isn't more concrete or specific to your issue, but I hope it helps.
by (160 points)
Thank you, that's very helpful!
I also solved the issue now by making all of my parameters global. Seems like the program couldn't handle local parameters, even though they were fixed values without any uncertainty assigned to them.
...