C++ convert to IQAN

Kerim 9 years ago in IQANdesign updated by Ulrik Zakariasson (Software development) 8 years ago 5
Hello ,
We would like to convert from C++ to IQAN design.
I can very easily convert from if else to IQAN function.
But I dont convert  from while to IQAN function. 
So we can create while function then it s fake.
Now How can we do "while" or "for"  in the IQAN design?
Maybe try the "Latching and" or "Latching or" functionalities in IDC channels? 

for a while function you can use a SMC-channel, you'll find it under the miscellaneous-tab.
In the SMC-channel you define the diffenrent condititions (while x=0...)
Each calculation channel (IDC, MAC, DMAC,..), and also many other functions have a property called "Functions selector".
If you select your SMC-channel, the calculation channel gets more states.
In your solution library should be an example for this: "Closed loop control and manual state.ida3"

Since IQAN is a sampled control system where the whole application is calculated each system cycle, there is no exact equivalent to while or for loops. The whole application is a loop itself, which runs each time the system is sampled. There are however many other ways to achieve the same result as you would with a C++ loop.
As Ulrik points out, the entire application is a loop in itself. 
Each enabled channel and object in the application will be calculated exactly once, each system cycle. 

For me, the great benefit of this is that I will know that the application will always complete the calculation on-time, every cycle. A simple mistake in application logic cannot cause it to become stuck in a loop inside the application.