67
68
69
70 USE python_funct_mod
71 USE my_alloc_mod
78 USE sensor_mod
80 USE read_sensor_python_mod, ONLY : read_sensor_python
82
83
84
85#include "implicit_f.inc"
86
87
88
89#include "param_c.inc"
90#include "scr17_c.inc"
91#include "com04_c.inc"
92#include "units_c.inc"
93
94
95
96 TYPE(PYTHON_), intent(inout) :: PYTHON
97 INTEGER ,INTENT(IN) :: NSETS
98 INTEGER ,INTENT(OUT) :: HM_NSENS
99 INTEGER ,DIMENSION(*) ,INTENT(IN) :: ITABM1
100 INTEGER ,DIMENSION(3,*) ,INTENT(IN) :: LACCELM,LGAUGE
101 INTEGER ,DIMENSION(LISKN,*) ,INTENT(IN) :: ISKWN
102 INTEGER ,DIMENSION(LIPART1,*) ,INTENT(IN) :: IPART
103 TYPE (SENSORS_) ,INTENT(INOUT) ,TARGET :: SENSORS
104 TYPE (GROUP_) ,DIMENSION(NGRNOD) :: IGRNOD
105 TYPE (SUBSET_) ,DIMENSION(NSUBS) :: SUBSET
106 TYPE (SUBMODEL_DATA) ,DIMENSION(NSUBMOD) :: LSUBMODEL
107 TYPE (UNIT_TYPE_) ,INTENT(IN) ::UNITAB
108 TYPE(SENSOR_USER_STRUCT_) ,INTENT(INOUT) :: SENSOR_USER_STRUCT
109
110
111
112 INTEGER ISEN,IUNIT,IFLAGUNIT,NS,UNIT_ID,SENS_ID
114 CHARACTER(LEN=NCHARTITLE) :: TITR
115 CHARACTER KEY*40,MESS*40
116 INTEGER ,DIMENSION(:) ,ALLOCATABLE :: SID
117 TYPE(PYTHON_FUNCTION), DIMENSION(:), ALLOCATABLE :: temp
118 DATA mess/'SENSOR DEFINITION '/
119
120
121
124 IF(ns > 0) THEN
125 call python_initialize(python_error)
126 if(.not. allocated(python%functs)) then
127 allocate(python%functs(ns))
128 else
129 allocate(temp(python%nb_functs + ns))
130 temp(1:python%nb_functs) = python%functs
131 CALL move_alloc(from=temp,to=python%functs)
132 endif
133 END IF
134 IF (hm_nsens > 0) THEN
135 WRITE(istdo,'(A)')' .. SENSORS'
136 WRITE (iout,'(///,A)')' SENSORS'
137 WRITE (iout,'(A/)') ' -------'
138 END IF
139
140 IF (ALLOCATED(sensors%SENSOR_TAB)) DEALLOCATE(sensors%SENSOR_TAB)
141 ALLOCATE(sensors%SENSOR_TAB(hm_nsens))
142 CALL my_alloc (sid,hm_nsens)
143 sensors%NSENSOR = hm_nsens
144
146
148
149
150
151 DO isen = 1,hm_nsens
152
154 . option_id = sens_id,
155 . option_titr = titr ,
156 . unit_id = unit_id ,
157 . keyword2 = key )
158
159
160
161 iflagunit = 0
162 DO iunit=1,unitab%NUNITS
163 IF (unitab%UNIT_ID(iunit) == unit_id) THEN
164 iflagunit = 1
165 EXIT
166 ENDIF
167 ENDDO
168 IF (unit_id > 0 .AND. iflagunit == 0) THEN
169 CALL ancmsg(msgid=659,anmode=aninfo,msgtype=msgerror,
170 . i2=unit_id,i1=sens_id,
171 . c1='SENSOR', c2='SENSOR', c3='TITR')
172 ENDIF
173
174 key = key(1:len_trim(key))
175
176 SELECT CASE(key)
177
178 CASE ('TIME' ,'TYPE0')
180
181 CASE ('ACCE' ,'TYPE1')
183 . laccelm ,unitab ,lsubmodel)
184
185 CASE ('DIST' ,'TYPE2')
187 . itabm1 ,unitab ,lsubmodel)
188
189 CASE ('SENS' ,'TYPE3')
191
192 CASE ('AND' ,'TYPE4')
193 CALL read_sensor_and(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
194
195 CASE ('OR' ,'TYPE5')
196 CALL read_sensor_or(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
197
198 CASE ('INTER' ,'TYPE6')
200 . unitab ,lsubmodel)
201
202 CASE ('RWALL' ,'TYPE7')
204 . unitab ,lsubmodel)
205
206 CASE ('NOT' ,'TYPE8')
207 CALL read_sensor_not(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
208
209 CASE ('VEL' ,'TYPE9')
211 . itabm1 ,unitab ,lsubmodel)
212
213 CASE ('GAUGE' ,'TYPE10')
215 . lgauge ,unitab ,lsubmodel)
216
217 CASE ('RBODY' ,'TYPE11')
219 . unitab ,lsubmodel)
220
221 CASE ('SECT' ,'TYPE12')
223 . unitab ,lsubmodel)
224
225 CASE ('WORK' ,'TYPE13')
227 . itabm1 ,unitab ,lsubmodel)
228
229 CASE ('ENERGY' ,'TYPE14')
231 . ipart ,subset ,unitab ,lsubmodel)
232
233 CASE ('DIST_SURF' ,'TYPE15')
235 . itabm1 ,unitab ,lsubmodel)
236
237 CASE ('HIC' ,'TYPE16')
239 . laccelm ,unitab ,lsubmodel)
240
241 CASE ('TEMP')
243 . igrnod ,unitab ,lsubmodel)
244
245 CASE ('NIC_NIJ')
247 . sensors%SENSOR_TAB(isen) ,sens_id ,titr ,iskwn ,
248 . unitab ,lsubmodel )
249
250 CASE ('USER1' ,'USER2','USER3')
251
252 sensors%SENSOR_TAB(isen)%TSTART = infinity
253
255 . unitab ,lsubmodel ,key ,unit_id ,sens_id ,
256 . sensors%SENSOR_TAB(isen),sensor_user_struct)
257 sensors%SENSOR_TAB(isen)%SENS_ID = sens_id
258 CASE('PYTHON')
259 CALL read_sensor_python(python,
260 . sensors%SENSOR_TAB(isen) ,sens_id , lsubmodel )
261
262 CASE DEFAULT
263 CALL ancmsg(msgid=43, anmode=aninfo, msgtype=msgerror,
264 . c2=key(1:len_trim(key)),
265 . i1=sens_id,
266 . c1=titr)
267 END SELECT
268
269 sensors%SENSOR_TAB(isen)%TITLE = titr
270
271 END DO
272
273
274
275 DO isen = 1,sensors%NSENSOR
276 IF (sensors%SENSOR_TAB(isen)%SENS_ID > 0) THEN
277 sid(isen) = sensors%SENSOR_TAB(isen)%SENS_ID
278 END IF
279 END DO
280 CALL udouble(sid,1,sensors%NSENSOR,mess,0,bid)
281 DEALLOCATE(sid)
282
283 RETURN
subroutine hm_option_count(entity_type, hm_option_number)
subroutine hm_option_start(entity_type)
integer, parameter nchartitle
subroutine read_sensor_acc(sensor_ptr, sens_id, titr, laccelm, unitab, lsubmodel)
subroutine read_sensor_and(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_disp(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine read_sensor_dist_surf(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine read_sensor_energy(sensor_ptr, sens_id, titr, ipart, subset, unitab, lsubmodel)
subroutine read_sensor_gauge(sensor_ptr, sens_id, titr, lgauge, unitab, lsubmodel)
subroutine read_sensor_hic(sensor_ptr, sens_id, titr, laccelm, unitab, lsubmodel)
subroutine read_sensor_nic(sensor_ptr, sens_id, titr, iskn, unitab, lsubmodel)
subroutine read_sensor_not(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_or(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_rbody(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_rwall(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_sect(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_sens(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_temp(sensor_ptr, sens_id, titr, igrnod, unitab, lsubmodel)
subroutine read_sensor_time(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_user(hm_nsensor, isen, title, unitab, lsubmodel, key, unit_id, sens_id, sensor_ptr, sensor_user_struct)
subroutine read_sensor_vel(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine read_sensor_work(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine sensor_tab_init(sensors)
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)
subroutine udouble(list, ilist, nlist, mess, ir, rlist)