This is probably more of a style question than anythign else. I am
curious if this makes sense. I figured before spending a few hours
and trying to implement my project this way, i'd run it by the
experts.
If I want to have 2(probably not more) components running in the same
TOSSIM simulation like stated above, would it make sense to make these
components basically autonomous in that they just need to be linked to
Main.StdControl. I was thinking something like this:
file1:
configuration Wrap{
}
implementation{
components CHOICE1, CHOICE2;
if(TOS_LOCAL_ADDRESS == 0){
Main.StdControl -> CHOICE1;
}
else{
Main.StdControl-> CHOICE2;
}
}
but then CHOICE1 and 2 would be configurations instead of Modules that
take care of all of their wirings to other Modules, and interfaces.
This way the wrapper file is clean, and the two separate components
can each do their own thing and there will be less confusion if they
need to provide or use interfaces.
Does that make sense?
On Tue, 25 Jan 2005 01:04:55 -0800 (PST), [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi guys,
> I posted question regarding how to run 2 apps in Tossim. Thanks for all
> you guys help and bellow is what I did so far.
> I followed Joe's way becoz I think it is easier and mostly because I am
> lazy:)
> The wraper component I wrote listed below:
> -------------------------
> configuration Wrap {
> }
> implementation {
> components Main, RfmToInt, IntToLeds, Counter, IntToRfm, TimerC;
>
> if (TOS_LOCAL_ADDRESS == 0)
> { Main.StdControl -> Counter.StdControl;
> Main.StdControl -> IntToLeds.StdControl;
> Main.StdControl -> IntToRfm.StdControl;
> Main.StdControl -> TimerC.StdControl;
> Counter.Timer -> TimerC.Timer[unique("Timer")];
> IntToLeds <- Counter.IntOutput;
> Counter.IntOutput -> IntToRfm;
> }
> else if (TOS_LOCAL_ADDRESS == 1)
> {
> Main.StdControl -> IntToLeds.StdControl;
> Main.StdControl -> RfmToInt.StdControl;
> RfmToInt.IntOutput -> IntToLeds.IntOutput;
> }
> }
> ---------------------
> Above is really nothing but to wrap up CntToLedsAndRfm & RfmToLeds.
> But it fails to compile and gives err info: parse error before `if' at line6
> anyone has any idea what is going wrong?
> Thanks
> Leo
>
>
> > It is not possible to run two different apps, but it is possible to
> > initialize each mote differently.
> >
> > Since TinyOS is component based, you ought to be able to write a
> > wrapper component that, depending on the TOS_LOCAL_ADDRESS or other
> > parameters, calls StdControl on App1C or App2C appropriately.
> >
> > The reason for this is because TOSSIM is compiled INTO the application
> > (ie main.exe). Thus if you run two different main.exe files, you're
> > running two different simulators. The wrapper method above is an easy
> > and quick fix to your situation (and is what we have done to simulate
> > motes with different code).
> >
> > -Joe
>
> _______________________________________________
> Tinyos-users mailing list
> [email protected]
> http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users
>
_______________________________________________
Tinyos-users mailing list
[email protected]
http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users