igy234
igy234

Reputation: 69

Log the selected resource in Simmer for R

I'm trying to create a simulation model that describes traffic near the motorway gates.

I have added the resources

motorwayGate <-
    simmer("motorwayGate") %>%
    add_resource("counterCards", 1) %>%
    add_resource("counterCash1", 1) %>%
    add_resource("counterCash2", 1) %>%
    add_resource("counterCash3", 1) %>%

Then i let the simulation select one of the elements taking into account shortest-queue policy.

select(c("counterCards", "counterCash1", "counterCash2", "counterCash3"), policy = "shortest-queue") %>%

How to log the value of the selected resource? I would like to know which one was selected. I've tried using

log_(get_selected()) %>%

or

print(get_selected())

but it does not seem to work.

Upvotes: 1

Views: 190

Answers (1)

igy234
igy234

Reputation: 69

As it turns out i was looking for a proper use of function "log_()" and "get_selected()"

log_(function() {paste("Selected: ", get_selected(motorwayGate))})  %>%

Upvotes: 2

Related Questions