OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_sens.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| sensor_sens ../engine/source/tools/sensor/sensor_sens.F
25!||--- called by ------------------------------------------------------
26!|| sensor_logical ../engine/source/tools/sensor/sensor_logical.F
27!||--- uses -----------------------------------------------------
28!|| sensor_mod ../common_source/modules/sensor_mod.F90
29!||====================================================================
30 SUBROUTINE sensor_sens(NSENSOR,SENSOR_TAB,SENS)
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-----------------------------------------------
163 END
164
165
#define my_real
Definition cppsort.cpp:32
subroutine sensor_sens(nsensor, sensor_tab, sens)
Definition sensor_sens.F:31