Author Topic: LTspice and pulse voltage  (Read 12991 times)

0 Members and 1 Guest are viewing this topic.

Offline lk

  • Regular Contributor
  • *
  • Posts: 152
  • Country: dk
LTspice and pulse voltage
« on: August 03, 2012, 08:44:47 pm »
Greetings,
I was playing around with LT Spice, and i wanted to simulate a relay switch between two power sources, i planned to do it with a negative pulse on the voltage source, i don't know if this is the right way to do this. According to the datasheet for the relay the switch time is 1ms.

but what i do know is that the massive spikes can not be good at all, but i guess that is normal behavior when you cut the current path with an inductor in there.


I guess my question is, does this setup properly simulate the relay action, eg the 1 ms switch time where the power is "disconnected". Maybe there is a problem with my raise and fall times, could it be that my load is infact without power for 3 ms?

this is 24 volts and i peak load is 6 A.

-l


 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: nl
Re: LTspice and pulse voltage
« Reply #1 on: August 04, 2012, 12:07:34 pm »
Congratulations, you just invented the boost converter.  :)
I'm not sure what you are trying to do, but yes, these spikes are to be expected in this setup.
If you are trying to switch a relay, shouldn't the relay coil be parallel to the supply?
Keyboard error: Press F1 to continue.
 

Offline lk

  • Regular Contributor
  • *
  • Posts: 152
  • Country: dk
Re: LTspice and pulse voltage
« Reply #2 on: August 04, 2012, 07:51:29 pm »
Doh :)
No I'm not trying to switch the relay, I'm trying to make the "output" of my relay drop voltage as little as possible when the "relay" switches, that's why I'm talking about the 1ms switching time. So I'm trying to figure out if i need to do something to my output to keep it high, or just hope that the 24v PC power supply in this case can survive. That's why I'm messing with the pulses.

So i have 2 independent 24 volt inputs that i need the relay to switch between to the same output, that switch takes 1ms, so i was trying this to see what i could do so that i see as little drop on the output as possible. 

i hope this makes some sense

-lk
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1305
  • Country: 00
Re: LTspice and pulse voltage
« Reply #3 on: August 04, 2012, 08:20:04 pm »
I'm not sure I understand what you're trying to do but if you're trying to keep the relay's coil energized while you switch between two power sources then you might try the attached schematic. 

It will, in a sense, allow you to power the relay from two power sources simultaneously.  In fact, the power supply with the higher voltage will power the coil.  If one power source falls off then the other will pick-up automatically. 

You can use the circuit for switching between two power sources as well.  You can bring one power source online while the other power source is still online thus preventing the relay from dropping out.

The freewheeling diode across the coil will keep the coil energized for a short while in the case where both power supplies fall off.  (You need it anyway to avoid the voltage spikes.)
 

Offline jahonen

  • Super Contributor
  • ***
  • Posts: 1049
  • Country: fi
Re: LTspice and pulse voltage
« Reply #4 on: August 04, 2012, 08:21:50 pm »
If you want to simulate a relay contact changeover, use the voltage controlled switch component, "SW". You just need to parametrize it.

Regards,
Janne
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: nl
Re: LTspice and pulse voltage
« Reply #5 on: August 05, 2012, 08:49:48 am »
So if I understand correctly this is what you are trying to do.
How are you going to control the relay?
Keyboard error: Press F1 to continue.
 

Offline lk

  • Regular Contributor
  • *
  • Posts: 152
  • Country: dk
Re: LTspice and pulse voltage
« Reply #6 on: August 05, 2012, 06:55:33 pm »
PAOPBZ,
This is exactly what i wanted to to, as for how to control the relay, i will most likely need a micro controller, as i have a feeling that even with hysteresis a stand alone comparator looking at the "flaky" source, in this case a PV setup, there is no reason to switch back if its 0100 in the morning, and there is no sunlight, even if the battery should somehow recover.

Jahonen, i will give the "sw" component a look.

But i guess i should still be able to simulate the relay switchover withe the negative pulse i use.

-lk

 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: nl
Re: LTspice and pulse voltage
« Reply #7 on: August 05, 2012, 07:30:31 pm »
I think a simulation would not be very accurate, because what you are interested in is the output of the power supply (so the 3.3, 5 and 12 volts), and not the input, and you are not going to simulate the whole power supply are you?  ;)
And since there are no relays in LT Spice you.d have to build one yourself first. What I would do is take your relay and connect the PSU to both the outputs, switch the relay manually and put a scope on the outputs of the PSU while loading them with what you are intending to do. That way you can see what happens to the outputs while switching the input under load.
something like this:
Keyboard error: Press F1 to continue.
 

Offline lk

  • Regular Contributor
  • *
  • Posts: 152
  • Country: dk
Re: LTspice and pulse voltage
« Reply #8 on: August 06, 2012, 09:19:44 am »
Hi PA0PBZ,

