Getting and setting variables at a given time

Use this forum to post Sable related questions.

Moderator: Administrator

Post Reply
Herve - IPSIS
Junior Member
Posts: 4
Joined: Fri May 23, 2014 9:00 am
Vensim version: DSS

Getting and setting variables at a given time

Post by Herve - IPSIS »

Hello Tony,

I would like to get and set model variables at a given time from an ActiveX component.
I tried to call OCX_SETVALUE and OCX_GETVALUE commands, using the following syntax for the variable name : "myvariable[mysubcriptelement]@mytime" (for example : C in Atmosphere[Deterministic]@2035)

Unfortunately, it looks like only the end time value is read and set, whatever time is written after the "@" character.

Could you please tell me how to read and update those values from an ActiveX component ?
Best regards,
Hervé
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Getting and setting variables at a given time

Post by Administrator »

There is a new version uploaded that will allow "parameter@time" now. Let me know if it works ok for you.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Herve - IPSIS
Junior Member
Posts: 4
Joined: Fri May 23, 2014 9:00 am
Vensim version: DSS

Re: Getting and setting variables at a given time

Post by Herve - IPSIS »

Thank you a lot

This works now.

Hervé
cphan
Junior Member
Posts: 16
Joined: Mon Jun 16, 2014 3:31 pm
Vensim version: DSS

Re: Getting and setting variables at a given time

Post by cphan »

I've tried "parameter@time" for a variable of type "data" but it did not work. Does it work for all types of variables or for only variable of type "auxiliary"?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Getting and setting variables at a given time

Post by Administrator »

What errors are you getting? It should work, but only if a data point exists at the specific time you are asking for.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
cphan
Junior Member
Posts: 16
Joined: Mon Jun 16, 2014 3:31 pm
Vensim version: DSS

Re: Getting and setting variables at a given time

Post by cphan »

I've used your example DLL VBDemoControl in order to get the variable value.
Here is my test project. I try to get "Data Variable@2005", it does not work. But "Data Variable Auxiliary@2005" works fine.
Attachments
test.zip
(260.94 KiB) Downloaded 586 times
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Getting and setting variables at a given time

Post by Administrator »

I've tried this project, there is no call to get the data (or I cannot see it).

Can you give me step by step instructions please?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
cphan
Junior Member
Posts: 16
Joined: Mon Jun 16, 2014 3:31 pm
Vensim version: DSS

Re: Getting and setting variables at a given time

Post by cphan »

I open the project with Sable Developer, then run the DLL VBDemoControl in "External Dlls" folder. In DLL's window, I try to get data.
Attachments
get_data_variable.png
get_data_variable.png (234.2 KiB) Viewed 13380 times
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Getting and setting variables at a given time

Post by Administrator »

I'll have to raise this as a Vensim bug, I have no workaround for now. Sorry.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Post Reply