All Packages Class Hierarchy This Package Previous Next Index
Class eduni.simjava.Sim_system
java.lang.Object
|
+----eduni.simjava.Sim_system
- public class Sim_system
- extends Object
This is the system class which manages the simulation. All of
the members of this class are static, so there is no need to
create an instance of this class.
-
SIM_ANY
- A standard predicate that matches any event.
-
SIM_NONE
- A standard predicate that does not match any events.
-
Sim_system()
-
-
add(Sim_entity)
- Add a new entity to the simulation.
-
clock()
- Get the current simulation time.
-
current_ent()
- Find the currently running entity.
-
get_entity(int)
- Find an entity by its id number.
-
get_entity(String)
- Find an entity by its name.
-
get_entity_id(String)
- Find out an entities unique id number from its name.
-
get_num_entities()
- Get the current number of entities in the simulation
-
get_trc_level()
- Get the current trace level (initially 0xff), which
controls trace output.
-
get_trcout()
-
-
getNumberFormat()
- Returns the number format used for generating
times in trace lines
-
initialise()
- Initialise the system, this function does the job of a
constructor, and should be called at the start of any simulation
program.
-
initialise(Sim_anim, Thread)
- This version of initialise() is used by the standard animation
package eduni.simanim
-
initialise(Sim_output, Thread)
- This version of initialise() is for experienced users who
want to use the trace output to draw a graph or an animation
as part of the application.
-
link_ports(String, String, String, String)
- Link the ports the ports on two entities, so that events secheduled
from one port are sent to the other.
-
run()
- Start the simulation running.
-
run_start()
- Start the simulation running.
-
run_stop()
- Stop the simulation
-
run_tick()
- Run one tick of the simulation.
-
set_auto_trace(boolean)
- Switch the auto trace messages on and off.
-
set_trc_level(int)
- Set the trace level flags which control trace output.
-
sim_clock()
- A different name for Sim_system.clock().
SIM_ANY
public static Sim_any_p SIM_ANY
- A standard predicate that matches any event.
SIM_NONE
public static Sim_none_p SIM_NONE
- A standard predicate that does not match any events.
Sim_system
public Sim_system()
initialise
public static void initialise()
- Initialise the system, this function does the job of a
constructor, and should be called at the start of any simulation
program. It comes in several flavours depending on what context
the simulation is running.
This is the simplest, and should be used for standalone simulations
It sets up trace output to a file in the current directory called
`tracefile'
initialise
public static void initialise(Sim_anim out,
Thread sim)
- This version of initialise() is used by the standard animation
package eduni.simanim
initialise
public static void initialise(Sim_output out,
Thread sim)
- This version of initialise() is for experienced users who
want to use the trace output to draw a graph or an animation
as part of the application.
- Parameters:
- out - The object to be used for trace output
- sim - The thread the simulation is running under, (set to
null if not applicable
getNumberFormat
public static NumberFormat getNumberFormat()
- Returns the number format used for generating
times in trace lines
clock
public static double clock()
- Get the current simulation time.
- Returns:
- The simulation time
sim_clock
public static double sim_clock()
- A different name for Sim_system.clock().
- Returns:
- The current simulation time
get_num_entities
public static int get_num_entities()
- Get the current number of entities in the simulation
- Returns:
- A count of entities
get_trc_level
public static int get_trc_level()
- Get the current trace level (initially 0xff), which
controls trace output.
- Returns:
- The trace level flags
get_entity
public static Sim_entity get_entity(int id)
- Find an entity by its id number.
- Parameters:
- id - The entity's unique id number
- Returns:
- A reference to the entity, or null if it could not be found
get_entity
public static Sim_entity get_entity(String name)
- Find an entity by its name.
- Parameters:
- name - The entity's name
- Returns:
- A reference to the entity, or null if it could not be found
get_entity_id
public static int get_entity_id(String name)
- Find out an entities unique id number from its name.
- Parameters:
- name - The entity's name
- Returns:
- The entity's unique id number, or -1 if it could not be found
current_ent
public static Sim_entity current_ent()
- Find the currently running entity.
- Returns:
- A reference to the entity, or null if none are running
set_trc_level
public static void set_trc_level(int level)
- Set the trace level flags which control trace output.
- Parameters:
- level - The new flags
set_auto_trace
public static void set_auto_trace(boolean on)
- Switch the auto trace messages on and off.
- Parameters:
- on - If true then the messages are switched on
add
public static void add(Sim_entity e)
- Add a new entity to the simulation.
This is now done automatically in the Sim_entity constructor,
so there is no need to call this explicitly.
- Parameters:
- e - A reference to the new entity
link_ports
public static void link_ports(String ent1,
String port1,
String ent2,
String port2)
- Link the ports the ports on two entities, so that events secheduled
from one port are sent to the other.
- Parameters:
- ent1 - The name of the first entity
- port1 - The name of the port on the first entity
- ent2 - The name of the second entity
- port2 - The name of the port on the second entity
run_start
public static void run_start()
- Start the simulation running. This should be called after
all the entities have been setup and added, and their ports linked
Phase 1.
run_tick
public static boolean run_tick()
- Run one tick of the simulation.
run_stop
public static void run_stop()
- Stop the simulation
run
public static void run()
- Start the simulation running. This should be called after
all the entities have been setup and added, and their ports linked
get_trcout
public static Sim_output get_trcout()
All Packages Class Hierarchy This Package Previous Next Index