Facing problem while extracting the WeatherReport data from state.log

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Facing problem while extracting the WeatherReport data from state.log

Porag
Hi,

We have been trying to use the log tool analyzer to extract the weather report data from the server state.log file. We have created a WeatherReportHandler in the setup function where the setup method looks as follows :

@Override
        public void setup() {
                timeslotRepo = (TimeslotRepo) getBean("timeslotRepo");
                timeService = (TimeService) getBean("timeService");
                brokerRepo = (BrokerRepo) SpringApplicationContext.getBean("brokerRepo");
                registerNewObjectListener(new BrokerHandler(), Broker.class);

                registerNewObjectListener(new TimeslotUpdateHandler(),
                                TimeslotUpdate.class);
                registerNewObjectListener(new MarketTransactionHandler(),
                                MarketTransaction.class);
                registerNewObjectListener(new BalancingTransactionHandler(),
                                BalancingTransaction.class);
                registerNewObjectListener(new TimeslotHandler(),
                                Timeslot.class);
                registerNewObjectListener(new WeatherReportHandler(),
                                WeatherReport.class);
                registerNewObjectListener(new OrderbookHandler(),
                                Orderbook.class);
               
               
                ignoreCount = ignoreInitial;
                data = new TreeMap<Integer, ClearedTrade[]>();
                marketData = new TreeMap<Integer, CustomMarketTransaction>();
                try {
                        output = new PrintWriter(new File(dataFilename));
                } catch (FileNotFoundException e) {
                        log.error("Cannot open file " + dataFilename);
                }
        }

And the WeatherReportHandler looks as follows:

        class WeatherReportHandler implements NewObjectListener {
               
                @Override
                public void handleNewObject(Object thing) {
                       
                        WeatherReport wr = (WeatherReport) thing;
                       
                        System.out.println("Inside the weather report");
                       
                        int timeslotSerial = timeslotRepo.currentSerialNumber();
                               
                        CustomMarketTransaction cmt = marketData.get(timeslotSerial);
                        if (null == cmt) {
                                cmt = new CustomMarketTransaction();
                        }
                               
                        double temperature = wr.getTemperature();
                        cmt.temp = temperature;
                        System.out.println("temp : "+ temperature);
                               
                        marketData.put(timeslotSerial,
                                                cmt);
                }
        }


I was expecting the text "Inside the weather report" in the console but I was not getting any. It seems like that the method is never called. I also tried using the example to fetch WeatherReport and WeatherForcast i.e. WeatherStats.java and Wind.java in the logtool-example, but no luck as well. Can anyone please help with this issue? How can I get the temp, cloud coverage, wind direction and windspeed for a specific timeslot from the server state.log file.

Thanks
Porag  
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facing problem while extracting the WeatherReport data from state.log

Porag
This is really weird. When I run the project from the STS IDE, I am able to fetch the weather data but when I run the tool from command prompt, I am unable to fetch weather data!

Currently, I am using the latest pull from the git repo of the log analyzer tool. I wasn't able to get weather data because this project had some code like this in the DomainObjectReader.java in org.powertac.logtool.common :

ignores.add("org.powertac.common.WeatherReport");
ignores.add("org.powertac.common.WeatherForecast");
ignores.add("org.powertac.common.WeatherForecastPrediction");

When I commented out these lines, I was able to get weather data when I ran the project from IDE. But when I try to run the logtool from command line(mvn exec:exec -Dexec.args="org.powertac.logtool.example.MktPriceStats boot0.state boot0.output"), I am not getting any weatherdata. Can anyone please help me on this?

Thanks
Porag  
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facing problem while extracting the WeatherReport data from state.log

grampajohn
Administrator
Hello -
Porag wrote
This is really weird. When I run the project from the STS IDE, I am able to fetch the weather data but when I run the tool from command prompt, I am unable to fetch weather data!

Currently, I am using the latest pull from the git repo of the log analyzer tool. I wasn't able to get weather data because this project had some code like this in the DomainObjectReader.java in org.powertac.logtool.common :

ignores.add("org.powertac.common.WeatherReport");
ignores.add("org.powertac.common.WeatherForecast");
ignores.add("org.powertac.common.WeatherForecastPrediction");
Yes. When I was developing and first using it I was having trouble with the constructors for the weather data. I obviously neglected to remove those lines.
When I commented out these lines, I was able to get weather data when I ran the project from IDE. But when I try to run the logtool from command line(mvn exec:exec -Dexec.args="org.powertac.logtool.example.MktPriceStats boot0.state boot0.output"), I am not getting any weatherdata. Can anyone please help me on this?
Assuming you are using the style in logtool-examples, the problem is probably that maven cannot find your updated logtool module. If so, you need to go into the logtool dir and do a mvn clean install to make it visible locally.

Does this help?

John
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facing problem while extracting the WeatherReport data from state.log

grampajohn
Administrator
In reply to this post by Porag
Porag and all -

Today I committed and deployed an update to the logtool module that reads WeatherReport correctly. There's an example of its use in logtool-examples/../WeatherStats.java.

There still appears to be a problem with reading Order instances. I'll try to get to that soon.

Cheers -

John
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facing problem while extracting the WeatherReport data from state.log

Porag
In reply to this post by grampajohn
Thanks John. It solved my problem :)
Loading...