[j-sim-users] Tcl scripts problem

zze-LUDINARD Romaric RD-CORE-LAN romaric.ludinard at rd.francetelecom.com
Wed Apr 12 09:01:15 CDT 2006


Hi everybody,
to see my simulation evolution, I made a Gui component. this component
is linked with all components. At each modification of a component, the
modified component notify the GuiComponent.
If I run my simulation my typing each command, it runs without problems,
but if i execute a script with the same commands I have a
java::nullPointerException. But there are no difference between my Tcl
script and my step-by-step simulation. This is my Tcl Script

cd [mkdir -q drcl.comp.Component /test]

# create the topology
puts "create topology..."
set link_ [java::new drcl.inet.Link]
$link_ setPropDelay 0.3; # 300ms
set adjMatrix_ [java::new {int[][]} 16 {
	{2 3 4 5 6} 
	{3 7 8 9} 
	{0 3 10 11 12}
	{0 1 2 13 14 15}
	{0} 
	{0} 
	{0}
	{1}
	{1} 
	{1} 
	{2}
	{2}
	{2} 
	{3} 
	{3}
	{3}
}]
java::call drcl.inet.InetUtil createTopology [! .] $adjMatrix_ $link_

puts "create builders..."
# NodeBuilder:
set nb [mkdir drcl.inet.NodeBuilder .nodeBuilder]
$nb setBandwidth 1.0e7; #10Mbps
#puts "build..."
$nb build [! n?]
$nb build [! h*] {
	zone			101/csl		ftrd.p2p.can.Zone
}
 
for {set i 4} {$i < 16} {incr i} {
	connect h$i/z/id@ -and h$i/csl/.service_id@
}

mkdir ftrd.p2p.can.gui.ZoneGui Ihm
connect Ihm/down@ -and h*/z/gui@

puts "setup static routes..."
for {set i 4} {$i <16} {incr i} {
	for {set j [expr $i+1 ]} {$j<16} {incr j} {
		java::call drcl.inet.InetUtil setupRoutes [! h$i] [! h$j] "bidirection"
	}
}

puts "set up simulator..."
set sim [attach_simulator .]

puts "Done!"

! h4/z* set 0
! h4/z* split 5
! h4/z* split 6
! h4/z* split 7
! h4/z* split 8
! h6/z* split 9
! h6/z* split 10
! h9/z* split 11
! h9/z* split 12
! h5/z* split 13
! h13/z* split 14
! h13/z* split 15

the 4 first split have good behavior, but when the script attempt to execute the line "! h6/z* split 9" there is the nullPointerException. But when I copy and paste these lines, one-by-one there is no problem, is it possible, that the simulator attept to execute the line "! h6/z* split 9" before finishing the precedings lines ?  
Thanks

-- 
Romaric Ludinard
CORE/M2I -- Stagiaire
Bureau WA 121
France Télécom
Recherche & Développement
2 avenue Pierre Marzin
22307 LANNION CEDEX




More information about the j-sim-users mailing list