The Camunda 8 Connector for Carbon-Aware Process Execution

Reduce the environmental impact of your business processes using Camunda and carbon-aware process execution.
By
  • Blog
  • >
  • The Camunda 8 Connector for Carbon-Aware Process Execution
TOPICS

30 Day Free Trial

Bring together legacy systems, RPA bots, microservices and more with Camunda

Sign Up for Camunda Content

Get the latest on Camunda features, events, top trends, and more.

TRENDING CONTENT

Climate change has the potential to cause unprecedented natural disasters that impact, inter alia, food production and thereby threatens livelihoods. In result, governments across the world adopted the Paris Agreement in 2015 [MFS20], committing to implement measures in order to keep the global temperature increase below 2°C compared to pre-industrial levels. In order to limit the global temperature increase, it becomes necessary to drastically reduce carbon (CO2) emissions, so that there are net zero emissions in the long run. According to [Fr21], the IT sector produces 2.1%-3.9% of global greenhouse gas emissions. Therefore, the IT sector must strive to reduce its emissions, in order to positively contribute towards the overall goal of the Paris Agreement.

The Camunda Carbon Reductor [CCR] can contribute to reduce the environmental impact of digitized business processes in Camunda, by time shifting the execution of energy intensive activities. Executing activities of a business process at times at which energy sources with low CO2 emissions (e.g. solar energy) is available, is called carbon-aware process execution.

In traditional BPM, the main performance dimensions for which processes are optimized for are usually time, cost and quality. With this work, we aim to raise awareness that the dimension of ecology should also be seen as an equal as illustrated in Figure 1.

The triangle of Time/Quality/Costs is changed to a pyramid, now representing Time/Quality/Costs and Ecology.
Figure 1: Performance Dimensions

Camunda Carbon Reductor

The Camunda Carbon Reductor is a Camunda Connector consisting of an element template that is modelled in front of energy-intensive activities and time shifts their execution to time windows when renewable energy sources are available.

Time shifting energy-intensive activities

Energy-intensive activities may not be time shifted arbitrarily. Business processes are subject to constraints, namely, service level agreements (SLA). The most common SLA is the maximum execution time, which specifies a time window for a certain part of a business process, which may not be exceeded when executing this part of the business process.

Assume the business processes, given by Figure 2, consist of a couple of activities at the beginning and an energy-intensive service activity at the end. In front of the energy-intensive activity, the Camunda Carbon Reductor is modelled. For the business process, a milestone and a maximum execution time from this milestone to the end of the business process is specified. Then, it is possible to derive the time since the milestone to the Camunda Carbon Reductor and the time of the remaining activities from the Camunda Carbon Reductor to the end of the business process. Based on these time windows the time window for time shift can be calculated. This time window for time shift is the time window in which the time window with the fewest carbon emissions can be determined.

Time-window-shift
Figure 2: Determination of Time Window for Time Shift

The following equation describes how to determine the time window for time shift:

tshift = tMET − (tmilestone  + tremaining)

  • tshift is the time window for time shift, i.e. the maximum time the subsequent activity may be postponed.
  • tMET is the maximum execution time of the business process (i.e. the SLA)
  • tmilestone is the duration since milestone
  • tremaining is the estimated duration of the remaining activities

For better illustration: To determine the purple time window for time shift in Figure 2 the green arrows need to be subtracted from the red arrow.

Connector implementation

When implementing the approach for the Camunda Carbon Reductor, two challenges need to be faced. First, a forecast of the carbon-intensity of the energy of the region the energy-intensive activity is running in is needed. And second, the Camunda Carbon Reductor shall be a reusable model element that is easy to integrate into process models and effortlessly usable.

For the forecast of the carbon-intensity of energy, there are a few web APIs that might be used. Currently, the Camunda Carbon Reductor supports two of them while being open for the support of further APIs. The supported APIs are CarbonAwareWebAPI of the Green Software Foundation [CASDK] and the CarbonAwareComputing API [CAC].

In order to account for the second challenge, the Camunda Carbon Reductor is implemented as Connector-like System as it is called in the Camunda Docs [CD]. A pure Connector runs in a Connector Environment which takes care of Camunda 8 specific API calls, which is why a Connector does not have access to low-level APIs (at the moment, see [PR]). However, to time shift a business process (i.e. suspend and resume a business process) access to low-level API is necessary. Therefore, the combination of an element template of a Connector and a Job Worker is the perfect fit for this use case. An element template is a reusable building block that integrates easily and effortlessly into process models. The developer who is modelling the process just needs to fill in the configuration and the Camunda Carbon Reductor is running. The following configuration is required:

  • The location where the energy-intensive activity is executed in. This information is used to get a forecast of the carbon-intensity of energy.
  • An estimated duration of the remaining activities.
  • A milestone, which is a timestamp. It is (any) starting point for the SLA based duration calculation; per default, the moment the connector starts as it is shown in Figure 3 with = now().
  • The maximum execution time a process instance is allowed to take from the milestone to finish to be SLA compliant.

