OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_hic.F File Reference
#include "implicit_f.inc"
#include "comlock.inc"
#include "param_c.inc"
#include "units_c.inc"
#include "com08_c.inc"
#include "task_c.inc"
#include "lockon.inc"
#include "lockoff.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine sensor_hic (sensor, accn, accel)

Function/Subroutine Documentation

◆ sensor_hic()

subroutine sensor_hic ( type (sensor_str_), target sensor,
dimension(3,*) accn,
dimension(llaccelm,*) accel )

Definition at line 32 of file sensor_hic.F.

33C-----------------------------------------------
34C M o d u l e s
35C-----------------------------------------------
36 USE groupdef_mod
37 USE sensor_mod
38C-----------------------------------------------
39C I m p l i c i t T y p e s
40C-----------------------------------------------
41#include "implicit_f.inc"
42#include "comlock.inc"
43C-----------------------------------------------
44C C o m m o n B l o c k s
45C-----------------------------------------------
46#include "param_c.inc"
47#include "units_c.inc"
48#include "com08_c.inc"
49#include "task_c.inc"
50C-----------------------------------------------
51C D u m m y A r g u m e n t s
52C-----------------------------------------------
53 my_real, DIMENSION(3,*) :: accn
54 my_real, DIMENSION(LLACCELM,*) :: accel
55 TYPE (SENSOR_STR_) ,TARGET :: SENSOR
56C----------------------------------------------------------
57C Local Variables
58C----------------------------------------------------------
59 INTEGER I,J,IDIR,IACC,ISENSOR_TYPE,NPOINT,INDX,NVAR,ICRIT
60c
61 my_real :: time_unit,time,xindx, integral,increment,time_interval
62 my_real :: hic_period,hic_crit,hic,hic_prec,hic_tmp
63 my_real :: time_prec,test_time,delta_t,beta
64 my_real :: acc_x,acc_y,acc_z,acc,accg,acc_prec,current_value,gravity
65 my_real :: period_tmp,opt_period,t1,t2,tmin,tdelay
66 my_real ,DIMENSION(:) ,POINTER :: value_table
67c
68 DATA nvar/4/
69c-----------------------------------------------------------------------
70c Sensor state variables
71c SENSOR%VAR(1) : TIME_PREC = beginning of current time interval
72c SENSOR%VAR(2) : Integral of acceleration over time within current time interval
73c SENSOR%VAR(3) : Index of current time interval in data table
74c SENSOR%VAR(4) : Previous HIC value
75c SENSOR%VAR(5...5+NPOINT) : average acceleration data table by time intervals
76C=======================================================================
77 IF (sensor%STATUS == 1) RETURN ! already activated
78c
79 tmin = sensor%TMIN
80 tdelay = sensor%TDELAY
81 isensor_type = sensor%IPARAM(1)
82 iacc = sensor%IPARAM(2)
83 npoint = sensor%IPARAM(3)
84 idir = sensor%IPARAM(4)
85
86 hic_period = sensor%RPARAM(1)
87 hic_crit = sensor%RPARAM(2)
88 gravity = sensor%RPARAM(3)
89 time_unit = sensor%RPARAM(4)
90c
91 time = tt
92 beta = 2.5d0
93 value_table(1:npoint) => sensor%VAR(nvar+1:nvar+npoint)
94c
95 IF (isensor_type == 1) THEN ! Acceletator based
96 acc_x = accel(20,iacc)
97 acc_y = accel(21,iacc)
98 acc_z = accel(22,iacc)
99 ELSE ! Node based
100 acc_x = accn(1,iacc)
101 acc_y = accn(2,iacc)
102 acc_z = accn(3,iacc)
103 END IF
104c
105 IF (idir == 1) THEN ! Resultant
106 acc = sqrt(acc_x**2 + acc_y**2 + acc_z**2)
107 ELSEIF (idir == 2) THEN ! X
108 acc = acc_x
109 ELSEIF (idir == 3) THEN ! Y
110 acc = acc_y
111 ELSE ! Z
112 acc = acc_z
113 END IF
114 accg = acc / gravity
115c
116c... Get last sensor state variables
117
118 time_prec = sensor%VAR(1)
119 acc_prec = sensor%VAR(2)
120 xindx = sensor%VAR(3)
121 hic_prec = sensor%VAR(4)
122 indx = nint(xindx)
123 icrit = 0
124c
125 time_interval = hic_period / npoint
126 test_time = time_prec + time_interval
127c
128c.... Calculate new HIC value (only at the start of new time interval)
129c
130 IF (time > test_time) THEN
131 delta_t = time - time_prec
132 ! average acceleration from previous time interval
133 current_value = (acc_prec + accg*dt12) / delta_t
134c
135 IF (indx == npoint) THEN
136c shift data to make place for new time interval when HIC_PERIOD is reached
137 DO i = 1,npoint-1
138 value_table(i) = value_table(i+1)
139 END DO
140 ELSE ! advance data index for next time interval
141 indx = indx + 1
142 ENDIF
143 value_table(indx) = current_value
144c
145c Calculation of HIC
146c Searching for the period (lower or equal to HIC_PERIOD) maximizing HIC
147c
148 opt_period = zero
149 hic = zero
150 DO i = 1,indx
151 integral = zero
152 DO j = i,indx
153 integral = integral + value_table(j)*delta_t
154 END DO
155 increment = indx + 1 - i
156 period_tmp = delta_t * increment
157 hic_tmp = period_tmp * ((integral/period_tmp)**beta)
158 hic_tmp = hic_tmp * time_unit ! convert to seconds ???
159 IF (hic_tmp > hic) THEN
160 hic = hic_tmp
161 opt_period = period_tmp
162 t1 = max(time - opt_period, zero)
163 t2 = time
164 ENDIF
165 END DO
166c
167c Save sensor status, for next step
168 sensor%VAR(1) = time
169 sensor%VAR(2) = zero ! reinitialize integral for next time interval
170 sensor%VAR(3) = indx
171 IF (hic >= hic_prec) THEN
172 sensor%VAR(4) = hic
173 icrit = 1
174 ENDIF
175c
176c.......Check Sensor State
177 IF (sensor%TCRIT + tmin > tt) THEN
178 IF (icrit == 0) THEN
179 sensor%TCRIT = infinity
180 ELSE IF (sensor%TCRIT == infinity) THEN
181 sensor%TCRIT = min(sensor%TCRIT, tt)
182 END IF
183 ELSE IF (sensor%TSTART == infinity) THEN
184 sensor%TSTART = sensor%TCRIT + tmin + tdelay
185 END IF
186c
187 IF (sensor%TSTART <= tt) THEN ! sensor activation
188 sensor%STATUS = 1
189 END IF
190c
191 ELSE ! TIME < TEST_TIME
192c Calculate acceleration integral within current time interval
193 sensor%VAR(2) = sensor%VAR(2) + accg*dt12
194 ENDIF ! Fin of TIME test
195c-----------------------------------------------------------------------
196 IF (sensor%STATUS == 1 .and. ispmd == 0) THEN
197#include "lockon.inc"
198 WRITE (istdo,1100 ) sensor%SENS_ID,sensor%TSTART
199 WRITE (iout ,1100 ) sensor%SENS_ID,sensor%TSTART
200 WRITE (iout ,1200) hic, hic_period
201 WRITE (iout ,1300) t1, t2
202#include "lockoff.inc"
203 ENDIF
204c-----------------------------------------------------------------------
2051100 FORMAT(' SENSOR NUMBER ',i10,' ,ACTIVATED AT TIME ',1pe12.5)
2061200 FORMAT(' HIC = ',1pe12.5,' ,HIC PERIOD = ',1pe12.5)
2071300 FORMAT(' TIME T1 = ',1pe12.5,' ,TIME T2 = ',1pe12.5)
208c-----------------------------------------------------------------------
209 RETURN
#define my_real
Definition cppsort.cpp:32
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
integer function nvar(text)
Definition nvar.F:32