# Plot Battery Charging Below X-axis?

**URL:** <https://forum.encoord.com/t/plot-battery-charging-below-x-axis/346>\
**Category:** General\
**Tags:** plots-and-tables, electric-storage, iron-python\
**Created:** [April 25, 2025, 6:27am UTC](https://forum.encoord.com/t/plot-battery-charging-below-x-axis/346 "2025-04-25T06:27:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbuehmann](https://forum.encoord.com/letter_avatar_proxy/v4/letter/j/5e9695/32.png) [@jbuehmann](https://forum.encoord.com/u/jbuehmann)\
**Post date:** [April 25, 2025, 6:27am UTC](https://forum.encoord.com/t/plot-battery-charging-below-x-axis/346/1 "2025-04-25T06:27:40Z")

</div>

How do I plot battery charging below the x-axis (ie negative) like the default generation dispatch plot does? Currently my code stacks it onto the positive side.

I’ve tried putting a negative sign in front of POUT, but then I don’t see it plotted anywhere. Perhaps it’s plotted in the negative region but I also can’t get the plot to show a negative region.

nplot(  
‘EGRP.NUCLEAR.PIN.[GW];r196g78b82;legend=Nuclear;stack’,  
‘EGRP.COAL.PIN.[GW];r140g140b140;legend=Coal;stack’,  
‘EGRP.GAS.PIN.[GW];r147g120b96;legend=Natural Gas;stack’,  
‘EGRP.WIND.PIN.[GW];r85g168b104;legend=Wind;stack’,  
‘EGRP.PV.PIN.[GW];r221g132b82;legend=Solar;stack’,  
‘EGRP.ESTR.POUT.[GW];r129g114b179;legend=Battery Charge;stack’,  
‘EGRP.ESTR.PIN.[GW];r0g114b179;legend=Battery Discharge;stack’,  
‘ENET.PD.[GW];r0g0b0;dash;legend=Demand;[6.5,0,5];’,  
‘EGRP.WIND.PNSWIND.[GW];r144g255b177;legend=Wind Curtailment;stack’,  
‘EGRP.PV.PNSPV.[GW];r255g224b139;legend=Solar Curtailment;stack;[6.5,-1,6.5];Title=Generation Fleet Dispatch with the System Demand’,  
start,  
end  
)

---

<div class="post-metadata">

**Author:** ![jimhSAIntencoord](https://forum.encoord.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@jimhSAIntencoord](https://forum.encoord.com/u/jimhSAIntencoord)\
**Post date:** [April 25, 2025, 1:33pm UTC](https://forum.encoord.com/t/plot-battery-charging-below-x-axis/346/2 "2025-04-25T13:33:23Z")

</div>

Support Team,  
I have the same issue - nothing plots in either direction for batteries. Also, would you provide the code line for plotting energy not served? Thanks!

---

<div class="post-metadata">

**Author:** ![Hakeemuddin](https://forum.encoord.com/letter_avatar_proxy/v4/letter/h/278dde/32.png) [@Hakeemuddin](https://forum.encoord.com/u/Hakeemuddin)\
**Post date:** [April 28, 2025, 12:41pm UTC](https://forum.encoord.com/t/plot-battery-charging-below-x-axis/346/4 "2025-04-28T12:41:12Z")

</div>

Thank you @jbuehmann @jimhSAIntencoord for your question!. It addresses an important aspect of understanding the properties of different objects within SAInt.

In SAInt, the properties POUT and PIN for a group report absolute active-power values, they do not carry a sign for flow direction. Consequently, they will always plot above the x-axis, even when the battery is charging.

**Preferred solution** :

To display charging below the axis (negative) and discharging above it (positive), plot the group’s Total Active Power Balance (PFB) instead, i.e. EGRP.ESTR.PFB. PFB uses the following sign convention:

Positive(+): Power injected through externals (e.g. electric storages)

Negative(-): Power extracted by externals

Replace the two storage traces in your _nplot_ call with a single PFB trace: ‘EGRP.ESTR.PFB.[GW];r129g114b179;legend=Battery;stack’.

Note: PFB is a _net_ value for the whole storage group.  
If the group contains multiple batteries, the trace shows their combined charge/discharge.  
If you need object-level detail: We recommend to plot each battery’s behavior separately using the trace: “ESTR.{Name}.P” in the nplot function call.

**Alternative solution:** You can also use a scalar of “-1” and multiply with your POUT call in the nplot function: ‘-1\*EGRP.ESTR.POUT.[GW];r129g114b179;legend=Battery Charge;stack’,

---

<div class="post-metadata">

**Author:** ![Hakeemuddin](https://forum.encoord.com/letter_avatar_proxy/v4/letter/h/278dde/32.png) [@Hakeemuddin](https://forum.encoord.com/u/Hakeemuddin)\
**Post date:** [April 28, 2025, 12:57pm UTC](https://forum.encoord.com/t/plot-battery-charging-below-x-axis/346/5 "2025-04-28T12:57:51Z")

</div>

Thank you @jimhSAIntencoord for your question. Property-related questions like this are extremely valuable for deepening the understanding of SAInt.

In SAInt, energy not served for demand can be plotted at different levels:

- **Network level** :
  - **ENET.PNSDEM** : Total demand not served across the entire network.

- **Group level** :
  - **EGRP.{Name}.PNSDEM** : Demand not served within a specific group.

- **Object level** :
  - **EDEM.{Name}.PNS** Demand not served for an individual electric demand object.

For informational purposes, the “PNS” (Power Not Served) is computed as the difference between the active power setpoint ( **PSET** ) and the actual active power consumption ( **P** ).
