- added vars to tracer

- added result.m for octave
This commit is contained in:
jens
2020-12-20 12:33:52 +01:00
parent cccfd539c6
commit a3868b0439
2 changed files with 48 additions and 1 deletions
+35
View File
@@ -0,0 +1,35 @@
## Copyright (C) 2020 Jens
##
## This program is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see
## <https://www.gnu.org/licenses/>.
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} results (@var{input1}, @var{input2})
##
## @seealso{}
## @end deftypefn
## Author: Jens <jens@orion>
## Created: 2020-12-20
function retval = results()
load test.mat
subplot(2,1,1)
plot(time, tc_temp_soll, time, tc_temp_ist); grid
subplot(2,1,2)
plot(time, tc_dtemp_soll, time, tc_dtemp_ist, time, tc_dtemp_commanded); grid
endfunction
+13 -1
View File
@@ -29,11 +29,23 @@ class TracerTask(ATask):
time = 0 time = 0
_time = np.empty(0) _time = np.empty(0)
_sensor_temp = np.empty(0)
_tc_temp_ist = np.empty(0)
_tc_dtemp_ist = np.empty(0)
_tc_temp_soll = np.empty(0)
_tc_dtemp_soll = np.empty(0)
_tc_dtemp_commanded = np.empty(0)
while True: while True:
_time = np.append(_time, time) _time = np.append(_time, time)
_sensor_temp = np.append(_sensor_temp, self.sensor.temperature())
_tc_temp_ist = np.append(_tc_temp_ist, self.temp_ctrl.theta_ist)
_tc_dtemp_ist = np.append(_tc_dtemp_ist, self.temp_ctrl.heatrate_ist)
_tc_temp_soll = np.append(_tc_temp_soll, self.temp_ctrl.theta_soll_set)
_tc_dtemp_soll = np.append(_tc_dtemp_soll, self.temp_ctrl.heatrate_soll_set)
_tc_dtemp_commanded = np.append(_tc_dtemp_commanded, self.temp_ctrl.heatrate_soll)
scipy.io.savemat('test.mat', {'time': _time, 'sensor_temp': _sensor_temp, 'tc_temp_ist': _tc_temp_ist, 'tc_dtemp_ist': _tc_dtemp_ist, 'tc_temp_soll': _tc_temp_soll, 'tc_dtemp_soll': _tc_dtemp_soll, 'tc_dtemp_commanded': _tc_dtemp_commanded})
time += 1 time += 1
scipy.io.savemat('test.mat', {'time': _time})
await asyncio.sleep(self.interval) await asyncio.sleep(self.interval)