In this project, we were asked to build a dashboard on SystemLink that our family and/or friends can use to find when the next 94 or 96 bus is arriving in front of Anderson (College Ave @ Boston Ave stop, Medford, MA). The dashboard is supposed to display one bus' arrival at a time and allow the user to choose between the 94 and 96 bus times while also showing the current weather in front of Anderson.
Using the MBTA service API documentation link, we were able to find the predicted stop times URL of two different buses. Using our prior knowledge from the last assignment, we specified the STOP ID to be 2379 at College Ave@Boston Ave. All we had to do was changing the parameters in this link and alternate between 94 and 96 on filter[route] and hit execute to get the separate APIs. We acquired this API link for bus 96 and this link for bus 94.
We plugged the API links into our previously constructed block diagram on LabVIEW, to display arrival times of the MBTA buses and the current time. However, our first challenge was to figure out how to make the user choose between buses. We created a boolean type tag on Systemlink data and incorporated that into our block diagram and front panel using SystemLink tag and read, further attaching it to a boolean indicator. We had to allow the code to "select" between API's of different buses depending on the true or false values, so we found the "select" function under programming --> comparison. Then, we were able to connect these as an input to the JSON hack.
As a next step, we had to figure out how to display the outputs, the arrival times and the current time, visually on the SystemLink dashboard. So we made use of SystemLink write, in the number form for minutes and seconds until arrival, and further linked our newly created string type tags on SystemLink by creating controls. Another challenge we had was not being able to connect SystemLink read to the current timestamp on the block diagram, because the outlets did not match and we received an error message when connecting the wires. Then we found "Format Date/Time String" String function in order to make the conversion and display the timestamp value as a string .
For the second part of the dashboard, we searched for a weather API that would give us the temperature and the forecast at the specific location and time. We found this weather API web service and followed the examples to get our specific API. Finding the grid points that correlate to our location was challenging since we first found the coordinates of College Ave@Boston Ave using this website and then plugged the latitude and longitude coordinates into this link in order to get the gridID, grid X and Y for forecast.
Then, we acquired this API link as our original API to insert into the block diagram. We found the specific search names to display the current "temperature" and "detailedForecast" using the URL, as displayed below. We repeated the same procedure for both of them using two JSON hacks.
As a final challenge, our detailed forecast would not show on either our front panel on LabVIEW and dashboard on Systemlink, while temperature worked. After learning that we should connect the indicator to "What is left" node, we were able to make it work. We then repeated the same process of attaching newly created tags to SystemLink write and the control on the block diagram, to be displayed on the dashboard. To further cut the rest of the blurb after the quotation mark where the detailed forecast ends, we made use of the String function "Match Pattern" and created a before substring. By this way, we were able to get rid of the unnecessary information after the detailed forecast.