首先让我们检查result = plxle.solve(model)的变量类型:输出结果显示result是一个类<class 'plxle.result.SolutionResult'>, 因此可以直接取出其中的值。下面按result的顺序取出各项之值。result.output_path取出结果的保存路径:
print(result.output_path)
result文件的第三项是model_info,所有的结果都保存在这个对象中,首先加载:
totals = json.loads(result.model_info)
然后查看totals的内容,由于totals是一个字典对象,因而也可以使用totals.keys()for each in totals:
print(each)
显示如下:
ModelProperties
ModelSettings
PoreWaterPressureSettings
AnalysisMethods
SlipSurfaceSettings
MaterialProperties
Results
ModelProperties显示模型名称,创建时间以及使用的单位。model_prop = totals["ModelProperties"]
print(model_prop)
for i in model_prop.items():
print(i[0],i[1])
Created 0001-01-01T00:00:00 [显示错误,plxle的问题]model_settings = totals["ModelSettings"]
for i in model_settings.items():
print(i[0],i[1])
FailureDirection Left to Right
(3) PoreWaterPressureSettings
PoreWaterPressureSettings提取与地下水相关的参数,包括水的密度、水压力类型、Ru、B-Bar以及每层土的水位线等。pwps = totals["PoreWaterPressureSettings"]
for i in pwps.items():
print(i[0],i[1])
PoreFluidUnitWeight 9.807 kN/m^3PoreWaterPressureType Water SurfacesApplicationOfRuCoefficient OffApplicationOfBBarParameters OffRegions ['Region - Upper Soil: Water Table Line 1', 'Region - Lower Soil: Water Table Line 1'](4) AnalysisMethods
AnalysisMethods提取与分析方法相关的参数值,包括使用的极限平衡方法、条分数量、收敛准则以及最大的迭代次数analysis_methods = totals["AnalysisMethods"]
for i in analysis_methods.items():
print(i[0],i[1])
MethodsUsed ['GLE (Interslice Force Function - Half-sine)']ConvergenceTolerance 0.0010000000474974513MaximumNumberOfIterations 50SlipSurfaceSettings用来提取滑动面设置的参数值,包括滑动面形状、搜索方法及其相应的其他参数。slip_surface = totals["SlipSurfaceSettings"]
print(sss)
for i in slip_surface.items():
print(i[0],i[1])
SlipSurfaceShape CircularSearchMethod Cuckoo SearchMaterialProperties用来提取土层的参数值,这个值的外层使用了list,内层使用了dict,因此提出方法与上面的方法稍有不同。mat_prop = totals["MaterialProperties"]
for i in mat_prop:
print(i)
{'MaterialName': 'Upper Soil', 'StrengthType': 'Mohr Coulomb', 'Properties': {'Cohesion': '5 (kPa)', 'Phi': '20 (deg)', 'Unit Weight': '15 (kN/m^3)'}}{'MaterialName': 'Lower Soil', 'StrengthType': 'Mohr Coulomb', 'Properties': {'Cohesion': '10 (kPa)', 'Phi': '25 (deg)', 'Unit Weight': '18 (kN/m^3)'}}mat_prop = totals["MaterialProperties"]
for i in mat_prop:
a = i["Properties"]
for each in a.items():
print(each[0],each[1])
Results提取全部的计算结果,首先提取计算方法和安全系数for fos in totals["Results"]:
print (fos['Method'])
print(fos['MomentFOS'])
print(fos['ForceFOS'])
final_results = fos['ResultsSummary']
for each in final_results.items():
print(each[0],each[1])
Search Method Cuckoo SearchTotal Weight 2.123E+003 kNTotal Volume 1.237E+002 m^3Total Activating Moment 1.331E+004 kNmTotal Resisting Moment 1.972E+004 kNmTotal Activating Force 6.046E+002 kNTotal Resisting Force 8.954E+002 kNRotation Center 24.830, 21.305 mSlip Surface Entry Point 6.772, 14.000 mSlip Surface Exit Point 33.772, 4.000 m
....