Jump to content
OMRON Forums


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

alejandrojginerd's Achievements


Apprentice (3/14)

  • Reacting Well Rare
  • Collaborator Rare
  • Dedicated Rare
  • One Month Later
  • First Post

Recent Badges



  1. I have already checked the C API documentation but it does not seem to have any information on the issue. I know now that the library is loaded as Send() is also part of gplib.h according to the documentation. Additionally, when the Command() is commented out, the app builds without any issue. double user_pid_ctrl( struct MotorData *Mptr) { if (!Mptr->ClosedLoop) return 0; if (pshm->P[1] == 1){ Send(0,"Move Up"); // CommandTS("&2 b MoveUp r"); pshm->P[1] = 0; } return 0; } I also know that the function itself exists within the library and works as intended on BgCPLC void user_plcc() { if(pshm->P[1] == 1){ Command("&2 b MoveUp r"); pshm->P[1] = 0; } } Given that Matlab code generation only generates code for a UserServo fucntion and that we want a hard real time behaviour, we would like to be able to call the Motion Programs within this UserServo fucntion and not a BgCPLC. Do you have any idea on how to call motion programs within a UserServo rutine or automatically generate C code for BgCPLC.
  2. we are developing a State machine that will be runing on the Servo loop thread to take advantage of the real time characteristics and the Matlab Code generation. The State machine we thinking of ttriggering other programs like motion programns with the Command() call. However, we are not able to include the Command() fucntion into owr C code. the following example shows the problems we are facing: double user_pid_ctrl( struct MotorData *Mptr) { if (!Mptr->ClosedLoop) return 0; if (pshm->P[1] == 1){ Send(0,"Move Up"); Command("&2 b MoveUp r"); pshm->P[1] = 0; } return 0; } C:\Users\aleja\Documents\Universidad\KEIO\Research\PMAC\NewModule\PowerPMAC1\C Language\Realtime Routines\usrcode.c(126,0): error : implicit declaration of function 'Command' [-Werror=implicit-function-declaration] it seems the gplib.h was not loaded so we tried to forceload it with a #inlcude <gplib.h> \usr\local\dtlibs\libppmac\gplib.h(18,0): error : stdlib.h we did the same for stdlib.h this time (#inlcude <stdlib.h>) C:\Users\aleja\Documents\Universidad\KEIO\Research\PMAC\NewModule\PowerPMAC1\C Language\Realtime Routines\usrcode.c(40,0): error : stdlib.h Is it possible to use Command inside a UserServo fucntion? If it is, how to do it? if not, what could achieve a similar outcome?
  3. Yes. Thant you very much However I am still unable to set up the tunable parameters as, when I click crete files in the PowerPMAC Tunable Parameter Setup window, I get errors. I created a simple model to rule out any model related issuesbut got teh same error: Warning: The 'MultiInstanceERTCode' parameter will be removed in a future release. Please set the 'CodeInterfacePackaging' parameter instead. > In slConfigUISetVal In ppmac_default_set In stfInitTarget>loc_eval (line 137) In stfInitTarget (line 118) In RTW.TargetBrowser/uploadTarget In targetBrowserCloseCB In rtwprivate (line 16) Warning: The 'MultiInstanceERTCode' parameter will be removed in a future release. Please set the 'CodeInterfacePackaging' parameter instead. > In slConfigUISetVal In ppmac_default_set In stfInitTarget>loc_eval (line 137) In stfInitTarget (line 118) In configset.dialog.HTMLView/apply Parameters from MATLAB workspace Param Name Initial Val PPMAC Mem Loc IDE Symbol C code struct field ========== ======== =============== ========== ============================== {'Ktn'} {[50]} {'Sys.Ddata[1]'} {'_Ktn'} {'Ktn'} Error using Simulink.BlockDiagram.createVarStruct Too many output arguments. Error in CreateStructuredModel Error in PPMAC_param3 Error in gui_mainfcn (line 95) feval(varargin{:}); Error in PPMAC_param3 Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)PPMAC_param3('pushbutton1_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.
  4. Good day, I have been following the instructions regarding the installation of MATLAB/SIMULINK TARGET FOR POWER PMAC found on the Power PMAC IDE manual (MN-000291) on a Matlab 2020b distribution. So far I have been able to install it without any issues and generate code that runs on PMAC, however, the DeltaTau menu needed to set up Tunable Parameters is missing. Where do we find the DeltaTau menu in Matlab 2020b? How should we set up tunable parameters in the 2020b Matlab version?
  5. Inside a BgCPLC I have created a nodetree that was dynamically allocated. I am trying to implement a way to free up this memory when the BgCPLC is disabled. As no code will the run when the cplc is disabled ithought of freeing the memory the next time it is enabled, therefore I need to keep track of the previeus UserAlgo.BgCplc[i] state. I thougt of having another CPLC running that stores the UserAlgo.BgCplc[i] value into a shared P variable but this seems to be an excesivelly cumbersome solution. Is there a cleaner way to achive this behaviour? #include <stdbool.h> static bool initialized; int user_plcc() { if (prev_UserAlgoBgCplc[i] = 0 && initialized){ // if it was previusly turned off and its not the first run free(root); initialized = false; } if (!initialized) // initialize the node tree { // Constructing the tree root = createNode(node, num_children) // fills the node using malloc depending on the number of children initialized = true; } if (prev_UserAlgoBgCplc[i] = 0 && !initialized){ // if it was previusly turned off and its not the first run free(root); } }
  6. Good day, Is it posible to change the starting point of the generated trajectories from the motor[x].DesPos to motor[x].ActPos? We are currently workikng on a controller that switches from position control to force control upon detectin a collision. We want to use the PMAC built-in trajectory generation by calling motion programs from a PLC. However, to my understanding the built-in trajectory generation allways start from from the current desired position (motor[x].DesPos) and not the current actual position (motor[x].ActPos). Since we will be colliding, there is going to be a big difference between actual and desired position, making subsecuentent moves hard to achive. Example with image bellow: 1- Excecute Motion program 1 to move the tooltip to Xcmd (red). Since there is a collision, engage force controll and aply constant force to the colliding surface. Therfore tooltip actual position X (blue) will stop following Xcmd. 2- Excecute Motion program 2 to move the retrieve the tooltip. If the trajectory to follow starts at Xcmd (green), the position controller will try to penetrate the solid we are colliding with.
  7. Good day, We are implementing a custom user servo algorithm for position and force control for a linear actuator. We have already developed some testing in Matlab and would like to automatically generate the user servo code automatically as we might have to change it at a later stage. Matlab version 2023b PMAC IDE Is Power PMAC Target on MATLAB 2023b avaiable for the version we are working on or we would have to downgrade?
  8. Good day, I am thinking of building a UML FSM based on a online available framework (kiishor). However, in order to use said framework, I would require to use cmake to build the executable. Is it possible to upload the necessary files including the CMakeList.txt file to the PMAC and build it there as I will also require access PMAC's libraries for accessing the shared memory and such. Regards, Alejandro Giner
  9. After some further checking, I found out that I hadn't configured GPIODir. After adding the change to the start.txt file, everything works. Thanks for the support
  10. If you mean the LEDs on top og the GPIO port, no, they dont lit up when the bgcplc is running. I have tried both with and without the external 24V power source on two systems and always get the same behaviour. Is there something i have to configure in order to use the GPIO port?
  11. I measured the voltage at the Output pins and all presented 0V. Even pins 9, 27 and 18 wich, to my undertanding are allways "HIGH". Is something wrong on my understanding of the hardware?
  12. Good day, I am trying to understand how to read and write values to the GPIO port on my AX1515N (CK3M) however, the documentation avaiable hasnt helped much on this regard. For learning pourpuses, could you provide an code example that follows the folowing pseudocode: void user_plcc() { input = IN_00; // read the state of IN00 (LOW = 0V, HIGH = 24V) if (input == LOW) // blinck output 0 every 1000 ticks { static int i = 0; if(i > 1000) { OUT_00 = HIGH; } else { OUT_00 = LOW; } i = i %2000; } } I have tried somethin of the sorts but i dont get any measurable results. #define OutputData(x) (x << 16) void user_plcc() { volatile GateArray3 *MyGate3IO; MyGate3IO = GetGate3MemPtr(0); static int i = 0; if(i++ > 1000) { MyGate3IO->GpioData[0] = OutputData(0xAAAA); } else { MyGate3IO->GpioData[0] = OutputData(0x5555); } i = i %2000; }
  13. That is an option however, the sice of the unsolicided messages buffer is such that my aplication keeps sending data long after the send() command has changed. I am building a state machine i C and for debuging i wanted to cotinuisly print the current state and the current action. When the state changes, the buffer is aleady full of entries from the previous state therefore is keeps printing that state. Is it posible to decrease the size of the buffer to beter catch this changes? if not, printf would be a better option as it does not have a buffer. could you explain how to set up the printf() scheme with Putty?
  14. Good day, I am trying to create a CPLC that reads the GPIO located in the CK3W-AX attached to it. However, we want to test the proper workflow of the CPLC before implementing it in the actual machine. Is there a way to simulate the GPIO and shared memory (P[i]) changes within the view window? We though of using a simple arduino conected to the GPIO port since we dont know if there is a better way. Additionally, if you could provide guidance or an example on how to implement it, it would be of great help.
  • Create New...