In my work, we use processors with Boolean logic programs for an industrial application. These programs can be very long and complex. They mainly consist of sets of input bits, output bits, and internal Boolean bits. These bits are then used in logical operators that lead to the output. Inputs and outputs can be either physical wired outputs or serial communication, but this is not very important.
Here is a quick, simplified example:
Inputs: input1, input2, input3; Outputs: output1, output2, output3; Boolean: bool1, bool2, bool3; Logic: assign input1 && input2 to bool1; assign input1 && bool1 to output1; assign input2 && input3 to bool2; assign output1 && bool2 to output2; assign output1 && output2 || bool2 to bool3;
So keep in mind that I am very new to Java. I have done quite a lot of web programming (ruby, php, javascript, etc.).
Basically, what I would like the simulator to do is break the formatting of the program and allow graphical modeling. Programs can interact with each other, and thus the simulator should also be able to process several programs (and bind input / output together).
My problem starts with the organization. I would suggest that I need to have a βbitβ class. This class will store whether the bit is set to TRUE or FALSE, the type of bit, the corresponding equation, which processor the bit is, etc.
But then I can reach the point where I have hundreds, or thousands of "bits" of copies. How can I arrange these bits? If I wanted to capture all instances, for example, from a specific processor, how could I do this?
In addition, when I change the status (TRUE or FALSE) of the input bit in the simulator, it then updates the state of several other bits. Any suggestions on this? I would like to make it as flexible as possible because I would like to add additional features. For example, certain bits may be designated as timers (it may take a certain amount of time to set them to determine when their conditions are met, or it may take a certain amount of time to delete them when their conditions are no longer fulfilled).
My initial thought was to store arrays or hashes of objects and try to somehow organize them.
I am basically looking for any suggestions. Thanks in advance.