LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help in converting the Matlab Code into G Code

Solved!
Go to solution

I have written my MATLAB Code for my simulation in which I am calculating the Velocity for the Motor. I have LabVIEW code for motor in which it takes motor speed as an input. I need help in writing the G code for the profile which I have already done in MATLAB.

 

0 Kudos
Message 1 of 8
(747 Views)
Solution
Accepted by topic author rishab_kr

Hi rishab,

 

I already showed you the conversion to G code for the first lines of your m code.

Could you please cleanup your (m) code and remove all parts dedicated to plotting graphs? I guess this is not needed for "Velocity" calculation…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(743 Views)
Solution
Accepted by topic author rishab_kr

Yes, I understand you let me understand how to write the first part. But my concern is how I will make sure writing the matrix part and differentiation part in the g code, I don' t understand how to increament the time values in the g code. 

Also, My major conern before dewlling into the g code programming is do we have some other way to integrate or use the matlab code result directly in the Labview. Because for building further logic I need to use Matlab and again writing it into labview will consume time ?

0 Kudos
Message 3 of 8
(729 Views)

@rishab_kr wrote:

Yes, I understand you let me understand how to write the first part. But my concern is how I will make sure writing the matrix part and differentiation part in the g code, I don' t understand how to increament the time values in the g code. 

Also, My major conern before dewlling into the g code programming is do we have some other way to integrate or use the matlab code result directly in the Labview. Because for building further logic I need to use Matlab and again writing it into labview will consume time ?


If it works in MATLAB, then why port it to LV? if you want to use LV in the end, why develop in MATLAB?

 

Yes, there are ways to use MATLAB code in LV. https://www.ni.com/docs/en-US/bundle/labview/page/calling-the-matlab-software-from-labview.html

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 4 of 8
(715 Views)

Hi rishab,

 


@rishab_kr wrote:

Also, My major conern before dewlling into the g code programming is do we have some other way to integrate or use the matlab code result directly in the Labview. Because for building further logic I need to use Matlab and again writing it into labview will consume time ?


Why don't you stick with Matlab?

Why do you need to use LabVIEW anyway?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(625 Views)

So basically I need to operate the Hardware using NI SbRio 9627 for my developed simulation in Matlab. 

0 Kudos
Message 6 of 8
(598 Views)
Solution
Accepted by topic author rishab_kr

Hi rishab,

 


@rishab_kr wrote:

So basically I need to operate the Hardware using NI SbRio 9627 for my developed simulation in Matlab. 


Do you want to use the sbRIO only as "semi-smart DAQ device" or do you want to use it as (it's main purpose) "embedded controller"?

 

When you need the "embedded controller" then I would implement the control algorithm in LabVIEW (with Realtime behaviour in mind!) for the sbRIO. And I would even try to utilize the FPGA inside the sbRIO...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(590 Views)

Yes, So basically I have developed my hardware and I have to write the labview code by using the Realtime behaviour in mind as well as utilizing the FPGA board on the NI SbRIO 9627.

Also, Can you check once the flow of my G coding (please suggest if there is any improvement) ? there are text based codes I have written for your reference.

2. Basically I am not from electronic background so can you give brief / share any reference link to follow up regarding Real time and FPGA.

0 Kudos
Message 8 of 8
(574 Views)