我正在测试如何在brightway中向我的biosphere3矩阵添加一个新的"activity“,我在我的technosphere矩阵中得到了一个我不期望的新列(对应于我的新生物圈节点的id )。这是预期的行为吗?并不是说我想坚持传统,而是技术领域矩阵中的列通常不是“基本流程”。我使用的是bw2calc版本(2.0.DEV1)和bw2data版本(4.0.DEV1)
下面是一些尝试重现此行为的代码:
b3 = bw2data.Database('biosphere3')
uwva_node = b3.new_activity(code='uwva_ppp',
name='utility weighted value added (PPP)',
categories=('social',),
unit = 'Meuro_ppp',
)
uwva_node.save()act1_key=('test_db','activity_1')
biosphere_exchange_1={'amount':2,
'input':uwva_node.key,
'output':act1_key,
'type':'biosphere',
'uncertainty type': 0}
production_exchange_1={'amount':2,
'input':act1_key,
'output':act1_key,
'type':'production',
'uncertainty type':0}
act_1_dict={'name':'test_activity_1',
'unit':'megajoule',
'exchanges':[production_exchange_1,biosphere_exchange_1]}
act2_key=('test_db','activity_2')
production_exchange_2={'amount':10,
'input':act2_key,
'output':act2_key,
'type':'production',
'uncertainty type':0}
technosphere_exchange_1={
'amount':10, #
'input':act1_key,
'output':act2_key,
'type':'technosphere',
}
act_2_dict={'name':'test_activity_2',
'unit':'megajoule',
'exchanges':[production_exchange_2,technosphere_exchange_1]}
database_dict={act1_key:act_1_dict,
act2_key:act_2_dict}
db=bw2data.Database('test_db')
db.write(database_dict)如果我计算库存,我会得到一个3列的technosphere矩阵。我的新生物圈活动也在技术圈矩阵上。
act2 = bw2data.get_activity(act2_key)
lca = bw2calc.LCA({act2:1})
lca.lci()
lca.technosphere_matrix.todense()
assert uwva_node.id in lca.dicts.activity
assert uwva_node.id in lca.dicts.biosphere发布于 2021-08-19 11:22:55
当你创建uwva_node时,你没有告诉Brightway它是什么type,所以它认为它是一个正常的活动,应该适合技术领域。因此,因为您没有给它一个产品交换,所以它是1的assumed that there was an implicit production amount,这就是您在技术领域中看到的。
您可以通过将新的活动类型指定为process以外的任何值来修复此问题,例如
uwva_node = b3.new_activity(code='uwva_ppp',
name='utility weighted value added (PPP)',
categories=('social',),
unit = 'Meuro_ppp',
type="social",
)https://stackoverflow.com/questions/68846118
复制相似问题