LTspice Transformer issues - transformer-model

I'm struggling with this simple schematic in LTspice.
I just want to made a 1:1 insulation transformer but probably I'm missing something.
In theory it should works, the inductor are identical and the voltage is imposed from the primary V1. The power should be converted so V1 * I1 should be equal V2 * I2, but it doesn't happen.
What am I missing?
Thanks!
LTspice simulation

Thanks Ricardo, I've made the circuit and tested it, all works as expected.
I also made the simulation with PLECS and there the simulation works as expected.
I've found on electronics stackexchange that as ideal transformer they use a 1000H transformer. I still don't know why but with this modify all is now working.

Related

Pitch Shift in p5.js

I've been racking my brain on how to do a pitch shift in p5.js, and I've found documentation for a rate change (pitch and speed together), as well as a speed change without changing pitch. I was trying to experiment with having those run simultaneously, but it appears rate() is only available for p5.SoundFile and speed is only available for p5.MediaElement.
I was wondering if anyone had run across a way to extend functionality from one object to another, or if there was a way to manually extend the functionality somewhere in custom code.
Option 1. Switch to ToneJS
ToneJS is another library that wraps the browser's Audio API and it has a built in PitchShift effect. There's nothing special about p5.sound that makes it better or worse for use with p5.js except maybe that it follows some of the same conventions.
Option 2. Write a Custom Effect
p5.Sound provides a base class p5.Effect which could be used to implement a pitch shift effect however, this would be a pretty challenging project unless you have experience with digital signal processing and the underlying browser Audio API. Here's a Wikipedia page on the algorithm in question.

How to add new parameters to be measured in the result file .sca of the OMNET++ simulator?

I'm doing a research for the VANET network for my master thesis. I'm using OMNET++, SUMO and VEINS, for the evaluation of the performance in a scenario of car accident. For the moment I want to generate some results for the received power, signal to noise ratio, bit-rate and packet collision, based on three types of antenna's. From the results that I'm taking from the .sca file doesn't show those parameters. I have done some modifications in the source codes, but with no results!
So I wanted to ask you, is there any possibility to generate the results of those parameters and if yes can you help or guide me telling in quick steps how to do it well (modifying the source code or something else)?
Hi you can take a look at omnetpp tutorial 5
https://docs.omnetpp.org/tutorials/tictoc/part5/#52-adding-statistics-collection. This should provide you the basics for scalar and vector file analysis.
To all of you that want to know, here is the overall solution:
The MAC layer extracts some control info received from the physical layer [1];
This control info (received power, snr, etc) is given in [2];
We must modify the Mac1609_4.cc to such data as vectors (results in the .vec file) [3];
[1]
https://github.com/sommer/veins/blob/master/src/veins/modules/mac/ieee80211p/Mac1609_4.cc#L558
[2]
https://github.com/sommer/veins/blob/master/src/veins/modules/phy/DeciderResult80211.h
[3] https://doc.omnetpp.org/omnetpp/manual/#sec:sim-lib:coutvector
Next in the Mac1609_4.h add the vector: cOutVector recvPower_dBm;
Now in Mac1609_4.cc add the following:
double power;
power = ((DeciderResult80211*)msg->getControlInfo())->getRecvPower_dBm();
recvPower_dBm.record(power);
This should help to record the parameters that you want!

Obtain GPS Coordinates from A3 Flight Controller using SDK

I am having a hard time finding any documentation on what I am trying to accomplish.
Basically, all I need to do is set up the A3 flight controller to output the GPS coordinates every defined interval through the local SBus port. When connected in Assistant 2, it looks like you can map the A3 output to a number of different functions, including SDK 1-8 which can be defined through code using the onboard SDK.
Here's where I am a bit confused, however. In the same software, if you click on the SDK tab, you can get to a window where you can define what is output, baud rates, etc..:
So my question is, when you define all the output frequencies and settings in the SDK tab, does this information automatically get output to all of the F5-F8 ports that are set to SDK? Basically, I am simply trying to obtain the coordinates so if there is a way to do it without writing code, this would be ideal.
Thank you in advance.
Based on some trial and error, I was able to determine that the parameters defined in the Data and Transmission Rates page are sent through the API port on the A3. After defining the desired frequency, I am able to get the position directly from this port without having to write any code. Hopefully this helps someone else that has the same question.

