[kepler-users] Kepler: Array instantiation and Array element assignment

Ricardo.Pascual at csiro.au Ricardo.Pascual at csiro.au
Mon Oct 1 17:59:16 PDT 2012


Hi Edward,

Thanks for all the tips below.  I will see what this publisher and subscriber that you mentioned. Yes I will need it in several places and also it is inside a loop so it is good that one has a copy.  Kepler as I am learning this week is not the same as the traditional OOP languages.  I do not know that it is even the same as Simulink.  I have a feeling it is not because I can easily define a variable in Simulink. I will keep in mind the different directors.  The state that we are in at the moment is evaluating various options scientific workflow that we are going to use in our projects,  that's why I am going through some exercise in Kepler.



Thanks for all the help,

Ric  

-----Original Message-----
From: Edward A. Lee [mailto:eal at eecs.berkeley.edu] 
Sent: Tuesday, 2 October 2012 1:46 AM
To: Pascual, Ricardo (CMAR, Dutton Park)
Cc: Kepler-users at kepler-project.org; cxh at eecs.berkeley.edu; crawl at sdsc.edu
Subject: Re: [kepler-users] Kepler: Array instatiation and Array element assignment


The SetVariable actor is rather tricky to use.
Depending on the director that you choose and the parameters you set, it could be nondeterministic.  Why go through a variable? Why not just feed the data from DirectoryListing to where it is needed?

If there are lots of places it is needed, you might consider using Publisher and Subscriber.  These, at least, are assured of determinism.

It is a bit of a change of mindset to "think in kepler" :-) It's quite important which director you pick. They all provide a concurrent model of computation, but their behaviors are quite different...

Edward


On 9/30/12 8:49 PM, Ricardo.Pascual at csiro.au wrote:
> Hi Edward.
>
> Thanks for the email.  I am still trying to to learn how to think properly in kepler.  Any how the best solution  I can come up with is defining a parameter actor and setting the value using the VariableSetter actor. I believe you created this actor.  So if I set it to an array of strings dirList will be an array of string as in below.
> *dirList  #"declare the variable as ParameterActor"
> DirectoryListingActor -----> VariableSetterActor(with .variablename 
> =dirList)
>
> There might be a more elegant solution but that will have to wait until I know more of kepler.  As you pointed out you can do this with the various Expression like RExpression and others. BTW is there a hook to C++ in kepler?
>
>
> Kind regards.
>
> Ric
> ________________________________________
> From: Edward A. Lee [eal at eecs.berkeley.edu]
> Sent: Monday, 1 October 2012 7:02 AM
> To: Pascual, Ricardo (CMAR, Dutton Park)
> Cc: Kepler-users at kepler-project.org; cxh at eecs.berkeley.edu; 
> crawl at sdsc.edu
> Subject: Re: [kepler-users] Kepler: Array instatiation and Array 
> element assignment
>
> Hi Ric,
>
> I'm not sure what you mean by "programmatically."
> What you describe below is a program in an imperative language.
> In Kepler, the primary imperative language is Java. So you could write 
> an actor in Java that does this.
>
> There are also hooks to write actors in MATLAB and Python, which are 
> also imperative languages.
>
> If instead you are trying to define a workflow that builds this 
> variable, then the only director with an imperative flavor is the FSM. 
> I think it could be awkward to define it in an FSM.
>
> You could use a dataflow director or PN and SequenceToArray actor, but 
> these are distinctly not imperative.
>
> In Kepler, parameters are defined as expressions in the Ptolemy 
> expression language.
> The expression language is also not an imperative language.
> It is a functional language. So you don't actually specify sequences 
> of steps for defining variables.
>
> It occurs to me that it could be very useful to define subclass of 
> Parameter, say PythonParameter, that specifies a parameter value that 
> is initialized by running a Python script... This would probably be 
> fairly easy to write...
> Any interest in this?
>
> Edward
>
>
>
> On 9/30/12 12:39 PM, Ricardo.Pascual at csiro.au wrote:
>> Hi All,
>>
>> Oooops wrong title.
>>
>> Thanks,
>>
>> Ric
>>
>> ________________________________________
>> From: kepler-users-bounces at kepler-project.org 
>> [kepler-users-bounces at kepler-project.org] On Behalf Of 
>> Ricardo.Pascual at csiro.au [Ricardo.Pascual at csiro.au]
>> Sent: Sunday, 30 September 2012 9:11 PM
>> To: Kepler-users at kepler-project.org; cxh at eecs.berkeley.edu; 
>> crawl at sdsc.edu
>> Subject: [ExternalEmail] Re: [kepler-users] netCDF
>>
>> Hi All,
>>
>> I am about a week old into Kepler and having difficulty defining an array variable programmatically.  I have search the internet for this to no avail.   I know how to do it as a constant by assigning the value = {"x1", ...}.
>>
>> What I like to do is define a variable with scope workflow wide say
>>
>> string fileNames[];
>>
>> then assign values to it as in
>>
>> fileNames[0] = "file0"
>> fileNames[1] = "file1"
>>
>>
>> and so on.
>>
>>
>> Thank you very much,
>>
>> Ric
>> _______________________________________________
>> Kepler-users mailing list
>> Kepler-users at kepler-project.org
>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>> _______________________________________________
>> Kepler-users mailing list
>> Kepler-users at kepler-project.org
>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>
>


More information about the Kepler-users mailing list