Computer Time

Inside a computer, the definition of time gets confusing, because we haven’t always agreed on the definition of time and we periodically add bits of time (usually seconds) based on unpredictable events that occur with a giant water-covered rock flying through space around other huge rocks and stars.  Here is a chart of a the popular forms of time in the digital world:

Posted in Information, Technology | Tagged , , , , , , , | Leave a comment

Program to Email Memory Contents of Redlion HMI for Troubleshooting

The Redlion HMIs have the capability of creating and deleting files on the flash memory card and emailing out files.  The program below is called from a button on a diagnostics screen.  This is used to collect the contents of a group of memory tags (variables), format them so they can be read with a spreadsheet program, store as a file on the flash memory card, then email that file out.

// program to store all the current regression data in a file and email it out

cstring line;
int FileNum, index;
 
//delete old file
FileNum = OpenFile("RegDiags.csv", 1);
Sleep(500); 
DeleteFile(FileNum);
Sleep(500);

// create the file
CreateFile("RegDiags.csv"); 
Sleep(500);
// wait for file to be created
while(GetDriveStatus('C') != 5) {}
// open the file and write the 'main' header information
FileNum = OpenFile("RegDiags.csv", 2); 

//write memory contents to text file
WriteFileLine(FileNum, "Regression1.lastTimeStamp");
WriteFileLine(FileNum, Regression1.lastTimeStamp.AsText);

WriteFileLine(FileNum, "Regression1.period");
WriteFileLine(FileNum, Regression1.period.AsText);

WriteFileLine(FileNum, "Regression1.slope");
WriteFileLine(FileNum, Regression1.slope.AsText);

WriteFileLine(FileNum, "Regression1.slope_scaled");
WriteFileLine(FileNum, Regression1.slope_scaled.AsText);

WriteFileLine(FileNum, "Regression1.slopeValid");
WriteFileLine(FileNum, Regression1.slopeValid.AsText);

// build up heading text line for spreadsheet viewing
line = "Sensor1x,Sensor1y,Sensor2x,Sensor2y,";
// write the line to the file
WriteFileLine(FileNum, line);

//write a line for each element in the array
for (index = 1; index <= 1500; index++){
 line = Regression1.x[index].AsText;
 line += ",";
 line += Regression1.y[index].AsText;
 line += ",";
 line += Regression2.x[index].AsText;
 line += ",";
 line += Regression2.y[index].AsText;
 line += ",";
 WriteFileLine(FileNum, line);
 };

CloseFile(FileNum);
Sleep(500);

//email file to list 1
SendFile(1, "RegDiags.csv");

Notes:

  • The Redlion HMI retains the contents of variables that have the ‘retentive’ option checked, even when a new database is loaded.  Because of this, I was able to load a new database containing this program, and extract all the data I needed.
  • The “.AsText” suffix can be used with any tag to represent the value (integer, float, or binary) as text so it can be written to a file.
Posted in Industrial Automation | Tagged , , , | Leave a comment

Bryson – Wolf to Bear Crossover

Bryson’s den had their crossover ceremony last night.  They graduated from wolf cub scouts to bears.

Posted in Family | Tagged , , | Leave a comment

IDEC PLCs and HMIs

While the info is fresh in my mind, I thought I’d make a few notes from the 3-day training class on IDEC PLCs and HMIs.

In General:

  • Excellent hardware quality
  • compact size
  • low cost
  • software is inexpensive (free with purchase of kit or training class)
  • support is included (no support contracts)

The PLCs available are in 2 groups:

  1. The FC5A (MicroSmart Pentra) – ($199 to $500) flagship model of PLC, about to be replaced with the 6 series which will come out in a few months
    1. FC5A-D____(E) – SlimCPU, up to 15 expansion modules (only 7 analog or comms).  (E) suffix has Ethernet port, capable of MODBUS/TCP
    2. FC5A-C_____ – built in power supply, some can have up to 4 expansion modules, Ethernet not available
  2. FT1A (SmartAXIS and SmartAXIS Touch) – lowest cost model (start at $155)
    1. FT1A-B___ – built in power supply, with or without LCD screen, some have Ethernet, some have serial ports, relay or transistor outputs
    2. FT1A-C___- 3.7″ touchscreen with I/O, Ethernet

