use of org.openlca.ilcd.processes.Exchange in project olca-modules by GreenDelta.
the class ExchangeExtensionTest method testEmpty.
@Test
public void testEmpty() {
Exchange raw = new Exchange();
raw.id = 1;
Exchange exchange = io(raw);
assertTrue(exchange != raw);
ExchangeExtension extension = new ExchangeExtension(exchange);
assertNull(extension.getAmount());
assertNull(extension.getFormula());
assertNull(extension.getPropertyId());
assertNull(extension.getUnitId());
assertFalse(extension.isValid());
}
use of org.openlca.ilcd.processes.Exchange in project olca-modules by GreenDelta.
the class ExchangeExtensionTest method createExchange.
private Exchange createExchange() {
Exchange exchange = new Exchange();
exchange.id = 1;
exchange.meanAmount = 500;
ExchangeExtension extension = new ExchangeExtension(exchange);
extension.setAmount(42);
extension.setFormula("2 * Pi * sqr(r)");
extension.setPropertyId("property-id");
extension.setUnitId("unit-id");
extension.setDefaultProvider("abc-def");
extension.setAvoidedProduct(true);
return exchange;
}
use of org.openlca.ilcd.processes.Exchange in project olca-modules by GreenDelta.
the class ProcessReadWriteTest method createExchange.
private void createExchange(Process process) {
Exchange exchange = new Exchange();
exchange.meanAmount = 1.5;
process.exchanges.add(exchange);
}
use of org.openlca.ilcd.processes.Exchange in project olca-modules by GreenDelta.
the class ProcessSampleTest method testAllocation.
@Test
public void testAllocation() {
with(p -> {
Exchange e = p.exchanges.get(0);
assertEquals(2, e.allocations.length);
AllocationFactor f = e.allocations[1];
assertEquals(57.98, f.fraction, 1e-10);
assertEquals(1, f.productExchangeId);
});
}
use of org.openlca.ilcd.processes.Exchange in project olca-modules by GreenDelta.
the class AllocationFactors method addCausalFactor.
private void addCausalFactor(AllocationFactor factor) {
Exchange exchange = exchangeMap.get(factor.exchange);
if (exchange == null)
return;
Exchange product = findProduct(factor);
if (product == null)
return;
addFactor(exchange, factor.value, product.id);
}
Aggregations