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)%TSART = 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, infinity
90C-----------------------------------------------
91 infinity = ep20
92 acti = 0
93c
94 sens_id = sensor_tab(sens)%SENS_ID
95 tstart = sensor_tab(sens)%TSTART
96 tdelay = sensor_tab(sens)%TDELAY
97 tstops = infinity
98c
99 is1 = sensor_tab(sens)%IPARAM(1)
100 status_is1 = sensor_tab(is1)%STATUS
101 tstart1 = sensor_tab(is1)%TSTART
102c
103 is2 = sensor_tab(sens)%IPARAM(2)
104 IF (is2 > 0) THEN
105 status_is2 = sensor_tab(is2)%STATUS
106 ENDIF
107
108 IF (sensor_tab(sens)%STATUS == -1)THEN ! Status= -1 : Sensor will never wake up again
109 RETURN
110 ENDIF
111
112
113 IF (status_is1 <= 0) THEN
114 tstart1 = infinity
115 END IF
116
117 IF (status_is1 == 1) THEN ! check status of sensor1
118 IF (sensor_tab(sens)%STATUS == 0) THEN
119 acti = 1
120 sensor_tab(sens)%STATUS = 1
121 sensor_tab(sens)%TSTART = tstart1
122 ENDIF
123 ENDIF
124
125 IF (tt > (tstart + tdelay) ) THEN ! We reached TDELAY
126
127 IF (is2 == 0) THEN ! If sensor2 not defined : STOP
128 tstops = tt
129 ELSE ! sensor2 defined : stop when sens2 starts
130 tstops = infinity
131 IF (sensor_tab(is2)%STATUS == 1) THEN
132 tstops = tt
133 ENDIF
134 ENDIF
135
136 IF (tstops <= tt) THEN
137 sensor_tab(sens)%TSTART = infinity
138 sensor_tab(sens)%STATUS = -1 ! Status= -1 : Sensor will never wake up again
139 acti = acti + 2
140 ENDIF
141 ENDIF
142
143
144 IF (acti == 1) THEN
145
146 IF (ispmd == 0) THEN
147 WRITE (istdo,1000) sensor_tab(sens)%SENS_ID,tstart1
148 WRITE (iout ,1000) sensor_tab(sens)%SENS_ID,tstart1
149 ENDIF
150
151 ELSE IF (acti == 2) THEN
152
153 IF (ispmd == 0) THEN
154 WRITE (istdo,1100) sensor_tab(sens)%SENS_ID,tt
155 WRITE (iout ,1100) sensor_tab(sens)%SENS_ID,tt
156 ENDIF
157
158 ENDIF
159c-----------------------------------------------------------------------
1601000 FORMAT(' SENSOR NUMBER ',i10,' ACTIVATED AT TIME ',1pe12.5)
1611100 FORMAT(' SENSOR NUMBER ',i10,' DEACTIVATED AT TIME ',1pe12.5)
162C-----------------------------------------------
#define my_real
Definition cppsort.cpp:32