Jump to content
Tom_abc

Can parameter values be read in automatically to make many times of simulation

Recommended Posts

When estimating a "best" model, parameters need to be changed many times. Is there a simple way for users to make this process automatic in Embed?

For example, I would like to find the best parameter value of "a" in the model "a*2 = 5" (see "Example_a.vsm"). Then I can input a list of 10 possible values of "a" with "2.1, 2.2, 2.3, ..., 3.0". But every time, I have to connect and disconnect the arrow of "a" in Embed, and click "Go" icon for ten times. This process will be unaccepatable if there are many parameter vlaues to test. Are there some ways to make it automatic? That is, the Embed reads the candidate parameter vectors, and use each of them every time for the repeated simulations?

Example_a.vsm

Share this post


Link to post
Share on other sites

In addition one could

1) Also use the import block where in you could specify the time vs data and even have it come from a text/csv file ..etc.

2) Use the variable block and have at one place all the desired variables and change them as need be and it would reflect in all references.

 

 

--sreeram 

Share this post


Link to post
Share on other sites
2 hours ago, Girish Karamadi said:

Hi ,

 

I have attached the modified diagram. Please refer.

 

Regards,

Girish

Example_a_modified.vsm 12.06 kB · 1 download

Thanks for the introduction of "Case" block. It's useful for this example. But I was wondering if there are many candidate values, say 500 values for a sensitivity analysis, it will be hard to add 500 connectors to the "Case" block.

Share this post


Link to post
Share on other sites
2 hours ago, Sreeram Mohan said:

Use the variable block and have at one place all the desired variables and change them as need be and it would reflect in all references.

Could you explain a little bit about the Point 2? 

Share this post


Link to post
Share on other sites

Hi Tom, 

 

Attached is an example ! 

 

By the way you can find the variable block as below  and give it a name.Remember you can assign it only once but you could use it in how many ever instance and also as part of parameters in blocks. 

 

Please feel free to let me know if you need anything more. 

 

By the way if i may ask what are you using Embed for  . Would be useful to know to provide more inputs !

 

--sreeram

 

 

 

image.png.07449c1b7bccb05c67f13843dda2cb9f.png 

Example_a_with_variable.vsm

Share this post


Link to post
Share on other sites
42 minutes ago, Sreeram Mohan said:

By the way if i may ask what are you using Embed for  .

Hi Sreeram,

  I use Embed to build model with differential equations. When calibrating the model, I can change the parameter's value manually by my specialized background. However, if I need to check the sensitivity of one parameter, I may need to examine the many cases of its value around the calibrated value.

  See the simplified example in "Example_a_update.vsm". In this example, I would like to do the sensitivity analysis of the model "a*y + y_dot + 5 = 0". Say, I first calibrated it and got the value of "a" with "5.2". Then I want to check the model's response with the value "4.51, 4.52, 4.53, ..., 5.2, 5.21, 6.00,...".

  Under this circumstance, I need to change the parameter's value hundreds or thousands of times. So I was wondering if there are some ways to automatically read parameter values and run the model.

Example_a_update.vsm

Share this post


Link to post
Share on other sites
1 hour ago, Ric said:

 using the "Auto Restart"

Hi Ric,

  Thanks, your method is very suitable for this condition. May I ask one more queation. When running a sensitivity analysis, sometimes we generate random values from outside instead of using the values with same increments. For example, attached is 100 random values of "a", and I saved in a txt file ("candidate_a.txt") for Embed to read. Based on your method, I tried to use "import" block to assign the variable. I tried to type "$runCount" in the "Start Row" box to make Embed read one value at each run. However, when I close the dialog, "Start Row" box became "1" again (see "Fig1.png"). Do you know if there are some ways to import the candidate values outside into the Embed when using "Auto Restart"?

Fig1.png.35fc966c9e819090ead49292d7b54137.png

candidate_a.txt

Share this post


Link to post
Share on other sites

Hi Tom, 

 

Can you try this example attached that has a way to use a 1D map block which might make things easier in this case uses a 1D map block. You may have to browse the candidate_a_map.csv in the 1D map block and it should give you the ability to use the $runcount or any other input and select the entry from the available values. 

 

--sreeram 

image.thumb.png.b640fe8edd4ec74407e6b4af0fa766cf.png

 

 

Forum_question.vsm Candidate_a_map.csv

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...