From 437f67407aece6f7aed8e989638b0d64075f0c0a Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Wed, 4 Aug 2021 11:59:18 +0200 Subject: Update ODLUX Add various updates and bugfixes to NetworkMap, Configuration, LinkCalculation and ConnectApp Issue-ID: CCSDK-3414 Signed-off-by: Aijana Schumann Change-Id: I6ea5c3a9d6ccbe9c450da43220654a53fd2f262b Signed-off-by: Aijana Schumann --- sdnr/wt/odlux/apps/linkCalculationApp/package.json | 4 +- sdnr/wt/odlux/apps/linkCalculationApp/pom.xml | 4 +- .../src/actions/commonLinkCalculationActions.ts | 141 +++-- .../src/handlers/linkCalculationAppRootHandler.ts | 51 +- .../apps/linkCalculationApp/src/views/Style.scss | 143 +++-- .../src/views/linkCalculationComponent.tsx | 662 ++++++++++++--------- 6 files changed, 631 insertions(+), 374 deletions(-) (limited to 'sdnr/wt/odlux/apps/linkCalculationApp') diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/package.json b/sdnr/wt/odlux/apps/linkCalculationApp/package.json index 171770603..c03afe19b 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/package.json +++ b/sdnr/wt/odlux/apps/linkCalculationApp/package.json @@ -29,8 +29,8 @@ "@types/react": "17.0.3", "@types/react-dom": "17.0.2", "@types/react-router-dom": "5.1.7", - "@material-ui/core": "4.11.0", - "@material-ui/icons": "4.9.1", + "@material-ui/core": "4.11.4", + "@material-ui/icons": "4.11.2", "@types/classnames": "2.2.6", "@types/flux": "3.1.8", "@types/jquery": "3.3.10", diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/pom.xml b/sdnr/wt/odlux/apps/linkCalculationApp/pom.xml index 5467c8b5d..c5d8c3617 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/pom.xml +++ b/sdnr/wt/odlux/apps/linkCalculationApp/pom.xml @@ -140,8 +140,8 @@ initialize - v10.16.3 - v1.19.0 + v12.13.0 + v1.22.10 diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts b/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts index e7427e4cc..0849058dc 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/actions/commonLinkCalculationActions.ts @@ -21,98 +21,155 @@ import { Dispatch } from "../../../../framework/src/flux/store"; import { IApplicationStoreState } from "../../../../framework/src/store/applicationStore"; -export class UpdateLinkIdAction extends Action{ - constructor(public linkId: string){ +export class UpdateLinkIdAction extends Action { + constructor(public linkId: string) { super(); } } -export class UpdateFrequencyAction extends Action{ - constructor(public frequency: number){ +export class UpdateFrequencyAction extends Action { + constructor(public frequency: number) { super(); } } -export class UpdateSiteAction extends Action{ +export class UpdateSiteAction extends Action { constructor( public siteA?: any, public siteB?: any - ){ + ) { super(); } } -export class UpdateRainAttAction extends Action{ - - constructor(public rainAtt: number){ +export class UpdateRainAttAction extends Action { + + constructor(public rainAtt: number) { super(); } } -export class UpdateRainValAction extends Action{ - constructor(public rainVal: number){ +export class UpdateRainValAction extends Action { + constructor(public rainVal: number) { super(); } } -export class updateHideForm extends Action{ - constructor(public formView: boolean){ +export class updateHideForm extends Action { + constructor(public formView: boolean) { super(); } } -export class UpdateDistanceAction extends Action{ - constructor(public distance: number){ +export class UpdateDistanceAction extends Action { + constructor(public distance: number) { super(); } } -export class UpdateFslCalculation extends Action{ - constructor(public fsl: number){ +export class UpdateFslCalculation extends Action { + constructor(public fsl: number) { super(); } } -export class UpdateLatLonAction extends Action{ +export class UpdateLatLonAction extends Action { constructor( public Lat1: number, - public Lon1:number, - public Lat2: number, + public Lon1: number, + public Lat2: number, public Lon2: number - ){ + ) { + super(); + + } +} +export class UpdatePolAction extends Action { + constructor(public polarization: string) { super(); - } } -export class UpdatePolAction extends Action{ - constructor(public polarization: string){ +export class isCalculationServerReachableAction extends Action { + constructor(public reachable: boolean) { super(); } } -export class isCalculationServerReachableAction extends Action{ - constructor(public reachable: boolean){ +export class updateAltitudeAction extends Action { + constructor( + public amslA: number, + public aglA: number, + public amslB: number, + public aglB: number + ) { super(); } } -export class updateAltitudeAction extends Action{ +export class UpdateAbsorptionLossAction extends Action { constructor( - public amslA:number, - public aglA:number, - public amslB:number, - public aglB:number - ){ + public absorptionOxygen: number, + public absorptionWater: number, + + ) { + super(); + } +} +export class UpdateWorstMonthRainAction extends Action { + constructor(public month: string) { + super(); + } +} + +export class UpdateEIRPAction extends Action { + constructor(public eirpA: number,public eirpB: number) { + super(); + } +} +export class UpdateAntennaGainAction extends Action { + constructor(public antennaGainList: string[]) { + super(); + } +} +export class UpdateAntennaListAction extends Action { + constructor(public antennaList: string[]) { + super(); + } +} +export class UpdateAntennaAction extends Action { + constructor(public antennaA: string | null, public antennaB : string | null) { + super(); + } +} +export class UpdateRadioAttributesAction extends Action { + constructor(public som: number , public eirpA : number, public eirpB : number) { super(); } } -export class UpdateAbsorptionLossAction extends Action{ - constructor( - public absorptionOxygen:number, - public absorptionWater:number, - - ){ - super(); - } +export class UpdateTxPowerAction extends Action { + constructor(public txPowerA: string | null , public txPowerB : string | null) { + super(); + } } -export class UpdateWorstMonthRainAction extends Action{ - constructor(public month: string){ +export class UpdateRxSensitivityAction extends Action { + constructor(public rxSensitivityA: string | null , public rxSensitivityB : string | null) { 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)) +} + diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts b/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts index 608367072..edfad052a 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} from '../actions/commonLinkCalculationActions'; +import { UpdateLinkIdAction, UpdateFrequencyAction , UpdateLatLonAction, UpdateRainAttAction, UpdateRainValAction, updateHideForm, UpdateFslCalculation, UpdateSiteAction, UpdateDistanceAction, isCalculationServerReachableAction, UpdatePolAction, updateAltitudeAction, UpdateAbsorptionLossAction, UpdateWorstMonthRainAction, UpdateEIRPAction, UpdateAntennaAction, UpdateAntennaListAction, UpdateAntennaGainAction, UpdateTxPowerAction, UpdateRxSensitivityAction} from '../actions/commonLinkCalculationActions'; declare module '../../../../framework/src/store/applicationStore' { interface IApplicationStoreState { @@ -55,7 +55,20 @@ export type ILinkCalculationAppStateState= { aglB:number, absorptionWater:number, absorptionOxygen: number, - month: string + month: string, + eirpA: number, + eirpB: number, + antennaGainA: number, + antennaGainB :number, + antennaList:string[], + antennaGainList:string[], + antennaA: string, + antennaB:string, + systemOperatingMargin : number, + txPowerA : string, + txPowerB: string, + rxSensitivityA : string, + rxSensitivityB: string } const initialState: ILinkCalculationAppStateState ={ @@ -80,7 +93,20 @@ const initialState: ILinkCalculationAppStateState ={ aglB:0, absorptionWater:0, absorptionOxygen: 0, - month: '' + month: '', + eirpA: 0, + eirpB: 0, + antennaGainA :0, + antennaGainB :0, + antennaList:[], + antennaGainList:[], + antennaA: '0', + antennaB:'0', + systemOperatingMargin : 0, + txPowerA : '0', + txPowerB: '0', + rxSensitivityA: '0', + rxSensitivityB: '0' } @@ -130,6 +156,25 @@ export const LinkCalculationHandler: IActionHandler ({ rainAtt: state.linkCalculation.calculations.rainAtt, rainVal: state.linkCalculation.calculations.rainVal, formView: state.linkCalculation.calculations.formView, - fsl:state.linkCalculation.calculations.fsl, + fsl: state.linkCalculation.calculations.fsl, siteA: state.linkCalculation.calculations.siteA, siteB: state.linkCalculation.calculations.siteB, distance: state.linkCalculation.calculations.distance, - reachable :state.linkCalculation.calculations.reachable, - polarization:state.linkCalculation.calculations.polarization, - amslA:state.linkCalculation.calculations.amslA, - amslB:state.linkCalculation.calculations.amslB, - aglA:state.linkCalculation.calculations.aglA, - aglB:state.linkCalculation.calculations.aglB, - absorptionOxygen : state.linkCalculation.calculations.absorptionOxygen, - absorptionWater : state.linkCalculation.calculations.absorptionWater, - month : state.linkCalculation.calculations.month + reachable: state.linkCalculation.calculations.reachable, + polarization: state.linkCalculation.calculations.polarization, + amslA: state.linkCalculation.calculations.amslA, + amslB: state.linkCalculation.calculations.amslB, + aglA: state.linkCalculation.calculations.aglA, + aglB: state.linkCalculation.calculations.aglB, + 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, + 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 + }); -const BASE_URL="/topology/linkcalculator" +const BASE_URL = "/topology/linkcalculator" const mapDispatch = (dispatcher: IDispatcher) => ({ updateFrequency: (frequency: number) => { - dispatcher.dispatch(new UpdateFrequencyAction(frequency)) + 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)) }, - + updateRainValue: (rainVal: number) => { dispatcher.dispatch(new UpdateRainValAction(rainVal)) }, @@ -80,53 +92,59 @@ const mapDispatch = (dispatcher: IDispatcher) => ({ dispatcher.dispatch(new UpdateRainAttAction(rainAtt)) }, - - FSL :(free:number)=> { - dispatcher.dispatch(new UpdateFslCalculation (free)) - }, - UpdateConectivity : (reachable:boolean) => { - dispatcher.dispatch (new isCalculationServerReachableAction (reachable)) + FSL: (free: number) => { + dispatcher.dispatch(new UpdateFslCalculation(free)) }, - updatePolarization :(polarization:any)=>{ - dispatcher.dispatch (new UpdatePolAction(polarization)) + UpdateConectivity: (reachable: boolean) => { + dispatcher.dispatch(new isCalculationServerReachableAction(reachable)) }, - updateAutoDistance : (distance:number)=>{ - dispatcher.dispatch (new UpdateDistanceAction(distance)) + updatePolarization: (polarization: any) => { + dispatcher.dispatch(new UpdatePolAction(polarization)) }, - UpdateAbsorption : (OxLoss:number , WaterLoss:number) => { - dispatcher.dispatch (new UpdateAbsorptionLossAction (OxLoss, WaterLoss)) + updateAutoDistance: (distance: number) => { + dispatcher.dispatch(new UpdateDistanceAction(distance)) }, - // UpdateWorstMonth : (worstmonth:boolean) => { - // dispatcher.dispatch (new UpdateWorstMonthAction(worstmonth)) - // }, - - UpdateWorstMonthRain : (month:string) => { - dispatcher.dispatch (new UpdateWorstMonthRainAction(month)) - } + UpdateAbsorption: (OxLoss: number, WaterLoss: number) => { + dispatcher.dispatch(new UpdateAbsorptionLossAction(OxLoss, WaterLoss)) + }, + UpdateWorstMonthRain: (month: string) => { + dispatcher.dispatch(new UpdateWorstMonthRainAction(month)) + }, + UpdateAntenas: (antennaA: string | null, antennaB: string | null) => { + dispatcher.dispatch(new UpdateAntennaAction(antennaA, antennaB)) + }, + UpdateRadioAttributes :(som: number, eirpA: number, eirpB: number)=>{ + dispatcher.dispatch(new UpdateRadioAttributesAction(som,eirpA, eirpB)) + }, + UpdateTxPower :(txPowerA: string | null, txPowerB: string | null)=>{ + dispatcher.dispatch(new UpdateTxPowerAction(txPowerA, txPowerB)) + }, + UpdateRxSensitivity :(rxSensitivityA : string | null, rxSensitivityB : string | null)=>{ + dispatcher.dispatch(new UpdateRxSensitivityAction(rxSensitivityA, rxSensitivityB)) + } }); type linkCalculationProps = Connect; interface initialState { - rainMethodDisplay: boolean, - absorptionMethod : string; + rainMethodDisplay: boolean, + absorptionMethod: string; horizontalBoxChecked: boolean, - latitude1Error: string, - longitude1Error:string - latitude2Error: string, - longitude2Error:string, - frequencyError: string, - rainMethodError: string, - attenuationMethodError : string, - worstmonth : boolean, - showWM : string - - + latitude1Error: string, + longitude1Error: string + latitude2Error: string, + longitude2Error: string, + frequencyError: string, + rainMethodError: string, + antennaTypeError: string, + attenuationMethodError: string, + worstmonth: boolean, + showWM: string, } class LinkCalculation extends React.Component { @@ -135,40 +153,41 @@ class LinkCalculation extends React.Component{ - const result = await fetch(BASE_URL+'/distance/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2) - const json = await result.json() - return json.distanceInKm - } + attenuationMethodError: '', + antennaTypeError: '', + worstmonth: false, + showWM: '', + }; + } + + updateAutoDistance = async (lat1: number, lon1: number, lat2: number, lon2: number) => { + const result = await fetch(BASE_URL + '/distance/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2) + const json = await result.json() + return json.distanceInKm + } + + updateLatLon = (e: any) => { + + e.target.id == 'Lat1' ? this.props.updateLatLon(e.target.value, this.props.lon1, this.props.lat2, this.props.lon2) : null + e.target.id == 'Lon1' ? this.props.updateLatLon(this.props.lat1, e.target.value, this.props.lat2, this.props.lon2) : null + e.target.id == 'Lat2' ? this.props.updateLatLon(this.props.lat1, this.props.lon1, e.target.value, this.props.lon2) : null + e.target.id == 'Lon2' ? this.props.updateLatLon(this.props.lat1, e.target.value, this.props.lat2, e.target.value) : null - updateLatLon = (e:any) => { - - e.target.id== 'Lat1'? this.props.updateLatLon(e.target.value, this.props.lon1, this.props.lat2, this.props.lon2) : null - e.target.id== 'Lon1'? this.props.updateLatLon(this.props.lat1, e.target.value, this.props.lat2, this.props.lon2) : null - e.target.id== 'Lat2'? this.props.updateLatLon(this.props.lat1, this.props.lon1, e.target.value, this.props.lon2) : null - e.target.id== 'Lon2'? this.props.updateLatLon(this.props.lat1, e.target.value, this.props.lat2, e.target.value) : null - } - updatePoli = (val: string) =>{ + updatePoli = (val: string) => { - this.setState({horizontalBoxChecked: !this.state.horizontalBoxChecked}); + this.setState({ horizontalBoxChecked: !this.state.horizontalBoxChecked }); this.props.updatePolarization(val); - + } LatLonToDMS = (value: number, isLon: boolean = false) => { @@ -187,266 +206,359 @@ class LinkCalculation extends React.Component { - if(!worstmonth){ - fetch(BASE_URL+'/rain/annual/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + frequency+ '/'+ distance + '/' + polarization.toUpperCase()) - .then(res => res.json()) - .then(result => { this.props.UpdateRainAtt(result.rainAttenuation) ; this.props.updateRainValue(result.rainFall.rainrate)}) + rainAttCal = (lat1: any, lon1: any, lat2: any, lon2: any, frequency: any, distance: number, polarization: string, worstmonth: boolean) => { + if (!worstmonth) { + fetch(BASE_URL + '/rain/annual/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + frequency + '/' + distance + '/' + polarization.toUpperCase()) + .then(res => res.json()) + .then(result => { this.props.UpdateRainAtt(result.rainAttenuation); this.props.updateRainValue(result.rainFall.rainrate) }) } else { - fetch(BASE_URL+'/rain/worstmonth/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + frequency+ '/'+ distance + '/' + polarization.toUpperCase()) - .then(res => res.json()) - .then(result => { this.props.UpdateRainAtt(result.rainAttenuation) ; this.props.updateRainValue(result.rainFall.rainrate); this.props.UpdateWorstMonthRain (result.rainFall.period); this.setState({showWM: '- Wm is : '})}) + fetch(BASE_URL + '/rain/worstmonth/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + frequency + '/' + distance + '/' + polarization.toUpperCase()) + .then(res => res.json()) + .then(result => { this.props.UpdateRainAtt(result.rainAttenuation); this.props.updateRainValue(result.rainFall.rainrate); this.props.UpdateWorstMonthRain(result.rainFall.period); this.setState({ showWM: '- Wm is : ' }) }) } } - manualRain = (rainfall: number, frequency: number, distance:number, polarization : string) => { - fetch(BASE_URL+'/rain/' + rainfall + '/' + frequency + '/' + distance+ '/' + polarization.toUpperCase()) + manualRain = (rainfall: number, frequency: number, distance: number, polarization: string) => { + fetch(BASE_URL + '/rain/' + rainfall + '/' + frequency + '/' + distance + '/' + polarization.toUpperCase()) .then(res => res.json()) .then(result => { this.props.specificRain(result.rainAttenuation) }) - } + } + + FSL = (distance: number, frequency: number) => { + fetch(BASE_URL + '/fsl/' + distance + '/' + frequency) + .then(res => res.json()) + .then(result => { this.props.FSL(result.fspl) }) + } - FSL = (distance:number, frequency:number) => { - fetch(BASE_URL+'/fsl/' + distance + '/' + frequency) - .then(res=>res.json()) - .then (result => {this.props.FSL(result.fspl)}) + AbsorptionAtt = (lat1: number, lon1: number, lat2: number, lon2: number, distance: number, frequency: number, worstmonth: boolean, absorptionMethod: string) => { + if (!worstmonth) { + fetch(BASE_URL + '/absorption/annual/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' + absorptionMethod) + .then(res => res.json()) + .then(result => { this.props.UpdateAbsorption(result.oxygenLoss, result.waterLoss) }) } - - AbsorptionAtt =(lat1: number, lon1: number, lat2: number, lon2: number, distance:number, frequency:number, worstmonth:boolean, absorptionMethod : string) => { - if(!worstmonth) - { - fetch(BASE_URL+'/absorption/annual/' +lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' +absorptionMethod) - .then(res=>res.json()) - .then (result => {this.props.UpdateAbsorption(result.oxygenLoss, result.waterLoss)}) - } - else { - fetch(BASE_URL+'/absorption/annual/' +lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' +absorptionMethod) - .then(res=>res.json()) - .then (result => {this.props.UpdateAbsorption(result.oxygenLoss, result.waterLoss)}) - } + else { + fetch(BASE_URL + '/absorption/annual/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' + absorptionMethod) + .then(res => res.json()) + .then(result => { this.props.UpdateAbsorption(result.oxygenLoss, result.waterLoss) }) } + } + + 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)}) + } + + formValid = () => { + + this.props.lat1 === 0 ? this.setState({ latitude1Error: 'Enter a number between -90 to 90' }) : null + this.props.lat2 === 0 ? this.setState({ latitude2Error: 'Enter a number between -90 to 90' }) : null + this.props.lon1 === 0 ? this.setState({ longitude1Error: 'Enter a number between -180 to 180' }) : null + 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.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 === ''); + + return 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 === ''; + + } + + - formValid = () => { - - this.props.lat1 === 0 ? this.setState({latitude1Error: 'Enter a number between -90 to 90'}) : null - this.props.lat2 === 0 ? this.setState({latitude2Error: 'Enter a number between -90 to 90'}) : null - this.props.lon1 === 0 ? this.setState({longitude1Error: 'Enter a number between -180 to 180' }) : null - 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.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=== ''); - - return 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=== ''; - - } - - - buttonHandler = async () => { - - if (this.formValid()) { + + if (this.formValid()) { this.props.updateAutoDistance(await this.updateAutoDistance(this.props.lat1, this.props.lon1, this.props.lat2, this.props.lon2)) this.FSL(this.props.distance, this.props.frequency) - if (this.state.worstmonth===false) { - this.setState({showWM : ' '}) + if (this.state.worstmonth === false) { + 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.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) - if (this.state.rainMethodDisplay === true){ + if (this.state.rainMethodDisplay === true) { - this.manualRain(this.props.rainVal, this.props.frequency, this.props.distance, this.props.polarization!); + 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) + } + 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.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); + 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 console.log('form is not valid') + else console.log('form is not valid') } componentDidMount = () => { - fetch (BASE_URL+'/fsl/1/1') - .then(res => {if (res.ok) { this.props.UpdateConectivity(true)}else {this.props.UpdateConectivity(false)} }) - .catch (res => {this.props.UpdateConectivity(false)} ) + fetch(BASE_URL + '/fsl/1/1') + .then(res => { if (res.ok) { this.props.UpdateConectivity(true) } else { this.props.UpdateConectivity(false) } }) + .catch(res => { this.props.UpdateConectivity(false) }) } - handleChange =(e:any) => { - - switch (e.target.id){ - case 'Lat1' : if ( e.target.value >90 || e.target.value<-90 ) - { this.setState({latitude1Error: 'Enter a number between -90 to 90'})} - else {this.updateLatLon(e) - this.setState({latitude1Error: ''}) } - break; - case 'Lat2' : if ( e.target.value >90 || e.target.value<-90 ) - { this.setState({latitude2Error: 'Enter a number between -90 to 90'})} - else {this.updateLatLon(e) - this.setState({latitude2Error: ''}) } - break; - case 'Lon1' : if ( e.target.value >180 || e.target.value<-180 ) - { this.setState({longitude1Error: 'Enter a number between -180 to 180'})} - else {this.updateLatLon(e) - this.setState({longitude1Error: ''}) } - break; - case 'Lon2' : if ( e.target.value >180 || e.target.value<-180 ) - { this.setState({longitude2Error: 'Enter a number between -180 to 180'})} - else {this.updateLatLon(e) - this.setState({longitude2Error: ''}) } - break; - + handleChange = (e: any) => { + + switch (e.target.id) { + case 'Lat1': if (e.target.value > 90 || e.target.value < -90) { this.setState({ latitude1Error: 'Enter a number between -90 to 90' }) } + else { + this.updateLatLon(e) + this.setState({ latitude1Error: '' }) + } + break; + case 'Lat2': if (e.target.value > 90 || e.target.value < -90) { this.setState({ latitude2Error: 'Enter a number between -90 to 90' }) } + else { + this.updateLatLon(e) + this.setState({ latitude2Error: '' }) + } + break; + case 'Lon1': if (e.target.value > 180 || e.target.value < -180) { this.setState({ longitude1Error: 'Enter a number between -180 to 180' }) } + else { + this.updateLatLon(e) + this.setState({ longitude1Error: '' }) + } + break; + case 'Lon2': if (e.target.value > 180 || e.target.value < -180) { this.setState({ longitude2Error: 'Enter a number between -180 to 180' }) } + else { + this.updateLatLon(e) + this.setState({ longitude2Error: '' }) + } + break; + } } - render() { + render() { return ( - -
- - {!this.props.formView && - -
- -
Site A -
- -
{this.state.latitude1Error}
-
{this.state.longitude1Error}
-
-
- -
Site B -
-
{this.state.latitude2Error}
-
{this.state.longitude2Error}
-
- + +
+ + {!this.props.formView && + +
+
+
SiteA
+
SiteB
+
+ +
+
+
+ +
{this.state.latitude1Error}
+
+
+
+
{this.state.latitude2Error}
+
+
+ +
+
+
{this.state.longitude1Error}
+
+
+
{this.state.longitude2Error}
+
+
+ + +
} -
-
{
this.setState ({worstmonth: false})}>Annual - this.setState ({worstmonth: true})}>WM
}
- - -
-
 
- {(this.props.siteA.length>0 || this.props.siteB.length>0) &&
Site Name
} -
Latitude
-
Longitude
-
Azimuth
-
Average Mean Sea Level
-
Antenna Height Above Ground
-
Distance
-
Polarization
-
Frequency
-
Free Space Loss
-
Rain Model
-
Rainfall Rate
-
Rain Loss
-
Absorption Model
-
Oxygen Specific Attenuation
-
Water Vapor Specific Attenuation
+
+
{
this.setState({ worstmonth: false })}>Annual + this.setState({ worstmonth: true })}>WM
}
- - -
-
Site A
- {this.props.siteA.length>0 &&
{this.props.siteA }
} -
{this.props.lat1 && this.LatLonToDMS(this.props.lat1)}
-
{this.props.lon1 && this.LatLonToDMS(this.props.lon1)}
-
0
-
{this.props.amslA.toFixed(2)} m
-
{this.props.aglA.toFixed(2)} m
- - -
-
{this.props.distance?.toFixed(3)} km
-
{
this.props.updatePolarization(e.target.value)}>Horizontal - {this.props.updatePolarization(e.target.value)}}>Vertical
}
- -
{}
{this.state.frequencyError}
- -
{this.props.fsl.toFixed(3)} dB
- -
{}
{this.state.rainMethodError}
-
+
+
Site A
+
Site B
+
+ {/*
 
*/} +
+ {(this.props.siteA.length > 0 || this.props.siteB.length > 0) &&
Site Name
} +
{this.props.siteA}
+
{this.props.siteB}
+
+
+
Latitude
+
{this.props.lat1 && this.LatLonToDMS(this.props.lat1)}
+
{this.props.lat2 && this.LatLonToDMS(this.props.lat2)}
+ +
+
+
Longitude
+
{this.props.lon1 && this.LatLonToDMS(this.props.lon1)}
+
{this.props.lon2 && this.LatLonToDMS(this.props.lon2)}
+
+
+
Azimuth
+
0
+
0
+
+
+
Average Mean Sea Level
+
{this.props.amslA.toFixed(2)} m
+
{this.props.amslB.toFixed(2)} m
+
+
+
Antenna Height Above Ground
+
{this.props.aglA.toFixed(2)} m
+
{this.props.aglB.toFixed(2)} m
+
+
+
Distance
+
{this.props.distance?.toFixed(3)} km
+
+
+
Polarization
+
{
this.props.updatePolarization(e.target.value)}>Horizontal + { this.props.updatePolarization(e.target.value) }}>Vertical
}
+
+
+
Frequency
+
{}
{this.state.frequencyError}
+
+
+
Free Space Loss
+
{this.props.fsl.toFixed(3)} dB
+
+
+
Rain Model
+
{}
{this.state.rainMethodError}
+
+
+
+
Rainfall Rate
{
{ this.props.updateRainValue(Number(e.target.value)) }} - value={this.props.rainVal} disabled={this.state.rainMethodDisplay === false ? true : false}> - mm/hr {this.state.showWM} {this.props.month}
}
-
{this.props.rainAtt.toFixed(3)} dB
- -
{}
{this.state.attenuationMethodError}
-
-
{this.props.absorptionOxygen.toFixed(3)} dB
-
{this.props.absorptionWater.toFixed(3)} dB
-
{}
+ value={this.props.rainVal} disabled={this.state.rainMethodDisplay === false ? true : false}> + mm/hr {this.state.showWM} {this.props.month}}
+
+
+
Rain Loss
+
{this.props.rainAtt.toFixed(3)} dB
+
+
+
Absorption Model
+
{}
{this.state.attenuationMethodError}
+
+
+
+
Oxygen Specific Attenuation
+
{this.props.absorptionOxygen.toFixed(3)} dB
+
+
+
Water Vapor Specific Attenuation
+
{this.props.absorptionWater.toFixed(3)} dB
+
+
+
System Operating Margin
+
{this.props.systemOperatingMargin} dB
+
+
+
Radio Transmitted Power
+
{
{if (e.target.value !== '') this.props.UpdateTxPower(e.target.value,null) }} + > + dBm
}
+
{
{ if (e.target.value !== '') this.props.UpdateTxPower(null,e.target.value) }} + > + dBm
}
+
+
+
RF Receiver Sensitivity
+
{
{ if (e.target.value !== '') this.props.UpdateRxSensitivity(e.target.value, null) }} + > + dBm
}
+
{
{ if (e.target.value !== '') this.props.UpdateRxSensitivity(null, e.target.value) }} + > + dBm
}
+
+
+
+
+
+
Antenna Settings
+
+
+
Antenna
+ +
{}
{this.state.antennaTypeError}
+
+
{}
{this.state.antennaTypeError}
+
+
+
EIRP
+
{this.props.eirpSiteA} dBm
+
{this.props.eirpSiteB} dBm
-
-
Site B
- {this.props.siteB.length>0 &&
{this.props.siteB}
} -
{this.props.lat2 && this.LatLonToDMS(this.props.lat2)}
-
{this.props.lon2 && this.LatLonToDMS(this.props.lon2)}
-
0
-
{this.props.amslB.toFixed(2)} m
-
{this.props.aglB.toFixed(2)} m
- -
- +
+
Gain
+
{this.props.antennaGainList[this.props.antennaList.indexOf(this.props.antennaA)]} dBi
+
{this.props.antennaGainList[this.props.antennaList.indexOf(this.props.antennaB)]} dBi
+
+
+
+
{}
+
- + - - - -
- ) - } - + + +
+ + ) } +} + export default connect(mapProps, mapDispatch)(LinkCalculation); -- cgit 1.2.3-korg