Experiment: Time to complete a fixed amound of products

All topics specific to modeling questions in Enterprise Dynamics
Post Reply
sga
Posts: 6
Joined: Monday 15 April, 2013 - 13:07

Experiment: Time to complete a fixed amound of products

Post by sga »

Hi ED forum

I have completed moduling several different machines setups for our production line.
Now I would like to measure the time it takes to complete 3150 products for each setup.

I use the following to restart the experiment: input(AtomByName([Sink118], Model))=3150
which works fine for each of the production line setups (when experiments are runed seperated).

But to get the answer I am searching for, I would like to have a timer on that shows how long each experiment has been taken.





Regards
Simon
dks
Posts: 5
Joined: Monday 28 March, 2011 - 11:52

Re: Experiment: Time to complete a fixed amound of products

Post by dks »

Hi Simon,

There are several ways to do what you're asking for.

E.g.
1) Use the function "stop" in combination with an if-statement to stop, when the products is done.
2) Use a table to collect statistics. That is when the "last" product arrives at the Sink - write the time to a table.

Please feel free to ask if you don't understand or wants a further description.
Regards,

Daniel K. Svendsen

Integrate, Denmark (Incontrol Partner)
http://www.integrate.dk
sga
Posts: 6
Joined: Monday 15 April, 2013 - 13:07

Re: Experiment: Time to complete a fixed amound of products

Post by sga »

Hi dks

An copy paste exsample in ED would be great.


But actually I often face difficulties with finding the exact 4DScript that I am needing...
I was wondering if there is some sort of 4DScript dictionary?
dks
Posts: 5
Joined: Monday 28 March, 2011 - 11:52

Re: Experiment: Time to complete a fixed amound of products

Post by dks »

Hi Simon,

I'll try to describe two situations, and please be aware that the following is intended to be used for a regular simulation run. E.g. no experiment wizard ;)


1) Testing the setup regarding the time to produce 3150 products


On your sink - it is possible to stop the model, when the input (which is the output of your production line) reaches the amount of 3150.
The code:

Code: Select all

if
(
 input(c)=3150,
 stop
)
Then you can see the time in the clock ;)

2) But it is also a possibility to write the time to a table

Code: Select all

if
(
 input(c) = 3150,
 setResulttable(1,1,time)
)
Then you find your time-value in the table "Resulttable"

If you need to perform several subruns in the model by using a the experiment wizard then you have to write some more code. If this is your intention - please don't hesitate to ask.

There is a 4DScript helper - go to the menu in Enterprise Dynamics and select the main topic "Window" and afterwards select "4DScript Overview". It contains also examples. Otherwise the help function (F1) is very useful.

Please feel free to contact me directly on dks@integrate.dk or by phone at (+45) 40909153.


I hope I've made myself clear - otherwise let me know ;)
Regards,

Daniel K. Svendsen

Integrate, Denmark (Incontrol Partner)
http://www.integrate.dk
sga
Posts: 6
Joined: Monday 15 April, 2013 - 13:07

Re: Experiment: Time to complete a fixed amound of products

Post by sga »

Hi Daniel,

First of all; Thanks for the reply and the examples :)

Unfortunately, my intention is actual to run several subruns to get a more reliable result.

In the experiment wizard, I have terminating cond on and I use the following codintion expression: input(AtomByName([Sink118], Model))=3150
It works great but miss the timer...

So if it is possible to write some code that is compatible with this "setup", would it be great for me to know how to write it.


Regards
Simon
dks
Posts: 5
Joined: Monday 28 March, 2011 - 11:52

Re: Experiment: Time to complete a fixed amound of products

Post by dks »

Hi Simon,

You could write a code on the Sink, which writes to a table.. That is the sink writes the time when product no. 3150 has arrived.

It could be solved like this:

Code: Select all

if(
 input(c)=3150,
 do
 (
  var([rowno],vbvalue, rowno:=IndexMatchRank(nrows(refResult_test),cell(count,1,refResult_test),0,1)),
  
  SetResult_test(rowno,1,time)
 )
)

The code writes a time value to the table "Result_test" when input reaches 3150. The only two things you must remember, is to empty the table before a experiment and set the number of tablerows to the number of runs you want to perform.

I hope this is helpful - otherwise contact me..
Regards,

Daniel K. Svendsen

Integrate, Denmark (Incontrol Partner)
http://www.integrate.dk
dks
Posts: 5
Joined: Monday 28 March, 2011 - 11:52

Re: Experiment: Time to complete a fixed amound of products

Post by dks »

Please use this code instead - a minor error is corrected...

Code: Select all

if(
 input(c)=3150,
 do
 (
  var([rowno],vbvalue, IndexMatchRank(nrows(refResult_test),cell(count,1,refResult_test),0,1)),
  
  SetResult_test(rowno,1,time)
 )
)
Regards,

Daniel K. Svendsen

Integrate, Denmark (Incontrol Partner)
http://www.integrate.dk
Post Reply