Jump to content
OMRON Forums

Proper way to include a general static library into PMAC IDE.


Recommended Posts

Posted
once I interface MATLAB with PMAC by the generated c-code package from MATLAB, it includes math.h, as I am using sinus block input in the Simulink. However, I am not sure what would be the best way to include the required math.h or any general static library into PMAC IDE. I tried to manually include a math.h file, but once I compile the PMAC IDE it still gives me error (see attachment). Does anyone know how to fix this?

error_IDE.thumb.PNG.d5510eca5d95af64136662648607cab9.PNG

Posted

Excellent. You are right!​ The project builds successfully even without including . We are using PMAC 3.1.2.2. I know that it would be possible to include a directory manually in PMAC. But I am still wondering how to include general header files directory in PMAC similar to what we do in visual studio through project properties link platform? At least I could not find such option on the version of PMAC we are using. Has this option become available on recent PMAC versions?

 

Another question is after being able to successfully compile the MATLAB generated simulink model (a simple sinusoidal trajectory), when commanding this trajectory (sinTraj) for motor#6 through sinTraj_flag(6)=1, I do not see any change would happen (please see attachment).

 

Any comment on these two questions will be greatly appreciated.

Posted
I know that it would be possible to include a directory manually in PMAC. But I am still wondering how to include general header files directory in PMAC similar to what we do in visual studio through project properties link platform? At least I could not find such option on the version of PMAC we are using. Has this option become available on recent PMAC versions?

You should be able to right click the folder your code is in or the include folder, select add new item and choose header file.

 

Another question is after being able to successfully compile the MATLAB generated simulink model (a simple sinusoidal trajectory), when commanding this trajectory (sinTraj) for motor#6 through sinTraj_flag(6)=1, I do not see any change would happen (please see attachment).

sinTraj_flag(6) looks like a user declared variable. Did it come from matlab? Is there a PLC watching the flag to run a motion program? Can you show this code?

Posted

I know that it would be possible to include a directory manually in PMAC. But I am still wondering how to include general header files directory in PMAC similar to what we do in visual studio through project properties link platform? At least I could not find such option on the version of PMAC we are using. Has this option become available on recent PMAC versions?

You should be able to right click the folder your code is in or the include folder, select add new item and choose header file.

 

Many thanks Eric. What if there would be many header files or some of them would reference to sub-header files existing out of PMAC folders?

 

Another question is after being able to successfully compile the MATLAB generated simulink model (a simple sinusoidal trajectory), when commanding this trajectory (sinTraj) for motor#6 through sinTraj_flag(6)=1, I do not see any change would happen (please see attachment).

sinTraj_flag(6) looks like a user declared variable. Did it come from matlab? Is there a PLC watching the flag to run a motion program? Can you show this code?

 

Thanks again. Yes. It is part of the c-code (Bmdl_sin.c) generated by MATLAB Simulink embedder coder. *sinTraj* is the name of input sinus block defined in Simulink. I attached the image-I hope the whole image could be captured here after uploading.

sinusTrajectoryCommand.pdf

Posted

I don't think we support that trajectory generation function. Trajectories are usually controlled through motion programs written in PMAC script. Can you tell me more about what type of trajectory this is?

 

 

Thanks much Eric. This trajectory name *sinTraj_flag(6)* is what we have ourselves defined in MATLAB Simulink as you can see in the attachment based on manual. It just generates code for a step signal to motor#6. I let Simulink coder generate the c-file package and then add them up to real-time routine folder on PMAC IDE. We are using IDE 3.1.2.2.

 

My wonder is when we execute this user-defined command *sinTraj_flag(6)*, although we do not get any error on the terminal, we do not see any motion or change on the encoder position window. However, the only change we are able to see is on the IDE encoder error window which most probably means there has no DAQ output for motor#6 built up.

 

Any help would be appreciated.

Matlab motor step input.pdf

Posted

If the motor sees some following error, it sounds like something is getting there.

 

Are you able to jog the motor?

 

Thanks a lot Eric.

Can you please take a look at the attachment files that I created. To answer your excellent question: most of the times, i am not able to run jog commands like #6j=0 right after running the MATLAB-defined trajectory/servo algorithm command, for example *sinTraj_flag()* here. I do not know why. That seems reasonable that the following error signal window can read the desired position which is 10 encoder counts for the programmed step input by MATLAB/Simulink embedder code, but the actual position of the motor still does not change that means the DAQ signal is not active and I probably miss compiling some sort of Deltatau servo algorithm. I am not quite sure why though. Any idea welcome.

matlab defined servo trajectory.pdf

simulink step input trajectory for c code generation to pmac IDE.pdf

  • 1 month later...
Posted

Hello moha_sa

I think the problem could be in the assignment in which motor is being executed the trajectory, in your case it's executing on Motor[6]

The trajectory should be executed in a virtual motor (e.g. Motor[0]), because it writes on the Motor[x].DesPos, being x the number of the motor declared in sinTraj_flag().

The Motor[6] needs to be maintained its own servo routine (Sys.ServoCtrl by default) to send properly the DAQ signal. 
You can click on "clear all" and set "Trajectories" for Motor[0] in the "User servo setup" window.


I don't know if I was clear, but I hope it helps.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...