Low-Energy Muon (LEM) Experiment  0.5.1
LakeShore340.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "midas.h"
#include "msystem.h"
#include "LakeShore340.h"
#include "ets_logout.h"
#include "lemSCWatchdog.h"
Include dependency graph for LakeShore340.c:

Go to the source code of this file.

Data Structures

struct  LS340_SENSORS
 stores internal informations within the DD. More...
 
struct  LS340_LOOP1
 stores internal informations within the DD. More...
 
struct  LS340_INTERNAL
 stores internal informations within the DD. More...
 
struct  LS340_SETTINGS
 stores internal informations within the DD. More...
 
struct  LS340_ODB_NAMES
 stores internal informations within the DD. More...
 
struct  LS340_INFO
 

Macros

#define LS340_SHUTDOWN   -999
 
#define LS340_MAX_SENSORS   10
 max. number of possible input sensors More...
 
#define LS340_DELTA_R   2.0
 max. allowed deviation between ODB heater resistance and LS340 readback More...
 
#define LS340_TIME_OUT   2000
 time out in msecs for read (rs232) More...
 
#define LS340_MAX_ERROR   3
 maximum number of error messages More...
 
#define LS340_DELTA_TIME_ERROR   3600
 reset error counter after LS340_DELTA_TIME_ERROR seconds More...
 
#define LS340_MAX_TRY_MANY   10
 maximum number of communication attempts for important reads More...
 
#define LS340_MAX_TRY_LESS   3
 maximum number of communication attempts for less important reads More...
 
#define LS340_WAIT   500
 time (ms) to wait between commands More...
 
#define LS340_INIT_ERROR   -2
 initialize error tag More...
 
#define LS340_READ_ERROR   -1
 read error tag More...
 
#define LS340_MAX_AVG   100
 max. length of the average array More...
 
#define LS340_DEBUG   0
 debug tag, if set to TRUE, additional messages will be displayed at execution time More...
 
#define LS340_MAX_READBACK_FAILURE   5
 maximum number of readback failures before a reconnect will take place More...
 
#define LS340_MAX_RECONNECTION_FAILURE   5
 
#define LS340_ETS_LOGOUT_SLEEP   10000
 sleep time (us) between the telnet commands of the ets_logout More...
 
#define LS340_SENSORS_STR   "\Date and Time = STRING : [32] \n\Sensor Type = INT[10]: \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\Calibration Curve = INT[10]: \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\Channel = STRING[10]: \n\[4] A\n\[4] B\n\[4] C1\n\[4] C2\n\[4] C3\n\[4] C4\n\[4] D1\n\[4] D2\n\[4] D3\n\[4] D4\n\Sensor Name = STRING[10]: \n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\Raw Input Ch 1 = FLOAT : 0.0\n\Raw Input Ch 2 = FLOAT : 0.0\n\Raw Input Ch 3 = FLOAT : 0.0\n\Raw Input Ch 4 = FLOAT : 0.0\n\Raw Input Ch 5 = FLOAT : 0.0\n\Raw Input Ch 6 = FLOAT : 0.0\n\Raw Input Ch 7 = FLOAT : 0.0\n\Raw Input Ch 8 = FLOAT : 0.0\n\Raw Input Ch 9 = FLOAT : 0.0\n\Raw Input Ch 10 = FLOAT : 0.0\n\"
 initializing string for LS340_SENSORS More...
 
#define LS340_LOOP1_STR   "\CTRL_CH = STRING : [4] A\n\SetPoint Limit = FLOAT : 350.f\n\Max. Current Tag = INT : 4\n\Max. User Current = FLOAT : 0.85\n\Max. Heater Range = INT : 5\n\Heater Resistance = FLOAT : 25.0\n\"
 initializing string for LS340_LOOP1 More...
 
#define LS340_INTERNAL_STR   "\Detailed Messages = INT : 0\n\ETS_IN_USE = INT : 1\n\SCW_IN_USE = INT : 0\n\No Connection = INT : 1\n\Reconnection Timeout = INT : 10\n\Read Timeout = INT : 5\n\Read Raw Data = BOOL : FALSE\n\ODB Offset = INT : 0\n\ODB Output Path = STRING : [64] /Equipment/LS340 Moddy/Variables/Output\n\Remote = INT : 1\n\# Sensors = INT : 7\n\"
 initializing string for LS340_INTERNAL More...
 