Figure 3 shows a service task that is configured to be the Camunda Carbon Reductor. It can be seen that the aforementioned configuration fields need to be filled in.

A screenshot of a computerDescription automatically generated with medium confidence
Figure 3: Connector Template

Once a process instance arrives at the Camunda Carbon Reductor the corresponding Job Worker picks up the Job. The following code extract shows schematically how the Job Worker works.

@Component 
public class CarbonReductorWorker { 
    ... 
    @JobWorker(type = "de.envite.greenbpm.carbonreductorconnector.carbonreductortask:1") 
    public void execute(ActivatedJob job) throws Exception { 
        if (!alreadyTimeshifted(job)) { 
            Forecast forecast = getForcast(job); 
            Delay delay = calculateDelay(forecast); 
            writeToProcessInstance(job, forecast, delay); 
            if (delay){ 
	     failJob(job, delay); 
            } else { 
                completeJob(job); 
            } 
        } else { 
            completeJob(job); 
        } 
    } 
    ... 
}   

The Job Worker consists of a method that is annotated with @JobWorker. In the annotation, zeebe:taskDefinition:type is specified so that the Job Worker knows what Jobs to fetch. When the Job Worker gets executed, first, it is checked whether this business process instance was already time shifted. If it was, the job is completed immediately. Otherwise, a forecast of the carbon-intensity is fetched using one of the available APIs. Then, a time window is determined when energy with little carbon emissions is available taking the configuration and the forecast into account. The results are written to the process instance for reporting purposes.

If renewable energy sources are available right away, no delay is calculated. Otherwise, the job is failed with the calculated delay. After the delay, when renewable energy sources are available, the method of the Job Worker is executed again. As this business process has already been time shifted, the job will not be time shifted again, but instead it gets completed immediately.

Evaluation of time shifted activities

The Camunda Carbon Reductor generates output data like the delay of the process instance, the original carbon emissions per kwh (i.e. the carbon emissions that would have been emitted when the process had been executed immediately) and the actual carbon emissions that have been emitted during the execution of the energy-intensive activity.

Using this information, a dashboard like the one displayed in Figure 4 can be created in Camunda Optimize. The dashboard shows, inter alia, the saved carbon emissions per kWh in percentage and in absolute numbers.

A screenshot of a computerDescription automatically generated with medium confidence
Figure 4: Optimize Dashboard

Conclusion

Climate change is a challenge for society as a whole. The IT sector also needs to contribute to overcome it by reducing carbon emissions. To this aim, the Camunda Carbon Reductor supports companies with an easy-to-apply approach in making process application carbon-aware, i.e. time windows can be chosen for running the energy-intensive activities in which energy from sustainable sources is available. The Camunda Carbon Reductor is publicly available [CCR] and can directly be used both for Camunda Platform 7 and 8.

It is important that CO2 emissions are not the only KPI in regard to the environmental impact (e.g. water consumption, waste, etc.). However, reducing the carbon footprint is uniformly viewed as important in the context of Green BPM, which makes us confident that the Camunda Carbon Reductor is a positive step towards improving the environmental impact of business processes.

Sources

[CAC] Carbon Aware Computing.

[CASDK] Carbon Aware SDK.

[CCR] Camunda Carbon Reductor.

[CD] Camunda Docs.

[Fr21] Freitag, C. et al.: The real climate and transformative impact of ICT: A critique of estimates, trends, and regulations. Patterns (New York, N.Y.) 9/2, S. 100340, 2021.

[MFS20] Matemilola, S.; Fadeyi, O.; Sijuade, T.: Paris Agreement. In (Idowu, S. et al. Hrsg.): Encyclopedia of Sustainable Management. Springer International Publishing, Cham, S. 1–5, 2020.

[PR] Pull Request.

Start the discussion at forum.camunda.io

Try All Features of Camunda

Related Content

Achieve our first certification as a Camunda Certified Professional—Developer.
Operationalize your processes with AI and machine learning to improve how your organization interacts with clients.
Useful process intelligence is important for evaluating whether your processes are putting you on track for your goals. Learn how Camunda Optimize and Process KPIs can help.