I'm working with CoDeSys 3.5 SP4 Patch 2 for a few weeks now. At the moment I'm trying to get a few x-y Graph done and I'm quite surprised that CoDeSys only comes with a histogram tool, that has absolutely no options of editing the x-Axis whatsoever. I'm looking for a plot tool/function like in MATLAB, where you can edit the x-Axis and have more overall opions, like logarithmic axes, etc. Is there maybe a better tool available that I can import into CoDeSys?
Thanks for your answers!
Julian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I bypassed the standard functions and wrote my own... It's pretty easy. Each graph trace is a polyline whose x,y point coordinates can be set via codesys code.
Doing this I have implemented multiple overlapping graphs with different scales and a multi-channel logic analyzer which uses the shortest polyline to draw the trace.
The information for doing this was found on this forum. I can probably put a example together.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That sounds very interesting and seems to be exactly what I need. It would be awesome if you could post an example, but if you don't have the time, I would also be happy if you'd post the link to the thread where you found the information.
Thank you very much!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You embed a polyline in the visualizaiton and set the Dynamic Point settings to:
Array of points: _MAIN.apPoints[Trace#]
Number of points: 256 (or as many as you need)
Hope this helps.
PJE
PROGRAM_MAINVARÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
  (*HistoryGraphs----------------------------------------------------------------------------------------------*)
  atGraphPoints : ARRAY[0..5] OFARRAY[0..255] OFVisuElems.VisuStructPoint;    (* Graph Storage        *)
  apPoints   : ARRAY[0..5] OFPOINTERTOVisuElems.VisuStructPoint;       (* Pointers to Graph Data    *)
  iWidth    : INT :=670;                           (* Graph Box Width       *)
  iHeight    : INT :=400;                           (* Graph Box Height       *)
  iOffY     : INT :=240;                           (* Graph Box Y Offset      *)
  iOffX     : INT :=12;                            (* Graph Box X Offset      *)
  iPX      : INT;                               (* Calculated X Coordinate   *)
  iPY      : INT;                               (* Calculated Y Coordinate   *)
  bUpdate    : BOOL :=TRUE;                          (* Request To Update Graphs   *)
  siTrace    : BYTE;                              (* Trace Number         *)
  siPoint    : BYTE;                              (* Point Number within Trace  *)END_VAR  (*------------------------------------------------------------------------------------------------------*)IF(bUpdate)THEN  (*GenerateGraphs============================================================================*)
  FORsiTrace :=0TO5DO                             (*Draw6Graphs        *)
    FORsiPoint :=0TO255DO                          (* EachWith256Points    *)
      iPX :=(*CalculateXcoordinateforpoint-0..iWidth*);        (*  Calculate X Coordinate   *)
      iPY :=(*CalculateYcoordinateforpoint-0..iHeight*);       (*  Calculate Y Coordinate   *)
      atGraphPoints[siTrace][siPoint].iX :=LIMIT(0, iPX, iWidth) +iOffX;  (*  Range Check & Add X offset *)
      atGraphPoints[siTrace][siPoint].iY :=LIMIT(0, iPY, iHeight)+iOffY;  (*  Range Check & Add Y offset *)
    END_FOR                                   (*               *)
    apPoints[siTrace] :=ADR(atGraphPoints[siTrace]);              (* Assign Pointer to Data   *)
  END_FOR                                     (*               *)
  bUpdate :=FALSE;                                (* Prevent Constant Update   *)END_IF  (*=======================================================================================================*)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm working with CoDeSys 3.5 SP4 Patch 2 for a few weeks now. At the moment I'm trying to get a few x-y Graph done and I'm quite surprised that CoDeSys only comes with a histogram tool, that has absolutely no options of editing the x-Axis whatsoever. I'm looking for a plot tool/function like in MATLAB, where you can edit the x-Axis and have more overall opions, like logarithmic axes, etc. Is there maybe a better tool available that I can import into CoDeSys?
Thanks for your answers!
Julian
I bypassed the standard functions and wrote my own... It's pretty easy. Each graph trace is a polyline whose x,y point coordinates can be set via codesys code.
Doing this I have implemented multiple overlapping graphs with different scales and a multi-channel logic analyzer which uses the shortest polyline to draw the trace.
The information for doing this was found on this forum. I can probably put a example together.
That sounds very interesting and seems to be exactly what I need. It would be awesome if you could post an example, but if you don't have the time, I would also be happy if you'd post the link to the thread where you found the information.
Thank you very much!
Here's a template taken from my test code.
You embed a polyline in the visualizaiton and set the Dynamic Point settings to:
Array of points: _MAIN.apPoints[Trace#]
Number of points: 256 (or as many as you need)
Hope this helps.
PJE
It has indeed helped me a lot.
Thanks again!
Could you post example please ?
Best regards