Jump to content
Sign in to follow this  
VisSim Forum Archives

startup script

Recommended Posts


Submitted by robin_a on Tue, 02/28/2012 - 15:16 

I've tried using a startup script but can't access the variables defined in the c file. I assume that i'm missing something from the syntax, as i can get vissim to throw an error if i miss the semicolon. I've tried float double or no type, but whatever i do the variable block in the vissim model returns 0. please can someone explain what i'm doing wrong,



I tried to upload my simple case but restrictive we b policy means i cant. Basically i have a file called var.c stored in the root of c: with the following contents:

float var1 = 10;

The vissim model references this (with the whole path) then i have a variable block which references var1. when i run vissim i get no error but the variable just returns 0.

Share this post

Link to post
Share on other sites

Submitted by Anders89 on Tue, 02/28/2012 - 23:53.

Hi Robin,
Your problem is that you are using a VisSim variable block to reference a C variable. The VisSim variable block only defines and references other VisSim variables, not variables from the C namespace. You must use a block that uses the C interpreter like a const block or expression block to access the C name space. The const block will evaluate a C expression once at sim start, the expression block will be evaluated at each time step.

Share this post

Link to post
Share on other sites

Submitted by robin_a on Thu, 03/08/2012 - 20:03.

thanks for your help, I now have the script file working ....sort of. It only works with 1 constant definition. I had hoped to define a script file with all constants in the model. e.g.

const1 = 1; const2 = 2; const3 = 3; etc.

When i try this, only const1 is valid. Is this multiple definition possible, i can't imagine that i can only define 1 constant in a script file. Have I got the syntax wrong?

Thanks for you help


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.

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.

Sign in to follow this  

  • Create New...