2

我尝试在特征因子不确定的情况下进行蒙特卡洛分析。代码运行良好(没有错误),但每次迭代的结果始终相同。计算仅适用于 LCA 模拟。

这是代码:

样品 LCIA 方法的定义

some_exchange = bw.Database('biosphere3').random()
my_cf = [(some_exchange.key,
      {"amount": 10,
       "uncertainty_type": 4,
       "minimum": 0,
       "maximum": 20}
     )]
uncertain_method = bw.Method(("fake", "method", "with uncertainty"))
uncertain_method.write(my_cf)

简单活动的定义

simple_LCI_db = bw.Database('simple LCI db')
simple_LCI_db.write(
    {('simple LCI db', 'some_code'): 
        {'name': 'fake activity',
         'unit': 'amount',
         'exchanges': 
            [
                {'input': ('simple LCI db', 'some_code'),
                 'amount': 1,
                 'type': 'production'},
                {'input': some_exchange.key,
                 'amount': 1,
                 'type': 'biosphere'},                
            ]
        },

})

蒙特卡洛代码

mc = bw.MonteCarloLCA({('simple LCI db', 'some_code'):1}, ('fake', 'method', 'with uncertainty'))
next(mc)

不确定性定义有问题吗?

感谢您的帮助!

4

1 回答 1

0

您只需要uncertainty dictionary稍微不同地定义您的:在 Brightway 中,uncertainty type写的是没有_,即

my_cf = [(some_exchange.key,
      {"amount": 10,
       "uncertainty type": 4, #and not "uncertainty_type"
       "minimum": 0,
       "maximum": 20}
     )]

您可以在Brightway 文档中查看uncertainty dictionaryBrightway 框架中的架构

您编写它的方式与stats_arrays 文档中定义的一样。我不知道它们为什么不同,即为什么在一种情况下我们有uncertainty type而在另一种情况下uncertainty_type,但只需删除您_的代码,您的代码就可以工作。

于 2017-06-16T17:56:34.917 回答