#define LS340_ZONE_STR   "\Zone = STRING[10]: \n\[32] 1, 1, 7, 500, 300, 0, 0, 3\n\[32] 1, 2, 10, 500, 200, 2, 0, 4\n\[32] 1, 3, 15, 500, 100, 2, 0, 4\n\[32] 1, 4, 20, 500, 50, 2, 0, 4\n\[32] 1, 5, 30, 500, 20, 2, 0, 4\n\[32] 1, 6, 320, 500, 20, 2, 0, 5\n\[32] 1, 7, 320, 500, 20, 2, 0, 5\n\[32] 1, 8, 320, 500, 20, 2, 0, 5\n\[32] 1, 9, 320, 500, 20, 2, 0, 5\n\[32] 1, 10, 320, 500, 20, 2, 0, 5\n\"
 
#define LS340_ODB_NAMES_STR   "\LakeShore 340 Name = STRING : [32] Moderator\n\Names In = STRING[8] : \n\[32] LS_Heater\n\[32] LS_SetPoint (read back)\n\[32] LS_Gain P (read back)\n\[32] LS_Reset I (read back)\n\[32] LS_Rate D (read back)\n\[32] LS_HeaterRange (read back)\n\[32] LS_ControlMode (read back)\n\[32] LS_Ramp (read back)\n\Names Out = STRING[8] : \n\[32] LS_Remote (1/0)\n\[32] LS_SetPoint (K)\n\[32] LS_Gain P\n\[32] LS_Reset I\n\[32] LS_Rate D\n\[32] LS_HeaterRange\n\[32] LS_ControlMode\n\[32] LS_Ramp\n\"
 initializing string for LS340_ODB_NAMES More...
 
#define LS340_SCW_STR   "\Proc Name = STRING : [32]\n\PID = INT : -1\n\Log Name = STRING : [64]\n\DD Name = STRING : [32]\n\Last Updated = DWORD : 0\n\Timeout = DWORD : 180\n\"
 defines the slowcontrol default watchdog info structure More...
 

Functions

INT ls340_send_rcv (LS340_INFO *info, char *cmd, char *str, int max_try)
 
INT ls340_get_decode (LS340_INFO *info, INT ch, int *sub_tag)
 
INT ls340_force_update (LS340_INFO *info)
 
void ls340_no_connection (LS340_INFO *info, INT value)
 
void ls340_cryo_name_changed (HNDLE hDB, HNDLE dummy, void *pinfo)
 
INT ls340_in_init (HNDLE hKey, void **pinfo, INT channels, INT(*bd)(INT cmd,...))
 
INT ls340_out_init (HNDLE hKey, void **pinfo, INT channels, INT(*bd)(INT cmd,...))
 
INT ls340_exit (LS340_INFO *info)
 
INT ls340_set (LS340_INFO *info, INT channel, float value)
 
void ls340_check_heater (LS340_INFO *info)
 
INT ls340_get (LS340_INFO *info, INT channel, float *pvalue)
 
INT ls340_in_get_label (LS340_INFO *info, INT channel, char *name)
 
INT ls340_out_get_label (LS340_INFO *info, INT channel, char *name)
 
INT ls340_in (INT cmd,...)
 
INT ls340_out (INT cmd,...)
 

Variables

LS340_INFOinfo
 global info structure, in/out-init routines need the same structure More...
 

Macro Definition Documentation

#define LS340_DEBUG   0

debug tag, if set to TRUE, additional messages will be displayed at execution time

Definition at line 52 of file LakeShore340.c.

Referenced by ls340_send_rcv(), and ls340_set().

#define LS340_DELTA_R   2.0

max. allowed deviation between ODB heater resistance and LS340 readback

Definition at line 34 of file LakeShore340.c.

Referenced by ls340_cryo_name_changed(), and ls340_in_init().

#define LS340_DELTA_TIME_ERROR   3600

reset error counter after LS340_DELTA_TIME_ERROR seconds

