<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Hello all, <br><br></div><div>I'm working for Edward Lee on composable web services in Ptolemy for the TerraSwarm project.  We've integrated a web server so a Ptolemy model can be a web service, receiving HTTP requests and returning responses.<br>
</div><div><br></div><div>The web server works in Kepler too, and could support interesting use cases!  I've attached a sample model based on the predator-prey demo.  It requires the ptolemy ptango package; notes below.  Hosting web services is a complement to Kepler actors that invoke outside web services (such as the RESTService actor).  <br>
</div><div><br>Running this model will launch a web service accessible at: <br></div><a href="http://localhost:8078/predatorprey">http://localhost:8078/predatorprey</a> <br><br></div>Users can enter parameters and submit a POST request to the model, which will execute and respond with new graph data.  <br>
<br></div></div>We're looking into options for making services accessible to the outside world.  We have a web server, <a href="http://ptango.eecs.berkeley.edu">ptango.eecs.berkeley.edu</a>, but generally don't leave models continuously running since the model input isn't currently screened for malicious items.<br>
</div><div><br></div>Within TerraSwarm, we're also integrating other tools, such as Sensor Andrew data feeds, EnergyPlus, and the TuLiP controller synthesis project.<br></div><br>For more info, there's a Ptolemy miniconference presentation and documentation in the latest Ptolemy book.<br>
<a href="http://chess.eecs.berkeley.edu/pubs/1027.html">http://chess.eecs.berkeley.edu/pubs/1027.html</a><br></div><a href="http://ptolemy.eecs.berkeley.edu/books/Systems/">http://ptolemy.eecs.berkeley.edu/books/Systems/</a><br>
<br></div><div>Please let me know if you have any questions!  Looking forward to hearing about lots of neat ideas for web services :)<br></div><div><br></div>Best,<br>Beth<br><br></div>Execution instructions:<br></div>The web server is part of the ptolemy ptango package.  The source code is part of the ptolemy repository, which is included with the Kepler development source code.  <br>
<br></div>The ptango package is excluded from the Kepler build by default.  To include it, please make the following changes:<br><br>- In <code> /kepler/build-area/settings/ptolemy-excludes</code>, REMOVE <code>/org/ptolemy/ptango/**</code><br>
<br>- In <code> /kepler/build-area/settings/ptolemy-includes</code>, ADD <code>/org/ptolemy/ptango/**</code> <br><br>- In <code> /kepler/build-area/resources/idea/PtolemyModuleStart</code>, REMOVE <code><excludeFolder url="<a class="" rel="nofollow">file://$MODULE_DIR$/src/org/ptolemy/ptango</a>" /></code>
<div><p class="">Then, build Kepler using instructions here: <br><a class="" href="https://kepler-project.org/developers/teams/build/documentation/build-system-instructions" rel="nofollow">https://kepler-project.org/developers/teams/build/documentation/build-system-instructions</a></p>
<p class="">The predatorprey.xml model references some additional files (included in attachment) and needs to know the locations of the files on your machine.  Please open the model and edit the parameters specified in the comments.</p>
<p class="">Then, run the model, open a browser, and navigate to:<br><a href="http://localhost:8078/predatorprey">http://localhost:8078/predatorprey</a> <br></p><p class="">Note there's a possibility the model will not converge for a particular input combination (the model looks for a return to the initial conditions), so please try some different inputs in this case.<br>
</p><div><div><div><div><div><div><br></div></div></div></div></div></div></div></div>