Skip to content
Snippets Groups Projects
Commit 39279ba3 authored by Adam Friedrich Schrey's avatar Adam Friedrich Schrey
Browse files

Update Sandkasten.ipynb

parent 33201aae
No related branches found
No related tags found
1 merge request!1merge develop into master
%% Cell type:markdown id:sacred-child tags:
# <span style='color:OrangeRed'>Sandkasten</span>
%% Cell type:code id:adaptive-optimum tags:
``` python
from systheo2functions import *
%matplotlib inline
```
%% Cell type:code id:outdoor-confidence tags:
``` python
# Untersuche Eigenschaften einer beliebigen Regelstrecke:
Gs = 80/((1+2*s)**7) #Gebe hier eine beliebige Funktion ein; s**N steht für s^N
print("Gs:"+str(Gs))
plt_bode(Gs)
margin(Gs)
#plt_nyquist(G,x-Skalierung,y-Skalierung,x-Anfang,x-Ende):
plt_nyquist(Gs,0.5,0.4,-20,0) #Benutze plt_nyquist(Gs,1,1,0,0) um das ganze Diagramm zu sehen
```
%% Cell type:code id:fresh-reviewer tags:
``` python
# Erstellen einer einfachen Simulation mit einem Eingangs- und einem Ausgangs-Signal:
tini = 0 # Start time
tfinal = 1.5 # End time
dt = 0.001 # Time Step
nflows = 3 # Number of data flows in the schematic
Ts = 0.1 # Sampling time for discrete time
sc = Schema(tini,tfinal,dt,nflows) # Instance of the simulation schematic
c1 = SinusoidalSignalSource(1,0,1,2*pi,0)#SinusoidalSignalSource(out,startv,Am,om,phi)
c2 = TransferFunction(1,2,[1],[1,1]);#TransferFunction(inp,out,num,den)
sc.AddListComponents(np.array([c1,c2]));
#Run the schematic and plot:
out = sc.Run(np.array([1, 2]))
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
fig.set_dpi(120)
ax.plot(out[0,:],out[1,:],out[0,:],out[2,:])
ax.grid()
ax.legend(['Eingangssignal (SinusoidalSignalSource)','Ausgangssignal durch TransferFunction'])
plt.show()
```
%% Cell type:code id:hungry-newton tags:
``` python
```
%% Cell type:code id:elementary-lambda tags:
``` python
```
%% Cell type:code id:moving-knock tags:
``` python
```
%% Cell type:markdown id:sapphire-member tags:
# Liste nützlicher Funktionen für Matrizen und Funktionen:
# Liste nützlicher Funktionen für Matrizen und mathematische Funktionen:
print_det(M)
print_rank(M)
print_eig(M)
matmul_loop(mats)
plt_bode(G)
plt_nyquist(G,scale_x,scale_y,x0,x1)
margin(G)
# Liste nützlicher Klassen für Simulationen:
StepSource(out,startv,endv,ts)
SinusoidalSignalSource(out,startv,Am,om,phi)
SquareSignal(out,hi,lo,f,duty)
Constant(out,value)
Division(in1,in2,out)
Product(in1,in2,out)
Sum(in1,in2,out,sign1,sign2)
Saturation(inp,out,minout,maxout)
Gain(inp,out,k)
PI(inp,out,Kp,Ki,ini)
PID(inp,out,Kp,Ki,Kd,ini)
Integrator(inp,out,ini)
Not(inp,out)
StateSpace(inp,out,A,B,C,D,xo)
TransferFunction(inp,out,num,den)
### -------
FIR(inp,out,a,ts)
DTIntegral(inp,out,ts,xo)
ZOH(inp,out,ts)
DTDelay(inp,out,init,ts)
IIR(inp,out,a,b,ts)
DTTransferFunction(inp,out,num,den,Ts)
DTStateSpace(inp,out,A,B,C,D,xo,Ts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment