Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEV - High Energy Ventilator
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
HEV - High Energy Ventilator
Commits
625540db
Commit
625540db
authored
4 years ago
by
Your Name
Browse files
Options
Downloads
Patches
Plain Diff
master merged pid_dev
parent
6976257f
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arduino/hev_prototype_v1/src/BreathingLoop.cpp
+2
-2
2 additions, 2 deletions
arduino/hev_prototype_v1/src/BreathingLoop.cpp
raspberry-dataserver/CommsDebug.py
+16
-11
16 additions, 11 deletions
raspberry-dataserver/CommsDebug.py
with
18 additions
and
13 deletions
arduino/hev_prototype_v1/src/BreathingLoop.cpp
+
2
−
2
View file @
625540db
...
...
@@ -103,7 +103,7 @@ void BreathingLoop::updateReadings()
//volume = Integral
//flow = Derivative
_valves_controller
.
setValves
(
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
_valve_inhale_PID_percentage
*
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
);
//
_valves_controller.setValves(VALVE_STATE::CLOSED, VALVE_STATE::CLOSED, _valve_inhale_PID_percentage*VALVE_STATE::OPEN, VALVE_STATE::CLOSED, VALVE_STATE::CLOSED);
}
...
...
@@ -569,4 +569,4 @@ void BreathingLoop::doPID(float target_pressure, float process_pressure, float &
pid_variables
&
BreathingLoop
::
getPIDVariables
()
{
return
_pid
;
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
raspberry-dataserver/CommsDebug.py
+
16
−
11
View file @
625540db
...
...
@@ -32,14 +32,13 @@ class Dependant(object):
def
update_llipacket
(
self
,
payload
):
#logging.info(f"payload received: {payload}")
if
hasattr
(
payload
,
'
ventilation_mode
'
):
logging
.
info
(
f
"
payload received:
{
payload
.
ventilation_mode
}
"
)
#logging.info(f"payload received: {payload.fsm_state}")
if
payload
.
getType
()
==
1
:
logging
.
info
(
f
"
Fsm state:
{
payload
.
fsm_state
}
"
)
#logging.info(f"payload received: {payload.timestamp}")
if
hasattr
(
payload
,
'
duration_inhale
'
):
logging
.
info
(
f
"
payload received: inhale duration =
{
payload
.
duration_inhale
}
"
)
logging
.
info
(
f
"
payload received:
{
payload
}
"
)
#logging.info(f"Fsm state: {payload.fsm_state}")
#if hasattr(payload, 'ventilation_mode'):
# logging.info(f"payload received: {payload.ventilation_mode}")
#if hasattr(payload, 'duration_inhale'):
# logging.info(f"payload received: inhale duration = {payload.duration_inhale} ")
self
.
_llipacket
=
payload
.
getDict
()
# returns a dict
...
...
@@ -51,13 +50,19 @@ async def commsDebug():
await
asyncio
.
sleep
(
1
)
comms
.
writePayload
(
cmd
)
print
(
'
sent cmd start
'
)
toggle
=
2
while
True
:
await
asyncio
.
sleep
(
15
)
cmd
=
CommandFormat
(
cmd_type
=
CMD_TYPE
.
SET_PID
.
value
,
cmd_code
=
CMD_SET_PID
.
KP
.
value
,
param
=
200
)
# to set Kp=0.2, param=200 i.e., milli_Kp
comms
.
writePayload
(
cmd
)
print
(
'
sent cmd set Kp = 0.2
'
)
#
cmd = CommandFormat(cmd_type=CMD_TYPE.SET_PID.value, cmd_code=CMD_SET_PID.KP.value, param=200) # to set Kp=0.2, param=200 i.e., milli_Kp
#
comms.writePayload(cmd)
#
print('sent cmd set Kp = 0.2')
await
asyncio
.
sleep
(
15
)
cmd
=
CommandFormat
(
cmd_type
=
CMD_TYPE
.
GENERAL
.
value
,
cmd_code
=
CMD_GENERAL
.
STOP
.
value
,
param
=
0
)
cmd
=
CommandFormat
(
cmd_type
=
CMD_TYPE
.
GENERAL
.
value
,
cmd_code
=
toggle
,
param
=
0
)
if
toggle
==
2
:
toggle
=
1
else
:
toggle
=
2
comms
.
writePayload
(
cmd
)
print
(
'
sent cmd stop
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment