How to avoid red error lines (JK FlipFlop as subcircuit ) [Logisim] - flip-flop

I have build a JK FlipFlop in Logisim to further use it as subcircuit.
The Problem is that when you place that subcircuit it will start with the red colored exit pins. The FlipFlop is also depending on the information of the state of the outputs,
1 or 0.
The Question is if there is a way to avoid this undefined state somehow.
I Know that i could just use the SR-FlipFlop included in Logisim because this will be placed without errors on the Outputs from the start but I would like to build every part myself if it is possible.

I do not know of an explicit way to prevent the red lines. However, you can "initialize" it by enabling K on the rising edge of the clock - this will clear the red lines and begin normal operations.
Hope this helps, I'll return if I find a better answer.

Related

OPENCV OPENVINO cv2.rectangle

I am using opencv and openvino and am trying to figure out when I have a face detected, use the cv2.rectangle and have my coordinates sent but only on the first person bounded by the box so it can move the motors because when it sees multiple people it sends multiple coordinates and thus causing the servo and stepper motors to go crazy. Any help would be appreciated. Thank you
Generally, each code would run line by line. You'll need to create a proper function for each scenario so that the data could be handled and processed properly. In short, you'll need to implement error handling and data handling (probably more than these, depending on your software/hardware design). If you are trying to implement multiple threads of executions at the same time, it is better to use multithreading.
Besides, you are using 2 types of motors. Simply taking in all data is inefficient and prone to cause missing data. You'll need to be clear about what servo motor and stepper motor tasks are, the relations between coordinates, who will trigger what, if something fails or some sequence is missing then do task X, etc.
For example, the sequence of Data A should produce Result A but it is halted halfway because Data B went into the buffer and interfered with Result A and at the same time screwed Result B which was anticipated to happen. (This is what happened in your program)
It's good to review and design your whole process by creating a coding flowchart (a diagram that represents an algorithm). It will give you a clear idea of what should happen for each sequence of code. Then, design a proper handler for each situation.
Can you share more insights of your (pseudo-)code, please?
It sounds easy - you trigger a face-detection inference-request and you get a list/vector with all detected faces (the region-of-interest for each detected face) (including false-positive and false-positives, requiring some consistency-checks to filter those).
If you are interested in the first detected face only - then it could be to just process the first returned result from the list/vector.
However, you will see that sometimes the order of results might change, i.e. when 2 faces A and B were detected, in the next run it could still return faces, but B first and then A.
You could add object-tracking on top of face-detection to make sure you always process the same face.
(But even that could fail sometimes)

misleading project reactor documentation image for flatMapSequentialDelayError, or ...?

