How to publish a model using DLLs?

Use this forum to post Vensim related questions.
Post Reply
PaulHUGUES
Junior Member
Posts: 4
Joined: Wed Nov 14, 2018 5:00 pm
Vensim version: DSS

How to publish a model using DLLs?

Post by PaulHUGUES »

Hi there,

I'm trying to set up a script to "automatically" publish a .mdl file using Vensim DLLs.

After having been through the Vensim documentation, I thought I should use the Venapp Commands through but I could not find one that converts a mdl to a vpmx file.

Could you please kindly indicate me what is the right way to perform this action?

Thanks a lot,

Paul
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: How to publish a model using DLLs?

Post by Administrator »

You'll need to set up a form for publishing, and then us that when calling
FILE>PUBLISH|frmfile

https://www.vensim.com/documentation/25033.html
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
PaulHUGUES
Junior Member
Posts: 4
Joined: Wed Nov 14, 2018 5:00 pm
Vensim version: DSS

Re: How to publish a model using DLLs?

Post by PaulHUGUES »

Thank you very much for your reply.

I made a series of tests but I have not been able to make it work, i.e. publish the IND_2023_Master.mdl to IND_2023_Master.vpmx.
Here is the Vensim version I use: DSS 9.2.3 x64, Build TK-220328.00133, on Windows 10 22H2.

And below is the VB code I tried

Code: Select all

 
'Option Explicit

Public Declare PtrSafe Function vensim_command Lib "vendll64.dll" (ByVal Vcommand$) As Long

 Sub Publish_Vensim_Model()

    Dim bln_return As Integer
    Dim strCmd As String
    
    bln_return = 1
    strCmd = \\path\DocumentsVensimScript.cmd
    bln_return = vensim_command(strCmd)

End Sub

With DocumentsVensimScript.cmd as

Code: Select all

SPECIAL>LOADMODEL|G:\EO2023\Model\Demand\_Master\IND\blank.vpmx
FILE>PUBLISH|IND_master.frm
and IND_master.frm as

Code: Select all

PublishSettings
561
1,0,0,0
0
1,1,1,1,1,1
0,0,0,0

Vensim® DSS Version 9.2.3 x64 (x64), Build : TK-220328.00133 Serial #1694002  Windows  8 (or greater)
IND_2023_Master.vpmx
IND_2023_Master.mdl
By the way, when running the VB script below

Code: Select all

Sub Publish_Vensim_Model()

    Dim bln_return As Integer
    Dim strCmd As String
    
    bln_return = 1
    strCmd = "SPECIAL>LOADMODEL|G:\EO2023\Model\Demand\_Master\IND\IND_2023_Master.mdl"
    bln_return = vensim_command(strCmd)

End Sub
I got the following error whereas, from the documentation, I understood that "You can load both text format model (.mdl files) and binary format models (.vmf) files as well as packaged models." Not sure if there is link, but I preferred to flag
Capture.PNG
Capture.PNG (4.07 KiB) Viewed 2699 times

Thanks a lot for your help,

Paul
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: How to publish a model using DLLs?

Post by Administrator »

Sorry, I misunderstood your first mesage.

No, you cannot do this via the DLL. The DLL will only open published models, so there is no way to get the MDL file into the DLL in order to publish it. You need to run these commands in Vensim via a command script.
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