Passing string constants through a data file
Passing string constants through a data file
Hi,
I can pass string constants through a .cin file. But when I am interested to use only a subset, I get errors like
"Too many values or unrecognizable value format" and
"bad type, incorrectly subscripted or not found".
I'd like to avoid .cin input errors by having all model data, including string constants in a .vdfx data model.
Are string constants save to a .vdfx file? Can string constants be read in from a .vdfx file?
Best regards,
Rob
I can pass string constants through a .cin file. But when I am interested to use only a subset, I get errors like
"Too many values or unrecognizable value format" and
"bad type, incorrectly subscripted or not found".
I'd like to avoid .cin input errors by having all model data, including string constants in a .vdfx data model.
Are string constants save to a .vdfx file? Can string constants be read in from a .vdfx file?
Best regards,
Rob
Re: Passing string constants through a data file
Here are two example models that show the problem.
- Attachments
-
- sample_uses_datamodel.mdl
- (1.38 KiB) Downloaded 149 times
-
- sample_datamodel.mdl
- (1.15 KiB) Downloaded 147 times
Re: Passing string constants through a data file
I think data i/o only works for numeric values. Strings would have to be in a .cin.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Super Administrator
- Posts: 4605
- Joined: Wed Mar 05, 2003 3:10 am
Re: Passing string constants through a data file
String variables are stored in the VDFX file. I think the only way to get them would be a new function like "GET STRINGVAR FROM VDFX FILE" as you cannot define a data variable to be of type string.
I'll add it to the list of things to do.
I'll add it to the list of things to do.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Passing string constants through a data file
What's the use case for this?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Passing string constants through a data file
The application is supply chain for raw materials. There are ~1600 finished goods, and ~7300 raw parts. Since the FG and raw part names are long and awkward, I'd rather define subscript names in a convenient way,
FG : (f1-f600) and
part: (r1-r7300)
Since I cannot remember what part number r4545 is, I want to put a string in the plot title, e.g. \rname[r4545]/
So there string constants with the names of the finished goods and part numbers, fname[FG], rname[part]. These are long, and don't change, so I don't want to have to mess with them very much.
Since the model ends up being large (read: slow), I'd like to test it out with only a few finished goods and their complete bills of materials. I do this by
FG: f140,f256,f1234
But when I pass the string constants in the .cin files, I get errors for all the subscripts that are no longer defined.
The only way I can see to do this now is to make new .cin with only the subset of finished goods and part numbers (which makes it somewhat harder to construct the test case, but is doable).
FG : (f1-f600) and
part: (r1-r7300)
Since I cannot remember what part number r4545 is, I want to put a string in the plot title, e.g. \rname[r4545]/
So there string constants with the names of the finished goods and part numbers, fname[FG], rname[part]. These are long, and don't change, so I don't want to have to mess with them very much.
Since the model ends up being large (read: slow), I'd like to test it out with only a few finished goods and their complete bills of materials. I do this by
FG: f140,f256,f1234
But when I pass the string constants in the .cin files, I get errors for all the subscripts that are no longer defined.
The only way I can see to do this now is to make new .cin with only the subset of finished goods and part numbers (which makes it somewhat harder to construct the test case, but is doable).
-
- Super Administrator
- Posts: 4605
- Joined: Wed Mar 05, 2003 3:10 am
Re: Passing string constants through a data file
Are they errors or warnings? We changed the behaviour some time ago so that if an error was encountered, you could still contine.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Passing string constants through a data file
One other option: use GET XLS SUBSCRIPTS or the GET DIRECT equivalent to define them.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Passing string constants through a data file
The messages are errors.Administrator wrote: ↑Fri Feb 12, 2021 8:58 pmAre they errors or warnings? We changed the behaviour some time ago so that if an error was encountered, you could still contine.
-
- Super Administrator
- Posts: 4605
- Joined: Wed Mar 05, 2003 3:10 am
Re: Passing string constants through a data file
Try
pname[p3] :is: 'Third'
pname[p3] :is: 'Third'
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Passing string constants through a data file
Right - the syntax should be the same as an equation: = for numbers, :is: for strings.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Passing string constants through a data file
I get basically the same result.
I should have mentioned that the .cin file for my test had three elements. Only the element in the .cin file but not in the model causes the error. Sample model and both .cin files attached.
Best regards,
Rob
I should have mentioned that the .cin file for my test had three elements. Only the element in the .cin file but not in the model causes the error. Sample model and both .cin files attached.
Best regards,
Rob
- Attachments
-
- pname.cin
- (65 Bytes) Downloaded 155 times
-
- test_string.mdl
- (1.12 KiB) Downloaded 160 times
Re: Passing string constants through a data file
Here's the second .cin file
- Attachments
-
- pname2.cin
- (74 Bytes) Downloaded 152 times
Re: Passing string constants through a data file
The model has
part : (p1-p2)
so the error for p3 is expected.
However, we can downgrade it to a warning so that it still runs.
part : (p1-p2)
so the error for p3 is expected.
However, we can downgrade it to a warning so that it still runs.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/