如何使用以前的仿真解决方案初始化模型? [英] How to initialize model with previous simulation solution?

查看:43
本文介绍了如何使用以前的仿真解决方案初始化模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的想法又用完了,我求助于你.

Having run out of ideas again I turn to you.

我确定这个问题之前已经回答过了,但我一生都找不到对它的清晰描述.

I'm sure this has to have been answered before though for the life of me I can't find a clear description of it.

场景:

您努力使用初始猜测等建立模型,然后求解模型中所有参数的真实"稳态 (SS) 条件.从这个解决方案中,我想调查事件对系统的影响.

You work hard to get a model all set up with initial guesses, etc., and then solve for the 'real' steady state (SS) condition of all parameters in the model. From this solution I want to investigate events effects on the system.

为了执行这种与 SS 分析的偏差,能够简单地加载具有 Dymola 已生成的所有模型参数的 SS 解决方案 .mat 文件将是有利的.加载此解决方案消除了在执行与 SS 调查的偏差之前首先模拟模型以获得 SS 解决方案的任何需要.我可以想象,发生这种情况的一个可能步骤是在模拟的'初始化'阶段.

To perform this deviation from SS analysis, it would be expedient to be able to simply load the SS solution .mat file with all the model parameters that is already generated by Dymola. Loading this solution removes any need to first simulate the model to achieve the SS solution before performing the deviations from the SS investigations. I can conceive that a possible step at which this takes place is during the 'Initialization' phase of the simulation.

鉴于这似乎是一个重要的概念,我想这个想法会在 Modelica/Dymola 开发的早期阶段就考虑到.鉴于这些模型的大小很快变得非常大,手动提取每个单独的参数似乎并不合适.

Given that this would seem to be an important concept, I imagine that this idea would have been considered from a very early stage of Modelica/Dymola development. Manual extraction of each individual parameter does not seem proper given that the size of these models quickly become very large.

问题:

  1. 是否可以解决模型的状态(.mat 文件)和然后将该模拟加载为所有变量的初始"值?(这将覆盖/替换之前的初始猜测系统)
  2. 如果可能,这是如何实现的?(运行一些脚本,一些隐藏菜单选项,在模型/模拟中添加某种导入命令?)

非常感谢您的帮助.我正在使用 Dymola 2016.

I very much appreciate your help. I am using Dymola 2016.

推荐答案

我在上面发布的问题中找到了以下答案.

I have found the following answers to my own questions posted above.

matth 还指出了以下有关该主题的有用参考:http://claytex.com/blog/how-to-restart-a-simulation

这些是 Dymola 的说明.我无法验证它们是否适用于其他基于 Modelica 的程序.我还在 Dymola 用户手册第 1 卷第 5.3.3 节模拟 > 继续 > 导入初始/继续中找到了一些文档.

These are instructions for Dymola. I cannot verify if they are applicable to other Modelica based programs. I also found some documentation in the Dymola User Manual Volume 1 Section 5.3.3 Simulation > Continue > Import Initial/Continue.

1) 是的,可以从生成的 .mat 文件启动模型.您也可以从 dsfinal.txt 文件继续它.

1) Yes it is possible to start your model from the generated .mat file. You can also continue it from the dsfinal.txt file.

2) 以下是使用 GUI 的步骤:

2) Below are the steps using the GUI:

  • 备份YOUR_MODEL.mat"文件(例如 YOUR_MODEL_orig.txt).运行模拟后,将创建一个新的 .mat 文件,您可能不希望意外覆盖它.
  • 翻译您的模型.
  • 在功能区中,转到模拟">继续">导入初始值".选择要继续模拟的 .mat 文件.
  • 将生成一个提示,要求输入指定范围的时间.这使您可以在 .mat 模拟结果中的任何时间点继续进行模拟.
  • 转到模拟设置并选择新的模拟参数.如果您希望解决方案将开始时间注册为 0 而不是一些与初始 SS 模拟相关联的大数字,则将开始时间"更新为 0.这不会影响用于来自 Model_Sim.mat 文件的参数数据的初始时间.
  • 现在模拟模型.将从您指定的点开始生成一个新的 .mat 文件.

替代方法:(虽然这种方法很奇怪,但似乎没有生成或更新 .mat 文件.)

Alternative method: (an odd thing though with this method no .mat file seems to be generated or updated.)

  • 备份dsfinal.txt"文件(例如 dsfinal_orig.txt).运行模拟后,将创建一个新的 dsfinal.txt 文件,您可能不希望意外覆盖它.
  • 翻译您的模型.
  • 在功能区中,转到模拟">继续">继续".按下此选项后,模拟将开始使用路径上的任何 dsfinal.txt 文件.
  • 模拟现在将从生成 dsfinal.txt 文件的模拟的最终条件开始.
  • 如果希望在时间 0 开始,则可以修改 dsfinal.txt 文件(对我来说是第 9、10 和 12 行),它对应于模拟开始 (9)、停止 (10) 和时间步数(12).这似乎可以解决问题.

这篇关于如何使用以前的仿真解决方案初始化模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