Wednesday, 18 January 2017

Tektronix TDS2024 Loging

I have Created a script for logging the measurements.

Note:
I did look at this code https://forum.tek.com/viewtopic.php?t=136170
Which is interesting but does not work with the current version of Python PyVISA lib.
Noting that this code works with version 1.8.
It also has no licence so technically it is copyrighted.  I have included the MIT licence.
With the code.  However this instrument is old so I do not know it it will be of any use to anyone.
on a side note I think VISA is a bad abbreviation for a standard as is the easily confused with the other uses of this name.


 # -*- coding: utf-8 -*-  
 """  
 Created on Tue Jan 17 14:42:26 2017  
   
 @author: craig.wroth  
   
 This Script will produce a Log File of Measurements from a Tektronix
2024B Oscilloscope. This is not the wave forms but the measurements of the 
Oscilloscope that have been set up using the Measure Button.
There is 5 available. The purpose of this is to allow for a very long time to
be monitored ie hours to days. 

See Following for More information
TDS 200-Series Digital Oscilloscope Programmer Manual
   
 Copyright (c) 2016 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy  
 of this software and associated documentation files (the "Software"), to deal  
 in the Software without restriction, including without limitation the rights  
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
 copies of the Software, and to permit persons to whom the Software is  
 furnished to do so, subject to the following conditions:  
   
 The above copyright notice and this permission notice shall be included in all  
 copies or substantial portions of the Software.  
   
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE  
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
 SOFTWARE.  
 """  
   
 import visa  
 import time  
 import os  
   
 rm = visa.ResourceManager()  
 alist = rm.list_resources()  
 print alist # Normaly (u'ASRL1::INSTR', u'ASRL3::INSTR', u'USB::0x0699::0x036A::C102692::INSTR')  
 #Note Our instrument is No3 Hence position 2 in list  
 inst = rm.open_resource(alist[2])  
 NewFile = time.strftime("%a%d%b%Y")+".csv"  
 Rev = 0  
 #Code to Increment File Rev on day  
 while os.path.exists(NewFile) == True:  
   NewFile = time.strftime("%a%d%b%Y")+"rev"+str(Rev)+".csv"  
   Rev = Rev+1  
     
 WF = open(NewFile,'w') #WF -> Working File  
 WF.write("Log File started ")  
 WF.write(time.asctime( time.localtime(time.time()) ))  
 WF.write("\n")  
 WF.close()  
   
 Stime = time.time() #Start Time  
 Duration = 0.1  #Time of test in mins  
 EndTime = Stime + Duration*60  
 SampleTime = 2 # Time between samples in sec note less that 1 not practical  
   
 WF = open(NewFile,'a')  
 WF.write("Time,Measure1,Measure2,Measure3,Measure4,Measure5\n")  
 inst.write(":header off")  
 WF.write("Measure Description,")  
 astring = inst.query("MEASUrement:MEAS1?")  
 print astring   
 WF.write(astring[:len(astring)-1] +",")  
 astring = inst.query("MEASUrement:MEAS2?")  
 print astring   
 WF.write(astring[:len(astring)-1] +",")  
 astring = inst.query("MEASUrement:MEAS3?")  
 print astring   
 WF.write(astring[:len(astring)-1] +",")  
 astring = inst.query("MEASUrement:MEAS4?")  
 print astring   
 WF.write(astring[:len(astring)-1] +",")  
 astring = inst.query("MEASUrement:MEAS5?")  
 print astring   
 WF.write(astring[:len(astring)-1] +",")  
 WF.write("\n")  
   
 inst.write(":header on")  
 while time.time() < EndTime :  
   WF.write(time.strftime("%X")+",")  
   atime = time.time()    
   print (time.strftime("%X"))  
   #print (atime)  
   atime = atime%1 #obtain fractions of seconds  
   #print (atime)  
   astring = inst.query("MEASUrement:MEAS1:VALue?")  
   astring = astring[len("MEASUrement:MEAS1:VALue?"):len(astring)-1] #Befor I discovered inst.write(":header off")  
   WF.write(astring +",")  
   astring = inst.query("MEASUrement:MEAS2:VALue?")  
   astring = astring[len("MEASUrement:MEAS2:VALue?"):len(astring)-1]  
   WF.write(astring +",")  
   astring = inst.query("MEASUrement:MEAS3:VALue?")  
   astring = astring[len("MEASUrement:MEAS3:VALue?"):len(astring)-1]  
   WF.write(astring +",")  
   astring = inst.query("MEASUrement:MEAS4:VALue?")  
   astring = astring[len("MEASUrement:MEAS4:VALue?"):len(astring)-1]  
   WF.write(astring +",")  
   astring = inst.query("MEASUrement:MEAS5:VALue?")  
   astring = astring[len("MEASUrement:MEAS5:VALue?"):len(astring)-1]  
   WF.write(astring +",")  
   WF.write("\n")  
   time.sleep((1-atime)+(SampleTime-1))  
   
   
   
   
 print ("The New File is "+NewFile)   
 print (time.asctime( time.localtime(time.time()) ))  
   
   
   
 WF.close()  
   
 inst.close()  
   

Monday, 9 January 2017

Open Source

Have been looking at Open Source.
Hoping to find something to put some time into as well as get a good picture of what is available to help with my own endeavors.

Open-Source-Software-Top-59-Sites
Useful list of sites

https://www.openhub.net/
Useful search engine for open source

nodebox
Is this Cool or what!

box2d
Another 2D enviroment.

magictools

torque-2d
interesting 2D engine

godot

artist tools and tutorials

https://godotengine.org/
Been seeing good things about this


http://atomicgameengine.com/
This one is interesting and has MIT licenses


OpenRTS
This is a  Open 3D game engine for RTS
Not much action in past 2 years dead ??
Related Project
alchemist

OpenRA
Active Project.  In C# used to redo some clasics such as CC Red Alert and Dune 2000
Has bounties for coding so that is cool.

stratagus
Stratagus - A free fantasy real time strategy game engine
See artical http://www.linuxdevcenter.com/pub/a/linux/2004/07/15/stratagus.html
Move onto Bos-Wars Engine
MegaGlest


lordadamson/strategy_game
Interesting game in Godot



https://indiegamestand.com/
Like steam ??
Redeemable steam keys


Forums Of Interest

http://forum.freegamedev.net/


Blogs

http://freegamer.blogspot.com.au/


Interesting open Games
http://opendungeons.github.io/


freeorion



Space Station 13

Dwarf Fortress

annex conquer the world

https://play0ad.com/