Q&A Forum

Notifications
Clear all

Plugin toe dipping

29 Posts
3 Users
0 Reactions
7,777 Views
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

I've managed to write a basic Visual Basic program that converts units.  

Lots to learn in terms of converting this to a plugin.  I've had a quick look at the source for the speed and distance plugin.  The first step for me is to pass a variable from YourDyno into my plugin.  How do you know what the variables that can be taken from YourDyno are?  E.g. if i want power, how do i know a) if is available and b) what it's name is.

 

Thanks.

 
Posted : 08/03/2019 11:03 pm
(@bmgjet)
Posts: 362
Dyno Wizard
 

Arrgh just tried to post a long post detailing it and forum timed out. Pushed back button and its gone.

In managed code you can view all the functions of the referenced dll and its values.
"DataConnection.OneProcessedSample" is where you want to be looking for processed data by the bluebox.

The speed distance plugin will give you the sort of method for polling values.
On of my plugins for example. In the main entry class of the plugin where it has "private DynoDataConnection dynoDataConnection;"
I make a timer that will poll the values and a static that will hold the values which I can read from anywhere else in my plugin.

--- Alright so forum times out if im including code in the post ---

You need to make some statics to store the values, Then a timer to update them so the rest of the plugin can access it.

So I have.
public static Timer dynodata = new Timer();
public static float DRPM;
public static float DHP;
public static float DNM;

and inside that timer.

if (dynoDataConnection != null)
{
DRPM = (float)dynoDataConnection?.polledDataSet.engineRPM;
DHP = (float)dynoDataConnection?.polledDataSet.wheelHP;
DNM = (float)dynoDataConnection?.polledDataSet.wheelTorque;
}
This post was modified 6 years ago 4 times by bmgjet
 
Posted : 09/03/2019 12:09 am
(@admin)
Posts: 1460
Member Admin
 
     public class OneProcessedSample
    {
        public double engineRPM;
        public double timeStamp;
        public double engineHP;
        public double engineTorque;
        public double wheelHP;
        public double wheelTorque;
        public double wheelHP1;
        public double wheelTorque1;
        public double wheelHP2;
        public double wheelTorque2;
        public double aux1;
        public double EGT;
        public double aux2;
        public double aux3;
        public double instantEngineRPM; // used for gauge
        public double roller1RPM;
        public double roller2RPM;
        public double instantRoller1RPM; // used for PID reg
        public double instantRoller2RPM; // used for PID reg
        public float gearRatio;
    }
 
Posted : 09/03/2019 12:27 am
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

I can't see any of the above variables in the speedanddistamce source, do i need to import something else?  

Also, there are no Static variables?