Definition at line 39 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_ETS_LOGOUT_SLEEP   10000

sleep time (us) between the telnet commands of the ets_logout

Definition at line 59 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_INIT_ERROR   -2

initialize error tag

Definition at line 45 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_INTERNAL_STR   "\Detailed Messages = INT : 0\n\ETS_IN_USE = INT : 1\n\SCW_IN_USE = INT : 0\n\No Connection = INT : 1\n\Reconnection Timeout = INT : 10\n\Read Timeout = INT : 5\n\Read Raw Data = BOOL : FALSE\n\ODB Offset = INT : 0\n\ODB Output Path = STRING : [64] /Equipment/LS340 Moddy/Variables/Output\n\Remote = INT : 1\n\# Sensors = INT : 7\n\"

initializing string for LS340_INTERNAL

Definition at line 177 of file LakeShore340.c.

Referenced by ls340_in_init().

#define LS340_LOOP1_STR   "\CTRL_CH = STRING : [4] A\n\SetPoint Limit = FLOAT : 350.f\n\Max. Current Tag = INT : 4\n\Max. User Current = FLOAT : 0.85\n\Max. Heater Range = INT : 5\n\Heater Resistance = FLOAT : 25.0\n\"

initializing string for LS340_LOOP1

Definition at line 151 of file LakeShore340.c.

Referenced by ls340_in_init().

#define LS340_MAX_AVG   100

max. length of the average array

Definition at line 49 of file LakeShore340.c.

Referenced by ls340_get(), and ls340_in_init().

#define LS340_MAX_ERROR   3

maximum number of error messages

Definition at line 38 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_MAX_READBACK_FAILURE   5

maximum number of readback failures before a reconnect will take place

Definition at line 55 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_MAX_RECONNECTION_FAILURE   5

Definition at line 56 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_MAX_SENSORS   10

max. number of possible input sensors

Definition at line 33 of file LakeShore340.c.

Referenced by ls340_get(), and ls340_in_init().

#define LS340_MAX_TRY_LESS   3

maximum number of communication attempts for less important reads

Definition at line 41 of file LakeShore340.c.

Referenced by ls340_check_heater(), and ls340_get().

#define LS340_MAX_TRY_MANY   10

maximum number of communication attempts for important reads

Definition at line 40 of file LakeShore340.c.

Referenced by ls340_cryo_name_changed(), ls340_force_update(), ls340_in_init(), and ls340_set().

#define LS340_ODB_NAMES_STR   "\LakeShore 340 Name = STRING : [32] Moderator\n\Names In = STRING[8] : \n\[32] LS_Heater\n\[32] LS_SetPoint (read back)\n\[32] LS_Gain P (read back)\n\[32] LS_Reset I (read back)\n\[32] LS_Rate D (read back)\n\[32] LS_HeaterRange (read back)\n\[32] LS_ControlMode (read back)\n\[32] LS_Ramp (read back)\n\Names Out = STRING[8] : \n\[32] LS_Remote (1/0)\n\[32] LS_SetPoint (K)\n\[32] LS_Gain P\n\[32] LS_Reset I\n\[32] LS_Rate D\n\[32] LS_HeaterRange\n\[32] LS_ControlMode\n\[32] LS_Ramp\n\"

initializing string for LS340_ODB_NAMES

Definition at line 232 of file LakeShore340.c.

Referenced by ls340_in_init().

#define LS340_READ_ERROR   -1

read error tag

Definition at line 46 of file LakeShore340.c.

Referenced by ls340_get().

#define LS340_SCW_STR   "\Proc Name = STRING : [32]\n\PID = INT : -1\n\Log Name = STRING : [64]\n\DD Name = STRING : [32]\n\Last Updated = DWORD : 0\n\Timeout = DWORD : 180\n\"

defines the slowcontrol default watchdog info structure

Definition at line 255 of file LakeShore340.c.

Referenced by ls340_in_init().

