From: <bro...@us...> - 2008-02-19 00:31:28
|
Revision: 107 http://gridsim.svn.sourceforge.net/gridsim/?rev=107&view=rev Author: brobergj Date: 2008-02-18 16:31:31 -0800 (Mon, 18 Feb 2008) Log Message: ----------- *Removed FlowInput and FlowOutput and replaced it with FlowBuffer input/output combined class *Added support for FlowBuffer input/output combined class in initNetwork() and terminateIOEntities() Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java Modified: branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-02-18 04:25:19 UTC (rev 106) +++ branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-02-19 00:31:31 UTC (rev 107) @@ -11,8 +11,7 @@ import eduni.simjava.*; import gridsim.net.*; -import gridsim.net.flow.FlowInput; -import gridsim.net.flow.FlowOutput; +import gridsim.net.flow.FlowBuffer; import gridsim.util.*; import java.util.Collection; @@ -192,13 +191,10 @@ /** Sending data via output port to external entities */ protected Sim_port output; - + // Output port but only for a network extension. private NetIO out_ = null; - //private Output out_ = null; - //private FlowOutput fout_ = null; // TODO: redundant - // TODO: new addition protected static int NETWORK_TYPE = GridSimTags.NET_PACKET_LEVEL; @@ -308,41 +304,45 @@ initNetwork(name, link.getBaudRate(), link); } - // TODO: new addition private void initNetwork(String name, double baudRate, Link link) { // Every GridSim entity with network has its own input/output channels. // Connect this entity "input" port to its input buffer "in_port" NetIO in = null; - //FlowInput fin = null; // TODO: redundant + // Packet Level networking has input & output if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_PACKET_LEVEL) { in = new Input("Input_" + name, baudRate); out_ = new Output("Output_" + name, baudRate); + + System.out.println(super.get_name() + ".initNetwork()"); + Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer"); + Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer"); + if (link != null) + { + in.addLink(link); + out_.addLink(link); + } } + // Flow Level networking has a buffer that handles both input/output else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { - // TODO: ... - //fin = new FlowInput("Input_" + name, baudRate); - //fout_ = new FlowOutput("Output_" + name, baudRate); - in = new FlowInput("Input_" + name, baudRate); - out_ = new FlowOutput("Output_" + name, baudRate); + + out_ = new FlowBuffer("Output_" + name, baudRate); + + System.out.println(super.get_name() + ".initNetwork()"); + Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer"); + if (link != null) + { + out_.addLink(link); + } } else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_BUFFER_PACKET_LEVEL) { // TODO: } - - System.out.println(super.get_name() + ".initNetwork()"); - Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer"); - Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer"); - if (link != null) - { - in.addLink(link); - out_.addLink(link); - } } @@ -678,11 +678,12 @@ * by the constructor: {@link GridSim#GridSim(String, double)} * @pre $none * @post $none + * WARNING: use this method if you use the NET FLOW type */ protected void terminateIOEntities() { // If it is Networked entity and Not yet terminated, then terminate. - if ( isNetworked() && !terminateIOEntitiesFlag_ ) + if ( isNetworked() && !terminateIOEntitiesFlag_ && NETWORK_TYPE == GridSimTags.NET_PACKET_LEVEL) { // Send END_OF_SIMULATION to Input entity send(input, 0.0, GridSimTags.END_OF_SIMULATION); @@ -691,6 +692,10 @@ send(output, 0.0, GridSimTags.END_OF_SIMULATION); terminateIOEntitiesFlag_ = true; + // If we are using flow level networking, only terminate output as input is null! + } else if ( isNetworked() && !terminateIOEntitiesFlag_ && NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { + // Send END_OF_SIMULATION to Output entity + send(output, 0.0, GridSimTags.END_OF_SIMULATION); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2008-03-13 05:32:30
|
Revision: 156 http://gridsim.svn.sourceforge.net/gridsim/?rev=156&view=rev Author: brobergj Date: 2008-03-12 22:32:30 -0700 (Wed, 12 Mar 2008) Log Message: ----------- Returned back to FlowInput / FlowOutput approach, reinstated support Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java Modified: branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-03-13 05:15:21 UTC (rev 155) +++ branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-03-13 05:32:30 UTC (rev 156) @@ -12,6 +12,8 @@ import eduni.simjava.*; import gridsim.net.*; import gridsim.net.flow.FlowBuffer; +import gridsim.net.flow.FlowInput; +import gridsim.net.flow.FlowOutput; import gridsim.util.*; import java.util.Collection; @@ -325,16 +327,19 @@ out_.addLink(link); } } - // Flow Level networking has a buffer that handles both input/output + // Flow Level networking has flow input & output else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { - - out_ = new FlowBuffer("Output_" + name, baudRate); - + + in = new FlowInput("Input_" + name, baudRate); + out_ = new FlowOutput("Output_" + name, baudRate); + System.out.println(super.get_name() + ".initNetwork()"); Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer"); if (link != null) { + in.addLink(link); + out_.addLink(link); } @@ -692,10 +697,6 @@ send(output, 0.0, GridSimTags.END_OF_SIMULATION); terminateIOEntitiesFlag_ = true; - // If we are using flow level networking, only terminate output as input is null! - } else if ( isNetworked() && !terminateIOEntitiesFlag_ && NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { - // Send END_OF_SIMULATION to Output entity - send(output, 0.0, GridSimTags.END_OF_SIMULATION); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2008-03-13 05:39:23
|
Revision: 157 http://gridsim.svn.sourceforge.net/gridsim/?rev=157&view=rev Author: brobergj Date: 2008-03-12 22:39:26 -0700 (Wed, 12 Mar 2008) Log Message: ----------- Minor updates/fixes from merge Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java Modified: branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-03-13 05:32:30 UTC (rev 156) +++ branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-03-13 05:39:26 UTC (rev 157) @@ -11,9 +11,7 @@ import eduni.simjava.*; import gridsim.net.*; -import gridsim.net.flow.FlowBuffer; -import gridsim.net.flow.FlowInput; -import gridsim.net.flow.FlowOutput; +import gridsim.net.flow.*; import gridsim.util.*; import java.util.Collection; @@ -317,37 +315,26 @@ { in = new Input("Input_" + name, baudRate); out_ = new Output("Output_" + name, baudRate); - - System.out.println(super.get_name() + ".initNetwork()"); - Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer"); - Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer"); - if (link != null) - { - in.addLink(link); - out_.addLink(link); - } } // Flow Level networking has flow input & output else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { - in = new FlowInput("Input_" + name, baudRate); - out_ = new FlowOutput("Output_" + name, baudRate); - - System.out.println(super.get_name() + ".initNetwork()"); - Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer"); - if (link != null) - { - in.addLink(link); - - out_.addLink(link); - } - + out_ = new FlowOutput("Output_" + name, baudRate); } else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_BUFFER_PACKET_LEVEL) { // TODO: } + + System.out.println(super.get_name() + ".initNetwork()"); + Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer"); + Sim_system.link_ports(name, "output", "Output_" + name, "output_buffer"); + if (link != null) + { + in.addLink(link); + out_.addLink(link); + } } @@ -688,7 +675,7 @@ protected void terminateIOEntities() { // If it is Networked entity and Not yet terminated, then terminate. - if ( isNetworked() && !terminateIOEntitiesFlag_ && NETWORK_TYPE == GridSimTags.NET_PACKET_LEVEL) + if ( isNetworked() && !terminateIOEntitiesFlag_ ) { // Send END_OF_SIMULATION to Input entity send(input, 0.0, GridSimTags.END_OF_SIMULATION); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aca...@us...> - 2008-05-29 16:42:44
|
Revision: 177 http://gridsim.svn.sourceforge.net/gridsim/?rev=177&view=rev Author: acaminero Date: 2008-05-29 09:42:45 -0700 (Thu, 29 May 2008) Log Message: ----------- incorporated FNB I/O ports Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java Modified: branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-05-29 16:40:25 UTC (rev 176) +++ branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-05-29 16:42:45 UTC (rev 177) @@ -14,6 +14,7 @@ import gridsim.net.flow.*; import gridsim.util.*; import java.util.Collection; +import gridsim.net.fnb.*; /** @@ -166,7 +167,6 @@ * * @author Manzur Murshed and Rajkumar Buyya * @author Anthony Sulistio (re-written this class) - * @author James Broberg (added FlowInput and FlowOutput) * @since GridSim Toolkit 3.0 * @see eduni.simjava.Sim_entity * @see gridsim.net.Output @@ -177,7 +177,7 @@ */ public class GridSimCore extends Sim_entity { - private boolean networkedFlag_; // true, if networked entity, other false + private boolean networkedFlag_; // true, if networked entity, other false // false means NOT invoked private boolean terminateIOEntitiesFlag_ = false; @@ -191,11 +191,11 @@ /** Sending data via output port to external entities */ protected Sim_port output; - + // Output port but only for a network extension. private NetIO out_ = null; - // TODO: new addition + /** Specifies which type of network to be used */ protected static int NETWORK_TYPE = GridSimTags.NET_PACKET_LEVEL; @@ -313,27 +313,30 @@ // Packet Level networking has input & output if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_PACKET_LEVEL) { - in = new Input("Input_" + name, baudRate); + in = new Input("Input_" + name, baudRate); out_ = new Output("Output_" + name, baudRate); } // Flow Level networking has flow input & output else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { - in = new FlowInput("Input_" + name, baudRate); - out_ = new FlowOutput("Output_" + name, baudRate); + in = new FlowInput("Input_" + name, baudRate); + out_ = new FlowOutput("Output_" + name, baudRate); } - else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_BUFFER_PACKET_LEVEL) + // Use Finite network buffer + else if (GridSimCore.NETWORK_TYPE == + GridSimTags.NET_BUFFER_PACKET_LEVEL) { - // TODO: + in = new FnbInput("Input_" + name, baudRate); + out_ = new FnbOutput("Output_" + name, baudRate); } - + System.out.println(super.get_name() + ".initNetwork()"); Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer"); Sim_system.link_ports(name, "output", "Output_" + name, "output_buffer"); if (link != null) { - in.addLink(link); - out_.addLink(link); + in.addLink(link); + out_.addLink(link); } } @@ -347,7 +350,8 @@ * @pre $none * @post $none */ - public Link getLink() { + public Link getLink() + { return link_; } @@ -394,6 +398,7 @@ return out_.setBackgroundTraffic(gen, userName); } + /** * Pings to a particular entity ID with a given packet size. * <p> @@ -409,7 +414,8 @@ * @pre size >= 0 * @post $none */ - protected boolean ping(int entityID, int size) { + protected boolean ping(int entityID, int size) + { return ping(entityID, size, 0.0, 0); } @@ -428,7 +434,8 @@ * @pre size >= 0 * @post $none */ - protected boolean ping(String entityName, int size) { + protected boolean ping(String entityName, int size) + { return ping(entityName, size, 0.0, 0); } @@ -454,7 +461,7 @@ * @post $none */ protected boolean ping(String entityName, int size, double delay, - int netServiceLevel) + int netServiceLevel) { int id = GridSim.getEntityId(entityName); return ping(id, size, delay, netServiceLevel); @@ -487,24 +494,25 @@ if (entityID < 0) { System.out.println(super.get_name() + ".ping(): Error - " + - "invalid entity ID or name."); + "invalid entity ID or name."); return false; } if (size < 0) { System.out.println(super.get_name() + ".ping(): Error - " + - "invalid packet size."); + "invalid packet size."); return false; } - if (delay < 0) { + if (delay < 0) + { delay = 0.0; } // send this ping to the destination - send( this.output, delay, GridSimTags.INFOPKT_SUBMIT, - new IO_data(null, size, entityID, netServiceLevel) ); + send(this.output, delay, GridSimTags.INFOPKT_SUBMIT, + new IO_data(null, size, entityID, netServiceLevel)); return true; } @@ -533,7 +541,8 @@ int netServiceLevel) { boolean result = ping(entityID, size, delay, netServiceLevel); - if (result == false) { + if (result == false) + { return null; } @@ -624,21 +633,20 @@ super.sim_get_next(tag, ev); InfoPacket pkt = null; - try { + try + { pkt = (InfoPacket) ev.get_data(); - } - catch(Sim_exception sim) + } catch (Sim_exception sim) { System.out.print(super.get_name() + ".getPingResult(): Error - "); System.out.println("exception occurs. See the below message:"); - System.out.println( sim.getMessage() ); + System.out.println(sim.getMessage()); pkt = null; - } - catch(Exception e) + } catch (Exception e) { System.out.print(super.get_name() + ".getPingResult(): Error - "); System.out.println("exception occurs. See the below message:"); - System.out.println( e.getMessage() ); + System.out.println(e.getMessage()); pkt = null; } @@ -657,7 +665,8 @@ * @pre $none * @post $none */ - protected void TerminateInputOutputEntities() { + protected void TerminateInputOutputEntities() + { terminateIOEntities(); } @@ -675,7 +684,7 @@ protected void terminateIOEntities() { // If it is Networked entity and Not yet terminated, then terminate. - if ( isNetworked() && !terminateIOEntitiesFlag_ ) + if (isNetworked() && !terminateIOEntitiesFlag_) { // Send END_OF_SIMULATION to Input entity send(input, 0.0, GridSimTags.END_OF_SIMULATION); @@ -696,7 +705,8 @@ * @pre $none * @post $none */ - protected void finalize() { + protected void finalize() + { finalizeGridSimulation(); } @@ -707,7 +717,8 @@ * @pre $none * @post $none */ - protected void finalizeGridSimulation() { + protected void finalizeGridSimulation() + { terminateIOEntities(); } @@ -719,7 +730,8 @@ * @pre $none * @post $result == true || false */ - protected boolean IsNetworked() { + protected boolean IsNetworked() + { return isNetworked(); } @@ -730,7 +742,8 @@ * @pre $none * @post $result == true || false */ - protected boolean isNetworked() { + protected boolean isNetworked() + { return networkedFlag_; } @@ -777,7 +790,8 @@ * @pre delay >= 0.0 * @post $none */ - protected void Send(String entityName, double delay, int gridSimTag) { + protected void Send(String entityName, double delay, int gridSimTag) + { send(entityName, delay, gridSimTag); } @@ -823,12 +837,14 @@ */ protected void send(String entityName, double delay, int gridSimTag) { - if (entityName == null) { + if (entityName == null) + { return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 - if (delay < 0.0) { + if (delay < 0.0) + { delay = 0.0; } @@ -836,7 +852,7 @@ if (id < 0) { System.out.println(super.get_name() + ".send(): Error - " + - "invalid entity name \"" + entityName + "\"."); + "invalid entity name \"" + entityName + "\"."); return; } @@ -938,12 +954,14 @@ protected void send(String entityName, double delay, int gridSimTag, Object data) { - if (entityName == null) { + if (entityName == null) + { return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 - if (delay < 0.0) { + if (delay < 0.0) + { delay = 0.0; } @@ -951,7 +969,7 @@ if (id < 0) { System.out.println(super.get_name() + ".send(): Error - " + - "invalid entity name \"" + entityName + "\"."); + "invalid entity name \"" + entityName + "\"."); return; } @@ -1000,7 +1018,8 @@ * @pre delay >= 0.0 * @post $none */ - protected void Send(int entityID, double delay, int gridSimTag) { + protected void Send(int entityID, double delay, int gridSimTag) + { send(entityID, delay, gridSimTag); } @@ -1046,19 +1065,21 @@ */ protected void send(int entityID, double delay, int gridSimTag) { - if (entityID < 0) { + if (entityID < 0) + { return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 - if (delay < 0.0) { + if (delay < 0.0) + { delay = 0.0; } if (entityID < 0) { System.out.println(super.get_name() + ".send(): Error - " + - "invalid entity id " + entityID); + "invalid entity id " + entityID); return; } @@ -1158,19 +1179,21 @@ */ protected void send(int entityID, double delay, int gridSimTag, Object data) { - if (entityID < 0) { + if (entityID < 0) + { return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 - if (delay < 0.0) { + if (delay < 0.0) + { delay = 0.0; } if (entityID < 0) { System.out.println(super.get_name() + ".send(): Error - " + - "invalid entity id " + entityID); + "invalid entity id " + entityID); return; } @@ -1219,7 +1242,8 @@ * @pre delay >= 0.0 * @post $none */ - protected void Send(Sim_port destPort, double delay, int gridSimTag) { + protected void Send(Sim_port destPort, double delay, int gridSimTag) + { send(destPort, delay, gridSimTag); } @@ -1268,12 +1292,13 @@ if (destPort == null) { System.out.println(super.get_name() + ".send(): Error - " + - "destination port is null or empty."); + "destination port is null or empty."); return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 - if (delay < 0.0) { + if (delay < 0.0) + { delay = 0.0; } @@ -1326,7 +1351,7 @@ * @see gridsim.IO_data */ protected void Send(Sim_port destPort, double delay, int gridSimTag, - Object data) + Object data) { send(destPort, delay, gridSimTag, data); } @@ -1375,22 +1400,32 @@ * @see gridsim.IO_data */ protected void send(Sim_port destPort, double delay, int gridSimTag, - Object data) + Object data) { if (destPort == null) { System.out.println(super.get_name() + ".send(): Error - " + - "destination port is null or empty."); + "destination port is null or empty."); return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 - if (delay < 0.0) { + if (delay < 0.0) + { delay = 0.0; } super.sim_schedule(destPort, delay, gridSimTag, data); } + /**This function returns the NETWORK_TYPE parameter. + * @return NETWORK_TYPE + * */ + public static int getNetworkType() + { + return NETWORK_TYPE; + } + + } // end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aca...@us...> - 2008-05-30 16:52:35
|
Revision: 180 http://gridsim.svn.sourceforge.net/gridsim/?rev=180&view=rev Author: acaminero Date: 2008-05-30 09:52:24 -0700 (Fri, 30 May 2008) Log Message: ----------- add entities IDs into white list for network buffer Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java Modified: branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-05-30 16:51:15 UTC (rev 179) +++ branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2008-05-30 16:52:24 UTC (rev 180) @@ -11,10 +11,12 @@ import eduni.simjava.*; import gridsim.net.*; -import gridsim.net.flow.*; +//import gridsim.net.flow.*; import gridsim.util.*; import java.util.Collection; import gridsim.net.fnb.*; +import gridsim.datagrid.index.*; +import gridsim.index.*; /** @@ -319,8 +321,8 @@ // Flow Level networking has flow input & output else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL) { - in = new FlowInput("Input_" + name, baudRate); - out_ = new FlowOutput("Output_" + name, baudRate); + // in = new FlowInput("Input_" + name, baudRate); + // out_ = new FlowOutput("Output_" + name, baudRate); } // Use Finite network buffer else if (GridSimCore.NETWORK_TYPE == @@ -328,6 +330,21 @@ { in = new FnbInput("Input_" + name, baudRate); out_ = new FnbOutput("Output_" + name, baudRate); + + // NOTE: experimental TODO + // check which class or object type it belongs to + if (this instanceof AbstractRC) { + System.out.println(".... It works ... AbstractRC ...."); + GridSim.fnbWhiteList_.addEntityID(this.get_id()); + } + else if (this instanceof AbstractGIS) { + System.out.println(".... It works ... AbstractGIS ...."); + GridSim.fnbWhiteList_.addEntityID(this.get_id()); + } + else if (this instanceof GridInformationService) { + System.out.println(".... It works ... GIS ...."); + GridSim.fnbWhiteList_.addEntityID(this.get_id()); + } } System.out.println(super.get_name() + ".initNetwork()"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |