diff options
author | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2021-08-05 08:50:16 +0200 |
---|---|---|
committer | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2021-08-05 08:50:16 +0200 |
commit | 3ba5eb125ac8890968e4437b098e39195d699434 (patch) | |
tree | ac58a39013fc9ab2cd468da83e4c41cd2d62b600 /sdnr/wt/odlux/apps/linkCalculationApp/src | |
parent | 437f67407aece6f7aed8e989638b0d64075f0c0a (diff) |
Update ODLUX
Add LineOfSightApp, update Framework, Connect, Performance and LinkCalculatorApp
Issue-ID: CCSDK-3417
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: I651a2fb771d2963aea70f916c70c8fdfd3443e87
Diffstat (limited to 'sdnr/wt/odlux/apps/linkCalculationApp/src')
5 files changed, 187 insertions, 145 deletions
diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts b/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts index 0849058dc..d499ec209 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts @@ -116,60 +116,45 @@ export class UpdateWorstMonthRainAction extends Action { } } -export class UpdateEIRPAction extends Action { - constructor(public eirpA: number,public eirpB: number) { + +export class UpdateAntennaGainAction extends Action { + constructor(public antennaGainA: number, public antennaGainB: number) { super(); } } -export class UpdateAntennaGainAction extends Action { - constructor(public antennaGainList: string[]) { +export class updateAntennaNameAction extends Action { + constructor(public antennaNameA: string, public antennaNameB: string) { super(); } } -export class UpdateAntennaListAction extends Action { - constructor(public antennaList: string[]) { +export class UpdateTxPowerAction extends Action { + constructor(public txPowerA: string | null, public txPowerB: string | null) { super(); } } -export class UpdateAntennaAction extends Action { - constructor(public antennaA: string | null, public antennaB : string | null) { +export class UpdateRxSensitivityAction extends Action { + constructor(public rxSensitivityA: string | null, public rxSensitivityB: string | null) { super(); } } -export class UpdateRadioAttributesAction extends Action { - constructor(public som: number , public eirpA : number, public eirpB : number) { +export class UpdateWaveguideLossAction extends Action { + constructor(public waveguideLossA: number, public waveguideLossB: number) { super(); } } -export class UpdateTxPowerAction extends Action { - constructor(public txPowerA: string | null , public txPowerB : string | null) { + +export class UpdateEIRPAction extends Action { + constructor(public eirpA: number, public eirpB: number) { super(); } } -export class UpdateRxSensitivityAction extends Action { - constructor(public rxSensitivityA: string | null , public rxSensitivityB : string | null) { +export class UpdateRxPowerAction extends Action { + constructor(public rxPowerA: number, public rxPowerB: number) { super(); } } - - -export const updateAntennaList = (frequency: number) => async (dispatcher: Dispatch, getState: () => IApplicationStoreState) => { - let antennaList: string[] = [] - let antennaDiameterList: string[] = [] - let antennaGainList :string[] =[] - //switch case here frequency = 26? antennaList.push - switch (frequency) { - case 7: antennaList.push('ANDREW VHLPX2.5-7W', 'ANDREW VHLPX3-7W', 'ANDREW VHLPX4-7W', 'ANDREW VHLPX6-7W' ), antennaDiameterList.push('0.6','0.9','1.2','1.8'), antennaGainList.push('33.90','35.50','37.30','40.61'); break - case 11: antennaList.push('ANDREW VHLPX2-11W', 'ANDREW VHLPX3-11W', 'ANDREW VHLPX4-11W'), antennaDiameterList.push('0.6','0.9','1.2'), antennaGainList.push('34.50','38.4','40.70');break - case 15: antennaList.push('ANDREW VHLPX1-15', 'ANDREW VHLPX2-15', 'ANDREW VHLPX3-15', 'ANDREW VHLPX4-15'), antennaDiameterList.push('0.3','0.6','0.9','1.2'), antennaGainList.push('32.00','36.80','41.11','42.90');break - case 23: antennaList.push('ANDREW VHLPX1-23', 'ANDREW VHLPX2-23', 'ANDREW VHLPX3-23', 'ANDREW VHLPX4-23'), antennaDiameterList.push('0.3','0.6','0.9','1.2'), antennaGainList.push('35.30','40.21','44.80','46.71');break - case 26: antennaList.push('ANDREW VHLPX1-26', 'ANDREW VHLPX2-26', 'ANDREW VHLPX3-26'), antennaDiameterList.push('0.3','0.6','0.9'), antennaGainList.push('36.61','40.21','41.21','45.80');break - case 28: antennaList.push('ANDREW VHLPX1-28', 'ANDREW VHLPX2-28'), antennaDiameterList.push('0.3','0.6'), antennaGainList.push('38.11','42.21');break - case 38: antennaList.push('ANDREW VHLPX1-38', 'ANDREW VHLPX2-38'), antennaDiameterList.push('0.3','0.6'), antennaGainList.push('40.11','45.21');break - case 42: antennaList.push('ANDREW VHLPX1-42-XXX/D', 'ANDREW VHLPX2-42-XXX/A'), antennaDiameterList.push('0.3','0.6'), antennaGainList.push('40.80','46.00');break - case 80: antennaList.push('Radio Waves HPCPE-80', 'Radio Waves HPLP2-80'), antennaDiameterList.push('0.3','0.6'), antennaGainList.push('43.80','50.80');break - } - dispatcher(new UpdateAntennaListAction(antennaList)) - dispatcher(new UpdateAntennaGainAction(antennaGainList)) +export class UpdateSomAction extends Action { + constructor(public somA: number, public somB:number) { + super(); + } } - diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts b/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts index edfad052a..01512eb92 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts @@ -21,7 +21,7 @@ import { combineActionHandler } from '../../../../framework/src/flux/middleware' // ** do not remove ** import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import { IActionHandler } from '../../../../framework/src/flux/action';; -import { UpdateLinkIdAction, UpdateFrequencyAction , UpdateLatLonAction, UpdateRainAttAction, UpdateRainValAction, updateHideForm, UpdateFslCalculation, UpdateSiteAction, UpdateDistanceAction, isCalculationServerReachableAction, UpdatePolAction, updateAltitudeAction, UpdateAbsorptionLossAction, UpdateWorstMonthRainAction, UpdateEIRPAction, UpdateAntennaAction, UpdateAntennaListAction, UpdateAntennaGainAction, UpdateTxPowerAction, UpdateRxSensitivityAction} from '../actions/commonLinkCalculationActions'; +import { UpdateLinkIdAction, UpdateFrequencyAction , UpdateLatLonAction, UpdateRainAttAction, UpdateRainValAction, updateHideForm, UpdateFslCalculation, UpdateSiteAction, UpdateDistanceAction, isCalculationServerReachableAction, UpdatePolAction, updateAltitudeAction, UpdateAbsorptionLossAction, UpdateWorstMonthRainAction, UpdateEIRPAction, UpdateAntennaGainAction, UpdateTxPowerAction, UpdateRxSensitivityAction, updateAntennaNameAction, UpdateWaveguideLossAction, UpdateRxPowerAction, UpdateSomAction} from '../actions/commonLinkCalculationActions'; declare module '../../../../framework/src/store/applicationStore' { interface IApplicationStoreState { @@ -60,15 +60,18 @@ export type ILinkCalculationAppStateState= { eirpB: number, antennaGainA: number, antennaGainB :number, - antennaList:string[], - antennaGainList:string[], - antennaA: string, - antennaB:string, - systemOperatingMargin : number, + antennaNameA: string, + antennaNameB:string, + systemOperatingMarginA : number, + systemOperatingMarginB : number, txPowerA : string, txPowerB: string, rxSensitivityA : string, - rxSensitivityB: string + rxSensitivityB: string, + waveguideLossA : number, + waveguideLossB: number, + rxPowerA :number, + rxPowerB: number } const initialState: ILinkCalculationAppStateState ={ @@ -98,19 +101,20 @@ const initialState: ILinkCalculationAppStateState ={ eirpB: 0, antennaGainA :0, antennaGainB :0, - antennaList:[], - antennaGainList:[], - antennaA: '0', - antennaB:'0', - systemOperatingMargin : 0, + antennaNameA: '', + antennaNameB:'', + systemOperatingMarginA : 0, + systemOperatingMarginB : 0, txPowerA : '0', txPowerB: '0', rxSensitivityA: '0', - rxSensitivityB: '0' + rxSensitivityB: '0', + waveguideLossA : 0, + waveguideLossB: 0, + rxPowerA : 0, + rxPowerB: 0 } - - export const LinkCalculationHandler: IActionHandler<ILinkCalculationAppStateState> = (state=initialState, action) => { if(action instanceof UpdateLinkIdAction){ @@ -156,17 +160,12 @@ export const LinkCalculationHandler: IActionHandler<ILinkCalculationAppStateStat else if (action instanceof UpdateWorstMonthRainAction){ state = Object.assign({}, state, {month:action.month}) } - else if (action instanceof UpdateEIRPAction){ - state = Object.assign({}, state, {eirpA:action.eirpA, eirpB:action.eirpB}) - } + else if (action instanceof UpdateAntennaGainAction){ - state = Object.assign({}, state, {antennaGainList:action.antennaGainList}) - } - else if (action instanceof UpdateAntennaListAction){ - state = Object.assign({}, state, {antennaList:action.antennaList}) + state = Object.assign({}, state, {antennaGainA:action.antennaGainA,antennaGainB:action.antennaGainB}) } - else if (action instanceof UpdateAntennaAction){ - state = Object.assign({}, state, {antennaA:action.antennaA == null ? state.antennaA : action.antennaA , antennaB: action.antennaB == null? state.antennaB : action.antennaB}) + else if (action instanceof updateAntennaNameAction){ + state = Object.assign({}, state, {antennaNameA:action.antennaNameA, antennaNameB: action.antennaNameB}) } else if (action instanceof UpdateTxPowerAction){ state = Object.assign({}, state, {txPowerA:action.txPowerA == null ? state.txPowerA : action.txPowerA , txPowerB: action.txPowerB == null? state.txPowerB : action.txPowerB}) @@ -174,6 +173,19 @@ export const LinkCalculationHandler: IActionHandler<ILinkCalculationAppStateStat else if (action instanceof UpdateRxSensitivityAction){ state = Object.assign({}, state, {rxSensitivityA:action.rxSensitivityA == null ? state.rxSensitivityA : action.rxSensitivityA , rxSensitivityB: action.rxSensitivityB == null? state.rxSensitivityB : action.rxSensitivityB}) } + else if (action instanceof UpdateWaveguideLossAction){ + state = Object.assign({}, state, {waveguideLossA:action.waveguideLossA, waveguideLossB: action.waveguideLossB}) + } + else if (action instanceof UpdateEIRPAction){ + state = Object.assign({}, state, {eirpA:action.eirpA, eirpB:action.eirpB}) + } + else if (action instanceof UpdateRxPowerAction){ + state = Object.assign({}, state, {rxPowerA:action.rxPowerA, rxPowerB:action.rxPowerB}) + } + else if (action instanceof UpdateSomAction){ + state = Object.assign({}, state, {systemOperatingMarginA:action.somA , systemOperatingMarginB :action.somB}) + } + return state } diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/index.html b/sdnr/wt/odlux/apps/linkCalculationApp/src/index.html index 2023ae365..edcbd2514 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/index.html +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/index.html @@ -15,10 +15,11 @@ <script type="text/javascript" src="./config.js"></script> <script> // run the application - require(["app","connectApp", "linkCalculationApp", "networkMapApp"], function (app, connectApp, linkCalculationApp,networkMapApp) { + require(["app","connectApp", "linkCalculationApp", "networkMapApp" , "lineOfSightApp"], function (app, connectApp, linkCalculationApp,networkMapApp, lineOfSightApp) { connectApp.register(); linkCalculationApp.register(); networkMapApp.register(); + lineOfSightApp.register(); app("./app.tsx").runApplication(); }); </script> diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/pluginLinkCalculation.tsx b/sdnr/wt/odlux/apps/linkCalculationApp/src/pluginLinkCalculation.tsx index f86b22a5c..a15bf033d 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/pluginLinkCalculation.tsx +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/pluginLinkCalculation.tsx @@ -24,11 +24,11 @@ import { withRouter, RouteComponentProps, Route, Switch, Redirect } from 'react- import { faBookOpen } from '@fortawesome/free-solid-svg-icons'; // select app icon import applicationManager from '../../../framework/src/services/applicationManager'; -import LinkCalculation from './views/linkCalculationComponent'; +import LinkCalculation from './views/linkCalculationComponent'; import LinkCalculationAppRootHandler from './handlers/linkCalculationAppRootHandler'; import connect, { Connect, IDispatcher } from '../../../framework/src/flux/connect'; import { IApplicationStoreState } from "../../../framework/src/store/applicationStore"; -import { UpdateLinkIdAction, UpdateLatLonAction, updateHideForm, UpdateSiteAction, UpdateDistanceAction, isCalculationServerReachableAction, updateAltitudeAction } from "./actions/commonLinkCalculationActions"; +import { UpdateLinkIdAction, UpdateLatLonAction, updateHideForm, UpdateSiteAction, UpdateDistanceAction, isCalculationServerReachableAction, updateAltitudeAction, updateAntennaNameAction, UpdateAntennaGainAction, UpdateWaveguideLossAction } from "./actions/commonLinkCalculationActions"; let currentLinkId: string | null = null; @@ -41,23 +41,29 @@ const mapProps = (state: IApplicationStoreState) => ({ const mapDisp = (dispatcher: IDispatcher) => ({ updateLinkId: (mountId: string) => dispatcher.dispatch(new UpdateLinkIdAction(mountId)), - updateSiteName: (siteNameA?:any, siteNameB?:any)=>{ + updateSiteName: (siteNameA?: any, siteNameB?: any) => { dispatcher.dispatch(new UpdateSiteAction(siteNameA, siteNameB)) }, - updateDistance :(distance:number) =>{ + updateDistance: (distance: number) => { dispatcher.dispatch(new UpdateDistanceAction(distance)) }, - updateLatLon : (Lat1:number, Lon1:number, Lat2:number, Lon2:number)=> { + updateLatLon: (Lat1: number, Lon1: number, Lat2: number, Lon2: number) => { dispatcher.dispatch(new UpdateLatLonAction(Lat1, Lon1, Lat2, Lon2)) - dispatcher.dispatch(new updateHideForm (true)) + dispatcher.dispatch(new updateHideForm(true)) }, - updateAltitude : (amslA:number, aglA:number, amslB:number, aglB:number) => { - dispatcher.dispatch(new updateAltitudeAction(amslA,aglA,amslB,aglB)) + updateAltitude: (amslA: number, aglA: number, amslB: number, aglB: number) => { + dispatcher.dispatch(new updateAltitudeAction(amslA, aglA, amslB, aglB)) + }, + updateAntennaName: (antennaNameA: string, antennaNameB: string) => { + dispatcher.dispatch(new updateAntennaNameAction(antennaNameA, antennaNameB)) + }, + updateAntennaGainAction: (antennaGainA: number, antennaGainB: number) => { + dispatcher.dispatch(new UpdateAntennaGainAction(antennaGainA, antennaGainB)) + }, + updateWaveguideLossAction: (waveguideLossA: number, waveguideLossB: number) => { + dispatcher.dispatch(new UpdateWaveguideLossAction(waveguideLossA, waveguideLossB)) } - // UpdateConectivity : (reachable:boolean) => { - // dispatcher.dispatch (new isCalculationServerReachableAction (reachable)) - // } }); @@ -70,45 +76,68 @@ const LinkCalculationRouteAdapter = connect(mapProps, mapDisp)((props: RouteComp lastUrl = props.location.pathname; linkId = getLinkId(lastUrl); - const data= props.location.search + const data = props.location.search + - - if (data !== undefined && data.length>0){ + if (data !== undefined && data.length > 0) { - - const lat1 = data.split('&')[0].split('=')[1] - const lon1 = data.split('&')[1].split('=')[1] - const lat2 = data.split('&')[2].split('=')[1] - const lon2 = data.split('&')[3].split('=')[1] - const siteNameA = data.split('&')[4].split('=')[1] - const siteNameB = data.split('&')[5].split('=')[1] + const lat1 = data.split('&')[0].split('=')[1] + const lon1 = data.split('&')[1].split('=')[1] + const lat2 = data.split('&')[2].split('=')[1] + const lon2 = data.split('&')[3].split('=')[1] - const distance = data.split('&')[8].split('=')[1] + const siteNameA = data.split('&')[4].split('=')[1] + const siteNameB = data.split('&')[5].split('=')[1] - const amslA = data.split('&')[9].split('=')[1] - const aglA = data.split('&')[10].split('=')[1] + const distance = data.split('&')[8].split('=')[1] - const amslB = data.split('&')[11].split('=')[1] - const aglB = data.split('&')[12].split('=')[1] + const amslA = data.split('&')[9].split('=')[1] + const aglA = data.split('&')[10].split('=')[1] + const amslB = data.split('&')[11].split('=')[1] + const aglB = data.split('&')[12].split('=')[1] - props.updateSiteName(String(siteNameA), String(siteNameB)) + const antennaNameA = data.split('&')[13].split('=')[1].replace("%20", " ") + const antennaGainA = data.split('&')[14].split('=')[1] + const waveguideLossA = data.split('&')[15].split('=')[1] + const antennaNameB = data.split('&')[16].split('=')[1].replace("%20", " ") + const antennaGainB = data.split('&')[17].split('=')[1] + const waveguideLossB = data.split('&')[18].split('=')[1] - props.updateDistance(Number(distance)) - props.updateLatLon(Number(lat1),Number(lon1),Number(lat2),Number(lon2)) + if (siteNameA !== null && siteNameB !== null) { + props.updateSiteName(String(siteNameA), String(siteNameB)) + } - props.updateAltitude (Number(amslA), Number(aglA), Number(amslB), Number(aglB)) - + if (Number(distance) !== null) { + props.updateDistance(Number(distance)) + } + if (Number(lat1) >= -90 && Number(lat2) >= -90 && Number(lat1) <= 90 && Number(lat2) <= 90 && Number(lon1) >= -180 && Number(lon2) >= -180 && Number(lon1) <= 180 && Number(lon2) <= 180) { + props.updateLatLon(Number(lat1), Number(lon1), Number(lat2), Number(lon2)) + } + if (Number(amslA)> 0 && Number(amslB)> 0) { + if (Number(aglA)>= Number(amslA) && Number(aglB)>= Number(amslB)) { + props.updateAltitude(Number(amslA), Number(aglA), Number(amslB), Number(aglB)) + } + } + if (antennaNameA && antennaNameB.length) { + props.updateAntennaName(String(antennaNameA), String(antennaNameB)) + } + if (Number(antennaGainA) > 0 && Number(antennaGainA) > 0) { + props.updateAntennaGainAction(Number(antennaGainA), Number(antennaGainB)) + } + if(Number(waveguideLossA) !== null, Number(waveguideLossB) !== null){ + props.updateWaveguideLossAction(Number(waveguideLossA),Number(waveguideLossB) ) + } } - + if (currentLinkId !== linkId) { // new element is loaded currentLinkId = linkId; props.updateLinkId(currentLinkId); - } + } }, []); // called when component gets updated @@ -126,7 +155,7 @@ const LinkCalculationRouteAdapter = connect(mapProps, mapDisp)((props: RouteComp const getLinkId = (lastUrl: string) => { let index = lastUrl.lastIndexOf("linkCalculation/"); if (index >= 0) { - linkId = lastUrl.substr(index+16); + linkId = lastUrl.substr(index + 16); } else { linkId = ""; } @@ -134,7 +163,7 @@ const LinkCalculationRouteAdapter = connect(mapProps, mapDisp)((props: RouteComp return linkId; } - + return ( <LinkCalculation /> ); diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx b/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx index 063926269..e3eaa6ba0 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx @@ -24,7 +24,7 @@ import { TextField, Tabs, Tab, Typography, AppBar, Button, Tooltip, Checkbox, Ta import './Style.scss' import { IApplicationStoreState } from "../../../../framework/src/store/applicationStore"; -import { UpdateFrequencyAction, UpdateLatLonAction, UpdateRainAttAction, UpdateRainValAction, UpdateFslCalculation, isCalculationServerReachableAction, UpdatePolAction, UpdateDistanceAction, updateAltitudeAction, UpdateAbsorptionLossAction, UpdateWorstMonthRainAction, updateAntennaList, UpdateAntennaAction, UpdateRadioAttributesAction, UpdateTxPowerAction, UpdateRxSensitivityAction } from "../actions/commonLinkCalculationActions"; +import { UpdateFrequencyAction, UpdateLatLonAction, UpdateRainAttAction, UpdateRainValAction, UpdateFslCalculation, isCalculationServerReachableAction, UpdatePolAction, UpdateDistanceAction, updateAltitudeAction, UpdateAbsorptionLossAction, UpdateWorstMonthRainAction, UpdateTxPowerAction, UpdateRxSensitivityAction, UpdateEIRPAction, UpdateRxPowerAction, UpdateSomAction } from "../actions/commonLinkCalculationActions"; import { faPlaneArrival, faAlignCenter } from "@fortawesome/free-solid-svg-icons"; import ConnectionInfo from '../components/connectionInfo' import { red } from "@material-ui/core/colors"; @@ -55,15 +55,22 @@ const mapProps = (state: IApplicationStoreState) => ({ absorptionOxygen: state.linkCalculation.calculations.absorptionOxygen, absorptionWater: state.linkCalculation.calculations.absorptionWater, month: state.linkCalculation.calculations.month, - eirpSiteA: state.linkCalculation.calculations.eirpA, - eirpSiteB: state.linkCalculation.calculations.eirpB, + eirpA: state.linkCalculation.calculations.eirpA, + eirpB: state.linkCalculation.calculations.eirpB, antennaGainA: state.linkCalculation.calculations.antennaGainA, antennaGainB: state.linkCalculation.calculations.antennaGainB, - antennaList: state.linkCalculation.calculations.antennaList, - antennaGainList: state.linkCalculation.calculations.antennaGainList, - antennaA: state.linkCalculation.calculations.antennaA, - antennaB: state.linkCalculation.calculations.antennaB, - systemOperatingMargin : state.linkCalculation.calculations.systemOperatingMargin + antennaNameA: state.linkCalculation.calculations.antennaNameA, + antennaNameB: state.linkCalculation.calculations.antennaNameB, + systemOperatingMarginA: state.linkCalculation.calculations.systemOperatingMarginA, + systemOperatingMarginB: state.linkCalculation.calculations.systemOperatingMarginB, + waveguideLossA: state.linkCalculation.calculations.waveguideLossA, + waveguideLossB: state.linkCalculation.calculations.waveguideLossB, + rxPowerA: state.linkCalculation.calculations.rxPowerA, + rxPowerB: state.linkCalculation.calculations.rxPowerB, + txPowerA: state.linkCalculation.calculations.txPowerA, + txPowerB: state.linkCalculation.calculations.txPowerB, + rxSensitivityA: state.linkCalculation.calculations.rxSensitivityA, + rxSensitivityB: state.linkCalculation.calculations.rxSensitivityB }); @@ -74,7 +81,6 @@ const mapDispatch = (dispatcher: IDispatcher) => ({ updateFrequency: (frequency: number) => { dispatcher.dispatch(new UpdateFrequencyAction(frequency)) - dispatcher.dispatch(updateAntennaList(frequency)) }, updateLatLon: (Lat1: number, Lon1: number, Lat2: number, Lon2: number) => { dispatcher.dispatch(new UpdateLatLonAction(Lat1, Lon1, Lat2, Lon2)) @@ -114,16 +120,20 @@ const mapDispatch = (dispatcher: IDispatcher) => ({ UpdateWorstMonthRain: (month: string) => { dispatcher.dispatch(new UpdateWorstMonthRainAction(month)) }, - UpdateAntenas: (antennaA: string | null, antennaB: string | null) => { - dispatcher.dispatch(new UpdateAntennaAction(antennaA, antennaB)) + UpdateEIRP: (eirpA: number, eirpB: number) => { + dispatcher.dispatch(new UpdateEIRPAction(eirpA, eirpB)) }, - UpdateRadioAttributes :(som: number, eirpA: number, eirpB: number)=>{ - dispatcher.dispatch(new UpdateRadioAttributesAction(som,eirpA, eirpB)) + UpdateRxPower: (rxPowerA: number, rxPowerB: number) => { + dispatcher.dispatch(new UpdateRxPowerAction(rxPowerA, rxPowerB)) }, - UpdateTxPower :(txPowerA: string | null, txPowerB: string | null)=>{ + UpdateSom: (somA: number, somB: number) => { + dispatcher.dispatch(new UpdateSomAction(somA, somB)) + }, + + UpdateTxPower: (txPowerA: string | null, txPowerB: string | null) => { dispatcher.dispatch(new UpdateTxPowerAction(txPowerA, txPowerB)) - }, - UpdateRxSensitivity :(rxSensitivityA : string | null, rxSensitivityB : string | null)=>{ + }, + UpdateRxSensitivity: (rxSensitivityA: string | null, rxSensitivityB: string | null) => { dispatcher.dispatch(new UpdateRxSensitivityAction(rxSensitivityA, rxSensitivityB)) } }); @@ -145,6 +155,7 @@ interface initialState { attenuationMethodError: string, worstmonth: boolean, showWM: string, + rainMethodErrorState: string } class LinkCalculation extends React.Component<linkCalculationProps, initialState> { @@ -164,6 +175,7 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState antennaTypeError: '', worstmonth: false, showWM: '', + rainMethodErrorState: '0' }; } @@ -246,10 +258,10 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState } } - linkBudget = (antennaA: string, antennaB: string, transmissionPowerA: number, transmissionPowerB: number) => { - fetch(BASE_URL + '/linkbudget/' + antennaA + '/' + antennaB + '/' + transmissionPowerA + '/' + transmissionPowerB) - .then(res=>res.json()) - .then(result => {this.props.UpdateRadioAttributes(result.systemOperatingMargin, result.eirpA, result.eirpB)}) + linkBudget = (lat1: number, lon1: number, lat2: number, lon2: number, distance: number, frequency: number, absorptionMethod: string, polarization: string, antennaGainA: number, antennaGainB: number, waveguideLossA: number, waveguideLossB: number, transmissionPowerA: number, transmissionPowerB: number, rxSensitivityA: number, rxSensitivityB: number) => { + fetch(BASE_URL + '/linkbudget/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' + absorptionMethod + '/' + polarization.toUpperCase() + '/' + antennaGainA + '/' + antennaGainB + '/' + waveguideLossA + '/' + waveguideLossB + '/' + transmissionPowerA + '/' + transmissionPowerB + '/' + rxSensitivityA + '/' + rxSensitivityB) + .then(res => res.json()) + .then(result => { this.props.UpdateEIRP(result.eirpA, result.eirpB); this.props.UpdateRxPower(result.receivedPowerA, result.receivedPowerB); this.props.UpdateSom(result.systemOperatingMarginA, result.systemOperatingMarginA) }) } formValid = () => { @@ -260,7 +272,10 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState this.props.lon2 === 0 ? this.setState({ longitude2Error: 'Enter a number between -180 to 180' }) : null this.props.frequency === 0 ? this.setState({ frequencyError: 'Select a frequency' }) : this.setState({ frequencyError: '' }) - this.state.rainMethodDisplay === null && this.props.rainVal === 0 ? this.setState({ rainMethodError: 'Select the rain method' }) : this.setState({ rainMethodError: '' }) + // this.state.rainMethodDisplay === null && this.props.rainVal === 0 ? this.setState({ rainMethodError: 'Select the rain method' }) : this.setState({ rainMethodError: '' }) + + this.state.rainMethodErrorState === '0' ? this.setState({ rainMethodError: 'Select the rain method' }) : this.setState({ rainMethodError: '' }) + this.state.absorptionMethod === '0' ? this.setState({ attenuationMethodError: 'Select the attenuation method' }) : this.setState({ attenuationMethodError: '' }) console.log(this.state); console.log(this.props.lat1 !== 0 && this.props.lat2 !== 0 && this.props.lon1 !== 0 && this.props.lon2 !== 0 && this.props.frequency !== 0 && this.state.rainMethodError === '' && this.state.attenuationMethodError === ''); @@ -282,21 +297,18 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState this.setState({ showWM: ' ' }) this.props.UpdateWorstMonthRain('') this.AbsorptionAtt(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.props.distance, this.props.frequency, this.state.worstmonth, this.state.absorptionMethod) + this.linkBudget(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.props.distance, this.props.frequency, this.state.absorptionMethod, this.props.polarization!, this.props.antennaGainA, this.props.antennaGainB, this.props.waveguideLossA, this.props.waveguideLossB, Number(this.props.txPowerA), Number(this.props.txPowerB), Number(this.props.rxSensitivityA), Number(this.props.rxSensitivityB)) if (this.state.rainMethodDisplay === true) { this.manualRain(this.props.rainVal, this.props.frequency, this.props.distance, this.props.polarization!); } else { - // this.updateRainValue(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.state.worstmonth) this.rainAttCal(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.props.frequency, this.props.distance, this.props.polarization!, this.state.worstmonth); } } else { this.AbsorptionAtt(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.props.distance, this.props.frequency, this.state.worstmonth, this.state.absorptionMethod) - - // this.updateRainValue(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.state.worstmonth) - this.rainAttCal(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2, this.props.frequency, this.props.distance, this.props.polarization!, this.state.worstmonth); } } @@ -432,7 +444,7 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState </div> <div> <div style={{ marginTop: 5 }}>Frequency</div> - <div style={{ marginTop: 5 }}> {<select aria-label="select-frequency-in-ghz" className={this.state.frequencyError.length > 0 ? 'error' : 'input'} onChange={(e) => { this.props.updateFrequency(Number(e.target.value)); e.target.value === '0' ? this.setState({ frequencyError: 'select a frequency' }) : this.setState({ frequencyError: '' }); this.props.UpdateAntenas('0', '0') }}> + <div style={{ marginTop: 5 }}> {<select aria-label="select-frequency-in-ghz" className={this.state.frequencyError.length > 0 ? 'error' : 'input'} onChange={(e) => { this.props.updateFrequency(Number(e.target.value)); e.target.value === '0' ? this.setState({ frequencyError: 'select a frequency' }) : this.setState({ frequencyError: '' }) }}> <option value='0' aria-label="none-value" >Select Freq</option> <option value='7' aria-label="7" >7 GHz</option> @@ -452,7 +464,7 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState </div> <div> <div>Rain Model</div> - <div> {<select aria-label="select-rain-method" className={this.state.rainMethodError.length > 0 ? 'error' : 'input'} onChange={(e) => { e.target.value === 'itu' ? this.setState({ rainMethodDisplay: false }) : this.setState({ rainMethodDisplay: true }); e.target.value === '0' ? this.setState({ rainMethodError: 'select a Rain model' }) : this.setState({ rainMethodError: '' }) }}> + <div> {<select aria-label="select-rain-method" className={this.state.rainMethodError.length > 0 ? 'error' : 'input'} onChange={(e) => {if (e.target.value !== '') { this.setState({ rainMethodErrorState: e.target.value, rainMethodError: '' }) }; e.target.value === 'itu' ? this.setState({ rainMethodDisplay: false }) : this.setState({ rainMethodDisplay: true }) }}> <option value='0' aria-label="none-value" >Select Rain Method</option> <option value='itu' aria-label="itur8377">ITU-R P.837-7</option> <option value='manual' aria-label="manual-entry">Specific Rain</option> @@ -471,7 +483,7 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState </div> <div> <div>Absorption Model</div> - <div> {<select aria-label="select-absorption-method" className={this.state.attenuationMethodError.length > 0 ? 'error' : 'input'} onChange={(e) => { if (e.target.value !== '') { this.setState({ absorptionMethod: e.target.value }); this.setState({ attenuationMethodError: '' }) } }}> + <div> {<select aria-label="select-absorption-method" className={this.state.attenuationMethodError.length > 0 ? 'error' : 'input'} onChange={(e) => { if (e.target.value !== '') { this.setState({ absorptionMethod: e.target.value, attenuationMethodError: '' }) } }}> <option value='0' aria-label="none-value" >Select Absorption Method</option> <option value='ITURP67612' aria-label="iturp67612" >ITU-R P.676-12</option> <option value='ITURP67611' aria-label="iturp67611" >ITU-R P.676-11</option> @@ -489,14 +501,15 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState </div> <div> <div>System Operating Margin</div> - <div aria-label="system-operating-margin">{this.props.systemOperatingMargin} dB</div> + <div aria-label="system-operating-margin">{this.props.systemOperatingMarginA.toFixed(3)} dB</div> + <div aria-label="system-operating-margin">{this.props.systemOperatingMarginB.toFixed(3)} dB</div> </div> <div> - <div>Radio Transmitted Power</div> - <div> {<form><input aria-label="site-a-transmitted-power" type="number" style={{ width: 70, height: 15, fontSize: 14 }} onChange={(e) => {if (e.target.value !== '') this.props.UpdateTxPower(e.target.value,null) }} + <div>Radio Transmitted Power</div> + <div> {<form><input aria-label="site-a-transmitted-power" type="number" style={{ width: 70, height: 15, fontSize: 14 }} onChange={(e) => { if (e.target.value !== '') this.props.UpdateTxPower(e.target.value, null) }} > </input> dBm </form>} </div> - <div> {<form><input aria-label="site-b-transmitted-power" type="number" style={{ width: 70, height: 15, fontSize: 14 }} onChange={(e) => { if (e.target.value !== '') this.props.UpdateTxPower(null,e.target.value) }} + <div> {<form><input aria-label="site-b-transmitted-power" type="number" style={{ width: 70, height: 15, fontSize: 14 }} onChange={(e) => { if (e.target.value !== '') this.props.UpdateTxPower(null, e.target.value) }} > </input> dBm </form>} </div> </div> @@ -509,41 +522,43 @@ class LinkCalculation extends React.Component<linkCalculationProps, initialState > </input> dBm </form>} </div> </div> + <div> + <div>Rx power</div> + <div aria-label="site-a-effective-isotropic-radiated-power">{this.props.rxPowerA.toFixed(3)} dBm</div> + <div aria-label="site-b-effective-isotropic-radiated-power">{this.props.rxPowerB.toFixed(3)} dBm</div> + </div> </div> <div className='antennaContainer'> <div> <div></div> <div className='antennaFont'>Antenna Settings</div> </div> + <div> <div>Antenna</div> + <div aria-label="site-a-amsl">{this.props.antennaNameA} </div> + <div aria-label="site-b-amsl">{this.props.antennaNameB}</div> + </div> - <div> {<select aria-label="site-a-select-antenna" value={this.props.antennaA} style={{ width: 160, height: 22, fontSize: 13 }} className={this.state.antennaTypeError.length > 0 ? 'error' : 'input'} onChange={(e) => { if (e.target.value !== '') { this.props.UpdateAntenas(e.target.value, null); this.setState({ antennaTypeError: '' }) } }}> - <option value='0' aria-label="none-value" >Select Antenna</option> - {this.props.antennaList.map(antenna => <option value={antenna}>{antenna}</option>)} - - </select>} <div style={{ fontSize: 12, color: 'red' }}>{this.state.antennaTypeError}</div> - </div> - <div> {<select aria-label="site-b-select-antenna" value={this.props.antennaB} style={{ width: 160, height: 22, fontSize: 13 }} className={this.state.antennaTypeError.length > 0 ? 'error' : 'input'} onChange={(e) => { if (e.target.value !== '') { this.props.UpdateAntenas(null, e.target.value); this.setState({ antennaTypeError: '' }) } }}> - <option value='0' aria-label="none-value" >Select Antenna</option> - {this.props.antennaList.map(antenna => <option value={antenna}>{antenna}</option>)} - </select>} <div style={{ fontSize: 12, color: 'red' }}>{this.state.antennaTypeError}</div> - </div> - </div> <div> <div>EIRP</div> - <div aria-label="site-a-effective-isotropic-radiated-power">{this.props.eirpSiteA} dBm</div> - <div aria-label="site-b-effective-isotropic-radiated-power">{this.props.eirpSiteB} dBm</div> + <div aria-label="site-a-effective-isotropic-radiated-power">{this.props.eirpA.toFixed(3)} dBm</div> + <div aria-label="site-b-effective-isotropic-radiated-power">{this.props.eirpB.toFixed(3)} dBm</div> </div> - + <div> <div>Gain</div> - <div aria-label="site-a-antenna-gain" > {this.props.antennaGainList[this.props.antennaList.indexOf(this.props.antennaA)]} dBi</div> - <div aria-label="site-b-antenna-gain">{this.props.antennaGainList[this.props.antennaList.indexOf(this.props.antennaB)]} dBi</div> - + <div aria-label="site-a-antenna-gain" > {this.props.antennaGainA} dBi</div> + <div aria-label="site-b-antenna-gain">{this.props.antennaGainB} dBi</div> </div> <div> + <div>Waveguide Loss</div> + <div aria-label="site-a-waveguide-loss" > {this.props.waveguideLossA} dB</div> + <div aria-label="site-b-waveguide-loss">{this.props.waveguideLossB} dB</div> + </div> + + <div> <div></div> <div>{<button aria-label="calculate-button" style={{ color: '#222', fontFamily: 'Arial', boxAlign: 'center', display: 'inline-block', insetInlineStart: '20', alignSelf: 'center' }} onClick={(e) => this.buttonHandler()} >Calculate</button>} </div> |