#define LS340_SENSORS_STR   "\Date and Time = STRING : [32] \n\Sensor Type = INT[10]: \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\Calibration Curve = INT[10]: \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\1 \n\Channel = STRING[10]: \n\[4] A\n\[4] B\n\[4] C1\n\[4] C2\n\[4] C3\n\[4] C4\n\[4] D1\n\[4] D2\n\[4] D3\n\[4] D4\n\Sensor Name = STRING[10]: \n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\[32] LS_\n\Raw Input Ch 1 = FLOAT : 0.0\n\Raw Input Ch 2 = FLOAT : 0.0\n\Raw Input Ch 3 = FLOAT : 0.0\n\Raw Input Ch 4 = FLOAT : 0.0\n\Raw Input Ch 5 = FLOAT : 0.0\n\Raw Input Ch 6 = FLOAT : 0.0\n\Raw Input Ch 7 = FLOAT : 0.0\n\Raw Input Ch 8 = FLOAT : 0.0\n\Raw Input Ch 9 = FLOAT : 0.0\n\Raw Input Ch 10 = FLOAT : 0.0\n\"

initializing string for LS340_SENSORS

Definition at line 81 of file LakeShore340.c.

Referenced by ls340_in_init().

#define LS340_SHUTDOWN   -999

Definition at line 31 of file LakeShore340.c.

Referenced by ls340_get(), and ls340_send_rcv().

#define LS340_TIME_OUT   2000

time out in msecs for read (rs232)

Definition at line 35 of file LakeShore340.c.

Referenced by ls340_send_rcv().

#define LS340_WAIT   500

time (ms) to wait between commands

Definition at line 43 of file LakeShore340.c.

Referenced by ls340_send_rcv(), and ls340_set().

#define LS340_ZONE_STR   "\Zone = STRING[10]: \n\[32] 1, 1, 7, 500, 300, 0, 0, 3\n\[32] 1, 2, 10, 500, 200, 2, 0, 4\n\[32] 1, 3, 15, 500, 100, 2, 0, 4\n\[32] 1, 4, 20, 500, 50, 2, 0, 4\n\[32] 1, 5, 30, 500, 20, 2, 0, 4\n\[32] 1, 6, 320, 500, 20, 2, 0, 5\n\[32] 1, 7, 320, 500, 20, 2, 0, 5\n\[32] 1, 8, 320, 500, 20, 2, 0, 5\n\[32] 1, 9, 320, 500, 20, 2, 0, 5\n\[32] 1, 10, 320, 500, 20, 2, 0, 5\n\"

initializing string for the zone settings. Each zone string has the following syntax:

loop, zone, top_temp, P, I, D, man_out, range

Definition at line 198 of file LakeShore340.c.

Referenced by ls340_in_init().

Function Documentation

void ls340_check_heater ( LS340_INFO info)

checks the state of the heater and tries to switch it on again if it is disabled.

Parameters
infois a pointer to the DD specific info structure

Definition at line 1553 of file LakeShore340.c.

References LS340_INFO::bd_connected, LS340_INFO::cmode, LS340_INTERNAL::detailed_msg, LS340_INFO::heater_setting, LS340_SETTINGS::intern, LS340_MAX_TRY_LESS, ls340_no_connection(), LS340_INFO::ls340_odb_names, ls340_send_rcv(), LS340_INFO::ls340_settings, LS340_ODB_NAMES::ls_name, LS340_INFO::setpoint, and LS340_SETTINGS::zone.

Referenced by ls340_get().

void ls340_cryo_name_changed ( HNDLE  hDB,
HNDLE  dummy,
void *  pinfo 
)

Hotlink routine which is switching LakeShore340 and ODB relevant informations. Here the details:

Under the DD entry in the ODB, there is a tree Cryos. For each used cryostat there should be an entry with its name (e.g. DD/Cryos/Konti-1). The cryo sub-tree is structured as follows:

  • Heater Resistance: holds the resistance of the cryo's heater.
  • Max. Current Tag: 1->0.25A, 2->0.5A, 3->1.0A, 4->2.0A, 5->User
  • Max. User Current: if Max. Current Tag == 5, this current will be set (given in A).
  • Max. Heater Range: upper limit for the heater range (see LakeShore340 manual, 6-9, 9-27)
  • Sensor Type: sensor types for the 10 possible channels (for sensor types see the LakeShore340 user manual p.9-33, INTYPE).
  • Calibration Curve: calibration curve number for the 10 possible channels (for details see the LakeShore340 user manual p.9-33 INCRV).
  • Channel: channel name (A, B, C1-C4, D1-D4) for the 10 possible channels.
  • Sensor Name: ODB Names of the 10 possible channels.
  • Zone: 10 Zone settings (see LakeShore340 user manual p.9-42 ZONE).

