Hello Paul,

I am implementing SAM as simulating tool in my company. We have spoken by email about some basic issues, but this one may be useful for other people.

Inside financial models, I am trying to intruduce the inputs for an spanish bill. Everything is ok except the rates for demand charges. We have different ways to calculate these charges, for example there is a "3.0A bill" which demands charges are defined as follows:

- If max power is between 85% and 105% of hired power, the charges are applied into the max power (in a month).

- If max power is lower than 85% of hired power, the charges are applied into the 85 % of hired power.

- If max power is higher than 105% of hired power, the charges are applied into Pf = Pr + 2·(Pr - 1,05·Pc). Being Pr the max power and Pc the hired power.

In the following web there is a better explain, but in spanish: http://www.tarifa-electrica.es/potencia_modo2.php

Do you figure out how to implement it into the simulation parameters of Demand Charges? Or do you have any spanish simulation which you can sare?

If someone has solved it, any help will be grateful.

Best regards!

Dear Miguel,

Wow! That is a very complicated demand charge calculation! Thank you for the clear explanation and for including a link to the original tariff description. I think I understand how it works. :)

SAM applies the demand rate ($/kW) to the maximum power (kW) from the grid in a given month (or TOU period in the month for time-of-use demand charges). For tiered demand charges, it is possible to assign a different rate based on the magnitude of the maximum power value, but it is not possible to adjust the power value itself that SAM uses to calculate the demand charge. It is also not possible to calculate the demand charge based on a percentage of the contracted (hired) power.

Best regards,

Paul.

Thanks Paul,

Yes, here in Spain the electrical market is too confusing. Is it possible to calculate the demand charge based on the contracted power? Or is it only possible by the maximum power?

Might be possible to do it by scripting? I could try to understand the SAM's language to script or import a Matlab code, which I think it's possible.

Best regards,

Miguel García Casas

Dear Miguel,

What is the difference between "contracted" and "maximum" power? SAM calculates the demand charge based on the maximum power from the grid in a month for "flat" demand rates, and in a TOU period for each month for "TOU" rates. It is not possible to calculate it based on a different value.

LK script does not give you access to SAM's internal calculation, so you cannot use it to modify algorithms. If you develop your own algorithm for calculating the demand charge, you could write an LK script (or MATLAB code) to implement it. However, you would not be able to feed that demand charge back into SAM's cash flow model. It might be possible to write an LK script to calculate effective demand rate input values by running a simulation to calculate the PV system output, comparing it to the load, and determining what the monthly demand charge would be.

SAM's C++ source code is available to the public, and you can see how SAM calculates the electricity bill in this file:

https://github.com/NREL/ssc/blob/develop/ssc/cmod_utilityrate5.cpp

The calculations are complicated, but in theory, you could modify the demand charge calculations in the source code, and then compile your own version of SAM.

Best regards,

Paul.

Dear Paul,

The maximum power is what is registered in every TOU. The contracted power is what you sign with your electricity commercializer in every TOU (it is based on your demand prevision and there is a lot of benefits optimicing it with control data). So the demand charge depends on if the maximum power is under or over the contracted power, that's what I tried to explain in my first message. In this kind of bill the calculation is always done by the contracted power, except when your maximum power is between the 85 % and the 105 % of your contracted power. It is difficult to understand even for us.

For now I externalized this calculating into excel with the hourly data provide by SAM. In the future, I'll try to implement it into SAM's algorithm.

Thank you for your help,

Miguel.

Dear Miguel,

I have submitted a feature request on the SAM GitHub website. You can track that to see if we decide to implement something like this or if someone in the open source community decides to implement it.

https://github.com/NREL/SAM/issues/27

Best regards,

Paul.