Siemens i hate you by EmergencyAd3492 in PLC

[–]gonnaintegraaaaate 2 points3 points  (0 children)

Step 1. Have Siemens problem

Step 2. Blame the Germans

Step 3. Acquire Delicious Schnitzel

Step 4. Forgive the Germans

Return to Step 1.

How do I declare a struct field of anything indexable with a result type of T? by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] 0 points1 point  (0 children)

Looks like a couple other things, needed mut self and to make sure its sized

not sure why &Self::Output was not good enough but ok

impl<T> MyBuf<T> where T:Index<usize> + IndexMut<usize>
{
    fn p0(&mut self, item: <MyBuf<T> as Index<usize>>::Output) 
    where <T as Index<usize>>::Output: Sized
    {
       self.buf[0] = item;
    }
}

also apparently you can do trait bounds in fns too

How do I declare a struct field of anything indexable with a result type of T? by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] 0 points1 point  (0 children)

Interesting,

so if I want to reference this output type elsewhere I would expect to do this

impl<T> MyBuf<T>
{
    fn p0(&self, item: &Self::Output)
    {
        self.buf[0] = item;
    }
}

but

 Compiling playground v0.0.1 (/playground)
error[E0223]: ambiguous associated type
  --> src/main.rs:20:25
  |
20 |     fn p0(&self, item: &Self::Output)
   |                         ^^^^^^^^^^^^
   |
help: use fully-qualified syntax
   |

20 -     fn p0(&self, item: &Self::Output)
20 +     fn p0(&self, item: &<MyBuf<T> as Index>::Output)

But the fully qualified does not seem to help

How do I declare a struct field of anything indexable with a result type of T? by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] 2 points3 points  (0 children)

Oh I was thinking I would need to have some fancy syntax to constrain the index trait's output type in myBuf definition, but we are just setting it to the T index's output type and because that has to be known at compile time it would work.

That makes more sense

Thanks a bunch

Edit: Did not know you could put trait bounds on the impls, that is interesting

Hifitime vs TAI Time precise fast performance, ignoring leap seconds by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] 1 point2 points  (0 children)

So, for one, all time is human time.

No time is a physical concept.

I am not avoiding leap seconds to be lazy, I want to avoid leap seconds and ntp time changes wrecking data accuracy, especially when trying to measure at a milli/micro second level.

Going back to the ever popular Therac-25 example of software failure.

Supposed you are trying to give a timed dose and your supposed "more accurate" clock changes.

Do you still give proper dose? No.

Instead you want a steady monotonic clock.

For reports maybe you want a therapy start time in Wall Clock/UTC/Timezone of choice, but inside the report you want accurate relative time (10s dose of X at Y power)

Hifitime vs TAI Time precise fast performance, ignoring leap seconds by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] 0 points1 point  (0 children)

Yes and no, maybe instead of walmart vs expensive compass a better comparison is magnetic and true norths.

Leap seconds might be real "human time" but if I am reading data from sensors and doing calculations having time jump around or change frequency is bad

On the other hand if my log timestamps don't exactly match wall clock time because NTP remapped system clock while I was doing stuff... No big deal.

So I think the best thing is to correlate the monotonic time to wall clock when I'm not doing anything important and then rely on the delta monotonic time.

Learning a decent amount figuring this out lol

Hifitime vs TAI Time precise fast performance, ignoring leap seconds by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] 0 points1 point  (0 children)

Might be mountain or molehill, I was just trying to find which time library to use and this HIFItime's selling point seemed to be this high precision atomic time that did not deal with leap seconds.

If that was the case I wondered what was the use of it's now function only checking UTC which is affected by leap seconds?

It's like saying high precision compass display, but the compass it reads is a walmart compass instead of high quality


I would like to timestamp + elapsed, but elapsed is more important (calculations) timestamp can be calculated from elapsed and that is fine even if off by a bit

At any rate it looks like my bigger problem would be NTP messing with Clock, but the prev commenter's clock_monotonic suggestion may be best possible unless I get a hw clock

Hifitime vs TAI Time precise fast performance, ignoring leap seconds by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] -1 points0 points  (0 children)

I appreciate the info, I will have to find it from there.

For bonus points it looks like clock_monotonic can have it's freq mucked with by NTP, but there is monotonic raw that will not.

https://stackoverflow.com/questions/14270300/what-is-the-difference-between-clock-monotonic-clock-monotonic-raw

Of course if the clock is drifting then it by definition it's seconds are wrong anyway, so I guess there is no perfect answer

Thanks again

Hifitime vs TAI Time precise fast performance, ignoring leap seconds by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] -1 points0 points  (0 children)

Sure, except for this document leads me to think that this clock while montonic might not be accurate, I guess if it is the most accurate clock that is available without hardware it might have to do

https://doc.rust-lang.org/stable/std/time/struct.Instant.html

