Constraints with assignment to parameters

2004-05-21 Thread Marija Surnaite
Hello,
we are three students from Aalborg University. We are using Ptolemy II 
for our study project. We encountered a few problems and would like to 
know if they are constraints of Ptolemy II or if we are just doing 
things in the wrong way.

1) In expression editor it is normal to assign a value to a variable. In 
 an Expression actor we tried to assign a value to a parameter and 
it throws a parsing error.
In FSM model, assigning to a parameter (set action) works correctly.

2) We decided to model a block of RAM as an array (FSM model). We put a 
parameter named RAM and assigned initial values as following:
([1:1:length]*0.0).toArray()
We encountered a problem while assigning a value to a element of this 
array (set action RAM[c]=value, where c is a parameter with integer 
value). The expression says that it requires INTEGER instead of c.

We would be really grateful if anyone could explain these problems
 Regards,
Marija

Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]


Re: Constraints with assignment to parameters

2004-05-21 Thread Edward A Lee
The expression language itself is not a programming language.
It does not have statements (sequencing of operations) nor
does not support assignments...  It supports just expressions.
The result of evaluating an expression is an immutable (unchangable)
token. If the result is an array, you cannot modify the elements
of the array.  You would have to create a new array.
FSM augments the expression language with assignments, but this
makes sense because FSM has sequencing in its semantics.
If what you really want is a scripting capability, I suggest
using the Python actor.  Then you have a full programming language
accessible rather than just an expression language.  You can
also use Matlab as a scripting language using the MatlabExpression
actor.
Edward
At 12:55 PM 5/21/2004 +0200, Marija Surnaite wrote:
Hello,
we are three students from Aalborg University. We are using Ptolemy II for 
our study project. We encountered a few problems and would like to know if 
they are constraints of Ptolemy II or if we are just doing things in the 
wrong way.

1) In expression editor it is normal to assign a value to a variable. 
In  an Expression actor we tried to assign a value to a parameter and 
it throws a parsing error.
In FSM model, assigning to a parameter (set action) works correctly.
2) We decided to model a block of RAM as an array (FSM model). We put a 
parameter named RAM and assigned initial values as following:
([1:1:length]*0.0).toArray()
We encountered a problem while assigning a value to a element of this 
array (set action RAM[c]=value, where c is a parameter with integer 
value). The expression says that it requires INTEGER instead of c.


Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
[EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal

Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]