00001
00002
00003
00004
00005
00006
00007
00008
00009 SUBROUTINE get_cnct_source_details ( id_XML_doc, &
00010 cda_xpath, &
00011 ld_coupling, &
00012 sd_source, &
00013 id_error )
00014
00015
00016
00017
00018
00019
00020 USE PSMILe_smioc
00021 IMPLICIT NONE
00022
00023
00024
00025
00026
00027
00028
00029 INTEGER, INTENT(In) :: id_XML_doc
00030
00031
00032 CHARACTER(len=*), INTENT(In) :: cda_xpath
00033
00034
00035 LOGICAL, INTENT(In) :: ld_coupling
00036
00037
00038 TYPE(transient_out), INTENT(InOut) :: sd_source
00039
00040
00041 INTEGER, INTENT(Out):: id_error
00042
00043
00044 CHARACTER(len=16) cla_source
00045
00046
00047 CHARACTER(len=18) cla_property
00048
00049
00050 CHARACTER(LEN=max_name) :: cla_char
00051 INTEGER :: il_test, il_length
00052 INTEGER :: il_exchange_rate
00053 DOUBLE PRECISION :: dl_test
00054
00055 INTEGER :: sasa_c_get_element_2nd_level_i
00056 INTEGER :: sasa_c_get_element_3rd_level_c
00057 INTEGER :: sasa_c_get_element_2nd_level_d
00058 INTEGER :: sasa_c_get_attri_2nd_level, sasa_c_get_attri_3rd_level
00059 INTEGER :: sasa_c_convert_char2int
00060
00061
00062 IF (ld_coupling) THEN
00063 cla_source = "couplingSource"
00064 cla_property = "couplingProperty"
00065 ELSE
00066 cla_source = "connectionSource"
00067 cla_property = "connectionProperty"
00068 ENDIF
00069
00070
00071 il_exchange_rate = -1
00072 id_error = &
00073 sasa_c_get_element_2nd_level_i (id_XML_doc, cda_xpath, 0, &
00074 "timeProfile", 0, "rate", 0, il_exchange_rate)
00075
00076
00077 if (il_exchange_rate .ne. -1 .and. il_exchange_rate .ne. PSMILe_undef) then
00078
00079
00080
00081
00082
00083
00084 sd_source%ig_exch_date_type = PSMILe_period
00085
00086
00087 cla_char = ' '
00088 id_error = &
00089 sasa_c_get_attri_2nd_level (id_XML_doc, cda_xpath, 0, &
00090 "timeProfile", 0, "units", cla_char, il_length)
00091 if (il_length .ne. 0) then
00092 if (cla_char .eq."seconds") then
00093 sd_source%sg_exch_date%sg_period%second = il_exchange_rate
00094 else if (cla_char .eq."minutes") then
00095 sd_source%sg_exch_date%sg_period%minute = il_exchange_rate
00096 else if (cla_char .eq."hours") then
00097 sd_source%sg_exch_date%sg_period%hour = il_exchange_rate
00098 else if (cla_char .eq."days") then
00099 sd_source%sg_exch_date%sg_period%day = il_exchange_rate
00100 else if (cla_char .eq."months") then
00101 sd_source%sg_exch_date%sg_period%month = il_exchange_rate
00102 else if (cla_char .eq."years") then
00103 sd_source%sg_exch_date%sg_period%year = il_exchange_rate
00104 else
00105 PRINT *, '***************************************************'
00106 PRINT *, 'Unsupported timeProfile units in XML data:', cla_char
00107 PRINT *, '***************************************************'
00108 CALL PSMILe_Flushstd
00109
00110 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00111 endif
00112 else
00113 PRINT *, '*****************************************'
00114 PRINT *, 'Unspecified timeProfile units in XML data'
00115 PRINT *, '*****************************************'
00116 CALL PSMILe_Flushstd
00117
00118 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00119 endif
00120 endif
00121
00122
00123 id_error = &
00124 sasa_c_get_element_2nd_level_d (id_XML_doc, cda_xpath, 0, &
00125 TRIM(cla_property)//'[name="add_scalar"]', 0, &
00126 "value", 0, dl_test)
00127 IF ( dl_test /= PSMILe_dundef ) THEN
00128 sd_source%sg_src_local_trans%dg_add_scalar = dl_test
00129 ENDIF
00130
00131
00132 id_error = &
00133 sasa_c_get_element_2nd_level_d (id_XML_doc, cda_xpath, 0, &
00134 TRIM(cla_property)//'[name="mult_scalar"]', 0, &
00135 "value", 0, dl_test)
00136 IF ( dl_test /= PSMILe_dundef ) THEN
00137 sd_source%sg_src_local_trans%dg_mult_scalar = dl_test
00138 ENDIF
00139
00140
00141
00142 id_error = &
00143 sasa_c_get_attri_3rd_level (id_XML_doc, cda_xpath, 0, &
00144 "timeTransformation", 0, "mappingType", 0, "value", cla_char, il_length)
00145 if (il_length > 0) then
00146 if (cla_char .eq. "TimeAverage") then
00147 sd_source%ig_src_timeop = PSMIle_tave
00148 else if (cla_char .eq. "TimeAccumulation") then
00149 sd_source%ig_src_timeop = PSMILe_tacc
00150 endif
00151 endif
00152
00153
00154 id_error = &
00155 sasa_c_get_element_2nd_level_i (id_XML_doc, cda_xpath, 0, &
00156 "timeLag", 0, "value", 0, il_test)
00157 if ( il_test /= PSMILe_undef .and. il_test /= 0) &
00158 sd_source%ig_lag = il_test
00159
00160
00161 id_error = &
00162 sasa_c_get_element_3rd_level_c (id_XML_doc, cda_xpath, 0, &
00163 TRIM(cla_source), 0, TRIM(cla_property)//'[name="scattering"]', 0, &
00164 "value", 0, cla_char, il_length)
00165 if (il_length > 0) then
00166
00167 sd_source%sg_src_local_trans%ig_scatter = sasa_c_convert_char2int(cla_char(1:il_length))
00168 endif
00169
00170
00171 id_error = &
00172 sasa_c_get_element_3rd_level_c (id_XML_doc, cda_xpath, 0, &
00173 TRIM(cla_source), 0, TRIM(cla_property)//'[name="statistics_masked_points"]', 0, &
00174 "value", 0, cla_char, il_length)
00175 if (il_length > 0) then
00176
00177 sd_source%iga_stats(1) = sasa_c_convert_char2int(cla_char(1:il_length))
00178 endif
00179
00180 id_error = &
00181 sasa_c_get_element_3rd_level_c (id_XML_doc, cda_xpath, 0, &
00182 TRIM(cla_source), 0, TRIM(cla_property)//'[name="statistics_notmasked_points"]', 0, &
00183 "value", 0, cla_char, il_length)
00184 if (il_length > 0) then
00185
00186 sd_source%iga_stats(2) = sasa_c_convert_char2int(cla_char(1:il_length))
00187 endif
00188
00189 id_error = &
00190 sasa_c_get_element_3rd_level_c (id_XML_doc, cda_xpath, 0, &
00191 TRIM(cla_source), 0, TRIM(cla_property)//'[name="statistics_all_points"]', 0, &
00192 "value", 0, cla_char, il_length)
00193 if (il_length > 0) then
00194
00195 sd_source%iga_stats(3) = sasa_c_convert_char2int(cla_char(1:il_length))
00196 endif
00197
00198
00199 id_error = &
00200 sasa_c_get_element_3rd_level_c (id_XML_doc, cda_xpath, 0, &
00201 TRIM(cla_source), 0, TRIM(cla_property)//'[name="debug_mode"]', 0, &
00202 "value", 0, cla_char, il_length)
00203 if (il_length > 0) then
00204
00205 sd_source%ig_debugmode = sasa_c_convert_char2int(cla_char(1:il_length))
00206 endif
00207
00208
00209 END SUBROUTINE get_cnct_source_details
00210
00211
00212