The routine does the following:

  1. read all the above mentioned settings from the cryo specific ODB tree (e.g. DD/Cryos/Konti-1).
  2. write these values to the ODB relevant subtrees (DD/.. etc., for details see the code).
  3. update the LakeShore340 according the settings.

This procedure assures that even after a restart of the frontend, the settings of the new cryo will be used.

WARNING: Two things one should be aware of:

  1. The mlogger needs to be restarted if the ODB names are changed, otherwise the history will not be available.
  2. If the number of temperature channels are different between cryo settings (hopefully not). The frontend needs to be restarted, since the ODB will change!
Parameters
hDBmain ODB handle
dummynot used
pinfois a pointer to the DD specific info structure

Definition at line 575 of file LakeShore340.c.

References LS340_INFO::cryo_name, LS340_INFO::hDB, hKey, LS340_INFO::hkey, info, LS340_SETTINGS::intern, LS340_SETTINGS::loop1, LS340_DELTA_R, LS340_MAX_TRY_MANY, LS340_INFO::ls340_odb_names, ls340_send_rcv(), LS340_INFO::ls340_settings, LS340_ODB_NAMES::ls_name, LS340_LOOP1::max_current_tag, LS340_LOOP1::max_heater_range, LS340_LOOP1::max_user_current, LS340_INTERNAL::no_of_sensors, LS340_INTERNAL::odb_offset, and LS340_LOOP1::setpoint_limit.

Referenced by ls340_in_init().

INT ls340_exit ( LS340_INFO info)

terminates the bus driver and free's the memory allocated for the info structure LS340_INFO.

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure

Definition at line 1388 of file LakeShore340.c.

References LS340_INFO::bd, LS340_INFO::bd_info, LS340_SETTINGS::intern, LS340_INFO::ls340_settings, LS340_INFO::scw, LS340_INTERNAL::scw_in_use, and LS340_INFO::startup_error.

Referenced by ls340_in().

INT ls340_force_update ( LS340_INFO info)

Forces an update when switching to remote. This is necessary, since otherwise there is no synchronization between the Input and Output settings.

Return:

  • FE_SUCCESS if everything went smooth
  • DB_INVALID_HANDLE invalid database handle
  • DB_NO_ACCESS key has no read access
  • DB_NO_KEY key does not exist
Parameters
infois a pointer to the DD specific info structure

Definition at line 424 of file LakeShore340.c.

References hDB, LS340_SETTINGS::intern, LS340_MAX_TRY_MANY, LS340_INFO::ls340_odb_names, ls340_send_rcv(), LS340_INFO::ls340_settings, LS340_ODB_NAMES::ls_name, LS340_INTERNAL::odb_offset, LS340_INTERNAL::odb_output, and LS340_INFO::setpoint.

Referenced by ls340_set().

INT ls340_get ( LS340_INFO info,
INT  channel,
float *  pvalue 
)

reads the values of the LS340.

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure
channelto be set
pvaluepointer to the result

Definition at line 1701 of file LakeShore340.c.

