Skip to content
Snippets Groups Projects
Commit 38babc7c authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 12/12/2022: aircrafts: restructure to compute next position (instead...

Philippe 12/12/2022: aircrafts: restructure to compute next position (instead of computing current position)
This is necessary to allow transfer of all aircraft data between processes (to be developed)
parent 967f2bbb
No related branches found
No related tags found
No related merge requests found
...@@ -231,7 +231,7 @@ INTEGER :: IINFO_ll ! return code ...@@ -231,7 +231,7 @@ INTEGER :: IINFO_ll ! return code
! !
INTEGER :: IMODEL INTEGER :: IMODEL
REAL :: ZTSTEP REAL :: ZTSTEP
TYPE(DATE_TIME) :: TZNEXT ! Time for next position
!---------------------------------------------------------------------------- !----------------------------------------------------------------------------
IKU = SIZE(PZ,3) IKU = SIZE(PZ,3)
...@@ -239,33 +239,34 @@ CALL GET_MODEL_NUMBER_ll(IMI) ...@@ -239,33 +239,34 @@ CALL GET_MODEL_NUMBER_ll(IMI)
SELECT TYPE ( TPFLYER ) SELECT TYPE ( TPFLYER )
CLASS IS ( TAIRCRAFTDATA) CLASS IS ( TAIRCRAFTDATA)
! For 'MOB' aircrafts, do the positioning only if model 1 (data will be available to others after) ! Take-off?
! aircraft store timestep is always a multiple of model 1 timestep TAKEOFF: IF ( .NOT. TPFLYER%LTOOKOFF ) THEN
! For 'FIX' aircrafts, do the computation only on the correct model ! Do the take-off positioning only once
! (important especially if store timestep is smaller than model 1 timestep) ! (on model 1 for 'MOB', if aircraft is on an other model, data will be available on the right one anyway)
IF ( ( TPFLYER%CMODEL == 'MOB' .AND. IMI == 1 ) & IF ( ( TPFLYER%CMODEL == 'MOB' .AND. IMI == 1 ) &
.OR. ( TPFLYER%CMODEL == 'FIX' .AND. IMI == TPFLYER%NMODEL ) ) THEN .OR. ( TPFLYER%CMODEL == 'FIX' .AND. IMI == TPFLYER%NMODEL ) ) THEN
!Do we have to store aircraft data? ! Is the aircraft in flight ?
CALL FLYER_CHECK_STORESTEP( TPFLYER ) IF ( TDTCUR >= TPFLYER%TLAUNCH .AND. TDTCUR <= TPFLYER%TLAND ) THEN
TPFLYER%LFLY = .TRUE.
! Is the aircraft in flight ? TPFLYER%LTOOKOFF = .TRUE.
IF ( TDTCUR >= TPFLYER%TLAUNCH .AND. TDTCUR <= TPFLYER%TLAND ) THEN
TPFLYER%LFLY = .TRUE. ! Compute current position
CALL AIRCRAFT_COMPUTE_POSITION( TDTCUR, TPFLYER )
! Compute current position
CALL AIRCRAFT_COMPUTE_POSITION( TDTCUR, TPFLYER ) ! Get rank of the process where the aircraft is and the model number
CALL FLYER_GET_RANK_MODEL_ISCRASHED( TPFLYER )
! Get rank of the process where the aircraft is and the model number END IF
CALL FLYER_GET_RANK_MODEL_ISCRASHED( TPFLYER )
ELSE
TPFLYER%LFLY = .FALSE.
END IF END IF
END IF TAKEOFF
IF ( IMI == TPFLYER%NMODEL ) THEN
!Do we have to store aircraft data?
CALL FLYER_CHECK_STORESTEP( TPFLYER )
END IF END IF
! For aircrafts, data has only to be computed at store moments ! For aircrafts, data has only to be computed at store moments
ISTORE = TPFLYER%TFLYER_TIME%N_CUR
IF ( IMI == TPFLYER%NMODEL .AND. TPFLYER%LFLY .AND. TPFLYER%LSTORE ) THEN IF ( IMI == TPFLYER%NMODEL .AND. TPFLYER%LFLY .AND. TPFLYER%LSTORE ) THEN
ISTORE = TPFLYER%TFLYER_TIME%N_CUR
! Check if it is the right moment to store data ! Check if it is the right moment to store data
IF ( ABS( TDTCUR - TPFLYER%TFLYER_TIME%TPDATES(ISTORE) ) < 1e-10 ) THEN IF ( ABS( TDTCUR - TPFLYER%TFLYER_TIME%TPDATES(ISTORE) ) < 1e-10 ) THEN
ISOWNERAIR: IF ( TPFLYER%NRANK_CUR == ISP ) THEN ISOWNERAIR: IF ( TPFLYER%NRANK_CUR == ISP ) THEN
...@@ -294,6 +295,33 @@ SELECT TYPE ( TPFLYER ) ...@@ -294,6 +295,33 @@ SELECT TYPE ( TPFLYER )
END IF ISOWNERAIR END IF ISOWNERAIR
CALL FLYER_COMMUNICATE_DATA( ) CALL FLYER_COMMUNICATE_DATA( )
! Store has been done
TPFLYER%LSTORE = .FALSE.
END IF
END IF
! Compute next position if the previous store has just been done (right moment on right model)
IF ( IMI == TPFLYER%NMODEL .AND. ISTORE > 0 ) THEN
! This condition may only be tested if ISTORE > 0
IF (ABS( TDTCUR - TPFLYER%TFLYER_TIME%TPDATES(ISTORE) ) < 1e-10 ) THEN
! Next store moment
TZNEXT = TDTCUR + TPFLYER%TFLYER_TIME%XTSTEP
! Is the aircraft in flight ?
IF ( TZNEXT >= TPFLYER%TLAUNCH .AND. TZNEXT <= TPFLYER%TLAND ) THEN
TPFLYER%LFLY = .TRUE.
! Force LTOOKOFF to prevent to do it again (at a next timestep)
TPFLYER%LTOOKOFF = .TRUE.
! Compute next position
CALL AIRCRAFT_COMPUTE_POSITION( TZNEXT, TPFLYER )
! Get rank of the process where the aircraft is and the model number
CALL FLYER_GET_RANK_MODEL_ISCRASHED( TPFLYER )
ELSE
TPFLYER%LFLY = .FALSE.
END IF
END IF END IF
END IF END IF
......
...@@ -132,6 +132,7 @@ TYPE :: TFLYERDATA ...@@ -132,6 +132,7 @@ TYPE :: TFLYERDATA
END TYPE TFLYERDATA END TYPE TFLYERDATA
TYPE, EXTENDS( TFLYERDATA ) :: TAIRCRAFTDATA TYPE, EXTENDS( TFLYERDATA ) :: TAIRCRAFTDATA
LOGICAL :: LTOOKOFF = .FALSE. ! Set to true once the aircraft takes off
! !
!* aircraft flight definition !* aircraft flight definition
! !
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment