Skip to content

Commit b56f4c7

Browse files
Merge pull request #19 from tshort/tabs
Replace tabs with two spaces
2 parents ee7aa39 + 4c58960 commit b56f4c7

19 files changed

+1294
-1294
lines changed

examples/CauerLowPassFilter.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ using Modia.Electric
7171
# V=StepVoltage(startTime=10, V=1)
7272
V=ConstantVoltage(V=1)
7373
Ground1=Ground()
74-
obs=Float(start=0.0)
74+
obs=Float(start=0.0)
7575
@equations begin
7676
connect(Op1.in_p, G.p)
7777
connect(G1.p, Op2.in_p)
@@ -138,7 +138,7 @@ using Modia.Electric
138138
connect(Op5.in_p, G4.p)
139139
connect(V.p, Ground1.p)
140140
connect(V.n, R1.p)
141-
der(obs) = 100000*(Op5.out.v-obs)
141+
der(obs) = 100000*(Op5.out.v-obs)
142142
end
143143
end
144144

examples/SynchronousExamples.jl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ using Base.Test
1313
a = Var(size=())
1414
b = Var(size=())
1515
c = Var(start=0.0)
16-
obs=Float(start=0.0)
16+
obs=Float(start=0.0)
1717
@equations begin
1818
a = Clock(0.1)
1919
b = sample(time, a)
2020
c = previous(c, a) + 0.5
21-
der(obs) = 1000000*(c-obs)
21+
der(obs) = 1000000*(c-obs)
2222
end
2323
end
2424

@@ -48,7 +48,7 @@ end
4848
vref = 100 # Speed ref.
4949
vd=Float(start=0.0)
5050
u=Float(start=0.0)
51-
fobs=Float(start=0.0)
51+
fobs=Float(start=0.0)
5252
@equations begin
5353
# speed sensor
5454
vd = sample(v, Clock(0.1))
@@ -58,7 +58,7 @@ end
5858

5959
# force actuator
6060
f = hold(u)
61-
der(fobs) = 1000000*(f-fobs)
61+
der(fobs) = 1000000*(f-fobs)
6262
end
6363
end
6464

@@ -70,27 +70,27 @@ plot(result, ("v", "fobs"), figure=1, heading="SpeedControl", figure=15)
7070
@extends MassWithSpringDamper(k=0)
7171
@inherits v, f
7272
K = 2 # Gain of speed P controller
73-
Ti = 2 # Integral time
73+
Ti = 2 # Integral time
7474
vref = 100 # Speed reference
7575
dt=0.1 # sampling interval
7676
vd=Float()
7777
u=Float(start=0)
78-
e=Float()
79-
intE=Float(start=0)
80-
81-
fobs=Float(start=0.0)
78+
e=Float()
79+
intE=Float(start=0)
80+
81+
fobs=Float(start=0.0)
8282
@equations begin
8383
# speed sensor
8484
vd = sample(v, Clock(dt))
8585

8686
# PI controller for speed
87-
e = vref-vd
88-
intE = previous(intE, Clock(dt)) + e
87+
e = vref-vd
88+
intE = previous(intE, Clock(dt)) + e
8989
u = K*(e + intE/Ti)
9090

9191
# force actuator
9292
f = hold(u)
93-
der(fobs) = 1000000*(f-fobs)
93+
der(fobs) = 1000000*(f-fobs)
9494
end
9595
end
9696

@@ -113,7 +113,7 @@ plot(result, ("v", "fobs"), figure=1, heading="SpeedControlPI", figure=16)
113113
vd=Float(size=())
114114
vref=Float(size=())
115115
uInner=Float(start=0.0)
116-
fobs=Float(start=1990)
116+
fobs=Float(start=1990)
117117
@equations begin
118118
# position sensor
119119
xd = sample(x, Clock(0.02))
@@ -128,7 +128,7 @@ plot(result, ("v", "fobs"), figure=1, heading="SpeedControlPI", figure=16)
128128
uInner = KInner*(vref-vd)
129129
# force actuator
130130
f = hold(uInner)
131-
der(fobs) = 100000*(f-fobs)
131+
der(fobs) = 100000*(f-fobs)
132132
end
133133
end
134134

@@ -139,36 +139,36 @@ end
139139
@model DiscretePIController begin
140140
K=0.1 # Gain
141141
Ti=1E10 # Integral time
142-
dt=1.0 # sampling interval
142+
dt=1.0 # sampling interval
143143
ref=1 # set point
144-
u=Float(); ud=Float(size=())
145-
y=Float(); yd=Float(size=())
144+
u=Float(); ud=Float(size=())
145+
y=Float(); yd=Float(size=())
146146
e=Float(size=())
147147
intE=Float(start=0)
148148

149-
fobs=Float(start=0)
149+
fobs=Float(start=0)
150150
@equations begin
151151
# sensor
152152
ud = sample(u, Clock(dt))
153-
# PI controller
153+
# PI controller
154154
e = ref-ud
155155
intE = previous(intE, Clock(dt)) + e
156156
yd = K*(e + intE/Ti)
157157
# actuator
158158
y = hold(yd)
159-
160-
der(fobs) = 100000*(y-fobs)
159+
160+
der(fobs) = 100000*(y-fobs)
161161
end
162162
end
163163

164164

165165
@model SpeedControl2 begin
166166
m=MassWithSpringDamper(d=0.5, k=0)
167-
c=DiscretePIController(K=2, dt=0.1)
167+
c=DiscretePIController(K=2, dt=0.1)
168168
@equations begin
169169
connect(m.v, c.u)
170-
connect(c.y, m.f)
171-
end
170+
connect(c.y, m.f)
171+
end
172172
end
173173

174174
#result = simulate(SpeedControl2, 5.0, storeEliminated=false, logSimulation=true)
@@ -177,12 +177,12 @@ end
177177

178178
@model SpeedControl3 begin
179179
m=MassWithSpringDamper(d=0.5, k=0)
180-
@extends DiscretePIController(K=2, dt=0.1)
181-
@inherits u, y, dt, e, intE
180+
@extends DiscretePIController(K=2, dt=0.1)
181+
@inherits u, y, dt, e, intE
182182
@equations begin
183183
u = m.v
184-
m.f = y
185-
end
184+
m.f = y
185+
end
186186
end
187187

188188
#result = simulate(SpeedControl3, 5.0, storeEliminated=false, logSimulation=true)

src/language/Execution.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,9 @@ makeJSON(ex) = get(operator_table, string(ex), string(ex))
818818
function makeJSON(ex::Array{Any})
819819
[makeJSON(e) for e in ex]
820820
end
821-
821+
822822
function makeJSON(ex::Expr)
823-
if isexpr(ex, :quote) || isexpr(ex, :line)
823+
if isexpr(ex, :quote) || isexpr(ex, :line)
824824
nothing
825825
elseif isexpr(ex, :block)
826826
makeJSON(ex.args[2])

src/language/Instantiation.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ prettyfy(get::GetField) = Symbol(replace(string(get.name), ".", "_")) # get.name
971971
#prettyfy(s::Symbol) = s
972972
prettyfy(ex) = ex
973973
function prettyfy(ex::Expr)
974-
if isexpr(ex, :quote) || isexpr(ex, :line)
974+
if isexpr(ex, :quote) || isexpr(ex, :line)
975975
nothing
976976
elseif isexpr(ex, :block)
977977
prettyfy(ex.args[2])
@@ -995,10 +995,10 @@ Array{Any}
995995
function prettyPrint(e::Expr)
996996
ex = prettyfy(e)
997997
if ex.head === :quote
998-
return ex
999-
elseif ex.head === :(:=)
1000-
return string(prettyPrint(ex.args[1]), " := ", prettyPrint(ex.args[2]))
1001-
end
998+
return ex
999+
elseif ex.head === :(:=)
1000+
return string(prettyPrint(ex.args[1]), " := ", prettyPrint(ex.args[2]))
1001+
end
10021002
Expr(ex.head, [prettyPrint(arg) for arg in ex.args]...)
10031003
end
10041004

src/models/Blocks.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ end
7878
height=1 # Height of step
7979
@extends SignalSource()
8080
@inherits y, offset, startTime
81-
t = Float(start=0.0)
81+
t = Float(start=0.0)
8282
@equations begin
8383
y = offset + (t < startTime ? 0 : height)
84-
der(t) = 1
84+
der(t) = 1
8585
end
8686
end
8787

@@ -94,11 +94,11 @@ end
9494
startTime=0 # Output y = offset for time < startTime
9595
@extends SO()
9696
@inherits y
97-
t = Float(start=0.0)
97+
t = Float(start=0.0)
9898
@equations begin
9999
# y = offset + if time < startTime; 0 else amplitude*sin(2*pi*freqHz*(time - startTime) + phase) end
100100
y = offset + if t < startTime; 0 else amplitude*sin(2*pi*freqHz*(t - startTime) + phase) end
101-
der(t) = 1
101+
der(t) = 1
102102
end
103103
end
104104

src/models/Rotational.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ end
6868
@extends PartialCompliant(phi_rel=Float(size=(), state=false))
6969
@inherits tau, phi_rel
7070
c=Parameter(min=0, start=1.0e5) # Spring constant
71-
d=Parameter()
71+
d=Parameter()
7272
phi_rel0=0 # Unstretched spring angle
7373
@equations begin
7474
tau = c*(phi_rel - phi_rel0) + d*der(phi_rel)
@@ -82,7 +82,7 @@ end
8282
p=Pin()
8383
n=Pin()
8484
flange=Flange()
85-
85+
8686
v=Float(size=())
8787
i=Float(size=())
8888
phi=Float(state=false, size=())

0 commit comments

Comments
 (0)