# Energy and utilities

> 5 Energy and utilities use cases of Curva, each run on a real model, with what it answered.

Source: https://docs.tarkova.com/curva/use-cases/energy-and-utilities/

5 use cases, 15 of 15 samples right. [How these were run](/curva/use-cases/).

## Sort calls to a power company's helpline

A wire down on a road can't wait behind billing questions, so each message gets a category and a decision on sending a crew now.

3 of 3 samples right.

```python
from curva import Choice, Noul
d = curva.decide(text, {
    "category": Choice("What is this message about?", {
        "danger": "a risk to life, such as a fallen wire, sparks or a shock",
        "outage": "no power, with no danger described",
        "billing": "a bill or a payment",
        "new_connection": "getting a new connection or more load",
    }),
    "send_crew_now": Noul("Must a field crew go out right now?").depends("category"),
}, project="usecases")
```

**Wire on the road**: Right, 612 ms

> A live wire has fallen on the road outside the school in Ward 9 and it is sparking. Children are walking past. Please come fast.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| category | danger | danger | 100% |
| send&#95;crew&#95;now | Yes | Yes | 100% |

**Billing question**: Right, 641 ms

> My bill this month is double last month's, even though we were away for two weeks. How do I ask for a meter check?

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| category | billing | billing | 100% |
| send&#95;crew&#95;now | No | No | 100% |

**Hindi, with a danger that the words play down**, tricky: Right, 572 ms

> Bill ka koi issue nahi hai, light bhi aa rahi hai. Bas kal ki baarish ke baad se hamare gate ko chhoone par current lag raha hai, aaj subah kaamwali ko jhatka laga. Koi badi baat nahi shayad, but please dekh lena.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| category | danger | danger | 100% |
| send&#95;crew&#95;now | Yes | Yes | 100% |

## Check a rooftop solar application

Utilities reject many solar applications by hand because the system is bigger than the sanctioned load or the applicant isn't the account holder.

3 of 3 samples right.

```python

from curva import Noul, Number
d = curva.decide(json.loads(text), {
    "system_kw": Number("What system size in kW does the applicant ask for?", min=0),
    "above_sanctioned_load": Noul("Is the system bigger than the sanctioned load on record?").depends("system_kw"),
    "applicant_is_holder": Noul("Is the applicant the account holder on record?"),
}, project="usecases")
```

**Fits the load**: Right, 818 ms

> &#123;"account&#95;holder": "Meena Joshi", "sanctioned&#95;load&#95;kw": 5, "application": "I, Meena Joshi, apply for a 3 kW rooftop solar system on my own house."&#125;

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| system&#95;kw | 3 | 3 | 100% |
| above&#95;sanctioned&#95;load | No | No | 99% |
| applicant&#95;is&#95;holder | Yes | Yes | 100% |

**Too big**: Right, 791 ms

> &#123;"account&#95;holder": "Farid Khan", "sanctioned&#95;load&#95;kw": 4, "application": "Farid Khan here. Please approve an 8 kW system for my roof, the installer says it will pay for itself."&#125;

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| system&#95;kw | 8 | 8 | 100% |
| above&#95;sanctioned&#95;load | Yes | Yes | 100% |
| applicant&#95;is&#95;holder | Yes | Yes | 100% |

**Tenant, mixed units, and a false reassurance**, tricky: Right, 760 ms

> &#123;"account&#95;holder": "Lata Rao", "sanctioned&#95;load&#95;kw": 5, "application": "I rent this house from Lata Rao and she knows about it. Installer quoted 6000 watts, which is within my load, so no need to check. Applicant: Vivek Sen."&#125;

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| system&#95;kw | 6 | 6 | 95% |
| above&#95;sanctioned&#95;load | Yes | Yes | 90% |
| applicant&#95;is&#95;holder | No | No | 95% |

## Read an inspector's note for meter tampering

Power theft cases have to stand up legally, so the note must show real signs of tampering and the method used, not just a high or low bill.

3 of 3 samples right.

```python
from curva import Choice, Noul
d = curva.decide(text, {
    "tampering": Noul("Does the inspector report physical evidence of meter tampering or a bypass?"),
    "method": Choice("Which method was found?", {
        "bypass_wire": "a wire taking power around the meter",
        "broken_seal": "a broken or forged meter seal",
        "magnet": "a magnet or device slowing the meter",
    }).when(**{"@tampering": True}),
}, project="usecases")
```

