OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_sens.F File Reference
#include "implicit_f.inc"
#include "com04_c.inc"
#include "com08_c.inc"
#include "units_c.inc"
#include "task_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine sensor_sens (nsensor, sensor_tab, sens)

Function/Subroutine Documentation

◆ sensor_sens()

subroutine sensor_sens ( integer, intent(in) nsensor,
type (sensor_str_), dimension(nsensor), intent(inout) sensor_tab,
integer, intent(in) sens )

Definition at line 30 of file sensor_sens.F.

31C-----------------------------------------------
32C ROUTINE DESCRIPTION :
33C ===================
34C SENS sensor : starts when IS1 starts,
35C Remains active for at least TDELAY
36C IF IS2 is defined : stops when IS2 starts
37C ELSE stops after TDELAY.
38C IS1 and IS2 are the sensors given as definition
39C----------------------------------------------------------------
40C DUMMY ARGUMENTS DESCRIPTION:
41C ===================
42C
43C NAME DESCRIPTION
44C
45C SENSOR_TAB Sensor Structure
46C SENS SENSOR ID to treat
47C----------------------------------------------------------------
48C Sensor activation flag:
49C
50C Sensor inactive & cannot be reactivated afterwards
51C SENSOR_TAB(SENS)%TSTART = INFINITY (1.E+20)
52C SENSOR_TAB(SENS)%STATUS = -1
53C
54C Sensor inactive :
55C SENSOR_TAB(SENS)%TSTART = INFINITY (1.E+20)
56C SENSOR_TAB(SENS)%STATUS = 0
57C
58C Sensor active :
59C SENSOR_TAB(SENS)%TSTART = TT (or activation time : TT+DT2)
60C SENSOR_TAB(SENS)%STATUS = 1
61C
62C-----------------------------------------------
63C M o d u l e s
64C-----------------------------------------------
65 USE sensor_mod
66C-----------------------------------------------
67C I m p l i c i t T y p e s
68C-----------------------------------------------
69#include "implicit_f.inc"
70C-----------------------------------------------
71C C o m m o n B l o c k s
72C-----------------------------------------------
73#include "com04_c.inc"
74#include "com08_c.inc"
75#include "units_c.inc"
76#include "task_c.inc"
77C-----------------------------------------------
78C D u m m y A r g u m e n t s
79C-----------------------------------------------
80 INTEGER, INTENT(IN) :: NSENSOR,SENS
81 TYPE (SENSOR_STR_), INTENT(INOUT) ,DIMENSION(NSENSOR) :: SENSOR_TAB
82C-----------------------------------------------
83C L o c a l V a r i a b l e s
84C-----------------------------------------------
85 INTEGER IS1,STATUS_IS1
86 INTEGER IS2,STATUS_IS2
87
88 INTEGER ACTI,SENS_ID
89 my_real tstart, tdelay,tstart1, tstops
90C-----------------------------------------------
91 acti = 0
92c
93 sens_id = sensor_tab(sens)%SENS_ID
94 tstart = sensor_tab(sens)%TSTART
95 tdelay = sensor_tab(sens)%TDELAY
96 tstops = infinity
97c
98 is1 = sensor_tab(sens)%IPARAM(1)
99 status_is1 = sensor_tab(is1)%STATUS
100 tstart1 = sensor_tab(is1)%TSTART
101c
102 is2 = sensor_tab(sens)%IPARAM(2)
103 IF (is2 > 0) THEN
104 status_is2 = sensor_tab(is2)%STATUS
105 ENDIF
106
107 IF (sensor_tab(sens)%STATUS == -1)THEN ! Status= -1 : Sensor will never wake up again
108 RETURN
109 ENDIF
110
111
112 IF (status_is1 <= 0) THEN
113 tstart1 = infinity
114 END IF
115
116 IF (status_is1 == 1) THEN ! check status of sensor1
117 IF (sensor_tab(sens)%STATUS == 0) THEN
118 acti = 1
119 sensor_tab(sens)%STATUS = 1
120 sensor_tab(sens)%TSTART = tstart1
121 ENDIF
122 ENDIF
123
124 IF (tt > (tstart + tdelay) ) THEN ! We reached TDELAY
125
126 IF (is2 == 0) THEN ! If sensor2 not defined : STOP
127 tstops = tt
128 ELSE ! sensor2 defined : stop when sens2 starts
129 tstops = infinity
130 IF (sensor_tab(is2)%STATUS == 1) THEN
131 tstops = tt
132 ENDIF
133 ENDIF
134
135 IF (tstops <= tt) THEN
136 sensor_tab(sens)%TSTART = infinity
137 sensor_tab(sens)%STATUS = -1 ! Status= -1 : Sensor will never wake up again
138 acti = acti + 2
139 ENDIF
140 ENDIF
141
142
143 IF (acti == 1) THEN
144
145 IF (ispmd == 0) THEN
146 WRITE (istdo,1000) sensor_tab(sens)%SENS_ID,tstart1
147 WRITE (iout ,1000) sensor_tab(sens)%SENS_ID,tstart1
148 ENDIF
149
150 ELSE IF (acti == 2) THEN
151
152 IF (ispmd == 0) THEN
153 WRITE (istdo,1100) sensor_tab(sens)%SENS_ID,tt
154 WRITE (iout ,1100) sensor_tab(sens)%SENS_ID,tt
155 ENDIF
156
157 ENDIF
158c-----------------------------------------------------------------------
1591000 FORMAT(' SENSOR NUMBER ',i10,' ACTIVATED AT TIME ',1pe12.5)
1601100 FORMAT(' SENSOR NUMBER ',i10,' DEACTIVATED AT TIME ',1pe12.5)
161C-----------------------------------------------
#define my_real
Definition cppsort.cpp:32