creating Tariff

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

creating Tariff

Sachi
Hi,

Im am trying to create my own tariff using the following code in the createInitialTariff() method :
private void createInitialTariffs ()
  {
    // remember that market prices are per mwh, but tariffs are by kwh
    double marketPrice = marketManager.getMeanMarketPrice() / 1000.0;
    Random rdm = new Random();
List<Tariff> tariffs;
    Tariff t;
    // for each power type representing a customer population,
    // create a tariff that's better than what's available
    for (PowerType pt : customerProfiles.keySet()) {
      // we'll just do fixed-rate tariffs for now
      double rateValue,value,rangeMin,rangeMax,rate;
      rateValue=0.0;
      if (pt.isConsumption())
      {
    tariffs = this.tariffRepo.findActiveTariffs(pt);
    System.out.println(tariffs.size());
   
    t = this.tariffRepo.findActiveTariffs(pt).get(tariffs.size());

But on running it, it gives IndexOutOfbound exception, since the list tariffs does not get populated with the active tariffs. The findActiveTariffs() method does not return any tariffs. Aren't default tariffs activated when session starts? Im not sure why this is happening. Could you help me?
Reply | Threaded
Open this post in threaded view
|

Re: creating Tariff

grampajohn
Administrator
Sachi -

The tariff data that gets sent to brokers are TariffSpecification instances, not Tariffs. The findActiveTariffs() method returns Tariffs, and the broker does not have any, unless you create them from your TariffSpecifications.

But it probably does not make sense to do that; when a TariffSpecification is sent to a broker, it has by definition been published, which makes it active. So you can use findAllTariffSpecifications(), which you would then have to filter by PowerType. Also, keep in mind that there's a hierarchy of PowerTypes -- to see what tariffs are applicable to a PowerType, you would have to check the type itself as well as the corresponding generic type.

Does this help?

John
Reply | Threaded
Open this post in threaded view
|

Re: creating Tariff

Sachi
Thank you, that does help. It is working now.

I am trying to run my broker on the visualizer. When i run the server in bootstrap mode from the visualizer, it gives an output: bootstrapdata null null, and then gives a list of java heap space errors. I also changed the default heap size, but it still gives this error. Can you help me with this?