## Qt source code for controlling Omron E5CC

These 2 weeks I was fiighting with the manual and try to control the device.

In my application, I need to change the temperature super slowly, not jump from 1 point to the other. I heard that there is an internal function called SP-ramp, that seem to fit my purpose, but I don’t really understand the manual….

The program can control most basic functions, record temperature, set the change rate of SP, limit the output (MV).

However, I don’t know how to get the RUN/STOP and AT (Auto-tune) status, so be careful.

The source code is in Github, feel free to download and modify. The program use Modbus for communication, so, you need to set the device.

https://github.com/TripletESR/Omron_PID

I also made a simplified manual, but I do not post in here for copyright issue. If you want, leave a massage.

## Omron E5CC Modbus RTU in QT 101

The Omron E5CC temperature PID controller is using modbus RTU(Remote Terminal Unit) to connect.

First, you prepare a USB-to-RS-485 cable. Connect it to the E5CC. Notice that the A port of the E5CC, should be connected to  negative of the RS-485. Don’t follow the E5CC manual. Also the programing manual is extremely for expert of modbus, not for beginner.

In Modbus, the idea is that, your PC (master) send signal over the connected devices (slaves). The signal is a Hex, contained few things

DeviceID + Function-Code + Address + Command-in-Hex + CRC-16

The master send a signal, only the device with matching DeviceID will respond to the signal. Thus, there is no “locking” that link the master-slave.

The Function-Code is modbus function code, it tell the type of the signal. The type can be reading, writing, diagnostic, etc. This function is part of the modbus protocol, which is common for all devices.

The Address is the memory address stored in the device. The address should be provided by the device manufacture.

Then the command-in-Hex follow.

At the end, a 4-digit Hec CRC-16 is used for error check. Qt can calculate CRC-16 for modbus.

In the Omron E5CC programing manual. Section 4-4-1, we see that the data structure of a read signal. It is read because the Function-Code is 0x03, which is  “Read Holding Registers” in modbus RTU protocal. For example, reading the temperature (PV) of E5CC,

## 010300 0000 02 C4 0B

0x01 is deviceID, this can be set in the E5CC.

0x03 is the function code

0x0002 is number of value we are going to read. In modbus, one value contains 4-digit Hex, or 0xHHHH. In E5CC, each parameter is stored as 8-digit Hex, or 0xHHHHHHHH. Thus the E5CC manual tell us to get 2 values for temperature reading.

0xC408 is the CRC-16

The device return

## 01030400 00 03 E8 FA 8D

04 is the number of 8-digit Bin (2-digit Hex = 8-digit Bin). Four of 8-digit Bin = 8-digit Hex.

00 00 03 E8 is the return value of the temperature, converted to DEC is 1000, which is 100.0 ºC.

Run/Stop command

## 010600 0001 01 49 9A

0x06 is the “Write Single Register” function-Code

0x0101 is the value that start the run/stop for E5CC.

When writing single value in E5CC, only address 0x0000 is allowed. Thus, to write the SV (set value, or SP = Set Point) we have to use write multiple value. (stupid….)

### Write multiple value

The set the alarm upper and lower values

## 011001 0A00 040800 00 03 E8FF FF FC18 8D E9

0x10 is the “Write Multiple Coils”

0x010A is the address of the alarm upper value

0x0004  is the 2 times number of value to be written. In our case, we want to write 2 value, thus the value is 0x4. The address of the next value would be 0x010A + 0x0002 = 0x010C. Since all value use 2 memory slots.

0x08 is the length of the input value. There are 2 value, each value is four 4-digit-Hex, so the input is 0x08.

0x000003E8 is the first value

0xFFFFFC18 is the 2nd value

This structure can also be use to write single value. If we want to change the SV (or Set Point) to 100 ºC. The address is 0x0106.

## 011001 0600 020400 00 00 64

In Qt, there is an example for modus, call master. We can use it for simple I/O.

Here is a screenshot.

First, we go to Tools to setup the Setting

In the E5CC, you have to set the communication mod to be modbus. In modbus, the parity, data bits, and stop bits are no used.

Since we use USB, this is serial port. The port number can be found using

