---
# System prepended metadata

title: Water Dispenser Simulator Manual
tags: [SmartDispenserSimulator]

---

Water Dispenser Simulator Manual
===
###### tags: `SmartDispenserSimulator`
The simulator program begins with certain assumptions as follows: 
1. The water in all the tanks is full
2. The temperature is at the upper limit for the hot tank and the lower limit for the cold tank

The steps for working the simulator are as follows: 
**1.** Generate the csv file for the raw data of any dispenser and replace the name of the raw data file in the python file. Example:
```python=47
data = pd.read_csv("MA_04_01_test (1).csv", header = 0) 
```
**2.** Now proceed to change the file location and names of the volume used dataframe and the derived parameters dataframe. Example:
```python=89
VolumeUse.to_csv(r'C:\Users\AnkitPanda\Desktop\Internship@Taiwan\Test1.csv', index = None, header = None) 
```
```python=299
par.to_csv(r'C:\Users\AnkitPanda\Desktop\Internship@Taiwan\parameter.csv', index = None, header = None)
```
**3.** Once these changes are made execute the python code as follows:
```
$ python3 ParameterDerive.py
```
**4.** One thing to make sure is that the output files should be located in the same folder as the cpp simulator files. 

**5.** The cpp program for the simulator are available in two options:
    - The volume used parameter is used and the program runs automatically. 
    - The volume used is inputted by the user with the help of mouse clicks. 
    
**6.** Before executing the cpp program the name of the input files for the parameters and volume used should be changed as per the output file names of the python program.Example: 
```cpp=128
ifstream ip("parameter.csv");
```
```
ifstream ip("VolumeUse.csv");
```
**7.** Now set the power saving time of the Simulator. Example: 
```cpp=104
string s2 = "Tue Jun 11 14:48"; 
string s3 = "Tue Jun 11 14:50";
```
**8.** Also, before running the simulator, the environment should support GUI operations else program will not compile.Here's a link on how to compile cpp programs with graphics.h header file. [Compile Graphics in Dev](https://www.youtube.com/watch?v=TEMhWt9WwTA).
Before running the simulator, the output file name of the cpp also needs to be changed. 
```
myfile.open("WaterDispenser141.csv",ios::out|ios::app);
```
**9.** Now execute the cpp file depending upon the choice for the auto mode or the one in the mouse click mode. For the mouse click mode: 
Compile the program: 
```
$ g++ WaterDispenserFinal2.cpp 
$ ./a.out
```
Once the program runs it will show the GUI window as shown in the image: 
![](https://i.imgur.com/FYbYQ2D.png)
The mouse commands on this screen are as follows: 
> LB: Hot Water
> MB: Cold Water
> RB: Warm Water 

**10.** To exit from the program press the Ctrl+C button or the close button on the GUI window. 

## Error
1. undefined reference to initgraph
![](https://i.imgur.com/mFGX2Qv.png)

[Debug](https://stackoverflow.com/questions/27341363/graphics-h-is-not-working-in-dev-c/27341479#27341479)