Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: about timer guarding interleave

about timer guarding interleave 24 Feb 2003 03:43 #6400

how to guard interleave operation with a timer? Suppose I want to wait A from PCO1, B from PCO2, C from PCO3
during T seconds. The interleave structure is like:

interleave {
[] PCO1?A
[] PCO2?A
[] PCO3?A
}
where should I introduce the timer operation?
---
Best Regards,

Zhongjie Li

********************************************************************
* Zhongjie Li *
* Ph.D candidate, Department of Computer Science & Technology *
* Tsinghua University, Beijing, 100084, P.R.China *
* Tel: +86+10-62788109 Fax: +86+10-62788109 *
* Email: This email address is being protected from spambots. You need JavaScript enabled to view it. *
********************************************************************
The administrator has disabled public write access.

about timer guarding interleave 24 Feb 2003 08:08 #6401

This is indeed a tricky one... Here is a solution that we have come up with:

var integer n := 0;
var boolean timeout_occurred := false;
timer T;

T.start(...);
interleave {
[not timout_occurred] PCO1.receive(A) {
n := n + 1;
...
}
[not timout_occurred] PCO2.receive(A) {
n := n + 1;
...
}
[not timout_occurred] PCO3.receive(A) {
n := n + 1;
...
}
[n < 3] T.timeout {
timeout_occurred := true;
...
}
}

This should accomplish what you need. Also, I guess, this example shows very nicely why interleave should be used with great care! Another possibility to solve the same kind of problem might be to introduce the concurrency explicitly into the test case and use three PTCs, once for each port, and shut them down from outside once the timeout occurs on the parent component.

BR

Stephan Tobies

