Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: stevon8ter on November 29, 2012, 12:36:51 pm
-
Hi guys
I'm new to AXE programming, so don't be to hard on me for my noobie mistakes i made.
So what i want is a program that can simulate an electrical circuit, like this:
(http://postimage.org/image/zec7c4lzl/1bceb6dc/)
And i want to be able to give values to all the components that i know, and then i want it to be able to calculate all ungiven vars.
And maybe let lines auto connect the components instead of letting the user do it? (optional choice)
Ok, so here's a little gif of what i already made so far.
I know, the map routine could probably be a lot smaller and more optimised, idk
I'll add the source as well...
-
I like the concept, it seems a bit like the Proteus software :)
If you're having troubles just ask around, there are many Axe coders which can help you (including me :P ).
-
well i've got some problems... (+ got to recode the while thing) but TheMachine02 is looking into it....
-
Do you even know how to make this kind of simulation software using a different language?
Edit: Do you know analysis techniques to analyze networks?
-
Do you even know how to make this kind of simulation software using a different language?
Edit: Do you know analysis techniques to analyze networks?
No that's something i don't know, the way i'dd do it would take up a lot of space :/ and vars :/
but i just have the tileplacing and i need to know how i could do the Values pointing to a component
-
So... you don't know anything about electronics and simulators and AXE and still you think this is a good idea :P No offense, but I don't see how this is possible at this moment. I study electronics and I know how complex these simulators really are.
-
I know about electronics etc (elektronica, binair, binaire logica, and-or-not-xor-... poorten, elektriciteit (dutch))
Maar dat is juist de bedoeling... om te leren hoe ik zo een eenvoudige simulator maak...
-
A logic simulator is easier to make! With analog electronics you have to deal with impedances, transitions, tresholds, phasors, etc. I bet a TI84+ is not strong enough to handle that.
-
I just need to emulate a: (spoel, weerstand, en condensator op ac, en dat zijn maar enkele formules) it's for school
-
What's the imput signal you want to feed trough those things?
If it's DC you just have to replace the capacitors with open ranks and the inductor coils with short circuits. Analyzing resistor networks is very easy :)
-
a good place to start with this would be implementing a linked list data structure. once you have that working, you're going to need to decide on what different attributes to have defined for each possible element (i.e., how long is the current stalled when passing through, what resistance level is there, what's the minimal voltage for it to work, etcetera). then, as long as you aren't looking for too much accuracy, and if each element is connected to only one other, it should be pretty easy. as soon as you start adding in branching and merging paths, however, things will get much more difficult. you will have to have multiple paths simulated in tandem. more complex elements, like capacitors, would also be problematic to implement. that's no reason to not give it a shot, though =)
-
a good place to start with this would be implementing a linked list data structure. once you have that working, you're going to need to decide on what different attributes to have defined for each possible element (i.e., how long is the current stalled when passing through, what resistance level is there, what's the minimal voltage for it to work, etcetera). then, as long as you aren't looking for too much accuracy, and if each element is connected to only one other, it should be pretty easy. as soon as you start adding in branching and merging paths, however, things will get much more difficult. you will have to have multiple paths simulated in tandem. more complex elements, like capacitors, would also be problematic to implement. that's no reason to not give it a shot, though =)
Yeah i'll have to make some lists and then i'll have them store all the data, all components are in after eachother, i guess i'll figure it out once ;p
How do i create a 384 hex elements that are all the same without having to hardcode the thing?
So not: [0000000000000....
And also not: [00-> gdb0
For(A,0,384
00-> {gdb0 + A}
End
Cause that could corrupt the other ram...
Is there a possible way?
-
Buff(384)->GDB0
-
Ok thx ;3
-
Actually this is a really neat idea for a project. I can see this being extremely valuable for students and enthusiasts alike.
-
here what I am thinking. If you don't understand something, just ask.
-
With analog electronics you have to deal with impedances, transitions, tresholds, phasors, etc. I bet a TI84+ is not strong enough to handle that.
On the contrary, considering that my father simulated some analog electronics - and IIRC, not just RLC circuits - on a HP-41C, about two decades ago, I'd bet that a TI-Z80 can handle quite a number of things ;)
The HP-41C's processor is clocked at least an order of magnitude slower than the 6(-15) MHz Z80 of the 83+ family, and the 83+ family has at least two orders of magnitude more RAM.
Of course, the TI-68k series, the Prizm and the Nspire series could do better than the 83+ family.
-
Stevon8er, have you ever used LTspice? When you simulate you can pick a node or a component and measure respectively voltage or current. No need to simulate the whole circuit every cycle. (unless you do a frequency sweep)
-
No i didn't, but it's actually a wrong tittle, it's not really a simulation but it's drawing a circuit, and then giving the values (like U, I, R, Xl , Xc , f , ...) and after that it calculates it for you
so instead of using input fields for getting the vars, it asks you to draw it and give the values... it's just a funnier way of learning/ solving formulas
-
When you let it "calculate" for you it simulates the behaviour of the circuit right?
-
Not really, euhm let me explain it a bit... so you give a source... to that source you add a value... after it has enough values... it starts calculating and on the missing places it puts the calculated answer... that's it... after that it's done... (or you could edit the values and recalculate)
-
Like this?
-
yes, but then with more complex drawings and more vars (like frequency etc...)
EDIT: maybe i could do it so, that user can go to another screen, where the sin-function of the circuit is drawn... idk, maybe i could add that lol :p
-
Good luck with that.
-
Yeah probably won't work but whatever xD
-
It might be easier to do this in BASIC, because it actually has support for floating point (assuming non-integral values, which is sometimes the case)
-
Hmmmm that's actually true, but then if i'dd try to visualize it, it's a lot harder...
Isn't there a way to add basic progs + their outputs to an axe program?
Or maybe something like grammer can do... Start up the program... But values declared by the axe program?
-
you can always use the old 12:prgmBLAH approach that all the hybrid programs of old used, performing functions in an axe program that reads values from BASIC variables.
-
How do you mean? Could you explain it a bit?
-
Or use basic with libs to enhange gfx :)
-
Could do that, only problem is that one would need xlib for example
But whatever we'll see what happens :p
-
You can make an asm library that is a program :P You've probably seen a bazillion of mine. Basically what I think they mean is that you can make an Axe program that handles all the graphics based on input from a BASIC program.
-
yeah ^^
Axe can access all of the basic variables, including Ans, pretty easily, so passing values to a program shouldn't take too much work. using something like Batlib would probably be a better idea, though.
-
So it's too hard to use floats in axe...?
-
Yes, without using bcalls which would require using opcodes.
-
Too bad axe doesn't support true inline AMS yet. Only opcodes.
-
errm... <_< I think someone made an axiom for floating point.
And it's not tooo hard to create a bunch of FP routines in axe.
-
There are internal fixed-point decimals, iirc. How much precision do you really need? Surely not 9 bytes.
-
if possible you can even just multiply by 10 to get one decimal.
-
Maybe millivolts and tenths of milliamperes are sufficiently small increments?
-
There are internal fixed-point decimals, iirc. How much precision do you really need? Surely not 9 bytes.
I think it could be a number like: 999,99 I don't think i'll need more
-
Well from a programmers perspective you can have numbers up to 0-65535 or 0-655,35 with the standard 16 bit resolution (unsigned) or -32767 to 32767 or -327,67 to 327,67 (signed)
-
How would i do the standard 16bit then? How would i make a float out of them?
-
You wouldn't be using floats. You would be using an integer, and knowing that the integer is actually the number*1000 (thus, 1.010 amps would be stored as the integer 1010)
-
Yes but how could i in example display the "float"?
-
The easiest way that occurs to me is this:
Store the number divided by 1000 in another var, here I'll call it A.
Display A
Display a .
Display number-(A*1000)
-
say you have the number 125,3 stored as 1253 then you would first divide by 10, store it to a var (let's say, A) then subtract A*10 from 1253 to get the decimal part.
edit: ninja'd D:
-
Something like this:
Text(0,0,A/100>Dec
Text(".")
Text(A^100>Dec
EDIT: Accidentally hit post before XD
-
Erhm you're last sentence i read as: substract 1253 from 1253
EDIT: read it as 1253 -1250 :p thx guys
But now there: __125.___3
Where _ = space