Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
eurotherm2400.mac $Revision: 4.2 $ | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: Temperature | ||||||
Description:
| ||||||
Documentation:
The macros provide users with an interface between SPEC and a EuroTherm 2400 temperature controller. INTERNALS You may declare a motor and a counter, even for the same device! The macro motor/counter macros can handle that. The temperature setpoint (or any other writable modbus tag) is driven as a (macro) motor, the process value "PV" and other tags can be read as (macro) counter. SETUP When used through a serial line, this macro motor set is using a macro set called modbus-rtu.mac. The communication with the Eurotherm controller is done using the modbus binary, called RTU, protocol! Only one controller is allowed in a Spec session. If need arises, that might be changed. Now declare a motor controller: MOTORS DEVICE ADDR <>MODE NUM <>TYPE YES E2400 3 999 Macro Motorsor MOTORS DEVICE ADDR <>MODE NUM <>TYPE YES E2400 id00/modbus/e2408 999 Macro Motors If you use a serial line access, please put the index number of your serial line into the ADDR field (alphanum, hit "'" first). Optionally the Modbus instrument address can be added, seperated from the serial line number with blank. If you access your instrument through a Modbus Tango device server, please enter its address. The Modbus instrument address is a property of the server, you can't change it in Spec. Then create the macro motor: Unit is index num of controller, second is the Modbus TAG address. Number: <>Controller 0: MAC_MOT Unit/[Module/]Channel 0/1 Name Eurot SP Mnemonic m_euro Steps per degree/mm 1 Sign of user * dial 1 Backlash [steps] 0 Steady-state rate [Hz] 1 Base rate [Hz] 1 Acceleration time [msec] 1 Motor accumulator 0 Restrictions <> NONE Dial = accumulator / steps High limit 1000.0000 Current 0.0000 Low limit 0.0000 User = sign * dial + offset Offset 0.0000 `High' limit 1000.0000 Current 0.0000 `Low' limit 0.0000The value steps per degree should reflect, if the controller accepts floating point numbers or not (check Modbus tag address 525). Then hit 'm' twice. Set the following for your motor: Hardware read mode <> PR + AL + NQ Now declare a scaler controller: SCALERS DEVICE ADDR <>MODE NUM <>TYPE YES POLL 1 2 Software Timer YES E2400 3 1 999 Macro Counter The counter is then configured as : Number Name Mnemonic <>Device Unit Chan <>Use As Scale Factor 3 T_euro t_euro MAC_CNT 0 1 counter 1 4 europv europv MAC_CNT 0 901 counter 1 This reads the Process Value (tag address 1) and places the value in the counter t_euro. One can read tag addresses as IEEE floating point numbers. To read a tag address as floating point number, add 900 to its tag address. To read the PV use 901. Other modbus tag addresses are: EXAMPLE As application example, one could create two separate spec session. The first session would start a previously defined program in the controller and then start a timescan. The timescan updates the process value continuously. A client spec session can now fetch the counter value, using the prop_get() builtin. Assume the counter number 3 reads you Eurotherm: 16.HOLG> y = prop_get("localhost:spec", "var/S[3]") 17.HOLG> p y y["3"] = 100.3The same can be accomplished with a simple remote counter :-), but you still have to count to read the instrument! Alternatively, one may trigger the read-out when needed by executing the euro_read macro. This macro will write the result to S[3], too. remote_async("localhost:spec", "euro_read 3")If you use a remote counter, then you can even just say euro_read mne. If you read your instrument through a Eurotherm2400 Tango device server, you can declare the same instrument in several Spec sessions and just read out the process value in a timescan, while the first session could serve to define new programs in the controller. Due to the slow serial line connection, it has to be accounted for the long read out time. For faster handling, it is planned to write a device server, which does a PV polling. For your information from the documentation: There are four different Holdback types. The choice of type is made by setting a parameter when creating a program, and may be one of the following: There is a single Holdback Value which applies to the whole program. However, the Holdback type and whether or not it is enabled, can be applied to the program as a whole, or individually in each segment. INTERNALS Great care has to be taken, when reading selected addresses from the Modbus. Some of the mb addresses are given in 10th. This concerns the values for ramp rate/time and dwell time in segment programming. Also the status values for the remaining segment time in seconds (36) and minutes (63) are return as 10 times of the real value. INTERNALS | ||||||
Macros:
Usage: e2400_debug toggle debug mode for the present macros. euro_read Usage: euro_read mne read PV (process value) from the counter with mnemonic mne. Allows to trigger a read-out without counting. Value is returned, i.e. x = euro_read euro01 euro2400status Usage: euro2400status <manual_setpoint> [unit=<unit>] Gives information about the status of the controller. Not to confuse with europrogstatus, which gives information about a program execution in the controller. This one reads the status bytes on a controller and puts them out in human readable form. Saves you to rtfm. The bits of the fast status read (tag 75) are as follows: 0 Alarm 1 State ( 0 = Safe, 1 = Alarm )After reflexion, Ill give you all that is there :-), 74 to 77 euro2400saveprogram Usage: euro2400saveprogram program_number [file_name] <unit=[0|1|2|..] or mne=some-counter-or-motor> Save the program with number program_number. Optional argument is the filename. Files are saved in ~blissadm/local/spec/userconf. euro2400restoreprogram Usage: euro2400restoreprogram [file_name] [program number] <unit=[0|1|2|..] or mne=some-counter-or-motor> Restore a program previously saved. Only and optional argument is the filename. Files are restored from ~blissadm/local/spec/userconf. euro2400showpid Usage: euro2400showpid <unit=[0|1|2|..] or mne=some-counter-or-motor> Show the PID values for unit euro2400configuration Usage: euro2400configuration <unit=[0|1|2|..] or mne=some-counter-or-motor> Please run without arguments to find out about the possible actions. Put controller into configuration mode and set one of several special cells. The following values influence the macros considerably. They can be set from the computer to make the user experience less painful. Note: no spaces are allowed around the `=` signs! Note: the decimal display will only be valid, if the Resolution is set to 0 (full)!!!
| ||||||
Internal Macros: | ||||||
Usage: __e2400_put(unit, fwaddr, value) __e2400_blockput Usage: __e2400_blockput(unit, fwaddr, num, data) __e2400_get Usage: __e2400_get(unit, fwaddr, num, data) __e2400_put_serial Usage: __e2400_put_serial (node, fwaddr, value) Called by spec __e2400_blockput_serial Usage: __e2400_blockput_serial (node, fwaddr, value) Called by spec __e2400_get_serial Usage: __e2400_get_serial (fwaddr, fwaddr, num, data) Called by spec __e2400_put_tango Usage: __e2400_put_tango (fwaddr, value) (server, fwaddr, value) Called by spec __e2400_blockput_tango Usage: __e2400_blockput_tango (server, fwaddr, nwords, data) Called by spec __e2400_get_tango Usage: __e2400_get_tango (server, fwaddr, num, data) Called by spec.<BR>data is ushort array __euro_rfloat Usage: __euro_rfloat(unit, val) __euro_wfloat Usage: __euro_wfloat(unit, val) E2400_config Usage: E2400_config (mne, type, unit, mod, chan) Called by spec E2400_cmd Usage: E2400_cmd(mne, cmd, p1, p2, p3) Called by spec E2400_par Usage: E2400_par(num, key, action, p1, p2) Called by spec with different keys to handle motor_par(mot,"key",new_value) actions. __euro__float Usage: __euro__float (<data>) Converts 4 byte size values into IEEE floating point value and returns it. The 2408 can be put into a floating point mode (read cell 12550) which then displays values with variable number of floating point numbers. To avoid getting in trouble with that, the protocol allows to read 4 bytes from adresses over 0x8000. Thus, the cell 2 reads from 2 x 2 + 8000h = 8004h = 32772 decimal. __europrog_save_as_scan Usage: __europrog_save_as_scan (starttemp, memarr, nosubprg) Save eurotherm 2400 program from array `memarr` into the SPEC datafile. __e2400_simple Usage: __e2400_simple _europrog_show_values Usage: _europrog_show_values (memarr, unit) this is a special macro for europrog shows the values in a eurotherm program, just the values without conversion. euro2400menu Usage: euro2400menu <unit=[0|1|2|..] or mne=some-counter-or-motor> Set various parameters in the controller. Only possible for unit number 0 in this spec session. _euro_set_serial_parameters Usage: _euro_set_serial_parameters (mne) Setting serial line parameters _euro_search_bisync Usage: _euro_search_bisync(serialline, enda) _europrog_cmd Usage: _europrog_cmd (unit, state) this is a special macro for europrog Sends a program control command to a Eurotherm 2400 series instrument. _europrog_status Usage: _europrog_status (unit) this is a special macro for europrog Reads the status of a program on a Eurotherm 2400 series instrument. This macro has been adapted from the former one in temperature.mac. There seems to be more testing necessary! _europrog_show Usage: _europrog_show (label, starttemp, memarr, nosubprg, unit) this is a special macro for europrog Reads a program from a Eurotherm 2400 series instrument. _europrog_edit Usage: _europrog_edit (memarr, label, unit) this is a special macro for europrog Edit a program Adress calculation is base address 8192 plus number of program (skip 0) times 17*8 _europrog_read Usage: _europrog_read (unit, euro_program_number) this is a special macro for europrog Reads a program from a Eurotherm 2400 series instrument. _europrog_write Usage: _europrog_write (unit, memarr, program_number) this is a special macro for europrog Writes a program on a Eurotherm 2400 series instrument. Adress calculation is base address 8192 plus number of program (skip 0) times 17*8 writing a program has to be done in a selective manner. One can`t just write a block of modbus adresses. Each segment type has arguments, which can be written other _europrog_value_too_high Usage: _europrog_value_too_high(unit, astr, value) _europrog_print_error Usage: _europrog_print_error(str) _europrog_print_so Usage: _europrog_print_so(str, width) europrog_editfield Usage: europrog_editfield (str, width, xpos, ypos) this is a special macro for europrog Edit a field europrog_multiplechoice Usage: europrog_multiplechoice (choice, charr, width, xpos, ypos) this is a special macro for europrog Edit a field __eurotherm_wrapper Usage: __eurotherm_wrapper euro_main Usage: euro_main () This macro function runs a loop to provide interactive communication to an eurotherm device. It reads keyboard input and executes the wished command. _euro_mne2unit Usage: _euro_mne2unit _euro_mne_test Usage: _euro_mne_test _euro_2400_test_function Usage: _euro_2400_test_function(cmd) testattempt_eurotherm2400 Usage: testattempt_eurotherm2400 | ||||||
|