seq0.start(p_sequencer.axi4_rd_sequencer);
seq1.start(p_sequencer.axi4_wr_sequencer);
I want to start 2 different sequence(seq0,seq1) on 2 separate sequencer. Is there any way that i can start seq1 after seq0 has finished?
I have tried this
p_sequencer.axi4_rd_sequencer.wait_for_item_done(this,-1)
but it doesn't work
Related
I'm working on a system with an ATmega1284p to communicate (i2c) with multiple MCP23017.
The thing is that I was able to work with 2 MCP until I decided to connect a third one.. They have 3 bits of addressing (A2, A1 and A0), one is at #000 (0), the other at #100 (4), then I added another MCP with #011 (3) and to make sure it was working well, so I uploaded an I2C scanner to my AVR and to my surprise it only recognized the last one I connected.
The 2 others are now impossible to work with, even if I disconnect the 3rd one and roll back to my initial system with only 2 MCP (which was fine) -> no response
At first, I was able to communicate with the 2 mcp only by wiring SDA/SCL without pull up resistors, so when I added the 3rd one and saw no communication I tried to plug 4.7k Resistor on SDA/SCL but nothing came out.
I can't figure out what's going on, so I would be grateful for your assistance
The "Assembler" should stop working for 2 hours after 10 assemblies are done.
How can I achieve that?
There are so many ways to do this depending on what it means to stop working and what the implications are for the incoming parts.. but here's one option
create a resourcePool called Machine, this will be used along with the technicians:
on the "on exit" action of the assembler do this (I use 9 instead of 10 because the out.count() doesn't count until the agent is completely out, so when it counts 9, it means that you have produced 10)
if(self.out.count()==9){
machine.set_capacity(0);
create_MyDynamicEvent(2, HOUR);
}
In your dynamice event (that you have to create) you will add the following code:
machine.set_capacity(1);
A second option is to have a variable countAssembler count the number of items produced... then
on exit you write countAssembler++;
on enter delay you write the following:
if(countAssembler==10){
self.suspend(agent);
create_MyDynamicEvent(2, HOUR,agent);
}
on the dynamic event you write:
assembler.resume(agent);
Don't forget to add the parameter needed in the dynamic event:
Create a variable called countAssembler of type int. Increment this as agents pass through the assembler. Also create a variable called assemblerStopTime. You also record the assembler stop time with assemblerStopTime=time()
Place a selectOutputOut block before the and let them in if countAssembler value is less than 10. Otherwise send to a Wait block.
Now, to maintain the FIFO rule, in the first selectOutputOut condition, you need to check also if there is any agent in the wait block and if the current time - assemblerStopTime is greater than 2. If there is, you free it and send to the assembler with wait.free(0) function. And send the current agent to wait. You also need to reset the countAssembler to zero.
I've been given a task to set up an openai toy gym which can only be solved by an agent with memory. I've been given an example with two doors, and at time t = 0 I'm shown either 1 or -1. At t = 1 I can move to correct door and open it.
Does anyone know how I would go about starting out? I want to show that a2c or ppo can solve this using an lstm policy. How do I go about setting up environment, etc?
To create a new environment in gym format, it should have the 5 functions mentioned in the gym.core file.
https://github.com/openai/gym/blob/e689f93a425d97489e590bba0a7d4518de0dcc03/gym/core.py#L11-L35
To lay this down in steps-
Define observation space and action space for your environment, preferably using gym.spaces module.
Write down the step function which performs agent's action and returns a 4 tuple containing - next set of observations from the environment , reward ,
done - a boolean indicating whether the episode is over , and some extra info if you want.
Write a reset function for the environment to reinitialise the episode to a random start state and return a 4 tuple similar to step.
These functions are enough to be able to run an RL agent on your environment.
You can skip the render, seed and close functions if you want.
For the task you have defined,you can model the observation and action space using Discrete(2). 0 for first door and 1 for second door.
Reset would return in it's observation which door has the reward.
Then agent would choose either of the door - 0 or 1.
Then perform a environment step by calling step(action), which will return agent's reward and done flag as true - signifying that the episode is over.
Frankly, the problem you describe seems too simple to accomplish for any reinforcement learning algorithm, but I assume you have provided that as an example.
Remembering for longer horizons is usually harder.
You can read their documentation and toy environments to understand how to create one.
I have a raspberry pi 3 running a program made in Xojo.
My goal is to have two flow sensors which display the amount of water that flows though each sensor on the screen.
I have a program that works for one flow sensor, it uses the GPIO library and a custom module called 'InterruptModule'. I followed a tutorial to make this program.
Tutorial: https://einhugur.com/blog/index.php/xojo-gpio/connecting-button-with-gpio-and-using-interupts/#comment-14
This program works successfully for both flow sensors, but only one at a time. I.e if I change the input pin and run the program again it works.
HOWEVER, when I try combine the two it responds can't differentiate between the two inputs.
I have tried with two GPIO modules and two custom 'InterruptModule' modules but it still counts the inputs under whichever sensor is defined first.
See my attempt here.
Screenshot of Xojo code
One way to differentiate between the two interrupts is to create two separate callback method.
Example:
Const kPin = 14
If GPIO.WiringPiISR(kPin, GPIO.EDGE_RISING, Addressof InteruptModule.ButtonDownInterupt1) = -1 then
MsgBox "Could not register for Interupt1 on kPin14"
End If
Const kPin = 18
If GPIO.WiringPiISR(kPin, GPIO.EDGE_RISING, Addressof InteruptModule.ButtonDownInterupt2) = -1 then
MsgBox "Could not register for Interupt2 on kPin18"
End If
In this example, each pin interruption would have its own callback method with different code to work with each pin.
I am trying to use PLC's to monitor a race track. I will be using 3 Photo sensors to show which car crossed the finish line first. Each sensor will have be OTL (Latched) instruction. Each lane will have a light to indicate which car was in first place. The car not in first lights will not come. There will be 3 judges. At the completionof each race, once the winner has been recorded, the 3 judges will use their respective switches to reset the indicator lamps to an off state (Unlatched) in preparation for the next race.To inhibit any attempt at cheating by the race judges , the judges switches are programmed so that all 3 judges must agree to reset and a reset can only occur after all 3 cars have passed the finish line. The judges will be programmed with a One Shot Rising (OSR) instruction. It sh.ould be noted that we're working with a SLC 500 PLC. I fail to mention that Iam using Rockwell Automation software RS Logics, so please use Rockwell's instructions on your ladder logic.
This is rather straight forward. I'm answering generically for the PLC make isn't defined.
// You need 3 of these sets, one for each Lane, prefixed 1, 2, 3, accordingly
|---|Photo1|----------------|-----------(OTL1)----|
|---|OTL1|-----|/ResetCmd|--|
|--|OTL1|---|/OTL2|---|/ OTL3|----------(Light1)--|
// We have two work booleans, used in relation with the reset logic.
// All3In is an AND of all 3 OTLs indicating that all 3 cars have passed the finish line
// SomeOTLON is an OR of the 3 OTLs indicating that one or more OTL latches hasn't been reset
|--|OTL1|---|OTL2|----|OTL3|----------------------(All3In)--|
|--|OTL1|----|---------------------------------(SomeOTLON)--|
| |
|--|OTL2|----|
| |
|--|OTL3|----|
// We need 3 latches like the following, one per judge
// Essentially the Latch comes on when all 3 cars are in and the judge presses his button
// The latch comes off after all 3 OTLs dropped
|--|Judge1|---|All3In|----------|-------------(Judge1Latch)--|
| |
|--|Judge1Latch|---|SomeOTLON|--|
// Finally the Reset Command
|--|Judge1Latch|---|Judge2Latch|---|Judge3Latch|--|------(ResetCmd)--|
| |
|--|ResetCmd|------|SomeOTLON|--------------------|
Et voilĂ . Only possible trouble is if the "JudgeN" switches are not One Shot Rising (but they seem to be as per the problem text), it would be possible for a judge to make his/her push button stick and still have the ResetCmd latch on when all 3 cars arrive.