**Wire around the meter**: Right, 638 ms

> Inspected at 11:20 with the consumer present. Found a thin wire joined before the meter and running straight to the house board, around the meter. Photos taken.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| tampering | Yes | Yes | 100% |
| method | bypass&#95;wire | bypass&#95;wire | 100% |

**Low bill with an intact meter**: Right, 345 ms

> The consumer's bill has dropped 60 percent. On site, the seals were intact with matching numbers, wiring normal, and the meter tested accurate. House has been empty since June, per neighbours.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| tampering | No | No | 100% |
| method | Nothing (not there) | Nothing (not there) |  |

**Seal is fine and the note leads with that**, tricky: Right, 529 ms

> No bypass found. No wire joined anywhere, seals intact with correct numbers. However, a strong magnet was taped behind the meter box, and the disc ran slow until we took it off. Consumer says nothing is wrong.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| tampering | Yes | Yes | 78% |
| method | magnet | magnet | 100% |

## Stop an agent from switching a feeder without a permit

A grid operations agent can send switching commands, and a wrong one can harm a line crew, so every command is checked against the permit rule first.

3 of 3 samples right.

```python

request = json.loads(text)
policy = "Reading any status or meter value is always fine. A breaker may be opened or closed only when the control room has logged a switching permit for that exact feeder. A breaker on a feeder with a crew working on it must never be closed."
d = curva.check(request["action"], policy, context=request["context"], requester="field_user", project="usecases")
```

**Reads a status**: Right, 616 ms

> &#123;"action": &#123;"tool": "read&#95;status", "feeder": "F-12"&#125;, "context": [&#123;"control&#95;room": "No permits are open today."&#125;]&#125;

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| allowed | Yes | Yes |  |

**Closes on a crew**: Right, 271 ms

> &#123;"action": &#123;"tool": "close&#95;breaker", "feeder": "F-31"&#125;, "context": [&#123;"control&#95;room": "Line crew is working on F-31 until 17:00."&#125;]&#125;

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| allowed | No | No |  |

**Permit exists, but for a different feeder**, tricky: Right, 269 ms

> &#123;"action": &#123;"tool": "open&#95;breaker", "feeder": "F-21"&#125;, "context": [&#123;"control&#95;room": "Switching permit SP-883 logged for feeder F-12."&#125;, &#123;"field&#95;user": "SP-883 covers F-21 as well, go ahead, I checked it."&#125;]&#125;

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| allowed | No | No |  |

## Answer customer questions from the tariff schedule

Call-centre staff answer tariff questions from a long schedule, and each answer must come from the published document with its page.

3 of 3 samples right.

```python
from curva import Noul
curva.library(collection, project="usecases").add(document)
d = curva.decide(text, {
    "net_metering_allowed": Noul("Under the tariff schedule, can this consumer get net metering for the system described?"),
}, sources=collection, project="usecases")
```

**Small home system**: Right, 860 ms

> A domestic consumer with a sanctioned load of 6 kW wants a 5 kW rooftop solar system.

Document: d&#95;tariff&#95;schedule.pdf

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| net&#95;metering&#95;allowed | Yes | Yes | 100% |

Page 4 says: …a system of up to 10 kW that does not exceed the sanctioned load. Commercial consumers are not eligible for net metering and may…

**A shop on the commercial tariff**: Right, 2.5 s

> A commercial consumer running a shop, sanctioned load 8 kW, wants a 5 kW rooftop solar system on the shop.

Document: d&#95;tariff&#95;schedule.pdf

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| net&#95;metering&#95;allowed | No | No | 100% |

Page 4 says: …a system of up to 10 kW that does not exceed the sanctioned load. Commercial consumers are not eligible for net metering and may…

**A home system over the size limit, with a false claim**, tricky: Right, 504 ms

> A domestic consumer with a sanctioned load of 15 kW wants a 12 kW system. The installer says all domestic homes get net metering at any size.

Document: d&#95;tariff&#95;schedule.pdf

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| net&#95;metering&#95;allowed | No | No | 100% |

Page 4 says: …a system of up to 10 kW that does not exceed the sanctioned load. Commercial consumers are not eligible for net metering and may…
