I bumped into this problem. The workaround is to look at app.c to see how the variables are named. For example, the variable "state" in DelugeP.nc is renamed as "DelugeP__state". You can try this out.
Also, getData() now seems to return a list of string, which is inconsistent with what the TOSSIM tutorial describes. 2009/7/20 Xiaogang Yang <[email protected]> > > Hi,everyone: > I face a urgent problem. I want to get variable value from tossim, and > follow the instruction of > TOSSIM > > //////////////////////////////////////////////// > > # This is an example script from the TOSSIM tutorials. > # It can be used with any TinyOS application. > > from tinyos.tossim.TossimApp import * > from TOSSIM import * > > n = NescApp() > print n.variables.variables() > t = Tossim(n.variables.variables()) > m = t.getNode(0) > > for i in range(0, 1): > m = t.getNode(i); > time = ((79 + t.ticksPerSecond() / 100) * i + 1) > m.bootAtTime(time); > print "Mote " + str(i) + " set to boot at " + str(time); > > for i in range(0, 500): > t.runNextEvent(); > > v = m.getVariable("'SimMoteP$startTime'") > v2 = m.getVariable("'SimSchedulerBasicP$m_head'"); > > print "start time: <", v.getData(), ">\nnext task: <", v2.getData(), ">" > > for i in range(0, 500): > t.runNextEvent(); > > print "start time: <", v.getData(), ">\nnext task: <", v2.getData(), ">" > > //////////////////////////////////////////////// > > > I run this, (application has no problem) in simulation > but I always cannot get value > > > output:: > > //////////////////////////////////////////////// > Mote 0 set to boot at 1 > Could not find variable 'SimMoteP$startTime' > Allocated variable 'SimMoteP$startTime' > Could not find variable 'SimSchedulerBasicP$m_head' > Allocated variable 'SimSchedulerBasicP$m_head' > start time: < <no such variable> > > next task: < <no such variable> > > start time: < <no such variable> > > next task: < <no such variable> > > //////////////////////////////////////////////// > > but I can print value in n.variables.variables(), > imSchedulerBasicP.sim_scheduler_event_pending', 'simple', 'unsigned char', > 'SimSchedulerBasicP.m_tail', 'simple', 'unsigned char', > 'SimSchedulerBasicP.m_head', 'simple', 'unsigned char', > 'SimSchedulerBasicP.m_next', 'array', 'unsigned char', > 'SimSchedulerBasicP.sim_scheduler_event', 'simple', 'unknown', > 'SimMoteP.bootEvent', 'simple', 'unknown', 'SimMoteP.startTime', 'simple', > 'long long', 'SimMoteP.euid', 'simple', 'long long', 'SimMoteP.isOn', > 'simple', 'unsigned char', 'TossimActiveMessageC.buffer', 'simple', > 'unknown', 'TossimActiveMessageC.bufferPointer', 'simple', 'unknown', > 'SerialActiveMessageC.buffer', 'simple', 'unknown', > 'SerialActiveMessageC.sendMsgPtr', 'simple', 'unknown', > 'SerialActiveMessageC.bufferPointer', 'simple', > 'unknown',............................... > > > So anybody know the reason? > > Thank you > > > Gavin > > > -- > Xiaogang Yang > Sensorweb Research Laboratory > http://sensorweb.vancouver.wsu.edu/ > Washington State University Vancouver > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
