Compare commits
	
		
			No commits in common. "3213347dcb24340fd465ec0b336e2cbc8048c015" and "9fbe63af4836556969aa8ba8fc0e91c7214ae23c" have entirely different histories.
		
	
	
		
			3213347dcb
			...
			9fbe63af48
		
	
		| 
						 | 
					@ -1,3 +0,0 @@
 | 
				
			||||||
int *getRandoms(int lower, int upper, int count);
 | 
					 | 
				
			||||||
long double distance(struct Point* A, struct Point* B);
 | 
					 | 
				
			||||||
void Kmeans2(struct data_frame *df);
 | 
					 | 
				
			||||||
							
								
								
									
										500
									
								
								iPDC/kmeans.csv
								
								
								
								
							
							
						
						
									
										500
									
								
								iPDC/kmeans.csv
								
								
								
								
							| 
						 | 
					@ -1,500 +0,0 @@
 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65469.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65467.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65442.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65477.000000, 1
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65449.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65467.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65475.000000, 1
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65475.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65477.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65457.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65463.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65465.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65450.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65463.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65460.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65476.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65455.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65468.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65461.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65444.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65478.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65462.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65455.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65452.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65447.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65457.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.400002, 65479.000000, 1
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65452.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65451.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.299999, 65475.000000, 1
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.500000, 65451.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65445.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65456.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65459.000000, 2
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.400002, 65454.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65475.000000, 1
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.200001, 65446.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65468.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.500000, 65465.000000, 2
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.099998, 65454.000000, 0
 | 
					 | 
				
			||||||
50.299999, 65460.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65460.000000, 2
 | 
					 | 
				
			||||||
50.299999, 65460.000000, 2
 | 
					 | 
				
			||||||
		
		
			
  | 
							
								
								
									
										9671
									
								
								iPDC/kmeans.txt
								
								
								
								
							
							
						
						
									
										9671
									
								
								iPDC/kmeans.txt
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -1,56 +0,0 @@
 | 
				
			||||||
# 0 : 50.284426, 65451.237705
 | 
					 | 
				
			||||||
# 1 : 50.370104, 65476.164948
 | 
					 | 
				
			||||||
# 2 : 50.302515, 65464.320755
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import csv
 | 
					 | 
				
			||||||
import numpy as np
 | 
					 | 
				
			||||||
import matplotlib.pyplot as plt
 | 
					 | 
				
			||||||
from sklearn import preprocessing
 | 
					 | 
				
			||||||
x=[]
 | 
					 | 
				
			||||||
y=[]
 | 
					 | 
				
			||||||
x1=[]
 | 
					 | 
				
			||||||
y1=[]
 | 
					 | 
				
			||||||
x2=[]
 | 
					 | 
				
			||||||
y2=[]
 | 
					 | 
				
			||||||
with open('kmeans.csv', mode ='r') as file:
 | 
					 | 
				
			||||||
    csvFile = csv.reader(file)
 | 
					 | 
				
			||||||
    for lines in csvFile:
 | 
					 | 
				
			||||||
        #print(lines)
 | 
					 | 
				
			||||||
        if(int(lines[2])==0):
 | 
					 | 
				
			||||||
            x.append(float(lines[0]))
 | 
					 | 
				
			||||||
            y.append(float(lines[1]))
 | 
					 | 
				
			||||||
        elif(int(lines[2])==1):
 | 
					 | 
				
			||||||
            x1.append(float(lines[0]))
 | 
					 | 
				
			||||||
            y1.append(float(lines[1]))
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            x2.append(float(lines[0]))
 | 
					 | 
				
			||||||
            y2.append(float(lines[1]))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
x.append(50.284426)
 | 
					 | 
				
			||||||
y.append(65451.237705)
 | 
					 | 
				
			||||||
x1.append(50.370104)
 | 
					 | 
				
			||||||
y1.append(65476.164948)
 | 
					 | 
				
			||||||
x2.append(50.302515)
 | 
					 | 
				
			||||||
y2.append(65464.320755)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
x_array = np.array(x+x1+x2)
 | 
					 | 
				
			||||||
y_array = np.array(y+y1+y2)
 | 
					 | 
				
			||||||
# x1_array = np.array(x1)
 | 
					 | 
				
			||||||
# y1_array = np.array(y1)
 | 
					 | 
				
			||||||
# x2_array = np.array(x2)
 | 
					 | 
				
			||||||
# y2_array = np.array(y2)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
x_arr = preprocessing.normalize([x_array])
 | 
					 | 
				
			||||||
y_arr = preprocessing.normalize([y_array])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# x1_arr = preprocessing.normalize([x1_array])
 | 
					 | 
				
			||||||
