cancel
Showing results for 
Search instead for 
Did you mean: 

Set Alternative Services Method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

I am a little confused on how to set the alternative services in SimTalk 2.0. The help says this to set it:

 

SingleProc.imp.setAlternativeServices(MyServicesTable);

 

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!

9 REPLIES

Betreff: Set Alternative Services Method

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Csadler,

 

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

 

regards

 

GG

Betreff: Set Alternative Services Method

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Csadler,

 

I forgot to mention that we will correct the help for this topic.

 

Regards

 

GG

Betreff: Set Alternative Services Method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor
So, I would create a nestedlist within the table to assign the alternative service, which means I would create a new table for each alternative service.

Then to actually assign it to the importer on the workstation I have getAlternativeServices then setAlternativeServices.

Am I understanding this correctly?

Betreff: Set Alternative Services Method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor
Hi GG,

After looking into creating a nested list within a created table the help says the data type columns of the TableFile have to be list, stack, queue, or table. I'm not sure how else to set the alternative services, which is not how the services will work since it needs to be string, integer, string. With the example you replied with the alternative services did not change from how they were already set. Could you explain how to set more than one alternative service via a method?

Thanks!

Betreff: Set Alternative Services Method

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello CSandler,

 

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.

 

 

Regards

 

GG

Betreff: Set Alternative Services Method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

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.

 

 

Betreff: Set Alternative Services Method

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello CSadler,

 

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.

 

Regards

 

GG

Betreff: Set Alternative Services Method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Hi GG,

 

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.

 

 

Betreff: Set Alternative Services Method

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello CSadler,

 

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

 

Regards

 

GG