Cancel
Showing results for 
Search instead for 
Did you mean: 

25-How to use Simtalk to perform parameter settings for using Workers

Genius
Genius

Good day all,

Please can someone indicate what the SimTalk equivalents are to perform the following manual model settings (to introduce workers to an existing model )

1 Workstation settings
a  Set importer processing active
b  Set the StandardService
c  Point to the Broker

   [Workstation [8.Importer [1.Processing {Active}[-] <break inheritance>
         [Services {StandardService}
         [Broker] {<broker name> e.g. .Models. ... .Broker}


2 Worker customisation
a  Duplicate standard worker to make two variants
b  Change attributes of these workers

[ClassLibrary [Resources {Duplicate Worker to Worker1 and Worker2}
   Change attributes of worker1,2 in these duplicates
   {speed}, {efficiency -> proficiency}



This is an ongoing activity of automating the process of introducing workers to a general model without doing all the associated settings manually.

Any advice on doing the below in a better way, maybe this is not the best approach ....

Three objects have to be introduced/modified for each workstation which requires workers, around three settings for each - given there can be several workstations using workers - this seems too much  work and likely to be too error prone to do it manually

And model verification by walk through is much harder too - a method that re-configures an entire model to use workers can be reviewed far easier IMHO.

Thanks in advance

 

____________________________________________
PlantSim Ver 14.1.0.1294   &  Windows 7 Ent. SP1

~~~~  1st post in thread  ~~~~

14 REPLIES 14

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Phenom
Phenom

You could write a method to automize this kind of data input.

 

Or you copy/derive  the ready parametrized object.

 

Or you could wrap the station and everything you need for

 

it  in a frame.

 

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Genius
Genius

Thanks for answers Simulator.

I am working on the first method you suggested, writing a method to automate all the manual steps.

The issue however, and the core question, was how do I find the SimTalk equivalent for all of the manual steps. I have found about half by using the F8 (parameters and attributes) query to determine what changes when I set worker properties manually, but the other half remain a mystery to me.

So in general, what is the best way to find the SimTalk equivalent for a manual setting of a parameter?

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Phenom
Phenom

The best way is to be / get familiar (= read it ) with the Plant Simulation Help (file)

 

In your case especially with the chapter "Reference Help"

 

All object dialogs, methods / attributes are structured and described there.

 

 

 

 

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Genius
Genius

Thanks - that is how it should work, but there seem to be gaps in the help file.

I'll shortly write out the issues for my first example above (not able to find SimTalk code for setting a Station Service to Standard Service),
as it is not (where I would expect to find it) in the help file, nor an obvious F8-parameter.

And yet, the WorkPlace settings were all found and implemented quite easily as below from the F8-param list

// Settings to assign worker functionality to workplace (all complete here)
curWPe.Station := curWS                         -- ./1
curWPe.SupportedServices := ["StandardService"] -- ./2,3
curWPe.WorkerStaysHere := false                 -- ./4

 

Just to make sure the obvious did not work, I tried to copy that piece of code above from WorkPlace to Station, and it is not correct syntax :

curWS.SupportedServices := ["StandardService"] // Unknown identifier SupportedServices

Nor does it work with   curWS.Services   or   curWS.Service    ,  yet the manual setting to achieve this would suggest it should be something like one of the latter :

   [Workstation [8.Importer [1.Processing {Active}[-] <break inheritance>
         [Services {StandardService}

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Phenom
Phenom

FYI , how to set importer services.

 

Same methods for multiple objects are gathered here (s.b.)

 

Unbenannt.PNG

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Hi,

 

I did something quite similar a while ago, completely creating shifts/workers/services from a single tablefile because the shiftplan in a model was highly complicated. 

 

simulator have given you the answer for setting services.

 

You also asked in general how to find SimTalk functions. Perhaps you know this, but I find the most easy way to use F1 key. Simply put the cursor in a field (where you write for example the broker-path in a Station) and press F1. The SimTalk functions will be displayed for it. Or did you mean something else?

 

If you only need two variants of workers it is probably best to use a derived worker as you mentioned. I found out the hard way that deriving workers (about 80 in every initialization) which in turn had multiple instances, really slows down the model.

 

I later wanted to distinguish workers by name (but to have the same class), so I found it easier to not use the WorkerPool's creation table, but instead using create in the workerpool. Example of code:

var tmp_worker := Workers.GenericWorker.create(l.WorkerPool)
tmp_worker.name := shiftName
tmp_worker.brokerPath := .Models.Factory.Broker

When changing workers in a workerspool as initialization, do not use an ordinary init-method. Use the eventcontrollers init method. Otherwise the changes won't take effect.

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Genius
Genius

Thanks simulator - that screenshot pointed me to the spot in Help to sort out one particular aspect, setting the service required by the ParallelStation.  However I will change accepted solution to that of Busck below, as the tip hitting F1 on the manual input field is a more general solution - not 100% guaranteed - will take that up below.

That help page is buried pretty deep in the hierarchy, and although searching for "Service" in help would have found it, I think at search rank 12 or so - however in my ignorance I had been searching for  "StandardService" instead.

So the takeaway for me are the following fragments

service setting in simtalk for Station
(most services are StandardService)

[Help [Contents [Reference Help [Material FLow Objects 
   [Shared properties of material flow objects 
   [Methods of material flow objects [Methods of the importer [setServices \

OR search for  "path.imp.setservices"



// Assign the WorkPlace to provide the desired service
curWPe.SupportedServices := ["GenWorkServicE"]

 

// Define the service required by the specified WorkStation, 
-- logically we want to perform this
--       curWS.Services := ["GenWorkServicE"]
--
-- however this takes 5 lines of SimTalk code :-

var servicesTable: table[string,integer,string] 
curWS.imp.getServices( servicesTable) // needed to instantiate a table
                       servicesTable.delete
    servicesTable.writeRow( 1, 1, "GenWorkServicE", 1)
curWS.imp.setServices( servicesTable)


Are there going to be any nasty sideffects of not using StandardService, but insteadusing GenWorkServicE? 
Just to make the point that this service was explicitly set by a method, and not using the PlantSim default.

 

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Genius
Genius

Thanks Busck,  the suggestion to use the F1 help tip over a manual entry field will go a long way to sorting out the gist of the original question. 

( I'll go through the detail in the suggestions with multiple worker types after the more urgent model stuff. )

So far F1 has helped with fields that I can click on to change focus into.

Including setting the station importer to be active (which highlights that these fields are not always reported in the F8 settings, ImporterActive being absent)  :

--   [Workstation [8.Importer [1.Processing {Active}
curWS.ImporterActive := true

There are however some manual settings that are made using other methods, e.g. right mouse menu (moving the footpath icon to the back of the image) and using key & mouse combinations (Alt plus left mouse drag to move footpath end points) - see figure below. 

My method is creating and laying out the WorkPlaces, with Footpaths connecting these to the Worker Pool.
I have manually positioned the middle Footpath and set its icon to display behind other icons as I wish the method to do for all Footpaths it inserts.    The F1 tip cannot help me find the Simtalk equivalents of these two operations

15-Need to change the footpath end position (ie angle) and move to back.gif

Re: 25-How to use Simtalk to perform parameter settings for using Workers

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Hi,

 

You can change the conveyor with the methods getCurveSegments and setCurveSegments. 

 

Setting the "Send To Back" command seems tricky, in the help it seems to not exist any simtalk for it. At least I cannot find any settings for it.