When the sensors and actuators are attached to processors on a network, process control becomes a distributed application. Playground does not have real-time support for process control applications, but we can still explore the distributed process control paradigm in an application where timing is not quite so critical. In this lab, you will construct a distributed application to simulate, monitor and control a syrup factory. (Note: This syrup factory example is discussed in one of the research papers Playground. You will benefit most from this assignment if you do it on your own. Please do not look at that paper while you do this assignment.)
Read over the entire assignment before starting. Then, follow the instructions. Note that the modules can be constructed in any order. You may want to write the FACTORY module and then construct your user-interface before proceeding with the CONTROL module.
Your module should have three presentation items as output: the temperature of the liquid, the volume of the liquid, and the concentration of the liquid. These are initially 25C (room temperature), 0 liters, and 1.0 respectively. In addition, you will have two input presentation items: the height of the burner flame, in the range 0 (off) to 40.0 (full blast), and the status of the valve, in the range 0 to 20.0 liters per second. (Use PGreal variables for all of your published variables in this assignment.)
Your module will simulate, in a loop, small increments of simulated time. Once each second, it will adjust the temperature, volume, and concentration according to the current conditions. (See the counter module from Lab T-1 for an example of how to write a loop that performs a computation once each second.)
If the flame is on, the temperature will go up some amount in proportion to the height of the flame and in inverse proportion to the volume. If the flame is off and the liquid is above room temperature, then the liquid will cool slightly, depending on volume and current temperature. The volume will change depending on how much sap is coming into the vat through the valve and on how much water is evaporating due to the temperature of the liquid. The vat holds up to 150 liters of liquid before it overflows. Evaporation begins when the temperature reaches 90 degrees C. The concentration can be computed as the total liquid added to the vat divided by the current volume. The simulation should not stop until the concentration reaches at least 40.0 and the liquid has cooled to room temperature. It's up to you to decide how accurate the physics of your simulation will be. For example, you may want evaporation to be more rapid at lower concentrations.
HINTS: First write separate procedures to compute the new values of temperature, volume and concentration, given the old values and the current conditions of the burner and valve. Then put these into a loop whose termination condition is based on the concentration and the temperature. You may want to use EUPHORIA to test your module. Also, modules like the consumer and constant modules from Lab 1 may come in handy.