Using BSCAN_SIME2

I have instantiated the BSCANE2 in my tutorial designs in order to do easy controls and commands into the trial designs, and in order to simulate this I will use the BSCAN_SIME2.
However, I do not seem to find any documentation on this SIME2.
My trials so far on simulating has shown that it does set the SHIFT signal when going through the DR Shift states, but I have not yet been able to get a SEL signal from issuing a USER1 JTAG instruction.
Anyone had success using this simulation component?
Up until now I have just used very simple structures in my test bench. I dont want to build a larger design before I know exactly how to stimulate it.
Thanks.

Recreating bugs in cocos2d iphone

I guess someone must have asked a similar question before, but here goes.
It would be useful to be able to record games so that if a bug happened during the game, the recorded play can be reused later with a fixed build to confirm if the bug is fixed or not. I am using box2d as well and from what I remember it seems as if box2d is not really deterministic, but at least being able to recreate most of the state from the first time would be OK in many cases. Recreating the same randomized values would take reinstating the same time etc I assume. Any insight?
I have been fiddling with calabash-ios with various success. I know it's possible to record plays, and playback them there later. I just assume it wouldn't recreate random values.
A quick look at box2d faq and I think box2d is deterministic enough
For the same input, and same binary, Box2D will reproduce any
simulation. Box2D does not use any random numbers nor base any
computation on random events (such as timers, etc).
However, people often want more stringent determinism. People often
want to know if Box2D can produce identical results on different
binaries and on different platforms. The answer is no. The reason for
this answer has to do with how floating point math is implemented in
many compilers and processors. I recommend reading this article if you
are curious:
http://www.yosefk.com/blog/consistency-how-to-defeat-the-purpose-of-ieee-floating-point.html
If you encapsulate the input state the player gives to the world each time step (eg. in a POD struct) then it's pretty straightforward to write that to a file. For example, suppose you have input state like:
struct inputStruct {
bool someButtonPressed;
bool someOtherKeyPressed;
float accelerometerZ;
... etc
};
Then you can do something like this each time step:
inputStruct currentState;
currentState.someButtonPressed = ...; // set contents from live user input
if ( recording )
fwrite( &currentState, sizeof(inputStruct), 1, file );
else if ( replaying ) {
inputStruct tmpState;
int readCount = fread( &tmpState, sizeof(inputStruct), 1, file );
if ( readCount == 1 )
currentState = tmpState; //overwrite live input
}
applyState( currentState ); // apply forces, game logic from input
world->Step( ... ); // step the Box2D world
Please excuse the C++ centric code :~) No doubt there are equivalent ways to do it with Objective-C.
This method lets you regain live control when the input from the file runs out. 'file' is a FILE* that you would have to open in the appropriate mode (rb or wb) when the level was loaded. If the bug you're chasing causes a crash, you might need to fflush after writing to make sure the input state actually gets written before crashing.
As you have noted, this is highly unlikely to work across different platforms. You should not assume that the replay file will reproduce the same result on anything other than the device that recorded it (which should be fine for debugging purposes).
As for random values, you'll need to ensure that anything using random values that may affect the Box2D world go through a deterministic random generator which is not shared with other code, and you'll need to record the seed that was used for each replay. You might like to use one of the many implementations of Mersenne Twister found at http://en.wikipedia.org/wiki/Mersenne_twister
When I say 'not shared', suppose you also use the MT algorithm to generate random directions for particles, purely for rendering purposes - you would not want to use the same generator instance for that as you do for physics-related randomizations.

Resources