Hello all!
I am looking into adding the functionality of ‘Video Mode’ vs ‘Simulation Mode’ to my model. The video mode would speed up a few of the slower processes for demo purposes and sim mode would be for… simulation.
The idea is to tie this to a boolean on/off via a button. I edited the code to make the ‘HMI button’ component not reset, and thought I was off to the races. But no matter what I do, I cannot get the correct value to do an if statement against. The thought would be to have an ‘If’ statement in the flow process that either gives the normal delay or the shortened marketing intent delay.
I am using the default HMI Button from VC, can anyone help me out? Is there a better way to achieve this toggle functionality?
Hello!
you can use a WaitSignal without condition, just to know which value has the HMI button. You enter the variable name you want to use to store the signal value in “ValueOutputVariableName” and then you can use this variable in the condition of your If statement.
This works great for process nodes! I had a couple of follow up questions.
First, would it be possible to do something similar with conveyor belt speeds? I have a speed for simulation and another for “what looks good on camera”. I want the same HMI button to be able to toggle the conveyor belt speeds as well.
Another question: is it possible to have ‘top level’ variables for things like conveyor speed? I want to group conveyors and set them all to the same speed, using variables. Then I could edit it in one place rather than needing to select them all each time.
Finally, what about product creation? Am I able to have variables, conditions, etc. to determine how often / quickly products are fed into the simulation? This would be very nice to have.
You could do that with the “GetProperty” statement to select the ConveyorSpeed property of a conveyor, and then an Assign statement to change it.
I don’t think there is a component or function to change the speed of all conveyors at once. If you have access to the modeling tab, you could program your HMI directly to do it. For example you could just select all the conveyors or all the components with a path or a property “ConveyorSpeed” in your layout with a Python script, and change the speed when the HMI is toggled.
You could also use a “Create” statement in an if loop to create products when you trigger a button. Or define other conditions to create the products
@Tilma
I added the functionality to my main model, but it seems like the button doesn’t like to be pressed before starting the simulation. If I click it and then start it, it treats the signal as false. I have to start the simulation and then click it for the logic to update. Why might this be? Is there some way to reference the ‘IsPressed’ property directly in the conditional statement of the if? That would be ideal. Is there better documentation somewhere showing how to reference model properties within a conditional statement? Is this even supported? IsPressed is a default property in the HMI button.
I think ‘grouping’ the conveyors works good enough for my purposes, not ideal since I want to tie out to the button, but it should work for now. Out of curiosity, what would that script look like? Would it need to loop through all components in the model and check for that ‘ConveyorSpeed’ property, or could it be more optimized than that? I would want it to apply to specific conveyors, which I suppose I could name a certain way, but a tag or something would be ideal. Any ideas?
I am a bit confused about the ‘Create’ Statement part. Where can I do this? In a python code script? I cannot even begin to think of how this might be accomplished, I might have to just do this manually.