Experiment wizard settings

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Nickdendrijver
Posts: 3
Joined: Sunday 29 April, 2018 - 12:43

Experiment wizard settings

Post by Nickdendrijver »

Dear all,

I have a question about some experiment settings. I have an arrival list which proceeds the arrival of different trucks and amounts per hour. I have create a model for the processes of loading and unloading trucks on a terminal.

Now I want to obtain results from different experiments. When I start a experiment with de default settings, I will get results of an whole hour.
Is it possible to get results per hour for the opening hours of the terminal?
So for instance, between 07:30:00 and 08:30:00 the average amount in a server is ...
between 13:30:00 and 14:30:00 the content in a queue is ...

Maybe this is possible with the 4dscript in the observation period(s) settings???

Please can someone help me with this problem.

Regards,

Nick
User avatar
Markus Holzner
Posts: 21
Joined: Thursday 20 January, 2011 - 13:31

Re: Experiment wizard settings

Post by Markus Holzner »

Dear Nick,

you want to have the results for a certain period of time like every one hour to see peak times during the day, right?

Unfortunately, that does not yet work with the Experiment Wizard. You can use warum-up period to cut some time off, but that is not what you want, as far as I understood.

I suppose it is best to write the results you need to a table (Table atom) every period of time. There are also some commands that help you get results - see Category Atom Status (Help) like Input, Output or Content command to name a few.

For example, to get the content of an atom use the command "Content(<MyAtom>)". Write the content of all atoms you are interested to a table that way.
If you need more details on that, please let mw know.

Best regards,
Markus
Nickdendrijver
Posts: 3
Joined: Sunday 29 April, 2018 - 12:43

Re: Experiment wizard settings

Post by Nickdendrijver »

Dear Markus,

Thank you for your reply. Yes, that is exactly what I want, but I don't completely understand how i manage to get the results per hour in a table.

I have added my model below. For instance if I want to get the avg content of the atom (aantal wachtende voor parkeren) per hour (07:30 - 08:30 , 08:30 - 09:30 etc until 14:30 15:30), how do I manage this in a tabel? Is it possible you can show me?

Thanks a lot for your feedback.

Greetings,

Nick
Attachments
Simulatiemodel 4.mod
(335.56 KiB) Downloaded 290 times
User avatar
Markus Holzner
Posts: 21
Joined: Thursday 20 January, 2011 - 13:31

Re: Experiment wizard settings

Post by Markus Holzner »

Hi Nick,

I created a small demo to get the average content for a period of time.

I used an existing command for that called "averagecontent(<atmResource>, <valStartTime>, <valEndTime>). That way you can extract the average content from stored data and you don't need to calculate it yourself but you have to switch on the History. When you reset and run the model you will be asked if you want to create a history file (if History is not yet on!). Apply the Yes-button if so. That way data for certain atoms is stored within a text file and you can retrieve the data you need any time.

So, in the model you basically find two solutions to retrieve the data (average content).
The basic and easy one is the Report atom (Summary Report) where you can get all kinds of information for a start time (7.5 hours) and a duration time (1 hour). That way, you can get data for one or more atoms but only for a certain time period.

The other solutions writes data to a table. That is pretty much the solution I mentioned in my previous post. The solution should give you the impression how to do it but is still very basic. I give you a quick explanation to that way.
You basically need three atoms, a Table atom, a User Events atom and an Initialize atom. The Initialize atom resets the dimension of the Table atoms table to one row and four columns. The Table atom called "MyAverageContent" in that example is used to store the data you define. If you check the create alias option in the user interface you can refer to that table with "refMyAverageContent". The table also provides functions to read and write data from/to the table. The function "MyAverageContent(<row>, <column>)" reads data from the table and with "SetMyAverageContent(<row>, <coulmn>, <data [as string]>) you write data to the table.
The User Events atom stores a function to write that data to the table called "WriteAverageContent" (just check that function in that atom to see what it does!). That function is called every period of time (1 hour) starting after the first half an hour.

As I mentioned above that solution is still very basic. If you have access to the Atom Editor (Developer Version) you can combine all that functionality from those 3 atoms on one atom by either extending the existing Table atom or start with a Basic atom (new atom) or you can start with a table with a certain dimension that you don't need to expand the table dimension with any new data (for performance reason) and some other things.

So, please have a look at it. I hope that helps you. If you need some more details, please let me know.

Best regards,
Markus
Attachments
Demo_ResultsPerTimePeriod.mod
(44.86 KiB) Downloaded 304 times
KatrinBrü
Posts: 3
Joined: Friday 28 September, 2018 - 11:14

Experiment Wizard - Lead Time

Post by KatrinBrü »

Dear all,

I want to use the experiment wizard to report the average lead time of products moving through my simulation model. I tried it with AvgAge(i). However, I only get the average age of the atoms, not of the content of the sink. Is it possible, to report the average age of the contents of the sinks?

Thanks in advance and kind regards
Katrin
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Experiment wizard settings

Post by HarryBunnik »

Hallo Katrin,

As soon as an object ends up in the sink, it is destroyed. So a Sink has not really a measurable content.

When you use the AvgAge on the OnEntry, add this to a label and then at the end divide this by the number of atoms that have entered the Sink, you get the average time a product was in the model:

(Label([TotalAvgTime], c {Sink}) / Input(c {Sink})

Please note that this label must be set to 0 at the beginning of each simulation run. Otherwise, you end up with data from the previous run.

So you could use an Initialize atom to do this, or another option on the OnEntry of the SInk is:

If(
Input(c) = 1, {First product entering the sink}
Label([TotalAvgTime], c {Sink}) := AvgAge(i),
Label([TotalAvgTime], c {Sink}) := Label([TotalAvgTime], c {Sink}) + AvgAge(i)
)

I hope this helps you further!

Regards,

Harry
KatrinBrü
Posts: 3
Joined: Friday 28 September, 2018 - 11:14

Re: Experiment wizard settings

Post by KatrinBrü »

Dear Harry,

thanks a lot for the quick reply. As far as I understand it correctly, I add this code to the sink itself and not in the experiment wizard right?
So, there is no way to calculate the average lead time by defining KPIs in the experiment wizard?

Thanks again and kind regards
Katrin
KatrinBrü
Posts: 3
Joined: Friday 28 September, 2018 - 11:14

Re: Experiment wizard settings

Post by KatrinBrü »

Dear Harry,

an additional question: How do I save a new excel file with my lead time for each experiment? And where do I enter the 4D script?
I am able to write the age of each product in a table for a single run. But I want to do 100 runs and would like to avoid, starting the model 100 times manually to save the lead times for each simulation run individually.

Thanks in advance and kind regards
Katrin
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: Experiment wizard settings

Post by MatthijsJongboer »

Hallo Katrin,

Yes. The code Harry suggest needs to be placed om the OnEntry of the Sink.
This will set the label TotalAvgTime on this atom and calculate a new value every time a new product enters the sink.

Now you can use this label in your experiment (note the used settings!) to complete your data collection.
You can do this by opening the Experiment Wizard and under Performance measures, do the following:
Add | Atom | By name (and select the Sink you wrote the code on).
Under PFM press Add and give it a name (e.g. Total Average Time).
Drop down the performance measure and select Label([?],cs).
You can modify the code so that it reads Label([TotalAvgTime],cs)

It is now included in your experiments.
Best regards,
Matthijs
Post Reply