Pros: Continue reading

Posted in Industrial Automation | Tagged , , , | Leave a comment

Use Linear Regression to Find Slope of Many Datapoints

438px-Linear_regression.svgHere is the implementation of a program that analyses several days worth of data coming from a sensor that might change a tiny amount over that time.  We were interested in how much of a change over time occurred, so I ‘fitted’ a line through the data points that would fit the best and calculated the slope of that line using linear regression using the recommended formula for the sensor and process used: Continue reading

Posted in Industrial Automation | Tagged , , , | Leave a comment

The Remnant

ron-paulEver wonder why Ron Paul would get up and give the same speech everywhere he went, no matter the audience?  Why he didn’t waver from his central message of individual liberty?  I think it was because he had a different understanding of his own purpose.  He was talking to the remnant, just as the prophet Isaiah was:

the Lord commissioned the prophet to go out and warn the people of the wrath to come. “Tell them what a worthless lot they are.” He said, “Tell them what is wrong, and why and what is going to happen unless they have a change of heart and straighten up. Don’t mince matters. Make it clear that they are positively down to their last chance. Give it to them good and strong and keep on giving it to them. I suppose perhaps I ought to tell you,” He added, “that it won’t do any good. The official class and their intelligentsia will turn up their noses at you and the masses will not even listen. They will all keep on in their own ways until they carry everything down to destruction, and you will probably be lucky if you get out with your life.”

Isaiah had been very willing to take on the job — in fact, he had asked for it — but the prospect put a new face on the situation. It raised the obvious question: Why, if all that were so — if the enterprise were to be a failure from the start — was there any sense in starting it? “Ah,” the Lord said, “you do not get the point. There is a Remnant there that you know nothing about. They are obscure, unorganized, inarticulate, each one rubbing along as best he can. They need to be encouraged and braced up because when everything has gone completely to the dogs, they are the ones who will come back and build up a new society; and meanwhile, your preaching will reassure them and keep them hanging on. Your job is to take care of the Remnant, so be off now and set about it.”

love_revolution

Quote above from “Isaiah’s Job” by 

See also: Tom Wood’s podcast 382 Ron Paul and the Remnant: A Lesson in Politics, Strategy, and Liberty

Posted in Politics | Tagged , , , , | Leave a comment

Current Time as a Fraction of Current Year

I had the need to represent time as a fraction of a year, so I came up with this little program to do the conversion for me.  (using in Redlion Crimson 3) Continue reading

Posted in Industrial Automation | Tagged , , , , , | Leave a comment

Undocumented Secrets of Integrating BACnet MSTP

After too many hours of struggling though trial and error, packet sniffing, and lots of various materials found on the Internet, I have uncovered a few very important secrets that were not readily apparent in the official vendor documentation I had available.

The device I was working with:  Trane UC400 BACnet Communications Interface

In general, none of the BACnet configuration software or documentation makes reference to the number of data bits, parity, or stop bits used.  Baud is the only thing that is set.  The problem is that unless you are integrating with something specific to BACnet, you will need to set these parameters.  Here they are: Continue reading

Posted in Industrial Automation | Tagged , , , | 1 Comment

Water Flowing around the Gallimore House

Due to all the rain and melting snow, we have water pooling and flowing in areas I’ve never seen water at before.  Here are a two videos of the streams surrounding us right now.

Continue reading

Posted in Outdoors | Tagged , , , | Leave a comment

Build Your Own Non-Linear Response

It is common to control the speed of a pump based on a sensor reading.  But what if you want the pump speed to change at a different rate at different parts of the sensor range?  If the response isn’t approximated by an equation, you can break down the response in to segments and use a new equation for each segment.  That is exactly what is done here.

Continue reading

Posted in Industrial Automation | Tagged , , , | Leave a comment