Obsolete /
GDPTestGeneratorThe GDP is no longer supported by the Accessors Framework. This page exists as a historical reference.
The swarmlet appends to a GDP log named "edu.berkeley.eecs.testlog" a sequence of JSON data. A new output is produced once per second and the values cycle through a specified range. This is intended to be a test log that can be relied to be always producing data. The JSON produced has the following properties:
Deploying on TerraSwarmThe To update the version running on terra, edit the AccessorSSHCodeGenerator attribute and change the remote host to You will also need ssh access to Then run the model, the code should be redeployed to terra. You may need to do The swarmlet is restarted at boot time and periodically using pm2. In addition, there is cronjob that restarts every 5 minutes. PATH=/usr/local/python/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin # # /home/sbuser/sbuser.cron # */5 * * * * csh -c '/home/sbuser/cg/node_modules/.bin/pm2 restart GDPTestGenerator.js' >& /home/sbuser/sbuser.cron.log Log RotationWe are using https://github.com/pm2-hive/pm2-logrotate pm2-logrotation: pm2 install pm2-logrotate pm2 set pm2-logrotate:rotateInterval '* * * /1 * *' TestingSubscriptionThere is a model at gdp-readerHere's how to test whether the edu.berkeley.eecs.testlog is active using bash-3.2$ $PTII/vendors/gdp/gdp/apps/gdp-reader -s edu.berkeley.eecs.testlog Reading GCL T2bu1EV7VRFDM3Ao5ybbtWS8uxPrCOyJngCv0JMcils >>> recno 1524164, len 178, ts 2017-07-28 13:35:49.508240000Z 00000000 7b 22 64 65 76 69 63 65 22 3a 22 54 45 53 54 22 { " d e v i c e " : " T E S T " 00000010 2c 22 70 72 65 73 73 75 72 65 5f 70 61 73 63 61 , " p r e s s u r e _ p a s c a 00000020 6c 73 22 3a 37 33 34 30 30 2c 22 68 75 6d 69 64 l s " : 7 3 4 0 0 , " h u m i d 00000030 69 74 79 5f 70 65 72 63 65 6e 74 22 3a 38 2c 22 i t y _ p e r c e n t " : 8 , " 00000040 74 65 6d 70 65 72 61 74 75 72 65 5f 63 65 6c 63 t e m p e r a t u r e _ c e l c 00000050 69 75 73 22 3a 39 32 2c 22 6c 69 67 68 74 5f 6c i u s " : 9 2 , " l i g h t _ l 00000060 75 78 22 3a 38 30 2c 22 62 61 74 74 65 72 79 5f u x " : 8 0 , " b a t t e r y _ 00000070 70 65 72 63 65 6e 74 22 3a 39 32 2c 22 73 65 71 p e r c e n t " : 9 2 , " s e q 00000080 75 65 6e 63 65 5f 6e 75 6d 62 65 72 22 3a 38 2c u e n c e _ n u m b e r " : 8 , 00000090 22 74 69 6d 65 22 3a 22 32 30 31 37 2d 30 37 2d " t i m e " : " 2 0 1 7 - 0 7 - 000000a0 32 38 54 31 33 3a 33 34 3a 32 39 2e 33 33 31 5a 2 8 T 1 3 : 3 4 : 2 9 . 3 3 1 Z 000000b0 22 7d " } >>> recno 1524165, len 178, ts 2017-07-28 13:35:50.508682000Z 00000000 7b 22 64 65 76 69 63 65 22 3a 22 54 45 53 54 22 { " d e v i c e " : " T E S T " 00000010 2c 22 70 72 65 73 73 75 72 65 5f 70 61 73 63 61 , " p r e s s u r e _ p a s c a 00000020 6c 73 22 3a 37 33 37 30 30 2c 22 68 75 6d 69 64 l s " : 7 3 7 0 0 , " h u m i d 00000030 69 74 79 5f 70 65 72 63 65 6e 74 22 3a 39 2c 22 i t y _ p e r c e n t " : 9 , " 00000040 74 65 6d 70 65 72 61 74 75 72 65 5f 63 65 6c 63 t e m p e r a t u r e _ c e l c 00000050 69 75 73 22 3a 39 31 2c 22 6c 69 67 68 74 5f 6c i u s " : 9 1 , " l i g h t _ l 00000060 75 78 22 3a 39 30 2c 22 62 61 74 74 65 72 79 5f u x " : 9 0 , " b a t t e r y _ 00000070 70 65 72 63 65 6e 74 22 3a 39 31 2c 22 73 65 71 p e r c e n t " : 9 1 , " s e q 00000080 75 65 6e 63 65 5f 6e 75 6d 62 65 72 22 3a 39 2c u e n c e _ n u m b e r " : 9 , 00000090 22 74 69 6d 65 22 3a 22 32 30 31 37 2d 30 37 2d " t i m e " : " 2 0 1 7 - 0 7 - 000000a0 32 38 54 31 33 3a 33 34 3a 33 30 2e 33 33 32 5a 2 8 T 1 3 : 3 4 : 3 0 . 3 3 2 Z 000000b0 22 7d " } WebSocketsTerra is also running GDPToWebSocket.js, which should set up a WebSocket on terra that publishes the data. To run the model locally: $PTII/bin/capecode $PTII/ptolemy/actor/lib/jjs/modules/gdp/demo/GDPToWebSocket/*.xml Run GDPToWebSocket.xml first, then TestGDPToWebSocket.xml TestGDPToWebSocket.xml should connect to the WebSocket created by GDPToWebSocket.xml and produce data. |