I am a little confused on how to set the alternative services in SimTalk 2.0. The help says this to set it:
In the help it says the "MyServicesTable" should be string, integer, string, which is what I have set but when I run the model it gives me an error saying column 1 shouldn't be string. I've attached the very simple model I am working with. I would love some help on how to set alternative services within the importer of a singleproc because the Help is not helping.
Thanks ahead of time!
Solved! Go to Solution.
The table MyServiceTable should have one column of type table. Here you define the name of the alternative.
In the sub table, you have two columns, first of type string with the name of the service and second column of type integer with the amount of service you need.
Attached I modified your simulation model.
Hope this will help
with the following method it is possible to change the services of a SingleProc:
var services : table services.create SingleProc.imp.getAlternativeServices(services) // clear all defined services Services.delete services.createNestedList(1,1) // for alternative 1 services[1,1].name := "alternative_1" services.createNestedList(1,2) // for alternative 2 services[1,2].name := "alternative_2" var service : table service := services[1,1] service.writeRow(1,1,"MyService1", 2) service := Services[1,2] service.writeRow(1,1,"MyService2", 3) SingleProc.imp.setAlternativeServices(services)
Hope this will help.
Hi GG, thanks for the help that worked. Now, alternatively how would one access the information within the table?
The help only explains how to access the Name of the subtable and not the information within it.
use the following method to get the alternative services and print them in the Console of Plant Simulation:
var AltServices : table AltServices.create SingleProc.imp.getAlternativeServices(AltServices) // get the sub table of alternative 1 var service : table := AltServices[1,1] Var AlternativeName : string := AltServices[1,1].Name // now proint all services defined for the alternative for var i := 1 to service.YDim loop print "Alternative: ", AlternativeName, " Service: ",service[1,i], " Quantity: ", service[2,i] next
Hope this will help.
I was more specifically looking at how to get access to information within subtables not the service table. Is there a way/method to get access to information within subtables? From what I've seen it looks like you have to copy the subtable to another table in order to access the information in it.
you can directly access every subtable by directly adresing the cell in the sub table. For example we have a table with sub tables in the first column. If you would like th read the value of the cell in column 2, row 3 of the first subtable (Table[1,1]) then you can do this directly by:
x := Table[1,1][2,3] for reading or
Table[1,1][2,3] := x for writing a value into the sub table