Commit 92239206 authored by jaehyu's avatar jaehyu

devise BLECELL , FLOOR class

parent 9957d43d
......@@ -34,7 +34,7 @@ public class Configure {
public static final double CELL_SIZE_BLE = 300;
public static final double CELL_SIZE_MAG = 50;
public static final double LENGTH_X = 6000;
public static final double LENGTH_Y = 6000;
public static final double LENGTH_X = 3500; // 층의 X축방향 길이
public static final double WIDTH_Y = 2000; // 폭
}
......@@ -4,14 +4,96 @@ package com.skt.ehs.mbs.fpbuilder;
* Created by user on 2016-11-30.
*/
public class BLECell {
int cell_id;
int ble_cell_id;
double location_x, location_y; // 실거리 ??
double rssi_min, rssi_max, rssi_avg, rssi_std_dev;
int rssi_dir;
double magnitude_angle; // 해당 cell의 각 수집방향에 대하여 수집된 지자기방향의 평균값으로 대표
public int getCell_id() {
return cell_id;
public int getBle_cell_id() {
return ble_cell_id;
}
public void setCell_id(int cell_id) {
this.cell_id = cell_id;
public void setBle_cell_id(int ble_cell_id) {
this.ble_cell_id = ble_cell_id;
}
public double getLocation_x() {
return location_x;
}
public void setLocation_x(double location_x) {
this.location_x = location_x;
}
public double getLocation_y() {
return location_y;
}
public void setLocation_y(double location_y) {
this.location_y = location_y;
}
public double getRssi_min() {
return rssi_min;
}
public void setRssi_min(double rssi_min) {
this.rssi_min = rssi_min;
}
public double getRssi_max() {
return rssi_max;
}
public void setRssi_max(double rssi_max) {
this.rssi_max = rssi_max;
}
public double getRssi_avg() {
return rssi_avg;
}
public void setRssi_avg(double rssi_avg) {
this.rssi_avg = rssi_avg;
}
public double getRssi_std_dev() {
return rssi_std_dev;
}
public void setRssi_std_dev(double rssi_std_dev) {
this.rssi_std_dev = rssi_std_dev;
}
public int getRssi_dir() {
return rssi_dir;
}
public void setRssi_dir(int rssi_dir) {
this.rssi_dir = rssi_dir;
}
public double getMagnitude_angle() {
return magnitude_angle;
}
public void setMagnitude_angle(double magnitude_angle) {
this.magnitude_angle = magnitude_angle;
}
@Override
public String toString() {
return "BLECell{" +
"ble_cell_id=" + ble_cell_id +
", location_x=" + location_x +
", location_y=" + location_y +
", rssi_min=" + rssi_min +
", rssi_max=" + rssi_max +
", rssi_avg=" + rssi_avg +
", rssi_std_dev=" + rssi_std_dev +
", rssi_dir=" + rssi_dir +
", magnitude_angle=" + magnitude_angle +
'}';
}
//
}
......@@ -29,33 +29,48 @@ public class BLEFPBuilder {
return false;
}
/* Todo
층(floor) 단면에 대하여 x축방향 길이 (Configure.LENGTH_X) 와
폭 (Configure.WIDTH_Y) 을 성분으로 하는 가상 Matrix를 구성한다.
void genCell() {
int xmax = (int) (Configure.LENGTH_X / Configure.CELL_SIZE_BLE);
int ymax = (int) (Configure.LENGTH_Y / Configure.CELL_SIZE_BLE);
*/
void genCells() {
System.out.println( "X : "+xmax+" Y : "+ymax);
if (((int)Configure.LENGTH_X % (int)Configure.CELL_SIZE_BLE) != 0 ) xmax++;
if (((int)Configure.LENGTH_Y % (int)Configure.CELL_SIZE_BLE) != 0 ) ymax++;
// compose ble-cell-matrix
int M = (int) (Configure.LENGTH_X / Configure.CELL_SIZE_BLE);
int N = (int) (Configure.WIDTH_Y / Configure.CELL_SIZE_BLE);
System.out.println( "X : "+M+" Y : "+N);
if (((int)Configure.LENGTH_X % (int)Configure.CELL_SIZE_BLE) != 0 ) M++;
if (((int)Configure.WIDTH_Y % (int)Configure.CELL_SIZE_BLE) != 0 ) N++;
System.out.println( "M : "+M+" N : "+N);
int[][] ble_cell_ids = new int[M][N];
CellMatrix cells = new CellMatrix(ble_cell_ids);
cells.show();
List<BLECell> ble_cells = new ArrayList<>();
for (int x = 1; x <= xmax; x++) {
for (int x = 1; x <= M; x++) {
int idx = 0;
int id = 0;
int id_x = 1000 * x;
for (int y = 1; y <= ymax; y++) {
for (int y = 1; y <= N; y++) {
id = id_x + y;
BLECell next = new BLECell();
next.setCell_id(id);
next.setBle_cell_id(id);
ble_cells.add(next);
}
}
Iterator<BLECell> iter = ble_cells.iterator();
while (iter.hasNext()) System.out.println(iter.next().getCell_id());
//while (iter.hasNext()) System.out.println(iter.next().getCell_id());
System.out.println(ble_cells.size());
}
......@@ -91,7 +106,7 @@ public class BLEFPBuilder {
public static void main(String[] args) {
BLEFPBuilder b = new BLEFPBuilder();
b.genCell();
b.genCells();
processor();
}
......
......@@ -3,7 +3,7 @@ package com.skt.ehs.mbs.fpbuilder;
/**
* Created by user on 2016-11-30.
*/
final public class CellMatrix {
public class CellMatrix {
private final int M; // number of rows
private final int N; // number of columns
private int[][] cell_ids = null;
......@@ -15,6 +15,28 @@ final public class CellMatrix {
cell_ids = new int[M][N];
}
// create Matrix using parameterized Matrix
public CellMatrix(int[][] data) {
M = data.length;
N = data[0].length;
this.cell_ids = new int[M][N];
for(int i = 0; i<M; i++)
for(int j = 0; j < N; j++)
this.cell_ids[i][j] = data[i][j];
}
public int getElement (int x, int y) {
return this.cell_ids[x][y];
}
// print matrix
public void show() {
for(int i=0;i<M;i++) {
for(int j=0;j< N; j++) {
System.out.printf("%9d ", cell_ids[i][j]);
}
System.out.println();
}
}
}
package com.skt.ehs.mbs.fpbuilder;
/**
* Created by user on 2016-12-01.
* 층을 가상 Matrix 로 구성하고,
* Matrix의 각 element는 값으로 BLECell 타입의 Object를 가지게 된다
*/
public class Floor extends CellMatrix {
public Floor(int M, int N) {
super(M, N);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment