Hello,
I'm trying to code the states of a certain processor. That is, I want to be able to determine the state: if it's busy or idle. Is there a way to code it?
Hello,
I'm trying to code the states of a certain processor. That is, I want to be able to determine the state: if it's busy or idle. Is there a way to code it?
Hi @Carlos S3,
Yes, you can use an if condition along with an object property method to access the state of the processor. Here I have used a state string. Similarly, you can use a state number.
State number and state string can be known from stats node of the processor tree.
string State = Processor.stats.state().valueString; // returns the state of an object as string int Statenum = Processor.stats.state().value// returns the state of an object as integer
if condition along with the object property.
Object Processor = model().find("Processor1"); if(Processor.stats.state().valueString == "idle") // Similarly use busy state { Processor.color = Color.red; }
state-profile screen shot- statenum and statestring are taken from the profile node.
Regards,state.fsm
Arun KR
Except instead of
Processor.stats.state().valueString == "idle"
I would recommend using numeric constants:
Processor.stats.state().value == STATE_IDLE
Hi, I tried your suggestion but I think my version doesn't let me proceed. I'm using an old one. Version 7.3.6
setstate(node("/Processor",model()),STATE_IDLE);
Pre-Dot-syntax-time
getstatenum(node("/Processor",model())) == STATE_IDLE;
9 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved