Error when using subscripts.

Use this forum to post Vensim related questions.
Post Reply
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Error when using subscripts.

Post by nikvyas »

Hello again.

I have a problem when using subscripts - it doesn't work!

I've defined a subscript [training platform] which contains a range of 5. I then have the following equation:

test[training platform] = DS TRAINING PATTERN[Training Platform], FTD TRAINING PATTERN[Training Platform],PTT TRAINING PATTERN[Training Platform],RCT TRAINING PATTERN[Training Platform],SFET TRAINING PATTERN[Training Platform]

Where each of the five patterns are a series of pulses (obviously defined elsewhere in the model) - eg:

DS TRAINING PATTERN[Training Platform]= PULSE TRAIN( 176 , 5, 168, 8400 )+PULSE TRAIN( 183 , 5,168,8400 )+PULSE TRAIN(200 ,5 ,168, 8400)+PULSE TRAIN(208,3,168,8400)+PULSE TRAIN( 224 , 5, 168, 8400 )+PULSE TRAIN( 231 , 5,168,8400 )+PULSE TRAIN(248 ,5 ,168, 8400)+PULSE TRAIN(256,3,168,8400)+PULSE TRAIN( 272 , 5, 168, 8400 )+PULSE TRAIN( 279 , 5,168,8400 )


However, I get an error message saying Incorrect/Incomplete equation - but I don't see what is incomplete.

Thanks

Nik

[Edited on 7-6-2006 by nikvyas]
Administrator
Super Administrator
Posts: 4835
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

You have your syntax wrong.

What are you trying to do here?

test[training platform] = DS TRAINING PATTERN[Training Platform], FTD TRAINING PATTERN[Training Platform],PTT TRAINING PATTERN[Training Platform],RCTTRAINING PATTERN[Training Platform],SFET TRAINING PATTERN[Training Platform]

Tony.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

At a guess you intend

TrainingPlatform: DS,FTP,PTT,RCT,SFET ~~|

test[DS] = DS TRAINING PATTERN ~~|
test[FTP] = FTP TRAINING PATTERN ~~|
....
test[SFET] = SFET TRAININT PATTERN ~ Widget/Week ~|

That is, one equation for each subscript element and no subscripts on the test inputs. Use the Add Eq button to add multiple equations in the equation editor.
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Post by nikvyas »

Thanks Bob - but I still get error messages. I did what you suggested as follows:

TrainingPlatform: DS, FTP, PTT, RCT, SFET

and then added the following to the "test" box variable:

test[TrainingPlatform]=DS TRAINING PATTERN

Then using the add eq button:

test[TrainingPlatform]=FTP TRAINING PLATFORM

and so on, for PTT, RCT and SFET. So now I have 5 equations within test[TrainingPlatform].

However, when I run it I get the message:

Incorrect number of subscripts for - DS TRAINING PATTERN
Incorrect number of subscripts for - FTP TRAINING PATTERN
Incorrect number of subscripts for - PTT TRAINING PATTERN
Incorrect number of subscripts for - RCT TRAINING PATTERN
Incorrect number of subscripts for - SFET TRAINING PATTERN


As usual, help greatly appreciated.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You obviously need to remove the subscripts from the equations for DS TRAINING PATTERN etc and use the equations I specified, not the ones you used.

Chapter 17 of the User's Guide covers subscripts - this is a must read!
Post Reply