Hello guys , i have the following problem :
i have a motor that runs a semi-vehicle on rails (AM series from beckhoff ) & a distance sensor ... and i have a c++ app written in vc++ 2010 (NOT twincat 3 c++ module ) , here is my problem in detail:
1) The c++ app works as the brain of the motor , it has functions that are able to do the following :
- func1: Calculate the motor required velocity & acceleration at different time steps , and after finishing write them to txt file on the desktop.
- func2: Based on the reading of the sensor , i go through some algorithms to make a decision for the next action of the motor
2) In twincat 3 , i made a plc program that can run the motor with the required velo & acc by first reading the txt file (when plc starts) and storing the values into an array & later using MC function blocks the motor would move with the required velo & acc
3) Now i faced the problem of func2 , the sensor role comes into action after the motor has already moved ( so c++ app is closed & txt file is already read by twincat plc ) ... how to go back to c++ and tell him " take this sensor reading and give me your analysis results " ?? and if i need to go back and forth between Twincat & vc++2010 (sounds crazy to me during runtime) how to do this ??
a) should i forget about my HUGE c++ code (which is OOP based) and try to make every thing written inside twincat with plc ST !!
b) should i forget about using twincat , and go for some library that makes the vC++ 2010 able to communicate directly with the motor driver ( or beckhoff cx embedded pc) , so now the c++ app will "think" & "act" ... if this the solution , what would substitute the twincat MC library that directs the motor motion ??and what about other I/O like the sensor reading itself ??
c) Is there a method that would make vc++ (brain) talk to twincat plc (action) and vise versa when needed just like two computers or two micro-controllers can talk to each others on demand ? what will happen in the Runtime ? who will have the "focus" of the time tick ? Does using "multiple virtual plcs based on multi core processor " help ?
I am sorry if typed a lot , but i really need help guys and beckhoff documentation is helpless !!
Thank you in advance
i have a motor that runs a semi-vehicle on rails (AM series from beckhoff ) & a distance sensor ... and i have a c++ app written in vc++ 2010 (NOT twincat 3 c++ module ) , here is my problem in detail:
1) The c++ app works as the brain of the motor , it has functions that are able to do the following :
- func1: Calculate the motor required velocity & acceleration at different time steps , and after finishing write them to txt file on the desktop.
- func2: Based on the reading of the sensor , i go through some algorithms to make a decision for the next action of the motor
2) In twincat 3 , i made a plc program that can run the motor with the required velo & acc by first reading the txt file (when plc starts) and storing the values into an array & later using MC function blocks the motor would move with the required velo & acc
3) Now i faced the problem of func2 , the sensor role comes into action after the motor has already moved ( so c++ app is closed & txt file is already read by twincat plc ) ... how to go back to c++ and tell him " take this sensor reading and give me your analysis results " ?? and if i need to go back and forth between Twincat & vc++2010 (sounds crazy to me during runtime) how to do this ??
a) should i forget about my HUGE c++ code (which is OOP based) and try to make every thing written inside twincat with plc ST !!
b) should i forget about using twincat , and go for some library that makes the vC++ 2010 able to communicate directly with the motor driver ( or beckhoff cx embedded pc) , so now the c++ app will "think" & "act" ... if this the solution , what would substitute the twincat MC library that directs the motor motion ??and what about other I/O like the sensor reading itself ??
c) Is there a method that would make vc++ (brain) talk to twincat plc (action) and vise versa when needed just like two computers or two micro-controllers can talk to each others on demand ? what will happen in the Runtime ? who will have the "focus" of the time tick ? Does using "multiple virtual plcs based on multi core processor " help ?
I am sorry if typed a lot , but i really need help guys and beckhoff documentation is helpless !!
Thank you in advance