References LS340_INFO::bd, LS340_INFO::bd_connected, LS340_INFO::bd_info, LS340_SENSORS::channel, LS340_INFO::cmode, LS340_INTERNAL::detailed_msg, LS340_INFO::errorcount, LS340_INTERNAL::ets_in_use, ets_logout(), LS340_INFO::first_bd_error, LS340_INFO::hDB, LS340_INFO::heater_setting, LS340_INFO::his_full, LS340_INFO::history, LS340_INFO::hkey, LS340_INFO::hkey_datetime, LS340_INFO::hkey_raw_value, LS340_INFO::ihis, LS340_SETTINGS::intern, LS340_INFO::last_reconnect, LS340_INFO::last_value, LS340_INFO::lasterrtime, ls340_check_heater(), LS340_DELTA_TIME_ERROR, LS340_ETS_LOGOUT_SLEEP, ls340_get_decode(), LS340_INIT_ERROR, LS340_MAX_AVG, LS340_MAX_ERROR, LS340_MAX_READBACK_FAILURE, LS340_MAX_RECONNECTION_FAILURE, LS340_MAX_SENSORS, LS340_MAX_TRY_LESS, ls340_no_connection(), LS340_INFO::ls340_odb_names, LS340_READ_ERROR, ls340_send_rcv(), LS340_INFO::ls340_settings, LS340_SHUTDOWN, LS340_ODB_NAMES::ls_name, LS340_SENSORS::name, LS340_INTERNAL::read_raw_data, LS340_INTERNAL::read_timeout, LS340_INFO::read_timer, LS340_INFO::readback_err, LS340_INFO::readback_failure, LS340_INTERNAL::reconnect_timeout, LS340_INFO::reconnection_failures, LS340_INFO::scw, LS340_INTERNAL::scw_in_use, LS340_SETTINGS::sensor, LS340_INFO::setpoint, and LS340_INFO::startup_error.

Referenced by ls340_in().

INT ls340_get_decode ( LS340_INFO info,
INT  ch,
int *  sub_tag 
)

delivers the correct command tags for LS340_get.

Return: command tag

Parameters
infois a pointer to the DD specific info structure
chcurrent channel
sub_tagpointer to a sub_tag (for PID settings)

Definition at line 360 of file LakeShore340.c.

References LS340_SETTINGS::intern, LS340_INFO::ls340_settings, and LS340_INTERNAL::no_of_sensors.

Referenced by ls340_get().

INT ls340_in ( INT  cmd,
  ... 
)

LakeShore 340 device driver (DD). It is handling the communication between the LS340 and midas.

LS340_in is the part, which handles the communication LS340->MIDAS

RS232: 19200 baud, 8 data bits, 1 stop bit, no parity bit, no hardware protocol, no software protocol, termination: \ r\n (CR LF)

Device Driver info structure entries are organized as:

 info
   |___ ls340_odb_names
   |      |
   |      |__ ls_name
   |      |__ names_in
   |      |__ names_out
   |
   |___ ls340_settings
          |
          |__ intern
          |     |__ ets_in_use
          |     |__ reconnect_timeout
          |     |__ odb_offset
          |     |__ odb_ouput
          |     |__ remote
          |     |__ no_of_senors
          |
          |__ loop1
          |     |__ ctrl_ch
          |     |__ setpoint_limit
          |     |__ max_current_tag
          |     |__ max_heater_range
          |     |__ heater_resitance
          |
          |__ sensor
          |     |__ datetime
          |     |__ type
          |     |__ channel
          |     |__ name
          |     |__ raw_value
          |
          |__ zone
                |__ zone1
                |__ zone2
                |__ zone3
                |__ zone4
                |__ zone5
                |__ zone6
                |__ zone7
                |__ zone8
                |__ zone9
                |__ zone10
  • ls340_odb_names: stores the Input/Output Names which are default to the equipment e.g. 'Remote (1/0)'
    • ls_name: global label for this equipment (e.g. Moderator)
    • names_in: array with required default input names
    • names_out: array with required default output names