I'm getting an off the shelf 120 watt PSU, i don't want to deal with something like that with my limited knowledge. On your last drawing(I'm wondering what tool you use), the relay should switch  between 2 different 24 volt inputs, to a single 24 volt output, and the coil in the relay is driven from a 5 volt source, but that does not really matter, as i wanted to see how much the output line would "sag"/"drop" during the switch over, while the load is 6A.

And i would like to do this with real parts, but my lab PSU is only 2A, i don't have the batteries or the panels or the PSU. This is the reason why i was trying to simulate a relay switchover, so i at least catch the "low hanging fruit" before i buy anything that turns out not to work as i expected.

-lk
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: nl
Re: LTspice and pulse voltage
« Reply #9 on: August 06, 2012, 04:18:41 pm »
Hi PA0PBZ,

I'm getting an off the shelf 120 watt PSU, i don't want to deal with something like that with my limited knowledge. On your last drawing(I'm wondering what tool you use), the relay should switch  between 2 different 24 volt inputs, to a single 24 volt output, and the coil in the relay is driven from a 5 volt source, but that does not really matter, as i wanted to see how much the output line would "sag"/"drop" during the switch over, while the load is 6A.

The above drawing was just an idea of how you can test the setup, no need to take anything apart, just measure the different voltages when switching the relay with the pushbutton. The drawing was made on circuitlab.com, I normally use LT Spice too but there are no relays in there.
 
Quote
And i would like to do this with real parts, but my lab PSU is only 2A, i don't have the batteries or the panels or the PSU. This is the reason why i was trying to simulate a relay switchover, so i at least catch the "low hanging fruit" before i buy anything that turns out not to work as i expected.

I still think that you can not simulate it without simulating the whole PSU, it strongly depends on the parts inside there, like how big the capacitors are and such. However, my feeling is that a 1 ms lack of supply should not be a problem.
Keyboard error: Press F1 to continue.
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: nl
Re: LTspice and pulse voltage
« Reply #10 on: August 06, 2012, 05:11:30 pm »
This is the best I can think of using LT Spice. If you want to play with it copy the below to an .asc file.
Code: [Select]
Version 4
SHEET 1 880 680
WIRE 128 112 16 112
WIRE 224 112 208 112
WIRE 320 112 304 112
WIRE 400 112 320 112
WIRE 320 128 320 112
WIRE 192 176 192 160
WIRE 144 192 144 160
WIRE 192 192 192 176
FLAG 16 192 0
FLAG 144 192 0
FLAG 400 192 0
FLAG 320 192 0
FLAG 192 272 0
FLAG 192 176 SW
FLAG 400 112 OUT
SYMBOL voltage 16 96 R0
WINDOW 0 24 16 Invisible 2
WINDOW 3 -67 55 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 24
SYMBOL sw 112 112 R270
WINDOW 0 24 16 Invisible 2
WINDOW 3 24 96 Invisible 2
SYMATTR InstName S1
SYMBOL res 320 96 R90
WINDOW 0 0 56 Invisible 2
WINDOW 3 -39 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0.1
SYMBOL polcap 304 128 R0
WINDOW 0 24 8 Invisible 2
WINDOW 3 -84 34 Left 2
SYMATTR InstName C1
SYMATTR Value 10000ยต
SYMATTR Description Capacitor
SYMATTR Type cap
SYMATTR SpiceLine V=35 Irms=995m Rser=0.067 Lser=0
SYMBOL voltage 192 176 R0
WINDOW 0 24 16 Invisible 2
WINDOW 3 38 105 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value PULSE(5 0 0.002 0 0 0.001)
SYMBOL res 384 96 R0
WINDOW 0 36 40 Invisible 2
WINDOW 3 63 57 Left 2
SYMATTR InstName R2
SYMATTR Value 4
TEXT 232 240 Left 2 !.model SW SW(Ron=10m Vt=2.5)
TEXT -52 302 Left 2 !.tran .004
Keyboard error: Press F1 to continue.
 

Offline lk

  • Regular Contributor
  • *
  • Posts: 152
  • Country: dk
Re: LTspice and pulse voltage
« Reply #11 on: August 07, 2012, 06:38:35 am »
Thank You PA0PBZ,

I'm very grateful for the time you have spend helping me with my somewhat imprecise odd questions, but maybe this helps others as well :)

When i have all the bits and pieces i will make a posting on it, if all this has been in response to a problem that is infact not a problem, i think you are right in this.


-lk
 

Offline lk

  • Regular Contributor
  • *
  • Posts: 152
  • Country: dk
Re: LTspice and pulse voltage
« Reply #12 on: August 07, 2012, 07:30:25 pm »
And sometimes problems are just imagined, looks to me like the entire switchover event is done in 50ns, there is no catch diode installed, and its only run off 12volts as that is what the coil can handle. So i guess that i can get away with 1000uF capacitance.


-lk
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: nl
Re: LTspice and pulse voltage
« Reply #13 on: August 08, 2012, 10:48:33 am »
What are we looking at here? Yes, a Rigol scope screendump but it doesn't tell much without the circuit it's measuring.  ;)
Keyboard error: Press F1 to continue.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf