Matias - 1 year ago 111

Python Question

I have the following result:

`Time Production`

0 360

10 362

15 365

30 380

32 381

.. ..

The first column is the (simulation) time (not equi-distant); the second column is the production in kW.

Now i want to calculate the total production in kWh --> therefore i want to integrate the Production. Is there a straightforward way to do this in Python (numpy?)?

Thank you very much for your time.

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

You can use numpy trapizium rule to approximate,

```
import numpy as np
t = [0, 10, 15, 30, 32]
p = [360, 362, 365, 380, 381]
a = np.trapz(p,t)
print(a)
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**