ls340_settings: keeps configuration settings, etc.

  • intern: private variables
    • ets_in_use: flag showing if the ets rs232 terminal server is used (1=yes/0=no)
    • reconnection_timeout: timeout in (sec) after which a reconnection attempt is made
    • odb_offset: odb offset for the 'set point' within the output variables. Needed by the forced update routine.
    • odb_output: odb output variable path. Needed by the forced update routine.
    • remote: stores if the LS340 is computer controlled of not
    • no_of_sensors: # used sensors. Max. possible are 10, A and B are internal to the LS340 C1-C4 and D1-D4 are coming from the LS3468 input card The C/D blocks can only handle one type of sensor each at the time i.e. if C1 is a PT100, C2-C4 only can be PT100 as well.
  • loop1: keeps control loop1 related stuff
    • ctrl_ch: which channel is used for the controll loop1
    • setpoint_limit: maximal allowed setpoint
    • max_current_tag: limits the max. current for the heater, 1->0.25A, 2->0.5A, 3->1.0A, 4->2.0A
    • max_heater_range: upper limit for the heater range, i.e. the the demand heater range must be between >= 0 and <= max_heater_range (see LakeShore340 manual, 6-9, 9-27)
    • heater_resitance: resistance of the loop1 heater. It is only used to compare with the readback value of the LS340. If these value differ more than 2 Ohm, an error message is sent out.
  • sensor: info related to the sensors
    • datetime: current date and time, see LakeShore340 manual, p.9-30
    • type: 1-12, see LakeShore340 manual, p.9-33
    • curve: calibration curve, see LakeShore340 manual, p.9-33
    • channel: A, B, C1-C4, D1-D4
    • name: name for each channel
    • raw_value: raw input values, see LakeShore340 manual, p.9-42
  • zone: zone1 to zone10 are the zone setting strings see LakeShore340 manual, p.9-42 the zone strings have the syntax: loop, zone, top_temp, P, I, D, man_out, range

Definition at line 2002 of file LakeShore340.c.

References hKey, info, ls340_exit(), ls340_get(), ls340_in_get_label(), and ls340_in_init().

INT ls340_in_get_label ( LS340_INFO info,
INT  channel,
char *  name 
)

at startup, after initialization of the DD, this routine allows to write default names of the channels into the ODB.

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure
channelof the name to be set
namepointer to the ODB name

Definition at line 1975 of file LakeShore340.c.

References LS340_SETTINGS::intern, LS340_INFO::ls340_odb_names, LS340_INFO::ls340_settings, LS340_SENSORS::name, LS340_ODB_NAMES::names_in, LS340_INTERNAL::no_of_sensors, and LS340_SETTINGS::sensor.

Referenced by ls340_in().

INT ls340_in_init ( HNDLE  hKey,
void **  pinfo,
INT  channels,
INT(*)(INT cmd,...)  bd 
)

Initializes the LS340 device driver, i.e. generates all the necessary structures in the ODB if necessary, initializes the bus driver and the LS340 temperature controller.

Return:

  • FE_SUCCESS if everything went smooth
  • FE_ERR_ODB otherwise
    Parameters
    hKeyis the device driver handle given from the class driver
    pinfois needed to store the internal info structure
    channelsis the number of channels of the device (from the class driver)
    bdis a pointer to the bus driver

Definition at line 1000 of file LakeShore340.c.

References LS340_INFO::bd, LS340_INFO::bd_connected, LS340_INFO::bd_info, LS340_SENSORS::channel, LS340_INFO::cryo_name, LS340_LOOP1::ctrl_ch, LS340_SENSORS::curve, LS340_INFO::errorcount, LS340_INFO::first_bd_error, hDB, LS340_INFO::hDB, LS340_LOOP1::heater_resistance, LS340_INFO::heater_setting, LS340_INFO::his_full, LS340_INFO::history, hKey, LS340_INFO::hkey, LS340_INFO::hkey_datetime, LS340_INFO::hkey_no_connection, LS340_INFO::hkey_raw_value, LS340_INFO::ihis, info, LS340_SETTINGS::intern, LS340_INFO::last_reconnect, LS340_INFO::lasterrtime, LS340_SETTINGS::loop1, ls340_cryo_name_changed(), LS340_DELTA_R, LS340_INTERNAL_STR, LS340_LOOP1_STR, LS340_MAX_AVG, LS340_MAX_SENSORS, LS340_MAX_TRY_MANY, ls340_no_connection(), LS340_INFO::ls340_odb_names, LS340_ODB_NAMES_STR, LS340_SCW_STR, ls340_send_rcv(), LS340_SENSORS_STR, LS340_INFO::ls340_settings, LS340_ZONE_STR, LS340_ODB_NAMES::ls_name, LS340_LOOP1::max_current_tag, LS340_LOOP1::max_heater_range, LS340_LOOP1::max_user_current, LS340_INTERNAL::no_of_sensors, LS340_INFO::num_channels_in, LS340_INFO::read_timer, LS340_INFO::readback_err, LS340_INFO::readback_failure, LS340_INFO::reconnection_failures, LS340_INFO::scw, LS340_INTERNAL::scw_in_use, LS340_SETTINGS::sensor, LS340_INFO::set_startup_counter, LS340_LOOP1::setpoint_limit, LS340_INFO::startup_error, LS340_SENSORS::type, and LS340_SETTINGS::zone.

Referenced by ls340_in().

void ls340_no_connection ( LS340_INFO info,
INT  value 
)

Set's the no connection flag.

Parameters
infois a pointer to the DD specific info structure.
valueequal 1 if the connection is available, otherwise 0.

Definition at line 529 of file LakeShore340.c.

References LS340_INFO::hDB, and LS340_INFO::hkey_no_connection.

Referenced by ls340_check_heater(), ls340_get(), and ls340_in_init().

INT ls340_out ( INT  cmd,
  ... 
)

LakeShore 340 device driver (DD). It is handling the communication between the LS340 and midas.

LS340_out is the part, which handles the communication LS340<-MIDAS

Definition at line 2053 of file LakeShore340.c.

References hKey, info, ls340_out_get_label(), ls340_out_init(), and ls340_set().

INT ls340_out_get_label ( LS340_INFO info,
INT  channel,
char *  name 
)

at startup, after initialization of the DD, this routine allows to write default names of the channels into the ODB.

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure
channelof the name to be set
namepointer to the ODB name

Definition at line 1995 of file LakeShore340.c.

References LS340_INFO::ls340_odb_names, and LS340_ODB_NAMES::names_out.

Referenced by ls340_out().

INT ls340_out_init ( HNDLE  hKey,
void **  pinfo,
INT  channels,
INT(*)(INT cmd,...)  bd 
)

Initializes the LS340 device driver.

Return:

  • FE_SUCCESS if everything went smooth
  • FE_ERR_ODB otherwise
    Parameters
    hKeyis the device driver handle given from the class driver
    pinfois needed to store the internal info structure
    channelsis the number of channels of the device (from the class driver)
    bdis a pointer to the bus driver

Definition at line 1373 of file LakeShore340.c.

References info, and LS340_INFO::num_channels_out.

Referenced by ls340_out().

INT ls340_send_rcv ( LS340_INFO info,
char *  cmd,
char *  str,
int  max_try 
)

send/recieve routine. loops LS340_MAX_TRY times if there would be a communication problem.

Return: number of read bytes

Parameters
infois a pointer to the DD specific info structure
cmdcommand string
strreply string
max_trymaximal number of read trials

Definition at line 314 of file LakeShore340.c.

References LS340_INFO::bd_connected, LS340_DEBUG, LS340_INFO::ls340_odb_names, LS340_SHUTDOWN, LS340_TIME_OUT, LS340_WAIT, and LS340_ODB_NAMES::ls_name.

Referenced by ls340_check_heater(), ls340_cryo_name_changed(), ls340_force_update(), ls340_get(), ls340_in_init(), and ls340_set().

INT ls340_set ( LS340_INFO info,
INT  channel,
float  value 
)

sets the values of the LS340, if the device is remote. It relies on a specific order in the ODB (see code).

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure
channelto be set
valueto be sent to the LS330

Definition at line 1412 of file LakeShore340.c.

References LS340_INFO::bd_connected, LS340_INFO::first_bd_error, LS340_INFO::heater_setting, LS340_SETTINGS::intern, LS340_SETTINGS::loop1, LS340_DEBUG, ls340_force_update(), LS340_MAX_TRY_MANY, LS340_INFO::ls340_odb_names, ls340_send_rcv(), LS340_INFO::ls340_settings, LS340_WAIT, LS340_ODB_NAMES::ls_name, LS340_LOOP1::max_heater_range, LS340_INFO::num_channels_out, LS340_INTERNAL::remote, LS340_INFO::set_startup_counter, LS340_INFO::setpoint, LS340_LOOP1::setpoint_limit, and LS340_INFO::startup_error.

Referenced by ls340_out().

Variable Documentation

LS340_INFO* info

global info structure, in/out-init routines need the same structure

Definition at line 302 of file LakeShore340.c.