Sign up for our newsletter! 
Home News Products Downloads Forum Distributors Store Contact Us
PPE User Forum
June 19, 2013, 04:04:04 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Zeitronix Script Help  (Read 3798 times)
0 Members and 1 Guest are viewing this topic.
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« on: March 29, 2010, 01:51:33 pm »

Hi guys - I'm looking for information on how to create scripts.  I have zero knowledge of this stuff and although I can sort of follow along on the basic script ScanXL provides, I am unable to relate its language to my specific situation.

I will be using DashCommand on a small PC in my track car via a remote screen to monitor and display (in realtime) the information that Zeitronix's unit can provide, specifically, RPM, AFR, Water Temp, Oil Pressure and Oil Temp.  The first four parameters show up as PIDs in the DashCommand software (more or less), but the last one, Oil Temp, show up as "USER1" - displayed as voltage.

My question is, firstly, can I convert that voltage (0-5v) via a script into temp if I know the range of the temp sensor?  And secondly, if so, can someone point me in the right direction to write that particular script?
Logged

Pierre@PPE
Full Member
***
Offline Offline

Posts: 129


View Profile
« Reply #1 on: March 29, 2010, 08:31:26 pm »

hi.

Writing a script to take the data from USER1 and convert it to temperature could be easy or hard depending on the type of sensor it is. If the sensor is linear, meaning that each increment in voltage represent the same increment in temperature, then a simple linear equation or calculation could be made to convert voltage to temperature. On the other hand, if the temperature sensor is not linear, then you'll need to find the graph that shows how voltage relates to temperature then figure out an equivalent formula (lost of math). Or if you are lucky Zeitronix already has this formula figured out.

Once the formula is known, linear or something else, writing the script is really easy and would amount to only a few lines.

Good luck with your project and let's hope the sensor is linear.

Pierre.

PS. I'm looking for the answer to your other post re: using only the AUX input sans OBD-II.
Logged
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #2 on: March 30, 2010, 07:46:53 am »

Thanks for the reply Pierre.

I did some digging after I made this thread and found results more or less exactly what you described.  In our case, I believe the sensors are non linear (MSD 2310 - typical GM temp sensor).  I contacted Marc at Zeitronix - he was kind enough to give me a basic formula where the result will only be accurate within a certain range.  He says the smaller the range the more accurate the results.

So instead of having a very accurate result throughout the entire range of the sensor (-40 to 302*F), we would need to pick a specific range that is important to us so that the formula would produce a semi accurate result in that range, in our case 175-250*F should cover us.

here's what I have as my script (no idea if it's written correctly):

var SensorVoltage = Obdii.GetPidValueEnglish("AUX.ZTX.USER1");
var OilTemp = (SensorVoltage * -112.7)+295.3;
Obdii.PidValue.English = OilTemp;
Obdii.PidValue.Metric = OilTemp * 6.894757293168361;
Logged

Pierre@PPE
Full Member
***
Offline Offline

Posts: 129


View Profile
« Reply #3 on: March 30, 2010, 06:23:00 pm »

The syntax looks correct to me.

You'll need to add this to the top of the script to prevent a warning message:

function GetRequiredPids()
{
    AddRequiredPid("AUX.ZTX.USER1");
}

Logged
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #4 on: July 08, 2010, 08:18:48 pm »

so I have a small issue.

the script (temperature) seems to work and update in the "data logging" view, but doesn't update in the dashboard view.  If I get out of the dashboard view, then back in, the temp will jump to the current correct value, but won't update unless I get out and back in again.  All other PIDs work/update normally.

any suggestions?
Logged

Weston@PPE
Administrator
Hero Member
*****
Offline Offline

Posts: 1742


View Profile
« Reply #5 on: July 09, 2010, 01:02:41 pm »

Can you post up this dashboard? I'd like to take a look at it.
Logged
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #6 on: July 09, 2010, 01:33:26 pm »

sure.  take a look.  while you are looking let me know if you see anything else that doesn't look quite right  Grin
Logged

Weston@PPE
Administrator
Hero Member
*****
Offline Offline

Posts: 1742


View Profile
« Reply #7 on: July 09, 2010, 02:48:59 pm »

Everything looks functionally correct. You could use the degree character, instead of rendering an ellipse, but that's about all. Hold Alt and hit 0176 on the num-pad for a degree symbol (°). This will just make it line up with the text you already have (my screen resolution makes it not line up quite right).

The only other thing that comes to mind is if you don't have AddRequiredPid("AUX.ZTX.USER1"); in your script.

