简体   繁体   English

如何在 Anylogic 中的每个模拟日更新 excel 文件中的参数值

[英]How to update parameter value from excel file on each simulation day in Anylogic

I am working on a model in which I have a parameter called supply.我正在研究一个模型,其中有一个名为 supply 的参数。 This parameter should change on a daily basis as I have a different supply amount of raw materials each day.这个参数应该每天都在变化,因为我每天都有不同的原材料供应量。 I am using an excel file containing a column called supply and 10 rows (supply values for 10 days).我正在使用一个包含名为 supply 的列和 10 行(10 天的供应值)的 excel 文件。

My question is how can I use this excel file as input and have the model read the first row on day one, 2nd row on day 2, etc. Updating the parameter on each simulation day.我的问题是如何使用这个 excel 文件作为输入并让模型在第一天读取第一行,在第二天读取第二行等。在每个模拟日更新参数。

I am using the Anylogic personal learning edition.我正在使用 Anylogic 个人学习版。

  1. Loop across all dbase entries at the start of the model (using the database query wizard, choose option "iterate over returned rows and do something").在模型开始时遍历所有 dbase 条目(使用数据库查询向导,选择选项“迭代返回的行并执行某些操作”)。
  2. for each row, compute the duration from model start to what the row represents对于每一行,计算从模型开始到行所代表的持续时间
  3. for each row, create a Dynamic Event (on Main or wherever) using create_MyDynamicEvent(x, HOUR) where x is the duration from point 2 above, in hrs.对于每一行,使用create_MyDynamicEvent(x, HOUR)创建一个动态事件(在 Main 或任何地方),其中 x 是从上面第 2 点开始的持续时间,以小时为单位。 Give it an argument quantity and provide the current row's value给它一个参数quantity并提供当前行的值
  4. in the Dynamic Event, you change your parameter with the value provided, ie set_myParam(value)在动态事件中,您使用提供的值更改参数,即set_myParam(value)

You can also use a schedule or a source to do this, but the approach would be quite different.您也可以使用时间表或来源来执行此操作,但方法会完全不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM