Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Create a product system

This method creates a product system for a given process. It recursively links the processes of that system according to the given linking configuration. The process must have a quantitative reference. The method returns a reference to the new product system, which is stored in the database.

JSON-RPCRESTParametersReturns
data/create/systemPOST data/create-systemprocess: Ref[Process], config: LinkingConfig (optional)Ref[ProductSystem]

The linking configuration defines how the processes are linked:

  • providerLinking: whether default providers of exchanges should be ignored (IGNORE_DEFAULTS), preferred (PREFER_DEFAULTS), or exclusively used (ONLY_DEFAULTS).
  • preferUnitProcesses: if there are multiple possible providers of a product, unit processes are preferred over system processes when this is true.
  • cutoff: an optional cutoff value; product inputs or waste outputs with a demand below this value, relative to one unit of the reference product of the system, are not linked further.

Try it

You can edit and execute the example below. Just make sure an openLCA IPC server is running on port 8080:

// This example tries to find a process with this name and builds a product
// system from it. Note that it can take a bit until this method completes.
const processName = "grape production | grape | Cutoff, U";

const processes = await call("data/get/descriptors", { "@type": "Process" });
const process = processes.find((d) => d.name === processName);
if (!process) {
  throw new Error(`Could not find process: ${processName}`);
}

const system = await call("data/create/system", {
  process: { "@type": "Process", "@id": process["@id"] },
  config: {
    preferUnitProcesses: true,
    providerLinking: "PREFER_DEFAULTS",
  },
});
console.log(`created product system ${system.name}, id=${system["@id"]}`);

Python IPC

import sys

import olca_ipc as ipc
import olca_schema as o

client = ipc.Client()

# this example tries to find a process with this name
# and builds a product system from it
process_name = "grape production | grape | Cutoff, U"

process_ref = client.find(o.Process, process_name)
if process_ref is None:
    print(f"Could not find process: {process_name}")
    sys.exit(1)

config = o.LinkingConfig(
    prefer_unit_processes=True,
    provider_linking=o.ProviderLinking.PREFER_DEFAULTS,
)
system_ref = client.create_product_system(process_ref, config)
if system_ref is None:
    print("Failed to create the product system")
    sys.exit(1)
print(f"created product system {system_ref.name}, id={system_ref.id}")