const auto infos = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &info : infos) {
qDebug("PortName     ="+info.portName())
qDebug() <<"description  =" << (!info.description().isEmpty() ?  info.description() : blankString);
qDebug() <<"manufacturer =" << (!info.manufacturer().isEmpty() ? info.manufacturer() : blankString);
qDebug() <<"serialNumber =" << (!info.serialNumber().isEmpty() ? info.serialNumber() : blankString);
qDebug() <<"Location     =" << info.systemLocation();
qDebug() <<"Vendor       =" << (info.vendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : blankString);
qDebug() <<"Identifier   =  << (info.productIdentifier() ? QString::number(info.productIdentifier(), 16) : blankString);
}

In my case, it is COM4, so I put COM4 in the port. Then connect.

The read the temperature. We set the Table (at the lower left corner) to be Holding Register. In the Read (left panel), Start Address is 0, and Number of values to be 2. In the Qt application output, we will see:

qt.modbus: (RTU client) Sent Serial PDU: 0x0300000002
qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x010300000002c40b
qt.modbus: (RTU client) Send successful: 0x0300000002
qt.modbus.lowlevel: (RTU client) Response buffer: “010304”
qt.modbus.lowlevel: (RTU client) Response buffer: “0103040000001cfbfa”

The PDU = Protocol Data Unit, ADU = Accessing Data Unit = DeviceID + PDU + CRC-16. In the last line, the received PDU is 0x03040000001c, the value is 0x0000 and 0x001c=28, which is 18 ºC.

The display in the GUI is:

Now, we try to stop the device.

In the write panel, Start address is 0x0000, and according to the E5CC programing manual, the value consist of two part

## AA BB

AA is the command code

BB is the value

From the manual, the command code for RUN/STOP, 0xAA=0x01, and for STOP 0xBB=0x01. Thus, the value is 0x0101. Then we press write.

The Qt application output is

qt.modbus: (RTU client) Sent Serial PDU: 0x0600000101
qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x010600000101499a
qt.modbus: (RTU client) Send successful: 0x0600000101
qt.modbus.lowlevel: (RTU client) Response buffer: “01”
qt.modbus: (RTU client) Modbus ADU not complete
qt.modbus.lowlevel: (RTU client) Response buffer: “010600000101499a”

And we can see there is a STOP display on the E5CC.

