Barotrauma

Barotrauma

View Stats:
XallZall Dec 26, 2020 @ 8:31am
Constant Signal into Single Pulse
Hello fellow engineers, I have been running into this issue time and time again.

The question is, how can I turn a Constant/Infinite signal being sent into a single pulse?

Example 1:
A RELAY COMPONENT has a STATE_OUT
This state_out is sending a Constant and Infinite Signal.
Using a SIGNAL CHECK COMPONENT, I intercept the 0 or 1 being sent and transform this into some text being sent to a Terminal.

On the Terminal, the message is being Spammed non-stop.

Example 2:
A MEMORY COMPONENT is sending an infinite signal, how to turn this infinite signal being sent to a singular 0 or 1?

What I would like to do:
Show a single message text output on the terminal displaying the RELAY COMPONENT's STATE_OUT situation, where this relay is open or closed.
< >
Showing 1-14 of 14 comments
XallZall Dec 29, 2020 @ 8:02pm 
Alright just going to respond to my own post as I found a solution, may help others as well.

Pretty messy but it works:

To transform a constant signal into a single pulse, we can do this by means of relay switches.

1. Place two Relays (Lets call them Relay1 and Relay2), ensure that one is set to ON while the other is set to OFF

2. Place a Signal Check Component (Lets call it S1) and place the values as follows:
Output = 0
False Output = 1
Target Signal = 1

3. Connect your constant signal source (lets call this X) to Relay1's set_state.
4. Connect X to the S1 signal in.
5. Make a connection starting from S1's signal out to Relay2's set_state.

When the constant signal now changes, it will open and close the relays, and one relay will always be open while the other is always closed.

Now you essentially convert the Constant Signal into a Open or Closed relay, using a new Signal Check Component that passes through both Relay1 and Relay2 will now activate depending if the Relay1 or Relay2 is opened or closed.
Deceptive Pastry Jan 1, 2021 @ 2:54am 
I know of one way to do it using delay, NOT, and AND components.

Constant signal > AND comp signal_in 1
Constant signal > NOT comp > Delay comp (0.4 delay) > AND comp signal_in 2

When sending 0, the NOT turns it into a 1 and goes into the delay. When the constant signal turns to 1 it goes to AND signal 1 instantly while the delay continues sending a 1 for another 0.4 seconds to AND signal 2 before the NOT inverted signal makes it way through. So for 0.4 seconds the AND comp sends a signal.
Last edited by Deceptive Pastry; Jan 1, 2021 @ 2:55am
Slaiiz Jan 1, 2021 @ 4:05am 
Originally posted by Deceptive Pastry:
I know of one way to do it using delay, NOT, and AND components.

Constant signal > AND comp signal_in 1
Constant signal > NOT comp > Delay comp (0.4 delay) > AND comp signal_in 2

When sending 0, the NOT turns it into a 1 and goes into the delay. When the constant signal turns to 1 it goes to AND signal 1 instantly while the delay continues sending a 1 for another 0.4 seconds to AND signal 2 before the NOT inverted signal makes it way through. So for 0.4 seconds the AND comp sends a signal.

Oh but that might be sub-optimal for OP's purpose, it would at the very least spam the terminal for 0.4 seconds. But to my knowledge all the arithmetic and logic gates output a continuous signal anyway so it would actually spam forever?
GlaDOS Apr 11, 2021 @ 1:07pm 
I tried Deceptive Pastry's solution but it still did not manage to create a toggle. However, reducing the delay to 0.05 will create a signal equal to a toggle. For some reason that is not reliable tho. With, some circuits I found it to work with others not, even though they were identical.... A bit weird... seems to push the game to its limit somehow. suddenly 0.1 works more reliably without any apparent reason
Last edited by GlaDOS; Apr 11, 2021 @ 2:42pm
CaptainKeyboard Jun 29, 2021 @ 2:28am 
If you only need a pulse for a positive signal:

--> XOR (Output: Empty, False Output: '1') --> Delay (0.05/0.1 sec, Reset when signal received) -->
Last edited by CaptainKeyboard; Jun 29, 2021 @ 2:35am
Grimm Spector Nov 4, 2021 @ 7:14pm 
Originally posted by CaptainKeyboard:
If you only need a pulse for a positive signal:

