00001
00002
00003
00004
00005
00006
00007
00008
00009 SUBROUTINE get_transi_io_numbers ( id_XML_doc, &
00010 id_nb_transi, &
00011 ida_nb_stand_name, &
00012 ida_nb_transi_in, &
00013 ida_nb_transi_out, &
00014 id_comp, &
00015 cda_app_name, &
00016 cda_comp_name, &
00017 ld_first_details, &
00018 id_error )
00019
00020
00021
00022
00023
00024
00025
00026 USE PSMILe_smioc
00027 IMPLICIT NONE
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 INTEGER, INTENT(In) :: id_XML_doc
00039
00040
00041 INTEGER, INTENT(In) :: id_nb_transi
00042
00043
00044 INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_stand_name
00045
00046
00047 INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_transi_in
00048
00049
00050 INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_transi_out
00051
00052
00053 INTEGER, INTENT(In) :: id_comp
00054
00055
00056 CHARACTER(len=*), INTENT(In) :: cda_app_name
00057 CHARACTER(len=*), INTENT(In) :: cda_comp_name
00058
00059
00060 LOGICAL, INTENT(In) :: ld_first_details
00061
00062
00063 INTEGER, INTENT(Out) :: id_error
00064
00065
00066 INTEGER :: ib, ib_nt, ib_xml, ib_u
00067 INTEGER :: il_xml_transi
00068
00069 #if CIM
00070
00071 Character(len=max_name), Allocatable :: cla_transient_name(:)
00072 INTEGER :: il_length
00073
00074
00075 CHARACTER(len=282) :: cla_model_appli
00076 CHARACTER(len=282) :: cla_model_comp
00077 CHARACTER(len=282) :: cla_ref_comp
00078
00079
00080 INTEGER :: il_nb_couplings, il_coupling, il_test
00081
00082 INTEGER :: il_connection
00083
00084 Character(len=max_name) :: cl_connection_end
00085
00086
00087 INTEGER, PARAMETER :: nerrp = 2
00088 INTEGER :: ierrp (nerrp)
00089
00090 INTEGER :: sasa_c_get_number_3rd_level, sasa_c_get_number_6th_level, sasa_c_get_number_8th_level
00091 INTEGER :: sasa_c_get_element_7th_level_c
00092 #else
00093 INTEGER :: sasa_c_get_number_3rd_level, sasa_c_get_number_4th_level
00094 INTEGER :: sasa_c_get_number_5th_level
00095 #endif!
00096
00097
00098
00099
00100
00101
00102 IF ( ld_first_details ) THEN
00103 il_xml_transi = id_nb_transi
00104 ELSE
00105 il_xml_transi = id_nb_transi - iga_comp_nb_udef(id_comp)
00106 ENDIF
00107
00108 #if CIM
00109
00110
00111
00112
00113 ALLOCATE (cla_transient_name(il_xml_transi), stat=id_error )
00114 IF (id_error > 0) THEN
00115 ierrp (1) = id_error
00116 ierrp (2) = il_xml_transi
00117 id_error = 13
00118
00119 CALL Psmile_Error_Common ( id_error, 'cla_transient_name', &
00120 ierrp, 2, __FILE__, __LINE__ )
00121 RETURN
00122 ENDIF
00123
00124
00125
00126 cla_model_appli = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_app_name)//'"]'
00127 cla_model_comp = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_comp_name)//'"]'
00128
00129
00130
00131
00132 DO ib =1, il_xml_transi
00133
00134
00135 id_error = &
00136 sasa_c_get_number_8th_level (id_XML_doc, &
00137 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00138 "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00139 TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", ib, &
00140 "componentProperty", ida_nb_stand_name(ib))
00141
00142 if (ida_nb_stand_name(ib) .eq. 0) then
00143
00144 id_error = &
00145 sasa_c_get_number_8th_level (id_XML_doc, &
00146 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00147 "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00148 TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", ib, &
00149 "standardName", ida_nb_stand_name(ib))
00150 else
00151
00152
00153 ida_nb_stand_name(ib) = ida_nb_stand_name(ib) + 1
00154 endif
00155 ENDDO
00156
00157
00158
00159
00160 DO ib =1, il_xml_transi
00161 cla_transient_name(ib) = ' '
00162 id_error = &
00163 sasa_c_get_element_7th_level_c (id_XML_doc, &
00164 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00165 "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00166 TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", ib, &
00167 "shortName", 0, cla_transient_name(ib), il_length)
00168 ENDDO
00169
00170
00171 id_error = &
00172 sasa_c_get_number_3rd_level (id_XML_doc, &
00173 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00174 "composition", 0, "coupling", il_nb_couplings)
00175
00176
00177
00178
00179 ida_nb_transi_in(:) = 0
00180 ida_nb_transi_out(:) = 0
00181
00182
00183 cla_ref_comp = 'reference[normalize-space(name)="'//TRIM(cda_comp_name)//'"]'
00184
00185
00186 DO il_coupling =1, il_nb_couplings
00187
00188 id_error = &
00189 sasa_c_get_number_6th_level (id_XML_doc, &
00190 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00191 "composition", 0, "coupling", il_coupling, "couplingSource", 0, &
00192 "dataSource", 0, TRIM(cla_ref_comp), il_test)
00193
00194
00195
00196 if (il_test > 0) then
00197
00198
00199 il_connection = 1
00200 DO WHILE (.true.)
00201
00202 cl_connection_end = ' '
00203 id_error = &
00204 sasa_c_get_element_7th_level_c (id_XML_doc, &
00205 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00206 "composition", 0, "coupling", il_coupling, "connection", il_connection, &
00207 "connectionSource", 0, "dataSource", 0, "reference", 0, "name", 0, &
00208 cl_connection_end, il_length)
00209
00210 IF (il_length .ne. 0) then
00211
00212
00213
00214 DO ib =1, il_xml_transi
00215 IF (cl_connection_end .eq. cla_transient_name(ib)) then
00216
00217 ida_nb_transi_out(ib) = ida_nb_transi_out(ib) + 1
00218 exit
00219 ENDIF
00220 ENDDO
00221
00222
00223 il_connection = il_connection + 1
00224
00225 ELSE
00226
00227 exit
00228 ENDIF
00229 ENDDO
00230 endif
00231
00232
00233 id_error = &
00234 sasa_c_get_number_6th_level (id_XML_doc, &
00235 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00236 "composition", 0, "coupling", il_coupling, "couplingTarget", 0, &
00237 "dataSource", 0, TRIM(cla_ref_comp), il_test)
00238
00239
00240
00241 if (il_test > 0) then
00242
00243
00244 il_connection = 1
00245 DO WHILE (.true.)
00246
00247 cl_connection_end = ' '
00248 id_error = &
00249 sasa_c_get_element_7th_level_c (id_XML_doc, &
00250 "simulationComposite/child/simulationRun/model/modelComponent", 0, &
00251 "composition", 0, "coupling", il_coupling, "connection", il_connection, &
00252 "connectionTarget", 0, "dataSource", 0, "reference", 0, "name", 0, &
00253 cl_connection_end, il_length)
00254
00255 IF (il_length .ne. 0) then
00256
00257
00258
00259 DO ib =1, il_xml_transi
00260 IF (cl_connection_end .eq. cla_transient_name(ib)) then
00261
00262 ida_nb_transi_in(ib) = ida_nb_transi_in(ib) + 1
00263 exit
00264 ENDIF
00265 ENDDO
00266
00267
00268 il_connection = il_connection + 1
00269
00270 ELSE
00271
00272 exit
00273 ENDIF
00274 ENDDO
00275 endif
00276
00277 ENDDO
00278
00279 #ifdef DEBUG
00280 print *, "component name: ", cda_comp_name
00281 print *, "ida_nb_transi_in : ", ida_nb_transi_in(:)
00282 print *, "ida_nb_transi_out : ", ida_nb_transi_out(:)
00283 #endif
00284
00285 DEALLOCATE (cla_transient_name)
00286 #else
00287
00288
00289
00290
00291 DO ib =1, il_xml_transi
00292 id_error = &
00293 sasa_c_get_number_3rd_level(id_XML_doc, &
00294 'component', 0, 'transient', ib, 'transient_standard_name', &
00295 ida_nb_stand_name(ib))
00296 print *,' get_transi_io_numbers id_error stand_name ib = ',ib, id_error
00297
00298 id_error = &
00299 sasa_c_get_number_5th_level(id_XML_doc, &
00300 'component', 0, 'transient', ib, 'intent', 0, &
00301 'input', 0, 'origin', ida_nb_transi_in(ib))
00302 print *,' get_transi_io_numbers id_error transi_in ib = ',ib, id_error
00303
00304 id_error = &
00305 sasa_c_get_number_4th_level(id_XML_doc, &
00306 'component', 0, 'transient', ib, 'intent', 0, &
00307 'output', ida_nb_transi_out(ib))
00308 print *,' get_transi_io_numbers id_error transi_out ib = ',ib, id_error
00309 END DO
00310 #endif
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320 IF ( .NOT. ld_first_details ) THEN
00321
00322 ib_nt = 0
00323 DO ib_u = il_xml_transi + 1, id_nb_transi
00324 ib_nt = ib_nt + 1
00325
00326 ib_xml = sga_comp_udef_idx(id_comp)%iga_xml_trindex(ib_nt)
00327
00328 ida_nb_stand_name(ib_u) = ida_nb_stand_name(ib_xml)
00329
00330 IF ( ida_nb_transi_in(ib_xml) .NE. 0 ) THEN
00331 ida_nb_transi_in(ib_u) = 1
00332 ELSE
00333 ida_nb_transi_in(ib_u) = 0
00334 ENDIF
00335
00336 IF ( ida_nb_transi_out(ib_xml) .NE. 0 ) THEN
00337 ida_nb_transi_out(ib_u) = 1
00338 ELSE
00339 ida_nb_transi_out(ib_u) = 0
00340 ENDIF
00341 ENDDO
00342
00343 ENDIF
00344
00345 END SUBROUTINE get_transi_io_numbers
00346
00347
00348