Difference between revisions of "Example"

From Proview Wiki
Jump to: navigation, search
Line 1: Line 1:
Proview Designer's Guide Chapter 13
+
<p>Proview Designer's Guide Chapter 13</p>
 
+
<p><strong>Open Proview</strong></p>
'''Open Proview'''
+
<ul>
* Ctrl+E
+
<li> Ctrl+E </li>
* MB1 $Hier
+
<li> MB1 $Hier </li>
* MB2 right panel
+
<li> MB2 right panel </li>
* right key on Oxx $Hier
+
<li> right key on Oxx $Hier </li>
* ObjectName application
+
<li> ObjectName application </li>
* MB1 ProjectReg
+
<li> MB1 ProjectReg </li>
* MB2 in application $Hier
+
<li> MB2 in application $Hier </li>
* right key on Oxx $ProjectReg
+
<li> right key on Oxx $ProjectReg </li>
* ObjectName cpp
+
<li> ObjectName cpp </li>
* Ctrl+E
+
<li> Ctrl+E </li>
* Yes
+
<li> Yes </li>
* Yes
+
<li> Yes </li>
* MB3 cpp Open Project...
+
<li> MB3 cpp Open Project... </li>
* Next
+
<li> Next </li>
* Next
+
<li> Next </li>
* No
+
<li> No </li>
* Next
+
<li> Next </li>
* Next
+
<li> Next </li>
* Next
+
<li> Next </li>
* Next
+
<li> Next </li>
* Yes
+
<li> Yes </li>
'''Configure RootVolume'''
+
</ul>
* Next
+
<p><strong>Configure RootVolume</strong></p>
* Next
+
<ul>
* Next
+
<li> Next </li>
 
+
<li> Next </li>
* MB1 Plant -> $PlantHier
+
<li> Next </li>
* MB2 right panel
+
</ul>
* right key on Oxx $PlantHier
+
<ul>
* ObjectName plant
+
<li> MB1 Plant -&gt; $PlantHier </li>
* MB1 AllClases -> pwrb -> XyCurve
+
<li> MB2 right panel </li>
* MB2 in plant $PlantHier
+
<li> right key on Oxx $PlantHier </li>
* right key on Oxx XyCurve
+
<li> ObjectName plant </li>
* ObjectName curve
+
<li> MB1 AllClases -&gt; pwrb -&gt; XyCurve </li>
* Ctrl+E
+
<li> MB2 in plant $PlantHier </li>
* Yes
+
<li> right key on Oxx XyCurve </li>
 
+
<li> ObjectName curve </li>
'''''/usr/local/pwrp/cpp/src/appl/ra_myappl.cpp'''''
+
<li> Ctrl+E </li>
<nowiki>
+
<li> Yes </li>
#include <math.h>
+
</ul>
 +
<p><em><strong>/usr/local/pwrp/cpp/src/appl/ra_myappl.cpp</strong></em></p>
 +
<pre>#include &lt;math.h&gt;
 
#include "pwr.h"
 
#include "pwr.h"
 
#include "pwr_baseclasses.hpp"
 
#include "pwr_baseclasses.hpp"
Line 67: Line 69:
  
 
  // Direct link to curve object
 
  // Direct link to curve object
  sts = gdh_RefObjectInfo( name, (void **)&curve_ptr, &dlid, sizeof(*curve_ptr));
+
  sts = gdh_RefObjectInfo( name, (void **)&amp;curve_ptr, &amp;dlid, sizeof(*curve_ptr));
 
  if ( EVEN(sts)) exit(0);
 
  if ( EVEN(sts)) exit(0);
 
}
 
}
Line 76: Line 78:
 
   if ( i % 5 == 0) {
 
   if ( i % 5 == 0) {
 
   // Calculate x and y coordinates for a sine curve every fifth second
 
   // Calculate x and y coordinates for a sine curve every fifth second
   for ( int j = 0; j < 100; j++) {
+
   for ( int j = 0; j &lt; 100; j++) {
     curve_ptr->XValue[j] = j;
+
     curve_ptr-&gt;XValue[j] = j;
     curve_ptr->YValue[j] = 50 + 50 * sin( 2.0 * M_PI * (j + i) / 100);
+
     curve_ptr-&gt;YValue[j] = 50 + 50 * sin( 2.0 * M_PI * (j + i) / 100);
 
   }
 
   }
 
   // Indicate new curve to graph
 
   // Indicate new curve to graph
   curve_ptr->Update = 1;
+
   curve_ptr-&gt;Update = 1;
 
  }
 
  }
 
  else if ( i % 5 == 2)
 
  else if ( i % 5 == 2)
   curve_ptr->Update = 0;
+
   curve_ptr-&gt;Update = 0;
 
  sleep(1);
 
  sleep(1);
  if ( i > 360)
+
  if ( i &gt; 360)
 
   i = 0;
 
   i = 0;
 
  }
 
  }
Line 105: Line 107:
 
  myappl.close();
 
  myappl.close();
 
}
 
}
 
+
</pre>
</nowiki>
+
<p><strong>On terminal</strong></p>
 
+
<pre>$ sdf cpp
 
+
$ cd /usr/local/pwrp/cpp/src/appl/
'''On terminal'''
+
$ g++ -g -c ra_myappl.cpp -o $pwrp_obj/ra_myappl.o -I$pwr_inc -DOS_LINUX=1 -DOS=linux -DHW_X86=1 -DHW=x86
 