# y1_arr = preprocessing.normalize([y1_array])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# x2_arr = preprocessing.normalize([x2_array])
 | 
					 | 
				
			||||||
# y2_arr = preprocessing.normalize([y2_array])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
plt.scatter(x_arr, y_arr)
 | 
					 | 
				
			||||||
# plt.scatter(x1_arr, y1_arr)
 | 
					 | 
				
			||||||
# plt.scatter(x2_arr, y2_arr)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
plt.show()
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,204 +0,0 @@
 | 
				
			||||||
#include "parser.h"
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <time.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <stdbool.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct Point
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    long double x, y;    // coordinates
 | 
					 | 
				
			||||||
    int cluster;         // no default cluster
 | 
					 | 
				
			||||||
    long double minDist; // default infinite dist to nearest cluster
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int count = 0;
 | 
					 | 
				
			||||||
struct Point *P;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double distance(struct Point* A, struct Point* B)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return (((A->x - B->x) * (A->x - B->x)) + ((A->y - B->y) * (A->y - B->y)));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int *getRandoms(int lower, int upper, int count)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    srand(time(0));
 | 
					 | 
				
			||||||
    int *p = (int *)malloc(sizeof(int) * count);
 | 
					 | 
				
			||||||
    int track = 0;
 | 
					 | 
				
			||||||
    while (1)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (track == count)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            return p;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        int num = (rand() % (upper - lower + 1)) + lower;
 | 
					 | 
				
			||||||
        if (track == 0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            p[track] = num;
 | 
					 | 
				
			||||||
            track++;
 | 
					 | 
				
			||||||
            continue;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        int flag = 0;
 | 
					 | 
				
			||||||
        for (int j = 0; j <= track - 1; j++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (num == p[j])
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                flag = 1;
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (flag == 0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            p[track] = num;
 | 
					 | 
				
			||||||
            track++;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Kmeans2(struct data_frame *df)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    printf("count: %d\n",count);
 | 
					 | 
				
			||||||
    if(count==0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        P = (struct Point *)malloc(sizeof(struct Point) * 500);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (count != 500)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        float CURR_FREQ;
 | 
					 | 
				
			||||||
        if (df->dpmu[0]->fmt->freq == '0')
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            CURR_FREQ = 50 + to_intconvertor(df->dpmu[0]->freq) * 1e-3;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            CURR_FREQ = decode_ieee_single(df->dpmu[0]->freq);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        float CURR_vol;
 | 
					 | 
				
			||||||
        if (df->dpmu[0]->fmt->phasor == '0')
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (df->dpmu[0]->fmt->polar == '0')
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                unsigned char s1[2];
 | 
					 | 
				
			||||||
                unsigned char s2[2];
 | 
					 | 
				
			||||||
                strncpy(s1, df->dpmu[0]->phasors[0], 2);
 | 
					 | 
				
			||||||
                strncpy(s2, df->dpmu[0]->phasors[0] + 2, 2);
 | 
					 | 
				
			||||||
                long double v1 = to_intconvertor(s1);
 | 
					 | 
				
			||||||
                long double v2 = to_intconvertor(s2);
 | 
					 | 
				
			||||||
                CURR_vol = sqrt((v1 * v1) + (v2 * v2));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                unsigned char s1[2];
 | 
					 | 
				
			||||||
                strncpy(s1, df->dpmu[0]->phasors[0], 2);
 | 
					 | 
				
			||||||
                CURR_vol = to_intconvertor(s1);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (df->dpmu[0]->fmt->polar == '0')
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                unsigned char s1[4];
 | 
					 | 
				
			||||||
                unsigned char s2[4];
 | 
					 | 
				
			||||||
                strncpy(s1, df->dpmu[0]->phasors[0], 4);
 | 
					 | 
				
			||||||
                strncpy(s2, df->dpmu[0]->phasors[0] + 2, 4);
 | 
					 | 
				
			||||||
                long double v1 = decode_ieee_single(s1);
 | 
					 | 
				
			||||||
                long double v2 = decode_ieee_single(s2);
 | 
					 | 
				
			||||||
                CURR_vol = sqrt((v1 * v1) + (v2 * v2));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                unsigned char s1[4];
 | 
					 | 
				
			||||||
                strncpy(s1, df->dpmu[0]->phasors[0], 4);
 | 
					 | 
				
			||||||
                CURR_vol = decode_ieee_single(s1);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        P[count].x = CURR_FREQ;
 | 
					 | 
				
			||||||
        P[count].y = CURR_vol;
 | 
					 | 
				
			||||||
        P[count].cluster = -1;
 | 
					 | 
				
			||||||
        P[count].minDist = __DBL_MAX__;
 | 
					 | 
				
			||||||
        count++;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        int no_of_clusters = 5;
 | 
					 | 
				
			||||||
        int epochs = 20;
 | 
					 | 
				
			||||||
        int *c = getRandoms(0, 499, no_of_clusters);
 | 
					 | 
				
			||||||
        struct Point *Centroids = (struct Point *)malloc(sizeof(struct Point) * no_of_clusters);
 | 
					 | 
				
			||||||
        for (int i = 0; i < no_of_clusters; i++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Centroids[i].x = P[c[i]].x;
 | 
					 | 
				
			||||||
            Centroids[i].y = P[c[i]].y;
 | 
					 | 
				
			||||||
            Centroids[i].minDist = __DBL_MAX__;
 | 
					 | 
				
			||||||
            Centroids[i].cluster = -1;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        free(c);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        while (epochs--)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            for (int i = 0; i < no_of_clusters; i++)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                for (int j = 0; j < 500; j++)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    long double dist = distance(&Centroids[i], &P[j]);
 | 
					 | 
				
			||||||
                    if (P[j].minDist > dist)
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        P[j].minDist = dist;
 | 
					 | 
				
			||||||
                        P[j].cluster = i;
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            int *nPoints = (int *)malloc(sizeof(int) * no_of_clusters);
 | 
					 | 
				
			||||||
            long double *Sumx = (long double *)malloc(sizeof(long double) * no_of_clusters);
 | 
					 | 
				
			||||||
            long double *Sumy = (long double *)malloc(sizeof(long double) * no_of_clusters);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            for (int i = 0; i < no_of_clusters; i++)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                nPoints[i] = 0;
 | 
					 | 
				
			||||||
                Sumx[i] = 0;
 | 
					 | 
				
			||||||
                Sumy[i] = 0;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            for (int i = 0; i < 500; i++)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                nPoints[P[i].cluster]++;
 | 
					 | 
				
			||||||
                Sumx[P[i].cluster] += P[i].x;
 | 
					 | 
				
			||||||
                Sumy[P[i].cluster] += P[i].y;
 | 
					 | 
				
			||||||
                P[i].minDist = __DBL_MAX__;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            for (int i = 0; i < no_of_clusters; i++)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                Centroids[i].x = Sumx[i] / nPoints[i];
 | 
					 | 
				
			||||||
                Centroids[i].y = Sumy[i] / nPoints[i];
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            free(nPoints);
 | 
					 | 
				
			||||||
            free(Sumx);
 | 
					 | 
				
			||||||
            free(Sumy);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        count = 0;
 | 
					 | 
				
			||||||
        FILE *fp;
 | 
					 | 
				
			||||||
        fp = fopen("kmeans.txt","a");
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        for(int i=0;i<500;i++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            fprintf(fp,"%Lf, %Lf, %d\n",P[i].x,P[i].y,P[i].cluster);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        fprintf(fp,"\n\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for(int i=0;i<no_of_clusters;i++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            fprintf(fp,"%d : %Lf, %Lf\n",i,Centroids[i].x,Centroids[i].y);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        fprintf(fp,"\n\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        fclose(fp);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        free(Centroids);
 | 
					 | 
				
			||||||
        free(P);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,6 @@
 | 
				
			||||||
#include "connections.h"
 | 
					#include "connections.h"
 | 
				
			||||||
#include "livechart.h"
 | 
					#include "livechart.h"
 | 
				
			||||||
#include "utility_tools.h"
 | 
					#include "utility_tools.h"
 | 
				
			||||||
#include "Kmeans2.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//  debug
 | 
					//  debug
 | 
				
			||||||
| 
						 | 
					@ -45,17 +44,17 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
        float lat;
 | 
					        float lat;
 | 
				
			||||||
        float lon;
 | 
					        float lon;
 | 
				
			||||||
        loops++;
 | 
					        loops++;
 | 
				
			||||||
        // printf("loops: %d\n", loops);
 | 
					        printf("loops: %d\n", loops);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        id = to_intconvertor(df->idcode);
 | 
					        id = to_intconvertor(df->idcode);
 | 
				
			||||||
        // printf("id = %d\n",id);
 | 
					        printf("id = %d\n",id);
 | 
				
			||||||
        pthread_mutex_lock(&mutex_cfg);
 | 
					        pthread_mutex_lock(&mutex_cfg);
 | 
				
			||||||
        temp_cfg = cfgfirst;
 | 
					        temp_cfg = cfgfirst;
 | 
				
			||||||
        // Check for the IDCODE in Configuration Frame
 | 
					        // Check for the IDCODE in Configuration Frame
 | 
				
			||||||
        while(temp_cfg != NULL){
 | 
					        while(temp_cfg != NULL){
 | 
				
			||||||
            if(id == to_intconvertor(temp_cfg->idcode)){
 | 
					            if(id == to_intconvertor(temp_cfg->idcode)){
 | 
				
			||||||
                cfg_match = 1;
 | 
					                cfg_match = 1;
 | 
				
			||||||
                // printf("Matched - id : %d\n",id);
 | 
					                printf("Matched - id : %d\n",id);
 | 
				
			||||||
                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
					                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
				
			||||||
                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
					                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
				
			||||||
                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
					                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
				
			||||||
| 
						 | 
					@ -70,7 +69,7 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
        // get data from df.
 | 
					        // get data from df.
 | 
				
			||||||
        if(freq_fmt == '1'){
 | 
					        if(freq_fmt == '1'){
 | 
				
			||||||
            freq = decode_ieee_single(df->dpmu[i]->freq);
 | 
					            freq = decode_ieee_single(df->dpmu[i]->freq);
 | 
				
			||||||
            // printf("freq = %f\n",freq);
 | 
					            printf("freq = %f\n",freq);
 | 
				
			||||||
        }else{
 | 
					        }else{
 | 
				
			||||||
            freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
 | 
					            freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -81,15 +80,15 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
        strncpy(last2bytes, df->dpmu[i]->phasors[0]+2, 2);
 | 
					        strncpy(last2bytes, df->dpmu[i]->phasors[0]+2, 2);
 | 
				
			||||||
        vol_magnitude = to_intconvertor(first2bytes);
 | 
					        vol_magnitude = to_intconvertor(first2bytes);
 | 
				
			||||||
        float imaginary = to_intconvertor(last2bytes);
 | 
					        float imaginary = to_intconvertor(last2bytes);
 | 
				
			||||||
        // printf("vol = %f imag = %f\n",vol_magnitude, imaginary);
 | 
					        printf("vol = %f imag = %f\n",vol_magnitude, imaginary);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        vis_ptr = vis_data_head;
 | 
					        vis_ptr = vis_data_head;
 | 
				
			||||||
        match = 0;
 | 
					        match = 0;
 | 
				
			||||||
        while(vis_ptr != NULL){
 | 
					        while(vis_ptr != NULL){
 | 
				
			||||||
            // printf("vis_ptr->id = %d\n",vis_ptr->id);
 | 
					            printf("vis_ptr->id = %d\n",vis_ptr->id);
 | 
				
			||||||
            if(vis_ptr->id == id){
 | 
					            if(vis_ptr->id == id){
 | 
				
			||||||
                match = 1;
 | 
					                match = 1;
 | 
				
			||||||
                // printf("Matched - id : %d\n",id);
 | 
					                printf("Matched - id : %d\n",id);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            vis_ptr = vis_ptr->next;
 | 
					            vis_ptr = vis_ptr->next;
 | 
				
			||||||
| 
						 | 
					@ -103,7 +102,7 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
        live_chart_serie_add(vis_ptr->serie_dfreq, dfreq);
 | 
					        live_chart_serie_add(vis_ptr->serie_dfreq, dfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(match == 1 && cfg_match == 1){
 | 
					        if(match == 1 && cfg_match == 1){
 | 
				
			||||||
            // printf("lat = %f, lon = %f, freq = %f\n",lat,lon,freq);
 | 
					            printf("lat = %f, lon = %f, freq = %f\n",lat,lon,freq);
 | 
				
			||||||
            if(vis_ptr->last_image != 0){
 | 
					            if(vis_ptr->last_image != 0){
 | 
				
			||||||
                osm_gps_map_image_remove(parameters->util_map, vis_ptr->last_image);
 | 
					                osm_gps_map_image_remove(parameters->util_map, vis_ptr->last_image);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -154,7 +153,7 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
                }else if (algorithm==1 && dimmension == 1){
 | 
					                }else if (algorithm==1 && dimmension == 1){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }else if (algorithm==1 && dimmension == 2){
 | 
					                }else if (algorithm==1 && dimmension == 2){
 | 
				
			||||||
                    Kmeans2(df);
 | 
					
 | 
				
			||||||
                }else if (algorithm==2 && dimmension == 0){
 | 
					                }else if (algorithm==2 && dimmension == 0){
 | 
				
			||||||
                    if(!DTWvolDistance(df)){
 | 
					                    if(!DTWvolDistance(df)){
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue