For virtual commissioning, I wanna connect my custom conveyor to the control program. My control program in TIA Portal depends on the position of the component sent by an encoder but I don’t really know how to do so in VC. Could you guys give me a piece of advise on how to simulate it?
It looks like in the end it’s sligthly different to what I thougth. Instead of sending the position of the component, the encoder sends the distance traveled by the belt of the conveyor in mm, which is triggered by a sensor signal (at the beggining of the conveyor) and it restarts when it reaches 10000 mm.
Theoretically, this distance should be the same as the position of the component that you showed me how to calculate, but if it isn’t syncronized (or if the component slides or something), those values will be different.
I guess I’m gonna have to play with pathSpeed property of my physics conveyor to calculate the distance traveled and then send it to PLCSIM, rigth?
Calculating with speed is good idea, when i was partially making encoder for conveyor it needed to be in rotations so i was using speed to calculate distance, so your opinion make sense and in my experience it will work.
Hey @Seidel , thanks for answering, I appreciate it. Good to know that it is possible to achieve something with my speed aproximation, but I’m having some issues with it.
First of all, in python script, when I update the real signal value with the distance traveled to send it to PLCSIM, VC crashes. If I put a delay of 0.01s, which is the typical scan cycle value, the performance of VC really downgrades.
Also, my conveyor accelerates to match previous conveyor speed whenever a component is coming and then decelerates to 0 so calculating the distance is gonna be a bit tedious. Maybe could it be easier to attach a frame or something to the path and read its coordinates, similar to what @ozan said?
Yeah, that cycle time will be messing with performance. About that acceleration, You can use Transition signal on conveyors to start calculating after its triggered (True when component is on conveyor and False when it leaves).