+
$ g++ -g -o $pwrp_exe/ra_myappl $pwrp_obj/ra_myappl.o $pwr_obj/pwr_msg_rt.o -L$pwr_lib -lpwr_rt -lpwr_co -lpwr_msg_dummy -lrt
$ sdf cpp
+
</pre>
$ cd /usr/local/pwrp/cpp/src/appl/
+
<p><strong>On proview</strong></p>
$ g++ -g -c ra_myappl.cpp -o $pwrp_obj/ra_myappl.o -I$pwr_inc -DOS_LINUX=1 -DOS=linux -DHW_X86=1 -DHW=x86
+
<ul>
$ g++ -g -o $pwrp_exe/ra_myappl $pwrp_obj/ra_myappl.o $pwr_obj/pwr_msg_rt.o -L$pwr_lib -lpwr_rt -lpwr_co -lpwr_msg_dummy -lrt
+
<li> Shift+Ctrl+B Node + B </li>
 
+
<li> Tools -&gt; Runtime Monitor </li>
 
+
<li> Start Runtime </li>
'''On proview'''
+
<li> File -&gt; Start Runtime Navigator </li>
* Shift+Ctrl+B Node + B
+
<li> right key Database </li>
* Tools -> Runtime Monitor
+
<li> right key plant </li>
* Start Runtime
+
<li> MB3 curve Object Graph </li>
* File -> Start Runtime Navigator
+
</ul>
* right key Database
+
<p><br /> <strong>On terminal</strong></p>
* right key plant
+
<pre>$ ra_myappl</pre>
* MB3 curve Object Graph
+
<p>l</p>
 
+
<p><strong><br /></strong></p>
 
+
'''On terminal'''
+
$ ra_myappl
+

Revision as of 07:01, 21 August 2013

Proview Designer's Guide Chapter 13

Open Proview

  • Ctrl+E
  • MB1 $Hier
  • MB2 right panel
  • right key on Oxx $Hier
  • ObjectName application
  • MB1 ProjectReg
  • MB2 in application $Hier
  • right key on Oxx $ProjectReg
  • ObjectName cpp
  • Ctrl+E
  • Yes
  • Yes
  • MB3 cpp Open Project...
  • Next
  • Next
  • No
  • Next
  • Next
  • Next
  • Next
  • Yes

Configure RootVolume

  • Next
  • Next
  • Next
  • MB1 Plant -> $PlantHier
  • MB2 right panel
  • right key on Oxx $PlantHier
  • ObjectName plant
  • MB1 AllClases -> pwrb -> XyCurve
  • MB2 in plant $PlantHier
  • right key on Oxx XyCurve
  • ObjectName curve
  • Ctrl+E
  • Yes

/usr/local/pwrp/cpp/src/appl/ra_myappl.cpp

#include <math.h>
#include "pwr.h"
#include "pwr_baseclasses.hpp"
#include "rt_gdh.h"


class ra_myappl {
 pwr_Class_XyCurve *curve_ptr;
 pwr_tRefId dlid;
public:
 ra_myappl() {}
 void init();
 void scan();
 void close();
};

void ra_myappl::init()
{
 pwr_tStatus sts;
 pwr_tOName name = "plant-curve";
 
 // Connect to database
 sts = gdh_Init( "ra_myappl");
 if ( EVEN(sts)) exit(0);

 // Direct link to curve object
 sts = gdh_RefObjectInfo( name, (void **)&curve_ptr, &dlid, sizeof(*curve_ptr));
 if ( EVEN(sts)) exit(0);
}

void ra_myappl::scan()
{
 for ( unsigned int i = 0;;i++) {
  if ( i % 5 == 0) {
   // Calculate x and y coordinates for a sine curve every fifth second
   for ( int j = 0; j < 100; j++) {
    curve_ptr->XValue[j] = j;
    curve_ptr->YValue[j] = 50 + 50 * sin( 2.0 * M_PI * (j + i) / 100);
   }
   // Indicate new curve to graph
   curve_ptr->Update = 1;
 }
 else if ( i % 5 == 2)
  curve_ptr->Update = 0;
 sleep(1);
 if ( i > 360)
  i = 0;
 }
}

void ra_myappl::close()
{
 gdh_UnrefObjectInfo( dlid);
}


int main()
{
 ra_myappl myappl;
 
 myappl.init();
 myappl.scan(); 
 myappl.close();
}

On terminal

$ sdf cpp
$ cd /usr/local/pwrp/cpp/src/appl/
$ g++ -g -c ra_myappl.cpp -o $pwrp_obj/ra_myappl.o -I$pwr_inc -DOS_LINUX=1 -DOS=linux -DHW_X86=1 -DHW=x86
$ g++ -g -o $pwrp_exe/ra_myappl $pwrp_obj/ra_myappl.o $pwr_obj/pwr_msg_rt.o -L$pwr_lib -lpwr_rt -lpwr_co -lpwr_msg_dummy -lrt

On proview

  • Shift+Ctrl+B Node + B
  • Tools -> Runtime Monitor
  • Start Runtime
  • File -> Start Runtime Navigator
  • right key Database
  • right key plant
  • MB3 curve Object Graph


On terminal

$ ra_myappl

l


Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox