Jump to content

Expression assignment through a refer. property and a table


AGarcia
 Share

Recommended Posts

Hi,

I have a problem when that I describe bellow in full detail. I have seen a simbit which is similar to my issue but do not know how to extend it.

I have uploaded the model the description refers to.

Your help is highly appreciated.

Regards,


Overview

The idea is to allow the user choose the processing time for a server but not his entering the experssion himself, but by means of some intermmediate option.

In particular, the user is have two options: ‘regular’ or ‘reduced’ for the processing time. According to the user’s pick, regular and reduced will lead to specific expresions contained in a table.


The model

There are three objects:

• Source1 (default values from the estándar library)

• Server1 (the processing time is to be chosen by the user)

• Sink1 (default values from the estándar library)



List

There is a String List (named strUserOptions) containing the user can choose from, and contains two ítems: “Regular” and “Reduced”.


Properties

There is a List Reference Property rpUserOption, whose list is strUserOptions, so that the user can pick one of the above mentioned ítems.

Its Display Name property is “Server Processing Time Speed”


Table

There is a Data Table (tabUserOptionInfo), with two columns:

• Column 1 (name UserOption), List Property = strUserOptions

• Column 2 (name ProcessingTime): Expression, Unit Type = Time, Default Units = Hours

The table has two rows, as follows:


Regular random.exponential(5)

Reduced random.exponential(4.5)


The objective

My intention is that the user chooses either Regular or Reduced from the model property window and the corresponding value for the Server Processing Time is chosen for Server1

case_unsolved.spfx

description.docx

Link to comment
Share on other sites

The Server is currently set up to look at the table to find it's processing time, but you haven't told the server which row to look at in the table. Therefore, you need to put some logic into the model to check the current value of the model property and based on that value, set the correct row in the table.


One example for how to do this would be to create an Add On Process in the "Run Initialized" Add On Process Trigger of the Server. In this process, you would place a Search step that searches that Table. It would have a Match Condition of rpUserOption == tabUserOptionInfo.UserOption so that it finds the row that matches the current value of the model property. And then you would create a new State variable and put that State variable in the Save Index Found property of the Search step. This will save off the row number. Place a Set Row step in the original segment leaving the Search Step and put the State Variable into the Row Number property so that you are setting the correct row for that Server object.


Thank you

Link to comment
Share on other sites

×
×
  • Create New...