>
Original Message
> From: ext Li Zhongjie [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> Sent: 24. February 2003 04:43
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: about timer guarding interleave
>
>
> how to guard interleave operation with a timer? Suppose I
> want to wait A from PCO1, B from PCO2, C from PCO3
> during T seconds. The interleave structure is like:
>
> interleave {
> [] PCO1?A
> [] PCO2?A
> [] PCO3?A
> }
> where should I introduce the timer operation?
> ---
> Best Regards,
>
> Zhongjie Li
>
> ********************************************************************
> * Zhongjie Li *
> * Ph.D candidate, Department of Computer Science & Technology *
> * Tsinghua University, Beijing, 100084, P.R.China *
> * Tel: +86+10-62788109 Fax: +86+10-62788109 *
> * Email: This email address is being protected from spambots. You need JavaScript enabled to view it. *
> ********************************************************************
>
The administrator has disabled public write access.

about timer guarding interleave 24 Feb 2003 08:40 #6403

Hi,

there is one problem with the solution that I have suggested: it is not allowed to use guard conditions in an interleave statement... So the [not timeout_occurred] and the [n < 3] conditions cannot be specified in an interleave statement.

BR

Stephan Tobies

>
Original Message
> From: ext Li Zhongjie [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> Sent: 24. February 2003 04:43
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: about timer guarding interleave
>
>
> how to guard interleave operation with a timer? Suppose I
> want to wait A from PCO1, B from PCO2, C from PCO3
> during T seconds. The interleave structure is like:
>
> interleave {
> [] PCO1?A
> [] PCO2?A
> [] PCO3?A
> }
> where should I introduce the timer operation?
> ---
> Best Regards,
>
> Zhongjie Li
>
> ********************************************************************
> * Zhongjie Li *
> * Ph.D candidate, Department of Computer Science & Technology *
> * Tsinghua University, Beijing, 100084, P.R.China *
> * Tel: +86+10-62788109 Fax: +86+10-62788109 *
> * Email: This email address is being protected from spambots. You need JavaScript enabled to view it. *
> ********************************************************************
>
The administrator has disabled public write access.

about timer guarding interleave 24 Feb 2003 09:08 #6404

Hi Stephen,
Perhaps we can use check operation instead of receive, like this:

T.start
T.timeout
interleave {
[] PCO1.check(receive(A))
[] PCO2.check(receive(B))
[] PCO3.check(receive(C))
}
PCO1?receive(A);
PCO2?receive(B);
PCO3?receive(C);

We first start timers and when it expires, we check the incoming ports.
at last, we take the first PDUs in each port.

But perhaps the easiest way to solve my problem is to modify the interleave syntax and semantics to
allow timer-guarding.

BR.
Li
Original Message
From: "Stephen TOBIES" <This email address is being protected from spambots. You need JavaScript enabled to view it.>
To: <This email address is being protected from spambots. You need JavaScript enabled to view it.>
Sent: Monday, February 24, 2003 4:40 PM
Subject: Re: about timer guarding interleave


Hi,

there is one problem with the solution that I have suggested: it is not allowed to use guard conditions in an interleave statement... So the [not timeout_occurred] and the [n < 3] conditions cannot be specified in an interleave statement.

BR

Stephan Tobies

>
Original Message
> From: ext Li Zhongjie [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> Sent: 24. February 2003 04:43
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: about timer guarding interleave
>
>
> how to guard interleave operation with a timer? Suppose I
> want to wait A from PCO1, B from PCO2, C from PCO3
> during T seconds. The interleave structure is like:
>
> interleave {
> [] PCO1?A
> [] PCO2?A
> [] PCO3?A
> }
> where should I introduce the timer operation?
> ---
> Best Regards,
>
> Zhongjie Li
>
> ********************************************************************
> * Zhongjie Li *
> * Ph.D candidate, Department of Computer Science & Technology *
> * Tsinghua University, Beijing, 100084, P.R.China *
> * Tel: +86+10-62788109 Fax: +86+10-62788109 *
> * Email: This email address is being protected from spambots. You need JavaScript enabled to view it. *
> ********************************************************************
>
The administrator has disabled public write access.

about timer guarding interleave 24 Feb 2003 17:46 #6406

Dear Li,

I do not understand your examples at all. Your latest solution:

> T.start
> T.timeout
> interleave {
> [] PCO1.check(receive(A))
> [] PCO2.check(receive(B))
> [] PCO3.check(receive(C))
> }
> PCO1?receive(A);
> PCO2?receive(B);
> PCO3?receive(C);
>

is very strange, you can directly write

> T.start
> T.timeout
> PCO1?receive(A);
> PCO2?receive(B);
> PCO3?receive(C);

if you expect A, B and C in PCO1, PCO2 and PCO3 after the expiration
of T.

However, your original example/problem was:

> > interleave {
> > [] PCO1?A
> > [] PCO2?A
> > [] PCO3?A
> > }
> > where should I introduce the timer operation?


If I interpret this correctly, you mean

interleave {
[] PCO1.receive(A) {}
[] PCO2.receive(B) {}
[] PCO3.receive(C) {}
}


According to your proposed check-solution above you can write:

T.start;
interleave {
[] PCO1.receive(A) {}
[] PCO2.receive(B) {}
[] PCO3.receive(C) {}
}
if (not(T.running)) {
setverdict(fail);
T.timeout; // removal of timeout
}
else {
T.stop; // stopping of running timer
}

If you need to detect the timeout during the execution of the
interleaved receive statements, you can write a special default
and activate it immediately before entering the interleave statement.
For example:

altstep MySpecialDefault () runs on MyComponenttype {
[] T.timeout {
setverdict(fail);
stop; // Stop is just one possible handling of the timeout
}
}


and in the component behaviour description:

T.start;
defaultVar := activate(MySpecialDefault);
interleave {
[] PCO1.receive(A) {}
[] PCO2.receive(B) {}
[] PCO3.receive(C) {}
}
deactivate(defaultVar);
T.stop;


Hope this helps.
Best regards
Jens








Li Zhongjie schrieb:
>
> Hi Stephen,
> Perhaps we can use check operation instead of receive, like this:
>
> T.start
> T.timeout
> interleave {
> [] PCO1.check(receive(A))
> [] PCO2.check(receive(B))
> [] PCO3.check(receive(C))
> }
> PCO1?receive(A);
> PCO2?receive(B);
> PCO3?receive(C);
>
> We first start timers and when it expires, we check the incoming ports.
> at last, we take the first PDUs in each port.
>
> But perhaps the easiest way to solve my problem is to modify the interleave
syntax and semantics to
> allow timer-guarding.
>
> BR.
> Li
>
Original Message
> From: "Stephen TOBIES" <This email address is being protected from spambots. You need JavaScript enabled to view it.>
> To: <This email address is being protected from spambots. You need JavaScript enabled to view it.>
> Sent: Monday, February 24, 2003 4:40 PM
> Subject: Re: about timer guarding interleave
>
> Hi,
>
> there is one problem with the solution that I have suggested: it is not
allowed to use guard conditions in an interleave statement... So the [not
timeout_occurred] and the [n < 3] conditions cannot be specified in an
interleave statement.
>
> BR
>
> Stephan Tobies
>
> >
Original Message
> > From: ext Li Zhongjie [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> > Sent: 24. February 2003 04:43
> > To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> > Subject: about timer guarding interleave
> >
> >
> > how to guard interleave operation with a timer? Suppose I
> > want to wait A from PCO1, B from PCO2, C from PCO3
> > during T seconds. The interleave structure is like:
> >
> > interleave {
> > [] PCO1?A
> > [] PCO2?A
> > [] PCO3?A
> > }
> > where should I introduce the timer operation?
> > ---
> > Best Regards,
> >
> > Zhongjie Li
> >
> > ********************************************************************
> > * Zhongjie Li *
> > * Ph.D candidate, Department of Computer Science & Technology *
> > * Tsinghua University, Beijing, 100084, P.R.China *
> > * Tel: +86+10-62788109 Fax: +86+10-62788109 *
> > * Email: This email address is being protected from spambots. You need JavaScript enabled to view it. *
> > ********************************************************************
> >

--

======================================================================
Dr. Jens Grabowski
Institute for Telematics phone: +49 451 500 3723
University of Luebeck fax: +49 451 500 3722
Ratzeburger Allee 160 eMail: This email address is being protected from spambots. You need JavaScript enabled to view it.
D-23538 Luebeck or This email address is being protected from spambots. You need JavaScript enabled to view it.
(Germany) WWW: www.itm.mu-luebeck.de
======================================================================
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin