Re: [ns] How to set node frequency in C++ ?

2011-11-18 Thread Su Jinzhao

Hi:

As we know, before creating nodes in tcl script, we need to configure them
with various options like -macType -ifqType -phyType -channel and so on.  I
just want to know that after creating these nodes in tcl script, I want to
change some nodes frequency in C++ dynamically, I tried the following code
but failed:

Tcl& tcl = Tcl::instance();
tcl.evalf("$opt(netif) set freq_ newFreq);
if(tcl.result() != TCL_OK)
   cout << "set new freq failure." << endl;

So please help me what else should I do to make the change take effect.
Call node-config again or what else ?

Any suggestions will be appreciated, Thanks.


2011/11/16 苏金钊 

> The script is in tcl,while what I want is to implement it in c++.
>
>
>
>  原始邮件 
> 发件人:Mohamed Ibrahim Salman 
> 时间:2011-11-16 19:35
> 收件人:Su Jinzhao 
> 主题:Re: [ns] How to set node frequency in C++ ?
>
>  I think that script   "adhoc_tcp.tcl"  will be self explained
>
> *
> *
>
> --
> *From:* Su Jinzhao 
> *To:* Mohamed Ibrahim Salman 
> *Sent:* Wednesday, November 16, 2011 11:25 AM
> *Subject:* Re: [ns] How to set node frequency in C++ ?
>
> Thank you for you reply.
>
> I looked through what you suggest in samples folder of dei80211mr, and I
> am not sure whether I completely understand what you mean. I want to
> explain more clearly about what I want to you first:
>
>   Each node of my simulation network is configured with one interface and
> one channel, initially, all nodes work on the control channel. While
> running my mac protocol, I need to switch working frequency of some users
> to another channel with new center frequency in C++, instead of changing it
> in .tcl script file.
>
>  I have tried code like this:
>  Tcl& tcl = Tcl::instance
>  tcl.eval("$opt(netif) set freq_ newFreq");
>  if(tcl.result() != TCL_OK)
>  cout << "set freq error!" << endl;
>
>But I failed, here $opt(netif) is node interface variable defined in
> .tcl file, so is there any more suggestion or advice.
>
>  Thank you very much.
>
>
> On Wed, Nov 16, 2011 at 6:12 PM, Mohamed Ibrahim Salman <
> mohammad_w2...@yahoo.com> wrote:
>
> Hi,
> I think the package dei80211mr will benefit you it's already exist in ns-2
> all you need is to load the library and you can find samples in "sample"
> folder.
>
> good luck
>
>
> *
> *
>
> --
> *From:* Su Jinzhao 
> *To:* ns-users@ISI.EDU
> *Sent:* Wednesday, November 16, 2011 2:38 AM
> *Subject:* Re: [ns] How to set node frequency in C++ ?
>
>
>
> Is there anybody kind to help me? waiting for your help...
>
> On Tue, Nov 15, 2011 at 9:06 AM, Su Jinzhao  wrote:
>
> > Hi All,
> >
> >  There is only one interface in my simulation network, I want to
> > switch some nodes frequency to another channel with new center frequency
> in
> > C++, my code snippet is like this:
> >
> >  Tcl& tcl = Tcl::instance();
> >tcl.evalf("$opt(netif) set freq_ %f",v[i].mid_freq);
> >if(tcl.result() != TCL_OK)
> >  cout << "set freq error!" << endl;
> >
> >  Here the variable $opt(netif) is defined in my .tcl file, and the
> > result is print out "set freq error!", So How to set node frequency in
> C++
> > ? any suggestions is appreciated.
> >
> > --
> > Su Jinzhao(苏金钊)
> >
>
>
>
> --
> Su Jinzhao(苏金钊)
>
>
>
>
>
> --
> Su Jinzhao(苏金钊)
>
>
>


-- 
Su Jinzhao(苏金钊)


Re: [ns] How to set node frequency in C++ ?

2011-11-15 Thread Su Jinzhao

Is there anybody kind to help me? waiting for your help...

On Tue, Nov 15, 2011 at 9:06 AM, Su Jinzhao  wrote:

> Hi All,
>
>   There is only one interface in my simulation network, I want to
> switch some nodes frequency to another channel with new center frequency in
> C++, my code snippet is like this:
>
>  Tcl& tcl = Tcl::instance();
>tcl.evalf("$opt(netif) set freq_ %f",v[i].mid_freq);
>if(tcl.result() != TCL_OK)
>  cout << "set freq error!" << endl;
>
>   Here the variable $opt(netif) is defined in my .tcl file, and the
> result is print out "set freq error!", So How to set node frequency in C++
> ? any suggestions is appreciated.
>
> --
> Su Jinzhao(苏金钊)
>



-- 
Su Jinzhao(苏金钊)


[ns] How to set node frequency in C++ ?

2011-11-14 Thread Su Jinzhao

Hi All,

  There is only one interface in my simulation network, I want to
switch some nodes frequency to another channel with new center frequency in
C++, my code snippet is like this:

 Tcl& tcl = Tcl::instance();
   tcl.evalf("$opt(netif) set freq_ %f",v[i].mid_freq);
   if(tcl.result() != TCL_OK)
 cout << "set freq error!" << endl;

  Here the variable $opt(netif) is defined in my .tcl file, and the
result is print out "set freq error!", So How to set node frequency in C++
? any suggestions is appreciated.

-- 
Su Jinzhao(苏金钊)