Difference between revisions of "Program Examples:Camming by Virtual Master"

From SoftMC-Wiki
Jump to: navigation, search
(Creating Cam Table)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Languages|Program_Examples:Camming_by_Virtual_Master}}
 
== Introduction ==
 
== Introduction ==
  
Slave axis is driven by a virtual(simulated) master axis  
+
Slave axis is driven by a virtual(simulated) master axis.
 +
 
 +
[[File:CAMDEMO.PNG|Example of cam usage |600px]]
  
 
== Setup ==
 
== Setup ==
 
Both master and slave axes are set as in previous examples  
 
Both master and slave axes are set as in previous examples  
  
== Program example ==
+
== Program Example ==
  
  
Line 23: Line 26:
 
</pre>
 
</pre>
  
* Not linked to anything other cam-tables:
+
* Not linked to any other cam-tables:
  
 
<pre>
 
<pre>
Line 30: Line 33:
 
</pre>
 
</pre>
  
* making it 10000 points
+
* Making it 10000 points
  
 
<pre>
 
<pre>
Line 46: Line 49:
 
</pre>
 
</pre>
  
* Store the created file onto flash disk:
+
* Store the newly created file onto flash disk:
  
 
<pre>
 
<pre>
Line 52: Line 55:
 
</pre>
 
</pre>
  
Once the table is stored on the flash it can be re-loaded as:
+
Once the table is stored on the flash it can be reloaded as:
 
<pre>
 
<pre>
 
   loadcamdata ct1.cam CamTable1
 
   loadcamdata ct1.cam CamTable1
 
</pre>
 
</pre>
  
== Crating master-slave relationship ==
+
== Creating Master-Slave Relationship ==
  
 
Axis '''a2''' is slave axis of axis '''a1'''. The source varaible for the camming is the master's external position (external encoder) '''pext'''. They are connected through '''CamTable1''' cam multiplied by a gear-ratio of 1.0.
 
Axis '''a2''' is slave axis of axis '''a1'''. The source varaible for the camming is the master's external position (external encoder) '''pext'''. They are connected through '''CamTable1''' cam multiplied by a gear-ratio of 1.0.
Line 68: Line 71:
 
     a2.slave    = cam
 
     a2.slave    = cam
 
</pre>
 
</pre>
 +
 +
== Full Example ==
 +
 +
See: [[Program Examples:Camming by Virtual Master/Full Example| '''Camming by Virtual Master/Full Example''']]

Latest revision as of 01:52, 17 July 2017

Language: English  • 中文(简体)‎

Introduction

Slave axis is driven by a virtual(simulated) master axis.

Example of cam usage

Setup

Both master and slave axes are set as in previous examples

Program Example

Creating Cam Table

Declaring a cam-table type global variable:

common shared CamTable1 as cam

Creating an empty cam table:

  • This table is cyclic:
    CamTable1.Cycle = -1 
  • Not linked to any other cam-tables:
    CamTable1.Next = none
    CamTable1.Prev = none
  • Making it 10000 points
  dim camsize as long = 10000
  createcamdata camsize CamTable1
  • Defining a 360 deg sine table:
  for i = 1 to CamTable1.Size 
    CamTable1.MasterData [i] = 360*(i-1)/CamTable1.Size ' Master in degrees
    CamTable1.SlaveData  [i] = cam_amplitude *sin (CamTable1.MasterData [i] * pi/180)
  next
  • Store the newly created file onto flash disk:
  storecamdata ct1.cam CamTable1   

Once the table is stored on the flash it can be reloaded as:

  loadcamdata ct1.cam CamTable1

Creating Master-Slave Relationship

Axis a2 is slave axis of axis a1. The source varaible for the camming is the master's external position (external encoder) pext. They are connected through CamTable1 cam multiplied by a gear-ratio of 1.0.

    a2.MasterSource = a1.PExt 
    a2.GearRatio = 1.0
    a2.CamOffset = 0 
    a2.FirstCam  = CamTable1 
    a2.slave     = cam

Full Example

See: Camming by Virtual Master/Full Example