In this project, we were asked to create a front panel that displays the time of arrival and the number of minutes until the next 94 Bus arrives outside Anderson Hall on College Ave in Medford, MA.
Using the MBTA service API documentation link, we were able to find the predicted stop times URL of the bus and figured that we need a specific STOP ID. This URL, as a section of the MBTAs API, then lead us to a detailed data on stop times of different buses at specific locations, where we were able to find our bus "College Ave @ Boston Ave" and the specific STOP ID: 2379. This is seen on the screenshot to the right.
After getting the STOP ID, we were able to start constructing our block diagram and utilize this URL as an input to connect to a JSON hack that we already dragged into the diagram, using "arrival time" as the search term. The first problem we encountered was getting the output of the arrival time in a string format, which we further fixed by using the "time stamp" property of the output of the JSON hack and eventually got a decent output format.
As a further step, we searched for an API that gives the current time based on our location. http://worldtimeapi.org/ detected our local time and location and we obtained this URL specific to our time zone to plug into our other JSON hack on our diagram as an input. We then figured out how to display the output in both a number and a time stamp format as shown.
However, our second challenge and struggle was receiving a very large number value out of the JSON hack. Then, in order to get a numeric value for the time difference between the current time and the predicted arrival time, we found the subtract function, under Mathematics --> Numeric. Still, the number value of the time difference we acquired was large but relatively smaller. Trying to understand what this value actually represents, we calculated the difference between the current time and the time of expected arrival, manually, in minutes, to find out that the big number we kept acquiring was the number of seconds until arrival. Again, we used a mathematical function, this time division, to divide the number by 60 to display the output in a more convenient minutes format.
A final challenge was realizing that LabVIEW has a hard time updating in every single second and working continuously, the remaining time also became negative after the predicted time of arrival of the bus. So we then added a "while loop" with a 5 second time delay, as shown on the bottom left and right corners, to update the time in every 5 seconds as the program functions on the front panel, in a repeated pattern.