Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: RBPLC on April 23, 2020, 01:29:33 PM
-
How difficult is it to add functionality to place structures within UDT's? For example, incorporating a TMR into a UDT.
-
Definitely looking to expand that functionality in a future version. It is not trivial. A includes B includes C etc.
One work around is to have multiple blocks where the index matches. Say you have a RecipeStruct
Create blocks called
Recipe 100 long Recipe Struct
RecTimer 100 long Timer Struct
RecCounter 100 long Counter Struct
RecPID 100 long PID Struct
where all the indexes match. Recipe5 goes with RecTimer5, RecCounter5, RecPID5. Auto-complete will help with entry since the prefix is the same on all the blocks (Rec).
It's a hack, but it can work. If you need multi-level nesting, that's a different story altogether.
-
Definitely looking to expand that functionality in a future version. It is not trivial. A includes B includes C etc.
One work around is to have multiple blocks where the index matches. Say you have a RecipeStruct
Create blocks called
Recipe 100 long Recipe Struct
RecTimer 100 long Timer Struct
RecCounter 100 long Counter Struct
RecPID 100 long PID Struct
where all the indexes match. Recipe5 goes with RecTimer5, RecCounter5, RecPID5. Auto-complete will help with entry since the prefix is the same on all the blocks (Rec).
It's a hack, but it can work. If you need multi-level nesting, that's a different story altogether.
That is exactly how we solved it ourselves, not as "clean" but very effective.
For HEAP items it can become a bit more of an oversight problem (Create each item, match names, etc.)
-
Has much progress been made in this area? I've got another project where structures in UDT's (not nested) would be very helpful.
-
Has much progress been made in this area? I've got another project where structures in UDT's (not nested) would be very helpful.
Sorry, no.
If you do something like the RecipeT Timer block, RecipeCT Counter block with your Recipe UDT block, all that is missing is the dot ;D
Recipe42.CookTemperature
RecipeT42.Acc vs. Recipe42.T.Acc
RecipeCT42.Acc vs. Recipe42.CT.Acc
Nested structures are non-trivial.
-
It's a good workaround. Starts to break down if you need more than one time or counter per recipe, etc. Then you have to have RecTimer1[0..99] and RecTimer2[0..99], or start doing index math, etc. Generally a good approach but will still be happy when we can nest em! :)
-
Now that the functionality is available for structures in UDTs, can I easily convert all of my helper timer data blocks to get them in my UDTs.
MaintTimerBlock -->Main.tTimerBlock
I was attempting to do this with replace, but I have to use the "exact match" option. Unfortunately, I see that this didn't convert MaintTimerBlock.done --> Main.tTimerBock.done
-
Maybe export the code, search and replace outside & reimport.
-
Maybe export the code, search and replace outside & reimport.
I tried that and I get a boatload of errors trying to re-import.
-
I was able to duplicate it. It should be easy to fix.
-
I was able to duplicate it. It should be easy to fix.
I'm seeing "P1 Bit: ID is missing" and the like.
-
Now that the functionality is available for structures in UDTs, can I easily convert all of my helper timer data blocks to get them in my UDTs.
MaintTimerBlock -->Main.tTimerBlock
I was attempting to do this with replace, but I have to use the "exact match" option. Unfortunately, I see that this didn't convert MaintTimerBlock.done --> Main.tTimerBock.done
This what I can duplicate in that you are forced to check Exact Match. Once that limitation is removed for whole nested structures, it should work.
I do not see the "P1 bit" issue you mentioned. Please provide exact steps to duplicate that.
-
Now that the functionality is available for structures in UDTs, can I easily convert all of my helper timer data blocks to get them in my UDTs.
MaintTimerBlock -->Main.tTimerBlock
I was attempting to do this with replace, but I have to use the "exact match" option. Unfortunately, I see that this didn't convert MaintTimerBlock.done --> Main.tTimerBock.done
This what I can duplicate in that you are forced to check Exact Match. Once that limitation is removed for whole nested structures, it should work.
I do not see the "P1 bit" issue you mentioned. Please provide exact steps to duplicate that.
I think I messed up the copy/replace is why I'm getting the errors. I'll look it over again and let you know. It would still be easier to do this natively in DmD if possible.
-
I was able to duplicate it. It should be easy to fix.
Fixed. Will be out in Designer 2.9.3
-
Now that the functionality is available for structures in UDTs, can I easily convert all of my helper timer data blocks to get them in my UDTs.
MaintTimerBlock -->Main.tTimerBlock
I was attempting to do this with replace, but I have to use the "exact match" option. Unfortunately, I see that this didn't convert MaintTimerBlock.done --> Main.tTimerBock.done
I tried this again after updating to 2.9.4 and the .done is still not replaced.
-
I tried this again after updating to 2.9.4 and the .done is still not replaced.
Hmm... Please provide the steps to duplicate.
In 2.9.4, I tried the following.
I had 2 structures, one a block of Timers called MaintTimer that was a Timer Struct block, and another block of a UDT MaintStruct called Maint that contained a nested Timer struct field called tTimer.
1. I had logic that used MaintTimer6.Done and MaintTimer6.Acc (see attachment MaintTimer1.png)
2. I brought up the Replace dialog to replace the Timer structure MaintTimer6 with the nested Timer structure Maint6.tTimer, keeping the Match Exactly UNchecked (see attachment MaintTimer2.png)
3. It properly replaced the MaintTimer6.Done and MaintTimer6.Acc elements with Maint6.tTimer.Done and Maint6.tTimer.Acc, respectively (see attachment MaintTimer3.png). This was not do-able when 2.9 first shipped (2.9.1).
Let me know any details of what you are seeing.
-
You like 3D??? :-\
-
I'm noticing some Replace issues with nested structures. I can replace Machine1 with Machine2 no problem, as long as Machine1 does not consist of any sub-structures. However, when I try to Replace Machine1.Sensor1 with Machine1.Sensor2 or Machine2.Sensor1 it does not replace anything, no messages or popups. Sensor1 is a sub-structure.
-
I'm noticing some Replace issues with nested structures. I can replace Machine1 with Machine2 no problem, as long as Machine1 does not consist of any sub-structures. However, when I try to Replace Machine1.Sensor1 with Machine1.Sensor2 or Machine2.Sensor1 it does not replace anything, no messages or popups. Sensor1 is a sub-structure.
With 2.9.4, I was able to replace a relational contact with nested structures
MyDeep4.FieldA.MyReal = MyDeep5.FieldB.MyReal2
and replace
MyDeep4.FieldA
with
MyDeep6.FieldB
(i.e. I replaced both the main structure element and the substructure element)
Pre-replace:
STRE MyDeep4.FieldA.MyReal MyDeep5.FieldB.MyReal2
Replace MyDeep4.FieldA with MyDeep6.FieldB (UNchecked Match Exactly):
STRE MyDeep6.FieldB.MyReal MyDeep5.FieldB.MyReal2
Here are my UDTs:
#BEGIN UDT_CONFIG
MyStruct
// Field Name, Data Type, Memory Layout, Read/Write, Display Format, Data View Detail
BaseKey, SDWORD, 0:0, Read-Write, Native, Short
BitA, BIT, 1:0, Read-Write, Native, Short
BitB, BIT, 1:1, Read-Write, Native, No
BitC, BIT, 1:2, Read-Write, Native, Long
SByteA, SBYTE, 1:1, Read-Write, Native, Short
SByteB, SBYTE, 1:2, Read-Write, Native, No
SByteC, SBYTE, 1:3, Read-Write, Native, Long
MyReal, REAL, 2:0, Read-Write, Native, Short
MyReal1, REAL, 3:0, Read-Write, Native, No
MyReal2, REAL, 4:0, Read-Write, Native, No
MyReal3, REAL, 5:0, Read-Write, Native, No
MyReal4, REAL, 6:0, Read-Write, Native, No
MyReal5, REAL, 7:0, Read-Write, Native, No
MyReal6, REAL, 8:0, Read-Write, Native, No
MyReal7, REAL, 9:0, Read-Write, Native, No
MyReal8, REAL, 10:0, Read-Write, Native, No
MyReal9, REAL, 11:0, Read-Write, Native, Long
MyDeepStruct
// Field Name, Data Type, Memory Layout, Read/Write, Display Format, Data View Detail
MyStringA, STRING16, 0:0, Read-Write, Native, Short
FieldA, MyStruct, 5:0, Read-Write, Native, Short
MyStringB, STRING32, 17:0, Read-Write, Native, No
Key, SDWORD, 26:0, Read-Write, Native, Short
FieldB, MyStruct, 27:0, Read-Write, Native, Long
MyStringC, STRING8, 39:0, Read-Write, Native, Long
#END
Copy a single rung having the issue, then paste the clip of a rung of your code (you can remove the SYSCONFIG section, but keep the blocks and UDT details), along with details of what you're replacing, I can try to duplicate it. If you'd rather email, send it to support at hosteng.com with details on how to duplicate it, we can definitely look at it. There could be an issue with a specific instruction (e.g. it works in a relational contact, but not in an INIT instruction). It's almost always true that if we can duplicate it, we can fix it.
-
Well, I imported your structures into a new project, and it worked as you said. Then I copied and pasted some of my program's INIT instructions into the new project, and Replace worked fine there. Copied some contacts and MATH instructions over, it still worked, even when limiting it to a specific rung. Go back to my original project, and try some rung specific replaces there, and it works as well. Now I'm thoroughly confused. Thought it maybe isn't working without first Accepting changes, nope that still works. It even lets me replace "up" a level, from My1.Deep.Element to My1Deep.Element, if structures match, of course, as expected.
I don't understand. I've tried to replace structures dozens of times these last few days, and manually changed hundreds of structure entries because of it not working. Even tried to do it with help of text editor, but that was more trouble than it's worth. Now, I'm pretty much done, and it works as expected.
Thanks for looking into it. I promise I'm not crazy...
-
Software does exactly what you tell it to do, not necessarily what you want it to do. Trust me, there is some explanation for the behavior you saw, including possible settings in the Replace dialog.
Do you use Locked code blocks (where you give a specific code block a password)? Replace will only replace code that is in a locked password protected code block when it is UNlocked (i.e. you've entered the password to allow viewing/editing). There is no message that the Replace operation skipped over the locked code block, we don't want anyone knowing anything about a locked code block (other than the fact it exists) - secure is secure is secure.
Also realize this issue was fixed after the initial 2.9 shipped (2.9.3?), so if you have multiple PCs/laptops (e.g. one in your office, a laptop on the factory floor, etc.), possibly you were trying it on an "old" 2.9 version?
Regardless, glad it's working!