How to change the delay of a link in NS2 simulation? - networking

I need to run a NS2 simulation that the delay of a link will change
during the runtime, and I use following procedure in tcl script:
$ns delay $node3 $node4 $delay_time
to change the delay in a link between $node3 and $node4.
But it only works when it's set before the simulation starts.
If I want to change the delay in a certain time, e.g.
$ns at 1.0 "$ns delay $node3 $node4 10ms"
It doesn't work.So how to change the delay of a link during runtime?
Thanks for any help.

I have been looking for this answer on and off for quite some time myself. I have been constantly making my way back here to this depressingly unanswered question. Here it is.
Say as above, you have $node3 and $node4.
To get your link, use
set myLink [[$ns link $n(0) $n(1)] link]
Note that this is not just the link, it is the link_ within the Link (manual page 68 http://www.isi.edu/nsnam/ns/doc/ns_doc.pdf or html version http://www.isi.edu/nsnam/ns/doc/node63.html). This is the part that manages the link delay. In order to change the link delay, use
$myLink set delay_ 1ms
This part was found in ns-2.35/tcl/lib/ns-link.tcl

Related

Change music on hold during Dial()

I'm using the parameter m(mymusic) in my call to Dial() to let the caller hear some music instead of the boring ring tone. However I'd like to have a different music file after some time. The time when the music changes should easily be changeable (by editing a variable), so it is no option to just create a music-on-hold-file which has X seconds of music 1 and then Y seconds of music 2.
What I want is basically this, but without a second Dial() and without an actual second call to ${device}, because that creates two "missed call" entries for one missed call, and it interrupts the phone's ring tone.
Set(time_until_new_music=20);
Dial(${device},${time_until_new_music},gm(music1));
if ( "${DIALSTATUS}" == "NOANSWER" ) {
Dial(${device},,m(music2));
}
Is this possible somehow?
Hold class can have unlimited number of different sound file of any length
Number of musiconhold classes also unlimited. So you can create your own set for every need
However you can't control from dialplan class info. You can use external steaming app and forward to that app param you need. Require expert level in both asterisk and linux.
Something like this may work:
s,1,Set(time_until_new_music=20)
s,2,Dial(${device},${time_until_new_music},gm(music1))
s,3,GotoIf($[${DIALSTATUS}=NOANSWER]?s,4:s,5)
s,4,Dial(${device},,m(music2))
s,5,Hangup()

how to check if page finished loading in RSelenium

Imagine that you click on an element using RSelenium on a page and would like to retrieve the results from the resulting page. How does one check to make sure that the resulting page has loaded? I can insert Sys.sleep() in between processing the page and clicking the element but this seems like a very ugly and slow way to do things.
Set ImplicitWaitTimeout and then search for an element on the page. From ?remoteDriver
setImplicitWaitTimeout(milliseconds = 10000)
Set the amount of time
the driver should wait when searching for elements. When searching for
a single element, the driver will poll the page until an element is
found or the timeout expires, whichever occurs first. When searching
for multiple elements, the driver should poll the page until at least
one element is found or the timeout expires, at which point it will
return an empty list. If this method is never called, the driver will
default to an implicit wait of 0ms.
In the RSelenium reference manual (http://cran.r-project.org/web/packages/RSelenium/RSelenium.pdf), you will find the method setTimeout() for the remoteDriver class:
setTimeout(type = "page load", milliseconds = 10000)
Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
type: The type of operation to set the timeout for. Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout. Defaults to "page load"
milliseconds: The amount of time, in milliseconds, that time-limited commands are permitted to run. Defaults to 10000 milliseconds.
This seems to suggests that remDr$setTimeout() after remDr$navigate("...") would actually wait for the page to load, or return a timeout error after 10 seconds.
you can also try out this code that waits for the browser to provide whether page loaded or not.
objExecutor = (JavascriptExecutor) objDriver;
if (!objExecutor.executeScript("return document.readyState").toString()
.equalsIgnoreCase("complete")){
Thread.sleep(1000);
}
You can simply put it in your base page so you wont need to write it down in every pageobjects. I have never tried it out with any AJAX enabled sites, but this might help you and your scenario dependency will also get away.

Example use case of tmux's "refresh-client"?

From the man page (http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html):
refresh-client [-S] [-t target-client]
(alias: refresh)
Refresh the current client if bound to a key, or a single client
if one is given with -t. If -S is specified, only update the
client's status bar.
What does it mean for a client to be bound to a key? I'm trying to think of when I may actually use this.
This is by default bound to "r" in tmux, and I'm thinking of overriding it. Could someone explain an example use case for wanting to refresh the client? Thanks.
tmux only updates the screen when there is some new content to display. If you put something like date into your status line, the date will only update when the content of the pane changes, when you change between panes, or when run refresh-client. So in that case, you could use Ctrl-b r to refresh the screen.
Alternatively, you can also set set status-interval 1 to redraw every second, but that will cause CPU usage and drain your battery.
If you don't have anything dynamic in your status line, you can safely remap the key. And if you ever need to execute refresh-client, you can still run it with tmux refresh-client.

TinyOS interrupts handlling

Please give me an advice for this:
I want to get the time when a signal is sent from a mote(I was thinking to generate a interruption when the SFD pin gets from 1 to 0) I didn't find a solution for that, but I found this component:
Component: tos.chips.cc2420_tkn154.CC2420TransmitP
which provides cc2420Tx which seems to give me the time a need. But I can't manage to use it, as by default it usest the component from cc2420 folder and not the one from cc2420_tkn154 folder.
The main ideea is that I'd like to measure the time from sending the signal to recieving ack. I need Microsecond precision. All these would help me to get the distance between two motes.
Any ideea would be helpfull. I searched all over: forums, tinyos documentantion, examples...
Thank you :)
I do not know how low-level you want to get, but if you have a timer, in nesC you can get the local time every time the timer fires:
uint32_t timestamp;
event void myTimer.fired() {
timestamp = call myTimer.getNow();
printf("Timestamp: %ld \n", timestamp);
}
If you do not have a timer, you can use the component LocalTimeMilliC.
Add this to your configuration file:
components LocalTimeMilliC;
TestC.LocalTime -> LocalTimeMilliC;
...and in the module section of the implementation:
uses interface LocalTime<TMilli>;
...and in the code:
timestamp = call LocalTime.get();
However, the local time of each mote will start again when you reset the mote. You would have to synchronize the different times. If you want to calculate the distance between motes, this may not be the best way. To cite from the abstract of this paper:
Location of the deployed sensor nodes can be found either by TOA, TDOA or Received Signal Strength (RSS) measurements.
For RSSI, there is a demo in the folder tinyos-2.1.1/apps/tutorials.

how to add seconds to time

I was wondering if it's possible to add seconds to a clock in vb.net. I mean lt's say I have a label and I assign it to DateTime.Now(), how would I show/display the time with the seconds "ticking"?
I assume you're talking about ASP.NET and not a desktop app. In which case you're going to have to use JavaScript to update the user interface as once the time is set from the server side you can't update it. See this:
http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock

Resources