# MTK Control System with Current Not Working

**URL:** https://discourse.julialang.org/t/mtk-control-system-with-current-not-working/129558
**Category:** New to Julia
**Tags:** electricalcomponent, differentialequation, modelling, controlsystems, mtk
**Created:** [June 2, 2025, 1:00pm UTC](https://discourse.julialang.org/t/mtk-control-system-with-current-not-working/129558 "2025-06-02T13:00:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![madtorresga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/madtorresga/32/216920_2.png) [@madtorresga](https://discourse.julialang.org/u/madtorresga)
#### Post date: [June 2, 2025, 1:00pm UTC](https://discourse.julialang.org/t/mtk-control-system-with-current-not-working/129558/1 "2025-06-02T13:00:04Z")

</div>

Hello! I’m trying to implement this exact same [example](https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/tutorials/dc_motor_pi/), but controlling with the current that passes through the resistance instead of the speed in `speed_sensor.w`.

```julia
    @equations begin
        #...
       #connect(current_sensor.i, :y, feedback.input2) #not working
        feedback.input2 ~ current_sensor.i
        connect(R1.n, current_sensor.p)        
        connect(current_sensor.n, L1.p)        
        #...
    end

@named model = DCMotor()

sys = structural_simplify(model)

```

At `structural_simplify` it gives `ERROR: MethodError: no method matching -(::SymbolicUtils.BasicSymbolic{Real}, ::ODESystem) The function `-` exists, but no method is defined for this combination of argument types.`  
Since I’ve had similar issues with other implementations, I figured it could be a beginner’s problem.

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [June 2, 2025, 1:17pm UTC](https://discourse.julialang.org/t/mtk-control-system-with-current-not-working/129558/2 "2025-06-02T13:17:26Z")

</div>

It’s because `feedback.input2` is a connector and not a variable. You would have to do

```julia
feedback.input2.u ~ current_sensor.i

```

instead.

Why does

```julia
connect(current_sensor.i, :y, feedback.input2)

```

not work?