I've seen this on images multiple times, and just don't get it at all. Here is the javadoc:
https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#flatMapSequentialDelayError-java.util.function.Function-int-int-
image in question(sorry, I'm unable to show it directly)
https://projectreactor.io/docs/core/release/api/reactor/core/publisher/doc-files/marbles/flatMapSequentialWithConcurrencyAndPrefetch.svg
Can someone explain, why is there 1 red square box? Why it's internal Flux was completed so soon? Based on what (in original flux) if purple is still emitted? What am I missing?
The image is correct as far as I can tell.
What am I missing?
You seem to be assuming that the flatMapSequential() call is somehow affecting when the fluxes end, or when they emit their elements - the red flux ending after only one element and the others continuing for two. This isn't the case - this is just an example of what happens when you call flatMapSequential() on fluxes that just so happen to behave in this way.
If it helps, imagine they're 3 fluxes returning database records from a query. The green flux is subscribed to first, then it returns a result (but doesn't complete, because it's got another record to return still.) The red flux is then subscribed to, returns a result & completes (because there was only one record matching the query.) The Purple flux is then subscribed to, returns one result, then the green & purple fluxes return another result and then both complete.
In this case, if the red flux didn't complete, then the purple flux wouldn't be subscribed to until at least one of the green or red fluxes complete (since the max concurrency in this case its 2.) So picking fluxes that behave in this way for the example allows the image to be concise, as well as demonstrating both the "sequential" and the "max concurrency" elements visually.

Why is MEAN SHIFT + ORB not detecting (all) multiple objects?

I have to find multiple objects of one type in an image and for this purpose, I am using OpenCV (Python). First I started with Template matching which doesn't work well if the orientation of the image is changed.
So, I used the method described here. But, unfortunately, it is not working as expected and also, everytime I rerun my code, the output (i.e. the bounding box around the object detected) keeps changing.
Here is my output:
Output(Run 1)
Output(Run 2)
Output(Run 3)
Output(Run 4)
Output(Run 5)
Output(Run 6)
I have tweaked the values and I am still not getting the desired output. Why is it that 2/5 objects of the same type is detected, but not the rest?
I have been thinking about ways to fix it for weeks now. I also tried bf.knnMatch instead of flann.knnMatch and SURF/SIFT instead of ORB, but still no luck.
Do you guys have any idea on how can I fix this? Any suggestions will be appreciated.
Note: I have not made any changes in the code given in the link

iFractals MLQ5 usage not understood

Here is the code that I thought and tried. I thought that it was the right way to buy and sell for the Fractals signals. But getting buy and sell signals simultaneously.
double UP[],DOWN[];
double fractal_output = iFractals(_Symbol,_Period);
ArraySetAsSeries(UP,true);
ArraySetAsSeries(DOWN,true);
CopyBuffer(fractal_output,0,0,5,UP);
CopyBuffer(fractal_output,1,0,5,DOWN);
if (UP[1])
{
Comment("BUY");
trade.Buy(0.1);
}
if (DOWN[1])
{
Comment("SELL");
trade.Sell(0.1);
}
I don't understand how I can plan to buy and sell using the iFractals function indicator in my MQL5. What improvements need to be done?
A double fractal_output should be int not double and initialized in the OnInit(){...} just once, not each tick.
Make sure you understand which fractal is obtained when accessing UP[1] - it seems to be 0,1,2,3,4 (left to right), so you are asking for fractal 3 bars before the current Bar.
Alternatively you can get a value before the current Bar (most probably it is zero until next bar after current starts).
Make sure that you have copied the buffer correctly (it is possible that it is not copied and UP[1] may throw out-of-range error - for that reason CopyBuffer returns a number of elements actually copied (so if CopyBuffer()!=5){print();return;})
What do you expect to see when calling if(UP[1]){} ?
A buffer might take both positive values and EMPTY_VALUE (== 2^31-1).
It is better to check the value of the buffer: if(UP[i]>0){} or if(UP[i]!=EMPTY_VALUE){...}
Do not forget about a special case, when some candle has both an upper and a lower fractal - What to do in that corner-case?
It will open a Long and then open a Short (so it may close the Buy by opening a Short).
Probably you need check the open orders before that or open bar - otherwise you'll have many positions opened during one candle.
Tester will help you find other problems that you could miss when planning the EA.

Test for connectivity between two points in a schematic

I work for a semiconductor manufacturer. We are often trying to test our designs to make sure that sequences we run on our parts properly connect two points on a schematic for example signal_a and signal_b. The two signals usually have multiple pass gates that have to be turned on to connect the two signals. To check that this happens correctly we usually go through the schematic and simulation to check that all the pass gates were turned on correctly. It seems like Verilog would already have a built in command for checking this. For example something similar to:
#triggering_signal
begin
connected=check_connection(signal_a,signal_b)
end
connected would be set to 1 if they are connected and to 0 if they are not. I would appreciate it if anybody could point me in the correct direction if something like this exists. Note I thought of putting a force signal in the code to toggle signal_a and seeing if it shows up at signal_b using a counter, but this does not work for all the cases I need due to the fact that signal_a being at any other state than 1 turns the die off.
You can try to use SV assertions using sequence to test that signal_a value is always same as signal_b.
assert (signal_a == signal_b) else $error("It's gone wrong")Íž

Resources