question

Reina Hanazo avatar image
0 Likes"
Reina Hanazo asked Jeff Nordgren commented

How do I make sure the queue changes color according to the number I have implemented and how do I show the status for the color if I change the queue to an model? (File attached)

Hi, from the title and from the file I had attached, I have 2 question to ask.

Firstly, is it possible to have the queue change color according to code I had done in Queue 2 under 'On Exit'.

As I would like the queue to have the green color on 15(on exact), yellow at 10 and red on 5, the first time I play the simulation, it would work. However, after the first round(meaning when it reaches 0 as I batch the queue), when it is at 15, it is still red. Only when it is at 14, it would change back to green.

Secondly, how do I show the status of the color queue if I change the queue to a model?

I am aware that the color does not work when I change the queue to a model. So is there a way to show the color status (Like a billboard or text). Meaning, I would want the billboard to show green instead of the content.

Thank you.

FlexSim (other)
FlexSim (other - please specify)
color changeshow color status instead of content status
color-queue.fsm (16.1 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeff Nordgren avatar image
2 Likes"
Jeff Nordgren answered Jeff Nordgren commented

@Reina Hanazo

Attached is your model with the changes that I've made. I added code to the OnEntry trigger of Queue2 and changed the OnExit trigger code.

I changed the code in your Color Stat: display code to change color the same as the queue is doing. I'm not sure if this is the answer to your second question or not. Because I'm not sure what you are asking in your second question. If this is not the answer, could you please give more information about what you want the model to do.

color-queue.fsm


color-queue.fsm (17.3 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Reina Hanazo avatar image Reina Hanazo commented ·

@Jeff Nordgren

Hi Jeff, thank you so much for the help. This is what I am looking for. For the second part, what you did was correct.

Thank you once again for the help.

1 Like 1 ·
Jeff Nordgren avatar image Jeff Nordgren Reina Hanazo commented ·

@Reina Hanazo

Made one small change to the code in the Text7 object's code. I noticed that after a model Reset, the first time through, it was not displaying the green text at the beginning. So I fixed that.

color-queue-jn1.fsm

1 Like 1 ·
color-queue-jn1.fsm (17.3 KiB)
Steven Hamoen avatar image
2 Likes"
Steven Hamoen answered

Hi Reina, the behavior you are describing is correct because you only use the onexit. So once the queue reaches red it will not change the color until something leaves again. So if you want that it changes back to yellow and to green you also have to write your code on the onentry.

Concerning your coding itself. you write 3 times treenode object = current; but current is already the correct pointer so only colorgreen( current ) etc. would be sufficient.

to show the status, I think the easiest way is when you change the color, also set a label with the right status and show that label in either a bilboard or a text object.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Sesha gopalan ravi kumar avatar image
-2 Likes"
Sesha gopalan ravi kumar answered Reina Hanazo commented

hi Reina my suggestion on your question is u have given == so when the item count is equal to the given it will change so instead of == u could try <= or >=so th colour can changes according to ur need

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Reina Hanazo avatar image Reina Hanazo commented ·

Hi Sesha, I tried your method but it doesn't seems to work.

0 Likes 0 ·