[chronojump] Encoder exports graph.R inertia,diameter. Untested
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder exports graph.R inertia,diameter. Untested
- Date: Wed, 2 Oct 2013 18:17:04 +0000 (UTC)
commit cca72fb7074a783f1eb685bdb81086edff92e861
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Oct 2 20:16:09 2013 +0200
Encoder exports graph.R inertia,diameter. Untested
encoder/graph.R | 17 +++++++----------
glade/chronojump.glade | 7 +++----
src/gui/encoder.cs | 31 ++++++++++++++++++++-----------
3 files changed, 30 insertions(+), 25 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 92e7f3f..8605c19 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -964,21 +964,15 @@ paint <- function(rawdata, eccon, xmin, xmax, yrange, knRanges, superpose, highl
#Explanation rotatory encoder on inertial machine
#speed$y comes in mm/ms, is the same than m/s
#speedw in meters:
- #speedw <- speed$y/0.0125 #m radius
- speedw <- speed$y/0.0175 #m radius
+ speedw <- speed$y/inertialDiameter #m radius
#accel$y comes in meters
#accelw in meters:
- #accelw <- accel$y/0.0125
- accelw <- accel$y/0.0175
-
- #inertia momentums
- #meters: 0.010
- #meters: 0.067
+ accelw <- accel$y/inertialDiameter
#power = power to the inertial machine (rotatory disc) + power to the displaced body mass
(lineal)
#power = ( inertia momentum * angular acceleration * angular velocity ) + mass(includes extra
weight if any) * accel$y * speed$y
#abs(speedw) because disc is rolling in the same direction and we don't have to make power to
change it
- power <- 0.067 * accelw * speedw + mass * (accel$y +g) * speed$y
+ power <- inertialMomentum * accelw * speedw + mass * (accel$y +g) * speed$y
#print("at Paint")
#print(c("mass",mass))
@@ -1546,7 +1540,10 @@ doProcess <- function(options) {
inertialMomentum = 0
if(length(analysisOptionsTemp) > 1) {
inertialType = analysisOptionsTemp[2] #values: "" || "li" || "ri"
- inertialMomentum = analysisOptionsTemp[3]
+ inertialMomentum = analysisOptionsTemp[3] #in meters, eg: 0.010
+ }
+ if(length(analysisOptionsTemp) > 3) {
+ inertialDiameter = analysisOptionsTemp[4] #in meters, eg: 0.0175
}
#in "li": linear encoder with inertial machines,
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index e75da44..e24593f 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -12182,16 +12182,15 @@ on current Chronojump version.</property>
<widget class="GtkSpinButton"
id="spin_encoder_capture_inertial">
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
- <property name="tooltip"
translatable="yes">Inertia Momentum</property>
+ <property name="tooltip">Inertia Momentum in
Kg*cm^2</property>
<property name="invisible_char">●</property>
<property
name="invisible_char_set">True</property>
<property
name="primary_icon_activatable">False</property>
<property
name="secondary_icon_activatable">False</property>
<property
name="primary_icon_sensitive">True</property>
<property
name="secondary_icon_sensitive">True</property>
- <property name="adjustment">0.01 0 1 0.01 0.01
0</property>
+ <property name="adjustment">100 0 5000 1 10
0</property>
<property name="climb_rate">1</property>
- <property name="digits">3</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
</widget>
@@ -12250,7 +12249,7 @@ on current Chronojump version.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
- <property name="tooltip"
translatable="yes">Inertia Momentum</property>
+ <property name="tooltip"
translatable="yes">Diameter of inertia machine axis</property>
<property name="invisible_char">●</property>
<property
name="invisible_char_set">True</property>
<property
name="primary_icon_activatable">False</property>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index cb02ca4..56d6939 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -42,7 +42,11 @@ public partial class ChronoJumpWindow
[Widget] Gtk.CheckButton checkbutton_encoder_capture_inverted;
[Widget] Gtk.CheckButton checkbutton_encoder_capture_inertial;
[Widget] Gtk.Box hbox_encoder_capture_rotary_f_a;
- [Widget] Gtk.SpinButton spin_encoder_capture_inertial;
+
+ //this is Kg*cm^2 because there's limitation of Glade on 3 decimals. The rest of the software uses
Kg*m^2 ( /10000 )
+ [Widget] Gtk.SpinButton spin_encoder_capture_inertial;
+
+ [Widget] Gtk.SpinButton spin_encoder_capture_diameter;
[Widget] Gtk.Button button_encoder_capture_inertial;
[Widget] Gtk.Box hbox_encoder_capture_diameter;
@@ -209,7 +213,7 @@ public partial class ChronoJumpWindow
createEncoderCombos();
spin_encoder_capture_inertial.Value = Convert.ToDouble(Util.ChangeDecimalSeparator(
- SqlitePreferences.Select("inertialmomentum")));
+ SqlitePreferences.Select("inertialmomentum"))) * 10000;
}
void on_button_encoder_capture_clicked (object o, EventArgs args)
@@ -291,7 +295,8 @@ public partial class ChronoJumpWindow
lastRecalculateWasInverted = checkbutton_encoder_capture_inverted.Active;
//Update inertia momentum of encoder if needed
- SqlitePreferences.Update("inertialmomentum", Util.ConvertToPoint((double)
spin_encoder_capture_inertial.Value), false);
+ SqlitePreferences.Update("inertialmomentum",
+ Util.ConvertToPoint((double) spin_encoder_capture_inertial.Value / 10000),
false);
if (radiobutton_encoder_capture_external.Active) {
encoderStartVideoRecord();
@@ -563,11 +568,15 @@ public partial class ChronoJumpWindow
}
if(checkbutton_encoder_capture_inertial.Active)
- str += "-" + Util.ConvertToPoint((double) spin_encoder_capture_inertial.Value);
+ str += "-" + Util.ConvertToPoint((double) spin_encoder_capture_inertial.Value /
10000); //Kg*cm^2 -> Kg*m^2
+
+ str += "-" + Util.ConvertToPoint((double) spin_encoder_capture_diameter.Value);
return str;
}
-
+
+
+ //TODO: add diameter here
private void setEncoderCombos(string str) {
if (
str.StartsWith(Constants.EncoderSignalMode.LINEARINERTIAL.ToString() + "-" )
||
@@ -578,7 +587,7 @@ public partial class ChronoJumpWindow
checkbutton_encoder_capture_inertial.Active = true;
string [] strFull = str.Split(new char[] {'-'});
spin_encoder_capture_inertial.Value =
- Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1]));
+ Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1])) * 10000; //Kg*m^2
-> Kg*cm^2
str=strFull[0]; //to be processed by the next ifs:
} else
@@ -602,7 +611,6 @@ public partial class ChronoJumpWindow
}
- //TODO: fix this to use diameter if needed
private string getEncoderAnalysisOptions(bool captureOrAnalyze) {
//capture == true; analyze == false
@@ -611,17 +619,18 @@ public partial class ChronoJumpWindow
analysisOptions = "p";
//inertial momentum with '.' for R
- string im = Util.ConvertToPoint((double) spin_encoder_capture_inertial.Value);
+ string im = Util.ConvertToPoint((double) spin_encoder_capture_inertial.Value / 10000);
+ string diameter = Util.ConvertToPoint((double) spin_encoder_capture_diameter.Value);
if(checkbutton_encoder_capture_inertial.Active) {
if(captureOrAnalyze || radiobutton_encoder_analyze_data_current_signal.Active)
{
if(radiobutton_encoder_capture_rotary.Active)
- analysisOptions += ";ri;" + im;
+ analysisOptions += ";ri;" + im + ";" + diameter;
else //(radiobutton_encoder_capture_linear.Active ||
checkbutton_encoder_capture_inverted.Active)
- analysisOptions += ";li;" + im;
+ analysisOptions += ";li;" + im + ";" + diameter;
} else
- analysisOptions += ";-;-";
+ analysisOptions += ";-;-;-";
}
return analysisOptions;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]