Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
356 changes: 336 additions & 20 deletions Source/Main Dialogs/Catalog/Catalog.nib/designable.nib

Large diffs are not rendered by default.

Binary file modified Source/Main Dialogs/Catalog/Catalog.nib/keyedobjects.nib
Binary file not shown.
5,004 changes: 793 additions & 4,211 deletions Source/Objects/Hardware/HV/NHQ226L/NHQ226L.nib/designable.nib

Large diffs are not rendered by default.

Binary file modified Source/Objects/Hardware/HV/NHQ226L/NHQ226L.nib/keyedobjects.nib
Binary file not shown.
586 changes: 295 additions & 291 deletions Source/Objects/Hardware/USB/LakeShore336/LakeShore336.nib/designable.nib

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
- (IBAction) resetAction:(id)sender;
- (IBAction) sendCommandAction:(id)sender;
- (IBAction) connectAction: (id) aSender;
- (IBAction) getParamsAction:(id)sender;
- (IBAction) loadParamsAction:(id)sender;
- (IBAction) lockAction:(id)sender;
- (IBAction) pollTimeAction:(id)sender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ -(IBAction) loadParamsAction:(id)sender
@try {
[model loadHeaterParameters];
[model loadInputParameters];
NSLog(@"LakeShore336 New parameters loaded.\n");
}
@catch(NSException* localException) {
NSLog( [ localException reason ] );
Expand All @@ -340,6 +341,12 @@ -(IBAction) loadParamsAction:(id)sender
}
}

-(IBAction) getParamsAction:(id)sender
{
[model queryAll]; //do a poll (temp and heat%)
[model queryEverything]; //all the extra stuff
}

