Skip to content

Commit

Permalink
removed ConstantX components
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Carman committed Jan 9, 2024
1 parent f724bd5 commit fdc907a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 91 deletions.
29 changes: 13 additions & 16 deletions docs/src/connectors/sign_convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ This is demonstrated in the following domains of `Mechanical`, `Electrical`, and

The flow variable (i.e. force) input component for the `Mechanical` domain is

```julia
```@example sign_convention
using ModelingToolkit
using ModelingToolkitStandardLibrary.Mechanical.Translational
@mtkmodel ConstantForce begin
@parameters begin
f = 0
f
end
@components begin
flange = MechanicalPort()
Expand All @@ -75,12 +78,6 @@ end
Here we can see that a positive input force results in an increasing velocity.

```@example sign_convention
using ModelingToolkit
using ModelingToolkitStandardLibrary.Mechanical.Translational
@parameters t
D = Differential(t)
@mtkmodel System begin
@components begin
mass = Mass(; m = 10)
Expand All @@ -98,10 +95,12 @@ full_equations(sys)

The flow variable (i.e. current) input component for the `Electrical` domain is

```julia
```@example sign_convention
using ModelingToolkitStandardLibrary.Electrical
@mtkmodel ConstantCurrent begin
@parameters begin
i = 0
i
end
@components begin
p = Pin()
Expand All @@ -117,8 +116,6 @@ end
Here we can see that a positive input current results in an increasing voltage. Note that the electrical domain uses pins `p` and `n` at each side of the source and energy storage components. The direction of connection is not important here, only that a positive connector `p` connects with a negative connector `n`.

```@example sign_convention
using ModelingToolkitStandardLibrary.Electrical
@mtkmodel System begin
@components begin
capacitor = Capacitor(; C = 10)
Expand Down Expand Up @@ -156,11 +153,13 @@ full_equations(sys)

The flow variable (i.e. mass flow) input component for the `Hydraulic` domain is

```julia
```@example sign_convention
using ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible
@mtkmodel ConstantMassFlow begin
@parameters begin
p_int
dm = 0
dm
end
@components begin
port = HydraulicPort(; p_int)
Expand All @@ -174,8 +173,6 @@ end
A positive input mass flow leads to an increasing pressure (in this case we get increasing density (`rho`), which is directly related to an increasing pressure).

```@example sign_convention
using ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible
@mtkmodel System begin
@components begin
volume = FixedVolume(; vol = 10.0, p_int = 0.0)
Expand Down
25 changes: 0 additions & 25 deletions src/Electrical/Analog/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,4 @@ See [OnePort](@ref)
end
end

"""
ConstantCurrent(; i=0, name)
Acts as an ideal constant current source with no internal resistance.
# Connectors:
- `p`: positive pin
- `n`: negative pin
# Parameters:
- `i`: input current

"""
@mtkmodel ConstantCurrent begin
@parameters begin
i = 0
end
@components begin
p = Pin()
n = Pin()
end
@equations begin
0 ~ p.i + n.i
i ~ -n.i
end
end
2 changes: 1 addition & 1 deletion src/Electrical/Electrical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include("Analog/ideal_components.jl")
export CurrentSensor, PotentialSensor, VoltageSensor, PowerSensor, MultiSensor
include("Analog/sensors.jl")

export Voltage, Current, ConstantCurrent
export Voltage, Current
include("Analog/sources.jl")

# include("Digital/gates.jl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include("utils.jl")
export Cap, Tube, FixedVolume, DynamicVolume
include("components.jl")

export ConstantMassFlow, MassFlow, Pressure, FixedPressure
export MassFlow, Pressure, FixedPressure
include("sources.jl")

end
23 changes: 0 additions & 23 deletions src/Hydraulic/IsothermalCompressible/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,6 @@
Hydraulic mass flow input source
# Connectors:
- `port`: hydraulic port
- `dm`: real input
"""
@mtkmodel ConstantMassFlow begin
@parameters begin
p_int
dm = 0
end
@components begin
port = HydraulicPort(; p_int)
end
@equations begin
port.dm ~ -dm
end
end

"""
MassFlow(; name, p_int)
Hydraulic mass flow input source
# Connectors:
- `port`: hydraulic port
Expand Down
2 changes: 1 addition & 1 deletion src/Mechanical/Translational/Translational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include("utils.jl")
export Mass, Spring, Damper, Fixed
include("components.jl")

export ConstantForce, Force, Position, Velocity, Acceleration
export Force, Position, Velocity, Acceleration
include("sources.jl")

export ForceSensor, PositionSensor
Expand Down
24 changes: 0 additions & 24 deletions src/Mechanical/Translational/sources.jl
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
"""
ConstantForce(; f=0, name)
Linear 1D constant force input source
# Connectors:
- `flange`: 1-dim. translational flange
# Parameters:
- `f`: input force
"""
@mtkmodel ConstantForce begin
@parameters begin
f = 0
end
@components begin
flange = MechanicalPort()
end
@equations begin
# connectors
flange.f ~ -f
end
end

"""
Force(; name)
Expand Down

0 comments on commit fdc907a

Please sign in to comment.