(in-package #:rlc)
-(defun plot-series-rlc-current (v r l c t-inc t-end &optional (t-start 0))
+(defun plot-series-rlc-current (v r l c t-inc t-end &optional (t-start 0)
+ (graph-function 'run-xgraph))
(let ((path (make-pathname
:directory '(:absolute "tmp")
:name
(concatenate 'string "rlc-data-"
(write-to-string (get-universal-time)))
:type "dat")))
- (write-series-rlc-graph path v r l c t-inc t-end t-start)
- (run-xgraph path)
+ (write-series-rlc-current-graph path v r l c t-inc t-end t-start)
+ (funcall graph-function path)
(sleep 2)
(delete-file path)))
(defun write-series-rlc-current-graph (path v r l c t-inc t-end
&optional (t-start 0))
+ (with-open-file (out path :direction :output :if-exists :supersede
+ :if-does-not-exist :create)
+ (write-series-rlc-current-graph-stream out v r l c t-inc t-end t-start)))
+
+(defun write-series-rlc-current-graph-stream (out v r l c t-inc t-end
+ &optional (t-start 0))
(multiple-value-bind (x y)
(series-rlc-current-graph-data v r l c t-inc t-end t-start)
- (with-open-file (out path :direction :output :if-exists :supersede
- :if-does-not-exist :create)
- (dotimes (i (length x))
- (format out "~D ~D~%" (aref x i) (aref y i))))))
+ (dotimes (i (length x))
+ (format out "~D ~D~%" (aref x i) (aref y i)))))
(defun series-rlc-current-graph-data (v r l c t-inc t-end &optional (t-start 0))
(let* ((formula-list (series-rlc-current-formula v r l c))
0)))
(:l
`(lambda (tm)
- (* ,(/ v l) t)))
+ (* ,(/ v l) tm)))
(:rl
`(lambda (tm)
(* ,(/ v r) (- 1 (exp (- (* tm ,(/ r l))))))))