- (IBAction) connectionProtocolAction:(id)sender
{
[model setConnectionProtocol:(int)[[connectionProtocolMatrix selectedCell] tag]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
int maxCurrent;
float maxUserCurrent;
int currentOrPower;
int heaterRange;
double lowLimit;
double highLimit;
double minValue;
Expand Down Expand Up @@ -54,8 +55,10 @@
- (NSUInteger) numberPointsInTimeRate;
- (void) timeRateAtIndex:(int)i x:(double*)xValue y:(double*)yValue;
- (NSString*) heaterSetupString;
- (NSString*) heaterRangeSetupString;
- (NSString*) pidSetupString;
- (NSString*) outputSetupString;
- (NSString*) setPointString:(float) aTemperature;

@property (copy,nonatomic) NSString* label;
@property (assign,nonatomic) int channel;
Expand All @@ -68,6 +71,7 @@
@property (assign,nonatomic) double minValue;
@property (assign,nonatomic) double maxValue;
@property (assign,nonatomic) int currentOrPower;
@property (assign,nonatomic) int heaterRange;
@property (assign,nonatomic) BOOL userMaxCurrentEnabled;
@property (assign,nonatomic) int opMode;
@property (assign,nonatomic) int input;
Expand Down
26 changes: 23 additions & 3 deletions Source/Objects/Hardware/USB/LakeShore336/ORLakeShore336Heater.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@implementation ORLakeShore336Heater

@synthesize label,channel,output,resistance, maxCurrent, maxUserCurrent, currentOrPower;
@synthesize label,channel,output,resistance, maxCurrent, maxUserCurrent, currentOrPower, heaterRange;
@synthesize lowLimit,highLimit,minValue,maxValue,timeRate,timeMeasured,userMaxCurrentEnabled;
@synthesize iValue,pValue,dValue,opMode,input,powerUpEnable;

Expand All @@ -50,15 +50,28 @@ - (NSString*) heaterSetupString;
{
return [NSString stringWithFormat:@"HTRSET %d,%d,%d,+%5.3f,%d",channel+1,resistance+1,maxCurrent,maxUserCurrent,currentOrPower+1];
}

- (NSString*) heaterRangeSetupString;
{
return [NSString stringWithFormat:@"RANGE %d,%d",channel+1,heaterRange];
}

- (NSString*) pidSetupString;
{
return [NSString stringWithFormat:@"PID %d,+%.1f,+%.1f,%d",channel+1,pValue,iValue,dValue];
}

- (NSString*) outputSetupString;
{
return [NSString stringWithFormat:@"OUTMODE %d,%d,%d,%d",channel+1,opMode,input,powerUpEnable];
return [NSString stringWithFormat:@"OUTMODE %d,%d,%d,%d",channel+1,opMode,input+1,powerUpEnable];
}

- (NSString*) setPointString:(float)aTemperature;
{
return [NSString stringWithFormat:@"SETP %d,%@%3.2f",channel+1,aTemperature>0?@"+":@"-",aTemperature];
}


- (void) setOutput:(float)aValue
{
output = aValue;
Expand Down Expand Up @@ -101,6 +114,11 @@ - (void) setCurrentOrPower:(int)aValue
currentOrPower = aValue;
}

- (void) setHeaterRange:(int)aValue
{
[[[self undoManager] prepareWithInvocationTarget:self] setHeaterRange:heaterRange];
heaterRange = aValue;
}

- (void) setLowLimit:(double)aValue
{
Expand Down Expand Up @@ -178,13 +196,14 @@ - (id)initWithCoder:(NSCoder*)decoder
//[self setMaxCurrent: [decoder decodeIntegerForKey: @"maxCurrent"]];
[self setMaxUserCurrent:[decoder decodeIntegerForKey: @"maxUserCurrent"]];
[self setCurrentOrPower:[decoder decodeBoolForKey: @"currentOrPower"]];
[self setHeaterRange: [decoder decodeIntegerForKey: @"heaterRange"]];
[self setLowLimit: [decoder decodeFloatForKey: @"lowLimit"]];
[self setHighLimit: [decoder decodeFloatForKey: @"highLimit"]];
[self setMinValue: [decoder decodeFloatForKey: @"minValue"]];
[self setMaxValue: [decoder decodeFloatForKey: @"maxValue"]];
[self setPValue: [decoder decodeFloatForKey: @"pValue"]];
[self setIValue: [decoder decodeFloatForKey: @"iValue"]];
[self setDValue: [decoder decodeIntegerForKey: @"dValue"]];
[self setDValue: [decoder decodeIntegerForKey: @"dValue"]];
[self setLabel: [decoder decodeObjectForKey:@"label"]];
[self setOpMode: [decoder decodeIntForKey: @"mode"]];
[self setInput: [decoder decodeIntForKey: @"input"]];
Expand All @@ -208,6 +227,7 @@ - (void)encodeWithCoder:(NSCoder*)encoder
[encoder encodeInteger:maxCurrent forKey:@"maxCurrent"];
[encoder encodeInteger:maxUserCurrent forKey:@"maxUserCurrent"];
[encoder encodeBool:currentOrPower forKey:@"currentOrPower"];
[encoder encodeInteger:heaterRange forKey:@"heaterRange"];
[encoder encodeFloat:lowLimit forKey:@"lowLimit"];
[encoder encodeFloat:highLimit forKey:@"highLimit"];
[encoder encodeFloat:minValue forKey:@"minValue"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- (void) timeRateAtIndex:(int)i x:(double*)xValue y:(double*)yValue;
- (BOOL) sensorEnabled;
- (NSString*) inputSetupString;
- (NSString*) setPointString;
//- (NSString*) setPointString;

#pragma mark ***Archival
- (id)initWithCoder:(NSCoder*)decoder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ - (NSString*) inputSetupString;
return [NSString stringWithFormat:@"INTYPE %c,%d,%d,%d,%d,%d",'A'+channel,sensorType,autoRange,range,compensation,units];
}

- (NSString*) setPointString;
{
return [NSString stringWithFormat:@"SETP %d,%@%f.2",channel+1,setPoint>0?@"+":@"-",setPoint];
}
//- (NSString*) setPointString;
//{
// return [NSString stringWithFormat:@"SETP %d,%@%3.2f",channel+1,setPoint>0?@"+":@"-",setPoint];
//}


- (NSUInteger) numberPointsInTimeRate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
- (void) resetAndClear;
- (void) pollHardware;
- (void) queryAll;
- (void) queryEverything;
- (void) loadHeaterParameters;
- (void) loadInputParameters;

Expand Down
88 changes: 84 additions & 4 deletions Source/Objects/Hardware/USB/LakeShore336/ORLakeShore336Model.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,23 @@ - (void) queryAll
[self addCmdToQueue:@"HTR? 2"];
}

- (void) queryEverything
{
NSLog(@"LakeShore336 Retriving current settings.\n");
[self addCmdToQueue:@"OUTMODE? 1"];
[self addCmdToQueue:@"OUTMODE? 2"];
[self addCmdToQueue:@"SETP? 1"];
[self addCmdToQueue:@"SETP? 2"];
[self addCmdToQueue:@"RANGE? 1"];
[self addCmdToQueue:@"RANGE? 2"];
[self addCmdToQueue:@"HTRSET? 1"];
[self addCmdToQueue:@"HTRSET? 2"];
[self addCmdToQueue:@"INTYPE? A"];
[self addCmdToQueue:@"INTYPE? B"];
[self addCmdToQueue:@"INTYPE? C"];
[self addCmdToQueue:@"INTYPE? D"];
}

- (int) timeoutCount
{
return timeoutCount;
Expand Down Expand Up @@ -587,6 +604,7 @@ - (void) connectIP
if(!ipConnected){
[self setSocket:[NetSocket netsocketConnectedToHost:ipAddress port:kLakeShore336Port]];
}

}

#pragma mark ***Delegate Methods
Expand Down Expand Up @@ -663,13 +681,17 @@ - (void) systemTest

- (void) resetAndClear
{
[self setLastRequest:nil]; //clear also the queue
[self writeToDevice:@"*RST;*CLS"];
}

- (void) loadHeaterParameters
{
for(id aHeater in heaters){
[self writeToDevice:[aHeater heaterSetupString]];
//grabs from the right inout the setp temp:
[self writeToDevice:[aHeater setPointString:[inputs[[aHeater input]] setPoint]]];
[self writeToDevice:[aHeater heaterRangeSetupString]]; //also start the heater
[self writeToDevice:[aHeater pidSetupString]];
[self writeToDevice:[aHeater outputSetupString]];
}
Expand All @@ -679,7 +701,7 @@ - (void) loadInputParameters
{
for(id anInput in inputs){
[self writeToDevice:[anInput inputSetupString]];
[self writeToDevice:[anInput setPointString]];
//[self writeToDevice:[anInput setPointString]]; //move to heater
}

}
Expand Down Expand Up @@ -802,6 +824,7 @@ - (void) writeToDevice: (NSString*) aCommand
{
if(![self isConnected])return;

if(![aCommand hasSuffix:@"\n"])aCommand = [aCommand stringByAppendingString:@"\n"]; //just to be safe
if(![aCommand hasSuffix:@"\r"])aCommand = [aCommand stringByAppendingString:@"\r"];

switch(connectionProtocol){
Expand Down Expand Up @@ -1006,7 +1029,8 @@ - (void) processOneCommandFromQueue
@synchronized(self){
NSString* aCmd = [self nextCmd];
if(aCmd){
if(![aCmd hasSuffix:@"\n"]) aCmd = [aCmd stringByAppendingString:@"\n"];
//move it to the write
//if(![aCmd hasSuffix:@"\n"]) aCmd = [aCmd stringByAppendingString:@"\n"];

[self writeToDevice: aCmd];
if([aCmd rangeOfString:@"?"].length != NSNotFound){
Expand Down Expand Up @@ -1040,8 +1064,64 @@ - (void) process_response:(NSString*)theResponse
if([channel hasPrefix:@"1"])[[heaters objectAtIndex:0] setOutput:[theResponse floatValue]];
else if([channel hasPrefix:@"2"])[[heaters objectAtIndex:1] setOutput:[theResponse floatValue]];
}
else if([lastRequest hasPrefix:@"INTYPE"]){
// int i = [NSString ]
else if([lastRequest hasPrefix:@"OUTMODE?"]){
NSString* channel = [lastRequest substringFromIndex:9];
NSArray *items = [theResponse componentsSeparatedByString:@","];
int lineNo = -1;
if([channel hasPrefix:@"1"]) lineNo=0;
else if([channel hasPrefix:@"2"]) lineNo=1;
if(lineNo >=0){
[[heaters objectAtIndex:lineNo] setInput:([items[1] intValue]-1)];
[[heaters objectAtIndex:lineNo] setOpMode:[items[0] intValue]];
[[heaters objectAtIndex:lineNo] setPowerUpEnable:[items[2] boolValue]];
}
}
else if([lastRequest hasPrefix:@"SETP?"]){
NSString* channel = [lastRequest substringFromIndex:6];
if([channel hasPrefix:@"1"]){
[inputs[[[heaters objectAtIndex:0] input]] setSetPoint:[theResponse floatValue]];
}
else if([channel hasPrefix:@"2"]){
[inputs[[[heaters objectAtIndex:1] input]] setSetPoint:[theResponse floatValue]];
}
}
else if([lastRequest hasPrefix:@"RANGE?"]){
NSString* channel = [lastRequest substringFromIndex:7];
if([channel hasPrefix:@"1"]){
[[heaters objectAtIndex:0] setHeaterRange:[theResponse intValue]];
}
else if([channel hasPrefix:@"2"]){
[[heaters objectAtIndex:1] setHeaterRange:[theResponse intValue]];
}
}
else if([lastRequest hasPrefix:@"HTRSET?"]){
NSString* channel = [lastRequest substringFromIndex:8];
NSArray *items = [theResponse componentsSeparatedByString:@","];
int lineNo = -1;
if([channel hasPrefix:@"1"]) lineNo=0;
else if([channel hasPrefix:@"2"]) lineNo=1;
if(lineNo >=0){
[[heaters objectAtIndex:lineNo] setResistance:([items[0] intValue]-1)];
[[heaters objectAtIndex:lineNo] setMaxCurrent:[items[1] intValue]];
[[heaters objectAtIndex:lineNo] setMaxUserCurrent:[items[2] floatValue]];
[[heaters objectAtIndex:lineNo] setCurrentOrPower:([items[3] intValue]-1)];
}
}
else if([lastRequest hasPrefix:@"INTYPE?"]){
NSString* channel = [lastRequest substringFromIndex:8];
NSArray *items = [theResponse componentsSeparatedByString:@","];
int lineNo = -1;
if([channel hasPrefix:@"A"]) lineNo=0;
else if([channel hasPrefix:@"B"]) lineNo=1;
else if([channel hasPrefix:@"C"]) lineNo=2;
else if([channel hasPrefix:@"D"]) lineNo=3;
if(lineNo>=0){
[[inputs objectAtIndex:lineNo] setSensorType:[items[0] intValue]];
[[inputs objectAtIndex:lineNo] setAutoRange:[items[1] boolValue]];
[[inputs objectAtIndex:lineNo] setRange:[items[2] intValue]];
[[inputs objectAtIndex:lineNo] setCompensation:[items[3] boolValue]];
[[inputs objectAtIndex:lineNo] setUnits:([items[4] intValue]-1)];
}

}
if([lastRequest rangeOfString:@"?"].location!=NSNotFound){
Expand Down
Loading