Setting input value during simulation

368 views
Skip to first unread message

Damien s

unread,
Feb 3, 2016, 3:37:33 PM2/3/16
to Jaamsim Users Discussion Group
Hello,

is it possible to change InputValue during simulation? Should I use something else?

I need a state that can be changed and managed during the simulation.

Thanks in advance
Damjan

Harry King

unread,
Feb 3, 2016, 5:03:46 PM2/3/16
to Jaamsim Users Discussion Group
Damjan,

Any numerical input that accepts an InputValue object (or an expression) can be changed in the middle of a simulation run.

Harry

Damien s

unread,
Feb 4, 2016, 4:40:24 AM2/4/16
to Jaamsim Users Discussion Group
Hello Harry,

Yes, but I don't know how. I have the Value named InputValue1 (on picture under number 1).
When Branch (Nr. 2) delivers to packing(Nr. 4), The InputValue1 would be "1" (as busy).
When the ExpressionThreshold (under Nr 5.) is green, Then the InputValue would "2" and the package goes to the machine Nr. 3) .
When the machine (Nr. 3), has no more Queue, it would set the Input Value1 back to 0.
In the same time, there would be a condition in Branch (N2. 2), That can deliver packages to packing(Nr. 4) if the InputValue1 is set to 0.

The problem is, that i don't know how to set an expression and where and how to set Value of object called "[InputValue1].Value".

Please give me some advice about that too.

Thank you in advance
Damjan
Auto Generated Inline Image 1

Harry King

unread,
Feb 4, 2016, 10:47:57 AM2/4/16
to Jaamsim Users Discussion Group
Damjan,

The purpose of the InputValue object is to allow the user to enter a value through the graphical user interface. Just double-click on the displayed value for the InputValue object and edit it. Press enter to accept the new value (or click on another object). While in edit mode, you can copy and paste using cntrl-c and cntrl-v. This is a relatively new object that hasn't been documented in the User Manual yet.

Expressions are re-calculated on demand. Once you enter an expression for some input, it will be re-calculated every time that input is referenced by the program.

ExpressionThresholds are checked at every event time and their states (open or closed) set accordingly.

Harry


Damien s

unread,
Feb 4, 2016, 12:26:20 PM2/4/16
to Jaamsim Users Discussion Group
Harry,

and which object shall i use for changing date during the simulation and how.

I tried with Assign object, but then i din't know how to set a Value in AttributeAssignmentList to Object InputValue - {'[InputValue1].Value = [InputValue1].Value + 1'}. That doesn't work. I didn't know which object to use for these needs.

Which object shall I use then for status purposes only and how do I assign new values to it during simulation.

Damjan

Damien s

unread,
Feb 4, 2016, 12:41:19 PM2/4/16
to Jaamsim Users Discussion Group
Harry,

sorry. Now I found some more examples. Please for reply if this is the correct way:
First I add Assign object and define new attribute AttributeDefinitionList And set it to some Value.
Than later in new assign object I set it to another value. And these values can be called in condion such as in ExpressionThreshold?

If so, do you have any examples for similiar use?

Damjan

Harry King

unread,
Feb 4, 2016, 1:50:33 PM2/4/16
to Jaamsim Users Discussion Group
Damjan,

Yes, the Assign object is the one you should use. At present, it is the only way to change the value for an attribute.

I've attached two examples that might be helpful.

Harry
Assemble and Match Example.cfg
Assign Example.cfg

Damien s

unread,
Feb 4, 2016, 3:47:56 PM2/4/16
to Jaamsim Users Discussion Group
Harry,

Thank you for very quick reply and also for examples. I'll go them through. In the mean time i found onother solution without global variables, but i think i would need them anyway.

Now I have another question.

Let's say I have Pack Object with maximum number of entities 92. Then i forward this packege to SeizeObject, then release it and forward it so Server object.

Is it possible, that I forward the package with less than 92 entities if the Server queue is equal 0? Now it's working in my example, only if the packege cointains 92 entities. I want to make sure that the server is always busy and it doesn't have to wait for package to be full if the server is not working. I only must assure, that the packege contains number entities that are delimited by 4. (I hope i explained the right way)

Please see the attached example. The problem i'm having is with Pack [PackVoz1] which is positioned on most right position of the map.

Damjan
diploma.cfg

Harry King

unread,
Feb 5, 2016, 4:08:38 PM2/5/16
to Jaamsim Users Discussion Group
Damjan,

The NumberOfEntities input for the Pack object is evaluated once per EntityContainer, so you have to select the number to pack at the start of packing. Changing the number part way through packing will have no effect.

You could write an expression that checked whether the Server was busy, and if not, set the number to pack to the number of entities on hand in the queue. The input to the NumberOfEntities keyword would be something like:

'[EntityToReleaseVozi].Working ? [InputValueVozKosov].Value  :  ([QueuePackVoz1].QueueLength - [QueuePackVoz1].QueueLength % 4)'

The last part of this expression rounds down the number of entities to a multiple of four, as you specified. This reminds me that I should add floor and ceil functions to expressions.

Harry

Damien s

unread,
Feb 6, 2016, 9:21:24 AM2/6/16
to Jaamsim Users Discussion Group
Hello,

yes, that's what I was looking for. I didn't know that i can put expressions also in NumberOfEntities.

Thank you
Damjan

Harry King

unread,
Feb 6, 2016, 12:02:14 PM2/6/16
to Jaamsim Users Discussion Group
Damjan,

Whenever possible, we have allowed numerical inputs to accept an expression or an object that returns a number (such as a TimeSeries or Probability Distribution). The easiest way to find out what types of inputs can be used is to look at the pop-up that appears when you hover the cursor over the keyword in the Input Editor.

Harry

Damien s

unread,
Feb 6, 2016, 2:41:56 PM2/6/16
to Jaamsim Users Discussion Group
Harry,

pop-up i have discovered only few days ago. They are really helpfull. Users like me can also find many good examples in this group.

But...there only a few examples on your site, the many others are here in these group. Your manual is also very good described, but it doesn't show the whole potential or uses of your program. It would be really good if there was a simmiliar group (or something) only for examples and maybe for users references. What have they done with your app. So everything was at one place. This is only my opinion.

When I complete my thesis, I will also share my project, caouse I think this what this community is about and what I'm getting from it. Maybe someone else finds sometehing in my project, that will show him another way.

All the best
Damjan

Harry King

unread,
Feb 6, 2016, 11:36:20 PM2/6/16
to Jaamsim Users Discussion Group
Damjan,

In case you haven't noticed them already, there are pop-ups for the outputs in the Output Viewer.

I agree that JaamSim is short of worked examples. This is partly because most models are developed for a client/employer who would not want their model to be shared with others. One solution that has been suggested to me is to provided worked solutions for the exercises in one of the simulation textbooks.

I've been meaning to add another download to the website containing a collection of simple models that demonstrate the use of various objects. Most of these models were posted to the forum when the object was first introduced, but it would be useful for new users to have them all in one place.

I would be delighted to have users such as yourself post their models to the forum along with a brief explanation.

Harry

Harry King

unread,
Feb 7, 2016, 12:05:29 AM2/7/16
to Jaamsim Users Discussion Group
Damjan,

I've added the collection of simple models that I mentioned in my previous post to the Downloads page.

Harry

Harry King

unread,
Feb 8, 2016, 12:36:50 AM2/8/16
to Jaamsim Users Discussion Group
Damjan,

The floor and ceil functions that I mentioned have been added to release 2016-02. Your expression for the NumberOfEntities keyword can now be written as:

'[EntityToReleaseVozi].Working ? [InputValueVozKosov].Value  :  floor([QueuePackVoz1].QueueLength / 4) * 4'

Harry

Damien s

unread,
Feb 8, 2016, 8:05:18 AM2/8/16
to Jaamsim Users Discussion Group
Harry,

I saw the new link for the examples. I think that's super.

I also got your new version to try that expression for NumberOfEntities keyword. The ceil funtion solves it all :) It does the trick that i needed. New math functions are also more than welcomed.

As a future request will it also bi possible to select all objects and move them around? Or how could I color background grid so i can point out some segments in simulation?

Damjan

Damien s

unread,
Feb 8, 2016, 8:07:55 AM2/8/16
to Jaamsim Users Discussion Group
Hello,

Yes, I'll write something about that. My Thesis must be completed by end of the march, so I'll write about it in beginning of April.

Damjan

Damien s

unread,
Feb 8, 2016, 9:21:59 AM2/8/16
to Jaamsim Users Discussion Group
Hello,

Maybe i was excited a little too fast.I've have inserted your expression in NumberOfEntities. I also made in text box, where can i see the number that was calculated. The  Expression in text box 'ceil([QueuePackVoz1].QueueLength / 4) * 4' gives me an error? What is the easiest way to debug that problem?



Thank you
Damjan
diploma.cfg
Auto Generated Inline Image 1

Harry King

unread,
Feb 8, 2016, 11:37:41 AM2/8/16
to Jaamsim Users Discussion Group
Damjan,

There are two things to be fixed:
  • Set the UnitType input for the Text object to DimensionlessUnit. This keyword should be a required input, but we didn't enforce it to maintain backwards compatibility with some complicated older models. It is mandatory to set the UnitType if you enter a non-trivial expression for the DataSource.
  • The Pack objects do not work properly when the NumberOfEntries input is set to zero. Modify the expressions for PackVoz1 to '[EntityToReleaseVozi].Working ? [InputValueVozKosov].Value  :  max(4, ceil([QueuePackVoz1].QueueLength / 4) * 4)'.  The input for PackVoz2 should be modified in a similar way.
We will make some changes to the code to trap these types of errors better in future.

Your model runs error free after making these changes, but I notice that a bottleneck forms when the ExpressionThreshold ExpThrSeizeVozi closes and does not re-open.

One other thing -- it notice that your model is tilted strangely. You can re-align it by clicking on the 2D button.

Harry


Damien s

unread,
Feb 8, 2016, 4:17:05 PM2/8/16
to Jaamsim Users Discussion Group
Harry,

i implement your expressions in new version and it works as i wanted too.

I also fix everything that you noticed. Now I think I'm over the first half of simulation. I also rearrange it a little bit.

Thanks for everything
Damjan

Harry King

unread,
Feb 14, 2016, 9:47:23 PM2/14/16
to Jaamsim Users Discussion Group
Damjan,

Error messages have been added to release 2016-03 for the two error conditions you encountered.

Harry
Reply all
Reply to author
Forward
0 new messages