Signup payments

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

Signup payments

Smiler7
Hi John,

I'm new to java and the Power Tac environment. I'm currently trying to learn them both simultaneously. (Sorry if I ask any stupid questions!)

When modifying the sample broker in the org.powertac.samplebroker. package. I'd like the modify the portfoliomanagerservice class. Being more specific the initial tariff offered.

I am currently trying to add a signup payment to the initial tariffs in the sample brokers source code to see the effects it will have with customers. Could you give me any clues on how this is done as i'm struggling with the structure. Where to add code and what i'd need.





------------------------------------------------------------------------------------------------

  // Creates initial tariffs for the main power types. These are simple
  // fixed-rate two-part tariffs that give the broker a fixed margin.
 
 
  private void createInitialTariffs ()
  {
         
    // remember that market prices are per mwh, but tariffs are by kwh
         
         
    double marketPrice = marketManager.getMeanMarketPrice() / 1000.0;
   
   
    // 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, signupPayment = 0.5;
   
   
   
    {
    this.setSignupPayment(signupPayment);

  }
     
      if (pt.isConsumption()) //power type variable pt then selects power type consumption
     
     
   
       
     rateValue = ((marketPrice + fixedPerKwh) * (1.0 + defaultMargin));
       
      else
        //rateValue = (-1.0 * marketPrice / (1.0 + defaultMargin));
        rateValue = -2.0 * marketPrice;
     
     
     
     
     
      if (pt.isInterruptible()) {
        rateValue *= 0.7; // Magic number!! price break for interruptible
      }
      TariffSpecification spec =
          new TariffSpecification(brokerContext.getBroker(), pt)
              .withPeriodicPayment(defaultPeriodicPayment);
      Rate rate = new Rate().withValue(rateValue);
     
     
     
     
     
      if (pt.isInterruptible()) {
        // set max curtailment
        rate.withMaxCurtailment(0.1);
       
       
       
       
       
      }
      if (pt.isStorage()) {
        // add a RegulationRate
        RegulationRate rr = new RegulationRate();
        rr.withUpRegulationPayment(-rateValue * 0.5)
            .withDownRegulationPayment(rateValue * 0.5); // magic numbers
        spec.addRate(rr);
      }
      spec.addRate(rate);
      customerSubscriptions.put(spec, new HashMap<CustomerInfo, CustomerRecord>());
      tariffRepo.addSpecification(spec);
      brokerContext.sendMessage(spec);
    }
  }

 
 
Reply | Threaded
Open this post in threaded view
|

Re: Signup payments

grampajohn
Administrator
Hello, Dean -

Dean wrote
I'm new to java and the Power Tac environment. I'm currently trying to learn them both simultaneously. (Sorry if I ask any stupid questions!)

When modifying the sample broker in the org.powertac.samplebroker. package. I'd like the modify the portfoliomanagerservice class. Being more specific the initial tariff offered.

I am currently trying to add a signup payment to the initial tariffs in the sample brokers source code to see the effects it will have with customers. Could you give me any clues on how this is done as i'm struggling with the structure. Where to add code and what i'd need.
Here's much of what you need to understand about tariffs:

- Brokers send TariffSpecifications to the server. There they are turned into Tariffs, which are in turn published to the customers. Much of the transformation from TariffSpecification to Tariff is about validation and about processing the various Rates into the data needed to determine what the charge will be for a particular time or usage quantity.

- TariffSpecifications are wrappers for a set of Rates, and also specify tariff-global parameters such as signup and withdrawal payments.

- Rates specify usage-based prices that may depend on time or usage quantity.

- Prices, fees, and quantities in TariffSpecifications and Rates are specified from the customer's viewpoint -- in other words, negative quantities represent transfers from the customer to the broker.

- Parameters for TariffSpecifications and Rates are (mostly) set using "fluent setters" that return the TariffSpecification or Rate, allowing you to "chain" them. This is a common pattern for types that can take many parameters that have usable default values. You don't need to specify long parameters lists for the constructors. Other languages (like Lisp) accomplish this sort of thing with keyword arguments.

Does this give you what you need?

Cheers -

John
Reply | Threaded
Open this post in threaded view
|

Re: Signup payments

Smiler7
That gives me exactly what I need, thanks