π
<-

CCRLC


File hierarchy

 Downloads
 Files created online(31241)
 TI-Nspire
(22707)

 nCreator(4594)

DownloadTélécharger


LicenceLicense : Non spécifiée / IncluseUnspecified / Included

 TéléchargerDownload

Actions



Vote :

ScreenshotAperçu


Informations

Catégorie :Category: nCreator TI-Nspire
Auteur Author: sebastianmedel
Type : Classeur 3.0.1
Page(s) : 1
Taille Size: 15.25 Ko KB
Mis en ligne Uploaded: 18/03/2025 - 03:06:13
Uploadeur Uploader: sebastianmedel (Profil)
Téléchargements Downloads: 2
Visibilité Visibility: Archive publique
Shortlink : http://ti-pla.net/a4538004

Description 

Fichier Nspire généré sur TI-Planet.org.

Compatible OS 3.0 et ultérieurs.

<<
--[[ CircuitBuilder creates a Circuit from Schematic.elements data to be solved This is a bit of a mess right now :( but it works. I will try to clean it up for the next update ]] CircuitBuilder = class() function CircuitBuilder:init(elements) self.circuit = Circuit() self.elements = elements end function CircuitBuilder:buildCircuit() self.grounds = {} self.nodes = {} self.attachments = {} self.connections = {} self.visited = {} for y, row in pairs(self.elements) do for x, e in pairs(row) do if e and e.kind == "Ground" then table.insert(self.grounds, e) elseif e and e.kind == "Inductor" then -- Agrega el inductor al circuito local node = self:Node(self.circuit, "inductor_" .. x .. "_" .. y) node.node:connect(e.component) table.insert(self.nodes, node) self:attached(e, node) elseif e and e.kind == "Capacitor" then -- Agrega el capacitor al circuito local node = self:Node(self.circuit, "capacitor_" .. x .. "_" .. y) node.node:connect(e.component) table.insert(self.nodes, node) self:attached(e, node) elseif e and e.component then e.component.nodes[1] = false e.component.nodes[-1] = false end end end if #self.grounds < 1 then return end local gnd = self:Node(self.circuit, "gnd") table.insert(self.nodes, gnd) for i, v in pairs(self.grounds) do self:attached(v, gnd) end for i, v in pairs(self.attachments) do if not self.visited[self:toStr(v)] then local node = self:Node(self.circuit, "n"..#self.nodes) for j = -1, 1, 2 do if not v.component.nodes[j] then node.node:connect(v.component, j) end end table.insert(self.nodes, node) self:attached(v, node) self.visited[self:toStr(v)] = true end end local solution = self.circuit:solve(self.nodes[1].node) for i, node in pairs(self.nodes) do for j, wire in pairs(node.wire) do wire.voltage = node.node.voltage end end if solution and solution ~= "false" then return true else return false end end function CircuitBuilder:attached(element, node) local a = element:attached() for sign, v in pairs(a) do for i, e in pairs(v) do if e.kind == "Wire" and not self.visited[self:toStr(e)] then table.insert(node.wire, e) self.visited[self:toStr(e)] = true self:attached(e, node) elseif e.component then local side = e:isAttached(element.x, element.y)*(e.inverted and -1 or 1) if not self.visited[self:toStr(e, side)] then table.insert(self.attachments, e) end if self.visited[self:toStr(e, -side)] then self.visited[self:toStr(e)] = true end if not e.component.nodes[side] then node.node:connect(e.component, side) end self.visited[self:toStr(e, side)] = true end end end end function CircuitBuilder:toStr(e, sign) return e.x .. ", " .. e.y .. (sign and "," .. sign or "") end function CircuitBuilder:Node(circuit, name) return {wire = {}, node = Node(circuit, name), attachments = {}} end --[[ Elements are wrappers for components that handle GUI interactions Attributes: -- Component: Wrapped component -- x, y: Location -- kind: String name of the component -- parameter: Which component variable is set by the edit dialog -- measure: String representing the parameter -- units: Unit type string ]] Element = class() -- movements in the grid that lead to an attached component, split by [element orientation][direction] Element.touching = { vertical = { [-1] = {{0, -2}, {0, -1}, {-1, -1}}, [1] = {{0, 2}, {-1, 1}, {0, 1}} }, horizontal = { [-1] = {{-1, 0}, {0, 1}, {0, -1}}, [1] = {{1, 0}, {1, -1}, {1, 1}} }} -- Statics ------------------------------ function Element.drawCircle(gc, x, y, size, horizontal) if horizontal then gc:drawLine(x, y, x + size/4, y) gc:drawArc(x + size/4, y - size/4, size/2, size/2, 0, 360) gc:drawLine(x + size*(3/4), y, x + size, y) else gc:drawLine(x, y, x, y + size/4) gc:drawArc(x - size/4, y + size/4, size/2, size/2, 0, 360) gc:drawLine(x, y + size*(3/4), x, y + size) end end -- Instance ------------------------------ function Element:init(schematic, inverted, x, y) self.schematic = schematic self.x = x self.y = y self.inverted = inverted end function Element:getDrawingConstants(grid, camera) return self.x*grid.size - camera.x, math.floor(self.y/2)*grid.size - camera.y, grid.size end function Element:draw(gc, grid, camera) x, y, size = self:getDrawingConstants(grid, camera) self.drawComponent(gc, x, y, size, self.inverted, self.y % 2 == 0) end function Element:attached(req_sign) local r = {[1] = {}, [-1] = {}} local set = self.y % 2 == 0 and Element.touching.horizontal or Element.touching.vertical for sign, v in pairs(set) do if (not req_sign or req_sign == sign) then for i, e in pairs(v) do local x, y = self.x + e[1], self.y + e[2] local a = self.schematic.elements[y][x] if a then if oneWay or a:isAttached(self.x, self.y) then table.insert(r[sign], a) end end end end end return r end function Element:isAttached(x, y, req_sign) local set = self.y % 2 == 0 and Element.touching.horizontal or Element.touching.vertical for sign, v in pairs(set) do if (not req_sign or req_sign == sign) then for i, e in pairs(v) do local x1, y1 = self.x + e[1], self.y + e[2] if x1 == x and y1 == y then ret
[...]

>>

-
Search
-
Social TI-Planet
-
Featured topics
Grand Concours 2024-2025 - Programmation Python
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
12345
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
915 utilisateurs:
>889 invités
>16 membres
>10 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)