Accessing model variables in an ActiveX component

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

Accessing model variables in an ActiveX component

Post by Herve - IPSIS »

Hello,

I tried the ActiveX sample project with C-Roads and got some troubles in accessing model variables :
Before launching a simulation run, I can get and set any value.
After having run the simulation, I can only read, but not set any value.

Here are the steps to reproduce the problem :
  • 1) Add the ActiveX sample VBDemoControl to C-Roads sable project (using the files stored in
    MODEL.zip
    (234.78 KiB) Downloaded 869 times
    )
    2) Open C-Roads project in Sable developper
    3) Open the VBDemoControl window
    4) Create a new run with aggregation value "15 Region"
    5) Using the VBDemoControl window, set the following values :
    • Pct change in FF emissions sable[China] = -50
      ff change target year ecr sable[China] = 2030
      ecr target by rs sable[China] = 2
    6) In the VBDemoControl window, click "Sim Run"
    => The simulation runs, the CO2 FF emissions of China decrease
    7) Using the VBDemoControl window, set now the following value :
    Pct change in FF emissions sable[China] = +30
    => The value is not set. Pct change in FF emissions sable[China] value is still -50
Administrator
Super Administrator
Posts: 4667
Joined: Wed Mar 05, 2003 3:10 am

Re: Accessing model variables in an ActiveX component

Post by Administrator »

Can you email the entire project to me? I cannot figure out what is wrong with just the OCX to use.
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: Accessing model variables in an ActiveX component

Post by Herve - IPSIS »

Hello,

I got it working : C-Roads scripts reinitialize the SYNTHESIM mode. I called the same Venapp commands from my OCX and could modify values after a simulation run :

SYNTHESIM>AUTO|0
SYNTHESIM>AUTO|1
SYNTHESIM>GO|
SetData(data, value)
SimRun()

Hervé
Post Reply