public void DynoDataReceivedEventHandler(object sender, OnDataReceivedEventArgs e)
{
float rollerRPM;
if (SensorAndBrakeConfig.NumberOfRPMSensors() == 2)
rollerRPM = (float)(e.processedDynoSample.instantRoller1RPM + e.processedDynoSample.instantRoller2RPM) / 2;
else
rollerRPM = (float)e.processedDynoSample.instantRoller1RPM;

if (Settings.Properties.Settings.Default.UnitSelection == "Metric")
{
speed.y = rollerRPM * Properties.Settings.Default.brakeCirc * 60 / 1000;

if (!dynoDataConnection.isLogging)
distance.y = 0;
else
distance.y += rollerRPM / 60 * Properties.Settings.Default.brakeCirc * (float)e.processedDynoSample.timeStamp;
}

In the above i can see a float created for rollerRPM.  Does it have to be created in the plugin even if it is in the main code?

 
Posted : 09/03/2019 5:41 pm
(@bmgjet)
Posts: 362
Dyno Wizard
 

Speed distance plugin doesnt pass any of the variables to the form it creates so doesnt need any statics.
Its doing every thing within the guages its makes which is speed and distance.

Jostein really needs to finish off the plugin guide/instructions. I sort of just guessed my way though the code which is quite easy being dotnet.

 
Posted : 10/03/2019 1:17 am
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

I think i will wait for Jostein to do some more work on the guide, no doubt he has enough on his plate!

 
Posted : 10/03/2019 8:41 pm
(@bmgjet)
Posts: 362
Dyno Wizard
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

Ok the guide helped a lot, but am struggling.

I want to add a gauge to the speed and distance plugin that shows metric horse power.

I start by adding :

 

private OnePlugInDataConnection metricpower = new OnePlugInDataConnection();

then in public SpeedAndDistance()

I add:

metricpower.name = "MetricHP";
metricpower.unit = "PS";
metricpower.graphPane = 1;
metricpower.isY2Axis = false;
metricpower.showGaugeInRunWindow = true;
metricpower.applyNoiseFiltering = true;
data.Add(metricpower);

Then for the actual calculation which id done in  public void DynoDataReceivedEventHandler(object sender, OnDataReceivedEventArgs e)

I create a float variable called metricpower.

The calculation is  metricpower.y = wheelHP1 * (float)0.98632;

There errors are:

Severity Code Description Project File Line Suppression State
Error CS0165 Use of unassigned local variable 'metricpower' SpeedAndDistance C:\Users\Rick\source\SpeedAndDistance\SpeedAndDistance.cs 162 Active

Severity Code Description Project File Line Suppression State
Error CS1061 'float' does not contain a definition for 'y' and no accessible extension method 'y' accepting a first argument of type 'float' could be found (are you missing a using directive or an assembly reference?) SpeedAndDistance C:\Users\Rick\source\SpeedAndDistance\SpeedAndDistance.cs 162 Active

Severity Code Description Project File Line Suppression State
Error CS0103 The name 'wheelHP1' does not exist in the current context SpeedAndDistance C:\Users\Rick\source\SpeedAndDistance\SpeedAndDistance.cs 162 Active

Questions are:

what is the .y part for?  Speed.y is not created as a variable and yet there is no error for it.

wheelHP1 is not found, yet rollerRPM is and they are both listed in DataConnection.OneProcessedSample

 

Thanks.

 

 

 

 
Posted : 11/03/2019 8:08 pm
(@bmgjet)
Posts: 362
Dyno Wizard
 

So at the top of the page where your defining the veriables you need to add.


private OnePlugInDataConnection metricpower = new OnePlugInDataConnection();

That will fix the first two errors, since its complaining about stuff not being defined.

3rd error you need to put the full location in.


metricpower.y = (float)dynoDataConnection?.polledDataSet.wheelHP * (float)0.98632;

 

With the Y value you can think of it as a line graph for they Dyno.
Time being X and Y being your set value. The guages will show the Y value at current time. While the other graphs will show Y vs X (time)

 
Posted : 12/03/2019 5:55 am
 Dev
(@dev)
Posts: 62
Member
Topic starter
 
Posted by: bmgjet

So at the top of the page where your defining the veriables you need to add.


private OnePlugInDataConnection metricpower = new OnePlugInDataConnection();

That will fix the first two errors, since its complaining about stuff not being defined.

3rd error you need to put the full location in.


metricpower.y = (float)dynoDataConnection?.polledDataSet.wheelHP * (float)0.98632;

 

With the Y value you can think of it as a line graph for they Dyno.
Time being X and Y being your set value. The guages will show the Y value at current time. While the other graphs will show Y vs X (time)

 private OnePlugInDataConnection metricpower = new OnePlugInDataConnection(); 

Is already defined line 22.

If i add:

metricpower.y = (float)dynoDataConnection?.polledDataSet.wheelHP * (float)0.98632;

With that line I get:

Severity Code Description Project File Line Suppression State
Error CS1061 'float' does not contain a definition for 'y' and no accessible extension method 'y' accepting a first argument of type 'float' could be found (are you missing a using directive or an assembly reference?) SpeedAndDistance C:\Users\Rick\source\SpeedAndDistance\SpeedAndDistance.cs 164 Active

 

Thanks for looking 🙂

 

This post was modified 6 years ago by Dev
 
Posted : 12/03/2019 3:06 pm
(@bmgjet)
Posts: 362
Dyno Wizard
 

Attach the complete source and I'll have a look

 
Posted : 12/03/2019 8:15 pm
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

Thanks

 
Posted : 12/03/2019 8:32 pm
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

file is here:

https://www.dropbox.com/s/6necfw6rv6086qj/SpeedAndDistance.cs?dl=0

 

 
Posted : 12/03/2019 8:47 pm
(@admin)
Posts: 1460
Member Admin
 

Hi,

You had two definitions of metricpower. Remove 

            double metricpower = 0;
 
and add a cast like this: 
metricpower.y = (float)(e.processedDynoSample.wheelHP * 1.01387);

And you're good to go.

 
Posted : 12/03/2019 10:14 pm
 Dev
(@dev)
Posts: 62
Member
Topic starter
 

Brilliant, all compiled.  I will add some more unit conversions when I test this.

this statement converts the wheelHP into a float?

what does the e. property represent?  

 
Posted : 12/03/2019 10:27 pm
Page 1 / 2
Share:
Select your currency
NOK Norwegian krone
EUR Euro