Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IC-Interface Control
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mateus Goto
IC-Interface Control
Commits
5fed8559
Commit
5fed8559
authored
Aug 03, 2022
by
Mateus Goto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[error] socket
parent
71d30d66
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
33 additions
and
10 deletions
+33
-10
Control_Interface/__pycache__/controlInterface.cpython-310.pyc
...ol_Interface/__pycache__/controlInterface.cpython-310.pyc
+0
-0
Control_Interface/controlInterface.py
Control_Interface/controlInterface.py
+3
-1
NHR9400series/NHR9400.py
NHR9400series/NHR9400.py
+15
-6
NHR9400series/NHR9410.py
NHR9400series/NHR9410.py
+2
-1
NHR9400series/NHR9430.py
NHR9400series/NHR9430.py
+4
-0
NHR9400series/__pycache__/NHR9400.cpython-310.pyc
NHR9400series/__pycache__/NHR9400.cpython-310.pyc
+0
-0
NHR9400series/__pycache__/NHR9410.cpython-310.pyc
NHR9400series/__pycache__/NHR9410.cpython-310.pyc
+0
-0
NHR9400series/__pycache__/NHR9430.cpython-310.pyc
NHR9400series/__pycache__/NHR9430.cpython-310.pyc
+0
-0
UtilitiesRei/__pycache__/refineOutput.cpython-310.pyc
UtilitiesRei/__pycache__/refineOutput.cpython-310.pyc
+0
-0
main.py
main.py
+9
-2
No files found.
Control_Interface/__pycache__/controlInterface.cpython-310.pyc
View file @
5fed8559
No preview for this file type
Control_Interface/controlInterface.py
View file @
5fed8559
...
@@ -26,13 +26,15 @@ class controlInterface:
...
@@ -26,13 +26,15 @@ class controlInterface:
else
:
else
:
return
-
1
return
-
1
new
.
locateIp
(
self
.
__listIp
)
new
.
locateIp
(
self
.
__listIp
)
print
(
new
.
getIp
())
print
(
new
.
getS
())
usedIp
=
new
.
getIp
()
usedIp
=
new
.
getIp
()
print
(
"usedIP:"
+
str
(
usedIp
))
print
(
"usedIP:"
+
str
(
usedIp
))
try
:
try
:
self
.
__listIp
.
remove
(
usedIp
)
self
.
__listIp
.
remove
(
usedIp
)
self
.
__listUsedIp
.
append
(
usedIp
)
self
.
__listUsedIp
.
append
(
usedIp
)
if
(
nhr
==
"9410"
)
:
if
nhr
==
"9410"
:
self
.
__nhr9410
.
append
(
new
)
self
.
__nhr9410
.
append
(
new
)
elif
nhr
==
"9430"
:
elif
nhr
==
"9430"
:
self
.
__nhr9430
.
append
(
new
)
self
.
__nhr9430
.
append
(
new
)
...
...
NHR9400series/NHR9400.py
View file @
5fed8559
...
@@ -3,7 +3,7 @@ import socket
...
@@ -3,7 +3,7 @@ import socket
from
UtilitiesRei.refineOutput
import
refineOutput
from
UtilitiesRei.refineOutput
import
refineOutput
class
NHR9400
:
class
NHR9400
()
:
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
__name
=
name
self
.
__name
=
name
...
@@ -23,6 +23,7 @@ class NHR9400:
...
@@ -23,6 +23,7 @@ class NHR9400:
msg
=
self
.
__s
.
recv
(
1024
)
msg
=
self
.
__s
.
recv
(
1024
)
recv
=
self
.
receiveString
(
msg
)
recv
=
self
.
receiveString
(
msg
)
id
=
"NH Research,"
+
str
(
self
.
__name
)
id
=
"NH Research,"
+
str
(
self
.
__name
)
self
.
__s
.
send
(
"SOUR:VOLT: 110
\n
"
.
encode
())
if
recv
.
find
(
id
)
!=
-
1
:
#if find this subtring
if
recv
.
find
(
id
)
!=
-
1
:
#if find this subtring
self
.
__ip
=
client
self
.
__ip
=
client
print
(
self
.
__ip
)
print
(
self
.
__ip
)
...
@@ -35,6 +36,8 @@ class NHR9400:
...
@@ -35,6 +36,8 @@ class NHR9400:
def
getIp
(
self
):
def
getIp
(
self
):
return
self
.
__ip
return
self
.
__ip
def
getS
(
self
):
return
self
.
__s
#chose a mode with the instrument will run, check the manual to see all modes.
#chose a mode with the instrument will run, check the manual to see all modes.
def
configMode
(
self
,
mode
):
def
configMode
(
self
,
mode
):
...
@@ -106,11 +109,12 @@ class NHR9400:
...
@@ -106,11 +109,12 @@ class NHR9400:
#Function to see if exist any error in the carry
#Function to see if exist any error in the carry
def
checkErrors
(
self
):
def
checkErrors
(
self
):
self
.
__s
.
send
(
"SYST:ERR?
\n
"
.
encode
())
self
.
__s
.
send
(
"SYST:ERR?
\n
"
.
encode
())
self
.
__s
.
timeout
(
5
)
value
=
self
.
__s
.
recv
(
1024
)
return
self
.
receive
(
)
return
self
.
receive
String
(
value
)
def
close
(
self
):
def
close
(
self
):
self
.
__s
.
send
(
"SYST:LOC
\n
"
.
encode
())
self
.
__s
.
send
(
"SYST:LOC
\n
"
.
encode
())
print
(
self
.
checkErrors
())
self
.
__s
.
close
()
self
.
__s
.
close
()
# Controle do relé de saída do hardware (LIGAR OU DESLIGAR)
# Controle do relé de saída do hardware (LIGAR OU DESLIGAR)
# 0 OFF - Instrumento desabilitado
# 0 OFF - Instrumento desabilitado
...
@@ -123,7 +127,12 @@ class NHR9400:
...
@@ -123,7 +127,12 @@ class NHR9400:
################################# Setters and Getters ################################################
################################# Setters and Getters ################################################
#set limit voltage of all phases
#set limit voltage of all phases
def
setVoltage
(
self
,
voltage
):
def
setVoltage
(
self
,
voltage
):
self
.
__s
.
send
((
"SOUR:VOLT "
+
str
(
voltage
)
+
"
\n
"
).
encode
())
self
.
__s
.
send
(
"INIT
\n
"
.
encode
())
msg
=
"SOUR:VOLT: 110
\n
"
print
(
msg
)
print
(
self
.
__s
)
self
.
__s
.
send
(
msg
.
encode
())
print
(
"ok"
)
#Functions that sets the limits voltage on one phase (A, B or C)
#Functions that sets the limits voltage on one phase (A, B or C)
def
setVoltageA
(
self
,
voltage
):
def
setVoltageA
(
self
,
voltage
):
self
.
__s
.
send
((
"SOUR:VOLT:APH "
+
str
(
voltage
)
+
"
\n
"
).
encode
())
self
.
__s
.
send
((
"SOUR:VOLT:APH "
+
str
(
voltage
)
+
"
\n
"
).
encode
())
...
@@ -136,7 +145,7 @@ class NHR9400:
...
@@ -136,7 +145,7 @@ class NHR9400:
#Command establishes the True Power limit (W) as a positive value for the selected instrument.
#Command establishes the True Power limit (W) as a positive value for the selected instrument.
def
setPower
(
self
,
pow
):
def
setPower
(
self
,
pow
):
self
.
__s
.
send
((
"SOUR:POW "
+
str
(
pow
)
+
"
\n
"
).
encode
())
self
.
__s
.
send
((
"SOUR:POW
:
"
+
str
(
pow
)
+
"
\n
"
).
encode
())
#Individual command for one phase
#Individual command for one phase
def
setPowerA
(
self
,
pow
):
def
setPowerA
(
self
,
pow
):
self
.
__s
.
send
((
"SOUR:POW:APHase "
+
str
(
pow
)
+
"
\n
"
).
encode
())
self
.
__s
.
send
((
"SOUR:POW:APHase "
+
str
(
pow
)
+
"
\n
"
).
encode
())
...
@@ -201,7 +210,7 @@ class NHR9400:
...
@@ -201,7 +210,7 @@ class NHR9400:
self
.
__s
.
send
(
"FETC:CURR:BPHase?
\n
"
.
encode
())
self
.
__s
.
send
(
"FETC:CURR:BPHase?
\n
"
.
encode
())
value
=
self
.
__s
.
recv
(
1024
)
value
=
self
.
__s
.
recv
(
1024
)
return
self
.
receiveFloat
(
value
)
return
self
.
receiveFloat
(
value
)
def
getCurrentC
(
self
):
def
getCurrentC
(
self
):
self
.
__s
.
send
(
"FETC:CURR:CPHase?
\n
"
.
encode
())
self
.
__s
.
send
(
"FETC:CURR:CPHase?
\n
"
.
encode
())
value
=
self
.
__s
.
recv
(
1024
)
value
=
self
.
__s
.
recv
(
1024
)
...
...
NHR9400series/NHR9410.py
View file @
5fed8559
...
@@ -5,5 +5,6 @@ class NHR9410(NHR9400):
...
@@ -5,5 +5,6 @@ class NHR9410(NHR9400):
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
(
"9410"
)
super
().
__init__
(
"9410"
)
def
getS
(
self
):
return
self
.
__s
NHR9400series/NHR9430.py
View file @
5fed8559
import
socket
from
NHR9400series.NHR9400
import
NHR9400
from
NHR9400series.NHR9400
import
NHR9400
class
NHR9430
(
NHR9400
):
class
NHR9430
(
NHR9400
):
...
@@ -40,6 +41,7 @@ class NHR9430(NHR9400):
...
@@ -40,6 +41,7 @@ class NHR9430(NHR9400):
#set the current of all phases ** Available only to NHR9430-12
#set the current of all phases ** Available only to NHR9430-12
def
setCurrent
(
self
,
current
):
def
setCurrent
(
self
,
current
):
print
(
self
.
__s
)
self
.
__s
.
send
((
"SOUR:CURR "
+
str
(
current
)
+
"
\n
"
).
encode
())
self
.
__s
.
send
((
"SOUR:CURR "
+
str
(
current
)
+
"
\n
"
).
encode
())
#Functions that sets the limite currents on one phase (A, B or C)
#Functions that sets the limite currents on one phase (A, B or C)
def
setCurrentA
(
self
,
current
):
def
setCurrentA
(
self
,
current
):
...
@@ -49,6 +51,8 @@ class NHR9430(NHR9400):
...
@@ -49,6 +51,8 @@ class NHR9430(NHR9400):
def
setCurrentC
(
self
,
current
):
def
setCurrentC
(
self
,
current
):
self
.
__s
.
send
((
"SOUR:CURR:CPHase "
+
str
(
current
)
+
"
\n
"
).
encode
())
self
.
__s
.
send
((
"SOUR:CURR:CPHase "
+
str
(
current
)
+
"
\n
"
).
encode
())
NHR9400series/__pycache__/NHR9400.cpython-310.pyc
View file @
5fed8559
No preview for this file type
NHR9400series/__pycache__/NHR9410.cpython-310.pyc
View file @
5fed8559
No preview for this file type
NHR9400series/__pycache__/NHR9430.cpython-310.pyc
View file @
5fed8559
No preview for this file type
UtilitiesRei/__pycache__/refineOutput.cpython-310.pyc
View file @
5fed8559
No preview for this file type
main.py
View file @
5fed8559
import
socket
import
time
from
Control_Interface.controlInterface
import
controlInterface
from
Control_Interface.controlInterface
import
controlInterface
interface
=
controlInterface
()
interface
=
controlInterface
()
interface
.
__init__
()
interface
.
__init__
()
print
(
interface
.
getListIp
())
print
(
interface
.
getListIp
())
interface
.
newNhr
(
"9410"
)
interface
.
newNhr
(
"9410"
)
interface
.
newNhr
(
"9430"
)
interface
.
newNhr
(
"9430"
)
interface
.
newNhr
(
"9430"
)
#
interface.newNhr("9430")
nhr10
=
[]
nhr10
=
[]
nhr30
=
[]
nhr30
=
[]
...
@@ -17,8 +18,13 @@ nhr30 = interface.getNhr9430()
...
@@ -17,8 +18,13 @@ nhr30 = interface.getNhr9430()
print
(
nhr10
)
print
(
nhr10
)
print
(
nhr30
)
print
(
nhr30
)
for
elem
in
nhr10
:
for
elem
in
nhr10
:
print
(
"nhr10 ip: "
,
elem
.
getIp
())
print
(
"nhr10 ip: "
,
elem
.
getIp
())
elem
.
setVoltage
(
220
)
time
.
sleep
(
1
)
elem
.
setPower
(
0.7
)
print
(
elem
.
checkErrors
())
print
(
"voltage:"
,
elem
.
getVoltage
())
print
(
"voltage:"
,
elem
.
getVoltage
())
print
(
"current:"
,
elem
.
getCurrent
())
print
(
"current:"
,
elem
.
getCurrent
())
print
(
"Power:"
,
elem
.
getPower
())
print
(
"Power:"
,
elem
.
getPower
())
...
@@ -26,6 +32,7 @@ for elem in nhr10:
...
@@ -26,6 +32,7 @@ for elem in nhr10:
for
elem
in
nhr30
:
for
elem
in
nhr30
:
print
(
"nhr30 ip: "
,
elem
.
getIp
())
print
(
"nhr30 ip: "
,
elem
.
getIp
())
elem
.
setCurrent
(
30
)
print
(
"voltage:"
,
elem
.
getVoltage
())
print
(
"voltage:"
,
elem
.
getVoltage
())
print
(
"current:"
,
elem
.
getCurrent
())
print
(
"current:"
,
elem
.
getCurrent
())
print
(
"Power:"
,
elem
.
getPower
())
print
(
"Power:"
,
elem
.
getPower
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment