From: Marcos D. de A. <ma...@cs...> - 2008-06-11 10:16:47
|
Dear Gilberto, In theory you could create a GridResource dynamically during the simulation in the same way that you create GridResources before the simulation starts. One entity could, for example, create a resource with the required characteristics. The constructors of the Sim_entity class call Sim_system.add(this) to include the just created entity to the list of entities created. The method add of sim_system is as follows: /** * Add a new entity to the simulation. This is present for compatibility with existing * simulations since entities are automatically added to the simulation upon instantiation. * @param e The new entity */ public static void add(Sim_entity e) { Sim_event evt; if (running) { // Post an event to make this entity evt = new Sim_event(Sim_event.CREATE,clock,current_ent().get_id (),0,0, e); future.add_event(evt); } else { if (e.get_id()==-1) { // Only add once! e.set_id(entities.size()); entities.add(e); } } } Basically, if the simulation is running, it will schedule one event, which is handled by Sim_system itself in a private method. Everything looks fine. However, in practice SimJava has a bug because future.add_event(evt); may raise an exception as it is not synchronised and the list called future (containing the future simulation events) may be changed simultaneously by two entities. I had concurrent modification problems with the auction framework when adding entities at runtime. It is actually simple to solve it, but it requires one to change SimJava. Regards, Marcos On 11/06/2008, at 5:28 PM, Agustín Caminero Herráez wrote: > Hello, > > I don't think u can create gridResources dynamically during > simulations. > > What u can do instead is use the resource failure functionality and > set resources initially as failed, then make them available as sim > progresses. > > This way u would simulate the dynamic creation of GridResources. > > Regards, > > Agustin > > > Gilberto Cunha escribió: >> >> Hello, >> >> I have a question regarding GridResource. >> My doubt is as follows: >> >> How can i create GridResources during the simulation, in a dynamic >> way? >> >> Regards, >> -- >> Gilberto Cunha Filho >> gil...@gm... <mailto:gil...@gm...> >> SISMO - Laboratório de Sistemas e Mobilidade >> UFMA >> --------------------------------------------------------------------- >> --- >> >> --------------------------------------------------------------------- >> ---- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> --------------------------------------------------------------------- >> --- >> >> _______________________________________________ >> Gridsim-users mailing list >> Gri...@li... >> https://lists.sourceforge.net/lists/listinfo/gridsim-users >> > > -- > =============================================== > Agustin Caminero > PhD Student > Computing Systems Department > The University of Castilla La Mancha, Albacete. Spain. > Phone: +34 967 599 200 Ext. 2693. Fax: +34 967 599 343 > http://www.i3a.uclm.es/ > =============================================== > > <agustin.vcf>--------------------------------------------------------- > ---------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/ > index.php_______________________________________________ > Gridsim-users mailing list > Gri...@li... > https://lists.sourceforge.net/lists/listinfo/gridsim-users |