We can see, although the Holding Register is the same, in read, the function code is 0x03, in write, the function code is 0x06. In Qt manual, the QModBusPdu Class, we can see a list of Function-Code. (https://doc.qt.io/qt-5/qmodbuspdu.html#FunctionCode-enum)

This program is limited 10 address, so the operation is limited. This introduction is the basic, I think user can can study the Qt code to know how to use modbus, how to read and write signal. And people can read this website for another modbus 101.

## Absolute polarization measurement by elastic scattering

The magnitude of proton polarization can be measured by NMR technique with a reference. Because the NMR gives the free-induction decay signal, which is a voltage or current. For Boltzmann polarization using strong magnetic field and low temperature, the polarization can be calculated. However, when a reference point is not available, the absolute magnitude of proton polarization can be measured using proton-proton elastic scattering. The principle is the nuclear spin-orbital coupling. That creates left-right asymmetry on the scattering cross section.

Because of spin-orbital interaction:

$V_{ls}(r) = f(r) \vec{l} \cdot \vec{s} ,$

where $f(r)$ is the distance function, $\vec{l}$ is the relative angular momentum, $\vec{s}$ is the spin of the incident proton. In the following picture, the spin of the incident proton can be either out of the plane ($\uparrow$ ) or into the plan ($\downarrow$). When the proton coming above, the angular momentum is into the plane ($\downarrow$). The 4 possible sign of the spin-orbital interaction is shown. We can see, when the spin is up, the spin-orbital force repulses the proton above and attracts the proton below. That creates an asymmetry in the scattering cross section.

The cross section is distorted and characterized using analysing power $A_y$. Analyzing power is proportional to the difference between left-right cross-section. By symmetry (parity, time-reversal) consideration, $A_y = 1 + P sin(2\theta)$ (why?), in center of mass frame. In past post, the transformation between difference Lorentz frame. The angle in the $A_y$ has to be expressed in lab angle. The cross section and $A_y$ can be obtained from http://gwdac.phys.gwu.edu/ .

In scattering experiment, the number of proton (yield) is counted in left and right detectors. The yield should be difference when either proton is polarized. The yield is

$Y(\theta, \phi) = L \epsilon \sigma_0 (1 + cos(\phi)A_y(\theta) P) ,$

where $L$ is the luminosity, $\epsilon$ is the detector efficiency, $\sigma_0$ is the integrated cross-section of un-polarized beam and target of the detector, $P$ is the polarization of either the target or beam. When both target and the beam are polarized, the cross section is

$\sigma = \sigma_0 (1 + (P + P_T)A_y + P P_T C_yy),$

where $C_yy$ is spin-spin correlation due to spin-spin interaction of nuclear force.

Using the left-right yield difference, the absolute polarization of the target or the beam can be found using,

$\displaystyle A_y P = \frac{Y_L - Y_R}{Y_L + Y_R} ,$

where $Y_L = Y(\phi =0)$ and $Y_R = Y(\phi=\pi)$.

## Using day and night temperature difference to generate electricity?

Recently, the temperature difference between day and night is very large, like 10 degrees. What if, we have a heat tank that store the hot air on the day, and release the hot air at night to generate electricity?

I roughly sketched the idea. And the P-T plot is not correct.

An improved version could be a liquid with boiling point like 20 degrees. This tank of liquid will put inside the heat tank. On the day, let the hot air flow and heat up the liquid. A pressure is building up in the tank. At evening, close the heat tank, and insulate it. The hot air in the heat tank can be a buffer for the heat loss. There is another empty liquid tank outside and it is connected with the liquid tank inside with a tube. A turbine is inside the tube. When the temperature dropped at night. the tube was open and the hot gas flow from the liquid tank to release the pressure. This generate electricity. The hot gas meet the cold outdoor liquid tank will cold down and condense. When the sun goes up, the condensed liquid will flow back to the indoor liquid tank and a cycle complete.

In the future, thanks to the global warming, the temperature difference will be larger, and this new energy source harvest the energy in the atmosphere.

An extreme of this heat engine is using the temperature difference between root-top and the basement. Is it as same as the water heating solar panel?

## Energies in a nucleus

There are many kinds of energies, such as single particle energy, potential energy, kinetic energy, separation energy, and Fermi energy. How these energies are related?

I summarized in the following picture that the occupation number as a function of kinetic energy.

Since the nucleus is a highly interactive system, although the temperature of the ground state of a nucleus should be absolute Zero, but the Fermi surface is not sharp but diffusive.

The Fermi energy of a nucleon , which is the maximum kinetic energy of a nucleon, is approximately ~35 MeV.

The potential energy is approximately ~ 50 MeV per nucleon.

There is an additional energy for proton due to Coulomb force, which is a Coulomb barrier.

The separation energy  is the different between the potential energy and Fermi energy.

The single particle energy is the energy for each single particle orbit.

The binding energy for a nucleon is the energy requires to set that nucleon to be free, i.e. the energy difference between the single particle energy and the potential energy.

There is a minimum kinetic energy, using the 3D spherical well as an approximation. The n-th root of the spherical Bessel function can give the energy of n-orbit with angular momentum $l$, so that.

$j_{l}(kR) = 0, k^2=\frac{2 m E}{\hbar^2}$

For $l=0$, $j_0(x) = \frac{sin(x)}{x}$, the 1-st root is $x = \pi/2$, then

$k=\frac{\pi}{2R}$

$\frac{2 m E}{\hbar^2} = \frac{\pi^2}{4 R^2}$

use $R = 1.25 A^{1/3}$,

$E = \frac{\pi^2 \hbar^2}{8 m 1.25^2 A^{2/3}}$

use $\hbar c = 200 MeV \cdot fm$, $mc^2 = 940 MeV$

$E = \frac{33.6}{A^{2/3}} MeV$

we can see, for $^{16}O$, the minimum KE, which is the 1s-orbit, is about 5 MeV.

## on rate equation of para-terphenyl at room temperature

report2011_2

this report is about the parameter of pulsed laser setting for getting optimum polarization.

we plan to write another paper on a more complete rate equation. based on the density matrix of electron and proton.

i am not sure i posted the electron-proton double resonance in here or not, anyway, i post it again.

CW Solid effect

only the 1st part is finished, and it is only for free electron and proton.

## [Pol. p target] Meeting Report (May 26th)

Meeting report (May 26th)

# Done

1. Thermal Polarization measurement ( BG measurement ) ( x187 set data )
2. Optimization of the small system
1. Crystal orientation
2. Microwave power (3.0 ~ 3.5W)
3. Time sequences of laser, microwave and field sweep
4. Laser duty (5%, 10%, 20%, 20%)
3. 13C polarization transfer.
1. Double tuning (making coil and tuners) ( circuit diagram and theory needed to be explained)
2. Circuit changing
1. NMR tower ( switch to 3.2 MHz for Larmor frequency of 13C )
2. The proton spin lock and polarization transfer will be done by other circuit

# Result

1. The thermal polarization cannot be distinguished with the background
2. From the result of 13C polarization transfer, the microwave and the laser may be not at optimization condition.
1. The trigger (or the on/off) signal may be inverted
3. The polarization transfer has negative result due to low proton polarization.

# ToDo

1. Test on the microwave trigger signal (at the end of this week)
2. Optimization at right condition (at the end of next week, June 3rd)
1. The ESR frequency should be matched by fine tuning of magnetic field
3. Spin echo for thermal polarization
4. Laser linear polarization dependency
5. 13C polarization transfer

# Misc.

1. The submission on JSP meeting at Sept.
1. Title = “ Progress report on proton polarization at room temperature “
2. The PSTP meeting at Russian
1. Due to The time conflict, may only participate for from 12th to 14th. Then I have to go back to Japan for joining the JSP meeting on 16th.
3. Establish a communication perform
1. A network based –wiki
2. Whiteboard at the lab
3. To understand each member status and progress

## Historical Review on Solid Polarized Target

by Akira Masaike

this review is on “Proceedings of the 11th International workshop on Polarized Sources and Targets”

the introduction stated that using thermal polarization (brute force method) in low temperature, ~ 0.01K and high magnetic field~10T can produce proton polarization as high as 76%. another way is using dynamical method by paramagnetic materials, (was proposed by Overhauser) the coupling between electron spin and proton spin can polarize proton in higher temperature and lower magnetic field. Abragam proved that by using paramagnetic impurity can also work for non-metallic materials.

Abragam and Jeffries used $La_2 Mg_3 (NO_3)_{12} 24 H_2O$ (or called LMN), containing small percent of neodymium to polarize proton spin by dynamic nuclear polarization at 1963. but the LMN crystal is not good for inelastic reaction because of the low dilution factor ( the ratio of polarized proton to total number of nucleon ), and this produce a lot other un-wanted reactions. and also the crystal is damaged under scattering by relativistic particles.

organic materials are tested and a major breakthrough is by using butanol with water doped with porphyrexide in 1969 by Mango t al.. the polarization is 40% at 1K and 2.5T.  and also, diol with $Cr^{5+}$ were polarized to 45% at 1K and 2.5T by Glättli et al. Masaike et al. was polarized diol up to 80% at temperature lower then 0.5K. Burtanol in $^3He$ cryotat also polarized upto 67%. All these were done in 1969.

deuteron in deuterated organic material can also be polarized. the principle is called “the equal spin temperature model”

$\displaystyle P = B_I( \frac{\mu B }{ 2 k_B T_s} )$

$B_I$ is Brilluin function and $T_s$ is the nuclear spin temperature.

Spin Frozen Target is a technique that the polarized proton spin last long enough with ESR radiation. the theory was developed around 1965 by Schmugge and Jeffries and constructed by Rusell at 1971 in Rutherford laboratory.

$NH_3$ or ammonia has high dilution factor. it was polarized to 70% by doped with ethylene glycol $Cr^{5+}$ complex at 0.5K and 2.5T by Scheffler and Borghini at CERN at 1971. but ammonia has slow growth of polarization and may explode by high intensity proton irradiation at 1983 at CERN.  but later, it was overcomed by Meyer et al. at Bonn. Thanks to Meyer, ammonia becomes a popular polarized target.

High polarization of H, D and $^6Li$ in dilution refrigerator were found in Bonn around 2005. The COMPASS experiment in CERN use target of $latxe ^6LiD$ at polarization 50% at 300mK and 2.5T.

Hydrogen deuteride (HD) has the highest dilution factor and in principle, both can be polarized. the relaxation properties at 0.5K depends on ortho-para and para-ortho conversions of $latxe H_2$ and $latxe D_2$. The polarization for proton and deuteron of 60% and 14% by brute force method at 10mK and 13.5T was done by Grenoble-Orsay group at 2004.

Crystal of Naphthalene (77K) and p-tarphenyl (270K) doped with pentacene have been polarized in 0.3T by Iinuma et al. at 2000. the high temperature and low magnetic field is due to the paramagnetic excited state in pentacene and diamagnetic on ground state. the population of Zeeman  sublevels of the lowest triplet state is 12% for m=+1, 76% for m=0 and 12% for m=-1 regardless of temperature and magnetic field strength. by using ESR radiation and the “integrated solid effect”, the proton can be polarized and remain polarized after the electrons go back to ground state. 70% polarization at liquid nitrogen temperature.

## Dynamic Nuclear Polarization by Electron Spin in the Photoexcited Triplet State: I. Attainment of Proton Polarization of 0.7 at 105K in Naphthalene

This paper reported an excellent detail and considerations on polarization of nuclear spin by Dynamic Nuclear Polarization (DNP) method. the polarizing sample is naphthalene with 0.018mol% of pentacene. Pentacene has a paramagnetic triplet state with population independence of external magnetic field and temperature. This paramagnetic triplet state is very suitable on DNP, since the paramagnetic state like a switch to turn on the nuclear spin relaxation, due to the state will decay to diamagnetic state.

There are 5 conditions for sample:

1. Highly polarization of electron triplet state  ( since it is the source of polarization )
2. High concentration of guest molecule ( another aspect for polarization source ) ( but too high, guest molecule cluster forms and this reduce the polarization )
3. High Inter-System-Crossing rate, which is the rate from higher excited state to the triplet state, so faster the polarization build up time.
4. Long nuclear spin-lattice relaxation time ( the nuclear spin lost rate )
5. Suitable triplet state life time and electron spin-lattice relaxation time. long enough for transfer the electron spin to nuclear spin, but not so long that nuclear spin can use the paramagnetic triplet state as a channel for spin relaxation.
On the laser:
1. the pulse width should longer than the lifetime from excited state to the triplet state, but shorter than the triplet lifetime.
2. the intensity should be very high, so, the triplet state excitation depth increase. but it is not so high to increase the stimulated emission.
3. high intensity may melt the sample.
about the microwave and field sweep:
1. the time interval should be  long and not excess the adiabatic limit.
2. the sweeping range should be cover the ESR line width.
3. the field sweep should be within the lifetime of the triplet state.
they used water as a reference for the polarization measurement. the enhancement Q is defined to be:
$Q = \left( \frac { T E}{N g} \right) / \left( \frac{ T_w E_w}{ N_w g_w } \right)$
where T is temperature, N is number of proton spin, g is receiver gain and  E is the recorded signal amplitude.
at the end of this paper, it talks about some applications.

## symmetry breaking, mass and higg field.

Above curie temperature, the spin of iron is isotropic. The spin can be rotated to any direction without any resistance, they like massless. Below curie temp, the iron has phase transition and all spin now point to a particular direction. And we need some force to rotate the spin direction. The spin has mass now. This is what symmetry breaking in simple manner.

When matter becomes superconduct, the magnetic field inside is decay exponentially,which is similar as Yukawa force. And we said the force carrier particle is massive. The magnetic field decay is due to the copper pair, Which respond to the magnetic field and tend to cancel it. Thus, the direction of copper pair is not isotropic and this is another symmetry breaking due to the external field and low temperature.

At very high temperature, the weak force carriers are massless. And we assign an isotropic field (scaler field) for the force carrier and call it Higg field. The Higg field quata is called Higg boson. It act like the copper pair, which respond with the force carrier. When there is a force carrier, a Higg boson will be induced. And the symmetric breaking in Higg field, the symmetry breaking makes the force carrier has mass. That we need to apply a force to change the motion.