ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2009
Jamie Santa Ana Jamie Santa Ana is offline
Flexsim User
 
Join Date: Jul 2009
Location: Southern California
Posts: 44
Downloads: 22
Uploads: 0
Thanks: 25
Thanked 4 Times in 4 Posts
Rep Power: 134
Jamie Santa Ana is on a distinguished road
Default How to change color when full?

What I need to do is be able to show the difference between a conveyor that is full and blocked (items are in queue), vs a conveyor that is full but still conveying. It's sometimes hard to tell the difference at certain model run speeds. So I'd like to change the color of the conveyor when it's full and backed up.

I don't have much experience in writing code, but so far I've got:

Entry Trigger
if ((content(current)==getvarnum(current,"maxcontent" )) && (getstatenum(current)==4))
{
coloryellow(current);
}
else
{
colorwhite(current);
}

I can get the color to change to yellow and back to white, but only once. I need it to keep changing colors throughout the model run. I may be way off on the code. Any help would be appreciated!
Reply With Quote
  #2  
Old 09-23-2009
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 489
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

Jamie,

Being that you only want the conveyor to change when you can view it, you could just use the OnDraw trigger. The main disadvantage to using the OnDraw trigger is that it will fire more frequently when you run the model slow; however, it will fire less frequently when you crank up the speed and not at all when you close the view window.

Using the Convey End and Exit triggers will get you so far, but it is a little harder to ensure that it works right. This is especially true when you are using an accumulating conveyor that an be blocked at the end but still conveying at the other.

The OnDraw code would look similar to what you have already:

if(getstatenum(current) == STATE_BLOCKED)
coloryellow(current);
else
colorwhite(current);

This code will change the color to yellow when ever the conveyor is blocked. The problem with using the max content, like you did in the code that you posted, is that the max content is usually 1000 which is far more than can actually be contained in the conveyor. If you set the max content then you would have to assume that the flowitems would always be the same size and that the spacng value was never changed. Another option would be to check the filledlength variable on the conveyor and check that against the conveyorlength variable. Becareful there because a conveyor may be too full to accept more flowitems before the filledlength == conveyorlength because the flowitem length + spacing + filledlength is greater than the conveyor length.

Good Luck,
Brandon
__________________
thats not normal.
Reply With Quote
The Following User Says Thank You to Brandon Peterson For This Useful Post:
Jamie Santa Ana (09-23-2009)
  #3  
Old 09-23-2009
Jamie Santa Ana Jamie Santa Ana is offline
Flexsim User
 
Join Date: Jul 2009
Location: Southern California
Posts: 44
Downloads: 22
Uploads: 0
Thanks: 25
Thanked 4 Times in 4 Posts
Rep Power: 134
Jamie Santa Ana is on a distinguished road
Default

Thanks for your response, Brandon. You're exactly right about inputting code on the other 2 triggers. Two actions happening at either end of the conveyor, almost simultaneously, was throwing me off. So, thanks for the solution!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change color of 3D object made in 3D Max qin tian Q&A 3 03-26-2013 10:27 PM
3DS Changeable Color Greig Marshall Q&A 4 06-25-2008 01:36 AM
Changing the color of a .3ds shape made with autocad Alexandre Ouellet Q&A 5 04-30-2008 08:48 AM
How to get a full path of the current open Flexsim model file. Regan Blackett Tips and Tricks 7 04-17-2008 10:39 AM


All times are GMT -6. The time now is 08:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.