Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Collecting worker locations

[ Edited ]

Hi,

 

maybe someone can give me a hint, I'm only a beginner with Simtalk...

 

The goal is to track a worker's location during the simulation (only workstation sequence is relevant though). I created an observer to check for a change in worker.location. Then the method should write the worker.entrytime, location and previous location in a table.

 

param Attribut: string, alterWert: any

var eZeit: time
var ort: object
var vOrt: object

eZeit := .Ressourcen.Werker1.EntryTime
ort := .Ressourcen.Werker1.Location
vOrt := .Ressourcen.Werker1.PreviousLocation

.Modelle.Netzwerk.werkerAktionen.writeRow(1, .Modelle.Netzwerk.tZeile, eZeit)
.Modelle.Netzwerk.werkerAktionen.writeRow(2, .Modelle.Netzwerk.tZeile, ort)
.Modelle.Netzwerk.werkerAktionen.writeRow(3, .Modelle.Netzwerk.tZeile, vOrt)

.Modelle.Netzwerk.tZeile := .Modelle.Netzwerk.tZeile + 1

The writing part works, but in each line the data is "0.0000" for the time and "*.Ressourcen" for the location. What am I missing?

 

Cheers

Peritectic

2 REPLIES
Solution
Solution
Accepted by topic author Peritectic
‎10-22-2016 05:07 AM

Re: Collecting worker locations

.ressourcen.werker1 is just the class, not the instance in your frame, so you need to refer to the object instead e.g.

 

param Attribut: string, alterWert: any

var eZeit: time
var ort: object
var vOrt: object

eZeit := ?.EntryTime
ort := ?.Location
vOrt := ?.PreviousLocation

.Modelle.Netzwerk.werkerAktionen.writeRow(1, .Modelle.Netzwerk.tZeile, eZeit)
.Modelle.Netzwerk.werkerAktionen.writeRow(2, .Modelle.Netzwerk.tZeile, ort)
.Modelle.Netzwerk.werkerAktionen.writeRow(3, .Modelle.Netzwerk.tZeile, vOrt)

.Modelle.Netzwerk.tZeile := .Modelle.Netzwerk.tZeile + 1

here is an example:

 

https://www.bangsow.eu/detail_en.php?id=692


Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net


Re: Collecting worker locations

Thank you so much for the explanation, Steffen! Your example is a great addition, I copied the location.class.name check approach to sort out unnecessary information. Now it's working Smiley Happy