'''
Created on Nov 2, 2011
Modified on May 11, 2011
@version: 0.11
@author: Dilum Bandara
@email: dilumb@engr.colostate.edu
@license: Apache License v2.0

   Copyright 2012 H. M. N. Dilum Bandara and Anura P. Jayasumana, Colorado State
   University

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
'''

import math
from Location import Location

CACHING_POLICY = 'oldest' #oldest, LRU, LFU 
PIT_TIMEOUT = 120 #PIT timeout in seconds
SIZE_CS = 10 * math.pow(2, 20) #Capacity of content store
SIZE_PIT = 0
SIZE_FIB = 0

NUM_RADARS_X = 8 #Number of radars along X-axis
NUM_RADARS_Y = 4 #Number of radars along y-axis
RADAR_RANGE = 40000.0 #Radar range (float value)
INTER_RADAR_DIST = 30000.0 #Gap X & Y between 2 radars (float value)
RADAR_SKEW = 30 #Max time difference between 2 radars' data generation
RADAR_HEARTBEAT = 30 #Radar heart beat
#Size of 2d-torus - only consider inner coverage of boundary radars
#Size is from (0,0) to (SIZE_TORUS_X, SIZE_TORUS_Y)   
SIZE_TORUS = Location((NUM_RADARS_X - 1) *  INTER_RADAR_DIST,\
                      (NUM_RADARS_Y - 1) *  INTER_RADAR_DIST)
#Number of data fusion groups
NUM_DF_GROUPS = (int(math.ceil((SIZE_TORUS.x - 2.0 * INTER_RADAR_DIST)\
                        /(3.0 * INTER_RADAR_DIST))) + 1) *\
                        (int(math.ceil((SIZE_TORUS.y - 2.0 * INTER_RADAR_DIST)\
                        /(3.0 * INTER_RADAR_DIST))) + 1)

NUM_APP_IN_SUB_DFS = 2 #Number of apps in subset of data fusion groups
NUM_APP_PROXIES = 4
APPS_IN_ALL_DFS = ['REFL', 'DDOP'] #Aps in all data fusion groups
APPS_IN_SUB_DFS = ['QPE', 'NBRR', 'NCAS'] #Apps in subset of data fusion groups
TILE_X_PROXY = 3000 #Number of pixels per tile along x-axis (at proxy level)
TILE_Y_PROXY = 3000 #Number of pixels per tile along y-axis
TILE_X_RADAR = 500 #Number of pixels per tile along x-axis (at radar level)
TILE_Y_RADAR = 500 #Number of pixels per tile along y-axis
JOIN_DELAY = 0.5 #Delay between 2 nodes that join
ADD_RADAR_TO_OVERLAY = False
SIM_TIME_AFTER_LAST_QUERY = 150 #After what time should simulator be stopped
TIME_INFORM_NEIGHBORS = JOIN_DELAY * (NUM_RADARS_X * NUM_RADARS_Y + NUM_DF_GROUPS\
                            * len(APPS_IN_ALL_DFS) + NUM_APP_IN_SUB_DFS\
                             * len(APPS_IN_SUB_DFS) + NUM_APP_PROXIES) + 20

BANDWIDTH = math.pow(10, 9)
#PPI_DATA_SIZE = 160 * math.pow(2, 20) #160MB - PPI data scan size in bytes
#PIXEL_SIZE = 100 * 100 #pixel size in meters
#PIXEL_DATA_SIZE = (PPI_DATA_SIZE * PIXEL_SIZE)/(math.pi * RADAR_RANGE * RADAR_RANGE)
PIXEL_DATA_SIZE = 100 # 4 * 25 
USE_SUBSCRIPTIONS = True #Use query subscriptions
FIRST_QUERY = 300 #When will the first query arrive
#Subscriptions expires time. If subset of queries are send for speed up. Else
#Should be greater than the time of last query + SIM_TIME_AFTER_LAST_QUERY 
SUB_EXPIRE_TIME = 720
STAT_COLLECTION_INTERVAL = 30 #When to collect statistics
SPEED_LIGHT = 299792458
QUERY_FILE = 'queries.txt' #Query file name
RESULTS_FILE = 'results.txt'
