Hello!
I'm new to flexsim. I need to change the speed of the AGV using flexscript. Could anybody help with that?
Hello!
I'm new to flexsim. I need to change the speed of the AGV using flexscript. Could anybody help with that?
Hi @Jennifer F,
When you use the AGV Module
You can use the sampler to get the reference of the AGV speed parameters from the AGV network properties and then use that reference to change the speed. For Eg:
int SpeedValue = 5;
Model.find("AGVNetwork>variables/agvTypes/DefaultAGV/speeds/Straight/Empty")
ForwardSpeed.value = SpeedValue;
You may use this code in the process flow or in your waypoint logic in the model.
When you don't use AGV Module
int SpeedValue = 5;
treenode ForwardSpeed = getvarnode(Model.find("TaskExecuter1"), "maxspeed")
ForwardSpeed.value = SpeedValue;
You may use this code in the process flow or in the triggers in your model
Regards,
Arun KR
@Arun KR Thanks for your support. Is there a way to start with flexscript? Any idea pr suggestions sir!
In addition to @Jörg Vogel's I'd say that you can try small sections of FlexScript in the Script window if you want to test loops etc and write the results to the script return value (using the return keyword) or print to the output console if you want to see multiple values. Also you can step through any FlexSript code using breakpoints and then in the debugger look at the values of variables by hovering your mouse over them or checking the "local variables" window. You can also check any expression in the context of the executing code by entering it in the "Watch expression" window. The script window can also excute via the debugger directly using the debug option of the run button as shown here:
Some years ago I learned it by looking into source code of picklist templates. Currently this is not useful anymore, because some source code is outdated. The actual command structure depends on dot-syntax and FlexScript Classes. The outdated source code is functional syntax by commands. The change is still in progress and both structures co-exist. There is a lot of code deprecated. When you move your mouse pointer over it, the pop up hints tells you the deprecated state and advise you to use a class method or property instead. You can mix them and sometimes you have to do this, because you don’t find a substitute in a class for a command. But if you know, that dot-syntax is the currently preferred syntax, you can still try to understand template source code.
I recommend to get rid of the template tags in source code editor. An icon on the left bottom canvas of the edit area deletes all property tags. Then you are not able to edit the properties anymore, but the source code looks tidier and has much more to do with the structure in the reference manual.
Adding on to both @Jörg Vogel and @jason.lightfoot, I'd also recommend you to go through the coding in FlexSim topic in the manual to have a basic understanding of the syntax of Flexscript and it's usage.
https://docs.flexsim.com/en/20.2/Reference/CodingInFlexSim/WritingLogic/
Regards,
Arun KR
14 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