Is there a way to list of parameters of FMU (or of submodel in FMU) using the python libraries FMPy or pyFMI?

前端 未结 3 1952
遥遥无期
遥遥无期 2021-01-19 10:54

I have a FMU of a model and the use case is to change parameter values of the FMU to see the impact on the results. Is there a way to list top level parameters of the FMU us

3条回答
  •  盖世英雄少女心
    2021-01-19 11:27

    With fmpy you can loop over the modelVariables in the model description as follows:

    from fmpy import read_model_description
    from fmpy.util import download_test_file
    
    fmu_filename = 'CoupledClutches.fmu'
    
    download_test_file('2.0', 'CoSimulation', 'MapleSim', '2016.2', 'CoupledClutches', fmu_filename)
    
    model_description = read_model_description(fmu_filename)
    
    parameters = [v for v in model_description.modelVariables if v.causality == 'parameter']
    

提交回复
热议问题