<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-AU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Christopher,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the email. Now the fact that that we can interface with C /C++ is good news. At the moment I am evaluating a possible framework for us to use with our project related to climate model analysis. I have used Kepler to create actors related to climate studies using the composite actor and they are working well. I am heartened by fact that the user group has been very responsive and helpful as I learn this framework.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I ended using what you suggested, that is using a Parameter actor that can be seen workflow wide. Am I allowed to say “the variable is local to the workflow actor” </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks again,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ric<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Christopher Brooks [mailto:cxh@eecs.berkeley.edu] <br><b>Sent:</b> Tuesday, 2 October 2012 12:00 PM<br><b>To:</b> Pascual, Ricardo (CMAR, Dutton Park)<br><b>Cc:</b> barseghian@nceas.ucsb.edu; Kepler-users@kepler-project.org<br><b>Subject:</b> Re: [kepler-users] Kepler: Array instantiation and Array element assignment<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Hi Ricardo,<br><br>Interfacing to C is not that difficult, though it is difficult to do in a portable manner. <br>See<br><a href="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/">http://docs.oracle.com/javase/7/docs/technotes/guides/jni/</a><br><br>I used JNA (<a href="https://github.com/twall/jna">https://github.com/twall/jna</a>) with good success to interface to FMI, see org/ptolemy/fmu.<br><br>The JNAerator will create stub code for you from C and C++<br><a href="http://code.google.com/p/jnaerator/">http://code.google.com/p/jnaerator/</a><br><br>Ptolemy II includes ways to access C code, see the faq links below.<br>See $PTII/bin/vergil $PTII/ptolemy/cg/lib/demo/Scale/ScaleC.xml<br><br>For interfacing to a C library that is complex, I suggest using JNA to create some wrapper Java code and then write actors that use the Java wrapper code.<br><br>I don't really understand your initial question though. What are you trying to do?<br><br>You said you wanted to create a "scope workflow wide". Typically, we do this by placing a parameter into a model.<br><br>If you were writing Java code, you would create a parameter in the container of an actor, but this is not very good actor-oriented programming.<br><br>For information about writing actors in Java, see the designing actors chapter of <a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-28.html">http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-28.html</a><br><br>_Christopher<br><br><br><o:p></o:p></p><div><p class=MsoNormal>On 10/1/12 6:04 PM, <a href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a> wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Derik,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the email. Somehow I need to interface with C/C++ codes as there are codes that I will need written in C/C++. </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>It is good to know that there is an active forum on Kepler.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ric</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Derik Barseghian [<a href="mailto:barseghian@nceas.ucsb.edu">mailto:barseghian@nceas.ucsb.edu</a>] <br><b>Sent:</b> Tuesday, 2 October 2012 10:56 AM<br><b>To:</b> Pascual, Ricardo (CMAR, Dutton Park)<br><b>Cc:</b> <a href="mailto:kepler-users@kepler-project.org">kepler-users@kepler-project.org</a> Users<br><b>Subject:</b> Re: [kepler-users] Kepler: Array instatiation and Array element assignment</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><div><p class=MsoNormal>Hi Ric,<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>I found some relevant info here;<o:p></o:p></p></div><div><p class=MsoNormal><a href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#Interfacing%20to%20C/C++">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#Interfacing to C/C++</a><o:p></o:p></p></div><div><p class=MsoNormal><a href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#CodeGen">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#CodeGen</a><o:p></o:p></p></div><div><p class=MsoNormal>The descriptions make it sound like these aren't being worked on anymore, but I've seen ptolemy SVN check-ins that seem to do w/ C code generation and copernicus in the recent past, so I'm not sure about that.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Note you can call any arbitrary program using the External Execution actor.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>If you're trying to develop new actor(s), customizing the RExpression or Python actors, or writing new ones in Java is probably easiest.<o:p></o:p></p></div><div><p class=MsoNormal>Derik<o:p></o:p></p></div><div><div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>On Oct 1, 2012, at 8:46 AM, "Edward A. Lee" <<a href="mailto:eal@eecs.berkeley.edu">eal@eecs.berkeley.edu</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><br><br><br><o:p></o:p></p><p class=MsoNormal><br>The SetVariable actor is rather tricky to use.<br>Depending on the director that you choose and the parameters you set,<br>it could be nondeterministic. Why go through a variable? Why not just<br>feed the data from DirectoryListing to where it is needed?<br><br>If there are lots of places it is needed, you might consider using<br>Publisher and Subscriber. These, at least, are assured of determinism.<br><br>It is a bit of a change of mindset to "think in kepler" :-)<br>It's quite important which director you pick. They all provide<br>a concurrent model of computation, but their behaviors are quite<br>different...<br><br>Edward<br><br><br>On 9/30/12 8:49 PM, <a href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a> wrote:<br><br><br><o:p></o:p></p><p class=MsoNormal>Hi Edward.<br><br>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.<br>*dirList #"declare the variable as ParameterActor"<br>DirectoryListingActor -----> VariableSetterActor(with .variablename =dirList)<br><br>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?<br><br><br>Kind regards.<br><br>Ric<br>________________________________________<br>From: Edward A. Lee [<a href="mailto:eal@eecs.berkeley.edu">eal@eecs.berkeley.edu</a>]<br>Sent: Monday, 1 October 2012 7:02 AM<br>To: Pascual, Ricardo (CMAR, Dutton Park)<br>Cc: <a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a>; <a href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>; <a href="mailto:crawl@sdsc.edu">crawl@sdsc.edu</a><br>Subject: Re: [kepler-users] Kepler: Array instatiation and Array element assignment<br><br>Hi Ric,<br><br>I'm not sure what you mean by "programmatically."<br>What you describe below is a program in an imperative language.<br>In Kepler, the primary imperative language is Java. So you<br>could write an actor in Java that does this.<br><br>There are also hooks to write actors in MATLAB and Python,<br>which are also imperative languages.<br><br>If instead you are trying to define a workflow that builds<br>this variable, then the only director with an imperative<br>flavor is the FSM. I think it could be awkward to define<br>it in an FSM.<br><br>You could use a dataflow director or PN and SequenceToArray<br>actor, but these are distinctly not imperative.<br><br>In Kepler, parameters are defined as expressions in the<br>Ptolemy expression language.<br>The expression language is also not an imperative language.<br>It is a functional language. So you don't actually specify<br>sequences of steps for defining variables.<br><br>It occurs to me that it could be very useful to define<br>subclass of Parameter, say PythonParameter, that specifies<br>a parameter value that is initialized by running a Python<br>script... This would probably be fairly easy to write...<br>Any interest in this?<br><br>Edward<br><br><br><br>On 9/30/12 12:39 PM, <a href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a> wrote:<br><br><br><o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Hi All,<br><br>Oooops wrong title.<br><br>Thanks,<br><br>Ric<br><br>________________________________________<br>From: <a href="mailto:kepler-users-bounces@kepler-project.org">kepler-users-bounces@kepler-project.org</a> [<a href="mailto:kepler-users-bounces@kepler-project.org">kepler-users-bounces@kepler-project.org</a>] On Behalf Of <a href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a> [<a href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a>]<br>Sent: Sunday, 30 September 2012 9:11 PM<br>To: <a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a>; <a href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>; <a href="mailto:crawl@sdsc.edu">crawl@sdsc.edu</a><br>Subject: [ExternalEmail] Re: [kepler-users] netCDF<br><br>Hi All,<br><br>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", ...}.<br><br>What I like to do is define a variable with scope workflow wide say<br><br>string fileNames[];<br><br>then assign values to it as in<br><br>fileNames[0] = "file0"<br>fileNames[1] = "file1"<br><br><br>and so on.<br><br><br>Thank you very much,<br><br>Ric<br>_______________________________________________<br>Kepler-users mailing list<br><a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br><a href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><br>_______________________________________________<br>Kepler-users mailing list<br><a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br><a href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><eal.vcf>_______________________________________________<br>Kepler-users mailing list<br><a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br><a href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><o:p></o:p></p></div><p class=MsoNormal> <o:p></o:p></p></div><p class=MsoNormal><br><br><br><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>Kepler-users mailing list<o:p></o:p></pre><pre><a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><o:p></o:p></pre><pre><a href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><o:p></o:p></pre></blockquote><p class=MsoNormal><br><br><o:p></o:p></p><pre>-- <o:p></o:p></pre><pre>Christopher Brooks, PMP University of California<o:p></o:p></pre><pre>CHESS Executive Director US Mail: 337 Cory Hall<o:p></o:p></pre><pre>Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774<o:p></o:p></pre><pre>ph: 510.643.9841 (Office: 545Q Cory)<o:p></o:p></pre><pre>home: (F-Tu) 707.665.0131 cell: 707.332.0670 <o:p></o:p></pre></div></body></html>