flexiblepower / powermatcher

PowerMatcher - The Java implementation of the PowerMatcher, including the API, the core, a couple of examples, a remote implementation using websockets and a visualisation of the configuration.
http://www.powermatcher.org
Apache License 2.0
43 stars 25 forks source link

Trouble with using ArrayBid for BidUpdate #213

Open jhaprakash opened 7 years ago

jhaprakash commented 7 years ago

Hi,

I followed Powermatcher tutorial and wrote a PVPanelAgent in the examples package. In the doBidUpdate, when I use Bid.flatDemand to publish the bit, I can see the bids going to concentrator and to auctioneer.

I tried to send ArrayBid and it doesn't work. Following is the code snippet for the same. All help will be appreciated. Thanks in advance.

1st variant

`void doBidUpdate() { AgentEndpoint.Status currentStatus = getStatus(); if (currentStatus.isConnected()) { ArrayBid.Builder builder = new ArrayBid.Builder(currentStatus.getMarketBasis()); double[] bidCurve = new double[currentStatus.getMarketBasis().getPriceSteps()];

        bidCurve[0] = -3.0E2;
        bidCurve[1] = -2.50E2;
        bidCurve[2] = -3.00E2;
        bidCurve[3] = -1.50E2;
        bidCurve[4] = -2.00E2;
        bidCurve[5] = -2.75E2;
        bidCurve[6] = -3.00E2;
        bidCurve[7] = -3.00E2;
        bidCurve[8] = -3.00E2;
        bidCurve[9] = -3.00E2;

        publishBid(builder.demandArray(bidCurve).build());
    }
}`

2nd variant

`void doBidUpdate() { AgentEndpoint.Status currentStatus = getStatus(); if (currentStatus.isConnected()) {

        ArrayBid.Builder builder = new ArrayBid.Builder(currentStatus.getMarketBasis());            builder.demand(-300).demand(-250).demand(-300).demand(-150).demand(-200).demand(-275).demand(-300);

        publishBid(builder.build());
    }
}`

3rd Variant

void doBidUpdate() { AgentEndpoint.Status currentStatus = getStatus(); if (currentStatus.isConnected()) { publishBid((new ArrayBid.Builder(currentStatus.getMarketBasis()).demand(-300)).build()); } }

now, 3rd variant is same as flatDemand and it does work for couple of bids and then it stops working. Am I missing something?