sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.3k stars 634 forks source link

Feature request: Template to create new electrical and electromechanical devices #375

Open rricon opened 5 years ago

rricon commented 5 years ago

The idea is to be able to complete a template with data from a new device. That is, each user can create a new device without having to know the details of the programming. For example, an automotive switch is a set of mechanically controlled electrical switches in an allowed order.

pfalstad commented 5 years ago

You could use either a subcircuit or custom logic, depending on the specifics.

rricon commented 5 years ago

Yes, it is correct, but I mean introducing electromechanical devices such as an electric motor. In addition, the idea of the template is to allow the community to participate in increasing the library of the simulator.

pfalstad commented 5 years ago

Ok, I understand now. Yes, this would be good.

SgtSchultz71 commented 5 years ago

It would be awesome if we could share custom logic designs so that way people can share the best version of a particular custom logic block. An example would be like a program counter or a RAM module. A kind of library to pull other people's collaborations or works from.

rricon commented 5 years ago

That is the key word, collaboration. We are an army of users around the world that we can collaborate designing new devices. To achieve the goal, there must be something similar to a template that is an interface between the searched model and the javascript code.

sharpie7 commented 5 years ago

Anyone can collaborate already by changing the Java code to create new components. It is a bit hard, but quite a few different people have contributed component models that are in the simulation today so it can be done.

In principle it is a good idea to create more a "plug in" style environment for new components and symbols, but it is a lot of work. There is sometimes "black magic" in writing the model for a component so it actually works in the simulation. It isn't always a direct implementation of the maths that you might expect.

Liniking the electrical simulation to energy paths outside the electrical domain brings an additional set of questions in terms of how you can best model and display the interaction between electrical and other forces.

rricon commented 5 years ago

I think that one of the first steps to be taken is to ask Paul and others who collaborated in the design of the original models, it is the criteria they used to design the basic simulator devices and try to obtain code patterns.

sharpie7 commented 5 years ago

To ammend my previous comment a little bit: one of the main problems with contributing directly to the code is that the model needs to meet certain criteria if we are going to include it in the main branch. For example, it needs to have a certain level of quality and it needs to have a certain level of general interest.

If it was possible to edit models in user space then people could just use and share their own models (good or bad) without any cooperation from the application developers. Some people might find that useful, particularly if they have unusual requirements. The downside is that if people start distributing examples with bad models then that could negatively affect the perception of the project.

@rricon It's an open source project - pretty much each component is a java file named after its type. You can pick something similar and start editing.

rricon commented 5 years ago

I agree with the criterion of not touching the original code, but making a new code layer that is an interface between the original code and the new electromechanical devices.

sharpie7: I program in LabVIEW not in java or javascript. The original idea was simulator users we can add new devices to the library without having knowledge of java or javascript.

sharpie7 commented 5 years ago

@rricon I understand this is more effort than you are willing to put in. I am just pointing out that user created components are already possible, and that, even with a better interface, they are always going to require quite a lot of user effort IMHO.

You haven't really explained your use case. What would you actually do if this feature was available?

rricon commented 5 years ago

@sharpie7 For over twenty years I have taught electricity and electronics here in Argentina to students in the automotive area. One of the problems I encountered is that there is no free electromechanical simulator for the automotive area. For almost ten years I use the simulator designed by Paul Falstad with excellent learning results from my students. A few years ago I wrote to Paul asking if an interface could be made with a serial port. At that time he replied that he no longer planned to add anything new to the simulator due to lack of time. I have used many simulators over the years, but Paul's simulator has excellent teaching characteristics. A couple of years ago I bought a license for myself and licenses for finite time for my students of the simulator "Everycircuit". This simulator is similar in characteristics to Paul's simulator but has a library with few components and usually gives loading errors in the Google browser. Perhaps the time has come to think about paying licenses for the use of Paul's simulator to finance the enormous work of improving and maintaining the simulator. I am sure that I am not the only teacher in the world who uses this simulator for teaching. I hope I have clearly stated my intention to improve Paul's simulator and keep it in time.

eMPee584 commented 3 years ago

@rricon have you heard about OpenModelica? It's a cross-domain modelling / simulation framework..