Try changing the text to show RPM or something, and see if you still have the same problem. If it goes away, its probably in the script.
Logged
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #8 on: July 09, 2010, 03:24:35 pm »

thanks Weston.  I'll double check the script tonight to make sure it's setup correctly.

also, the reason I don't use the ALT 0176 is because the degree symbol looks more like a zero (much larger than it should be) with the font that I'm using.  So I went ahead and just created a simple ellipse.
Logged

audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #9 on: July 11, 2010, 12:08:43 pm »

still not having any luck on this end.  the temp will continuously update in the data logging view, but wont update in the dashboard.  perhaps its a problem with the script?  I checked the log and see an error or two.  Please see attached.

here's the script

function GetRequiredPids()
{
 AddRequiredPid("AUX.ZTX.USER1");
}
var SensorVoltage = Obdii.GetPidValueEnglish("AUX.ZTX.USER1");
var WaterTemp = (SensorVoltage * -112.7)+295.3;
Obdii.PidValue.English = WaterTemp;
Obdii.PidValue.Metric = WaterTemp * 6.894757293168361;


<edit>
I realize now that scanxl wasn't connected during the script test - which caused the error.

<edit II>
btw, I created a new container with nothing more than the water temp text and it still won't update while in the dash view.
« Last Edit: July 12, 2010, 09:26:32 am by audisnapr » Logged

Weston@PPE
Administrator
Hero Member
*****
Offline Offline

Posts: 1742


View Profile
« Reply #10 on: July 12, 2010, 12:30:15 pm »

That problem isn't because you aren't data logging. Like I thought, the GetRequiredPids() function isn't quite right.

It should be:
Obdii.AddRequiredPid("AUX.ZTX.USER1");
But you have it as:
AddRequiredPid("AUX.ZTX.USER1");

Try adding Obdii. to the front, and that should fix it.

Let us know how it goes.
Logged
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #11 on: July 12, 2010, 02:21:36 pm »

awesome!  I'll change it up tonight and report back.

I need to create a script for RPMs.  I essentially need to cut the RPMs in half, or close to it.  Have a simple script for me?  Turns out the Zietronix software has a place to change the RPM settings, but the guys from Zietronix say that the change will only show in the Zietronix software.  I believe the RPMs are showing in Dashcommand,  ~2X what they should be and need a script to remedy this.  Any help would be appreciated.
Logged

Weston@PPE
Administrator
Hero Member
*****
Offline Offline

Posts: 1742


View Profile
« Reply #12 on: July 12, 2010, 03:41:11 pm »

Sure, just used the default script from when you hit "New Script" and changed it from * 10, to / 2. You will need to change "SAE.RPM" to be the AUX.ZTX.XXX script you want to use is all.

function GetRequiredPids()
{
   // Add required PIDs here (see example on following line)
   Obdii.AddRequiredPid("SAE.RPM");
}

// Below is a sample script calculation that takes
// Engine RPM and multiplies it by 10. You may use
// it as a starting point for your own custom script.
// For more advanced scripting information, please
// take a look at the Script API help file.

var EngineRPM = Obdii.GetPidValueEnglish("SAE.RPM");
var CalculatedValue;

if (EngineRPM == null)
{
   // There was an error getting Engine RPM
   CalculatedValue = 0;
}
else
{
   CalculatedValue = EngineRPM / 2;
}

Obdii.PidValue.English = CalculatedValue; // Convert your custom value to English units here
Obdii.PidValue.Metric = CalculatedValue; // Convert your custom value to Metric units here
« Last Edit: July 12, 2010, 03:42:50 pm by Weston@PPE » Logged
audisnapr
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #13 on: July 13, 2010, 09:02:07 am »

the default script, you say?  haha, I'm embarrassed to have asked now  Grin Embarrassed

anyway, to report back, the "obdii" text missing from the script was in fact the problem.  All is working well, including the RPMs (minus the USER2 issue that I'm working on with Brian).  Thanks for the help!  We are very close to having a very function digi dash for the car.

BTW, here's a few updated shots of the car's interior.  I don't have any photos of the DC running, but it does work!




Logged

Weston@PPE
Administrator
Hero Member
*****
Offline Offline

Posts: 1742


View Profile
« Reply #14 on: July 13, 2010, 11:12:50 am »

Looks great! Let us know if you need help with anything else.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.113 seconds with 19 queries.
Home | News | Products | Downloads | Forum | Distributors | Store | Contact Us
Copyright © 2012 Palmer Performance Engineering, Inc. All Rights Reserved.