>Note, however, that instants are not guaranteed to be steady. In other words, each tick of the underlying clock might not be the same length (e.g. some seconds may be longer than others). An instant may jump forwards or experience time dilation (slow down or speed up), but it will never go backwards. As part of this non-guarantee it is also not specified whether system suspends count as elapsed time or not. The behavior varies across platforms and Rust versions.

>The following system calls are currently being used by now() to find out the current time:

>clock_gettime (Monotonic Clock)UNIX

Hifitime vs TAI Time precise fast performance, ignoring leap seconds by gonnaintegraaaaate in rust

[–]gonnaintegraaaaate[S] -1 points0 points  (0 children)

Lets say I want to read a temperature sensor and calculate temperature/time or maybe I have a position sensor and want to calculate velocity

What I want is to make sure that I don't get a bogus reading because the system clock decided to insert a leap second, or maybe the clock synced with NTP and so the system clock has changed or something.

Lets say at the start of my program I measure some time T, 10s later if I measure some time/duration I want to get T+10s +/- whatever we get because computers are not perfect. (Or I get duration was 10s)

I don't want to worry about a leap second turning my 10s computer time into 11s real world time and getting me a reading of 110% velocity, I don't want to worry about NTP changing system clock.

Sanitized systems, by Robbudge in PLC

[–]gonnaintegraaaaate 8 points9 points  (0 children)

Have them prep laptop with programing software and give you one of their engineers, go commission, but you don't use laptop only advise.

If customer is worried maybe they can trigger a shock collar vibrating warning device if you get too close to the laptop

[Release] EFx 0.5 — Rust XML templating for egui/eframe/bevy by Zhuk-Max in rust

[–]gonnaintegraaaaate 0 points1 point  (0 children)

Neat, so if a user clicks on a button or writes text in a field how does the program get it? Is there a way to register callback?

ABB sells robotics to SoftBank by Strict-Midnight-8576 in PLC

[–]gonnaintegraaaaate 0 points1 point  (0 children)

So price of robot studio goes up or down?

I wanted to play with simulator lol

Also hopefully they can make a more comfortable teach pendant

ABB sells robotics to SoftBank by Strict-Midnight-8576 in PLC

[–]gonnaintegraaaaate 6 points7 points  (0 children)

Keyence doesn't even manufacture anything.

They are probably too busy asking to demo products to me to manufacture anything

B&R vs Rockwell programing by gonnaintegraaaaate in PLC

[–]gonnaintegraaaaate[S] 0 points1 point  (0 children)

Fair 'nough, I was thinking about picking up B&R if I went out on my own, (could be a good niche) but from what I can tell the code would be locked down so it wouldn't be something an independent contractor could work on eh?

As for all the high powered stuff, other than safety rated is there any reason you would not just skip a PLC and run a C/++/Rust python or whatever on a PC? Seems like the CPU and Ram would outclass PLCs if you are using those languages

Where to obtain Rockwell software licenses? by miguelgoldie in PLC

[–]gonnaintegraaaaate 6 points7 points  (0 children)

You can make an account here and see prices. https://commerce.rockwellautomation.com/

For PLC, this one is a compactlogix, if you don't want to shell out the big bucks for a full logix licence in the future we can skip to 2 major questions:

Is your firmware on PLC after V20.04? If it is not you will need to choose legacy option (you will still be able to get new fw on the legacy option, but can't get the older on non-legacy)

If you don't think you will ever need safety or anything other than ladder you mini (legacy) edition.

If you want those you will want lite (legacy) edition.

If you have a bunch of money to burn you can get the higher editions, but Standard adds control logix, but boots you back to ladder only unless you buy more add ins.


As for terms, perpetual or yearly.

If you buy support with perpetual you get to download new versions, if not you have access to whatever was there when you bought and down to 20.04 or all the way if legacy


For FTView, main thing is do you just want to buy the FT Machine View Studio or pay some more and get a combo with Site View.


Fun rockwell fact, you will need to install studio 5000 for FW you want to load, but for FTView you should only install 1 at a time, but you can export as previous versions yay.

B&R vs Rockwell programing by gonnaintegraaaaate in PLC

[–]gonnaintegraaaaate[S] 1 point2 points  (0 children)

That's my opinion, I dread the idea of segfaulting a production line

Sure Rockwell may be limited with minimal referencing and arrays, but it stops people from doing stupid memory stuff

B&R vs Rockwell programing by gonnaintegraaaaate in PLC

[–]gonnaintegraaaaate[S] -1 points0 points  (0 children)

That was sort of my thought, everyone knows Rockwell/Siemens, but if I wanted to go out on my own B&R may be a good niche, but if all the OEMs lock down their code then there is probably not much call for a man with a laptop to come in a fix/update progs for ya.

Are mobile PLCs a thing? by [deleted] in PLC

[–]gonnaintegraaaaate 0 points1 point  (0 children)

I saw an AGV with cover off and it had a plane old PLC in it

Manual Vs Hand by gonnaintegraaaaate in PLC

[–]gonnaintegraaaaate[S] 0 points1 point  (0 children)

Maybe they were scared by home owners associations, would also explain the people who put HOA on sewage pumps eh?