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
2878fb7c
Commit
2878fb7c
authored
Jul 18, 2022
by
Mateus Goto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MODIFIED] IPfinder with a more general form
parent
6af36fa2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
13 deletions
+32
-13
NHR9400series/NHR9400.py
NHR9400series/NHR9400.py
+0
-10
NHR9400series/NHR9430.py
NHR9400series/NHR9430.py
+11
-0
Utility/IPFinder.py
Utility/IPFinder.py
+6
-1
test.py
test.py
+5
-2
test2.py
test2.py
+10
-0
No files found.
NHR9400series/NHR9400.py
View file @
2878fb7c
...
@@ -51,16 +51,6 @@ class NHR9400:
...
@@ -51,16 +51,6 @@ class NHR9400:
def
setVoltageC
(
self
,
voltage
):
def
setVoltageC
(
self
,
voltage
):
self
.
__s
.
send
(
"SOUR:VOLT:CPHase "
+
voltage
+
"
\n
"
)
self
.
__s
.
send
(
"SOUR:VOLT:CPHase "
+
voltage
+
"
\n
"
)
#set the current of all phases ** Available only to NHR9430-12
def
setCurrent
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR "
+
current
+
"
\n
"
)
#Functions that sets the limite currents on one phase (A, B or C)
def
setCurrentA
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR:APHase "
+
current
+
"
\n
"
)
def
setCurrentB
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR:BPHase "
+
current
+
"
\n
"
)
def
setCurrentC
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR:CPHase "
+
current
+
"
\n
"
)
#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 "
+
pow
+
"
\n
"
)
self
.
__s
.
send
(
"SOUR:POW "
+
pow
+
"
\n
"
)
...
...
NHR9400series/NHR9430.py
View file @
2878fb7c
...
@@ -5,6 +5,17 @@ class NHR9430(NHR9400):
...
@@ -5,6 +5,17 @@ class NHR9430(NHR9400):
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
(
"NHR9410"
)
super
().
__init__
(
"NHR9410"
)
#set the current of all phases ** Available only to NHR9430-12
def
setCurrent
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR "
+
current
+
"
\n
"
)
#Functions that sets the limite currents on one phase (A, B or C)
def
setCurrentA
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR:APHase "
+
current
+
"
\n
"
)
def
setCurrentB
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR:BPHase "
+
current
+
"
\n
"
)
def
setCurrentC
(
self
,
current
):
self
.
__s
.
send
(
"SOUR:CURR:CPHase "
+
current
+
"
\n
"
)
def
locateIp
(
self
,
clients
=
[]):
def
locateIp
(
self
,
clients
=
[]):
for
client
in
clients
:
for
client
in
clients
:
...
...
Utility/IPFinder.py
View file @
2878fb7c
...
@@ -15,7 +15,12 @@ class IPFinder:
...
@@ -15,7 +15,12 @@ class IPFinder:
s
.
connect
((
"10.255.255.255"
,
1
))
s
.
connect
((
"10.255.255.255"
,
1
))
local_ip
=
s
.
getsockname
()[
0
]
local_ip
=
s
.
getsockname
()[
0
]
local_ip
=
local_ip
[:
-
1
]
+
"/24"
splited
=
local_ip
.
split
(
'.'
)
splited
=
local_ip
.
split
(
'.'
)
splited
.
pop
()
splited
.
append
(
"1/24"
)
local_ip
=
"."
.
join
(
splited
)
arp
=
ARP
(
pdst
=
local_ip
)
arp
=
ARP
(
pdst
=
local_ip
)
ether
=
Ether
(
dst
=
"ff:ff:ff:ff:ff:ff"
)
ether
=
Ether
(
dst
=
"ff:ff:ff:ff:ff:ff"
)
packet
=
ether
/
arp
packet
=
ether
/
arp
...
...
test.py
View file @
2878fb7c
...
@@ -9,8 +9,11 @@ def getAllIp():
...
@@ -9,8 +9,11 @@ def getAllIp():
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
.
connect
((
"10.255.255.255"
,
1
))
s
.
connect
((
"10.255.255.255"
,
1
))
local_ip
=
s
.
getsockname
()[
0
]
local_ip
=
s
.
getsockname
()[
0
]
print
(
local_ip
)
splited
=
local_ip
.
split
(
'.'
)
local_ip
=
local_ip
[:
-
1
]
+
"/24"
splited
=
local_ip
.
split
(
'.'
)
splited
.
pop
()
splited
.
append
(
"1/24"
)
local_ip
=
"."
.
join
(
splited
)
print
(
local_ip
)
print
(
local_ip
)
print
(
type
(
local_ip
))
print
(
type
(
local_ip
))
arp
=
ARP
(
pdst
=
local_ip
)
arp
=
ARP
(
pdst
=
local_ip
)
...
...
test2.py
0 → 100644
View file @
2878fb7c
read
=
str
(
"192.168.150.5"
)
splited
=
read
.
split
(
'.'
)
print
(
splited
)
splited
.
pop
()
print
(
splited
)
splited
.
append
(
"1/24"
)
read
=
"."
.
join
(
splited
)
print
(
read
)
\ No newline at end of file
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