--> XOR (Output: Empty, False Output: '1') --> Delay (0.05/0.1 sec, Reset when signal received) -->

Hmmm are you saying input like say Lever into the XOR, and the Delay output to the device to receive the pulse?

I'm trying to test this by having a light come on for one second, but it's not working. When I change the state it isn't really working. If it's set as a toggle, it'll toggle on or off after the delay time I set. If it's set to set_state it'll just kind of come on, and then never go off no matter what I do.

I'm wanting to set it to an alarm klaxon to have it go off for a couple seconds when it receives a pulse and then go off. I'm not great at these circuits in this game.
CaptainKeyboard Nov 5, 2021 @ 3:58am 
Originally posted by Grimm Spector:
Originally posted by CaptainKeyboard:
If you only need a pulse for a positive signal:

--> XOR (Output: Empty, False Output: '1') --> Delay (0.05/0.1 sec, Reset when signal received) -->

Hmmm are you saying input like say Lever into the XOR, and the Delay output to the device to receive the pulse?

I'm trying to test this by having a light come on for one second, but it's not working. When I change the state it isn't really working. If it's set as a toggle, it'll toggle on or off after the delay time I set. If it's set to set_state it'll just kind of come on, and then never go off no matter what I do.

I'm wanting to set it to an alarm klaxon to have it go off for a couple seconds when it receives a pulse and then go off. I'm not great at these circuits in this game.

Yes, it's for a lever (or any constant signal). It will only fire a single pulse for a constant signal.

The 'output' field of the XOR must be empty, while the 'false output' field must contain a '1'. The output of the XOR then leads to a delay. I recommend to set the delay to 0.05. If a new signal comes faster than the duration of the delay, it's won't be recogniced. You must also check 'Reset when signal received' and UNcheck 'Reset when different signal received'.

The XOR will return a '1' every game tick as long as there is a NEGATIVE constant signal on it.

The delay will reset everytime it receives a '1', so also as long as the lever is negative.

The moment the lever is flicked the signal of the XOR ('1') stops, thus leading to the delay letting out it's signal (one single pulse).
Last edited by CaptainKeyboard; Nov 5, 2021 @ 4:26am
MorganOrgan Nov 5, 2021 @ 2:03pm 
Oscilator going into a signal check component will produce constant signal pulses when oscilator is on.

You can simply just use the oscilator, realized it after reading the description.
https://barotraumagame.com/wiki/Wiring_Components#Oscillator_Component

Ehh, seems I misunderstood the OP, nvm.
Last edited by MorganOrgan; Nov 5, 2021 @ 2:08pm
SHUK Mar 23, 2023 @ 10:27am 
I think I have found a simpler and more reliable way to do it, with only 2 components. Idea is to use a relay to instantly cut signal after u have send it. So for example I have a switch and when u switch it off u want to get a single 0 pulse instead off constant 0 signal. In this case I used one signal check component (output:0, false output: empty, target signal:0) and one relay.
Connection:
1. Lever (SIGNAL_OUT) -> Signal Check Component (SIGNAL_IN)
2. Signal Check Component (SIGNAL_OUT) -> Relay Component (SIGNAL_IN_1)
3. Relay Component (SIGNAL_OUT_1) -> To destination (this is going to be single pulse signal)
4. Lever (SIGNAL_OUT) -> Relay Component (SET_STATE)

When u switch lever off 0 signal will be able to go thru relay and instantly will be cut off with it self.
Wububub Dec 21, 2023 @ 8:26pm 
I was struggling with this exact issue and couldn't find a satisfactory solution. I finally solved the issue for myself at least, so I thought I might as well put my 2 cents in and present my solution.

My issue was using a toggle switch, which needed to stay a toggle switch because it was linked into multiple systems, but a few of those systems needed a pulse instead.

Took me a while to figure it out and get it working, but my solution was to use 2 Signal Check Components and 2 Delay Components. The end result starts as an empty signal, but allows you to send a 1-pulse when the switch is flipped to constant 1, and a 0-pulse when the switch is flipped to constant 0.
Here is the setup:

Connection:
1. Lever (SIGNAL_OUT) -> Signal Check Component #1 (SIGNAL_IN)
2. Signal Check Component #1 (SIGNAL_OUT)
-> To destination
-> Signal Check Component #2 (SIGNAL_IN)
-> Delay Component #1 (SIGNAL_IN)
3. Signal Check Component #2 (SIGNAL_OUT)
-> Signal Check Component #1 (SET_OUTPUT)
-> Signal Check Component #1 (SET_TARGETSIGNAL)
-> Delay Component #2 (SIGNAL_IN)
4. Delay Component #1 (SIGNAL_OUT) -> Signal Check Component #2 (SET_OUTPUT)
5. Delay Component #2 (SIGNAL_OUT) -> SCComponent #2 (SET_TARGETSIGNAL)

If the initial input for SCC#1 is a "1" signal, set up the SCCs as follows:
SCC#1:
Output: 0
False output: BLANK
Target signal: 0

SCC#2:
Output: 1
False output: BLANK
Target signal: 0

If the initial input for SCC#1 is a "0" signal, set up the SCCs as follows:
SCC#1:
Output: 1
False output: BLANK
Target signal: 1

SCC#2:
Output: 0
False output: BLANK
Target signal: 1

Set the Delay Components' delay to 0,05, that seemed to be sufficient enough for the signal to go through.

In this setup, the initial signal is blocked by SCC#1, and a BLANK signal is sent ahead. When the switch is flipped, SCC#1 sends a pulse to the destination, triggers SCC#2, which then immediately resets SCC#1's target signal, cutting it off. SCC#2 then rewrites SCC#1 from "0 ; - ; 0" into "1 ; - ; 1", and the delayed signals rewrite SCC#2 from "1 ; - ; 0" into "0 ; - ; 1". The circuit only gives out a BLANK signal in between toggles, and with every toggle, the SCCs alternate their target and output.

If you are starting with a "0" signal, instead configure SCC#1 as "1 ; - ; 1" and SCC#2 as "0 ; - ; 1". And if you need a 1-pulse on a 0-constant, and a 0-pulse on a 1-constant, put a NOT Component BEFORE SCC#1 to flip the incoming signal. If you put the NOT Component after the output, the BLANK signal will be flipped and registered as a 1, and will muck up your system.
Last edited by Wububub; Dec 23, 2023 @ 9:03am
IKEA Toaster Jan 1, 2024 @ 5:24pm 
If anyone's still looking for solutions I've found a solution that produced a single tick signal from a change of signal using 3 components, 2 signal checkers and 1 not component, rig it up as follows:

SCC #1:
- Output: 1
- False output: 0
- Target signal: 1
- Signal out -> SCC #2 Signal in

SCC #2:
- Output: 1
- False output: 0
- Target signal: 1
- Signal out -> NC Signal in

NC:
- Signal out -> SCC #1 Set target signal
- Signal out -> SCC #2 Set target signal

Circuit input (constant signal) -> SCC #1 Signal in
Circuit output (single tick on signal change) -> SCC #1 Signal out

This circuit can also be modified easily with a relay & and component to only give a tick when the change is from 0 -> 1, I imagine the reverse would also be a pretty simple adjustment.
Last edited by IKEA Toaster; Jan 1, 2024 @ 5:32pm
DECAFBAD Jan 1, 2024 @ 7:02pm 
Avoid doing this, there is usually another way!!!
Meichel Rapier Feb 22, 2024 @ 7:27am 
I found a simple version, still need 3 components.
1 signal checker (SG), 1 relay (RC), 1 Not component (NC)

Constant Signal Source:
Signal Out -> SG Signal In
Signal Out -> NC Signal In

SG:
Output: 1
False output: empty
Target signal: 1
Signal Out -> RC signal in

NC:
Signal Out -> RL Signal In

RC:
Signal Out -> Target In

when use switch and switched on, it will send signal once.
when switched off, it will not send any.
Last edited by Meichel Rapier; Feb 22, 2024 @ 7:28am
Gesugao-san Jan 29 @ 4:54am 
Lever → Not → Delay (0.01) → XOR
Lever → XOR
XOR → Lamp toggle
:dealeruwu:
< >
Showing 1-14 of 14 comments
Per page: 1530 50

Date Posted: Dec 26, 2020 @ 8:31am
Posts: 14